def is_valid(self): src = self.source card = self.associated_card.associated_cards[0] if card.is_card(AttackCard) and src.tags['vitality'] < 1: if not AttackCardVitalityHandler.is_disabled(src): return False if card.usage != 'launch': return False victim = self.target tgts = self.target_list[1:] lc = LaunchCard(victim, tgts, card) return lc.can_fire()
def is_valid(self): src = self.source card = self.associated_card.associated_cards[0] if card.is_card(AttackCard) and src.tags["vitality"] < 1: if not AttackCardVitalityHandler.is_disabled(src): return False if card.usage != "launch": return False victim = self.target tgts = self.target_list[1:] lc = LaunchCard(victim, tgts, card) return lc.can_fire()
def handle(self, evt_type, act): if evt_type == 'action_before' and isinstance(act, DrawCardStage): if act.cancelled: return act tgt = act.target if not tgt.has_skill(CriticalStrike): return act if not user_input([tgt], ChooseOptionInputlet(self, (False, True))): return act Game.getgame().process_action(CriticalStrikeAction(tgt, tgt)) act.amount = max(0, act.amount - 1) elif evt_type == 'action_apply' and isinstance(act, BaseAttack): src = act.source tags = src.tags if not self.in_critical_strike(src): return act tgt = act.target if isinstance(act, BaseAttack): tags['flan_targets'].append(tgt) act.damage += 1 elif evt_type == 'action_before' and isinstance(act, Damage): g = Game.getgame() pact = g.action_stack[-1] if not isinstance(pact, BaseDuel): return act src, tgt = act.source, act.target if not self.in_critical_strike(src): return act act.amount += 1 elif evt_type == 'action_before' and isinstance(act, ActionStageLaunchCard): src = act.source if not self.in_critical_strike(src): return act if act.card.is_card(AttackCard): act.vitality_consumed = True src.tags['vitality'] -= 1 elif evt_type == 'action_shootdown': if not isinstance(act, ActionStageLaunchCard): return act c = act.card src = act.source tags = src.tags if not self.in_critical_strike(src): return act if not c.is_card(AttackCard): return act if src.has_skill(ElementalReactorSkill): return act if src.tags['vitality'] > 0: return act if getattr(act, 'vitality_consumed', False): return act if set(act.target_list) & set(tags['flan_targets']): raise CriticalStrikeLimit return act elif evt_type == 'action_stage_action': tgt = act if not self.in_critical_strike(tgt): return act AttackCardVitalityHandler.disable(tgt) return act
def handle(self, evt_type, act): if evt_type == 'action_before' and isinstance(act, DrawCardStage): if act.cancelled: return act tgt = act.target if not tgt.has_skill(CriticalStrike): return act if not user_input([tgt], ChooseOptionInputlet(self, (False, True))): return act Game.getgame().process_action(CriticalStrikeAction(tgt, tgt)) act.amount = max(0, act.amount - 1) elif evt_type == 'action_apply' and isinstance(act, BaseAttack): src = act.source tags = src.tags if not self.in_critical_strike(src): return act tgt = act.target if isinstance(act, BaseAttack): tags['flan_targets'].append(tgt) act.damage += 1 elif evt_type == 'action_before' and isinstance(act, Damage): g = Game.getgame() pact = g.action_stack[-1] if not isinstance(pact, BaseDuel): return act src, tgt = act.source, act.target if not self.in_critical_strike(src): return act act.amount += 1 elif evt_type == 'action_before' and isinstance( act, ActionStageLaunchCard): src = act.source if not self.in_critical_strike(src): return act if act.card.is_card(AttackCard): act.vitality_consumed = True src.tags['vitality'] -= 1 elif evt_type == 'action_shootdown': if not isinstance(act, ActionStageLaunchCard): return act c = act.card src = act.source tags = src.tags if not self.in_critical_strike(src): return act if not c.is_card(AttackCard): return act if src.has_skill(ElementalReactorSkill): return act if src.tags['vitality'] > 0: return act if getattr(act, 'vitality_consumed', False): return act if set(act.target_list) & set(tags['flan_targets']): raise CriticalStrikeLimit return act elif evt_type == 'action_stage_action': tgt = act if not self.in_critical_strike(tgt): return act AttackCardVitalityHandler.disable(tgt) return act