Exemple #1
0
            def resp(evt_type, act):
                if evt_type == 'action_before' and isinstance(act, Demolition):
                    g.pause(1.5)
                    dialog(Cirno, u'哈哈,早知道你会用这一招,怎能让你轻易得逞!', 17)
                    g.process_action(LaunchCard(cirno, [cirno], cirnoreject, Reject(cirno, act)))

                elif evt_type == 'action_before' and isinstance(act, Reject) and act.associated_card is cirnoreject:
                    g.pause(1.5)
                    dialog(Meirin, u'这又是怎么回事……好像|G城管执法|r并没有起作用?', 38)
                    dialog(Sakuya, u'咦,这笨蛋居然知道用|G好人卡|r啊……', 19)
                    dialog(Cirno, u'什么笨蛋,老娘是天才,天~才~', 18)
                    text = (
                        u'|G好人卡|r的效果是|R抵消符卡效果|r,也就是说,你的|G城管执法|r的效果被无效化了。\n'
                        u'(在PC版中鼠标移动到卡牌/人物上,或者手机版中长按卡牌/人物头像,就会弹出说明,很有用的)'
                    )
                    dialog(Sakuya, text, 20)
                    dialog(Sakuya, u'但是,|G好人卡|r的“无效符卡”的效果,本身也是符卡效果,是可以被|G好人卡|r抵消的!', 21)

                    meirinreject = g.deck.inject(RejectCard, Card.CLUB, 4)
                    g.process_action(DrawCards(meirin, 1))

                    while not act.cancelled:
                        dialog(Meirin, u'我知道了,我也用|G好人卡|r去抵消她的|G好人卡|r效果就好了!', 39)

                        rej = RejectHandler()
                        rej.target_act = act
                        with InputTransaction('AskForRejectAction', [meirin]) as trans:
                            p, rst = ask_for_action(rej, [meirin], ('cards', 'showncards'), [], trans=trans)

                        if not p: continue
                        cards, _ = rst
                        assert cards[0] is meirinreject
                        g.process_action(LaunchCard(meirin, [cirno], meirinreject, Reject(meirin, act)))

                return act
Exemple #2
0
    def apply_action(self):
        g = Game.getgame()
        tgt = self.target

        while True:
            dc = DrawCards(tgt, 1)
            g.process_action(dc)
            c, = dc.cards
            self.card = c
            g.process_action(ShowCards(tgt, [c]))

            with InputTransaction('ActionStageAction', [tgt]) as trans:
                p, rst = ask_for_action(
                    self, [tgt], ('cards', 'showncards'), g.players, trans=trans
                )

            if p is not tgt:
                g.process_action(WindWalkSkipAction(tgt, tgt))
                break

            cl, tl = rst
            g.players.reveal(cl)
            c, = cl

            g.process_action(WindWalkLaunch(p, tl, c))

        return True
Exemple #3
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()
        pl = [p for p in g.players if not p.dead and p is not src]
        p, rst = ask_for_action(self, pl, ('cards', 'showncards'), [], timeout=6)
        if not p:
            ttags(src)['assisted_attack_disable'] = True
            return False

        (c,), _ = rst
        g.process_action(ActionStageLaunchCard(src, [tgt], AssistedAttackCard.wrap([c], src)))

        return True
Exemple #4
0
    def handle(self, evt_type, act):
        if evt_type == 'action_before' and isinstance(act, SpellCardAction):
            if act.cancelled: return act  # some other thing have done the job
            if act.non_responsive:
                return act

            g = Game.getgame()

            has_reject = False
            while g.SERVER_SIDE:
                # from thb.characters.baseclasses import Character
                # from thb.characters.reimu import SpiritualAttack
                # for p in g.players:
                #     if isinstance(p, Character) and p.has_skill(SpiritualAttack):
                #         has_reject = True
                #         break

                # if has_reject: break

                from thb.cards.definition import RejectCard
                for c in flatten([[p.cards, p.showncards] for p in g.players]):
                    if isinstance(c, RejectCard):
                        has_reject = True
                        break

                break

            has_reject = sync_primitive(has_reject, g.players)
            if not has_reject: return act

            self.target_act = act

            pl = BatchList(p for p in g.players if not p.dead)

            with InputTransaction('AskForRejectAction', pl) as trans:
                p, rst = ask_for_action(self,
                                        pl, ('cards', 'showncards'), [],
                                        trans=trans)

            if not p: return act
            cards, _ = rst
            assert cards and self.cond(cards)
            g.process_action(
                LaunchCard(p, [act.target], cards[0], Reject(p, act)))

        return act
