From 858f210a83f5f6270a00218ce85d51fbe97f9f13 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 6 May 2018 18:57:06 +0400 Subject: [PATCH 1/4] Test framework: added assert color; --- .../base/impl/CardTestPlayerAPIImpl.java | 53 ++++++++++++++++--- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index d405956f83b..24f6e7cce97 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -1,6 +1,7 @@ package org.mage.test.serverside.base.impl; import mage.Mana; +import mage.ObjectColor; import mage.abilities.Ability; import mage.cards.Card; import mage.cards.decks.Deck; @@ -516,20 +517,20 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - public void assertAbility(Player player, String cardName, Ability ability, boolean flag) throws AssertionError { - assertAbility(player, cardName, ability, flag, 1); + public void assertAbility(Player player, String cardName, Ability ability, boolean mustHave) throws AssertionError { + assertAbility(player, cardName, ability, mustHave, 1); } /** * @param player * @param cardName * @param ability - * @param flag true if creature should contain ability, false if it should + * @param mustHave true if creature should contain ability, false if it should * NOT contain it instead * @param count number of permanents with that ability * @throws AssertionError */ - public void assertAbility(Player player, String cardName, Ability ability, boolean flag, int count) throws AssertionError { + public void assertAbility(Player player, String cardName, Ability ability, boolean mustHave, int count) throws AssertionError { int foundCount = 0; Permanent found = null; for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) { @@ -545,7 +546,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertTrue("There is another number (" + foundCount + ") as defined (" + count + ") of such permanents under player's control, player=" + player.getName() + ", cardName=" + cardName, count == foundCount); - if (flag) { + if (mustHave) { Assert.assertTrue("No such ability=" + ability.toString() + ", player=" + player.getName() + ", cardName" + cardName, found.getAbilities(currentGame).containsRule(ability)); } else { @@ -682,9 +683,9 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement * * @param cardName Name of the permanent that should be checked. * @param type A type to test for - * @param flag true if creature should have type, false if it should not + * @param mustHave true if creature should have type, false if it should not */ - public void assertType(String cardName, CardType type, boolean flag) throws AssertionError { + public void assertType(String cardName, CardType type, boolean mustHave) throws AssertionError { Permanent found = null; for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) { if (permanent.getName().equals(cardName)) { @@ -695,7 +696,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', (found.getCardType().contains(type) == flag)); + Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', (found.getCardType().contains(type) == mustHave)); } @@ -738,6 +739,42 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } + /** + * Assert permanent color + * + * @param player player to check + * @param cardName card name on battlefield from player + * @param searchColors colors list with searchable values + * @param mustHave must or not must have that colors + */ + public void assertColor(Player player, String cardName, ObjectColor searchColors, boolean mustHave) { + Assert.assertNotEquals("must setup colors to search", 0, searchColors.getColorCount()); + + Permanent card = getPermanent(cardName, player); + ObjectColor cardColor = card.getColor(currentGame); + + List colorsHave = new ArrayList<>(); + List colorsDontHave = new ArrayList<>(); + + for (ObjectColor searchColor : searchColors.getColors()) { + if (cardColor.shares(searchColor)) { + colorsHave.add(searchColor); + } else { + colorsDontHave.add(searchColor); + } + } + + if (mustHave) { + Assert.assertEquals("must contain colors [" + searchColors.toString() + "] but found only [" + cardColor.toString() + "]", 0, colorsDontHave.size()); + } else { + Assert.assertEquals("must not contain colors [" + searchColors.toString() + "] but found [" + cardColor.toString() + "]", 0, colorsHave.size()); + } + } + + public void assertColor(Player player, String cardName, String searchColors, boolean mustHave) { + assertColor(player, cardName, new ObjectColor(searchColors), mustHave); + } + /** * Assert whether a permanent is tapped or not * From 72314a9512ea787434bce4599af11d26777b5f5f Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 6 May 2018 19:07:45 +0400 Subject: [PATCH 2/4] * Fixed 8 cards with "becomes creature attached" effect that it adds colors instead replace it; * Affected cards: Awaken the Ancient, Corrupted Zendikon, Crusher Zendikon, Deep Freeze, Guardian Zendikon, Living Terrain, Vastwood Zendikon, Wind Zendikon; --- .../src/mage/cards/a/AwakenTheAncient.java | 3 +- .../src/mage/cards/c/CorruptedZendikon.java | 2 +- .../src/mage/cards/c/CrusherZendikon.java | 3 +- Mage.Sets/src/mage/cards/d/DeepFreeze.java | 2 +- .../src/mage/cards/g/GuardianZendikon.java | 13 +- Mage.Sets/src/mage/cards/l/LivingTerrain.java | 3 +- .../src/mage/cards/v/VastwoodZendikon.java | 2 +- Mage.Sets/src/mage/cards/w/WindZendikon.java | 14 ++- .../BecomesCreatureAttachedTest.java | 114 ++++++++++++++++++ .../BecomesCreatureAttachedEffect.java | 16 +-- 10 files changed, 146 insertions(+), 26 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/continuous/BecomesCreatureAttachedTest.java diff --git a/Mage.Sets/src/mage/cards/a/AwakenTheAncient.java b/Mage.Sets/src/mage/cards/a/AwakenTheAncient.java index 37549cb360e..1dc0f1b8184 100644 --- a/Mage.Sets/src/mage/cards/a/AwakenTheAncient.java +++ b/Mage.Sets/src/mage/cards/a/AwakenTheAncient.java @@ -65,7 +65,8 @@ public class AwakenTheAncient extends CardImpl { this.addAbility(ability); // Enchanted Mountain is a 7/7 red Giant creature with haste. It's still a land. - Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new GiantToken(), "Enchanted Mountain is a 7/7 red Giant creature with haste. It's still a land", Duration.WhileOnBattlefield)); + Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect( + new GiantToken(), "Enchanted Mountain is a 7/7 red Giant creature with haste. It's still a land", Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR)); this.addAbility(ability2); } diff --git a/Mage.Sets/src/mage/cards/c/CorruptedZendikon.java b/Mage.Sets/src/mage/cards/c/CorruptedZendikon.java index 01744b45ca9..e63ced72db0 100644 --- a/Mage.Sets/src/mage/cards/c/CorruptedZendikon.java +++ b/Mage.Sets/src/mage/cards/c/CorruptedZendikon.java @@ -68,7 +68,7 @@ public class CorruptedZendikon extends CardImpl { // Enchanted land is a 3/3 black Ooze creature. It's still a land. Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new CorruptedZendikonOozeToken(), - "Enchanted land is a 3/3 black Ooze creature. It's still a land.", Duration.WhileOnBattlefield)); + "Enchanted land is a 3/3 black Ooze creature. It's still a land.", Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR)); this.addAbility(ability2); // When enchanted land dies, return that card to its owner's hand. diff --git a/Mage.Sets/src/mage/cards/c/CrusherZendikon.java b/Mage.Sets/src/mage/cards/c/CrusherZendikon.java index c6b9ab3fc90..0f3d07b8376 100644 --- a/Mage.Sets/src/mage/cards/c/CrusherZendikon.java +++ b/Mage.Sets/src/mage/cards/c/CrusherZendikon.java @@ -67,7 +67,8 @@ public class CrusherZendikon extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Enchanted land is a 4/2 red Beast creature with trample. It's still a land. - Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new BeastToken(), "Enchanted land is a 4/2 red Beast creature with trample. It's still a land.", Duration.WhileOnBattlefield)); + Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect( + new BeastToken(), "Enchanted land is a 4/2 red Beast creature with trample. It's still a land.", Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR)); this.addAbility(ability2); // When enchanted land dies, return that card to its owner's hand. Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false); diff --git a/Mage.Sets/src/mage/cards/d/DeepFreeze.java b/Mage.Sets/src/mage/cards/d/DeepFreeze.java index a7b21e6873d..3af29de23e7 100644 --- a/Mage.Sets/src/mage/cards/d/DeepFreeze.java +++ b/Mage.Sets/src/mage/cards/d/DeepFreeze.java @@ -69,7 +69,7 @@ public class DeepFreeze extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new DeepFreezeToken(), "Enchanted creature has base power and toughness 0/4, has defender, loses all other abilities, and is a blue Wall in addition to its other colors and types", - Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_AND_PT) + Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES) )); } diff --git a/Mage.Sets/src/mage/cards/g/GuardianZendikon.java b/Mage.Sets/src/mage/cards/g/GuardianZendikon.java index a8d3d66af37..02ba012b78e 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianZendikon.java +++ b/Mage.Sets/src/mage/cards/g/GuardianZendikon.java @@ -70,7 +70,8 @@ public class GuardianZendikon extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new WallToken(), "Enchanted land is a 2/6 white wall creature with defender. It's still a land", Duration.WhileOnBattlefield)); + Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect( + new GuardianZendikonWallToken(), "Enchanted land is a 2/6 white wall creature with defender. It's still a land", Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR)); this.addAbility(ability2); Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false); @@ -87,9 +88,9 @@ public class GuardianZendikon extends CardImpl { } } -class WallToken extends TokenImpl { +class GuardianZendikonWallToken extends TokenImpl { - WallToken() { + GuardianZendikonWallToken() { super("", "2/6 white wall creature with defender"); cardType.add(CardType.CREATURE); color.setWhite(true); @@ -98,11 +99,11 @@ class WallToken extends TokenImpl { toughness = new MageInt(6); this.addAbility(DefenderAbility.getInstance()); } - public WallToken(final WallToken token) { + public GuardianZendikonWallToken(final GuardianZendikonWallToken token) { super(token); } - public WallToken copy() { - return new WallToken(this); + public GuardianZendikonWallToken copy() { + return new GuardianZendikonWallToken(this); } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/l/LivingTerrain.java b/Mage.Sets/src/mage/cards/l/LivingTerrain.java index 019471ebb00..21c05cb2931 100644 --- a/Mage.Sets/src/mage/cards/l/LivingTerrain.java +++ b/Mage.Sets/src/mage/cards/l/LivingTerrain.java @@ -61,7 +61,8 @@ public class LivingTerrain extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Enchanted land is a 5/6 green Treefolk creature that's still a land. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new TreefolkToken(), "Enchanted land is a 5/6 green Treefolk creature that's still a land", Duration.WhileOnBattlefield))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect( + new TreefolkToken(), "Enchanted land is a 5/6 green Treefolk creature that's still a land", Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR))); } public LivingTerrain(final LivingTerrain card) { diff --git a/Mage.Sets/src/mage/cards/v/VastwoodZendikon.java b/Mage.Sets/src/mage/cards/v/VastwoodZendikon.java index 2e667eb368c..b86de1f50b1 100644 --- a/Mage.Sets/src/mage/cards/v/VastwoodZendikon.java +++ b/Mage.Sets/src/mage/cards/v/VastwoodZendikon.java @@ -69,7 +69,7 @@ public class VastwoodZendikon extends CardImpl { Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect( new ElementalCreatureToken(6, 4, "6/4 green Elemental creature", new ObjectColor("G")), - "Enchanted land is a 6/4 green Elemental creature. It's still a land", Duration.WhileOnBattlefield )); + "Enchanted land is a 6/4 green Elemental creature. It's still a land", Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR)); this.addAbility(ability2); Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false); diff --git a/Mage.Sets/src/mage/cards/w/WindZendikon.java b/Mage.Sets/src/mage/cards/w/WindZendikon.java index 44b44448886..836e9fafdc8 100644 --- a/Mage.Sets/src/mage/cards/w/WindZendikon.java +++ b/Mage.Sets/src/mage/cards/w/WindZendikon.java @@ -66,7 +66,9 @@ public class WindZendikon extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new ElementalToken(), "Enchanted land is a 2/2 blue Elemental creature with flying. It's still a land", Duration.WhileOnBattlefield)); + Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect( + new WindZendikonElementalToken(), "Enchanted land is a 2/2 blue Elemental creature with flying. It's still a land", + Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR)); this.addAbility(ability2); Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false); @@ -82,8 +84,8 @@ public class WindZendikon extends CardImpl { return new WindZendikon(this); } - class ElementalToken extends TokenImpl { - ElementalToken() { + class WindZendikonElementalToken extends TokenImpl { + WindZendikonElementalToken() { super("", "2/2 blue Elemental creature with flying"); cardType.add(CardType.CREATURE); color.setBlue(true); @@ -92,12 +94,12 @@ public class WindZendikon extends CardImpl { toughness = new MageInt(2); addAbility(FlyingAbility.getInstance()); } - public ElementalToken(final ElementalToken token) { + public WindZendikonElementalToken(final WindZendikonElementalToken token) { super(token); } - public ElementalToken copy() { - return new ElementalToken(this); + public WindZendikonElementalToken copy() { + return new WindZendikonElementalToken(this); } } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/BecomesCreatureAttachedTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/BecomesCreatureAttachedTest.java new file mode 100644 index 00000000000..7b2b9270143 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/BecomesCreatureAttachedTest.java @@ -0,0 +1,114 @@ +/* + * 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.continuous; + +import mage.ObjectColor; +import mage.abilities.AbilitiesImpl; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.constants.CardType; +import mage.constants.PhaseStep; +import mage.constants.SubType; +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 JayDi85 + */ +public class BecomesCreatureAttachedTest extends CardTestPlayerBase { + + // Dryad Arbor -- green creature land + + @Test + public void test_CreatureLandWithColor() { + addCard(Zone.BATTLEFIELD, playerA, "Dryad Arbor", 1); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Dryad Arbor", 1); + assertPowerToughness(playerA, "Dryad Arbor", 1, 1); + // land + assertColor(playerA, "Forest", "WUBGR", false); + // dryad + assertColor(playerA, "Dryad Arbor", "G", true); + assertColor(playerA, "Dryad Arbor", "WUBR", false); + } + + @Test + public void test_AttachToLandWithColorReplace() { + // Enchanted land is a 2/2 blue Elemental creature with flying. It’s still a land. + addCard(Zone.HAND, playerA, "Wind Zendikon", 1); + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + + addCard(Zone.BATTLEFIELD, playerA, "Dryad Arbor", 1); + + // attach to forest and check color changing + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wind Zendikon", "Dryad Arbor"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Dryad Arbor", 1); + assertPowerToughness(playerA, "Dryad Arbor", 2, 2); + assertType("Dryad Arbor", CardType.CREATURE, true); + assertType("Dryad Arbor", CardType.LAND, true); + assertAbilities(playerA, "Dryad Arbor", new AbilitiesImpl<>(FlyingAbility.getInstance())); + assertColor(playerA, "Dryad Arbor", "U", true); + assertColor(playerA, "Dryad Arbor", "WBGR", false); + } + + @Test + public void test_AttachToLandWithColorAdd() { + // Enchanted land is a 2/2 blue Elemental creature with flying. It’s still a land. + addCard(Zone.HAND, playerA, "Deep Freeze", 1); + addCard(Zone.BATTLEFIELD, playerA, "Island", 3); + + addCard(Zone.BATTLEFIELD, playerA, "Dryad Arbor", 1); + + // attach to forest and check color changing + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Deep Freeze", "Dryad Arbor"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Dryad Arbor", 1); + assertPowerToughness(playerA, "Dryad Arbor", 0, 4); + assertType("Dryad Arbor", CardType.CREATURE, true); + assertType("Dryad Arbor", CardType.LAND, true); + assertType("Dryad Arbor", CardType.LAND, SubType.WALL); + assertAbilities(playerA, "Dryad Arbor", new AbilitiesImpl<>(DefenderAbility.getInstance())); + assertColor(playerA, "Dryad Arbor", "UG", true); + assertColor(playerA, "Dryad Arbor", "WBR", false); + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java index aca32daee2d..ae71f505861 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java @@ -40,7 +40,7 @@ import mage.game.permanent.token.Token; public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { public enum LoseType { - NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE_AND_PT, ABILITIES_AND_PT + NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE, COLOR } protected Token token; @@ -98,7 +98,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { switch (loseType) { case ALL: case ALL_BUT_COLOR: - case ABILITIES_SUBTYPE_AND_PT: + case ABILITIES_SUBTYPE: permanent.getSubtype(game).retainAll(SubType.getLandTypes(false)); break; } @@ -107,12 +107,12 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { permanent.getSubtype(game).add(t); } } - } break; + case ColorChangingEffects_5: if (sublayer == SubLayer.NA) { - if (loseType == LoseType.ALL) { + if (loseType == LoseType.ALL || loseType == LoseType.COLOR) { permanent.getColor(game).setBlack(false); permanent.getColor(game).setGreen(false); permanent.getColor(game).setBlue(false); @@ -124,29 +124,29 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { } } break; + case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { switch (loseType) { case ALL: case ALL_BUT_COLOR: case ABILITIES: - case ABILITIES_AND_PT: - case ABILITIES_SUBTYPE_AND_PT: + case ABILITIES_SUBTYPE: permanent.removeAllAbilities(source.getSourceId(), game); break; } for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } - } break; + case PTChangingEffects_7: if (sublayer == SubLayer.SetPT_7b) { permanent.getPower().setValue(token.getPower().getValue()); permanent.getToughness().setValue(token.getToughness().getValue()); - break; } + break; } } return true; From f7a4e7590978d0deed01fe9d6bda3eccf42995f3 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 6 May 2018 19:08:56 +0400 Subject: [PATCH 3/4] Refactoring: replace custom creature tokens with basic class (11 cards) --- .../src/mage/cards/e/EnsoulArtifact.java | 20 +---- Mage.Sets/src/mage/cards/f/FowlPlay.java | 24 +----- Mage.Sets/src/mage/cards/l/LifeDeath.java | 21 +---- Mage.Sets/src/mage/cards/l/Lignify.java | 25 +----- Mage.Sets/src/mage/cards/l/LivingLands.java | 20 +---- Mage.Sets/src/mage/cards/l/LivingPlane.java | 20 +---- .../src/mage/cards/n/NaturalAffinity.java | 83 ++----------------- Mage.Sets/src/mage/cards/n/NaturesRevolt.java | 22 +---- Mage.Sets/src/mage/cards/r/RudeAwakening.java | 23 +---- .../src/mage/cards/t/TezzeretsTouch.java | 23 +---- .../src/mage/cards/t/TheloniteDruid.java | 3 +- 11 files changed, 32 insertions(+), 252 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/EnsoulArtifact.java b/Mage.Sets/src/mage/cards/e/EnsoulArtifact.java index 42c01e78957..0c04a8bcdc2 100644 --- a/Mage.Sets/src/mage/cards/e/EnsoulArtifact.java +++ b/Mage.Sets/src/mage/cards/e/EnsoulArtifact.java @@ -43,6 +43,7 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.TargetPermanent; import mage.target.common.TargetArtifactPermanent; @@ -66,7 +67,7 @@ public class EnsoulArtifact extends CardImpl { // Enchanted artifact is a creature with base power and toughness 5/5 in addition to its other types. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new BecomesCreatureAttachedEffect(new EnsoulArtifactToken(), "Enchanted artifact is a creature with base power and toughness 5/5 in addition to its other types", Duration.WhileOnBattlefield) + new BecomesCreatureAttachedEffect(new CreatureToken(5, 5), "Enchanted artifact is a creature with base power and toughness 5/5 in addition to its other types", Duration.WhileOnBattlefield) )); } @@ -79,21 +80,4 @@ public class EnsoulArtifact extends CardImpl { public EnsoulArtifact copy() { return new EnsoulArtifact(this); } -} - -class EnsoulArtifactToken extends TokenImpl { - - EnsoulArtifactToken() { - super("", "5/5"); - cardType.add(CardType.CREATURE); - power = new MageInt(5); - toughness = new MageInt(5); - } - public EnsoulArtifactToken(final EnsoulArtifactToken token) { - super(token); - } - - public EnsoulArtifactToken copy() { - return new EnsoulArtifactToken(this); - } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/f/FowlPlay.java b/Mage.Sets/src/mage/cards/f/FowlPlay.java index 2aa7e833f10..69edefb0e72 100644 --- a/Mage.Sets/src/mage/cards/f/FowlPlay.java +++ b/Mage.Sets/src/mage/cards/f/FowlPlay.java @@ -34,6 +34,7 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continuous.BecomesCreatureAttachedEffect; import mage.constants.Outcome; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.TargetPermanent; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; @@ -43,7 +44,6 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.constants.Zone; import mage.game.permanent.token.TokenImpl; -import mage.game.permanent.token.Token; import mage.target.common.TargetCreaturePermanent; /** @@ -66,9 +66,9 @@ public class FowlPlay extends CardImpl { // Enchanted creature is a Chicken with base power and toughness 1/1 and loses all abilities. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new BecomesCreatureAttachedEffect(new FowlPlayToken(), + new BecomesCreatureAttachedEffect(new CreatureToken(1, 1, "1/1 Chicken creature", SubType.CHICKEN), "Enchanted creature is a Chicken with base power and toughness 1/1 and loses all abilities", - Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_SUBTYPE_AND_PT))); + Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_SUBTYPE))); } public FowlPlay(final FowlPlay card) { @@ -80,21 +80,3 @@ public class FowlPlay extends CardImpl { return new FowlPlay(this); } } - -class FowlPlayToken extends TokenImpl { - - public FowlPlayToken() { - super("Chicken", "a Chicken with base power and toughness 1/1 with no abilities"); - cardType.add(CardType.CREATURE); - subtype.add(SubType.CHICKEN); - power = new MageInt(1); - toughness = new MageInt(1); - } - public FowlPlayToken(final FowlPlayToken token) { - super(token); - } - - public FowlPlayToken copy() { - return new FowlPlayToken(this); - } -} diff --git a/Mage.Sets/src/mage/cards/l/LifeDeath.java b/Mage.Sets/src/mage/cards/l/LifeDeath.java index f7c9a6d7413..12555e30b0e 100644 --- a/Mage.Sets/src/mage/cards/l/LifeDeath.java +++ b/Mage.Sets/src/mage/cards/l/LifeDeath.java @@ -45,6 +45,7 @@ import mage.filter.common.FilterControlledLandPermanent; import mage.game.Game; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.players.Player; import mage.target.Target; import mage.target.common.TargetCardInYourGraveyard; @@ -60,7 +61,7 @@ public class LifeDeath extends SplitCard { // Life // All lands you control become 1/1 creatures until end of turn. They're still lands. - getLeftHalfCard().getSpellAbility().addEffect(new BecomesCreatureAllEffect(new LifeLandToken(), "lands", + getLeftHalfCard().getSpellAbility().addEffect(new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn)); // Death @@ -81,24 +82,6 @@ public class LifeDeath extends SplitCard { } } -class LifeLandToken extends TokenImpl { - - public LifeLandToken() { - super("", "1/1 creatures"); - cardType.add(CardType.CREATURE); - power = new MageInt(1); - toughness = new MageInt(1); - } - public LifeLandToken(final LifeLandToken token) { - super(token); - } - - public LifeLandToken copy() { - return new LifeLandToken(this); - } - -} - class DeathEffect extends OneShotEffect { public DeathEffect() { diff --git a/Mage.Sets/src/mage/cards/l/Lignify.java b/Mage.Sets/src/mage/cards/l/Lignify.java index 9d2c1349246..788b26ab5e6 100644 --- a/Mage.Sets/src/mage/cards/l/Lignify.java +++ b/Mage.Sets/src/mage/cards/l/Lignify.java @@ -42,7 +42,7 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.permanent.token.TokenImpl; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -66,9 +66,9 @@ public class Lignify extends CardImpl { // Enchanted creature is a Treefolk with base power and toughness 0/4 and loses all abilities. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new BecomesCreatureAttachedEffect(new LignifyTreefolkToken(), + new BecomesCreatureAttachedEffect(new CreatureToken(0, 4, "0/4 Treefolk creature", SubType.TREEFOLK), "Enchanted creature is a Treefolk with base power and toughness 0/4 and loses all abilities", - Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_SUBTYPE_AND_PT))); + Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ABILITIES_SUBTYPE))); } @@ -81,22 +81,3 @@ public class Lignify extends CardImpl { return new Lignify(this); } } - -class LignifyTreefolkToken extends TokenImpl { - - public LignifyTreefolkToken() { - super("Treefolk", "a Treefolk with base power and toughness 0/4 with no abilities"); - cardType.add(CardType.CREATURE); - subtype.add(SubType.TREEFOLK); - power = new MageInt(0); - toughness = new MageInt(4); - } - public LignifyTreefolkToken(final LignifyTreefolkToken token) { - super(token); - } - - public LignifyTreefolkToken copy() { - return new LignifyTreefolkToken(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/l/LivingLands.java b/Mage.Sets/src/mage/cards/l/LivingLands.java index eb1d8b1b02f..6c4d52f64ae 100644 --- a/Mage.Sets/src/mage/cards/l/LivingLands.java +++ b/Mage.Sets/src/mage/cards/l/LivingLands.java @@ -38,6 +38,7 @@ import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import java.util.UUID; @@ -57,7 +58,7 @@ public class LivingLands extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); // All Forests are 1/1 creatures that are still lands. - ContinuousEffect effect = new BecomesCreatureAllEffect(new LivingLandsToken(), "lands", filter, Duration.WhileOnBattlefield); + ContinuousEffect effect = new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", filter, Duration.WhileOnBattlefield); effect.getDependencyTypes().add(DependencyType.BecomeForest); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } @@ -71,20 +72,3 @@ public class LivingLands extends CardImpl { return new LivingLands(this); } } - -class LivingLandsToken extends TokenImpl { - - public LivingLandsToken() { - super("", "1/1 creatures"); - cardType.add(CardType.CREATURE); - power = new MageInt(1); - toughness = new MageInt(1); - } - public LivingLandsToken(final LivingLandsToken token) { - super(token); - } - - public LivingLandsToken copy() { - return new LivingLandsToken(this); - } -} diff --git a/Mage.Sets/src/mage/cards/l/LivingPlane.java b/Mage.Sets/src/mage/cards/l/LivingPlane.java index d6b9f4ffca3..a35d681a0e0 100644 --- a/Mage.Sets/src/mage/cards/l/LivingPlane.java +++ b/Mage.Sets/src/mage/cards/l/LivingPlane.java @@ -40,6 +40,7 @@ import mage.constants.Zone; import mage.filter.StaticFilters; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; /** * @@ -52,7 +53,7 @@ public class LivingPlane extends CardImpl { this.addSuperType(SuperType.WORLD); // All lands are 1/1 creatures that are still lands. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new LivingPlaneToken(), "lands", StaticFilters.FILTER_LANDS, Duration.WhileOnBattlefield))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", StaticFilters.FILTER_LANDS, Duration.WhileOnBattlefield))); } public LivingPlane(final LivingPlane card) { @@ -64,20 +65,3 @@ public class LivingPlane extends CardImpl { return new LivingPlane(this); } } - -class LivingPlaneToken extends TokenImpl { - - public LivingPlaneToken() { - super("Land", "1/1 creatures"); - cardType.add(CardType.CREATURE); - power = new MageInt(1); - toughness = new MageInt(1); - } - public LivingPlaneToken(final LivingPlaneToken token) { - super(token); - } - - public LivingPlaneToken copy() { - return new LivingPlaneToken(this); - } -} diff --git a/Mage.Sets/src/mage/cards/n/NaturalAffinity.java b/Mage.Sets/src/mage/cards/n/NaturalAffinity.java index cfae01cb44c..1f021b3f9fc 100644 --- a/Mage.Sets/src/mage/cards/n/NaturalAffinity.java +++ b/Mage.Sets/src/mage/cards/n/NaturalAffinity.java @@ -31,17 +31,17 @@ import java.util.Iterator; import java.util.UUID; import mage.MageObjectReference; import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; +import mage.constants.*; +import mage.filter.StaticFilters; import mage.filter.common.FilterLandPermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.game.permanent.token.custom.CreatureToken; /** * @@ -53,7 +53,7 @@ public class NaturalAffinity extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}"); // All lands become 2/2 creatures until end of turn. They're still lands. - this.getSpellAbility().addEffect(new BecomesCreatureAllEffect()); + this.getSpellAbility().addEffect(new BecomesCreatureAllEffect(new CreatureToken(2, 2), "lands", StaticFilters.FILTER_LANDS, Duration.EndOfTurn)); } public NaturalAffinity(final NaturalAffinity card) { @@ -64,73 +64,4 @@ public class NaturalAffinity extends CardImpl { public NaturalAffinity copy() { return new NaturalAffinity(this); } -} - -class BecomesCreatureAllEffect extends ContinuousEffectImpl { - - public BecomesCreatureAllEffect() { - super(Duration.EndOfTurn, Outcome.BecomeCreature); - staticText = "All lands become 2/2 creatures until end of turn. They're still lands"; - } - - public BecomesCreatureAllEffect(final BecomesCreatureAllEffect effect) { - super(effect); - } - - @Override - public BecomesCreatureAllEffect copy() { - return new BecomesCreatureAllEffect(this); - } - - @Override - public void init(Ability source, Game game) { - super.init(source, game); - this.affectedObjectsSet = true; - for (Permanent perm : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) { - affectedObjectList.add(new MageObjectReference(perm, game)); - } - } - - @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - switch (layer) { - case TypeChangingEffects_4: - if (sublayer == SubLayer.NA) { - for (Iterator it = affectedObjectList.iterator(); it.hasNext();) { - Permanent permanent = it.next().getPermanent(game); - if (permanent != null) { - permanent.addCardType(CardType.CREATURE); - } else { - it.remove(); - } - } - } - break; - - case PTChangingEffects_7: - if (sublayer == SubLayer.SetPT_7b) { - for (Iterator it = affectedObjectList.iterator(); it.hasNext();) { - Permanent permanent = it.next().getPermanent(game); - if (permanent != null) { - permanent.getPower().setValue(2); - permanent.getToughness().setValue(2); - } else { - it.remove(); - } - } - } - } - return true; - } - - @Override - public boolean apply(Game game, Ability source) { - return false; - } - - @Override - public boolean hasLayer(Layer layer) { - return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4; - } - -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/n/NaturesRevolt.java b/Mage.Sets/src/mage/cards/n/NaturesRevolt.java index 3eef22208d4..a9445feb0a3 100644 --- a/Mage.Sets/src/mage/cards/n/NaturesRevolt.java +++ b/Mage.Sets/src/mage/cards/n/NaturesRevolt.java @@ -39,6 +39,7 @@ import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; /** * @@ -51,7 +52,7 @@ public class NaturesRevolt extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}{G}"); // All lands are 2/2 creatures that are still lands. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new NaturesRevoltToken(), + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new CreatureToken(2, 2), "lands", new FilterLandPermanent(), Duration.WhileOnBattlefield))); } @@ -63,21 +64,4 @@ public class NaturesRevolt extends CardImpl { public NaturesRevolt copy() { return new NaturesRevolt(this); } -} - -class NaturesRevoltToken extends TokenImpl { - - public NaturesRevoltToken() { - super("Land", "2/2 creatures"); - cardType.add(CardType.CREATURE); - power = new MageInt(2); - toughness = new MageInt(2); - } - public NaturesRevoltToken(final NaturesRevoltToken token) { - super(token); - } - - public NaturesRevoltToken copy() { - return new NaturesRevoltToken(this); - } -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/r/RudeAwakening.java b/Mage.Sets/src/mage/cards/r/RudeAwakening.java index e12cda24da0..1b21de2ffb4 100644 --- a/Mage.Sets/src/mage/cards/r/RudeAwakening.java +++ b/Mage.Sets/src/mage/cards/r/RudeAwakening.java @@ -40,6 +40,7 @@ import mage.constants.Duration; import mage.filter.common.FilterControlledLandPermanent; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; /** * @@ -57,7 +58,7 @@ public class RudeAwakening extends CardImpl { this.getSpellAbility().addEffect(new UntapAllLandsControllerEffect()); // or until end of turn, lands you control become 2/2 creatures that are still lands. Mode mode = new Mode(); - mode.getEffects().add(new BecomesCreatureAllEffect(new RudeAwakeningToken(), "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn)); + mode.getEffects().add(new BecomesCreatureAllEffect(new CreatureToken(2, 2), "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn)); this.getSpellAbility().getModes().addMode(mode); // Entwine {2}{G} @@ -72,22 +73,4 @@ public class RudeAwakening extends CardImpl { public RudeAwakening copy() { return new RudeAwakening(this); } -} - -class RudeAwakeningToken extends TokenImpl { - - public RudeAwakeningToken() { - super("", "2/2 creatures"); - cardType.add(CardType.CREATURE); - power = new MageInt(2); - toughness = new MageInt(2); - } - public RudeAwakeningToken(final RudeAwakeningToken token) { - super(token); - } - - public RudeAwakeningToken copy() { - return new RudeAwakeningToken(this); - } - -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/t/TezzeretsTouch.java b/Mage.Sets/src/mage/cards/t/TezzeretsTouch.java index 881cb3e90d9..14de72c7165 100644 --- a/Mage.Sets/src/mage/cards/t/TezzeretsTouch.java +++ b/Mage.Sets/src/mage/cards/t/TezzeretsTouch.java @@ -45,6 +45,7 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.TargetPermanent; import mage.target.common.TargetArtifactPermanent; @@ -67,9 +68,8 @@ public class TezzeretsTouch extends CardImpl { this.addAbility(ability); // Enchanted artifact is a creature with base power and toughness 5/5 in addition to its other types. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new BecomesCreatureAttachedEffect(new TezzeretsTouchToken(), - "Enchanted artifact is a creature with base power and toughness 5/5 in addition to its other types", Duration.WhileOnBattlefield))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect( + new CreatureToken(5, 5, "5/5 creature"),"Enchanted artifact is a creature with base power and toughness 5/5 in addition to its other types", Duration.WhileOnBattlefield))); // When enchanted artifact is put into a graveyard, return that card to its owner's hand. this.addAbility(new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted artifact", false, false)); @@ -83,21 +83,4 @@ public class TezzeretsTouch extends CardImpl { public TezzeretsTouch copy() { return new TezzeretsTouch(this); } -} - -class TezzeretsTouchToken extends TokenImpl { - - TezzeretsTouchToken() { - super("", "5/5"); - cardType.add(CardType.CREATURE); - power = new MageInt(5); - toughness = new MageInt(5); - } - public TezzeretsTouchToken(final TezzeretsTouchToken token) { - super(token); - } - - public TezzeretsTouchToken copy() { - return new TezzeretsTouchToken(this); - } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/t/TheloniteDruid.java b/Mage.Sets/src/mage/cards/t/TheloniteDruid.java index 3cd6579b7ee..01f8b0c052d 100644 --- a/Mage.Sets/src/mage/cards/t/TheloniteDruid.java +++ b/Mage.Sets/src/mage/cards/t/TheloniteDruid.java @@ -44,6 +44,7 @@ import mage.filter.common.FilterControlledLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -67,7 +68,7 @@ public class TheloniteDruid extends CardImpl { this.toughness = new MageInt(1); // {1}{G}, {tap}, Sacrifice a creature: Forests you control become 2/3 creatures until end of turn. They're still lands. - ContinuousEffect effect = new BecomesCreatureAllEffect(new TheloniteDruidLandToken(), "Forests", filter, Duration.EndOfTurn); + ContinuousEffect effect = new BecomesCreatureAllEffect(new CreatureToken(2, 3), "Forests", filter, Duration.EndOfTurn); effect.getDependencyTypes().add(DependencyType.BecomeForest); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, From 721f37c5ae681a580f5ae0d84a1bf5940a53c3c2 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 6 May 2018 19:47:00 +0400 Subject: [PATCH 4/4] * Summon the Pack - fixed that it gives black color to cards (#4905); --- Mage.Sets/src/mage/cards/s/SummonThePack.java | 2 +- .../BecomesBlackZombieAdditionEffect.java | 24 +++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SummonThePack.java b/Mage.Sets/src/mage/cards/s/SummonThePack.java index 445e3dc47d0..59b2edf00d5 100644 --- a/Mage.Sets/src/mage/cards/s/SummonThePack.java +++ b/Mage.Sets/src/mage/cards/s/SummonThePack.java @@ -115,7 +115,7 @@ class SummonThePackEffect extends OneShotEffect { message.append(c.getName()).append(" "); if (c != null && c.isCreature()) { message.append(" (creature card) "); - ContinuousEffect effect2 = new BecomesBlackZombieAdditionEffect(); + ContinuousEffect effect2 = new BecomesBlackZombieAdditionEffect(false); effect2.setTargetPointer(new FixedTarget(c.getId())); game.addEffect(effect2, source); creatureCards.add(c); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBlackZombieAdditionEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBlackZombieAdditionEffect.java index 488568c71ee..b4ade73721d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBlackZombieAdditionEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBlackZombieAdditionEffect.java @@ -38,13 +38,33 @@ import mage.game.permanent.Permanent; */ public class BecomesBlackZombieAdditionEffect extends ContinuousEffectImpl { + private boolean giveBlackColor = true; + public BecomesBlackZombieAdditionEffect() { super(Duration.Custom, Outcome.Neutral); - staticText = "That creature is a black Zombie in addition to its other colors and types"; + this.giveBlackColor = true; + updateText(); } + public BecomesBlackZombieAdditionEffect(boolean giveBlackColor) { + this(); + this.giveBlackColor = giveBlackColor; + updateText(); + } + + public BecomesBlackZombieAdditionEffect(final BecomesBlackZombieAdditionEffect effect) { super(effect); + this.giveBlackColor = effect.giveBlackColor; + updateText(); + } + + private void updateText() { + if (this.giveBlackColor) { + this.staticText = "That creature is a black Zombie in addition to its other colors and types"; + } else { + this.staticText = "That creature is a Zombie in addition to its other types"; + } } @Override @@ -73,7 +93,7 @@ public class BecomesBlackZombieAdditionEffect extends ContinuousEffectImpl { } break; case ColorChangingEffects_5: - if (sublayer == SubLayer.NA) { + if (sublayer == SubLayer.NA && this.giveBlackColor) { creature.getColor(game).setBlack(true); } break;