* Lignify - Fixed that existing subtypes of the enchanted creature were not removed.

This commit is contained in:
LevelX2 2016-01-29 22:18:34 +01:00
parent 9aeaeae1c3
commit 8c9c4421cd
6 changed files with 99 additions and 24 deletions

View file

@ -28,8 +28,6 @@
package mage.sets.betrayersofkamigawa; package mage.sets.betrayersofkamigawa;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.RemoveCountersSourceCost;
@ -37,6 +35,8 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.AnyColorManaAbility; import mage.abilities.mana.AnyColorManaAbility;
import mage.abilities.mana.ColorlessManaAbility; import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.counters.CounterType; import mage.counters.CounterType;
/** /**
@ -49,7 +49,8 @@ public class TendoIceBridge extends CardImpl {
super(ownerId, 165, "Tendo Ice Bridge", Rarity.RARE, new CardType[]{CardType.LAND}, ""); super(ownerId, 165, "Tendo Ice Bridge", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "BOK"; this.expansionSetCode = "BOK";
// Tendo Ice Bridge enters the battlefield with a charge counter on it. // Tendo Ice Bridge enters the battlefield with a charge counter on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(1)))); this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.CHARGE.createInstance(1)), "with a charge counter on it"));
// {tap}: Add {C} to your mana pool. // {tap}: Add {C} to your mana pool.
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {tap}, Remove a charge counter from Tendo Ice Bridge: Add one mana of any color to your mana pool. // {tap}, Remove a charge counter from Tendo Ice Bridge: Add one mana of any color to your mana pool.

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.commander; package mage.sets.commander;
import java.util.UUID; import java.util.UUID;
@ -71,8 +70,6 @@ public class GhaveGuruOfSpores extends CardImpl {
this.subtype.add("Fungus"); this.subtype.add("Fungus");
this.subtype.add("Shaman"); this.subtype.add("Shaman");
this.power = new MageInt(0); this.power = new MageInt(0);
this.toughness = new MageInt(0); this.toughness = new MageInt(0);

View file

@ -67,7 +67,7 @@ public class Lignify extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new BecomesCreatureAttachedEffect(new LignifyTreefolkToken(), new BecomesCreatureAttachedEffect(new LignifyTreefolkToken(),
"Enchanted creature is a Treefolk with base power and toughness 0/4 and loses all abilities", "Enchanted creature is a Treefolk with base power and toughness 0/4 and loses all abilities",
Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_AND_PT))); Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_SUBTYPE_AND_PT)));
} }

View file

@ -31,7 +31,6 @@ import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;

View file

@ -0,0 +1,77 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.enchantments;
import mage.abilities.keyword.IndestructibleAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class LignifyTest extends CardTestPlayerBase {
/**
* Lignify shouldn't make the creature it enchants a (whatever it
* is)treefolk as it makes the creature just a treefolk i.e. a Sliver
* Hivelord enchanted by lignify should be just a treefolk and not a sliver
* treefolk
*/
@Test
public void LooseType() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
// Enchant creature
// Enchanted creature is a Treefolk with base power and toughness 0/4 and loses all abilities.
addCard(Zone.HAND, playerA, "Lignify", 1); // {1}{G}
// Sliver creatures you control have indestructible.
addCard(Zone.BATTLEFIELD, playerB, "Sliver Hivelord", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lignify", "Sliver Hivelord");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Lignify", 1);
assertPermanentCount(playerB, "Sliver Hivelord", 1);
assertAbility(playerB, "Sliver Hivelord", IndestructibleAbility.getInstance(), false);
assertPowerToughness(playerB, "Sliver Hivelord", 0, 4);
Permanent hivelord = getPermanent("Sliver Hivelord", playerB);
Assert.assertFalse("Sliver Hivelord may not be of subtype Sliver", hivelord.getSubtype().contains("Sliver"));
}
}

View file

@ -47,7 +47,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
public enum LoseType { public enum LoseType {
NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_AND_PT NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE_AND_PT
}; };
protected Token token; protected Token token;
@ -111,6 +111,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
switch (loseType) { switch (loseType) {
case ALL: case ALL:
case ALL_BUT_COLOR: case ALL_BUT_COLOR:
case ABILITIES_SUBTYPE_AND_PT:
permanent.getSubtype().retainAll(CardRepository.instance.getLandTypes()); permanent.getSubtype().retainAll(CardRepository.instance.getLandTypes());
break; break;
} }
@ -143,7 +144,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
case ALL: case ALL:
case ALL_BUT_COLOR: case ALL_BUT_COLOR:
case ABILITIES: case ABILITIES:
case ABILITIES_AND_PT: case ABILITIES_SUBTYPE_AND_PT:
permanent.removeAllAbilities(source.getSourceId(), game); permanent.removeAllAbilities(source.getSourceId(), game);
break; break;
} }