From f0f407457ecbf9ee1c89d9e5601b57d076d54530 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 12 Feb 2018 14:45:05 +0100 Subject: [PATCH] * Subtypes of tokens were not set back correctly after a subtype changing effect did end (e.g. Arcane Adaptation). --- .../SubTypeChangingEffectsTest.java | 22 +++++++++++++++++++ .../mage/game/permanent/PermanentToken.java | 6 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/SubTypeChangingEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/SubTypeChangingEffectsTest.java index f8a3f00856a..3dd4bd44a08 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/SubTypeChangingEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/SubTypeChangingEffectsTest.java @@ -254,6 +254,14 @@ public class SubTypeChangingEffectsTest extends CardTestPlayerBase { // Creatures you control are the chosen type in addition to their other types. The same is true for creature spells you control and creature cards you own that aren't on the battlefield. addCard(Zone.HAND, playerA, "Arcane Adaptation", 1); // Enchantment {2}{U} addCard(Zone.BATTLEFIELD, playerA, "Island", 3); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 8); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + + // Create a 5/5 green Wurm creature token with trample. + addCard(Zone.HAND, playerA, "Advent of the Wurm", 1); // Instant {1}{G}{G}{W} + // Create a 4/4 green Beast creature token. + // Flashback {2}{G}{G}{G} (You may cast this card from your graveyard for its flashback cost. Then exile it.) + addCard(Zone.HAND, playerA, "Beast Attack", 1); // Instant {2}{G}{G}{G} addCard(Zone.HAND, playerA, "Silvercoat Lion"); addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); @@ -266,21 +274,35 @@ public class SubTypeChangingEffectsTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion"); + castSpell(1, PhaseStep.UPKEEP, playerA, "Advent of the Wurm"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Arcane Adaptation"); setChoice(playerA, "Orc"); + castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Beast Attack"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Disenchant", "Arcane Adaptation"); setStopAt(1, PhaseStep.END_TURN); execute(); assertGraveyardCount(playerA, "Arcane Adaptation", 1); + assertGraveyardCount(playerA, "Advent of the Wurm", 1); + assertGraveyardCount(playerA, "Beast Attack", 1); assertGraveyardCount(playerB, "Disenchant", 1); Permanent silvercoatLion = getPermanent("Silvercoat Lion", playerA); Assert.assertEquals(true, silvercoatLion.getSubtype(currentGame).contains(SubType.CAT)); Assert.assertEquals(false, silvercoatLion.getSubtype(currentGame).contains(SubType.ORC)); + Permanent beast = getPermanent("Beast", playerA); + Assert.assertEquals(true, beast.getSubtype(currentGame).contains(SubType.BEAST)); + Assert.assertEquals(false, beast.getSubtype(currentGame).contains(SubType.ORC)); + + Permanent wurm = getPermanent("Wurm", playerA); + Assert.assertEquals(true, wurm.getSubtype(currentGame).contains(SubType.WURM)); + Assert.assertEquals(false, wurm.getSubtype(currentGame).contains(SubType.ORC)); + for (Card card : playerA.getLibrary().getCards(currentGame)) { if (card.isCreature()) { Assert.assertEquals(card.getName() + " should not have ORC type", false, card.getSubtype(currentGame).contains(SubType.ORC)); diff --git a/Mage/src/main/java/mage/game/permanent/PermanentToken.java b/Mage/src/main/java/mage/game/permanent/PermanentToken.java index a04927c6c63..51f62bd528c 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentToken.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentToken.java @@ -88,8 +88,10 @@ public class PermanentToken extends PermanentImpl { this.color = token.getColor(game).copy(); this.frameColor = token.getFrameColor(game); this.frameStyle = token.getFrameStyle(); - this.supertype = token.getSuperType(); - this.subtype = token.getSubtype(game); + this.supertype.clear(); + this.supertype.addAll(token.getSuperType()); + this.subtype.clear(); + this.subtype.addAll(token.getSubtype(game)); this.tokenDescriptor = token.getTokenDescriptor(); }