Browse Source

set subject behavior selector

Bastien Sevajol 7 years ago
parent
commit
1eb8a1625b
1 changed files with 13 additions and 2 deletions
  1. 13 2
      opencombat/simulation/subject.py

+ 13 - 2
opencombat/simulation/subject.py View File

1
 # coding: utf-8
1
 # coding: utf-8
2
+import typing
3
+
4
+from synergine2.simulation import SubjectBehaviourSelector, SubjectBehaviour
5
+
2
 from opencombat.const import COLLECTION_ALIVE
6
 from opencombat.const import COLLECTION_ALIVE
3
 from opencombat.const import COMBAT_MODE_DEFENSE
7
 from opencombat.const import COMBAT_MODE_DEFENSE
4
 from opencombat.simulation.base import BaseSubject
8
 from opencombat.simulation.base import BaseSubject
8
 from synergine2.share import shared
12
 from synergine2.share import shared
9
 
13
 
10
 
14
 
15
+class TileBehaviourSelector(SubjectBehaviourSelector):
16
+    def reduce_behaviours(
17
+        self,
18
+        behaviours: typing.Dict[typing.Type[SubjectBehaviour], object],
19
+    ) -> typing.Dict[typing.Type[SubjectBehaviour], object]:
20
+        return behaviours
21
+
22
+
11
 class TileSubject(BaseSubject):
23
 class TileSubject(BaseSubject):
12
     start_collections = [
24
     start_collections = [
13
         COLLECTION_ALIVE,
25
         COLLECTION_ALIVE,
19
     ]
31
     ]
20
     visible_opponent_ids = shared.create_self('visible_opponent_ids', lambda: [])
32
     visible_opponent_ids = shared.create_self('visible_opponent_ids', lambda: [])
21
     combat_mode = shared.create_self('combat_mode', COMBAT_MODE_DEFENSE)
33
     combat_mode = shared.create_self('combat_mode', COMBAT_MODE_DEFENSE)
22
-    # TODO: implement (copied from engulf)
23
-    # behaviour_selector_class = CellBehaviourSelector
34
+    behaviour_selector_class = TileBehaviourSelector