def _reveal(self, character, attacker, amount): if character.is_hero(): if character.health - amount <= 0: character.add_buff( BuffUntil(Immune(), TurnEnded(player=CurrentPlayer()))) # TODO Check if this spell will also prevent damage to armor. super().reveal()
def create_weapon(self, player): return Weapon(5, 2, effects=[ Effect( CharacterAttack(IsHero()), ActionTag( Give(BuffUntil(Immune(), AttackCompleted())), HeroSelector())) ])
def change_temp_attack(self, amount): """ Change the amount of attack this :class:`Character` has on this turn only. The amount can be either positive or negative. This method will automatically undo its effect when silenced, and re-apply its effect when copied :param int amount: The amount to change the temporary attack by """ self.add_buff( BuffUntil(ChangeAttack(amount), TurnEnded(player=CurrentPlayer()))) self.trigger("attack_changed", amount)
def __init__(self): super().__init__("Shrinkmeister", 2, CHARACTER_CLASS.PRIEST, CARD_RARITY.COMMON, battlecry=Battlecry( Give( BuffUntil(ChangeAttack(-2), TurnEnded(player=CurrentPlayer()))), MinionSelector(players=BothPlayer(), picker=UserPicker())))
def create_weapon(self, player): return Weapon( 7, 1, effects=[ Effect(CharacterAttack(And(IsHero(), TargetIsMinion())), [ ActionTag(IncreaseDurability(), HeroSelector()), ActionTag(IncreaseWeaponAttack(-1), HeroSelector()), ActionTag( Give(BuffUntil(ChangeAttack(1), AttackCompleted())), HeroSelector()) ]) ])
def __from_json__(self, buffs=None, effects=None, auras=None): if effects: # To allow for give to work with effects as well, we check at load time return GiveEffect.__new__(GiveEffect).__from_json__(effects) if auras: # To allow for give to work with auras as well, we check at load time return GiveAura.__new__(GiveAura).__from_json__(auras) self.buffs = [] for buff in buffs: if "until" in buff: self.buffs.append(BuffUntil.from_json(**buff)) else: self.buffs.append(Buff.from_json(**buff)) return self
def use(self, player, game): super().use(player, game) minion = self.target.copy(player) minion.active = True minion.exhausted = False # What happens if there are already 7 minions? self.target.remove_from_board() minion.add_to_board(len(player.minions)) # When silenced, the minion should immediately come back to its previous # owner. See https://twitter.com/bdbrode/status/510251195173470208 minion.add_buff(BuffUntil(Stolen(), TurnEnded()))
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 __from_json__(self, buffs=None, effects=None, auras=None, picker=None): if effects: # To allow for give to work with effects as well, we check at load time return GiveEffect.__new__(GiveEffect).__from_json__(effects) if auras: # To allow for give to work with auras as well, we check at load time return GiveAura.__new__(GiveAura).__from_json__(auras) self.buffs = [] for buff in buffs: if "until" in buff: self.buffs.append(BuffUntil.from_json(**buff)) else: self.buffs.append(Buff.from_json(**buff)) if not picker: self.picker = AllPicker() else: self.picker = Picker.from_json(**picker) 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 use(self, player, game): super().use(player, game) self.target.add_buff(BuffUntil(Immune(), TurnEnded(player=CurrentPlayer()))) self.target.change_temp_attack(2)
def use(self, player, game): super().use(player, game) for minion in player.minions: if not minion.stealth: minion.add_buff(BuffUntil(Stealth(), TurnStarted()))
def use(self, player, game): super().use(player, game) self.target.add_buff(BuffUntil(Stealth(), TurnStarted()))