NearAttackableAction.run()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 2
1
from synergine.synergy.event.Action import Action
2
from intelligine.synergy.event.attack.NearAttackableEvent import NearAttackableEvent
3
from random import randint
4
5
6
class NearAttackableAction(Action):
7
8
    _listen = NearAttackableEvent
9
10
    def __init__(self, object_id, parameters):
11
        super().__init__(object_id, parameters)
12
13
    def prepare(self, context):
14
        pass
15
16
    def run(self, obj, context, synergy_manager):
17
        # TODO: reprendre ?
18
        for obj_id_attackable in self._parameters['objects_ids_attackable']:
19
            obj_attackable = synergy_manager.get_map().get_object(obj_id_attackable)
20
            obj_attackable.hurted(randint(0, 2))
21