From 07ddad6e48c36245e6908ef6811c08b7bbf156d9 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Wed, 7 Jul 2021 16:51:53 +0400 Subject: [PATCH] Game: fixed rare bugs in some cards after rollback or cancel actions: * Cumulative upkeep cost - fixed that it can lost payed state (cards: Aboroth, Karplusan Minotaur, Psychic Vortex, Sheltering Ancient); * Effects - fixed that it can lost selected targets or other settings (cards: Citadel of Pain, Crimson Honor Guard, Curfew, Leveler, Mana Cache, Monsoon, Paradigm Shift, Saprazzan Bailiff); * Exile all cards from graveyard ability - fixed that it can lost targets (example: Agent of Erebos); * Melee ability - fixed that it can lost targets (example: Adriana, Captain of the Guard). --- Mage.Sets/src/mage/cards/a/Aboroth.java | 6 +- .../mage/cards/a/AdamaroFirstToDesire.java | 3 +- Mage.Sets/src/mage/cards/a/AlphaStatus.java | 2 +- Mage.Sets/src/mage/cards/a/Anathemancer.java | 2 +- Mage.Sets/src/mage/cards/a/AncientOoze.java | 2 +- Mage.Sets/src/mage/cards/a/AspectOfWolf.java | 7 +-- Mage.Sets/src/mage/cards/b/BurdenOfGreed.java | 2 +- .../src/mage/cards/c/ChildrenOfKorlis.java | 2 +- Mage.Sets/src/mage/cards/c/CitadelOfPain.java | 20 +++---- .../src/mage/cards/c/ConquerorsFlail.java | 8 +-- .../src/mage/cards/c/CrimsonHonorGuard.java | 10 +++- Mage.Sets/src/mage/cards/c/Curfew.java | 8 ++- .../src/mage/cards/d/DemonicAppetite.java | 14 ----- Mage.Sets/src/mage/cards/d/DyingWish.java | 2 +- .../src/mage/cards/e/ElvishHouseParty.java | 2 +- .../src/mage/cards/e/EmissaryOfDespair.java | 2 +- .../mage/cards/e/EndlessRanksOfTheDead.java | 2 +- .../src/mage/cards/e/EnterTheInfinite.java | 2 +- .../src/mage/cards/k/KarplusanMinotaur.java | 6 +- .../mage/cards/k/KinsbaileBorderguard.java | 2 +- Mage.Sets/src/mage/cards/l/Leveler.java | 10 +++- .../src/mage/cards/l/LordOfExtinction.java | 2 +- .../src/mage/cards/l/LostOrderOfJarkeld.java | 2 +- Mage.Sets/src/mage/cards/m/ManaCache.java | 8 ++- .../src/mage/cards/m/MercadiasDownfall.java | 7 +-- Mage.Sets/src/mage/cards/m/Monsoon.java | 8 +-- .../src/mage/cards/m/MurderInvestigation.java | 2 +- Mage.Sets/src/mage/cards/n/Nyxathid.java | 2 +- Mage.Sets/src/mage/cards/p/Pallimud.java | 2 +- Mage.Sets/src/mage/cards/p/ParadigmShift.java | 14 +++-- .../src/mage/cards/p/PredatorsRapport.java | 2 +- .../src/mage/cards/p/PrimeSpeakerZegana.java | 2 +- Mage.Sets/src/mage/cards/p/PsychicVortex.java | 7 ++- .../src/mage/cards/r/RighteousAuthority.java | 3 +- Mage.Sets/src/mage/cards/r/RuneflareTrap.java | 2 +- .../src/mage/cards/s/SaprazzanBailiff.java | 6 +- Mage.Sets/src/mage/cards/s/SewerNemesis.java | 2 +- .../src/mage/cards/s/ShelteringAncient.java | 6 +- Mage.Sets/src/mage/cards/s/SoullessOne.java | 2 +- Mage.Sets/src/mage/cards/s/SpellRupture.java | 2 +- Mage.Sets/src/mage/cards/s/StormEntity.java | 2 +- .../src/mage/cards/s/SupremeLeaderSnoke.java | 2 +- .../src/mage/cards/t/TamiyoTheMoonSage.java | 2 +- Mage.Sets/src/mage/cards/t/TerraRavager.java | 2 +- Mage.Sets/src/mage/cards/u/UmbraStalker.java | 2 +- Mage.Sets/src/mage/cards/u/UrborgJustice.java | 18 +++--- .../src/mage/cards/w/WolfOfDevilsBreach.java | 9 ++- .../base/impl/CardTestPlayerAPIImpl.java | 2 +- .../main/java/mage/abilities/costs/Cost.java | 3 +- .../java/mage/abilities/costs/CostImpl.java | 2 - .../costs/OptionalAdditionalCost.java | 4 +- .../abilities/dynamicvalue/DynamicValue.java | 10 +++- .../common/TargetPermanenToughnessValue.java | 57 ------------------- .../java/mage/abilities/effects/Effect.java | 3 +- .../mage/abilities/effects/OneShotEffect.java | 1 - .../ExileGraveyardAllTargetPlayerEffect.java | 8 ++- .../effects/common/ExileSpellEffect.java | 2 +- .../effects/common/SkipNextCombatEffect.java | 42 -------------- .../ControlTargetPlayerNextTurnEffect.java | 6 +- .../mage/abilities/keyword/MeleeAbility.java | 15 ++++- 60 files changed, 163 insertions(+), 224 deletions(-) delete mode 100644 Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java delete mode 100644 Mage/src/main/java/mage/abilities/effects/common/SkipNextCombatEffect.java diff --git a/Mage.Sets/src/mage/cards/a/Aboroth.java b/Mage.Sets/src/mage/cards/a/Aboroth.java index 4561d265bb..df7955ce33 100644 --- a/Mage.Sets/src/mage/cards/a/Aboroth.java +++ b/Mage.Sets/src/mage/cards/a/Aboroth.java @@ -48,6 +48,10 @@ class AborothCost extends CostImpl { this.text = "Put a -1/-1 counter on Aboroth"; } + private AborothCost(final AborothCost cost) { + super(cost); + } + @Override public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(source.getSourceId()); @@ -66,6 +70,6 @@ class AborothCost extends CostImpl { @Override public AborothCost copy() { - return new AborothCost(); + return new AborothCost(this); } } diff --git a/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java b/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java index 710c5e5c80..4a4bfa13e2 100644 --- a/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java +++ b/Mage.Sets/src/mage/cards/a/AdamaroFirstToDesire.java @@ -43,6 +43,7 @@ public final class AdamaroFirstToDesire extends CardImpl { } class MostCardsInOpponentsHandCount implements DynamicValue { + @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int maxCards = 0; @@ -59,7 +60,7 @@ class MostCardsInOpponentsHandCount implements DynamicValue { } @Override - public DynamicValue copy() { + public MostCardsInOpponentsHandCount copy() { return new MostCardsInOpponentsHandCount(); } diff --git a/Mage.Sets/src/mage/cards/a/AlphaStatus.java b/Mage.Sets/src/mage/cards/a/AlphaStatus.java index dea706c04c..1fd2394ef7 100644 --- a/Mage.Sets/src/mage/cards/a/AlphaStatus.java +++ b/Mage.Sets/src/mage/cards/a/AlphaStatus.java @@ -72,7 +72,7 @@ class AlphaStatusDynamicValue implements DynamicValue { } @Override - public DynamicValue copy() { + public AlphaStatusDynamicValue copy() { return new AlphaStatusDynamicValue(); } diff --git a/Mage.Sets/src/mage/cards/a/Anathemancer.java b/Mage.Sets/src/mage/cards/a/Anathemancer.java index bdf3ed03ca..be2db64c8e 100644 --- a/Mage.Sets/src/mage/cards/a/Anathemancer.java +++ b/Mage.Sets/src/mage/cards/a/Anathemancer.java @@ -69,7 +69,7 @@ class AnathemancerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public AnathemancerCount copy() { return new AnathemancerCount(); } diff --git a/Mage.Sets/src/mage/cards/a/AncientOoze.java b/Mage.Sets/src/mage/cards/a/AncientOoze.java index 9e720aac5d..d10c2a7b4b 100644 --- a/Mage.Sets/src/mage/cards/a/AncientOoze.java +++ b/Mage.Sets/src/mage/cards/a/AncientOoze.java @@ -61,7 +61,7 @@ class AncientOozePowerToughnessValue implements DynamicValue { } @Override - public DynamicValue copy() { + public AncientOozePowerToughnessValue copy() { return new AncientOozePowerToughnessValue(); } diff --git a/Mage.Sets/src/mage/cards/a/AspectOfWolf.java b/Mage.Sets/src/mage/cards/a/AspectOfWolf.java index 019e9f54c0..0121c26c2b 100644 --- a/Mage.Sets/src/mage/cards/a/AspectOfWolf.java +++ b/Mage.Sets/src/mage/cards/a/AspectOfWolf.java @@ -59,12 +59,11 @@ class HalfForestsDownCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2; - return amount; + return game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2; } @Override - public DynamicValue copy() { + public HalfForestsDownCount copy() { return new HalfForestsDownCount(); } @@ -94,7 +93,7 @@ class HalfForestsUpCount implements DynamicValue { } @Override - public DynamicValue copy() { + public HalfForestsUpCount copy() { return new HalfForestsUpCount(); } diff --git a/Mage.Sets/src/mage/cards/b/BurdenOfGreed.java b/Mage.Sets/src/mage/cards/b/BurdenOfGreed.java index d9221e0c6f..f824f61baf 100644 --- a/Mage.Sets/src/mage/cards/b/BurdenOfGreed.java +++ b/Mage.Sets/src/mage/cards/b/BurdenOfGreed.java @@ -54,7 +54,7 @@ class BurdenOfGreedCount implements DynamicValue { } @Override - public DynamicValue copy() { + public BurdenOfGreedCount copy() { return new BurdenOfGreedCount(); } diff --git a/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java b/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java index b532f8e6c8..cb822bb779 100644 --- a/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java +++ b/Mage.Sets/src/mage/cards/c/ChildrenOfKorlis.java @@ -60,7 +60,7 @@ class SourceControllerLostLifeCount implements DynamicValue { } @Override - public DynamicValue copy() { + public SourceControllerLostLifeCount copy() { return new SourceControllerLostLifeCount(); } diff --git a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java index 6d85286360..ae1e15e5c3 100644 --- a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java +++ b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java @@ -27,10 +27,10 @@ public final class CitadelOfPain extends CardImpl { public CitadelOfPain(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + // At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands they control. TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new CitadelOfPainEffect()); - // At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands they control. this.addAbility(triggered); } @@ -48,11 +48,6 @@ class CitadelOfPainEffect extends OneShotEffect { private static final FilterPermanent filter = new FilterControlledLandPermanent(); - @Override - public String getText(Mode mode) { - return "{this} deals X damage to that player, where X is the number of untapped lands they control."; - } - static { filter.add(TappedPredicate.UNTAPPED); } @@ -61,8 +56,8 @@ class CitadelOfPainEffect extends OneShotEffect { super(Outcome.Damage); } - public CitadelOfPainEffect(Outcome outcome) { - super(outcome); + private CitadelOfPainEffect(final CitadelOfPainEffect effect) { + super(effect); } @Override @@ -77,7 +72,12 @@ class CitadelOfPainEffect extends OneShotEffect { } @Override - public Effect copy() { - return new CitadelOfPainEffect(); + public CitadelOfPainEffect copy() { + return new CitadelOfPainEffect(this); + } + + @Override + public String getText(Mode mode) { + return "{this} deals X damage to that player, where X is the number of untapped lands they control."; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java b/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java index 943cdf43d4..1fde37fc73 100644 --- a/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java +++ b/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java @@ -56,12 +56,6 @@ public final class ConquerorsFlail extends CardImpl { class ConquerorsFlailColorCount implements DynamicValue { - public ConquerorsFlailColorCount() { - } - - public ConquerorsFlailColorCount(final ConquerorsFlailColorCount dynamicValue) { - } - @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Player controller = game.getPlayer(sourceAbility.getControllerId()); @@ -105,7 +99,7 @@ class ConquerorsFlailColorCount implements DynamicValue { } @Override - public DynamicValue copy() { + public ConquerorsFlailColorCount copy() { return new ConquerorsFlailColorCount(); } } diff --git a/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java b/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java index 9ce3a8a9ca..0118e9df1d 100644 --- a/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java +++ b/Mage.Sets/src/mage/cards/c/CrimsonHonorGuard.java @@ -62,9 +62,8 @@ class CrimsonHonorGuardEffect extends OneShotEffect { super(Outcome.Damage); } - @Override - public Effect copy() { - return new CrimsonHonorGuardEffect(); + private CrimsonHonorGuardEffect(final CrimsonHonorGuardEffect effect) { + super(effect); } @Override @@ -84,4 +83,9 @@ class CrimsonHonorGuardEffect extends OneShotEffect { public String getText(Mode mode) { return "{this} deals 4 damage to that player unless they control a commander"; } + + @Override + public CrimsonHonorGuardEffect copy() { + return new CrimsonHonorGuardEffect(this); + } } diff --git a/Mage.Sets/src/mage/cards/c/Curfew.java b/Mage.Sets/src/mage/cards/c/Curfew.java index 97b5ab7f06..09962322f2 100644 --- a/Mage.Sets/src/mage/cards/c/Curfew.java +++ b/Mage.Sets/src/mage/cards/c/Curfew.java @@ -46,6 +46,10 @@ class CurfewEffect extends OneShotEffect { staticText = "Each player returns a creature they control to its owner's hand"; } + private CurfewEffect(final CurfewEffect effect) { + super(effect); + } + @Override public boolean apply(Game game, Ability source) { game.informPlayers("Each player returns a creature they control to its owner's hand"); @@ -64,7 +68,7 @@ class CurfewEffect extends OneShotEffect { } @Override - public Effect copy() { - return new CurfewEffect(); + public CurfewEffect copy() { + return new CurfewEffect(this); } } diff --git a/Mage.Sets/src/mage/cards/d/DemonicAppetite.java b/Mage.Sets/src/mage/cards/d/DemonicAppetite.java index f16afa817a..40578f7a56 100644 --- a/Mage.Sets/src/mage/cards/d/DemonicAppetite.java +++ b/Mage.Sets/src/mage/cards/d/DemonicAppetite.java @@ -51,17 +51,3 @@ public final class DemonicAppetite extends CardImpl { return new DemonicAppetite(this); } } - -class DemonicAppetiteEffect extends SacrificeTargetEffect { - - DemonicAppetiteEffect() { - super(); - staticText = "sacrifice a creature"; - } - - @Override - public DemonicAppetiteEffect copy() { - return new DemonicAppetiteEffect(); - } - -} diff --git a/Mage.Sets/src/mage/cards/d/DyingWish.java b/Mage.Sets/src/mage/cards/d/DyingWish.java index 004f1297ee..6b3e2888a6 100644 --- a/Mage.Sets/src/mage/cards/d/DyingWish.java +++ b/Mage.Sets/src/mage/cards/d/DyingWish.java @@ -78,7 +78,7 @@ class DyingWishAttachedPermanentPowerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public DyingWishAttachedPermanentPowerCount copy() { return new DyingWishAttachedPermanentPowerCount(); } diff --git a/Mage.Sets/src/mage/cards/e/ElvishHouseParty.java b/Mage.Sets/src/mage/cards/e/ElvishHouseParty.java index 266c865ef9..95d6f79e7d 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishHouseParty.java +++ b/Mage.Sets/src/mage/cards/e/ElvishHouseParty.java @@ -62,7 +62,7 @@ class CurrentHourCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CurrentHourCount copy() { return new CurrentHourCount(); } diff --git a/Mage.Sets/src/mage/cards/e/EmissaryOfDespair.java b/Mage.Sets/src/mage/cards/e/EmissaryOfDespair.java index a43361a22b..5fcdd68635 100644 --- a/Mage.Sets/src/mage/cards/e/EmissaryOfDespair.java +++ b/Mage.Sets/src/mage/cards/e/EmissaryOfDespair.java @@ -58,7 +58,7 @@ class EmissaryOfDespairCount implements DynamicValue { } @Override - public DynamicValue copy() { + public EmissaryOfDespairCount copy() { return new EmissaryOfDespairCount(); } diff --git a/Mage.Sets/src/mage/cards/e/EndlessRanksOfTheDead.java b/Mage.Sets/src/mage/cards/e/EndlessRanksOfTheDead.java index f4b8fedbda..ed43c862c9 100644 --- a/Mage.Sets/src/mage/cards/e/EndlessRanksOfTheDead.java +++ b/Mage.Sets/src/mage/cards/e/EndlessRanksOfTheDead.java @@ -57,7 +57,7 @@ class HalfZombiesCount implements DynamicValue { } @Override - public DynamicValue copy() { + public HalfZombiesCount copy() { return new HalfZombiesCount(); } diff --git a/Mage.Sets/src/mage/cards/e/EnterTheInfinite.java b/Mage.Sets/src/mage/cards/e/EnterTheInfinite.java index 18cd5efe33..4c8fc783e1 100644 --- a/Mage.Sets/src/mage/cards/e/EnterTheInfinite.java +++ b/Mage.Sets/src/mage/cards/e/EnterTheInfinite.java @@ -62,7 +62,7 @@ class CardsInControllerLibraryCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInControllerLibraryCount copy() { return new CardsInControllerLibraryCount(); } diff --git a/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java b/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java index e7b475f917..a1bc49f787 100644 --- a/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java +++ b/Mage.Sets/src/mage/cards/k/KarplusanMinotaur.java @@ -134,6 +134,10 @@ class KarplusanMinotaurCost extends CostImpl { this.text = "Flip a coin"; } + private KarplusanMinotaurCost(final KarplusanMinotaurCost cost) { + super(cost); + } + @Override public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); @@ -158,7 +162,7 @@ class KarplusanMinotaurCost extends CostImpl { @Override public KarplusanMinotaurCost copy() { - return new KarplusanMinotaurCost(); + return new KarplusanMinotaurCost(this); } } diff --git a/Mage.Sets/src/mage/cards/k/KinsbaileBorderguard.java b/Mage.Sets/src/mage/cards/k/KinsbaileBorderguard.java index 32f3a99026..9cedbc1ba6 100644 --- a/Mage.Sets/src/mage/cards/k/KinsbaileBorderguard.java +++ b/Mage.Sets/src/mage/cards/k/KinsbaileBorderguard.java @@ -73,7 +73,7 @@ class AllCountersCount implements DynamicValue { } @Override - public DynamicValue copy() { + public AllCountersCount copy() { return new AllCountersCount(); } diff --git a/Mage.Sets/src/mage/cards/l/Leveler.java b/Mage.Sets/src/mage/cards/l/Leveler.java index 24506b0c71..bd8ff3717b 100644 --- a/Mage.Sets/src/mage/cards/l/Leveler.java +++ b/Mage.Sets/src/mage/cards/l/Leveler.java @@ -50,9 +50,8 @@ class LevelerExileLibraryEffect extends OneShotEffect { staticText = "exile all cards from your library"; } - @Override - public LevelerExileLibraryEffect copy() { - return new LevelerExileLibraryEffect(); + private LevelerExileLibraryEffect(final LevelerExileLibraryEffect effect) { + super(effect); } @Override @@ -66,4 +65,9 @@ class LevelerExileLibraryEffect extends OneShotEffect { } return false; } + + @Override + public LevelerExileLibraryEffect copy() { + return new LevelerExileLibraryEffect(this); + } } diff --git a/Mage.Sets/src/mage/cards/l/LordOfExtinction.java b/Mage.Sets/src/mage/cards/l/LordOfExtinction.java index 012763c4a9..bfdf4ffc37 100644 --- a/Mage.Sets/src/mage/cards/l/LordOfExtinction.java +++ b/Mage.Sets/src/mage/cards/l/LordOfExtinction.java @@ -59,7 +59,7 @@ class LordOfExtinctionDynamicCount implements DynamicValue { } @Override - public DynamicValue copy() { + public LordOfExtinctionDynamicCount copy() { return new LordOfExtinctionDynamicCount(); } diff --git a/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java b/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java index 1d28ca854c..b393e26c17 100644 --- a/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java +++ b/Mage.Sets/src/mage/cards/l/LostOrderOfJarkeld.java @@ -69,7 +69,7 @@ class CreaturesControlledByChosenPlayer implements DynamicValue { } @Override - public DynamicValue copy() { + public CreaturesControlledByChosenPlayer copy() { return new CreaturesControlledByChosenPlayer(); } diff --git a/Mage.Sets/src/mage/cards/m/ManaCache.java b/Mage.Sets/src/mage/cards/m/ManaCache.java index 1485868e37..2ee9c317a7 100644 --- a/Mage.Sets/src/mage/cards/m/ManaCache.java +++ b/Mage.Sets/src/mage/cards/m/ManaCache.java @@ -66,9 +66,13 @@ class ManaCacheEffect extends OneShotEffect { this.staticText = "put a charge counter on {this} for each untapped land that player controls"; } + private ManaCacheEffect(final ManaCacheEffect effect) { + super(effect); + } + @Override - public Effect copy() { - return new ManaCacheEffect(); + public ManaCacheEffect copy() { + return new ManaCacheEffect(this); } @Override diff --git a/Mage.Sets/src/mage/cards/m/MercadiasDownfall.java b/Mage.Sets/src/mage/cards/m/MercadiasDownfall.java index 5e0c2e9fa3..346cd64561 100644 --- a/Mage.Sets/src/mage/cards/m/MercadiasDownfall.java +++ b/Mage.Sets/src/mage/cards/m/MercadiasDownfall.java @@ -44,12 +44,11 @@ public final class MercadiasDownfall extends CardImpl { return new MercadiasDownfall(this); } - class DefendersNonBasicLandCount implements DynamicValue { - - UUID defenderId; + static class DefendersNonBasicLandCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { + UUID defenderId; for (CombatGroup group : game.getCombat().getGroups()) { defenderId = group.getDefenderId(); if (group.isDefenderIsPlaneswalker()) { @@ -67,7 +66,7 @@ public final class MercadiasDownfall extends CardImpl { } @Override - public DynamicValue copy() { + public DefendersNonBasicLandCount copy() { return new DefendersNonBasicLandCount(); } diff --git a/Mage.Sets/src/mage/cards/m/Monsoon.java b/Mage.Sets/src/mage/cards/m/Monsoon.java index 6fb18acf90..809f56f15f 100644 --- a/Mage.Sets/src/mage/cards/m/Monsoon.java +++ b/Mage.Sets/src/mage/cards/m/Monsoon.java @@ -56,8 +56,8 @@ class MonsoonEffect extends OneShotEffect { this.staticText = "tap all untapped Islands that player controls and {this} deals X damage to the player, where X is the number of Islands tapped this way"; } - public MonsoonEffect(Outcome outcome) { - super(outcome); + private MonsoonEffect(final MonsoonEffect effect) { + super(effect); } @Override @@ -76,7 +76,7 @@ class MonsoonEffect extends OneShotEffect { } @Override - public Effect copy() { - return new MonsoonEffect(); + public MonsoonEffect copy() { + return new MonsoonEffect(this); } } diff --git a/Mage.Sets/src/mage/cards/m/MurderInvestigation.java b/Mage.Sets/src/mage/cards/m/MurderInvestigation.java index bb7956d9d1..1be12640d7 100644 --- a/Mage.Sets/src/mage/cards/m/MurderInvestigation.java +++ b/Mage.Sets/src/mage/cards/m/MurderInvestigation.java @@ -72,7 +72,7 @@ class AttachedPermanentPowerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public AttachedPermanentPowerCount copy() { return new AttachedPermanentPowerCount(); } diff --git a/Mage.Sets/src/mage/cards/n/Nyxathid.java b/Mage.Sets/src/mage/cards/n/Nyxathid.java index 3b2d47de40..c145d368e8 100644 --- a/Mage.Sets/src/mage/cards/n/Nyxathid.java +++ b/Mage.Sets/src/mage/cards/n/Nyxathid.java @@ -68,7 +68,7 @@ class CardsInChosenPlayerHandCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInChosenPlayerHandCount copy() { return new CardsInChosenPlayerHandCount(); } diff --git a/Mage.Sets/src/mage/cards/p/Pallimud.java b/Mage.Sets/src/mage/cards/p/Pallimud.java index 011105c357..73d6beb69a 100644 --- a/Mage.Sets/src/mage/cards/p/Pallimud.java +++ b/Mage.Sets/src/mage/cards/p/Pallimud.java @@ -70,7 +70,7 @@ class AnathemancerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public AnathemancerCount copy() { return new AnathemancerCount(); } diff --git a/Mage.Sets/src/mage/cards/p/ParadigmShift.java b/Mage.Sets/src/mage/cards/p/ParadigmShift.java index b7f6707818..6f66566fa1 100644 --- a/Mage.Sets/src/mage/cards/p/ParadigmShift.java +++ b/Mage.Sets/src/mage/cards/p/ParadigmShift.java @@ -25,7 +25,7 @@ public final class ParadigmShift extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}"); // Exile all cards from your library. Then shuffle your graveyard into your library. - this.getSpellAbility().addEffect(new ExileLibraryEffect()); + this.getSpellAbility().addEffect(new ParadigmShiftExileLibraryEffect()); } private ParadigmShift(final ParadigmShift card) { @@ -38,16 +38,20 @@ public final class ParadigmShift extends CardImpl { } } -class ExileLibraryEffect extends OneShotEffect { +class ParadigmShiftExileLibraryEffect extends OneShotEffect { - public ExileLibraryEffect() { + public ParadigmShiftExileLibraryEffect() { super(Outcome.Exile); staticText = "Exile all cards from your library. Then shuffle your graveyard into your library"; } + private ParadigmShiftExileLibraryEffect(final ParadigmShiftExileLibraryEffect effect) { + super(effect); + } + @Override - public ExileLibraryEffect copy() { - return new ExileLibraryEffect(); + public ParadigmShiftExileLibraryEffect copy() { + return new ParadigmShiftExileLibraryEffect(this); } @Override diff --git a/Mage.Sets/src/mage/cards/p/PredatorsRapport.java b/Mage.Sets/src/mage/cards/p/PredatorsRapport.java index 8f824c6799..c6e6f06a2d 100644 --- a/Mage.Sets/src/mage/cards/p/PredatorsRapport.java +++ b/Mage.Sets/src/mage/cards/p/PredatorsRapport.java @@ -53,7 +53,7 @@ class TargetPermanentPowerPlusToughnessCount implements DynamicValue { } @Override - public DynamicValue copy() { + public TargetPermanentPowerPlusToughnessCount copy() { return new TargetPermanentPowerPlusToughnessCount(); } diff --git a/Mage.Sets/src/mage/cards/p/PrimeSpeakerZegana.java b/Mage.Sets/src/mage/cards/p/PrimeSpeakerZegana.java index 68a44e36c9..13dfa5bd55 100644 --- a/Mage.Sets/src/mage/cards/p/PrimeSpeakerZegana.java +++ b/Mage.Sets/src/mage/cards/p/PrimeSpeakerZegana.java @@ -68,7 +68,7 @@ class GreatestPowerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public GreatestPowerCount copy() { return new GreatestPowerCount(); } diff --git a/Mage.Sets/src/mage/cards/p/PsychicVortex.java b/Mage.Sets/src/mage/cards/p/PsychicVortex.java index 5b418ecd59..59f1e74bb0 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicVortex.java +++ b/Mage.Sets/src/mage/cards/p/PsychicVortex.java @@ -1,4 +1,3 @@ - package mage.cards.p; import java.util.UUID; @@ -58,6 +57,10 @@ class PsychicVortexCost extends CostImpl { this.text = "Draw a card"; } + private PsychicVortexCost(final PsychicVortexCost cost) { + super(cost); + } + @Override public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); @@ -77,6 +80,6 @@ class PsychicVortexCost extends CostImpl { @Override public PsychicVortexCost copy() { - return new PsychicVortexCost(); + return new PsychicVortexCost(this); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/r/RighteousAuthority.java b/Mage.Sets/src/mage/cards/r/RighteousAuthority.java index ab2303f52f..470691c3de 100644 --- a/Mage.Sets/src/mage/cards/r/RighteousAuthority.java +++ b/Mage.Sets/src/mage/cards/r/RighteousAuthority.java @@ -59,6 +59,7 @@ public final class RighteousAuthority extends CardImpl { class CardsInEnchantedControllerHandCount implements DynamicValue { + @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { @@ -77,7 +78,7 @@ class CardsInEnchantedControllerHandCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInEnchantedControllerHandCount copy() { return new CardsInEnchantedControllerHandCount(); } diff --git a/Mage.Sets/src/mage/cards/r/RuneflareTrap.java b/Mage.Sets/src/mage/cards/r/RuneflareTrap.java index 859e935eb4..6a0f0ee368 100644 --- a/Mage.Sets/src/mage/cards/r/RuneflareTrap.java +++ b/Mage.Sets/src/mage/cards/r/RuneflareTrap.java @@ -61,7 +61,7 @@ class TargetPlayerCardsInHandCount implements DynamicValue { } @Override - public DynamicValue copy() { + public TargetPlayerCardsInHandCount copy() { return new TargetPlayerCardsInHandCount(); } diff --git a/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java b/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java index 4f084a859e..06500b05ef 100644 --- a/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java +++ b/Mage.Sets/src/mage/cards/s/SaprazzanBailiff.java @@ -64,9 +64,13 @@ class SaprazzanBailiffEffect extends OneShotEffect { staticText = "exile all artifact and enchantment cards from all graveyards"; } + private SaprazzanBailiffEffect(final SaprazzanBailiffEffect effect) { + super(effect); + } + @Override public SaprazzanBailiffEffect copy() { - return new SaprazzanBailiffEffect(); + return new SaprazzanBailiffEffect(this); } @Override diff --git a/Mage.Sets/src/mage/cards/s/SewerNemesis.java b/Mage.Sets/src/mage/cards/s/SewerNemesis.java index b313037419..13d8931470 100644 --- a/Mage.Sets/src/mage/cards/s/SewerNemesis.java +++ b/Mage.Sets/src/mage/cards/s/SewerNemesis.java @@ -72,7 +72,7 @@ class CardsInTargetOpponentsGraveyardCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInTargetOpponentsGraveyardCount copy() { return new CardsInTargetOpponentsGraveyardCount(); } diff --git a/Mage.Sets/src/mage/cards/s/ShelteringAncient.java b/Mage.Sets/src/mage/cards/s/ShelteringAncient.java index 2cf8968167..6c60f4a01c 100644 --- a/Mage.Sets/src/mage/cards/s/ShelteringAncient.java +++ b/Mage.Sets/src/mage/cards/s/ShelteringAncient.java @@ -62,6 +62,10 @@ class ShelteringAncientCost extends CostImpl { this.text = "Put a +1/+1 counter on a creature an opponent controls"; } + private ShelteringAncientCost(final ShelteringAncientCost cost) { + super(cost); + } + @Override public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); @@ -86,6 +90,6 @@ class ShelteringAncientCost extends CostImpl { @Override public ShelteringAncientCost copy() { - return new ShelteringAncientCost(); + return new ShelteringAncientCost(this); } } diff --git a/Mage.Sets/src/mage/cards/s/SoullessOne.java b/Mage.Sets/src/mage/cards/s/SoullessOne.java index 48ad90853d..7d64872e1a 100644 --- a/Mage.Sets/src/mage/cards/s/SoullessOne.java +++ b/Mage.Sets/src/mage/cards/s/SoullessOne.java @@ -67,7 +67,7 @@ class SoullessOneDynamicCount implements DynamicValue { } @Override - public DynamicValue copy() { + public SoullessOneDynamicCount copy() { return new SoullessOneDynamicCount(); } diff --git a/Mage.Sets/src/mage/cards/s/SpellRupture.java b/Mage.Sets/src/mage/cards/s/SpellRupture.java index bd566ada07..e56e0bf547 100644 --- a/Mage.Sets/src/mage/cards/s/SpellRupture.java +++ b/Mage.Sets/src/mage/cards/s/SpellRupture.java @@ -102,7 +102,7 @@ class GreatestPowerCountCreatureYouControl implements DynamicValue { } @Override - public DynamicValue copy() { + public GreatestPowerCountCreatureYouControl copy() { return new GreatestPowerCountCreatureYouControl(); } diff --git a/Mage.Sets/src/mage/cards/s/StormEntity.java b/Mage.Sets/src/mage/cards/s/StormEntity.java index 04c1133cb2..fdbab68ccc 100644 --- a/Mage.Sets/src/mage/cards/s/StormEntity.java +++ b/Mage.Sets/src/mage/cards/s/StormEntity.java @@ -62,7 +62,7 @@ class OtherSpellsCastThisTurnCount implements DynamicValue { } @Override - public DynamicValue copy() { + public OtherSpellsCastThisTurnCount copy() { return new OtherSpellsCastThisTurnCount(); } diff --git a/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java b/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java index 57b614ce63..4959cd037f 100644 --- a/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java +++ b/Mage.Sets/src/mage/cards/s/SupremeLeaderSnoke.java @@ -104,7 +104,7 @@ class OpponentNoncombatLostLifeCount implements DynamicValue { } @Override - public DynamicValue copy() { + public OpponentNoncombatLostLifeCount copy() { return new OpponentNoncombatLostLifeCount(); } diff --git a/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java b/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java index 21f45aff98..1b25f0ce93 100644 --- a/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java +++ b/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java @@ -77,7 +77,7 @@ class TappedCreaturesControlledByTargetCount implements DynamicValue { } @Override - public DynamicValue copy() { + public TappedCreaturesControlledByTargetCount copy() { return new TappedCreaturesControlledByTargetCount(); } diff --git a/Mage.Sets/src/mage/cards/t/TerraRavager.java b/Mage.Sets/src/mage/cards/t/TerraRavager.java index e8bfa5babb..68aa82d8e5 100644 --- a/Mage.Sets/src/mage/cards/t/TerraRavager.java +++ b/Mage.Sets/src/mage/cards/t/TerraRavager.java @@ -68,7 +68,7 @@ class TerraRavagerLandCount implements DynamicValue { } @Override - public DynamicValue copy() { + public TerraRavagerLandCount copy() { return new TerraRavagerLandCount(); } diff --git a/Mage.Sets/src/mage/cards/u/UmbraStalker.java b/Mage.Sets/src/mage/cards/u/UmbraStalker.java index 4674191b5b..c17f710659 100644 --- a/Mage.Sets/src/mage/cards/u/UmbraStalker.java +++ b/Mage.Sets/src/mage/cards/u/UmbraStalker.java @@ -66,7 +66,7 @@ class ChromaUmbraStalkerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public ChromaUmbraStalkerCount copy() { return new ChromaUmbraStalkerCount(); } diff --git a/Mage.Sets/src/mage/cards/u/UrborgJustice.java b/Mage.Sets/src/mage/cards/u/UrborgJustice.java index 6fc0710abb..33557591c0 100644 --- a/Mage.Sets/src/mage/cards/u/UrborgJustice.java +++ b/Mage.Sets/src/mage/cards/u/UrborgJustice.java @@ -44,6 +44,15 @@ public final class UrborgJustice extends CardImpl { class UrborgJusticeDynamicValue implements DynamicValue { + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + CreaturesDiedWatcher watcher = game.getState().getWatcher(CreaturesDiedWatcher.class); + if (watcher != null) { + return watcher.getAmountOfCreaturesDiedThisTurnByOwner(sourceAbility.getControllerId()); + } + return 0; + } + @Override public UrborgJusticeDynamicValue copy() { return new UrborgJusticeDynamicValue(); @@ -58,13 +67,4 @@ class UrborgJusticeDynamicValue implements DynamicValue { public String getMessage() { return "creature put into your graveyard from the battlefield this turn"; } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - CreaturesDiedWatcher watcher = game.getState().getWatcher(CreaturesDiedWatcher.class); - if (watcher != null) { - return watcher.getAmountOfCreaturesDiedThisTurnByOwner(sourceAbility.getControllerId()); - } - return 0; - } } diff --git a/Mage.Sets/src/mage/cards/w/WolfOfDevilsBreach.java b/Mage.Sets/src/mage/cards/w/WolfOfDevilsBreach.java index 8a7915319f..7af3587ddc 100644 --- a/Mage.Sets/src/mage/cards/w/WolfOfDevilsBreach.java +++ b/Mage.Sets/src/mage/cards/w/WolfOfDevilsBreach.java @@ -1,4 +1,3 @@ - package mage.cards.w; import java.util.UUID; @@ -40,7 +39,7 @@ public final class WolfOfDevilsBreach extends CardImpl { Costs toPay = new CostsImpl<>(); toPay.add(new ManaCostsImpl<>("{1}{R}")); toPay.add(new DiscardCardCost()); - Ability ability = new AttacksTriggeredAbility(new DoIfCostPaid(new DamageTargetEffect(new WolfOfDevilsBreachDiscardCostCardConvertedMana()), toPay, + Ability ability = new AttacksTriggeredAbility(new DoIfCostPaid(new DamageTargetEffect(new WolfOfDevilsBreachDiscardCostCardConvertedManaCount()), toPay, "Pay {1}{R} and discard a card to let {this} do damage to target creature or planeswalker equal to the discarded card's mana value?", true), false, "Whenever {this} attacks, you may pay {1}{R} and discard a card. If you do, {this} deals damage to target creature or planeswalker " + "equal to the discarded card's mana value."); @@ -58,7 +57,7 @@ public final class WolfOfDevilsBreach extends CardImpl { } } -class WolfOfDevilsBreachDiscardCostCardConvertedMana implements DynamicValue { +class WolfOfDevilsBreachDiscardCostCardConvertedManaCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { @@ -84,8 +83,8 @@ class WolfOfDevilsBreachDiscardCostCardConvertedMana implements DynamicValue { } @Override - public WolfOfDevilsBreachDiscardCostCardConvertedMana copy() { - return new WolfOfDevilsBreachDiscardCostCardConvertedMana(); + public WolfOfDevilsBreachDiscardCostCardConvertedManaCount copy() { + return new WolfOfDevilsBreachDiscardCostCardConvertedManaCount(); } @Override diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 664e7bebc6..0cb3e7d05b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -687,7 +687,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement CardInfo cardInfo = CardRepository.instance.findCard(cardName); Card card = cardInfo != null ? cardInfo.getCard() : null; if (card == null) { - throw new AssertionError("Couldn't find a card: " + cardName); + throw new AssertionError("Couldn't find a card in db: " + cardName); } cards.add(card); diff --git a/Mage/src/main/java/mage/abilities/costs/Cost.java b/Mage/src/main/java/mage/abilities/costs/Cost.java index f30d497634..b496c55f42 100644 --- a/Mage/src/main/java/mage/abilities/costs/Cost.java +++ b/Mage/src/main/java/mage/abilities/costs/Cost.java @@ -3,11 +3,12 @@ package mage.abilities.costs; import mage.abilities.Ability; import mage.game.Game; import mage.target.Targets; +import mage.util.Copyable; import java.io.Serializable; import java.util.UUID; -public interface Cost extends Serializable { +public interface Cost extends Serializable, Copyable { UUID getId(); diff --git a/Mage/src/main/java/mage/abilities/costs/CostImpl.java b/Mage/src/main/java/mage/abilities/costs/CostImpl.java index 56bde43359..4163f3c05c 100644 --- a/Mage/src/main/java/mage/abilities/costs/CostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/CostImpl.java @@ -1,4 +1,3 @@ - package mage.abilities.costs; import java.util.UUID; @@ -72,5 +71,4 @@ public abstract class CostImpl implements Cost { public UUID getId() { return this.id; } - } diff --git a/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCost.java b/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCost.java index 50e0f835f8..a97e768731 100644 --- a/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCost.java +++ b/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCost.java @@ -5,7 +5,7 @@ import mage.util.Copyable; /** * @author LevelX2 */ -public interface OptionalAdditionalCost extends Cost, Copyable { +public interface OptionalAdditionalCost extends Cost { String getName(); @@ -77,4 +77,6 @@ public interface OptionalAdditionalCost extends Cost, Copyable { + int calculate(Game game, Ability sourceAbility, Effect effect); + DynamicValue copy(); + String getMessage(); } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java deleted file mode 100644 index c5d726167e..0000000000 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java +++ /dev/null @@ -1,57 +0,0 @@ - - -package mage.abilities.dynamicvalue.common; - -import mage.abilities.Ability; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.Effect; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; - -import java.io.ObjectStreamException; - -/** - * - * @author LevelX2 - */ - -public class TargetPermanenToughnessValue implements DynamicValue { - - private static final TargetPermanenToughnessValue instance = new TargetPermanenToughnessValue(); - - private Object readResolve() throws ObjectStreamException { - return instance; - } - - public static TargetPermanenToughnessValue getInstance() { - return instance; - } - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - Permanent sourcePermanent = game.getPermanent(sourceAbility.getFirstTarget()); - if (sourcePermanent == null) { - sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getFirstTarget(), Zone.BATTLEFIELD); - } - if (sourcePermanent != null) { - return sourcePermanent.getToughness().getValue(); - } - return 0; - } - - @Override - public TargetPermanenToughnessValue copy() { - return new TargetPermanenToughnessValue(); - } - - @Override - public String toString() { - return "X"; - } - - @Override - public String getMessage() { - return "target creature's toughness"; - } -} diff --git a/Mage/src/main/java/mage/abilities/effects/Effect.java b/Mage/src/main/java/mage/abilities/effects/Effect.java index 07312ebdf1..f2ca86097c 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effect.java +++ b/Mage/src/main/java/mage/abilities/effects/Effect.java @@ -6,6 +6,7 @@ import mage.constants.EffectType; import mage.constants.Outcome; import mage.game.Game; import mage.target.targetpointer.TargetPointer; +import mage.util.Copyable; import java.io.Serializable; import java.util.UUID; @@ -13,7 +14,7 @@ import java.util.UUID; /** * @author BetaSteward_at_googlemail.com */ -public interface Effect extends Serializable { +public interface Effect extends Serializable, Copyable { UUID getId(); diff --git a/Mage/src/main/java/mage/abilities/effects/OneShotEffect.java b/Mage/src/main/java/mage/abilities/effects/OneShotEffect.java index c10fbddee8..ebf6fc2ee2 100644 --- a/Mage/src/main/java/mage/abilities/effects/OneShotEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/OneShotEffect.java @@ -19,5 +19,4 @@ public abstract class OneShotEffect extends EffectImpl { public OneShotEffect(final OneShotEffect effect) { super(effect); } - } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java index 6feb82f485..aa5e7e589b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java @@ -1,5 +1,3 @@ - - package mage.abilities.effects.common; import mage.abilities.Ability; @@ -21,9 +19,13 @@ public class ExileGraveyardAllTargetPlayerEffect extends OneShotEffect { staticText = "exile all cards from target player's graveyard"; } + private ExileGraveyardAllTargetPlayerEffect(final ExileGraveyardAllTargetPlayerEffect effect) { + super(effect); + } + @Override public ExileGraveyardAllTargetPlayerEffect copy() { - return new ExileGraveyardAllTargetPlayerEffect(); + return new ExileGraveyardAllTargetPlayerEffect(this); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileSpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileSpellEffect.java index d110f15104..0b6e7be1b7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileSpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileSpellEffect.java @@ -24,7 +24,7 @@ public class ExileSpellEffect extends OneShotEffect { @Override public ExileSpellEffect copy() { - return new ExileSpellEffect(); + return new ExileSpellEffect(this); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/SkipNextCombatEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SkipNextCombatEffect.java deleted file mode 100644 index d4fa52bbbb..0000000000 --- a/Mage/src/main/java/mage/abilities/effects/common/SkipNextCombatEffect.java +++ /dev/null @@ -1,42 +0,0 @@ -package mage.abilities.effects.common; - -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.constants.Outcome; -import mage.constants.TurnPhase; -import mage.game.Game; -import mage.game.turn.TurnMod; -import mage.players.Player; - -/** - * - * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) - */ -public class SkipNextCombatEffect extends OneShotEffect { - - public SkipNextCombatEffect() { - super(Outcome.Detriment); - staticText = "target opponent skips their next combat phase"; - } - - public SkipNextCombatEffect(SkipNextCombatEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - if (targetPointer != null) { - Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null) { - game.getState().getTurnMods().add(new TurnMod(player.getId(), TurnPhase.COMBAT, null, true)); - return true; - } - } - return false; - } - - @Override - public SkipNextCombatEffect copy() { - return new SkipNextCombatEffect(); - } -} diff --git a/Mage/src/main/java/mage/abilities/effects/common/turn/ControlTargetPlayerNextTurnEffect.java b/Mage/src/main/java/mage/abilities/effects/common/turn/ControlTargetPlayerNextTurnEffect.java index b308dcbca4..ee48d14a83 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/turn/ControlTargetPlayerNextTurnEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/turn/ControlTargetPlayerNextTurnEffect.java @@ -1,13 +1,13 @@ - package mage.abilities.effects.common.turn; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; import mage.game.Game; import mage.game.turn.TurnMod; +import java.util.UUID; + /** * @author nantuko */ @@ -35,6 +35,6 @@ public class ControlTargetPlayerNextTurnEffect extends OneShotEffect { @Override public ControlTargetPlayerNextTurnEffect copy() { - return new ControlTargetPlayerNextTurnEffect(); + return new ControlTargetPlayerNextTurnEffect(this); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java b/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java index 13434e288e..c123b43987 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MeleeAbility.java @@ -1,4 +1,3 @@ - package mage.abilities.keyword; import java.util.*; @@ -71,9 +70,19 @@ class MeleeWatcher extends Watcher { class MeleeDynamicValue implements DynamicValue { - private boolean valueChecked = false; + private boolean valueChecked; private int lockedInValue; + public MeleeDynamicValue() { + super(); + } + + protected MeleeDynamicValue(final MeleeDynamicValue dynamicValue) { + super(); + valueChecked = dynamicValue.valueChecked; + lockedInValue = dynamicValue.lockedInValue; + } + @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { MeleeWatcher watcher = game.getState().getWatcher(MeleeWatcher.class); @@ -89,7 +98,7 @@ class MeleeDynamicValue implements DynamicValue { @Override public MeleeDynamicValue copy() { - return new MeleeDynamicValue(); + return new MeleeDynamicValue(this); } @Override