From 2c671efedbcc3ec3ccac772e302e1b04b7fe00fb Mon Sep 17 00:00:00 2001 From: elcnesh Date: Mon, 16 Mar 2015 09:23:24 +0000 Subject: [PATCH] Fix not being able to pay alternative costs. --- .../src/main/java/forge/game/spellability/Ability.java | 2 +- .../java/forge/game/spellability/SpellAbility.java | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/spellability/Ability.java b/forge-game/src/main/java/forge/game/spellability/Ability.java index e68acc376b9..4c8d7c97dd1 100644 --- a/forge-game/src/main/java/forge/game/spellability/Ability.java +++ b/forge-game/src/main/java/forge/game/spellability/Ability.java @@ -76,7 +76,7 @@ public abstract class Ability extends SpellAbility { return this.getHostCard().isInPlay() && !this.getHostCard().isFaceDown(); } - public static final Ability PLAY_LAND_SURROGATE = new Ability(null, (Cost)null, null){ + public static final Ability PLAY_LAND_SURROGATE = new Ability(null, (Cost) null) { @Override public boolean canPlay() { return true; //if this ability is added anywhere, it can be assumed that land can be played diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java index 8b4865f5185..eece6aa29c2 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java @@ -134,12 +134,12 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit private TargetRestrictions targetRestrictions = null; private TargetChoices targetChosen = new TargetChoices(); - private final SpellAbilityView view; + private SpellAbilityView view; - protected SpellAbility(final Card iSourceCard, Cost toPay) { + protected SpellAbility(final Card iSourceCard, final Cost toPay) { this(iSourceCard, toPay, null); } - protected SpellAbility(final Card iSourceCard, Cost toPay, SpellAbilityView view0) { + protected SpellAbility(final Card iSourceCard, final Cost toPay, SpellAbilityView view0) { id = nextId(); hostCard = iSourceCard; payCosts = toPay; @@ -579,6 +579,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit try { clone = (SpellAbility) clone(); clone.id = nextId(); + clone.view = new SpellAbilityView(clone); + if (clone.hostCard != null && clone.hostCard.getGame() != null) { + clone.hostCard.getGame().addSpellAbility(clone.id, clone); + } } catch (final CloneNotSupportedException e) { System.err.println(e); }