@Override public boolean checksEventType(GameEvent event, Game game) { if (effect.checksEventType(event, game)) { return true; } else if (otherwiseEffect != null) { return otherwiseEffect.checksEventType(event, game); } return false; }
public ConditionalContinuousRuleModifyingEffect(final ConditionalContinuousRuleModifyingEffect effect) { super(effect); this.effect = (ContinuousRuleModifyingEffect) effect.effect.copy(); if (effect.otherwiseEffect != null) { this.otherwiseEffect = (ContinuousRuleModifyingEffect) effect.otherwiseEffect.copy(); } this.condition = effect.condition; this.baseCondition = effect.baseCondition; this.initDone = effect.initDone; }
public ConditionalContinuousRuleModifyingEffect(ContinuousRuleModifyingEffect effect, Condition condition, ContinuousRuleModifyingEffect otherwiseEffect) { super(effect.getDuration(), effect.getOutcome()); this.effect = effect; this.baseCondition = condition; this.otherwiseEffect = otherwiseEffect; }
if (!effect.checksEventType(event, game)) { continue; for (Ability sourceAbility : continuousRuleModifyingEffects.getAbility(effect.getId())) { if (!(sourceAbility instanceof StaticAbility) || sourceAbility.isInUseableZone(game, null, event)) { if (checkAbilityStillExists(sourceAbility, effect, event, game)) { if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) { effect.setValue("targetAbility", targetAbility); if (effect.applies(event, sourceAbility, game)) { if (targetAbility instanceof ActivatedAbility && ((ActivatedAbility) targetAbility).isCheckPlayableMode()) { checkPlayableMode = true; String message = effect.getInfoMessage(sourceAbility, event, game); if (message != null && !message.isEmpty()) { if (effect.sendMessageToUser()) { Player player = game.getPlayer(event.getPlayerId()); if (player != null && !game.isSimulation()) { if (effect.sendMessageToGameLog() && !game.isSimulation()) { game.informPlayers(message);
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (!initDone) { // if simpleStaticAbility, init won't be called init(source, game); } if (condition.apply(game, source)) { effect.setTargetPointer(this.targetPointer); return effect.applies(event, source, game); } else if (otherwiseEffect != null) { otherwiseEffect.setTargetPointer(this.targetPointer); return otherwiseEffect.applies(event, source, game); } return false; }
@Override public void init(Ability source, Game game) { super.init(source, game); if (baseCondition instanceof LockedInCondition) { condition = new FixedCondition(((LockedInCondition) baseCondition).getBaseCondition().apply(game, source)); } else { condition = baseCondition; } effect.setTargetPointer(this.targetPointer); effect.init(source, game); if (otherwiseEffect != null) { otherwiseEffect.setTargetPointer(this.targetPointer); otherwiseEffect.init(source, game); } initDone = true; }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { return effect.getInfoMessage(source, event, game); //To change body of generated methods, choose Tools | Templates. }
@Override public String getText(Mode mode) { if (staticText == null || staticText.isEmpty() && this.effect != null) { // usefull for conditional night/day card abilities return effect.getText(mode); } return staticText; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if(event.getType() == GameEvent.EventType.UNTAP && event.getTargetId().equals(source.getSourceId())) { effect.discard(); } return super.applies(event, source, game); }