Ejemplo n.º 1
0
 def create_minion(self, player):
     return Minion(5, 8, effects=[Effect(SpellCast(Not(HasCardName("Gallywix's Coin")), EnemyPlayer()),
                                         ActionTag(AddCard(CardQuery(source=CARD_SOURCE.LAST_CARD)),
                                         PlayerSelector(FriendlyPlayer()))),
                                  Effect(SpellCast(Not(HasCardName("Gallywix's Coin")), EnemyPlayer()),
                                         ActionTag(AddCard(GallywixsCoin()),
                                         PlayerSelector(EnemyPlayer())))])
Ejemplo n.º 2
0
 def create_minion(self, player):
     return Minion(3,
                   3,
                   effects=[
                       Effect(TurnEnded(HasSecret()), ChangeAttack(2),
                              SelfSelector()),
                       Effect(TurnEnded(HasSecret()), ChangeHealth(2),
                              SelfSelector())
                   ])
Ejemplo n.º 3
0
 def create_minion(self, player):
     return Minion(2,
                   2,
                   effects=[
                       Effect(MinionDied(MinionIsType(MINION_TYPE.BEAST)),
                              ChangeAttack(2), SelfSelector()),
                       Effect(MinionDied(MinionIsType(MINION_TYPE.BEAST)),
                              ChangeHealth(1), SelfSelector())
                   ])
Ejemplo n.º 4
0
 def create_minion(self, player):
     return Minion(
         2,
         4,
         effects=[
             Effect(CardPlayed(HasOverload()),
                    ActionTag(Give(ChangeAttack(1)), SelfSelector())),
             Effect(CardPlayed(HasOverload()),
                    ActionTag(Give(ChangeHealth(1)), SelfSelector()))
         ])
Ejemplo n.º 5
0
 def create_minion(self, player):
     return Minion(3,
                   3,
                   effects=[
                       Effect(
                           TurnEnded(HasSecret()),
                           ActionTag(Give(Add(CHARACTER_STATUS.ATTACK, 2)),
                                     SelfSelector())),
                       Effect(
                           TurnEnded(HasSecret()),
                           ActionTag(Give(Add(CHARACTER_STATUS.HEALTH, 2)),
                                     SelfSelector()))
                   ])
Ejemplo n.º 6
0
 def create_minion(self, player):
     return Minion(2,
                   2,
                   effects=[
                       Effect(
                           MinionDied(IsType(MINION_TYPE.BEAST)),
                           ActionTag(Give(Add(CHARACTER_STATUS.ATTACK, 2)),
                                     SelfSelector())),
                       Effect(
                           MinionDied(IsType(MINION_TYPE.BEAST)),
                           ActionTag(Give(Add(CHARACTER_STATUS.HEALTH, 1)),
                                     SelfSelector()))
                   ])
Ejemplo n.º 7
0
 def create_weapon(self, player):
     return Weapon(
         1,
         5,
         effects=[
             Effect(
                 MinionSummoned(),
                 ActionTag(
                     Give([Buff(ChangeAttack(1)),
                           Buff(ChangeHealth(1))]), TargetSelector())),
             Effect(MinionSummoned(),
                    ActionTag(DecreaseDurability(), WeaponSelector()))
         ])
Ejemplo n.º 8
0
 def create_minion(self, player):
     return Minion(2,
                   4,
                   effects=[
                       Effect(
                           CardPlayed(HasOverload()),
                           ActionTag(Give(Add(CHARACTER_STATUS.ATTACK, 1)),
                                     SelfSelector())),
                       Effect(
                           CardPlayed(HasOverload()),
                           ActionTag(Give(Add(CHARACTER_STATUS.HEALTH, 1)),
                                     SelfSelector()))
                   ])
Ejemplo n.º 9
0
 def create_minion(self, player):
     return Minion(5,
                   8,
                   effects=[
                       Effect(
                           SpellCast(Not(HasCardName("Gallywix's Coin")),
                                     EnemyPlayer()),
                           ActionTag(AddCard(LastCard()),
                                     PlayerSelector(FriendlyPlayer()))),
                       Effect(
                           SpellCast(Not(HasCardName("Gallywix's Coin")),
                                     EnemyPlayer()),
                           ActionTag(AddCard(GallywixsCoin()),
                                     PlayerSelector(EnemyPlayer())))
                   ])
