Skip to content
Permalink
Browse files

Move entity death preparation logic to Game._schedule_death()

  • Loading branch information...
jleclanche committed Jul 10, 2015
1 parent 7173a6a commit 23ca9a8a33c2a308aa6f92a54dfe8474cd38ee48
Showing with 17 additions and 8 deletions.
  1. +17 −8 fireplace/game.py
@@ -128,20 +128,29 @@ def process_deaths(self):
actions = []
for card in self.live_entities:
if card.to_be_destroyed:
actions.append(Death(card))
card.ignore_events = True
if card.type == CardType.MINION:
self.minions_killed.append(card)
self.minions_killed_this_turn.append(card)
card.controller.minions_killed_this_turn += 1
elif card.type == CardType.HERO:
card.controller.playstate = PlayState.LOSING
actions += self._schedule_death(card)

self.check_for_end_game()

if actions:
self.queue_actions(self, actions)

def _schedule_death(self, card):
"""
Prepare a card for its death. Will run any related Death
trigger attached to the Game object.
Returns a list of actions to perform during the death sweep.
"""
card.ignore_events = True
if card.type == CardType.MINION:
self.minions_killed.append(card)
self.minions_killed_this_turn.append(card)
card.controller.minions_killed_this_turn += 1
elif card.type == CardType.HERO:
card.controller.playstate = PlayState.LOSING

return [Death(card)]

def queue_actions(self, source, actions):
"""
Queue a list of \a actions for processing from \a source.

0 comments on commit 23ca9a8

Please sign in to comment.
You can’t perform that action at this time.