Browse Source

new states shorcuts bis

Bastien Sevajol 9 years ago
parent
commit
2707fc5993

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

@@ -5,7 +5,7 @@ from intelligine.cst import CANT_CARRY_STILL, TRANSPORTER, ALIVE
5 5
 class CycleEvent(Event):
6 6
 
7 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 10
     def _object_match(self, object_id, context, parameters):
11 11
         return True

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

@@ -6,7 +6,7 @@ from intelligine.cst import ATTACKER, ATTACKABLE, COLONY, ALIVE
6 6
 class NearAttackableEvent(Event):
7 7
 
8 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 11
     def __init__(self, actions):
12 12
         super().__init__(actions)
@@ -16,7 +16,7 @@ class NearAttackableEvent(Event):
16 16
         # TODO: nettoyer
17 17
         obj_colony_id = context.metas.value.get(COLONY, object_id)
18 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 20
                 if obj_colony_id != context.metas.value.get(COLONY, obj_near_id):
21 21
                     if 'objects_ids_attackable' not in parameters:
22 22
                         parameters['objects_ids_attackable'] = []

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

@@ -53,7 +53,7 @@ class MoveAction(Action):
53 53
     def _direction_point_is_possible(self, context, direction_point):
54 54
         objects_ids_on_this_point = context.metas.list.get(POSITIONS, direction_point, allow_empty=True)
55 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 57
             return False
58 58
         return True
59 59
 

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

@@ -6,7 +6,7 @@ from intelligine.cst import ALIVE, WALKER
6 6
 class MoveEvent(Event):
7 7
 
8 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 11
     def __init__(self, actions):
12 12
         super().__init__(actions)

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

@@ -6,5 +6,5 @@ from intelligine.cst import TRANSPORTER, ALIVE, CARRYING, CANT_PUT_STILL
6 6
 class PutableEvent(TakeableEvent):
7 7
 
8 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 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,8 +6,8 @@ from intelligine.cst import TRANSPORTABLE, TRANSPORTER, ALIVE, CARRYING, CANT_CA
6 6
 class TakeableEvent(Event):
7 7
 
8 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 11
                context.metas.value.get(CANT_CARRY_STILL, object_id, allow_empty=True)
12 12
 
13 13
     def __init__(self, actions):
@@ -17,7 +17,7 @@ class TakeableEvent(Event):
17 17
     def _object_match(self, object_id, context, parameters={}):
18 18
         # TODO: Nettoyer (refact possible sur ces objets ont tel states, comme dans concern)
19 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 21
                 if 'objects_ids_transportable' not in parameters:
22 22
                     parameters['objects_ids_transportable'] = []
23 23
                 parameters['objects_ids_transportable'].append(obj_near_id)