Ejemplo n.º 10
0
 def create_minion(self, player):
     return Minion(3,
                   6,
                   effects=[
                       Effect(DidDamage(),
                              ActionTag(Give(Frozen()), TargetSelector()))
                   ])
Ejemplo n.º 11
0
 def create_minion(self, player):
     return Minion(5, 4, windfury=True, effects=[Effect(Attack(),
                                                        ActionTag(ChangeTarget(CharacterSelector(NotCurrentTarget(),
                                                                                                 EnemyPlayer(),
                                                                                                 RandomPicker())),
                                                        SelfSelector(),
                                                        And(OneIn(2), OpponentMinionCountIsGreaterThan(0))))])
Ejemplo n.º 12
0
    def use(self, player, game):
        super().use(player, game)

        self.target.add_effect(
            Effect(TurnEnded(), ActionTag(Kill(), SelfSelector())))
        self.target.change_attack(4)
        self.target.increase_health(4)
Ejemplo n.º 13
0
 def create_minion(self, player):
     return Minion(4,
                   1,
                   effects=[
                       Effect(MinionSummoned(IsType(MINION_TYPE.PIRATE)),
                              ActionTag(Give(Stealth()), SelfSelector()))
                   ])
Ejemplo n.º 14
0
 def create_minion(self, player):
     return Minion(2,
                   5,
                   effects=[
                       Effect(MinionDied(IsType(MINION_TYPE.MURLOC)),
                              ActionTag(Draw(), PlayerSelector()))
                   ])
Ejemplo n.º 15
0
 def __init__(self):
     super().__init__("Burrowing Mine",
                      0,
                      CHARACTER_CLASS.WARRIOR,
                      CARD_RARITY.COMMON,
                      False,
                      effects=[
                          Effect(Drawn(),
                                 ActionTag(Damage(10), HeroSelector())),
                          Effect(
                              Drawn(),
                              ActionTag(RemoveFromHand(Same()),
                                        PlayerSelector())),
                          Effect(Drawn(), ActionTag(Draw(),
                                                    PlayerSelector()))
                      ])
Ejemplo n.º 16
0
 def use(self, player, game):
     super().use(player, game)
     game.other_player.hero.damage(player.effective_spell_damage(2), self)
     if player.cards_played > 0:
         player.add_effect(
             Effect(TurnEnded(), ActionTag(AddCard(self),
                                           PlayerSelector())))
Ejemplo n.º 17
0
 def create_minion(self, player):
     return Minion(2,
                   3,
                   effects=[
                       Effect(DidDamage(),
                              ActionTag(Freeze(), TargetSelector()))
                   ])
Ejemplo n.º 18
0
        def __init__(self):
            init_dict = {
                'name': card_def['name'],
                'mana': card_def['mana'],
                'rarity': CARD_RARITY.from_str(card_def['rarity'])
            }
            if 'character_class' in card_def:
                init_dict['character_class'] = CHARACTER_CLASS.from_str(card_def['character_class'])

            if 'minion_type' in card_def:
                init_dict['minion_type'] = MINION_TYPE.from_str(card_def['minion_type'])

            if 'battlecry' in card_def:
                init_dict['battlecry'] = tuple(Battlecry.from_json(**battlecry) for battlecry in card_def['battlecry'])

            if 'choices' in card_def:
                init_dict['choices'] = [Choice.from_json(**choice) for choice in card_def['choices']]

            if 'combo' in card_def:
                init_dict['combo'] = Battlecry.from_json(**card_def['combo'])

            if 'overload' in card_def:
                init_dict['overload'] = card_def['overload']

            if 'buffs' in card_def:
                init_dict['buffs'] = [Buff.from_json(**buff) for buff in card_def['buffs']]
            if 'auras' in card_def:
                init_dict['auras'] = [Aura.from_json(**aura) for aura in card_def['auras']]
            if 'effects' in card_def:
                init_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

            MinionCard.__init__(self, **init_dict)
