Convert the passive healing clock to a more granular tick mechanism
Instead of counting turns, count clock ticks. A WaitAction adds 10 ticks to the passive healing clock and a WalkAction adds 5. So, you will heal while walking but at a slower rate.
This commit is contained in:
parent
31bec25dcf
commit
99838cbd00
2 changed files with 34 additions and 13 deletions
|
@ -182,6 +182,13 @@ class WalkAction(MoveAction):
|
|||
log.ACTIONS.debug('Moving %s to %s', self.actor, new_position)
|
||||
self.actor.position = new_position
|
||||
|
||||
try:
|
||||
should_recover_hit_points = self.actor.fighter.passively_recover_hit_points(5)
|
||||
if should_recover_hit_points:
|
||||
return ActionResult(self, alternate=HealAction(self.actor, 1))
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return self.success()
|
||||
|
||||
class MeleeAction(MoveAction):
|
||||
|
@ -223,7 +230,7 @@ class WaitAction(Action):
|
|||
log.ACTIONS.debug('%s is waiting a turn', self.actor)
|
||||
|
||||
if self.actor == engine.hero:
|
||||
should_recover_hit_points = self.actor.fighter.passively_recover_hit_points()
|
||||
should_recover_hit_points = self.actor.fighter.passively_recover_hit_points(10)
|
||||
if should_recover_hit_points:
|
||||
return ActionResult(self, alternate=HealAction(self.actor, 1))
|
||||
|
||||
|
@ -273,4 +280,4 @@ class HealAction(Action):
|
|||
|
||||
fighter.hit_points += self.hit_points_to_recover
|
||||
|
||||
return self.success()
|
||||
return self.success()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue