Skip to content

Commit 5d02ac5

Browse files
committed
Simplify act method
No need to pass all those extra parameters anymore
1 parent 2ee949b commit 5d02ac5

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
lines changed

src/herculeum/ai/firebeetle.hy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[pyherc.data.geometry [in-area area-4-around]]
3737
[pyherc.ai [a-star :as a* show-alert-icon show-confusion-icon]])
3838

39-
(defstatemachine FireBeetleAI [model action-factory rng]
39+
(defstatemachine FireBeetleAI []
4040
"AI routine for rats"
4141
(--init-- [character] (state character character))
4242

src/herculeum/ai/rat.hy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[pyherc.ai [a-star :as a* show-alert-icon show-confusion-icon]])
3737

3838

39-
(defstatemachine RatAI [model action-factory rng]
39+
(defstatemachine RatAI []
4040
"AI routine for rats"
4141
(--init-- [character] (state character character))
4242

src/herculeum/ui/gui/map.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,7 @@ def keyPressEvent(self, event): #pylint: disable-msg=C0103
431431
while (next_creature != player
432432
and next_creature is not None
433433
and self.model.end_condition == 0):
434-
next_creature.act(model = self.model,
435-
action_factory = self.action_factory,
436-
rng = self.rng)
434+
next_creature.act()
437435
next_creature = self.model.get_next_creature(self.rules_engine)
438436

439437
if next_creature is None:

src/herculeum/ui/text/map.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ def show(self):
101101
if next_creature == player:
102102
self._handle_player_input()
103103
elif next_creature is not None:
104-
next_creature.act(model = self.model,
105-
action_factory = self.action_factory,
106-
rng = self.rng)
104+
next_creature.act()
107105
else:
108106
self.model.end_condition = DIED_IN_DUNGEON
109107

src/pyherc/data/character.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,11 @@ def notify_update_listeners(self, event):
166166

167167
# @guarded_action
168168
@log_info
169-
def act(self, model, action_factory, rng):
169+
def act(self):
170170
"""
171171
Triggers AI of this character
172-
173-
:param model: model where character is located
174-
:type model: Model
175-
:param action_factory: factory for creating actions
176-
:type action_factory: ActionFactory
177-
:param rng: random number generator
178-
:type rng: Random
179172
"""
180-
self.artificial_intelligence(model,
181-
action_factory,
182-
rng)
173+
self.artificial_intelligence()
183174

184175
def __get_hp(self):
185176
"""

0 commit comments

Comments
 (0)