Ejemplo n.º 19
0
        def __init_weapon__(self):
            init_dict = {
                'name': card_def['name'],
                'mana': card_def['mana'],
                'rarity': CARD_RARITY.from_str(card_def['rarity'])
            }
            if 'character_class' in card_def:
                init_dict['character_class'] = CHARACTER_CLASS.from_str(card_def['character_class'])

            if 'battlecry' in card_def:
                init_dict['battlecry'] = Battlecry.from_json(**card_def['battlecry'])

            if 'combo' in card_def:
                init_dict['combo'] = Battlecry.from_json(**card_def['combo'])

            if 'overload' in card_def:
                init_dict['overload'] = card_def['overload']

            if 'buffs' in card_def:
                init_dict['buffs'] = [Buff.from_json(**buff) for buff in card_def['buffs']]
            if 'auras' in card_def:
                init_dict['auras'] = [Aura.from_json(**aura) for aura in card_def['auras']]
            if 'effects' in card_def:
                init_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

            WeaponCard.__init__(self, **init_dict)
Ejemplo n.º 20
0
 def __init__(self):
     super().__init__("Fist of Jaraxxus", 4, CHARACTER_CLASS.WARLOCK, CARD_RARITY.RARE,
                      effects=[Effect(CardDiscarded(MinionIsTarget()), ActionTag(Damage(4),
                                                                                 CharacterSelector(None,
                                                                                                   EnemyPlayer(),
                                                                                                   RandomPicker())))
                               ])
Ejemplo n.º 21
0
 def create_minion(self, player):
     return Minion(0,
                   5,
                   effects=[
                       Effect(TurnStarted(), Heal(3),
                              CharacterSelector(picker=RandomPicker()))
                   ])
Ejemplo n.º 22
0
 def use(self, player, game):
     super().use(player, game)
     if player is game.players[0]:
         draw_player = PlayerOne()
     else:
         draw_player = PlayerTwo()
     self.target.add_effect(Effect(Attack(), ActionTag(Draw(), PlayerSelector(draw_player))))
Ejemplo n.º 23
0
        def __init_weapon__(self):
            init_dict = {
                'name': card_def['name'],
                'mana': card_def['mana'],
                'rarity': CARD_RARITY.from_str(card_def['rarity'])
            }
            if 'character_class' in card_def:
                init_dict['character_class'] = CHARACTER_CLASS.from_str(
                    card_def['character_class'])

            if 'battlecry' in card_def:
                init_dict['battlecry'] = Battlecry.from_json(
                    **card_def['battlecry'])

            if 'combo' in card_def:
                init_dict['combo'] = Battlecry.from_json(**card_def['combo'])

            if 'overload' in card_def:
                init_dict['overload'] = card_def['overload']

            if 'buffs' in card_def:
                init_dict['buffs'] = [
                    Buff.from_json(**buff) for buff in card_def['buffs']
                ]
            if 'auras' in card_def:
                init_dict['auras'] = [
                    Aura.from_json(**aura) for aura in card_def['auras']
                ]
            if 'effects' in card_def:
                init_dict['effects'] = [
                    Effect.from_json(**effect)
                    for effect in card_def['effects']
                ]

            WeaponCard.__init__(self, **init_dict)
Ejemplo n.º 24
0
 def create_minion(self, player):
     return Minion(2,
                   4,
                   effects=[
                       Effect(Damaged(),
                              ActionTag(Summon(Imp()), PlayerSelector()))
                   ])
Ejemplo n.º 25
0
        def create_minion(self, player):
            create_dict = {
                'attack': card_def['attack'],
                'health': card_def['health']
            }
            if "impl" in card_def:
                impl = card_def['impl']
                if 'effects' in impl:
                    create_dict['effects'] = [
                        Effect.from_json(**effect)
                        for effect in impl['effects']
                    ]

                if 'auras' in impl:
                    create_dict['auras'] = [
                        Aura.from_json(**aura) for aura in impl['auras']
                    ]

                if 'buffs' in impl:
                    create_dict['buffs'] = [
                        Buff.from_json(**buff) for buff in impl['buffs']
                    ]

            if 'enrage' in card_def:
                create_dict['enrage'] = [
                    Aura.from_json(**enrage) for enrage in card_def['enrage']
                ]

            if 'deathrattle' in card_def:
                create_dict['deathrattle'] = [
                    Deathrattle.from_json(**deathrattle)
                    for deathrattle in card_def['deathrattle']
                ]

            return Minion(**create_dict)
