@Override public boolean checkInterveningIfClause(Game game) { if (interveningIfClauseCondition != null) { return interveningIfClauseCondition.apply(game, this); } return true; }
@Override public boolean apply(Game game, Ability source) { if(!conditionChecked) { result = condition.apply(game, source); conditionChecked = true; } return result; }
@Override public Effects getEffects(Game game, EffectType effectType) { if (!condition.apply(game, this)) { return emptyEffects; } return super.getEffects(game, effectType); }
@Override public Effects getEffects(Game game, EffectType effectType) { if (!condition.apply(game, this)) { return emptyEffects; } return super.getEffects(game, effectType); }
@Override public boolean apply(Game game, Ability source) { if (condition.apply(game, source)) { return applyEffect(game, source); } return false; }
@Override public Effects getEffects(Game game, EffectType effectType) { if (!condition.apply(game, this)) { return emptyEffects; } return super.getEffects(game, effectType); }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { if (condition == null || condition.apply(game, source)) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { // has to return true, if the spell cannot be cast in the current phase / step if (event.getSourceId().equals(source.getSourceId())) { if (condition != null && !condition.apply(game, source)) { return true; } } return false; // cast not prevented by this effect }
@Override public ActivationStatus canActivate(UUID playerId, Game game) { if (!condition.apply(game, this)) { return ActivationStatus.getFalse(); } return super.canActivate(playerId, game); }
@Override public Effects getEffects(Game game, EffectType effectType) { if (!condition.apply(game, this)) { return new Effects(); } return super.getEffects(game, effectType); }
@Override public List<Mana> getNetMana(Game game, Ability source) { if (condition.apply(game, source)) { return effect.getNetMana(game, source); } else if (otherwiseEffect != null) { return otherwiseEffect.getNetMana(game, source); } return null; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD && event.getTargetId().equals(source.getSourceId())) { if (condition == null || condition.apply(game, source)) { return true; } } return false; }
@Override public boolean isAvailable(Ability source, Game game) { boolean conditionApplies = condition == null || condition.apply(game, source); boolean filterApplies = filter == null || filter.match(game.getCard(source.getSourceId()), game); return conditionApplies && filterApplies; }
@Override public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { conditionState = condition.apply(game, source); if (conditionState) { effect.setTargetPointer(this.targetPointer); return effect.applies(sourceId, source, affectedControllerId, game); } else if (otherwiseEffect != null) { otherwiseEffect.setTargetPointer(this.targetPointer); return otherwiseEffect.applies(sourceId, source, affectedControllerId, game); } return false; }
@Override public ActivationStatus canActivate(UUID playerId, Game game) { if (condition.apply(game, this) && costs.canPay(this, sourceId, playerId, game) && game.isActivePlayer(playerId)) { this.activatorId = playerId; return ActivationStatus.getTrue(); } return ActivationStatus.getFalse(); }
@Override public boolean apply(Game game, Ability source) { if (condition.apply(game, source)) { effect.setTargetPointer(this.targetPointer); return effect.apply(game, source); } else if (otherwiseEffect == null) { return true; // nothing to do - no problem } otherwiseEffect.setTargetPointer(this.targetPointer); return otherwiseEffect.apply(game, source); }
@Override public boolean applies(GameEvent event, Ability source, Game game) { // has to return true, if the spell cannot be cast in the current phase / step if (event.getSourceId().equals(source.getSourceId())) { if ((turnPhase != null && game.getPhase().getType() != turnPhase) || (phaseStep != null && (game.getTurn().getStepType() != phaseStep)) || (condition != null && !condition.apply(game, source))) { return true; } } return false; // cast not prevented by this effect }
@Override public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { if (sourceId.equals(source.getSourceId()) && source.isControlledBy(affectedControllerId)) { Card card = game.getCard(source.getSourceId()); if (card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { return condition.apply(game, source); } } return false; }
@Override public boolean checkInterveningIfClause(Game game) { Condition condition = new ControlsPermanentsComparedToOpponentsCondition( ComparisonType.EQUAL_TO, new FilterPermanent()); Player controller = game.getPlayer(controllerId); if (controller != null && condition.apply(game, this)) { return super.checkInterveningIfClause(game); } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { ability.setSourceId(this.getSourceId()); ability.setControllerId(this.getControllerId()); return ability.checkTrigger(event, game) && condition.apply(game, this); }