NearAttackableAction   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
dl 0
loc 15
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A prepare() 0 2 1
A __init__() 0 2 1
A run() 0 5 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