コード例 #1
0
ファイル: warrior.py プロジェクト: vkarthi46/hearthbreaker
    def use(self, player, game):
        super().use(player, game)
        player.add_aura(
            AuraUntil(SetTo(CHARACTER_STATUS.MINIMUM_HEALTH, 1),
                      MinionSelector(), TurnEnded()))

        player.draw()
コード例 #2
0
 def __init__(self):
     super().__init__("Dragon Consort", 5, CHARACTER_CLASS.PALADIN, CARD_RARITY.RARE,
                      minion_type=MINION_TYPE.DRAGON,
                      battlecry=Battlecry(GiveAura([AuraUntil(ManaChange(-3),
                                                              CardSelector(condition=IsType(MINION_TYPE.DRAGON)),
                                                              CardPlayed(IsType(MINION_TYPE.DRAGON)), False)]),
                                          PlayerSelector()))
コード例 #3
0
ファイル: action.py プロジェクト: 5alamander/hearthbreaker
 def __from_json__(self, auras):
     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
コード例 #4
0
ファイル: action.py プロジェクト: cadunne/hearthbreaker
 def __from_json__(self, auras):
     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
コード例 #5
0
 def __init__(self):
     super().__init__("Kirin Tor Mage",
                      3,
                      CHARACTER_CLASS.MAGE,
                      CARD_RARITY.RARE,
                      battlecry=Battlecry(
                          GiveAura([
                              AuraUntil(ManaChange(-100), SecretSelector(),
                                        CardPlayed(IsSecret()))
                          ]), PlayerSelector()))
コード例 #6
0
 def __init__(self):
     super().__init__("Kirin Tor Mage",
                      3,
                      CHARACTER_CLASS.MAGE,
                      CARD_RARITY.RARE,
                      battlecry=Battlecry(
                          GiveAura([
                              AuraUntil(SetTo(CARD_STATUS.MANA, 0),
                                        CardSelector(condition=IsSecret()),
                                        CardPlayed(IsSecret()))
                          ]), PlayerSelector()))
コード例 #7
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
コード例 #8
0
ファイル: action.py プロジェクト: bussiere/hearthbreaker
    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
コード例 #9
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_aura(AuraUntil(Stolen(), SelfSelector(), TurnEnded()))
コード例 #10
0
ファイル: game_objects.py プロジェクト: fazzone/hearthbreaker
 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 = []
コード例 #11
0
ファイル: engine.py プロジェクト: icelure/hearthstone-sim
    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._turns_passed = d['turn_count']
        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.weapon:
                player.weapon.attach(player.weapon, player)

            for minion in player.minions:
                minion.attach(minion, player)
                if minion.health != minion.calculate_max_health():
                    minion.enraged = True
            index += 1
        return new_game
コード例 #12
0
ファイル: game_objects.py プロジェクト: futouyiba/HyperbolaAI
 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 = []
コード例 #13
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
コード例 #14
0
ファイル: warrior.py プロジェクト: pcg79/hearthbreaker
    def use(self, player, game):
        super().use(player, game)
        player.add_aura(
            AuraUntil(MinimumHealth(1), MinionSelector(), TurnEnded()))

        player.draw()
コード例 #15
0
ファイル: rogue.py プロジェクト: vkarthi46/hearthbreaker
 def use(self, player, game):
     super().use(player, game)
     player.add_aura(AuraUntil(Subtract(CARD_STATUS.MANA, 3), CardSelector(condition=IsSpell()), SpellCast()))
コード例 #16
0
 def use(self, player, game):
     super().use(player, game)
     player.add_aura(AuraUntil(ManaChange(-3), SpellSelector(), SpellCast()))
コード例 #17
0
 def use(self, player, game):
     super().use(player, game)
     self.target.add_aura(
         AuraUntil(Immune(), SelfSelector(),
                   TurnEnded(player=CurrentPlayer())))
     self.target.change_temp_attack(2)
コード例 #18
0
ファイル: rogue.py プロジェクト: DariuszPiotr/HeathStoneAI
 def use(self, player, game):
     super().use(player, game)
     player.add_aura(AuraUntil(ManaChange(-3), CardSelector(condition=IsSpell()), SpellCast()))