* Aquitect's Will - Fixed a bug that the target land lost other abilities (fixes #2448).

This commit is contained in:
LevelX2 2016-10-10 20:52:47 +02:00
parent 35e8afb67c
commit 203056df0a
2 changed files with 57 additions and 19 deletions

View file

@ -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);
}
}

View file

@ -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<String> landTypes = new ArrayList();
protected ArrayList<String> 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);
}
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);