diff --git a/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java b/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java index 071f7bc9e34..92b01a83543 100644 --- a/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java +++ b/Mage.Sets/src/mage/cards/s/ScarwoodBandits.java @@ -129,7 +129,7 @@ class DoUnlessAnyOpponentPaysEffect extends OneShotEffect { // do the effects if nobody paid if (doEffect) { for (Effect effect : executingEffects) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); if (effect instanceof OneShotEffect) { result &= effect.apply(game, source); } else { diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalAsThoughEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalAsThoughEffect.java index 19fb2515ba8..92b98edca22 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalAsThoughEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalAsThoughEffect.java @@ -50,10 +50,10 @@ public class ConditionalAsThoughEffect extends AsThoughEffectImpl { public boolean apply(Game game, Ability source) { conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.apply(game, source); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.apply(game, source); } if (!conditionState && effect.getDuration() == Duration.OneUse) { @@ -69,10 +69,10 @@ public class ConditionalAsThoughEffect extends AsThoughEffectImpl { public boolean applies(UUID sourceId, Ability affectedAbility, Ability source, Game game, UUID playerId) { conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(sourceId, affectedAbility, source, game, playerId); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(sourceId, affectedAbility, source, game, playerId); } return false; @@ -82,10 +82,10 @@ public class ConditionalAsThoughEffect extends AsThoughEffectImpl { public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(sourceId, source, affectedControllerId, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(sourceId, source, affectedControllerId, game); } return false; diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java index f4ded9a7ff3..5c147b67a22 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousEffect.java @@ -81,10 +81,10 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl { } else { condition = baseCondition; } - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); effect.init(source, game); if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); otherwiseEffect.init(source, game); } initDone = true; @@ -122,10 +122,10 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl { } boolean conditionState = condition != null && condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.apply(game, source); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.apply(game, source); } switch (effect.getDuration()) { diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java index 83d74dcd3c0..aa798646bb7 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java @@ -52,10 +52,10 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi } else { condition = baseCondition; } - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); effect.init(source, game); if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); otherwiseEffect.init(source, game); } initDone = true; @@ -82,10 +82,10 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi init(source, game); } if (condition.apply(game, source)) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(event, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(event, source, game); } return false; diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalCostModificationEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalCostModificationEffect.java index 3adae692f9d..8c60a3f144d 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalCostModificationEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalCostModificationEffect.java @@ -51,10 +51,10 @@ public class ConditionalCostModificationEffect extends CostModificationEffectImp public boolean apply(Game game, Ability source, Ability abilityToModify) { conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.apply(game, source, abilityToModify); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.apply(game, source, abilityToModify); } if (!conditionState && effect.getDuration() == Duration.OneUse) { @@ -70,10 +70,10 @@ public class ConditionalCostModificationEffect extends CostModificationEffectImp public boolean applies(Ability abilityToModify, Ability source, Game game) { conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(abilityToModify, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(abilityToModify, source, game); } return false; diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalOneShotEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalOneShotEffect.java index ba2e32dd035..d07a6f08526 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalOneShotEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalOneShotEffect.java @@ -53,7 +53,7 @@ public class ConditionalOneShotEffect extends OneShotEffect { if (toApply.isEmpty()) { return true; } - toApply.setTargetPointer(this.targetPointer); + toApply.setTargetPointer(this.getTargetPointer().copy()); toApply.stream().forEach(effect -> effect.apply(game, source)); return true; } diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalPreventionEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalPreventionEffect.java index 8600b50c7b6..911b06b2b97 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalPreventionEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalPreventionEffect.java @@ -68,10 +68,10 @@ public class ConditionalPreventionEffect extends PreventionEffectImpl { } else { condition = baseCondition; } - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); effect.init(source, game); if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); otherwiseEffect.init(source, game); } initDone = true; @@ -80,10 +80,10 @@ public class ConditionalPreventionEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.replaceEvent(event, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.replaceEvent(event, source, game); } @@ -110,10 +110,10 @@ public class ConditionalPreventionEffect extends PreventionEffectImpl { } conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(event, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(event, source, game); } return false; diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalReplacementEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalReplacementEffect.java index c57f64a637d..0060c66fa4a 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalReplacementEffect.java @@ -60,10 +60,10 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl { } else { condition = baseCondition; } - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); effect.init(source, game); if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); otherwiseEffect.init(source, game); } initDone = true; @@ -72,10 +72,10 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.replaceEvent(event, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.replaceEvent(event, source, game); } if (!conditionState && effect.getDuration() == Duration.OneUse) { @@ -100,10 +100,10 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl { } conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(event, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(event, source, game); } return false; diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalRequirementEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalRequirementEffect.java index e8a94bb8d35..fc1d569d9d4 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalRequirementEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalRequirementEffect.java @@ -64,10 +64,10 @@ public class ConditionalRequirementEffect extends RequirementEffect { } else { condition = baseCondition; } - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); effect.init(source, game); if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); otherwiseEffect.init(source, game); } initDone = true; @@ -80,10 +80,10 @@ public class ConditionalRequirementEffect extends RequirementEffect { } conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(permanent, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(permanent, source, game); } if (!conditionState && effect.getDuration() == Duration.OneUse) { diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalRestrictionEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalRestrictionEffect.java index 03da9b7c055..05ae2063883 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalRestrictionEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalRestrictionEffect.java @@ -63,10 +63,10 @@ public class ConditionalRestrictionEffect extends RestrictionEffect { } else { condition = baseCondition; } - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); effect.init(source, game); if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); otherwiseEffect.init(source, game); } initDone = true; @@ -79,10 +79,10 @@ public class ConditionalRestrictionEffect extends RestrictionEffect { } conditionState = condition.apply(game, source); if (conditionState) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); return effect.applies(permanent, source, game); } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); return otherwiseEffect.applies(permanent, source, game); } if (effect.getDuration() == Duration.OneUse) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java index 30c9d2e0c62..e7b80d9ab3f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java @@ -51,7 +51,7 @@ public class DoIfClashWonEffect extends OneShotEffect { executingEffect.setTargetPointer(new FixedTarget(opponent.getId())); } } else { - executingEffect.setTargetPointer(this.targetPointer); + executingEffect.setTargetPointer(this.getTargetPointer().copy()); } if (executingEffect instanceof OneShotEffect) { return executingEffect.apply(game, source); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index fad28fa849b..c8c408787d3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -111,7 +111,7 @@ public class DoIfCostPaid extends OneShotEffect { private void applyEffects(Game game, Ability source, Effects effects) { if (!effects.isEmpty()) { for (Effect effect : effects) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); if (effect instanceof OneShotEffect) { effect.apply(game, source); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java index 5e6e1d8c25e..65c44b6e434 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java @@ -104,7 +104,7 @@ public class DoUnlessAnyPlayerPaysEffect extends OneShotEffect { // do the effects if nobody paid if (doEffect) { for (Effect effect : executingEffects) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); if (effect instanceof OneShotEffect) { result &= effect.apply(game, source); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java index 6614819785a..40f9f22a1cc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessControllerPaysEffect.java @@ -75,7 +75,7 @@ public class DoUnlessControllerPaysEffect extends OneShotEffect { // do the effects if not paid if (doEffect) { for (Effect effect : executingEffects) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); if (effect instanceof OneShotEffect) { result &= effect.apply(game, source); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java index 71d8c4ea4d9..f2aa6a26fa3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java @@ -110,7 +110,7 @@ public class DoUnlessTargetPlayerOrTargetsControllerPaysEffect extends OneShotEf // do the effects if not paid if (doEffect) { for (Effect effect : executingEffects) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); if (effect instanceof OneShotEffect) { result &= effect.apply(game, source); } else { @@ -118,7 +118,7 @@ public class DoUnlessTargetPlayerOrTargetsControllerPaysEffect extends OneShotEf } } } else if (otherwiseEffect != null) { - otherwiseEffect.setTargetPointer(this.targetPointer); + otherwiseEffect.setTargetPointer(this.getTargetPointer().copy()); if (otherwiseEffect instanceof OneShotEffect) { result &= otherwiseEffect.apply(game, source); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/FlipCoinEffect.java b/Mage/src/main/java/mage/abilities/effects/common/FlipCoinEffect.java index d289b93d621..377568d923c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/FlipCoinEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/FlipCoinEffect.java @@ -65,7 +65,7 @@ public class FlipCoinEffect extends OneShotEffect { } boolean result = true; for (Effect effect : controller.flipCoin(source, game, true) ? executingEffectsWon : executingEffectsLost) { - effect.setTargetPointer(this.targetPointer); + effect.setTargetPointer(this.getTargetPointer().copy()); if (effect instanceof OneShotEffect) { result &= effect.apply(game, source); } else {