@Override public String getRule() { StringBuilder sb = new StringBuilder(); sb.append("Enchant ").append(targetName); if (!this.getEffects().isEmpty()) { sb.append(". ").append(super.getRule()); } return sb.toString(); } }
@Override public String getText(Mode mode) { if (!staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder("Flip a coin. If you win the flip, ").append(executingEffectsWon.getText(mode)); if (!executingEffectsLost.isEmpty()) { sb.append(". If you lose the flip, ").append(executingEffectsLost.getText(mode)); } return sb.toString(); }
@Override public String getText(Mode mode) { if (!staticText.isEmpty()) { return staticText; } return (optional ? "you may " : "") + getCostText() + ". If you do, " + executingEffects.getText(mode) + (!otherwiseEffects.isEmpty() ? " If you don't, " + otherwiseEffects.getText(mode) : ""); }
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; }
@Override public void addEffect(Effect effect) { if (!getEffects().isEmpty()) { Effect entersBattlefieldEffect = this.getEffects().get(0); if (entersBattlefieldEffect instanceof EntersBattlefieldEffect) { ((EntersBattlefieldEffect) entersBattlefieldEffect).addEffect(effect); return; } } super.addEffect(effect); }
@Override public void addEffect(Effect effect) { if (!getEffects().isEmpty()) { Effect entersBattlefieldEffect = this.getEffects().get(0); if (entersBattlefieldEffect instanceof EntersBattlefieldEffect) { ((EntersBattlefieldEffect) entersBattlefieldEffect).addEffect(effect); return; } } super.addEffect(effect); }
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); }
@Override public void addEffect(Effect effect) { if (!getEffects().isEmpty()) { Effect entersEffect = this.getEffects().get(0); if (entersEffect instanceof EntersBattlefieldEffect) { ((EntersBattlefieldEffect) entersEffect).addEffect(effect); return; } } super.addEffect(effect); }
@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; }
continue; if (!ability.getRuleVisible() && !ability.getEffects().isEmpty()) { if (ability.getEffects().get(0) instanceof BecomesFaceDownCreatureAllEffect) { continue;
@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; }
ability.setRuleVisible(false); continue; } else if (!ability.getRuleVisible() && !ability.getEffects().isEmpty()) { if (ability.getEffects().get(0) instanceof BecomesFaceDownCreatureEffect) { continue;
Outcome outcome = mode.getEffects().isEmpty() ? Outcome.Detriment : mode.getEffects().get(0).getOutcome();
Outcome outcome = getEffects().isEmpty() ? Outcome.Detriment : getEffects().get(0).getOutcome(); if (getTargets().chooseTargets(outcome, this.controllerId, this, noMana, game) == false) { if ((variableManaCost != null || announceString != null)) {
if (sourceObject instanceof StackAbility) { StackAbility stackAbility = (StackAbility) sourceObject; if (!stackAbility.getEffects().isEmpty()) { targetId = stackAbility.getEffects().get(0).getTargetPointer().getFirst(game, stackAbility);