示例#1
0
    def apply_action(self):
        tgt = self.target
        src = self.source

        catnames = ('cards', 'showncards', 'equips', 'fatetell')
        cats = [getattr(tgt, i) for i in catnames]
        card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames))
        card = card or random_choose_card(cats)
        if not card:
            return False

        self.card = card
        src.reveal(card)

        src.tags['spirit_away_tag'] += 1

        cl = getattr(tgt, 'yukari_dimension', None)
        if cl is None:
            cl = CardList(tgt, 'yukari_dimension')
            tgt.yukari_dimension = cl
            tgt.showncardlists.append(cl)

        migrate_cards([card], cl)

        return True
示例#2
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()

        catnames = ('cards', 'showncards', 'equips', 'fatetell')
        cats = [getattr(tgt, i) for i in catnames]

        l = []
        for i in xrange(2):
            if not (tgt.cards or tgt.showncards or tgt.equips or tgt.fatetell):
                break

            card = user_input(
                [src], ChoosePeerCardInputlet(self, tgt, catnames)
            )

            if not card:
                card = random_choose_card(cats)
            if card:
                l.append(card)
                g.players.exclude(tgt).reveal(card)
                g.process_action(DropCards(src, tgt, [card]))

        self.cards = l
        return True
示例#3
0
 def apply_action(self):
     tgt = self.target
     c, = user_choose_cards(self, tgt,
                            ('cards', 'showncards', 'equips')) or (None, )
     c = c or random_choose_card([tgt.cards, tgt.showncards, tgt.equips])
     self.card = c
     return True
示例#4
0
    def apply_action(self):
        src, tgt = self.source, self.target
        cards = user_choose_cards(self, tgt, ('cards', 'showncards'))
        c = cards[0] if cards else random_choose_card([tgt.cards, tgt.showncards])
        src.reveal(c)
        migrate_cards([c], src.cards)

        return True
示例#5
0
 def apply_action(self):
     tgt = self.target
     assert tgt.cards
     c = random_choose_card([tgt.cards])
     g = Game.getgame()
     g.players.reveal(c)
     tgt.tags['mind_hack_effect-%s' % g.turn_count] = True
     migrate_cards([c], tgt.showncards)
     return True
示例#6
0
 def apply_action(self):
     tgt = self.target
     assert tgt.cards
     c = random_choose_card([tgt.cards])
     g = Game.getgame()
     g.players.reveal(c)
     tgt.tags['mind_hack_effect-%s' % g.turn_count] = True
     migrate_cards([c], tgt.showncards)
     return True
示例#7
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()

        equip = user_input([src], ChoosePeerCardInputlet(self, tgt, ['equips']))
        equip = equip or random_choose_card([tgt.equips])
        g.process_action(DropCards(src, tgt, [equip]))
        self.card = equip

        return True
示例#8
0
    def apply_action(self):
        src, tgt = self.source, self.target
        cards = user_choose_cards(self, src, ('cards', 'showncards', 'equips'))
        c = cards[0] if cards else random_choose_card([src.cards, src.showncards, src.equips])
        if not c:
            return False

        tgt.reveal(c)
        migrate_cards([c], tgt.cards)

        return True
示例#9
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()

        equip = user_input([src],
                           ChoosePeerCardInputlet(self, tgt, ['equips']))
        equip = equip or random_choose_card([tgt.equips])
        g.process_action(DropCards(src, tgt, [equip]))
        self.card = equip

        return True
示例#10
0
    def apply_action(self):
        src, tgt = self.source, self.target
        ttags(src)['dismantle'] = True

        g = Game.getgame()
        c = user_input([src], ChoosePeerCardInputlet(self, tgt, ('equips', )))
        c = c or random_choose_card([tgt.equips])
        if not c: return False

        g.process_action(Reforge(src, tgt, c))
        g.process_action(DrawCards(tgt, 1))

        return True
示例#11
0
    def apply_action(self):
        src, tgt = self.source, self.target
        ttags(src)['dismantle'] = True

        g = Game.getgame()
        c = user_input([src], ChoosePeerCardInputlet(self, tgt, ('equips', )))
        c = c or random_choose_card([tgt.equips])
        if not c: return False

        g.process_action(Reforge(src, tgt, c))
        g.process_action(DrawCards(tgt, 1))

        return True
