From 137070d5238c4c095156a8e2ed4e7e04abfbb2c4 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 24 Nov 2020 16:07:53 +0100 Subject: [PATCH] * Chorus of the Conclave - Fixed a problem with game copy logic (related to rollback and AI) (fixed #7195). --- .../other/ChorusOfTheConclaveTest.java | 54 +++++++++++++++++++ Mage/src/main/java/mage/game/GameState.java | 2 + 2 files changed, 56 insertions(+) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/ChorusOfTheConclaveTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/ChorusOfTheConclaveTest.java index 8bb53cc88e1..ca19cf1ca1d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/ChorusOfTheConclaveTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/ChorusOfTheConclaveTest.java @@ -44,4 +44,58 @@ public class ChorusOfTheConclaveTest extends CardTestPlayerBase { } + /* + Scenario: I have both Hamza, Guardian of Arashin and Chorus of the Conclave on the board, as well as a bunch of creature's with +1/+1 counters. + Hamza doesn't reduce the mana I want to pay extra with Chorus based on the amount of creatures with counters. + I'm unsure if this is due to Hamza not properly reducing additional costs, or Chorus not properly adding the cost to the creature in a way that Hamza can reduce it. + */ + @Test + public void testWithHamza() { + setStrictChooseMode(true); + + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 4); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); + addCard(Zone.HAND, playerA, "Mountain"); + + // As an additional cost to cast creature spells, you may pay any amount of mana. + // If you do, that creature enters the battlefield with that many additional +1/+1 counters on it. + addCard(Zone.BATTLEFIELD, playerA, "Chorus of the Conclave"); + + addCard(Zone.HAND, playerA, "Goblin Roughrider",1); // Creature {2}{R} + addCard(Zone.HAND, playerA, "Akki Drillmaster",1); // Creature {2}{R} + + // This spell costs {1} less to cast for each creature you control with a +1/+1 counter on it. + // Creature spells you cast cost {1} less to cast for each creature you control with a +1/+1 counter on it. + addCard(Zone.HAND, playerA, "Hamza, Guardian of Arashin"); // {4}{G}{W} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goblin Roughrider"); + setChoice(playerA, "Yes"); + setChoice(playerA, "X=1"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hamza, Guardian of Arashin"); + setChoice(playerA, "Yes"); + setChoice(playerA, "X=1"); + + playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Mountain"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Akki Drillmaster"); + setChoice(playerA, "Yes"); + setChoice(playerA, "X=1"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Goblin Roughrider", 1); // costs {R}{2} + {1} = 4 + assertCounterCount("Goblin Roughrider", CounterType.P1P1, 1); + + assertPermanentCount(playerA, "Hamza, Guardian of Arashin", 1); // costs {G}{W}{3} + {1} = 6 + assertCounterCount("Hamza, Guardian of Arashin", CounterType.P1P1, 1); + + assertPermanentCount(playerA, "Akki Drillmaster", 1);// costs {R} + {1} = 2 + assertCounterCount("Akki Drillmaster", CounterType.P1P1, 1); + + } + } diff --git a/Mage/src/main/java/mage/game/GameState.java b/Mage/src/main/java/mage/game/GameState.java index 22bb3e86b47..606d4d21654 100644 --- a/Mage/src/main/java/mage/game/GameState.java +++ b/Mage/src/main/java/mage/game/GameState.java @@ -167,6 +167,8 @@ public class GameState implements Serializable, Copyable { this.values.put(entry.getKey(), ((HashSet) entry.getValue()).clone()); } else if (entry.getValue() instanceof EnumSet) { this.values.put(entry.getKey(), ((EnumSet) entry.getValue()).clone()); + } else if (entry.getValue() instanceof HashMap){ + this.values.put(entry.getKey(), ((HashMap) entry.getValue()).clone()); } else { this.values.put(entry.getKey(), entry.getValue()); }