Ejemplo n.º 1
0
    def apply_action(self):
        src = self.source
        tgt = self.target
        options = (
            Card.SPADE, Card.HEART,
            Card.CLUB, Card.DIAMOND,
        )

        card = self.associated_card
        detach_cards([card])
        suit = user_input([tgt], ChooseOptionInputlet(self, options))

        src.tags['surprise_tag'] = src.tags['turn_count']
        assert card

        g = Game.getgame()
        g.players.reveal(card.associated_cards)
        migrate_cards([card], tgt.showncards, unwrap=True)

        if card.suit != suit:
            g.process_action(Damage(src, tgt))
            rst = True
        else:
            rst = False

        return rst
Ejemplo n.º 2
0
 def prepare(self):
     tl = self.target_list
     g = Game.getgame()
     cards = g.deck.getcards(len(tl))
     g.players.reveal(cards)
     detach_cards(cards)
     trans = InputTransaction('HarvestChoose', g.players, cards=cards)
     trans.begin()
     self.cards = cards
     self.trans = trans
Ejemplo n.º 3
0
 def prepare(self):
     tl = self.target_list
     g = Game.getgame()
     cards = g.deck.getcards(len(tl))
     g.players.reveal(cards)
     detach_cards(cards)
     trans = InputTransaction('HarvestChoose', g.players, cards=cards)
     trans.begin()
     self.cards = cards
     self.trans = trans
Ejemplo n.º 4
0
    def apply_action(self):
        g = Game.getgame()
        c = self.card
        ft = self.ft
        g.players.exclude(self.source).reveal(c)
        with MigrateCardsTransaction(self) as trans:
            migrate_cards([ft.card], g.deck.droppedcards, unwrap=True, trans=trans, is_bh=True)
            detach_cards([c], trans=trans)
            self.ft.set_card(c, self)

        return True
Ejemplo n.º 5
0
    def apply_action(self):
        g = Game.getgame()
        c = self.card
        ft = self.ft
        src = self.source
        g.players.exclude(src).reveal(c)
        with MigrateCardsTransaction(self) as trans:
            migrate_cards([ft.card], src.cards, unwrap=True, trans=trans, is_bh=True)
            detach_cards([c], trans=trans)
            self.ft.set_card(c, self)

        return True
Ejemplo n.º 6
0
    def apply_action(self):
        ft = self.ftact
        tgt = ft.target

        from .definition import YinYangOrbCard
        for e in tgt.equips:
            if e.is_card(YinYangOrbCard):
                with MigrateCardsTransaction(self) as trans:
                    migrate_cards([ft.card], tgt.cards, unwrap=True, trans=trans, is_bh=True)
                    detach_cards([e], trans=trans)
                    self.card = e
                    ft.set_card(e, self)

                break
        else:
            raise GameError('Player has YinYangOrb skill but no equip!')

        return True
Ejemplo n.º 7
0
    def apply_action(self):
        ft = self.ftact
        tgt = ft.target

        from .definition import YinYangOrbCard
        for e in tgt.equips:
            if e.is_card(YinYangOrbCard):
                with MigrateCardsTransaction(self) as trans:
                    migrate_cards([ft.card],
                                  tgt.cards,
                                  unwrap=True,
                                  trans=trans,
                                  is_bh=True)
                    detach_cards([e], trans=trans)
                    self.card = e
                    ft.set_card(e, self)

                break
        else:
            raise GameError('Player has YinYangOrb skill but no equip!')

        return True