Skip to content

Commit

Permalink
fix issue: #126
Browse files Browse the repository at this point in the history
  • Loading branch information
shinoi2 committed Dec 14, 2023
1 parent d9d9612 commit 8cc6b77
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
20 changes: 19 additions & 1 deletion fireplace/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,20 @@ class Death(GameAction):
"""
ENTITY = ActionArg()

def _broadcast(self, entity, source, at, *args):
# https://github.com/jleclanche/fireplace/issues/126
target = args[0]
if (not self.triggered_dearattle) and entity.play_counter > target.play_counter:
self.triggered_dearattle = True
if target.deathrattles:
source.game.queue_actions(target.controller, [Deathrattle(target)])
return super()._broadcast(entity, source, at, *args)

def do(self, source, target):
log.info("Processing Death for %r", target)
self.triggered_dearattle = False
self.broadcast(source, EventListener.ON, target)
if target.deathrattles:
if (not self.triggered_dearattle) and target.deathrattles:
source.game.queue_actions(target.controller, [Deathrattle(target)])


Expand Down Expand Up @@ -1316,6 +1326,14 @@ def do(self, source, target, cards):
continue
if card.controller != target:
card.controller = target
# Poisoned Blade
if (
card.controller.weapon and
card.controller.weapon.id == "AT_034" and
source.type == CardType.HERO_POWER and
card.type == CardType.WEAPON
):
continue
if card.zone != Zone.PLAY:
if source.type == CardType.MINION and source.zone == Zone.PLAY:
source_index = source.controller.field.index(source)
Expand Down
2 changes: 1 addition & 1 deletion fireplace/cards/classic/rogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class CS2_083b:
"""Dagger Mastery"""
activate = Find(FRIENDLY_WEAPON + ID("AT_034")) | Summon(CONTROLLER, "CS2_082")
activate = Summon(CONTROLLER, "CS2_082")


# Sharpened (Unused)
Expand Down
21 changes: 21 additions & 0 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,24 @@ def test_silence():
assert minion.health == 4
game.player1.give("CS2_203").play(target=minion)
assert minion.health == 4


def test_anubar_ambusher_cult_master():
# https://github.com/jleclanche/fireplace/issues/126
game = prepare_game()
game.player1.discard_hand()
cultmaster1 = game.player1.summon("EX1_595")
ambusher1 = game.player1.summon("FP1_026")
assert len(game.player1.hand) == 0
ambusher1.destroy()
assert len(game.player1.hand) == 2
assert cultmaster1 in game.player1.hand
game.end_turn(); game.end_turn()

game.player1.discard_hand()
ambusher2 = game.player1.summon("FP1_026")
cultmaster2 = game.player1.summon("EX1_595")
assert len(game.player1.hand) == 0
ambusher2.destroy()
assert len(game.player1.hand) == 1
assert cultmaster2 in game.player1.hand
9 changes: 9 additions & 0 deletions tests/test_tgt.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,3 +869,12 @@ def test_arcane_blast():
game.player1.field[-1].destroy()
game.player1.give("AT_004").play(target=minion)
assert minion.damage == 2 + 4 + 6 + 4


def test_poisoned_blade():
game = prepare_game(CardClass.ROGUE, CardClass.ROGUE)
blade = game.player1.give("AT_034").play()
atk = blade.atk
game.player1.hero.power.use()
assert game.player1.weapon.id == "AT_034"
assert game.player1.weapon.atk == atk + 1

0 comments on commit 8cc6b77

Please sign in to comment.