Skip to content

Commit

Permalink
Fix bug:
Browse files Browse the repository at this point in the history
* #4
  • Loading branch information
shinoi2 committed Dec 13, 2023
1 parent e52b863 commit 3608174
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 4 additions & 2 deletions fireplace/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,19 @@ def _broadcast(self, entity, source, at, *args):
entity.trigger_event(source, event, args)

def broadcast(self, source, at, *args):
source.game.action_start(BlockType.TRIGGER, source, 0, None)

for entity in source.game.entities:
self._broadcast(entity, source, at, *args)

for hand in source.game.hands:
for entity in hand.entities:
self._broadcast(entity, source, at, *args)

for deck in source.game.decks:
for entity in deck.entities:
self._broadcast(entity, source, at, *args)

source.game.action_end(BlockType.TRIGGER, source)

def queue_broadcast(self, obj, args):
self.event_queue.append((obj, args))

Expand Down
18 changes: 17 additions & 1 deletion tests/test_classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3755,7 +3755,7 @@ def test_mirror_entity_aura():
# https://github.com/jleclanche/fireplace/issues/221
game = prepare_game()
game.end_turn()
game.player2.give("CS2_222").play() # Stormwind Champion
game.player2.give("CS2_222").play()
game.end_turn()

mirror = game.player1.give("EX1_294")
Expand Down Expand Up @@ -3794,3 +3794,19 @@ def test_stormwind_champion_heal():
game.player2.give(FIREBALL).play(target=stormwind)
assert goldshire.atk == 1
assert goldshire.health == 2


def test_gruul_ragnaros():
# https://github.com/jleclanche/fireplace/issues/4
# Firelord may damage your opponent's Gruul to 8/0 but the Phase is not over
# Gruul triggers and buffs himself to 9/1, and survives the Phase.
game = prepare_game()
gruul = game.player1.give("NEW1_038").play()
game.end_turn()
assert gruul.atk == 8
assert gruul.health == 8
game.player2.give("EX1_298").play()
game.end_turn()
assert len(game.player1.field) == 1
assert gruul.atk == 9
assert (gruul.damage == 8) ^ (game.player1.hero.damage == 8)

0 comments on commit 3608174

Please sign in to comment.