def handle(self, evt_type, act): if evt_type == 'action_after' and isinstance(act, ActionStage): tgt = act.target if not tgt.has_skill(LittleLegion): return act c, = user_choose_cards( self, tgt, ('cards', 'showncards', 'equips')) or (None, ) if c is None: return act g = Game.getgame() assert 'equipment' in c.category category = c.equipment_category g.process_action(Reforge(tgt, tgt, c)) if tgt.dead: return act if category == 'weapon': g.process_action(LittleLegionAttackAction(tgt, tgt)) elif category == 'shield': g.process_action(LittleLegionCoverAction(tgt, tgt)) elif category == 'accessories': g.process_action(LittleLegionHoldAction(tgt, tgt)) elif category in ('redufo', 'greenufo'): g.process_action(LittleLegionControlAction(tgt, tgt)) return act
def apply_action(self): src, tgt = self.source, self.target g = Game.getgame() src.tags['darknoh_tag'] = src.tags['turn_count'] sk = self.associated_card card = sk.associated_cards[0] self.card = card migrate_cards([sk], tgt.showncards, unwrap=True) self.n = n = len(tgt.cards) + len(tgt.showncards) - tgt.life if n <= 0: return True cards = user_choose_cards(self, tgt, ('cards', 'showncards')) if not cards: cl = list(tgt.cards) + list(tgt.showncards) try: cl.remove(card) except: pass cards = cl[:n] g.players.reveal(cards) g.process_action(DropCards(src, tgt, cards)) return True
def apply_action(self): tgt, victim = self.target, self.victim if tgt.dead: return False g = Game.getgame() sel = ShipwreckChooseCard(tgt, victim) g.process_action(sel) c = sel.card tgt.reveal(c) migrate_cards([c], tgt.cards, unwrap=True) n = self.dropn if n <= 0: g.process_action(ShipwreckBrokenScoop(tgt, victim)) return True g = Game.getgame() cards = user_choose_cards(self, tgt, ('cards', 'showncards')) if not cards: from itertools import chain cards = list(chain(tgt.cards, tgt.showncards))[min(-n, 0):] g.process_action(ShipwreckEffect(tgt, victim, cards)) return True
def handle(self, evt_type, act): if evt_type == 'action_after' and isinstance(act, ActionStage): tgt = act.target if not tgt.has_skill(LittleLegion): return act c, = user_choose_cards(self, tgt, ('cards', 'showncards', 'equips')) or (None,) if c is None: return act g = Game.getgame() assert 'equipment' in c.category category = c.equipment_category g.process_action(Reforge(tgt, tgt, c)) if tgt.dead: return act if category == 'weapon': g.process_action(LittleLegionAttackAction(tgt, tgt)) elif category == 'shield': g.process_action(LittleLegionCoverAction(tgt, tgt)) elif category == 'accessories': g.process_action(LittleLegionHoldAction(tgt, tgt)) elif category in ('redufo', 'greenufo'): g.process_action(LittleLegionControlAction(tgt, tgt)) return act
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): 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): tgt, victim = self.target, self.victim cards = user_choose_cards(self, tgt, ('cards', 'showncards')) if not cards: return False c, = cards g = Game.getgame() g.process_action(ResonanceLaunchCard(tgt, [victim], c, bypass_check=True)) return True
def apply_action(self): tgt, victim = self.target, self.victim cards = user_choose_cards(self, tgt, ('cards', 'showncards')) if not cards: return False c, = cards g = Game.getgame() g.process_action( ResonanceLaunchCard(tgt, [victim], c, bypass_check=True)) return True
def handle(self, p, act): if p.dead: return act if not p.has_skill(MiracleMallet): return act self.number = act.card.number self.act = act cards = user_choose_cards(self, p, ('cards', 'showncards', 'equips')) if cards: c = cards[0] Game.getgame().process_action(MiracleMalletAction(p, act.target, act, c)) return act
def apply_action(self): src = self.source tgt = self.target cards = user_choose_cards(self, tgt, ('cards', 'showncards')) g = Game.getgame() if cards: self.peer_action = 'drop' g.process_action(DropCards(src, tgt, cards)) else: self.peer_action = 'draw' g.process_action(DrawCards(src, 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 handle(self, evt_type, act): if evt_type == 'action_before' and isinstance(act, FatetellStage): g = Game.getgame() for p in g.players: if p.dead: continue if not p.has_skill(Ciguatera): continue cards = user_choose_cards(self, p, ('cards', 'showncards', 'equips')) if cards: g.process_action(CiguateraAction(p, act.target, cards)) return act
def apply_action(self): attacker, victim = self.target_list src = self.source g = Game.getgame() tags = self.source.tags tags['darkness_tag'] = tags['turn_count'] cards = user_choose_cards(self, attacker, ('cards', 'showncards')) if cards: c = cards[0] g.process_action(LaunchCard(attacker, [victim], c)) else: g.process_action(Damage(src, attacker, 1)) return True
def handle(self, p, act): if p.dead: return act if not p.has_skill(MiracleMallet): return act self.number = act.card.number self.act = act cards = user_choose_cards(self, p, ("cards", "showncards", "equips")) if cards: c = cards[0] Game.getgame().process_action(MiracleMalletAction(p, act.target, act, c)) return act
def handle(self, p, act): if p.dead: return act if not p.has_skill(Trial): return act self.act = act if not user_input([p], ChooseOptionInputlet(self, (False, True))): return act cards = user_choose_cards(self, p, ('cards', 'showncards', 'equips')) if cards: c = cards[0] Game.getgame().process_action(TrialAction(p, act.target, act, c)) return act
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): 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): tl = self.target_list assert len(tl) == 2 src = self.source attacker, victim = tl cards = user_choose_cards(self, attacker, ['cards', 'showncards']) g = Game.getgame() if cards: g.players.reveal(cards) g.process_action(LaunchCard(attacker, [victim], cards[0])) else: l = [e for e in attacker.equips if e.equipment_category == 'weapon'] migrate_cards(l, src.cards) 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 handle(self, evt_type, act): if evt_type == 'action_after' and isinstance(act, Damage): if not act.succeeded: return act src, tgt = act.source, act.target if not (src and src.has_skill(AyaRoundfanSkill) and tgt.equips): return act g = Game.getgame() pa = g.action_stack[-1] if not isinstance(pa, basic.BaseAttack): return act cards = user_choose_cards(self, src, ('cards', 'showncards')) if not cards: return act g = Game.getgame() g.process_action(DropCards(src, src, cards)) g.process_action(AyaRoundfan(src, tgt)) return act
def apply_action(self): tl = self.target_list assert len(tl) == 2 src = self.source attacker, victim = tl cards = user_choose_cards(self, attacker, ['cards', 'showncards']) g = Game.getgame() if cards: g.players.reveal(cards) g.process_action(LaunchCard(attacker, [victim], cards[0])) else: l = [ e for e in attacker.equips if e.equipment_category == 'weapon' ] migrate_cards(l, src.cards) 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): 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 handle(self, evt_type, act): if evt_type == 'action_before' and isinstance(act, Damage): g = Game.getgame() pact = g.action_stack[-1] pcard = getattr(pact, 'associated_card', None) if not pcard: return act if pcard.is_card(SentryAttack): # Sentry effect src = pact.source if not src.dead and user_input( [src], ChooseOptionInputlet(self, (False, True))): # Guard dmg = pcard.target_damage dmg.amount = max(0, dmg.amount - 1) act.cancelled = True else: # Attack pass elif pcard.is_card(AttackCard) and isinstance(pact, BaseAttack): # Sentry fire for p in g.players: if p.dead: continue if not p.has_skill(Sentry): continue if p is pact.source: continue tgt = pact.source self.target = tgt # for ui self.act = act dist = LaunchCard.calc_distance(p, AttackCard()) if dist.get(tgt, 1) > 0: continue cl = user_choose_cards(self, p, ('cards', 'showncards', 'equips')) if not cl: continue c = SentryAttack.wrap(cl, p) c.target_damage = act g.process_action(LaunchCard(p, [tgt], c)) else: return act return act
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 handle(self, evt_type, arg): if evt_type == 'attack_aftergraze': act, succeed = arg assert isinstance(act, basic.BaseAttack) if succeed: return arg src = act.source tgt = act.target if not src or not src.has_skill(LaevateinSkill): return arg g = Game.getgame() cards = user_choose_cards(self, src, ('cards', 'showncards', 'equips')) if not cards: return arg g.process_action(DropCards(src, src, cards)) g.process_action(Laevatein(src, tgt)) return act, True return arg
def handle(self, evt_type, act): if evt_type == 'action_before' and isinstance(act, Damage): g = Game.getgame() pact = g.action_stack[-1] pcard = getattr(pact, 'associated_card', None) if not pcard: return act if pcard.is_card(SentryAttack): # Sentry effect src = pact.source if not src.dead and user_input([src], ChooseOptionInputlet(self, (False, True))): # Guard dmg = pcard.target_damage dmg.amount = max(0, dmg.amount - 1) act.cancelled = True else: # Attack pass elif pcard.is_card(AttackCard) and isinstance(pact, BaseAttack): # Sentry fire for p in g.players: if p.dead: continue if not p.has_skill(Sentry): continue if p is pact.source: continue tgt = pact.source self.target = tgt # for ui self.act = act dist = LaunchCard.calc_distance(p, AttackCard()) if dist.get(tgt, 1) > 0: continue cl = user_choose_cards(self, p, ('cards', 'showncards', 'equips')) if not cl: continue c = SentryAttack.wrap(cl, p) c.target_damage = act g.process_action(LaunchCard(p, [tgt], c)) else: return act return act
def activate_action(self): p = self.source self.cards = cards = user_choose_cards(self, p, ('cards', 'showncards', 'equips')) if not cards: return False p.tags['ran_ei'] = p.tags['turn_count'] + 1 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