Minor change.

This commit is contained in:
LevelX2 2015-07-04 22:16:56 +02:00
parent 87e953f6ba
commit 1c9e7d653d

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.abilities.effects.common.cost; package mage.abilities.effects.common.cost;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -39,19 +38,17 @@ import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.util.CardUtil; import mage.util.CardUtil;
/** /**
* *
* @author LevelX2 * @author LevelX2
*/ */
public class SpellCostReductionSourceEffect extends CostModificationEffectImpl { public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
private final int amount; private final int amount;
private ManaCosts<ManaCost> manaCostsToReduce = null; private ManaCosts<ManaCost> manaCostsToReduce = null;
private final Condition condition; private final Condition condition;
public SpellCostReductionSourceEffect(ManaCosts<ManaCost> manaCostsToReduce, Condition condition) { public SpellCostReductionSourceEffect(ManaCosts<ManaCost> manaCostsToReduce, Condition condition) {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST); super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
this.amount = 0; this.amount = 0;
this.manaCostsToReduce = manaCostsToReduce; this.manaCostsToReduce = manaCostsToReduce;
@ -59,14 +56,13 @@ public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("{this} costs "); sb.append("{this} costs ");
for (String manaSymbol :manaCostsToReduce.getSymbols()) { for (String manaSymbol : manaCostsToReduce.getSymbols()) {
sb.append(manaSymbol); sb.append(manaSymbol);
} }
sb.append(" less to if ").append(this.condition.toString()); sb.append(" less to if ").append(this.condition.toString());
this.staticText = sb.toString(); this.staticText = sb.toString();
} }
public SpellCostReductionSourceEffect(int amount, Condition condition) { public SpellCostReductionSourceEffect(int amount, Condition condition) {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST); super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
this.amount = amount; this.amount = amount;
@ -76,7 +72,7 @@ public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
this.staticText = sb.toString(); this.staticText = sb.toString();
} }
protected SpellCostReductionSourceEffect(SpellCostReductionSourceEffect effect) { protected SpellCostReductionSourceEffect(final SpellCostReductionSourceEffect effect) {
super(effect); super(effect);
this.amount = effect.amount; this.amount = effect.amount;
this.manaCostsToReduce = effect.manaCostsToReduce; this.manaCostsToReduce = effect.manaCostsToReduce;
@ -85,7 +81,7 @@ public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source, Ability abilityToModify) { public boolean apply(Game game, Ability source, Ability abilityToModify) {
if (manaCostsToReduce != null){ if (manaCostsToReduce != null) {
CardUtil.adjustCost((SpellAbility) abilityToModify, manaCostsToReduce, false); CardUtil.adjustCost((SpellAbility) abilityToModify, manaCostsToReduce, false);
} else { } else {
CardUtil.reduceCost(abilityToModify, this.amount); CardUtil.reduceCost(abilityToModify, this.amount);
@ -95,7 +91,7 @@ public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getSourceId().equals(source.getSourceId()) && (abilityToModify instanceof SpellAbility)) { if (abilityToModify.getSourceId().equals(source.getSourceId()) && (abilityToModify instanceof SpellAbility)) {
return condition.apply(game, source); return condition.apply(game, source);
} }
return false; return false;