def getInputletInstances(self): from thb.cards import AttackCard from thb.characters.youmu import Youmu from thb.common import CharChoice from thb.inputlets import ActionInputlet from thb.inputlets import ChooseGirlInputlet from thb.inputlets import ChooseIndividualCardInputlet from thb.inputlets import ChooseOptionInputlet from thb.inputlets import ChoosePeerCardInputlet from thb.inputlets import ProphetInputlet g, p = self.makeGame() ilets = [ ActionInputlet(self, ['cards', 'showncards'], []), ChooseGirlInputlet(self, {p: [CharChoice(Youmu)]}), ChooseIndividualCardInputlet(self, [AttackCard()]), ChooseOptionInputlet(self, (False, True)), ChoosePeerCardInputlet(self, p, ['cards']), ProphetInputlet(self, [AttackCard()]), ] for i in ilets: i.actor = p return g, p, ilets
def handle(self, evt_type, act): if evt_type == 'action_after' and isinstance(act, PlayerDeath): src = act.source if not src or not src.has_skill(S****t): return act dist = LaunchCard.calc_distance(src, AttackCard()) candidates = [ k for k, v in dist.items() if v <= 0 and k is not src ] if not candidates: return act pl = user_choose_players(self, src, candidates) if pl: Game.getgame().process_action(SadistAction(src, pl[0])) elif evt_type == 'action_before' and isinstance(act, Damage): src = act.source tgt = act.target if not src or src is tgt: return act if not src.has_skill(S****t): return act if tgt.life == 1: act.amount += 1 return act
def is_valid(self): tags = self.source.tags if tags['turn_count'] <= tags['darkness_tag']: return False attacker, victim = self.target_list if not LaunchCard(attacker, [victim], AttackCard()).can_fire(): return False return True
def handle(self, evt_type, act): if evt_type == 'action_apply' and isinstance(act, ActionStage): g = Game.getgame() for p in g.players: if p.dead: continue if not p.has_skill(Sentry): continue tgt = act.target if p is tgt: continue self.target = tgt # for ui dist = LaunchCard.calc_distance(p, AttackCard()) if dist.get(tgt, 1) > 0: continue if not user_input([p], ChooseOptionInputlet(self, (False, True))): continue g.process_action(SentryAction(p, tgt)) return act
def handle(self, evt_type, arg): if self.processing: return arg elif evt_type == 'calcdistance': src, c, dist = arg if not src.has_skill(Telegnosis): return arg if not c.is_card(AttackCard): return arg try: self.processing = True for p in dist: if p is src: continue d = LaunchCard.calc_distance(p, AttackCard()) if d[src] <= 0: dist[p] = 0 finally: self.processing = False return arg
def target(g, p, tl): l = g.players.rotate_to(p) del l[0] dists = LaunchCard.calc_raw_distance(p, AttackCard()) return ([t for t in l if not t.dead and dists[t] <= 1], True)
def is_valid(self): src, tgt = self.source, self.target if not LaunchCard(tgt, [src], AttackCard()).can_fire(): return False return not ttags(src)['bakadesu']
def is_valid(self): src, tgt = self.source, self.target act = ActionStageLaunchCard(src, [tgt], AttackCard()) disabled = ttags(src)['assisted_attack_disable'] return not disabled and act.can_fire()