示例#12
0
文件: cirno.py 项目: 17night/thbattle
    def apply_action(self):
        src, tgt = self.source, self.target
        ttags(src)['bakadesu'] = True

        cl = user_choose_cards(self, tgt, ('cards', 'showncards'))
        g = Game.getgame()
        if cl:
            g.process_action(LaunchCard(tgt, [src], cl[0]))
        else:
            c = user_input([src], ChoosePeerCardInputlet(self, tgt, ('cards', 'showncards', 'equips')))
            c = c or random_choose_card([tgt.cards, tgt.showncards, tgt.equips])
            c and g.process_action(CirnoDropCards(src, tgt, [c]))

        return True
示例#13
0
文件: alice.py 项目: TimLang/thbattle
    def apply_action(self):
        g = Game.getgame()
        cl = self.cards
        track_ids = set([c.track_id for c in cl])

        src, tgt = self.source, self.target
        for c in cl:
            c = user_input([src], ChoosePeerCardInputlet(self, tgt, ('cards', 'showncards', 'equips')))
            c = c or random_choose_card([tgt.cards, tgt.showncards, tgt.equips])
            if not c: return True
            g.players.reveal(c)
            g.process_action(DollBlastEffect(src, tgt, c, c.track_id in track_ids))

        return True
示例#14
0
    def apply_action(self):
        src, tgt, cl = self.source, self.target, self.cards
        g = Game.getgame()

        c = user_input([src], ChooseIndividualCardInputlet(
            self, cl)) or random_choose_card([cl])
        g.process_action(Reforge(src, tgt, c))
        '''
        candidates = [i for i in g.players if not i.dead]
        p, = user_choose_players(self, src, candidates) or (src,)

        g.process_action(DrawCards(p, 1))
        '''

        return True
示例#15
0
    def apply_action(self):
        src, tgt, cl = self.source, self.target, self.cards
        g = Game.getgame()

        c = user_input([src], ChooseIndividualCardInputlet(self, cl)) or random_choose_card([cl])
        g.process_action(Reforge(src, tgt, c))

        '''
        candidates = [i for i in g.players if not i.dead]
        p, = user_choose_players(self, src, candidates) or (src,)

        g.process_action(DrawCards(p, 1))
        '''

        return True
示例#16
0
    def apply_action(self):
        g = Game.getgame()
        src, tgt = self.source, self.target

        catnames = ('cards', 'showncards', 'equips', 'fatetell')
        cats = [getattr(tgt, i) for i in catnames]
        card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames))
        if not card:
            card = random_choose_card(cats)
            if not card:
                return False

        self.card = card
        g.players.exclude(tgt).reveal(card)
        g.process_action(DropCards(src, tgt, cards=[card]))
        return True
示例#17
0
    def apply_action(self):
        t = self.target
        src = self.source
        g = Game.getgame()

        catnames = ('cards', 'showncards', 'equips')
        cats = [getattr(t, i) for i in catnames]
        cards = user_choose_cards(self, t, catnames)
        if not cards:
            cards = [random_choose_card(cats)]

        if cards:
            g.players.exclude(t).reveal(cards)
            migrate_cards(cards, src.showncards)

        return True
示例#18
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()

        catnames = ('cards', 'showncards', 'equips')
        cats = [getattr(tgt, i) for i in catnames]

        card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames))
        card = card or random_choose_card(cats)

        assert card
        self.card = card

        g.players.reveal(card)
        g.process_action(DropCards(src, tgt, [card]))
        return True
示例#19
0
    def apply_action(self):
        t = self.target
        src = self.source
        g = Game.getgame()

        catnames = ('cards', 'showncards', 'equips')
        cats = [getattr(t, i) for i in catnames]
        cards = user_choose_cards(self, t, catnames)
        if not cards:
            cards = [random_choose_card(cats)]

        if cards:
            g.players.exclude(t).reveal(cards)
            migrate_cards(cards, src.showncards)

        return True
示例#20
0
文件: cirno.py 项目: 17night/thbattle
    def apply_action(self):
        self.damage.cancelled = True

        src, tgt = self.source, self.target
        g = Game.getgame()
        cl = user_choose_cards(self, tgt, ('cards', 'showncards', 'equips'))
        c = cl[0] if cl else random_choose_card([tgt.cards, tgt.showncards, tgt.equips])

        if c:
            damage = c.resides_in is not tgt.equips
            g.process_action(CirnoDropCards(src, tgt, [c]))

            if damage:
                g.process_action(LifeLost(src, tgt, 1))

        return True
