From bc851d0b51a61a5b144abd015c818689a565d711 Mon Sep 17 00:00:00 2001 From: Sloth Date: Mon, 3 Feb 2014 20:08:25 +0000 Subject: [PATCH] - Fixed spells cast by AF Play effects (like Isochron Scepter) not triggering cast spell triggers (like storm). --- .../java/forge/game/ability/effects/PlayEffect.java | 11 ++++++++--- .../java/forge/gui/player/HumanPlaySpellAbility.java | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java b/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java index 39079f0df2c..d781051839d 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java @@ -22,6 +22,7 @@ import forge.game.player.Player; import forge.game.spellability.Spell; import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbilityRestriction; +import forge.game.zone.Zone; import forge.game.zone.ZoneType; import forge.item.PaperCard; import forge.util.Aggregates; @@ -154,10 +155,14 @@ public class PlayEffect extends SpellAbilityEffect { } Card original = tgtCard; if (sa.hasParam("CopyCard")) { + Zone zone = tgtCard.getZone(); tgtCard = Card.fromPaperCard(tgtCard.getPaperCard(), sa.getActivatingPlayer()); tgtCard.setToken(true); - tgtCard.setCopiedSpell(true); + tgtCard.setZone(zone); + if (zone != null) { + zone.add(tgtCard); + } if (useEncoded) { tgtCard.setSVar("IsEncoded", "Number$1"); @@ -200,9 +205,9 @@ public class PlayEffect extends SpellAbilityEffect { if (sa.hasParam("CopyOnce")) { tgtCards.remove(original); } - SpellAbility tgtSA = null; + // only one mode can be used - tgtSA = sa.getActivatingPlayer().getController().getAbilityToPlay(sas); + SpellAbility tgtSA = sa.getActivatingPlayer().getController().getAbilityToPlay(sas); boolean noManaCost = sa.hasParam("WithoutManaCost"); if (noManaCost) { tgtSA = tgtSA.copyWithNoManaCost(); diff --git a/forge-gui/src/main/java/forge/gui/player/HumanPlaySpellAbility.java b/forge-gui/src/main/java/forge/gui/player/HumanPlaySpellAbility.java index 08ef922dc49..03b98411590 100644 --- a/forge-gui/src/main/java/forge/gui/player/HumanPlaySpellAbility.java +++ b/forge-gui/src/main/java/forge/gui/player/HumanPlaySpellAbility.java @@ -66,7 +66,9 @@ public class HumanPlaySpellAbility { final Card c = this.ability.getSourceCard(); if (this.ability instanceof Spell && !c.isCopiedSpell()) { fromZone = game.getZoneOf(c); - zonePosition = fromZone.getCards().indexOf(c); + if (fromZone != null) { + zonePosition = fromZone.getCards().indexOf(c); + } this.ability.setSourceCard(game.getAction().moveToStack(c)); }