diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index f9e56d059a3..e78eb4c41ce 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -2052,19 +2052,6 @@ public class AbilityUtils { } } - public static SpellAbility getCause(SpellAbility sa) { - final SpellAbility root = sa.getRootAbility(); - SpellAbility cause = sa; - if (root.isReplacementAbility()) { - SpellAbility replacingObject = (SpellAbility) root.getReplacingObject(AbilityKey.Cause); - if (replacingObject != null) { - cause = replacingObject; - } - } - return cause; - } - - public static SpellAbility addSpliceEffects(final SpellAbility sa) { final Card source = sa.getHostCard(); final Player player = sa.getActivatingPlayer(); diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java index 2af9a6ba2d6..97d09682bfb 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java @@ -448,8 +448,6 @@ public class ChangeZoneEffect extends SpellAbilityEffect { final Game game = player.getGame(); final CardCollection commandCards = new CardCollection(); - SpellAbility cause = AbilityUtils.getCause(sa); - ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination")); final List origin = Lists.newArrayList(); if (sa.hasParam("Origin")) { @@ -553,7 +551,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } } - movedCard = game.getAction().moveToLibrary(gameCard, libraryPosition, cause); + movedCard = game.getAction().moveToLibrary(gameCard, libraryPosition, sa); } else { if (destination.equals(ZoneType.Battlefield)) { @@ -659,7 +657,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { setFaceDownState(gameCard, sa); } - movedCard = game.getAction().moveTo(gameCard.getController().getZone(destination), gameCard, cause, moveParams); + movedCard = game.getAction().moveTo(gameCard.getController().getZone(destination), gameCard, sa, moveParams); if (sa.hasParam("Unearth")) { movedCard.setUnearthed(true); movedCard.addChangedCardKeywords(Lists.newArrayList("Haste"), null, false, false, @@ -699,7 +697,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { gameCard.setExiledWith(host); gameCard.setExiledBy(host.getController()); } - movedCard = game.getAction().moveTo(destination, gameCard, cause); + movedCard = game.getAction().moveTo(destination, gameCard, sa); if (ZoneType.Hand.equals(destination) && ZoneType.Command.equals(originZone.getZoneType())) { StringBuilder sb = new StringBuilder(); sb.append(movedCard.getName()).append(" has moved from Command Zone to ").append(player).append("'s hand."); @@ -1181,15 +1179,6 @@ public class ChangeZoneEffect extends SpellAbilityEffect { final boolean forget = sa.hasParam("ForgetChanged"); final boolean champion = sa.hasParam("Champion"); final boolean imprint = sa.hasParam("Imprint"); - - final SpellAbility root = sa.getRootAbility(); - SpellAbility cause = sa; - if (root.isReplacementAbility()) { - SpellAbility replacingObject = (SpellAbility) root.getReplacingObject(AbilityKey.Cause); - if (replacingObject != null) { - cause = replacingObject; - } - } boolean combatChanged = false; final CardZoneTable triggerList = new CardZoneTable(); @@ -1211,7 +1200,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { Map moveParams = Maps.newEnumMap(AbilityKey.class); moveParams.put(AbilityKey.FoundSearchingLibrary, searchedLibrary); if (destination.equals(ZoneType.Library)) { - movedCard = game.getAction().moveToLibrary(c, libraryPos, cause, moveParams); + movedCard = game.getAction().moveToLibrary(c, libraryPos, sa, moveParams); } else if (destination.equals(ZoneType.Battlefield)) { if (sa.hasParam("Tapped")) { @@ -1302,7 +1291,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { c.turnFaceDown(true); setFaceDownState(c, sa); } - movedCard = game.getAction().moveToPlay(c, c.getController(), cause, moveParams); + movedCard = game.getAction().moveToPlay(c, c.getController(), sa, moveParams); if (sa.hasParam("Tapped")) { movedCard.setTapped(true); } else if (sa.hasParam("Untapped")) { @@ -1333,7 +1322,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } } else { - movedCard = game.getAction().moveTo(destination, c, 0, cause, moveParams); + movedCard = game.getAction().moveTo(destination, c, 0, sa, moveParams); } movedCards.add(movedCard); diff --git a/forge-game/src/main/java/forge/game/ability/effects/ETBReplacementEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ETBReplacementEffect.java index e934cc8dcdc..846cafbbe82 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ETBReplacementEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ETBReplacementEffect.java @@ -3,7 +3,6 @@ package forge.game.ability.effects; import java.util.Map; import forge.game.ability.AbilityKey; -import forge.game.ability.AbilityUtils; import forge.game.ability.SpellAbilityEffect; import forge.game.card.Card; import forge.game.spellability.SpellAbility; @@ -19,6 +18,6 @@ public class ETBReplacementEffect extends SpellAbilityEffect { Map params = AbilityKey.newMap(); params.put(AbilityKey.CardLKI, sa.getReplacingObject(AbilityKey.CardLKI)); params.put(AbilityKey.ReplacementEffect, sa.getReplacementEffect()); - sa.getActivatingPlayer().getGame().getAction().moveToPlay(card, card.getController(), AbilityUtils.getCause(sa), params); + sa.getActivatingPlayer().getGame().getAction().moveToPlay(card, card.getController(), sa, params); } } \ No newline at end of file diff --git a/forge-game/src/main/java/forge/game/ability/effects/TokenEffect.java b/forge-game/src/main/java/forge/game/ability/effects/TokenEffect.java index aefdd9097a9..d902416c16e 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/TokenEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/TokenEffect.java @@ -67,10 +67,6 @@ public class TokenEffect extends TokenEffectBase { } } - // Cause of the Token Effect, in general it should be this - // but if its a Replacement Effect, it might be something else or null - SpellAbility cause = AbilityUtils.getCause(sa); - Card prototype = loadTokenPrototype(sa); final int finalAmount = AbilityUtils.calculateAmount(host, sa.getParamOrDefault("TokenAmount", "1"), sa); @@ -88,7 +84,7 @@ public class TokenEffect extends TokenEffectBase { MutableBoolean combatChanged = new MutableBoolean(false); for (final Player owner : AbilityUtils.getDefinedPlayers(host, sa.getParamOrDefault("TokenOwner", "You"), sa)) { - makeTokens(prototype, owner, sa, finalAmount, cause != null, false, triggerList, combatChanged); + makeTokens(prototype, owner, sa, finalAmount, true, false, triggerList, combatChanged); } if (!useZoneTable) {