示例#21
0
    def apply_action(self):
        src = self.source
        tgt = self.target

        catnames = ('cards', 'showncards', 'equips', 'fatetell')
        cats = [getattr(tgt, i) for i in catnames]
        card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames))
        if not card:
            card = random_choose_card(cats)
            if not card:
                return False

        self.card = card
        src.reveal(card)
        migrate_cards([card], src.cards, unwrap=True)
        return True
示例#22
0
    def apply_action(self):
        src = self.source
        tgt = self.target
        g = Game.getgame()

        c = user_input([src], ChoosePeerCardInputlet(self, tgt, ('cards', 'showncards', 'equips')))
        c = c or random_choose_card([tgt.cards, tgt.showncards])
        if not c: return False
        src.reveal(c)
        migrate_cards([c], src.cards)
        src.tags['borrow_tag'] = src.tags['turn_count']

        if user_input([tgt], ChooseOptionInputlet(self, (False, True))):
            g.process_action(LaunchCard(tgt, [src], Daze(tgt), bypass_check=True))

        return True
示例#23
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()

        catnames = ('cards', 'showncards', 'equips')
        cats = [getattr(tgt, i) for i in catnames]

        card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames))
        card = card or random_choose_card(cats)

        assert card
        self.card = card

        g.players.reveal(card)
        g.process_action(DropCards(src, tgt, [card]))
        return True
示例#24
0
    def apply_action(self):
        src = self.source
        tgt = self.target

        catnames = ('cards', 'showncards', 'equips', 'fatetell')
        cats = [getattr(tgt, i) for i in catnames]
        card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames))
        if not card:
            card = random_choose_card(cats)
            if not card:
                return False

        self.card = card
        src.reveal(card)
        migrate_cards([card], src.cards, unwrap=True)
        return True
示例#25
0
    def apply_action(self):
        self.damage.cancelled = True

        src, tgt = self.source, self.target
        g = Game.getgame()
        cl = user_choose_cards(self, tgt, ('cards', 'showncards', 'equips'))
        c = cl[0] if cl else random_choose_card(
            [tgt.cards, tgt.showncards, tgt.equips])

        if c:
            damage = c.resides_in is not tgt.equips
            g.process_action(CirnoDropCards(src, tgt, [c]))

            if damage:
                g.process_action(LifeLost(src, tgt, 1))

        return True
示例#26
0
    def apply_action(self):
        src, tgt = self.source, self.target
        ttags(src)['bakadesu'] = True

        cl = user_choose_cards(self, tgt, ('cards', 'showncards'))
        g = Game.getgame()
        if cl:
            g.process_action(LaunchCard(tgt, [src], cl[0]))
        else:
            c = user_input([src],
                           ChoosePeerCardInputlet(
                               self, tgt, ('cards', 'showncards', 'equips')))
            c = c or random_choose_card(
                [tgt.cards, tgt.showncards, tgt.equips])
            c and g.process_action(CirnoDropCards(src, tgt, [c]))

        return True
示例#27
0
    def apply_action(self):
        pact = ForEach.get_actual_action(self)
        cards = pact.cards
        cards_avail = [c for c in cards if c.detached]
        if not cards_avail: return False
        tgt = self.target

        card = user_input(
            [tgt],
            ChooseIndividualCardInputlet(self, cards_avail),
            trans=pact.trans,
        ) or random_choose_card([cards_avail])

        migrate_cards([card], tgt.cards)

        pact.trans.notify('harvest_choose', card)
        self.card = card
        return True
示例#28
0
    def handle(self, evt_type, act):
        if evt_type == 'action_apply' and isinstance(act, PlayerTurn):
            actor = act.target
            g = Game.getgame()

            for p in g.players:
                if not p.has_skill(Qiliao): continue
                qi = getattr(p, 'meirin_qiliao', None)
                if not qi: continue
                cl = user_choose_cards(self, actor, ('cards', 'showncards'))
                if not cl: continue
                g.process_action(DropCards(actor, actor, cl))
                if actor.dead: continue
                c = user_input([actor], ChooseIndividualCardInputlet(self, qi)) or random_choose_card([qi])
                g.players.reveal(c)
                g.process_action(DropCards(actor, p, [c]))

        return act
