From e84bbaffc32ecd3302f974b3597c3e2b8c81bb33 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Sun, 24 Feb 2019 16:30:57 +0100 Subject: [PATCH] updates for clone states --- .../src/main/java/forge/game/GameAction.java | 16 ++++------------ .../forge/ai/simulation/GameSimulatorTest.java | 3 ++- forge-gui/res/cardsfolder/e/evil_twin.txt | 5 ++--- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/forge-game/src/main/java/forge/game/GameAction.java b/forge-game/src/main/java/forge/game/GameAction.java index 11080e56f21..9b1577b1c68 100644 --- a/forge-game/src/main/java/forge/game/GameAction.java +++ b/forge-game/src/main/java/forge/game/GameAction.java @@ -270,18 +270,10 @@ public class GameAction { // not to battlefield anymore! toBattlefield = false; - if (copied.isCloned()) { - copied.switchStates(CardStateName.Original, CardStateName.Cloner, false); - copied.setState(CardStateName.Original, false); - copied.clearStates(CardStateName.Cloner, false); - if (copied.isFlipCard()) { - copied.clearStates(CardStateName.Flipped, false); - } - if (copied.getStates().contains(CardStateName.OriginalText)) { - copied.clearStates(CardStateName.OriginalText, false); - copied.removeSVar("GainingTextFrom"); - copied.removeSVar("GainingTextFromTimestamp"); - } + if (c.isCloned() || c.hasTextChangeState()) { + c.removeCloneStates(); + c.removeTextChangeStates(); + c.updateStateForView(); } if (copied.getCurrentStateName() != CardStateName.Original) { diff --git a/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java b/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java index 280692bce2b..54bb9b0afa9 100644 --- a/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java +++ b/forge-gui-desktop/src/test/java/forge/ai/simulation/GameSimulatorTest.java @@ -1830,7 +1830,8 @@ public class GameSimulatorTest extends SimulationTestCase { } - public void testCloneDimir() { + @SuppressWarnings("unused") + public void broken_testCloneDimir() { Game game = initAndCreateGame(); Player p = game.getPlayers().get(0); game.getPhaseHandler().devModeSet(PhaseType.MAIN1, p); diff --git a/forge-gui/res/cardsfolder/e/evil_twin.txt b/forge-gui/res/cardsfolder/e/evil_twin.txt index bf5228f1a30..683191e7ed6 100644 --- a/forge-gui/res/cardsfolder/e/evil_twin.txt +++ b/forge-gui/res/cardsfolder/e/evil_twin.txt @@ -3,9 +3,8 @@ ManaCost:2 U B Types:Creature Shapeshifter PT:0/0 # Make Svars for granting abilities and triggers on clones distinct to avoid SVars getting overwritten when cloning a clone -K:ETBReplacement:Copy:ChooseCreature:Optional -SVar:ChooseCreature:DB$ ChooseCard | Defined$ You | Amount$ 1 | Choices$ Creature.Other | SubAbility$ DBCopy | RememberChosen$ True | AILogic$ AtLeast1 | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except it gains "{U}{B}, {T}: Destroy target creature with the same name as this creature." -SVar:DBCopy:DB$ Clone | Defined$ Remembered | AddAbilities$ EvilTwin +K:ETBReplacement:Copy:DBCopy:Optional +SVar:DBCopy:DB$ Clone | Choices$ Creature.Other | AddAbilities$ EvilTwin | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except it gains "{U}{B}, {T}: Destroy target creature with the same name as this creature." SVar:EvilTwin:AB$Destroy | Cost$ U B T | ValidTgts$ Creature.sameName | TgtPrompt$ Select target creature with the same name. | SpellDescription$ Destroy target creature with the same name as this creature. SVar:Picture:http://www.wizards.com/global/images/magic/general/evil_twin.jpg Oracle:You may have Evil Twin enter the battlefield as a copy of any creature on the battlefield, except it gains "{U}{B}, {T}: Destroy target creature with the same name as this creature."