Skip to content

Commit

Permalink
Rewrite shaman upgraded hero power, now it similars to choose one
Browse files Browse the repository at this point in the history
  • Loading branch information
shinoi2 committed Mar 28, 2024
1 parent 2709aca commit f8792bc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
10 changes: 8 additions & 2 deletions fireplace/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,10 @@ def play(self, target=None, index=None, choose=None):
"""
if choose:
if self.must_choose_one:
choose = card = self.choose_cards.filter(id=choose)[0]
if choose in self.choose_cards:
card = choose
else:
choose = card = self.choose_cards.filter(id=choose)[0]
self.log("%r: choosing %r", self, choose)
else:
raise InvalidAction("%r cannot be played with choice %r" % (self, choose))
Expand Down Expand Up @@ -1419,7 +1422,10 @@ def get_heal(self, amount, target):
def use(self, target=None, choose=None):
if choose:
if self.must_choose_one:
choose = card = self.choose_cards.filter(id=choose)[0]
if choose in self.choose_cards:
card = choose
else:
choose = card = self.choose_cards.filter(id=choose)[0]
self.log("%r: choosing %r", self, choose)
else:
raise InvalidAction("%r cannot be played with choice %r" % (self, choose))
Expand Down
13 changes: 5 additions & 8 deletions fireplace/cards/tgt/upgraded_hero_powers.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ class AT_132_WARLOCKb(AT_132_WARLOCK):
class AT_132_SHAMAN:
"""Totemic Slam"""
requirements = {PlayReq.REQ_NUM_MINION_SLOTS: 1}
activate = Choice(
CONTROLLER,
["AT_132_SHAMANa", "AT_132_SHAMANb", "AT_132_SHAMANc", "AT_132_SHAMANd"]
).then(Battlecry(Choice.CARD, None))
choose = ("AT_132_SHAMANa", "AT_132_SHAMANb", "AT_132_SHAMANc", "AT_132_SHAMANd")


class CS2_049_H1_AT_132(AT_132_SHAMAN):
Expand All @@ -155,19 +152,19 @@ class CS2_049_H3_AT_132(AT_132_SHAMAN):

class AT_132_SHAMANa:
"""Healing Totem"""
play = Summon(CONTROLLER, "NEW1_009")
activate = Summon(CONTROLLER, "NEW1_009")


class AT_132_SHAMANb:
"""Searing Totem"""
play = Summon(CONTROLLER, "CS2_050")
activate = Summon(CONTROLLER, "CS2_050")


class AT_132_SHAMANc:
"""Stoneclaw Totem"""
play = Summon(CONTROLLER, "CS2_051")
activate = Summon(CONTROLLER, "CS2_051")


class AT_132_SHAMANd:
"""Wrath of Air Totem"""
play = Summon(CONTROLLER, "CS2_052")
activate = Summon(CONTROLLER, "CS2_052")
2 changes: 1 addition & 1 deletion tests/test_carddb.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
def test_play_scripts():
for card in CARDS.values():
if card.scripts.activate:
assert card.type in (CardType.HERO_POWER, CardType.SPELL)
assert card.type in (CardType.HERO_POWER, CardType.SPELL, CardType.MINION)
elif card.scripts.play:
assert card.type not in (CardType.HERO_POWER, CardType.ENCHANTMENT)

Expand Down
5 changes: 2 additions & 3 deletions tests/test_hero_powers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ def test_healing_totem():
def test_shaman_upgrade():
game = prepare_game(CardClass.SHAMAN, CardClass.SHAMAN)
game.player1.give("AT_132").play()
game.player1.hero.power.use()
choice = game.player1.choice
choice.choose(choice.cards[0])
power = game.player1.hero.power
power.use(choose=power.choose_cards[0])
assert game.player1.field == ["AT_132", "NEW1_009"]


Expand Down

0 comments on commit f8792bc

Please sign in to comment.