Browse Source

set subject behavior selector

Bastien Sevajol 6 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,4 +1,8 @@
1 1
 # coding: utf-8
2
+import typing
3
+
4
+from synergine2.simulation import SubjectBehaviourSelector, SubjectBehaviour
5
+
2 6
 from opencombat.const import COLLECTION_ALIVE
3 7
 from opencombat.const import COMBAT_MODE_DEFENSE
4 8
 from opencombat.simulation.base import BaseSubject
@@ -8,6 +12,14 @@ from opencombat.simulation.behaviour import LookAroundBehaviour
8 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 23
 class TileSubject(BaseSubject):
12 24
     start_collections = [
13 25
         COLLECTION_ALIVE,
@@ -19,5 +31,4 @@ class TileSubject(BaseSubject):
19 31
     ]
20 32
     visible_opponent_ids = shared.create_self('visible_opponent_ids', lambda: [])
21 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