association_pouvoirs.gd 594 B

123456789101112131415161718192021222324252627282930
  1. class_name Pouvoir
  2. enum Type {
  3. AUCUN, # si pas de pouvoir, laisser en premier
  4. FEU,
  5. VIE,
  6. RALENTIR,
  7. JAVELOT,
  8. BONJOUR # laisser en dernier
  9. }
  10. static func fabriquer(type: Type): # -> PouvoirBase
  11. match type:
  12. Type.BONJOUR:
  13. return BonjourPouvoir.new()
  14. Type.FEU:
  15. return PouvoirFeu.new()
  16. Type.VIE:
  17. return VieBonus.new()
  18. Type.RALENTIR:
  19. return RalentirPouvoir.new()
  20. Type.JAVELOT:
  21. return JavelotPouvoir.new()
  22. Type.AUCUN:
  23. return null
  24. _:
  25. assert(false, "Le nouveau pouvoir doit etre associe a son type " + str(type))
  26. return null # sinon compilateur pas content