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())))])
def create_minion(self, player): return Minion(3, 3, effects=[ Effect(TurnEnded(HasSecret()), ChangeAttack(2), SelfSelector()), Effect(TurnEnded(HasSecret()), ChangeHealth(2), SelfSelector()) ])
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()) ])
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())) ])
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())) ])
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())) ])
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())) ])
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())) ])
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()))) ])
def create_minion(self, player): return Minion(3, 6, effects=[ Effect(DidDamage(), ActionTag(Give(Frozen()), TargetSelector())) ])
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))))])
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)
def create_minion(self, player): return Minion(4, 1, effects=[ Effect(MinionSummoned(IsType(MINION_TYPE.PIRATE)), ActionTag(Give(Stealth()), SelfSelector())) ])
def create_minion(self, player): return Minion(2, 5, effects=[ Effect(MinionDied(IsType(MINION_TYPE.MURLOC)), ActionTag(Draw(), PlayerSelector())) ])
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())) ])
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())))
def create_minion(self, player): return Minion(2, 3, effects=[ Effect(DidDamage(), ActionTag(Freeze(), TargetSelector())) ])
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)
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)
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()))) ])
def create_minion(self, player): return Minion(0, 5, effects=[ Effect(TurnStarted(), Heal(3), CharacterSelector(picker=RandomPicker())) ])
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))))
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)
def create_minion(self, player): return Minion(2, 4, effects=[ Effect(Damaged(), ActionTag(Summon(Imp()), PlayerSelector())) ])
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)
def create_minion(self, player): return Minion(9, 9, effects=[ Effect(TurnEnded(MinionCountIs(1), BothPlayer()), ActionTag(Kill(), SelfSelector())) ])
def create_minion(self, player): return Minion(1, 4, effects=[ Effect(DidDamage(), ActionTag(Heal(EventValue()), HeroSelector())) ])
def create_weapon(self, player): return Weapon(4, 2, effects=[ Effect(CharacterAttack(IsHero()), ActionTag(Heal(2), HeroSelector())) ])
def create_minion(self, player): return Minion(3, 2, effects=[ Effect(MinionPlaced(IsType(MINION_TYPE.BEAST)), ActionTag(Draw(), PlayerSelector())) ])
def create_minion(self, player): return Minion(1, 4, effects=[ Effect(CharacterDamaged(condition=IsMinion()), ActionTag(IncreaseArmor(), HeroSelector())) ])
def create_minion(self, player): return Minion(2, 3, effects=[ Effect(MinionPlaced(AttackLessThanOrEqualTo(3)), ActionTag(Give(Charge()), TargetSelector())) ])
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)
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
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)
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)
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
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)
def __from_json__(self, effects): self.effects = [Effect.from_json(**effect) for effect in effects] return self