Exemple #1
0
class 横扫(Spell):
    data = {
        'id': 10008,
        'type': 1, 'klass': 1, 'cost': 4,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, [4, 1])

    check_target = ext.checker_enemy_character

    def run(self, target, **kwargs):
        """See <https://hearthstone.gamepedia.com/Swipe#Notes> for more details.

        Like most area of effect damaging effect, Swipe deals all its damage before any on-damage
        triggered effects are activated. However, Swipe creates Damage Events in an unusual order:
        first for the targeted character, and then for all other enemy characters in reverse order
        of play; then, all Damage Events are resolved in the same order.
        """
        targets = [target]
        values = [self.dh_values[0]]

        for entity in order_of_play(
                chain(self.game.get_zone(Zone.Play, 1 - self.player_id),
                      self.game.get_zone(Zone.Hero, 1 - self.player_id)), reverse=True):
            if entity is target:
                continue
            targets.append(entity)
            values.append(self.dh_values[1])

        return [std_events.AreaDamage(self.game, self, targets, values)]
Exemple #2
0
class 多重射击(Spell):
    data = {
        'id': 20009,
        'type': 1, 'klass': 2, 'cost': 4,
    }
    ext.add_dh_bonus_data(data, 3)

    def can_do_action(self, msg_fn=None):
        super_result = super().can_do_action(msg_fn=msg_fn)

        if self.zone == Zone.Hand and len(self.game.get_zone(Zone.Play, 1 - self.player_id)) < 2:
            if msg_fn:
                msg_fn('Your opponent must have at least 2 minions!')
            return self.Inactive

        return super_result

    def run(self, target, **kwargs):
        """Deal damage in random order.

        See <https://hearthstone.gamepedia.com/Damage#Advanced_rules> and its explanation on "Multi-Shot" for details.
        """
        zone = self.game.get_zone(Zone.Play, 1 - self.player_id)
        if len(zone) == 0:
            return []
        elif len(zone) < 2:
            real_targets = zone
        else:
            real_targets = random.sample(zone, 2)
        return [std_events.AreaDamage(self.game, self, real_targets, [self.dh_values[0] for _ in real_targets])]
Exemple #3
0
class 奥术射击(Spell):
    data = {
        'id': 20005,
        'type': 1, 'klass': 2, 'cost': 1,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 2)

    run = ext.damage_fn(data.get('dh_values', [])[0])
Exemple #4
0
class 月火术(Spell):
    data = {
        'id': 10001,
        'type': 1, 'klass': 1, 'cost': 0,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 1)

    run = ext.damage_fn(data.get('dh_values', [])[0])
Exemple #5
0
class 治疗之触(Spell):
    data = {
        'id': 10006,
        'type': 1, 'klass': 1, 'cost': 3,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 8, DHBonusEventType.Healing)

    def run(self, target, **kwargs):
        return [std_events.Healing(self.game, self, target, self.dh_values[0])]
Exemple #6
0
class 火球术(Spell):
    data = {
        'id': 30007,
        'type': 1,
        'klass': 3,
        'cost': 4,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 6)

    run = ext.damage_fn(data.get('dh_values', [])[0])
Exemple #7
0
class 稳固射击(HeroPower):
    data = {
        'id': 1,
        'klass': 2, 'is_basic': True, 'cost': 2,
    }
    ext.add_dh_bonus_data(data, [2])

    def run(self, target, **kwargs):
        return [std_events.Damage(
            self.game, self,
            target=self.game.get_hero(1 - self.player_id),
            value=self.dh_values[0])]
Exemple #8
0
class 次级治疗术(HeroPower):
    data = {
        'id': 4,
        'klass': 5,
        'is_basic': True,
        'cost': 2,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 2)

    def run(self, target, **kwargs):
        return [std_events.Healing(self.game, self, target, self.dh_values[0])]
Exemple #9
0
class 神圣惩击(Spell):
    data = {
        'id': 50001,
        'type': 1,
        'klass': 5,
        'cost': 1,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 2)

    def run(self, target, **kwargs):
        return [std_events.Damage(self.game, self, target, self.dh_values[0])]
Exemple #10
0
class 星火术(Spell):
    data = {
        'id': 10009,
        'type': 1, 'klass': 1, 'cost': 6,
        'po_tree': '$HaveTarget',
    }

    ext.add_dh_bonus_data(data, 5)

    def run(self, target, **kwargs):
        return [std_events.Damage(self.game, self, target, self.dh_values[0]),
                std_events.DrawCard(self.game, self, self.player_id)]
