Fixed Will Kenrith first ability duration and second ability not working

This commit is contained in:
Evan Kranzler 2018-05-28 14:08:13 -04:00
parent ea0a677e46
commit a21496ef5f
2 changed files with 16 additions and 8 deletions

View file

@ -29,6 +29,7 @@ package mage.abilities.effects.common.cost;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
@ -54,6 +55,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
private int amount;
private final boolean upTo;
private boolean onlyControlled;
private UUID controllerId;
public SpellsCostReductionAllEffect(int amount) {
this(new FilterCard("Spells"), amount);
@ -74,6 +76,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
this.upTo = upTo;
this.onlyControlled = onlyControlled;
this.staticText = filter.getMessage() + " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast";
this.controllerId = null;
}
protected SpellsCostReductionAllEffect(final SpellsCostReductionAllEffect effect) {
@ -82,6 +85,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
this.amount = effect.amount;
this.upTo = effect.upTo;
this.onlyControlled = effect.onlyControlled;
this.controllerId = effect.controllerId;
}
@Override
@ -145,6 +149,9 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
if (onlyControlled && !abilityToModify.getControllerId().equals(source.getControllerId())) {
return false;
}
if (controllerId != null && !abilityToModify.getControllerId().equals(controllerId)) {
return false;
}
if (abilityToModify instanceof SpellAbility) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) {
@ -158,6 +165,10 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
return false;
}
public void setControllerId(UUID controllerId) {
this.controllerId = controllerId;
}
@Override
public SpellsCostReductionAllEffect copy() {
return new SpellsCostReductionAllEffect(this);