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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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