Beispiel #1
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)

            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
Beispiel #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
                )

            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
Beispiel #3
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)

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

                return act
Beispiel #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 ..characters.baseclasses import Character
                from ..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 .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)

            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
Beispiel #5
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 ..characters.baseclasses import Character
                from ..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 .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)

            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
Beispiel #6
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
Beispiel #7
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