示例#29
0
    def apply_action(self):
        pact = ForEach.get_actual_action(self)
        cards = pact.cards
        cards_avail = [c for c in cards if c.detached]
        if not cards_avail: return False
        tgt = self.target

        card = user_input(
            [tgt],
            ChooseIndividualCardInputlet(self, cards_avail),
            trans=pact.trans,
        ) or random_choose_card([cards_avail])

        migrate_cards([card], tgt.cards)

        pact.trans.notify('harvest_choose', card)
        self.card = card
        return True
示例#30
0
    def apply_action(self):
        g = Game.getgame()
        src, tgt = self.source, self.target

        catnames = ('cards', 'showncards', 'equips', 'fatetell')
        cats = [getattr(tgt, i) for i in catnames]
        card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames))
        if not card:
            card = random_choose_card(cats)
            if not card:
                return False

        self.card = card
        g.players.exclude(tgt).reveal(card)
        g.process_action(
            DropCards(src, tgt, cards=[card])
        )
        return True
示例#31
0
    def apply_action(self):
        g = Game.getgame()
        cl = self.cards
        track_ids = set([c.track_id for c in cl])

        src, tgt = self.source, self.target
        for c in cl:
            c = user_input([src],
                           ChoosePeerCardInputlet(
                               self, tgt, ('cards', 'showncards', 'equips')))
            c = c or random_choose_card(
                [tgt.cards, tgt.showncards, tgt.equips])
            if not c: return True
            g.players.reveal(c)
            g.process_action(
                DollBlastEffect(src, tgt, c, c.track_id in track_ids))

        return True
示例#32
0
    def apply_action(self):
        src = self.source
        tgt = self.target
        g = Game.getgame()

        c = user_input([src],
                       ChoosePeerCardInputlet(
                           self, tgt, ('cards', 'showncards', 'equips')))
        c = c or random_choose_card([tgt.cards, tgt.showncards])
        if not c: return False
        src.reveal(c)
        migrate_cards([c], src.cards)
        src.tags['borrow_tag'] = src.tags['turn_count']

        if user_input([tgt], ChooseOptionInputlet(self, (False, True))):
            g.process_action(
                LaunchCard(tgt, [src], Daze(tgt), bypass_check=True))

        return True
示例#33
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()
        g.process_action(DrawCards(tgt, 2))

        cl = user_choose_cards(self, tgt, ('cards', 'showncards', 'equips'))
        c = cl[0] if cl else random_choose_card([tgt.cards, tgt.showncards, tgt.equips])

        if not c: return False

        g.players.reveal(c)
        g.process_action(ShowCards(tgt, [c]))
        migrate_cards([c], src.cards)

        if c.suit == Card.HEART:
            g.process_action(DrawCards(src, 1))

        self.card = c

        return True
示例#34
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()
        g.process_action(DrawCards(tgt, 2))

        cl = user_choose_cards(self, tgt, ('cards', 'showncards', 'equips'))
        c = cl[0] if cl else random_choose_card(
            [tgt.cards, tgt.showncards, tgt.equips])

        if not c: return False

        g.players.reveal(c)
        g.process_action(ShowCards(tgt, [c]))
        migrate_cards([c], src.cards)

        if c.suit == Card.HEART:
            g.process_action(DrawCards(src, 1))

        self.card = c

        return True
示例#35
0
    def apply_action(self):
        src, tgt = self.source, self.target
        g = Game.getgame()

        catnames = ('cards', 'showncards', 'equips', 'fatetell')
        cats = [getattr(tgt, i) for i in catnames]

        l = []
        for i in xrange(2):
            if not (tgt.cards or tgt.showncards or tgt.equips or tgt.fatetell):
                break

            card = user_input([src],
                              ChoosePeerCardInputlet(self, tgt, catnames))

            if not card:
                card = random_choose_card(cats)
            if card:
                l.append(card)
                g.players.exclude(tgt).reveal(card)
                g.process_action(DropCards(src, tgt, [card]))

        self.cards = l
        return True
示例#36
0
 def apply_action(self):
     tgt = self.target
     c, = user_choose_cards(self, tgt, ('cards', 'showncards', 'equips')) or (None,)
     c = c or random_choose_card([tgt.cards, tgt.showncards, tgt.equips])
     self.card = c
     return True