Skip to content

Commit

Permalink
Fix bugs: (#517)
Browse files Browse the repository at this point in the history
* Play hero card, keep buff and damage
* Wrathion draws util isn't dragon card
* default language to enUS
  • Loading branch information
shinoi2 authored Jan 11, 2024
1 parent 62b45c9 commit d1aafff
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 18 deletions.
16 changes: 16 additions & 0 deletions fireplace/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,22 @@ def _hit(self, amount):

def play(self, target=None, index=None, choose=None):
armor = self.armor

# Copy hero buff
for buff in self.controller.hero.buffs:
# Recreate the buff stack
new_buff = self.controller.card(buff.id)
new_buff.source = buff.source
attributes = ["atk", "max_health", "_xatk", "_xhealth", "_xcost", "store_card"]
for attribute in attributes:
if hasattr(buff, attribute):
setattr(new_buff, attribute, getattr(buff, attribute))
new_buff.apply(self)
if buff in self.game.active_aura_buffs:
new_buff.tick = buff.tick
self.game.active_aura_buffs.append(new_buff)

self.damage = self.controller.hero.damage
self.armor = self.controller.hero.armor
super().play(target, index, choose)
if armor:
Expand Down
2 changes: 1 addition & 1 deletion fireplace/cards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


year = ZodiacYear.RAVEN
default_language = "zhCN"
default_language = "enUS"


class CardDB(dict):
Expand Down
4 changes: 0 additions & 4 deletions fireplace/cards/gangs/kazakus_potions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class CFM_621t2:
"""Heart of Fire"""
requirements = {PlayReq.REQ_TARGET_TO_PLAY: 0}
# 1 Cost: Deal 3
play = Hit(TARGET, 3)

Expand Down Expand Up @@ -58,7 +57,6 @@ class CFM_621t10:

class CFM_621t16:
"""Heart of Fire"""
requirements = {PlayReq.REQ_TARGET_TO_PLAY: 0}
# 5 Cost: Deal 5 Dmg
play = Hit(TARGET, 5)

Expand Down Expand Up @@ -89,7 +87,6 @@ class CFM_621t20:

class CFM_621t21:
"""Mystic Wool"""
requirements = {PlayReq.REQ_MINIMUM_TOTAL_MINIONS: 1}
# 5 Cost: Polymorph 1
play = Morph(RANDOM_ENEMY_MINION, "CFM_621_m5")

Expand Down Expand Up @@ -117,7 +114,6 @@ class CFM_621t24:

class CFM_621t25:
"""Heart of Fire"""
requirements = {PlayReq.REQ_TARGET_TO_PLAY: 0}
# 10 Cost: Deal 10
play = Hit(TARGET, 10)

Expand Down
6 changes: 4 additions & 2 deletions fireplace/cards/gangs/neutral_legendary.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ class CFM_685:
class CFM_806:
"""Wrathion"""
play = Draw(CONTROLLER).then(
Find(Draw.CARD + DRAGON) | (
Find(LazyValueSelector(Draw.CARD)) & ExtraBattlecry(SELF, None)
Find(Draw.CARD + DRAGON) & (
Find(LazyValueSelector(Draw.CARD)) & (
ExtraBattlecry(SELF, None)
)
)
)

Expand Down
2 changes: 1 addition & 1 deletion fireplace/cards/ungoro/neutral_rare.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class UNG_072:

class UNG_075:
"""Vicious Fledgling"""
events = Attack(SELF).after(Adapt(SELF))
events = Attack(SELF, ALL_HEROES).after(Adapt(SELF))


class UNG_079:
Expand Down
1 change: 0 additions & 1 deletion fireplace/cards/ungoro/priest.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class UNG_940:


class UNG_940t8:
requirements = {PlayReq.REQ_HERO_TARGET: 0, PlayReq.REQ_TARGET_IF_AVAILABLE: 0}
play = Buff(FRIENDLY_HERO, "UNG_940t8e")


Expand Down
12 changes: 6 additions & 6 deletions fireplace/dsl/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ def copy(self, source, entity):
ret = super().copy(source, entity)
if self.id:
ret = source.controller.card(self.id, source)
if entity.type == CardType.MINION:
for k in entity.silenceable_attributes:
v = getattr(entity, k)
setattr(ret, k, v)
ret.silenced = entity.silenced
ret.damage = entity.damage
for buff in entity.buffs:
# Recreate the buff stack
new_buff = source.controller.card(buff.id)
Expand All @@ -67,6 +61,12 @@ def copy(self, source, entity):
if buff in source.game.active_aura_buffs:
new_buff.tick = buff.tick
source.game.active_aura_buffs.append(new_buff)
if entity.type == CardType.MINION:
for k in entity.silenceable_attributes:
v = getattr(entity, k)
setattr(ret, k, v)
ret.silenced = entity.silenced
ret.damage = entity.damage
return ret


Expand Down
5 changes: 2 additions & 3 deletions tests/test_gangs.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,8 @@ def test_madam_goya():
def test_wrathion():
game = prepare_empty_game()
game.player1.give(WISP).put_on_top()
game.player1.give("NEW1_023").put_on_top()
for _ in range(4):
game.player1.give(WISP).put_on_top()
game.player1.give("NEW1_023").put_on_top()
assert len(game.player1.hand) == 0
game.player1.give("CFM_806").play()
assert len(game.player1.hand) == 5
Expand All @@ -378,6 +377,6 @@ def test_wrathion():
def test_wrathion_empty():
game = prepare_empty_game()
game.player1.cant_fatigue = False
game.player1.give(WISP).put_on_top()
game.player1.give("NEW1_023").put_on_top()
game.player1.give("CFM_806").play()
assert game.player1.hero.health == 30 - 1
9 changes: 9 additions & 0 deletions tests/test_icecrown.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ def test_hero_armor():
assert game.player1.hero.armor == 7


def test_hero_health():
game = prepare_game()
game.player1.give("UNG_940t8").play()
game.player1.give(MOONFIRE).play(target=game.player1.hero)
assert game.player1.hero.health == 39
game.player1.give("ICC_481").play()
assert game.player1.hero.health == 39


def test_death_grip():
game = prepare_game()
grip = game.player1.give("ICC_314t4")
Expand Down

0 comments on commit d1aafff

Please sign in to comment.