Exemple #11
0
class 奥术飞弹(Spell):
    data = {
        'id': 30001,
        'type': 1,
        'klass': 3,
        'cost': 1,
    }
    ext.add_dh_bonus_data(data, 3)

    def run(self, target, **kwargs):
        # TODO
        return []
Exemple #12
0
class 火焰冲击(HeroPower):
    data = {
        'id': 2,
        'klass': 3,
        'is_basic': True,
        'cost': 2,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 1)

    def run(self, target, **kwargs):
        return [std_events.Damage(self.game, self, target, self.dh_values[0])]
Exemple #13
0
class 吸取生命(Spell):
    data = {
        'id': 80007,
        'type': 1,
        'klass': 8,
        'cost': 3,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, [2, 2])

    def run(self, target, **kwargs):
        # TODO
        return []
Exemple #14
0
class 地狱烈焰(Spell):
    data = {
        'id': 80009,
        'type': 1,
        'klass': 8,
        'cost': 4,
    }
    ext.add_dh_bonus_data(data, 3)

    def run(self, target, **kwargs):
        targets = ext.collect_all(self, oop=True)
        return [
            std_events.AreaDamage(self.game, self, targets,
                                  [self.dh_values[0] for _ in targets])
        ]
Exemple #15
0
class 暗影箭(Spell):
    data = {
        'id': 80008,
        'type': 1,
        'klass': 8,
        'cost': 3,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 4)

    can_do_action = ext.require_minion
    check_target = ext.checker_minion

    def run(self, target, **kwargs):
        return [std_events.Damage(self.game, self, target, self.dh_values[0])]
Exemple #16
0
class 旋风斩(Spell):
    data = {
        'id': 90002,
        'type': 1,
        'klass': 9,
        'cost': 1,
    }
    ext.add_dh_bonus_data(data, 1)

    def run(self, target, **kwargs):
        targets = ext.collect_all_minions(self, False, oop=True)
        return [
            std_events.AreaDamage(self.game, self, targets,
                                  [self.dh_values[0] for _ in targets])
        ]
Exemple #17
0
class 背刺(Spell):
    data = {
        'id': 60000,
        'type': 1,
        'klass': 6,
        'cost': 1,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 2)

    can_do_action, check_target = ext.action_target_checker_factory_cond_minion(
        lambda target: not target.damaged)

    def run(self, target, **kwargs):
        return [std_events.Damage(self.game, self, target, self.dh_values[0])]
Exemple #18
0
class 冰霜震击(Spell):
    data = {
        'id': 70005,
        'type': 1,
        'klass': 7,
        'cost': 1,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 1)

    check_target = ext.checker_enemy_character

    def run(self, target, **kwargs):
        # TODO
        return []
Exemple #19
0
class 心灵震爆(Spell):
    data = {
        'id': 50005,
        'type': 1,
        'klass': 5,
        'cost': 2,
    }
    ext.add_dh_bonus_data(data, 5)

    def run(self, target, **kwargs):
        return [
            std_events.Damage(self.game, self,
                              self.game.get_hero(1 - self.player_id),
                              self.dh_values[0])
        ]
Exemple #20
0
class 寒冰箭(Spell):
    data = {
        'id': 30004,
        'type': 1,
        'klass': 3,
        'cost': 2,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 3)

    def run(self, target, **kwargs):
        return [
            std_events.Damage(self.game, self, target, self.dh_values[0]),
            std_events.Freeze(self.game, self, target)
        ]
Exemple #21
0
class 灵魂之火(Spell):
    data = {
        'id': 80004,
        'type': 1,
        'klass': 8,
        'cost': 1,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 4)

    def run(self, target, **kwargs):
        discard_target = choice(self.game.get_zone(Zone.Hand, self.player_id))
        return [
            std_events.Damage(self.game, self, target, self.dh_values[0]),
            std_events.DiscardCard(self.game, self, discard_target)
        ]
Exemple #22
0
class 吸取生命(Spell):
    data = {
        'id': 80007,
        'type': 1,
        'klass': 8,
        'cost': 3,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, [2, 2],
                          [DHBonusEventType.Damage, DHBonusEventType.Healing])

    def run(self, target, **kwargs):
        return [
            std_events.Damage(self.game, self, target, self.dh_values[0]),
            std_events.Healing(self.game, self, target, self.dh_values[1]),
        ]