Ejemplo n.º 26
0
 def create_minion(self, player):
     return Minion(9,
                   9,
                   effects=[
                       Effect(TurnEnded(MinionCountIs(1), BothPlayer()),
                              ActionTag(Kill(), SelfSelector()))
                   ])
Ejemplo n.º 27
0
 def create_minion(self, player):
     return Minion(1,
                   4,
                   effects=[
                       Effect(DidDamage(),
                              ActionTag(Heal(EventValue()), HeroSelector()))
                   ])
Ejemplo n.º 28
0
 def create_weapon(self, player):
     return Weapon(4,
                   2,
                   effects=[
                       Effect(CharacterAttack(IsHero()),
                              ActionTag(Heal(2), HeroSelector()))
                   ])
Ejemplo n.º 29
0
 def create_minion(self, player):
     return Minion(3,
                   2,
                   effects=[
                       Effect(MinionPlaced(IsType(MINION_TYPE.BEAST)),
                              ActionTag(Draw(), PlayerSelector()))
                   ])
Ejemplo n.º 30
0
 def create_minion(self, player):
     return Minion(1,
                   4,
                   effects=[
                       Effect(CharacterDamaged(condition=IsMinion()),
                              ActionTag(IncreaseArmor(), HeroSelector()))
                   ])
Ejemplo n.º 31
0
 def create_minion(self, player):
     return Minion(2,
                   3,
                   effects=[
                       Effect(MinionPlaced(AttackLessThanOrEqualTo(3)),
                              ActionTag(Give(Charge()), TargetSelector()))
                   ])
Ejemplo n.º 32
0
        def create_weapon(self, player):
            create_dict = {
                'attack_power': card_def['attack'],
                'durability': card_def['durability']
            }
            if "impl" in card_def:
                impl = card_def['impl']
                if 'effects' in impl:
                    create_dict['effects'] = [
                        Effect.from_json(**effect)
                        for effect in impl['effects']
                    ]

                if 'auras' in impl:
                    create_dict['auras'] = [
                        Aura.from_json(**aura) for aura in impl['auras']
                    ]

                if 'buffs' in impl:
                    create_dict['buffs'] = [
                        Buff.from_json(**buff) for buff in impl['buffs']
                    ]

            if 'deathrattle' in card_def:
                create_dict['deathrattle'] = Deathrattle.from_json(
                    **card_def['deathrattle'])

            return Weapon(**create_dict)
Ejemplo n.º 33
0
    def __from_json__(self, auras=None, effects=None):
        if effects:  # To allow for give to work with effects as well, we check at load time
            effects = [Effect.from_json(**effect) for effect in effects]
            return GiveEffect(effects)

        self.auras = []
        for aura in auras:
            if "until" in aura:
                self.auras.append(AuraUntil.from_json(**aura))
            else:
                self.auras.append(Aura.from_json(**aura))
        return self
Ejemplo n.º 34
0
 def __from_json__(minion, effects=None, auras=None, buffs=None, **kwargs):
     if effects:
         minion.effects = [Effect.from_json(**effect) for effect in effects]
     else:
         minion.effects = []
     if auras:
         minion.auras = [AuraUntil.from_json(**aura) if 'until' in aura else Aura.from_json(**aura)
                         for aura in auras]
     else:
         minion.auras = []
     if buffs:
         minion.buffs = [BuffUntil.from_json(**buff) if 'until' in buff else Buff.from_json(**buff)
                         for buff in buffs]
     else:
         minion.buffs = []
        def create_weapon(self, player):
            create_dict = {
                'attack_power': card_def['attack'],
                'durability': card_def['durability']
            }
            if 'effects' in card_def:
                create_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

            if 'auras' in card_def:
                create_dict['auras'] = [Aura.from_json(**aura) for aura in card_def['auras']]

            if 'buffs' in card_def:
                create_dict['buffs'] = [Buff.from_json(**buff) for buff in card_def['buffs']]

            if 'deathrattle' in card_def:
                create_dict['deathrattle'] = Deathrattle.from_json(**card_def['deathrattle'])

            return Weapon(**create_dict)
