From ef6d1f440ea80958e64193b0006839b243f91f9c Mon Sep 17 00:00:00 2001 From: Sloth Date: Wed, 26 Mar 2014 19:31:22 +0000 Subject: [PATCH] - Fixed a bug when Nivmagus Elemental tries to exile copied spells. --- .../java/forge/game/card/CardCharacteristics.java | 4 ++++ .../src/main/java/forge/game/card/CardFactory.java | 1 + .../src/main/java/forge/game/cost/CostExile.java | 13 +++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/forge-game/src/main/java/forge/game/card/CardCharacteristics.java b/forge-game/src/main/java/forge/game/card/CardCharacteristics.java index a0d5d5f3d90..d0567a22773 100644 --- a/forge-game/src/main/java/forge/game/card/CardCharacteristics.java +++ b/forge-game/src/main/java/forge/game/card/CardCharacteristics.java @@ -209,6 +209,10 @@ public class CardCharacteristics { return this.spellAbility; } + public final void setSpellAbility(SpellAbility sa) { + this.spellAbility.clear(); + this.spellAbility.add(sa); + } /** * Gets the intrinsic ability. diff --git a/forge-game/src/main/java/forge/game/card/CardFactory.java b/forge-game/src/main/java/forge/game/card/CardFactory.java index 019cea62531..2b97a841e5e 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactory.java +++ b/forge-game/src/main/java/forge/game/card/CardFactory.java @@ -210,6 +210,7 @@ public class CardFactory { subSA = copySubSA.getSubAbility(); } } + c.getCharacteristics().setSpellAbility(copySA); copySA.setCopied(true); //remove all costs if (!copySA.isTrigger()) { diff --git a/forge-game/src/main/java/forge/game/cost/CostExile.java b/forge-game/src/main/java/forge/game/cost/CostExile.java index c4f6f520d6b..6a8ce26e084 100644 --- a/forge-game/src/main/java/forge/game/cost/CostExile.java +++ b/forge-game/src/main/java/forge/game/cost/CostExile.java @@ -203,17 +203,18 @@ public class CostExile extends CostPartWithList { @Override protected void doPayment(SpellAbility ability, Card targetCard) { Game game = targetCard.getGame(); - game.getAction().exile(targetCard); - + if (this.from.equals(ZoneType.Stack)) { ArrayList spells = targetCard.getSpellAbilities(); for (SpellAbility spell : spells) { - if (targetCard.isInZone(ZoneType.Exile)) { - final SpellAbilityStackInstance si = game.getStack().getInstanceFromSpellAbility(spell); - game.getStack().remove(si); - } + final SpellAbilityStackInstance si = game.getStack().getInstanceFromSpellAbility(spell); + if (si != null) { + game.getStack().remove(si); + } } } + + game.getAction().exile(targetCard); } public static final String HashListKey = "Exiled";