Exemple #23
0
class QuickDamage(Spell):
    """对敌方英雄造成100点伤害。"""
    data = {
        'id': "T00000003",
        'type': 1,
        'rarity': 0,
        'cost': 0,
    }
    ext.add_dh_bonus_data(data, 100)

    def run(self, target, **kwargs):
        return [
            std_events.Damage(self.game, self,
                              self.game.get_hero(1 - self.player_id),
                              self.dh_values[0])
        ]
Exemple #24
0
class 生命分流(HeroPower):
    data = {
        'id': 7,
        'klass': 8,
        'is_basic': True,
        'cost': 2,
    }
    ext.add_dh_bonus_data(data, 2)

    def run(self, target, **kwargs):
        return [
            std_events.Damage(self.game,
                              self,
                              target=self.game.get_hero(self.player_id),
                              value=self.dh_values[0]),
            std_events.DrawCard(self.game, self, self.player_id)
        ]
Exemple #25
0
class 冰霜震击(Spell):
    data = {
        'id': 70005,
        'type': 1,
        'klass': 7,
        'cost': 1,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, 1)

    check_target = ext.checker_enemy_character

    def run(self, target, **kwargs):
        return [
            std_events.Damage(self.game, self, target, self.dh_values[0]),
            std_events.Freeze(self.game, self, target)
        ]
Exemple #26
0
class 烈焰风暴(Spell):
    data = {
        'id': 30009,
        'type': 1,
        'klass': 3,
        'cost': 7,
    }
    ext.add_dh_bonus_data(data, 4)

    def run(self, target, **kwargs):
        targets = ext.collect_1p_minions(self,
                                         oop=True,
                                         player_id=1 - self.player_id)
        return [
            std_events.AreaDamage(self.game, self, targets,
                                  [self.dh_values[0] for _ in targets])
        ]
Exemple #27
0
class 魔爆术(Spell):
    """[NOTE]: This is a classic card of area damage."""
    data = {
        'id': 30003,
        'type': 1,
        'klass': 3,
        'cost': 2,
    }
    ext.add_dh_bonus_data(data, 1)

    def run(self, target, **kwargs):
        targets = ext.collect_1p_minions(self,
                                         oop=True,
                                         player_id=1 - self.player_id)
        return [
            std_events.AreaDamage(self.game, self, targets,
                                  [self.dh_values[0] for _ in targets])
        ]
Exemple #28
0
class 奥术飞弹(Spell):
    """[NOTE]: This is a classic card of distributed random damage."""
    data = {
        'id': 30001,
        'type': 1,
        'klass': 3,
        'cost': 1,
    }
    ext.add_dh_bonus_data(data, 3)

    def run(self, target, **kwargs):
        return [
            std_events.DistributedDamage(
                self.game,
                self,
                self.dh_values[0],
                collect_fn=lambda: ext.collect_1p(
                    self, player_id=1 - self.player_id, ignore_dead=True),
            )
        ]
Exemple #29
0
class 神圣新星(Spell):
    """[NOTE]: This is a classic card of multiple damage-healing bonus values with different type."""
    data = {
        'id': 50008,
        'type': 1,
        'klass': 5,
        'cost': 5,
    }
    ext.add_dh_bonus_data(data, [2, 2],
                          [DHBonusEventType.Damage, DHBonusEventType.Healing])

    def run(self, target, **kwargs):
        enemies = ext.collect_1p(self, oop=True, player_id=1 - self.player_id)
        friends = ext.collect_1p(self, oop=True, player_id=self.player_id)
        return [
            std_events.AreaDamage(self.game, self, enemies,
                                  [self.dh_values[0] for _ in enemies]),
            std_events.AreaHealing(self.game, self, friends,
                                   [self.dh_values[1] for _ in friends]),
        ]
Exemple #30
0
class 杀戮命令(Spell):
    data = {
        'id': 20008,
        'type': 1, 'klass': 2, 'cost': 3,
        'po_tree': '$HaveTarget',
    }
    ext.add_dh_bonus_data(data, [3, 5])

    def can_do_action(self, msg_fn=None):
        super_result = super().can_do_action(msg_fn=msg_fn)
        if super_result == self.Inactive:
            return super_result

        if self.zone == Zone.Hand and ext.have_friendly_beast(self):
            return self.Highlighted
        return super_result

    def run(self, target, **kwargs):
        value = self.dh_values[1] if ext.have_friendly_beast(self) else self.dh_values[0]
        return [std_events.Damage(self.game, self, target, value)]