Ejemplo n.º 36
0
        def create_minion(self, player):
            create_dict = {
                'attack': card_def['attack'],
                'health': card_def['health']
            }
            if 'effects' in card_def:
                create_dict['effects'] = [Effect.from_json(player.game, **effect) for effect in card_def['effects']]

            if 'auras' in card_def:
                create_dict['auras'] = [Aura.from_json(**aura) for aura in card_def['auras']]

            if 'enrage' in card_def:
                create_dict['enrage'] = [Action.from_json(**action) for action in card_def['enrage']]

            if 'deathrattle' in card_def:
                create_dict['deathrattle'] = Deathrattle.from_json(**card_def['deathrattle'])

            return Minion(**create_dict)
        def create_minion(self, player):
            create_dict = {
                'attack': card_def['attack'],
                'health': card_def['health']
            }
            if 'effects' in card_def:
                create_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

            if 'auras' in card_def:
                create_dict['auras'] = [Aura.from_json(**aura) for aura in card_def['auras']]

            if 'buffs' in card_def:
                create_dict['buffs'] = [Buff.from_json(**buff) for buff in card_def['buffs']]

            if 'enrage' in card_def:
                create_dict['enrage'] = Enrage.from_json(**card_def['enrage'])

            if 'deathrattle' in card_def:
                create_dict['deathrattle'] = Deathrattle.from_json(**card_def['deathrattle'])

            return Minion(**create_dict)
Ejemplo n.º 38
0
    def __from_json__(d, agents):
        new_game = Game.__new__(Game)
        new_game._all_cards_played = []
        new_game.minion_counter = d["current_sequence_id"]
        new_game.delayed_minions = set()
        new_game.game_ended = False
        new_game.random_func = random.randint
        new_game.events = {}
        new_game.players = [Player.__from_json__(pd, new_game, None) for pd in d["players"]]
        new_game._has_turn_ended = False
        if d["active_player"] == 1:
            new_game.current_player = new_game.players[0]
            new_game.other_player = new_game.players[1]
            new_game.current_player.opponent = new_game.players[1]
            new_game.other_player.opponent = new_game.players[0]
        else:
            new_game.current_player = new_game.players[1]
            new_game.other_player = new_game.players[0]
            new_game.current_player.opponent = new_game.players[0]
            new_game.other_player.opponent = new_game.players[1]

        index = 0
        for player in new_game.players:
            player.agent = agents[index]
            for effect_json in d['players'][index]['effects']:
                player.add_effect(Effect.from_json(**effect_json))
            player.player_auras = []
            for aura_json in d['players'][index]['auras']:
                player.add_aura(AuraUntil.from_json(**aura_json))
            player.hero.attach(player.hero, player)
            if player.hero.weapon:
                player.hero.weapon.attach(player.hero, player)

            for minion in player.minions:
                minion.attach(minion, player)
                if minion.health != minion.calculate_max_health():
                    minion.enraged = True
                    minion._do_enrage()
            index += 1
        return new_game
Ejemplo n.º 39
0
        def create_minion(self, player):
            create_dict = {
                'attack': card_def['attack'],
                'health': card_def['health']
            }
            if "impl" in card_def:
                impl = card_def['impl']
                if 'effects' in impl:
                    create_dict['effects'] = [Effect.from_json(**effect) for effect in impl['effects']]

                if 'auras' in impl:
                    create_dict['auras'] = [Aura.from_json(**aura) for aura in impl['auras']]

                if 'buffs' in impl:
                    create_dict['buffs'] = [Buff.from_json(**buff) for buff in impl['buffs']]

            if 'enrage' in card_def:
                create_dict['enrage'] = [Aura.from_json(**enrage) for enrage in card_def['enrage']]

            if 'deathrattle' in card_def:
                create_dict['deathrattle'] = [Deathrattle.from_json(**deathrattle)
                                              for deathrattle in card_def['deathrattle']]

            return Minion(**create_dict)
Ejemplo n.º 40
0
 def __from_json__(self, effects):
     self.effects = [Effect.from_json(**effect) for effect in effects]
     return self