Browse Source

new states shorcuts bis

Bastien Sevajol 9 years ago
parent
commit
2707fc5993

+ 1 - 1
intelligine/synergy/event/CycleEvent.py View File

5
 class CycleEvent(Event):
5
 class CycleEvent(Event):
6
 
6
 
7
     def concern(self, object_id, context):
7
     def concern(self, object_id, context):
8
-        return context.metas.states.have(object_id, [TRANSPORTER, ALIVE])
8
+        return context.metas.states.have_list(object_id, [TRANSPORTER, ALIVE])
9
 
9
 
10
     def _object_match(self, object_id, context, parameters):
10
     def _object_match(self, object_id, context, parameters):
11
         return True
11
         return True

+ 2 - 2
intelligine/synergy/event/attack/NearAttackableEvent.py View File

6
 class NearAttackableEvent(Event):
6
 class NearAttackableEvent(Event):
7
 
7
 
8
     def concern(self, object_id, context):
8
     def concern(self, object_id, context):
9
-        return context.metas.states.have(object_id, [ATTACKER, ALIVE])
9
+        return context.metas.states.have_list(object_id, [ATTACKER, ALIVE])
10
 
10
 
11
     def __init__(self, actions):
11
     def __init__(self, actions):
12
         super().__init__(actions)
12
         super().__init__(actions)
16
         # TODO: nettoyer
16
         # TODO: nettoyer
17
         obj_colony_id = context.metas.value.get(COLONY, object_id)
17
         obj_colony_id = context.metas.value.get(COLONY, object_id)
18
         for obj_near_id in parameters['objects_ids_near']:
18
         for obj_near_id in parameters['objects_ids_near']:
19
-            if context.metas.states.have(obj_near_id, [ATTACKABLE]):
19
+            if context.metas.states.have(obj_near_id, ATTACKABLE):
20
                 if obj_colony_id != context.metas.value.get(COLONY, obj_near_id):
20
                 if obj_colony_id != context.metas.value.get(COLONY, obj_near_id):
21
                     if 'objects_ids_attackable' not in parameters:
21
                     if 'objects_ids_attackable' not in parameters:
22
                         parameters['objects_ids_attackable'] = []
22
                         parameters['objects_ids_attackable'] = []

+ 1 - 1
intelligine/synergy/event/move/MoveAction.py View File

53
     def _direction_point_is_possible(self, context, direction_point):
53
     def _direction_point_is_possible(self, context, direction_point):
54
         objects_ids_on_this_point = context.metas.list.get(POSITIONS, direction_point, allow_empty=True)
54
         objects_ids_on_this_point = context.metas.list.get(POSITIONS, direction_point, allow_empty=True)
55
         for object_id_on_this_point in objects_ids_on_this_point:
55
         for object_id_on_this_point in objects_ids_on_this_point:
56
-          if context.metas.states.have(object_id_on_this_point, [IMPENETRABLE]):
56
+          if context.metas.states.have(object_id_on_this_point, IMPENETRABLE):
57
             return False
57
             return False
58
         return True
58
         return True
59
 
59
 

+ 1 - 1
intelligine/synergy/event/move/MoveEvent.py View File

6
 class MoveEvent(Event):
6
 class MoveEvent(Event):
7
 
7
 
8
     def concern(self, object_id, context):
8
     def concern(self, object_id, context):
9
-        return context.metas.states.have(object_id, [ALIVE, WALKER])
9
+        return context.metas.states.have_list(object_id, [ALIVE, WALKER])
10
 
10
 
11
     def __init__(self, actions):
11
     def __init__(self, actions):
12
         super().__init__(actions)
12
         super().__init__(actions)

+ 1 - 1
intelligine/synergy/event/transport/PutableEvent.py View File

6
 class PutableEvent(TakeableEvent):
6
 class PutableEvent(TakeableEvent):
7
 
7
 
8
     def concern(self, object_id, context):
8
     def concern(self, object_id, context):
9
-        return context.metas.states.have(object_id, [TRANSPORTER, ALIVE, CARRYING]) \
9
+        return context.metas.states.have_list(object_id, [TRANSPORTER, ALIVE, CARRYING]) \
10
                and not context.metas.value.get(CANT_PUT_STILL, object_id, allow_empty=True)
10
                and not context.metas.value.get(CANT_PUT_STILL, object_id, allow_empty=True)

+ 3 - 3
intelligine/synergy/event/transport/TakeableEvent.py View File

6
 class TakeableEvent(Event):
6
 class TakeableEvent(Event):
7
 
7
 
8
     def concern(self, object_id, context):
8
     def concern(self, object_id, context):
9
-        return context.metas.states.have(object_id, [TRANSPORTER, ALIVE]) and \
10
-               context.metas.states.dont_have(object_id, [CARRYING]) and not \
9
+        return context.metas.states.have_list(object_id, [TRANSPORTER, ALIVE]) and \
10
+               context.metas.states.dont_have(object_id, CARRYING) and not \
11
                context.metas.value.get(CANT_CARRY_STILL, object_id, allow_empty=True)
11
                context.metas.value.get(CANT_CARRY_STILL, object_id, allow_empty=True)
12
 
12
 
13
     def __init__(self, actions):
13
     def __init__(self, actions):
17
     def _object_match(self, object_id, context, parameters={}):
17
     def _object_match(self, object_id, context, parameters={}):
18
         # TODO: Nettoyer (refact possible sur ces objets ont tel states, comme dans concern)
18
         # TODO: Nettoyer (refact possible sur ces objets ont tel states, comme dans concern)
19
         for obj_near_id in parameters['objects_ids_near']:
19
         for obj_near_id in parameters['objects_ids_near']:
20
-            if context.metas.states.have(obj_near_id, [TRANSPORTABLE]):
20
+            if context.metas.states.have(obj_near_id, TRANSPORTABLE):
21
                 if 'objects_ids_transportable' not in parameters:
21
                 if 'objects_ids_transportable' not in parameters:
22
                     parameters['objects_ids_transportable'] = []
22
                     parameters['objects_ids_transportable'] = []
23
                 parameters['objects_ids_transportable'].append(obj_near_id)
23
                 parameters['objects_ids_transportable'].append(obj_near_id)