NearAttackableAction.py 667B

123456789101112131415161718192021
  1. from synergine.synergy.event.Action import Action
  2. from intelligine.synergy.event.attack.NearAttackableEvent import NearAttackableEvent
  3. from random import randint
  4. class NearAttackableAction(Action):
  5. _listen = NearAttackableEvent
  6. def __init__(self, object_id, parameters):
  7. super().__init__(object_id, parameters)
  8. def prepare(self, context):
  9. pass
  10. def run(self, obj, context, synergy_manager):
  11. # TODO: reprendre ?
  12. for obj_id_attackable in self._parameters['objects_ids_attackable']:
  13. obj_attackable = synergy_manager.get_map().get_object(obj_id_attackable)
  14. obj_attackable.hurted(randint(0, 2))