* Herald's Horn - Fixed that cast cost reduction was also applied to other players.

This commit is contained in:
LevelX2 2018-04-30 23:15:48 +02:00
parent f27f32ec5e
commit 940fe603c6
3 changed files with 25 additions and 13 deletions

View file

@ -53,6 +53,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
private FilterCard filter;
private int amount;
private final boolean upTo;
private boolean onlyControlled;
public SpellsCostReductionAllEffect(int amount) {
this(new FilterCard("Spells"), amount);
@ -63,19 +64,24 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
}
public SpellsCostReductionAllEffect(FilterCard filter, int amount, boolean upTo) {
this(filter, amount, upTo, false);
}
public SpellsCostReductionAllEffect(FilterCard filter, int amount, boolean upTo, boolean onlyControlled) {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
this.filter = filter;
this.amount = amount;
this.upTo = upTo;
this.onlyControlled = onlyControlled;
this.staticText = filter.getMessage() + " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast";
}
protected SpellsCostReductionAllEffect(SpellsCostReductionAllEffect effect) {
protected SpellsCostReductionAllEffect(final SpellsCostReductionAllEffect effect) {
super(effect);
this.filter = effect.filter;
this.amount = effect.amount;
this.upTo = effect.upTo;
this.onlyControlled = effect.onlyControlled;
}
@Override
@ -136,6 +142,9 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (onlyControlled && abilityToModify.getControllerId().equals(source.getControllerId())) {
return false;
}
if (abilityToModify instanceof SpellAbility) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) {

View file

@ -19,7 +19,11 @@ import mage.game.Game;
public class SpellsCostReductionAllOfChosenSubtypeEffect extends SpellsCostReductionAllEffect {
public SpellsCostReductionAllOfChosenSubtypeEffect(FilterCard filter, int amount) {
super(filter, amount);
this(filter, amount, false);
}
public SpellsCostReductionAllOfChosenSubtypeEffect(FilterCard filter, int amount, boolean onlyControlled) {
super(filter, amount, false, onlyControlled);
}
public SpellsCostReductionAllOfChosenSubtypeEffect(final SpellsCostReductionAllOfChosenSubtypeEffect effect) {