mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Fixed Will Kenrith first ability duration and second ability not working
This commit is contained in:
parent
ea0a677e46
commit
a21496ef5f
2 changed files with 16 additions and 8 deletions
|
@ -32,7 +32,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||
|
@ -51,7 +50,6 @@ import mage.constants.Outcome;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.emblems.WillKenrithEmblem;
|
||||
import mage.target.TargetPlayer;
|
||||
|
@ -72,11 +70,11 @@ public class WillKenrith extends CardImpl {
|
|||
|
||||
// +2: Until your next turn, up to two target creatures each have base power and toughness 0/3 and lose all abilities.
|
||||
Ability ability = new LoyaltyAbility(
|
||||
new SetPowerToughnessTargetEffect(0, 3, Duration.EndOfTurn)
|
||||
.setText("until end of turn, up to two target creatures each have base power and toughness 0/3"),
|
||||
new SetPowerToughnessTargetEffect(0, 3, Duration.UntilYourNextTurn)
|
||||
.setText("until your next turn, up to two target creatures each have base power and toughness 0/3"),
|
||||
2
|
||||
);
|
||||
ability.addEffect(new LoseAllAbilitiesTargetEffect(Duration.EndOfTurn)
|
||||
ability.addEffect(new LoseAllAbilitiesTargetEffect(Duration.UntilYourNextTurn)
|
||||
.setText("and lose all abilities")
|
||||
);
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 2));
|
||||
|
@ -144,10 +142,9 @@ class WillKenrithCostReductionEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FilterCard filter2 = filter.copy();
|
||||
filter2.add(new ControllerIdPredicate(source.getFirstTarget()));
|
||||
ContinuousEffect effect = new SpellsCostReductionAllEffect(filter2, 2);
|
||||
SpellsCostReductionAllEffect effect = new SpellsCostReductionAllEffect(filter, 2);
|
||||
effect.setDuration(Duration.UntilYourNextTurn);
|
||||
effect.setControllerId(source.getFirstTarget());
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue