From 203056df0a2c82016c41018f94f489e6ff42bcec Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 10 Oct 2016 20:52:47 +0200 Subject: [PATCH] * Aquitect's Will - Fixed a bug that the target land lost other abilities (fixes #2448). --- ....java => LandTypeChangingEffectsTest.java} | 36 ++++++++++++++++- .../BecomesBasicLandTargetEffect.java | 40 ++++++++++--------- 2 files changed, 57 insertions(+), 19 deletions(-) rename Mage.Tests/src/test/java/org/mage/test/cards/continuous/{LandTypeChangingEffects.java => LandTypeChangingEffectsTest.java} (71%) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/LandTypeChangingEffects.java b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/LandTypeChangingEffectsTest.java similarity index 71% rename from Mage.Tests/src/test/java/org/mage/test/cards/continuous/LandTypeChangingEffects.java rename to Mage.Tests/src/test/java/org/mage/test/cards/continuous/LandTypeChangingEffectsTest.java index 5b81a833c3..fbd8bc1b63 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/LandTypeChangingEffects.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/LandTypeChangingEffectsTest.java @@ -31,6 +31,7 @@ import mage.abilities.mana.AnyColorManaAbility; import mage.constants.CardType; import mage.constants.PhaseStep; import mage.constants.Zone; +import mage.counters.CounterType; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -38,7 +39,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * * @author LevelX2 */ -public class LandTypeChangingEffects extends CardTestPlayerBase { +public class LandTypeChangingEffectsTest extends CardTestPlayerBase { /** * @@ -97,4 +98,37 @@ public class LandTypeChangingEffects extends CardTestPlayerBase { assertAbility(playerB, "Canopy Vista", new AnyColorManaAbility(), true); } + /** + * Currently, a land hit by Aquitect's Will loses all of its other + * abilities, making it a cheap Spreading Seas. It should function like + * Urborg, Tomb of Yawgmoth, not Spreading Seas or Blood Moon. + */ + @Test + public void testLandDoesNotLooseOtherAbilities() { + // Put a flood counter on target land. + // That land is an Island in addition to its other types for as long as it has a flood counter on it. + // If you control a Merfolk, draw a card. + addCard(Zone.HAND, playerA, "Aquitect's Will");// Tribal Sorcery{U} + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + // Forbidding Watchtower enters the battlefield tapped. + // {T}: Add {W} to your mana pool. + // {1}{W}: Forbidding Watchtower becomes a 1/5 white Soldier creature until end of turn. It's still a land. + addCard(Zone.BATTLEFIELD, playerB, "Forbidding Watchtower", 1); + addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Aquitect's Will", "Forbidding Watchtower"); + + activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{W}:"); + setStopAt(2, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Aquitect's Will", 1); + + assertPermanentCount(playerB, "Forbidding Watchtower", 1); + assertCounterCount("Forbidding Watchtower", CounterType.FLOOD, 1); + assertType("Forbidding Watchtower", CardType.LAND, "Island"); + assertPowerToughness(playerB, "Forbidding Watchtower", 1, 5); + + } + } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index 7f6ad973d0..22ccfa003e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -51,6 +51,7 @@ import mage.game.permanent.Permanent; import mage.players.Player; /** + * http://mtgsalvation.gamepedia.com/Land_changers * * @author LevelX2 */ @@ -58,6 +59,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { protected boolean chooseLandType; protected ArrayList landTypes = new ArrayList(); + protected ArrayList landTypesToAdd = new ArrayList(); protected boolean loseOther; // loses all other abilities, card types, and creature types public BecomesBasicLandTargetEffect(Duration duration) { @@ -99,6 +101,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { public BecomesBasicLandTargetEffect(final BecomesBasicLandTargetEffect effect) { super(effect); this.landTypes.addAll(effect.landTypes); + this.landTypesToAdd.addAll(effect.landTypesToAdd); this.chooseLandType = effect.chooseLandType; this.loseOther = effect.loseOther; } @@ -128,17 +131,8 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { } } - if (!loseOther) { - for (UUID targetPermanent : targetPointer.getTargets(game, source)) { - Permanent land = game.getPermanent(targetPermanent); - if (land != null) { - for (String type : land.getSubtype(game)) { - if (!landTypes.contains(type)) { - landTypes.add(type); - } - } - } - } + if (loseOther) { + landTypesToAdd.addAll(landTypes); } } @@ -153,15 +147,25 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { if (!land.getCardType().contains(CardType.LAND)) { land.getCardType().add(CardType.LAND); } - // 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects - // So the ability removing has to be done before Layer 6 - land.removeAllAbilities(source.getSourceId(), game); - // 305.7 - land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes()); - land.getSubtype(game).addAll(landTypes); + if (loseOther) { + // 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects + // So the ability removing has to be done before Layer 6 + land.removeAllAbilities(source.getSourceId(), game); + // 305.7 + land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes()); + land.getSubtype(game).addAll(landTypes); + } else { + landTypesToAdd.clear(); + for (String subtype : landTypes) { + if (!land.getSubtype(game).contains(subtype)) { + land.getSubtype(game).add(subtype); + landTypesToAdd.add(subtype); + } + } + } break; case AbilityAddingRemovingEffects_6: - for (String landType : landTypes) { + for (String landType : landTypesToAdd) { switch (landType) { case "Swamp": land.addAbility(new BlackManaAbility(), source.getSourceId(), game);