Skip to content

Instantly share code, notes, and snippets.

@synap5e
Created July 13, 2015 08:17
Show Gist options
  • Save synap5e/c66eaedce0594c0eca88 to your computer and use it in GitHub Desktop.
Save synap5e/c66eaedce0594c0eca88 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys; sys.path.append("..")
from fireplace.cards.heroes import *
from test_main import prepare_game
IMP_GANG_BOSS = 'BRM_006'
IMP = 'BRM_006t'
def test_self_damage():
game = prepare_game(hero1=MAGE, hero2=MAGE)
# summon 2 Imp Gang Boss
boss1 = game.current_player.summon(IMP_GANG_BOSS)
boss2 = game.current_player.summon(IMP_GANG_BOSS)
game.end_turn()
# attack one of the bosses
game.current_player.hero.power.use(target=boss1)
# string ids of all the opponents minions
ids = [ent.id for ent in game.current_player.opponent.field]
# only one gang boss was hit, so there should only be one imp
assert(ids.count(IMP) == 1)
def main():
test_self_damage()
print("All tests ran OK")
if __name__ == "__main__":
main()
@synap5e
Copy link
Author

synap5e commented Jul 13, 2015

Relevant output of log

...
INFO:root:Player1 uses hero power <HeroPower ('Fireblast')> on <Minion ('Imp Gang Boss')>
INFO:root:<HeroPower ('Fireblast')> triggering <TargetedAction: Hit(amount=1)> targeting [<Minion ('Imp Gang Boss')>]
INFO:root:<HeroPower ('Fireblast')> triggering <TargetedAction: Damage(amount=1)> targeting [<Minion ('Imp Gang Boss')>]
INFO:root:<Minion ('Imp Gang Boss')> damaged for 1 health
check [<Minion ('Imp Gang Boss')>] is [<Minion ('Imp Gang Boss')>]
INFO:root:<Minion ('Imp Gang Boss')> triggering <TargetedAction: Summon(card='BRM_006t')> targeting [Player(name='Player2', hero=<Hero ('Jaina Proudmoore')>)]
INFO:root:Player2 summons [<Minion ('Imp')>]
INFO:root:Summoning <Minion ('Imp')>
DEBUG:root:<Minion ('Imp')> moves from <Zone.INVALID: 0> to <Zone.PLAY: 1>
check [<Minion ('Imp Gang Boss')>] is [<Minion ('Imp Gang Boss')>]
INFO:root:<Minion ('Imp Gang Boss')> triggering <TargetedAction: Summon(card='BRM_006t')> targeting [Player(name='Player2', hero=<Hero ('Jaina Proudmoore')>)]
INFO:root:Player2 summons [<Minion ('Imp')>]
INFO:root:Summoning <Minion ('Imp')>
DEBUG:root:<Minion ('Imp')> moves from <Zone.INVALID: 0> to <Zone.PLAY: 1>
Traceback (most recent call last):
  File "./test_on_hit.py", line 35, in <module>
    main()
  File "./test_on_hit.py", line 30, in main
    test_self_damage()
  File "./test_on_hit.py", line 27, in test_self_damage
    assert(ids.count(IMP) == 1)
AssertionError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment