Esempio n. 1
0
 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()
Esempio n. 2
0
 def create_weapon(self, player):
     return Weapon(5,
                   2,
                   effects=[
                       Effect(
                           CharacterAttack(IsHero()),
                           ActionTag(
                               Give(BuffUntil(Immune(), AttackCompleted())),
                               HeroSelector()))
                   ])
Esempio n. 3
0
    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)
Esempio n. 4
0
 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())))
Esempio n. 5
0
 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
Esempio n. 7
0
    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()))
Esempio n. 8
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 = []
Esempio n. 9
0
    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
Esempio n. 10
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 = []
Esempio n. 11
0
 def use(self, player, game):
     super().use(player, game)
     self.target.add_buff(BuffUntil(Immune(), TurnEnded(player=CurrentPlayer())))
     self.target.change_temp_attack(2)
Esempio n. 12
0
 def use(self, player, game):
     super().use(player, game)
     for minion in player.minions:
         if not minion.stealth:
             minion.add_buff(BuffUntil(Stealth(), TurnStarted()))
Esempio n. 13
0
 def use(self, player, game):
     super().use(player, game)
     self.target.add_buff(BuffUntil(Stealth(), TurnStarted()))