Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Marin the Fox. Fix some card and test #496

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fireplace/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ def play(self, target=None, index=None, choose=None):
if armor:
self.game.cheat_action(self, [actions.GainArmor(self, armor)])


class Minion(Character):
charge = boolean_property("charge")
has_inspire = boolean_property("has_inspire")
Expand Down
4 changes: 2 additions & 2 deletions fireplace/cards/icecrown/warrior.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ICC_062:
"""Mountainfire Armor"""
deathrattle = CurrentPlayer(OPPONENT) & GainArmor(CONTROLLER, 6)
deathrattle = CurrentPlayer(OPPONENT) & GainArmor(FRIENDLY_HERO, 6)


class ICC_238:
Expand Down Expand Up @@ -47,7 +47,7 @@ class ICC_281:

class ICC_837:
"""Bring It On!"""
play = GainArmor(CONTROLLER, 10), Buff(ENEMY_HAND + MINION, "ICC_837e")
play = GainArmor(FRIENDLY_HERO, 10), Buff(ENEMY_HAND + MINION, "ICC_837e")


class ICC_837e:
Expand Down
1 change: 1 addition & 0 deletions fireplace/cards/kobolds/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .neutral_legendary import *
39 changes: 39 additions & 0 deletions fireplace/cards/kobolds/neutral_legendary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from ..utils import *


##
# Minions

class LOOT_357:
"""Marin the Fox"""
play = Summon(OPPONENT, "LOOT_357l")


class LOOT_357l:
entourage = ["LOOT_998h", "LOOT_998j", "LOOT_998l", "LOOT_998k"]
deathrattle = Give(OPPONENT, RandomEntourage())


class LOOT_998h:
play = Draw(CONTROLLER).then(Give(CONTROLLER, Copy(Draw.CARD)) * (
MAX_HAND_SIZE(CONTROLLER) - Count(FRIENDLY_HAND)
))


class LOOT_998j:
play = Discover(CONTROLLER, RandomLegendaryMinion()).then(
Summon(CONTROLLER, Discover.CARD) * 2
)


class LOOT_998l:
play = (Draw(CONTROLLER) * 3).then(Buff(Draw.CARD, "LOOT_998le"))


class LOOT_998le:
cost = SET(0)
events = REMOVED_IN_PLAY


class LOOT_998k:
play = Morph(FRIENDLY_HAND, RandomLegendaryMinion())
2 changes: 1 addition & 1 deletion fireplace/cards/ungoro/mage.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class UNG_948:
PlayReq.REQ_FRIENDLY_TARGET: 0,
PlayReq.REQ_MINION_TARGET: 0,
PlayReq.REQ_TARGET_TO_PLAY: 0}
play = Summon(TARGET, ExactCopy(TARGET))
play = Summon(CONTROLLER, ExactCopy(TARGET))


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

class UNG_942t:
play = Give(CONTROLLER, RandomMurloc()) * (
MAX_HAND_SIZE(CONTROLLER) - Count(IN_HAND + FRIENDLY)
MAX_HAND_SIZE(CONTROLLER) - Count(FRIENDLY_HAND)
)


Expand Down
13 changes: 8 additions & 5 deletions fireplace/dsl/copy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from hearthstone.enums import CardType

from ..logging import log
from .lazynum import LazyValue

Expand Down Expand Up @@ -41,11 +43,12 @@ def copy(self, source, entity):
ret = super().copy(source, entity)
if self.id:
ret = source.controller.card(self.id, source)
for k in entity.silenceable_attributes:
v = getattr(entity, k)
setattr(ret, k, v)
ret.silenced = entity.silenced
ret.damage = entity.damage
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
entity.buff(ret, buff.id)
Expand Down
22 changes: 18 additions & 4 deletions fireplace/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,22 @@ def play_turn(game):

while True:
heropower = player.hero.power
if heropower.is_playable() and random.random() < 0.1:
if heropower.is_usable() and random.random() < 0.1:
choose = None
target = None
if heropower.must_choose_one:
choose = random.choice(heropower.choose_cards)
if heropower.requires_target():
heropower.use(target=random.choice(heropower.targets))
else:
heropower.use()
target = random.choice(heropower.targets)
heropower.use(target=target, choose=choose)
continue

# eg. Deathstalker Rexxar
while player.choice:
choice = random.choice(player.choice.cards)
print("Choosing card %r" % (choice))
player.choice.choose(choice)

# iterate over our hand and play whatever is playable
for card in player.hand:
if card.is_playable() and random.random() < 0.5:
Expand All @@ -217,6 +226,11 @@ def play_turn(game):
for character in player.characters:
if character.can_attack():
character.attack(random.choice(character.targets))
# eg. Vicious Fledgling
while player.choice:
choice = random.choice(player.choice.cards)
print("Choosing card %r" % (choice))
player.choice.choose(choice)

break

Expand Down
7 changes: 7 additions & 0 deletions tests/test_ungoro.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,10 @@ def test_blazecaller():
game.end_turn()
game.end_turn()
blazecaller1 = game.player1.give("UNG_847").play(target=blazecaller1)


def test_molten_reflection():
game = prepare_game()
wisp = game.player1.give(WISP).play()
game.player1.give("UNG_948").play(target=wisp)
assert len(game.player1.field) == 2