public boolean hasOutcome(Outcome outcome) { for (Effect effect : this) { if (effect.getOutcome() == outcome) { return true; } } return false; }
public List<Outcome> getOutcomes() { Set<Outcome> outcomes = new HashSet<>(); for (Effect effect : this) { outcomes.add(effect.getOutcome()); } return new ArrayList<>(outcomes); }
public int getOutcomeTotal() { int total = 0; for (Effect effect : this) { if (effect.getOutcome().isGood()) { total++; } else { total--; } } return total; }
public PutIntoGraveFromAnywhereEffect(Effect baseEffect, Condition condition, String text, boolean selfScope, boolean optional) { super(Duration.EndOfGame, baseEffect.getOutcome(), selfScope); this.baseEffects.add(baseEffect); this.text = text; this.condition = condition; this.optional = optional; }
public EntersBattlefieldEffect(Effect baseEffect, Condition condition, String text, boolean selfScope, boolean optional, EnterEventType enterEventType) { super(Duration.WhileOnBattlefield, baseEffect.getOutcome(), selfScope); this.baseEffects.add(baseEffect); this.enterEventType = enterEventType; this.text = text; this.condition = condition; this.optional = optional; }
public KinshipBaseEffect(Effect kinshipEffect) { super(kinshipEffect.getOutcome()); this.kinshipEffects.add(kinshipEffect); this.staticText = "you may look at the top card of your library. If it shares a creature type with {this}, you may reveal it. If you do, "; }
public AsTurnedFaceUpEffect(Effect baseEffect, boolean optional) { super(Duration.WhileOnBattlefield, baseEffect.getOutcome(), true); this.baseEffects.add(baseEffect); this.optional = optional; }
@Override public void filter(Game game, List<Ability> actions) { for (Ability ability : actions) { for (Effect effect: ability.getEffects()) { if (effect.getOutcome() == Outcome.AIDontUseIt) { removeAbility(ability); break; } } } } }
public RescueFromTheUnderworldCreateDelayedTriggeredAbilityEffect(DelayedTriggeredAbility ability) { super(ability.getEffects().get(0).getOutcome()); this.ability = ability; }
private static int isEffectRemoval(Card card, Ability ability, Effect effect) { if (effect.getOutcome() == Outcome.Removal) { log.debug("Found removal: " + card.getName()); return 1; return 1; if (effect.getOutcome() == Outcome.Damage || effect instanceof DamageTargetEffect) { for (Target target : ability.getTargets()) { if (!(target instanceof TargetPlayerOrPlaneswalker)) { if (effect.getOutcome() == Outcome.DestroyPermanent || effect instanceof DestroyTargetEffect || effect instanceof ExileTargetEffect ||
public CreateDelayedTriggeredAbilityEffect(DelayedTriggeredAbility ability, boolean copyTargets, boolean initAbility) { super(ability.getEffects().isEmpty() ? Outcome.Detriment : ability.getEffects().get(0).getOutcome()); this.ability = ability; this.copyTargets = copyTargets; this.initAbility = initAbility; }
public CreateSpecialActionEffect(SpecialAction action) { super(action.getEffects().isEmpty() ? Outcome.Detriment : action.getEffects().get(0).getOutcome()); this.action = action; }
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard, Layer layer, SubLayer subLayer) { super(duration, layer, subLayer, !ability.getEffects().isEmpty() ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility); this.ability = ability; staticText = rule; this.onCard = onCard; this.addDependencyType(DependencyType.AddingAbility); }
boolean good = true; for (Effect effect : ability.getEffects()) { if (effect.getOutcome().isGood()) { bad = false; } else {
private void playRemoval(List<UUID> creatures, Game game) { for (UUID creatureId : creatures) { for (Card card : this.playableInstant) { if (card.getSpellAbility().canActivate(playerId, game).canActivate()) { for (Effect effect : card.getSpellAbility().getEffects()) { if (effect.getOutcome() == Outcome.DestroyPermanent || effect.getOutcome() == Outcome.ReturnToHand) { if (card.getSpellAbility().getTargets().get(0).canTarget(creatureId, card.getSpellAbility(), game)) { if (this.activateAbility(card.getSpellAbility(), game)) { return; } } } } } } } }
boolean result = true; if (cost.canPay(source, source.getSourceId(), player.getId(), game) && executingEffects.size() > 0 && (!optional || player.chooseUse(executingEffects.get(0).getOutcome(), message, source, game))) { cost.clearPaid(); int bookmark = game.bookmarkState();
@Override public boolean resolve(Game game) { if (isOptional()) { MageObject object = game.getObject(getSourceId()); Player player = game.getPlayer(this.getControllerId()); if (player != null && object != null) { if (!player.chooseUse(getEffects().isEmpty() ? Outcome.Detriment : getEffects().get(0).getOutcome(), this.getRule(object.getLogName()), this, game)) { return false; } } else { return false; } } //20091005 - 603.4 if (checkInterveningIfClause(game)) { return super.resolve(game); } return false; }
Effect effect = card.getSpellAbility().getEffects().get(0); if (effect != null) { Outcome outcome = effect.getOutcome(); if (outcome.isGood()) { enchantments++;
if (chooseUseText == null || player.chooseUse(executingEffect.getOutcome(), message, source, game)) { if (ClashEffect.getInstance().apply(game, source)) { if (setTargetPointerToClashedOpponent) {
@Override public StackObject createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets) { Ability newAbility = this.copy(); newAbility.newId(); StackAbility newStackAbility = new StackAbility(newAbility, newControllerId); game.getStack().push(newStackAbility); if (chooseNewTargets && !newAbility.getTargets().isEmpty()) { Player controller = game.getPlayer(newControllerId); Outcome outcome = newAbility.getEffects().isEmpty() ? Outcome.Detriment : newAbility.getEffects().get(0).getOutcome(); if (controller.chooseUse(outcome, "Choose new targets?", source, game)) { newAbility.getTargets().clearChosen(); newAbility.getTargets().chooseTargets(outcome, newControllerId, newAbility, false, game); } } game.fireEvent(new GameEvent(GameEvent.EventType.COPIED_STACKOBJECT, newStackAbility.getId(), this.getId(), newControllerId)); return newStackAbility; }