Exemple #5
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()
        pl = [p for p in g.players if not p.dead and p is not src]
        p, rst = ask_for_action(self,
                                pl, ('cards', 'showncards'), [],
                                timeout=6)
        if not p:
            ttags(src)['assisted_attack_disable'] = True
            return False

        (c, ), _ = rst
        g.process_action(
            ActionStageLaunchCard(src, [tgt], AssistedAttackCard.wrap([c],
                                                                      src)))

        return True
            def resp(evt_type, act):
                if evt_type == 'action_before' and isinstance(act, Demolition):
                    g.pause(1.5)
                    dialog(Cirno, u'哈哈,早知道你会用这一招,怎能让你轻易得逞!', 17)
                    g.process_action(
                        LaunchCard(cirno, [cirno], cirnoreject,
                                   Reject(cirno, act)))

                elif evt_type == 'action_before' and isinstance(
                        act, Reject) and act.associated_card is cirnoreject:
                    g.pause(1.5)
                    dialog(Meirin, u'这又是怎么回事……好像|G城管执法|r并没有起作用?', 38)
                    dialog(Sakuya, u'咦,这笨蛋居然知道用|G好人卡|r啊……', 19)
                    dialog(Cirno, u'什么笨蛋,老娘是天才,天~才~', 18)
                    text = (u'|G好人卡|r的效果是|R抵消符卡效果|r,也就是说,你的|G城管执法|r的效果被无效化了。\n'
                            u'(在PC版中鼠标移动到卡牌/人物上,或者手机版中长按卡牌/人物头像,就会弹出说明,很有用的)')
                    dialog(Sakuya, text, 20)
                    dialog(Sakuya,
                           u'但是,|G好人卡|r的“无效符卡”的效果,本身也是符卡效果,是可以被|G好人卡|r抵消的!',
                           21)

                    meirinreject = g.deck.inject(RejectCard, Card.CLUB, 4)
                    g.process_action(DrawCards(meirin, 1))

                    while not act.cancelled:
                        dialog(Meirin, u'我知道了,我也用|G好人卡|r去抵消她的|G好人卡|r效果就好了!',
                               39)

                        rej = RejectHandler()
                        rej.target_act = act
                        with InputTransaction('AskForRejectAction',
                                              [meirin]) as trans:
                            p, rst = ask_for_action(rej, [meirin],
                                                    ('cards', 'showncards'),
                                                    [],
                                                    trans=trans)

                        if not p: continue
                        cards, _ = rst
                        assert cards[0] is meirinreject
                        g.process_action(
                            LaunchCard(meirin, [cirno], meirinreject,
                                       Reject(meirin, act)))

                return act
Exemple #7
0
    def handle(self, evt_type, act):
        if evt_type == 'action_before' and isinstance(act, SpellCardAction):
            if act.cancelled: return act  # some other thing have done the job
            if act.non_responsive:
                return act

            g = Game.getgame()

            has_reject = False
            while g.SERVER_SIDE:
                # from thb.characters.baseclasses import Character
                # from thb.characters.reimu import SpiritualAttack
                # for p in g.players:
                #     if isinstance(p, Character) and p.has_skill(SpiritualAttack):
                #         has_reject = True
                #         break

                # if has_reject: break

                from thb.cards.definition import RejectCard
                for c in flatten([[p.cards, p.showncards] for p in g.players]):
                    if isinstance(c, RejectCard):
                        has_reject = True
                        break

                break

            has_reject = sync_primitive(has_reject, g.players)
            if not has_reject: return act

            self.target_act = act

            pl = BatchList(p for p in g.players if not p.dead)

            with InputTransaction('AskForRejectAction', pl) as trans:
                p, rst = ask_for_action(self, pl, ('cards', 'showncards'), [], trans=trans)

            if not p: return act
            cards, _ = rst
            assert cards and self.cond(cards)
            g.process_action(LaunchCard(p, [act.target], cards[0], Reject(p, act)))

        return act
Exemple #8
0
    def handle(self, evt_type, act):
        if evt_type == 'action_apply' and isinstance(act, FinalizeStage):
            tgt = act.target
            if tgt.has_skill(Xianshizhan):
                g = Game.getgame()
                pl = [p for p in g.players if not p.dead and p is not tgt]
                _, rst = ask_for_action(self, [tgt], ('cards', 'showncards', 'equips'), pl)
                if not rst:
                    return act

                try:
                    cl, pl = rst
                    c, = cl
                    p, = pl
                except Exception:
                    return act

                g.process_action(XianshizhanAction(tgt, p, c))

        return act
Exemple #9
0
    def handle(self, evt_type, act):
        if evt_type == 'action_apply' and isinstance(act, FinalizeStage):
            tgt = act.target
            if tgt.has_skill(Xianshizhan):
                g = Game.getgame()
                pl = [p for p in g.players if not p.dead and p is not tgt]
                _, rst = ask_for_action(self, [tgt],
                                        ('cards', 'showncards', 'equips'), pl)
                if not rst:
                    return act

                try:
                    cl, pl = rst
                    c, = cl
                    p, = pl
                except Exception:
                    return act

                g.process_action(XianshizhanAction(tgt, p, c))

        return act
Exemple #10
0
    def apply_action(self):
        g = Game.getgame()
        tgt = self.target
        a = DrawCards(tgt, self.amount * 2)
        g.process_action(a)
        self.cards = cards = a.cards
        n = len(cards)
        while n > 0:
            pl = [p for p in g.players if not p.dead]
            pl.remove(tgt)
            if not pl:
                return True

            _, rst = ask_for_action(self, [tgt], ('cards',), pl)
            if not rst:
                return True

            cl, pl = rst
            pl[0].reveal(cl)
            migrate_cards(cl, pl[0].cards)
            n -= len(cl)

        return True
Exemple #11
0
    def apply_action(self):
        g = Game.getgame()
        tgt = self.target
        a = DrawCards(tgt, self.amount * 2)
        g.process_action(a)
        self.cards = cards = a.cards
        n = len(cards)
        while n > 0:
            pl = [p for p in g.players if not p.dead]
            pl.remove(tgt)
            if not pl:
                return True

            _, rst = ask_for_action(self, [tgt], ('cards',), pl)
            if not rst:
                return True

            cl, pl = rst
            pl[0].reveal(cl)
            migrate_cards(cl, pl[0].cards)
            n -= len(cl)

        return True