mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Refactored more subtypes usages to enum
This commit is contained in:
parent
92b999a9b4
commit
3cc178196e
29 changed files with 82 additions and 65 deletions
|
|
@ -30,6 +30,7 @@ package org.mage.test.cards.abilities.keywords;
|
|||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
|
@ -57,7 +58,7 @@ public class CrewTest extends CardTestPlayerBase {
|
|||
|
||||
assertTappedCount("Silvercoat Lion", true, 2);
|
||||
assertPowerToughness(playerA, "Cultivator's Caravan", 5, 5);
|
||||
assertType("Cultivator's Caravan", CardType.CREATURE, "Vehicle");
|
||||
assertType("Cultivator's Caravan", CardType.CREATURE, SubType.VEHICLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -78,7 +79,7 @@ public class CrewTest extends CardTestPlayerBase {
|
|||
assertTappedCount("Speedway Fanatic", true, 1);
|
||||
assertPowerToughness(playerA, "Smuggler's Copter", 3, 3);
|
||||
assertAbility(playerA, "Smuggler's Copter", HasteAbility.getInstance(), true);
|
||||
assertType("Smuggler's Copter", CardType.CREATURE, "Vehicle");
|
||||
assertType("Smuggler's Copter", CardType.CREATURE, SubType.VEHICLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ package org.mage.test.cards.continuous;
|
|||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
|
@ -57,7 +58,7 @@ public class BecomesCreatureTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerA, "Chimeric Mass", 1);
|
||||
assertPowerToughness(playerA, "Chimeric Mass", 3, 3);
|
||||
assertType("Chimeric Mass", CardType.CREATURE, "Construct");
|
||||
assertType("Chimeric Mass", CardType.CREATURE, SubType.CONSTRUCT);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ package org.mage.test.cards.continuous;
|
|||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
|
|
@ -69,7 +70,7 @@ public class DaxosTheReturnedTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Underworld Dreams", 2);
|
||||
assertCounterCount(playerA, CounterType.EXPERIENCE, 2);
|
||||
assertPowerToughness(playerA, "Spirit", 2, 2, Filter.ComparisonScope.All);
|
||||
assertType("Spirit", CardType.ENCHANTMENT, "Spirit");
|
||||
assertType("Spirit", CardType.ENCHANTMENT, SubType.SPIRIT);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerB, "Chromatic Lantern", 1);
|
||||
|
||||
assertType("Canopy Vista", CardType.LAND, "Mountain");
|
||||
assertType("Canopy Vista", CardType.LAND, SubType.MOUNTAIN);
|
||||
assertAbility(playerB, "Canopy Vista", new AnyColorManaAbility(), true);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerB, "Chromatic Lantern", 1);
|
||||
assertPermanentCount(playerA, "Magus of the Moon", 1);
|
||||
|
||||
assertType("Canopy Vista", CardType.LAND, "Mountain");
|
||||
assertType("Canopy Vista", CardType.LAND, SubType.MOUNTAIN);
|
||||
assertAbility(playerB, "Canopy Vista", new AnyColorManaAbility(), true);
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerB, "Forbidding Watchtower", 1);
|
||||
assertCounterCount("Forbidding Watchtower", CounterType.FLOOD, 1);
|
||||
assertType("Forbidding Watchtower", CardType.LAND, "Island");
|
||||
assertType("Forbidding Watchtower", CardType.LAND, SubType.ISLAND);
|
||||
assertPowerToughness(playerB, "Forbidding Watchtower", 1, 5);
|
||||
}
|
||||
|
||||
|
|
@ -164,11 +164,11 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerA, bloodmoon, 1);
|
||||
assertPermanentCount(playerA, urborgtoy, 1);
|
||||
assertType(canopyvista, CardType.LAND, "Mountain");
|
||||
assertNotSubtype(canopyvista, "Island");
|
||||
assertNotSubtype(canopyvista, "Swamp");
|
||||
assertType(urborgtoy, CardType.LAND, "Mountain");
|
||||
assertNotSubtype(urborgtoy, "Swamp");
|
||||
assertType(canopyvista, CardType.LAND, SubType.MOUNTAIN);
|
||||
assertNotSubtype(canopyvista, SubType.ISLAND);
|
||||
assertNotSubtype(canopyvista, SubType.SWAMP);
|
||||
assertType(urborgtoy, CardType.LAND, SubType.MOUNTAIN);
|
||||
assertNotSubtype(urborgtoy, SubType.SWAMP);
|
||||
Assert.assertTrue("The mana the land can produce should be [{R}] but it's " + playerB.getManaAvailable(currentGame).toString(), playerB.getManaAvailable(currentGame).toString().equals("[{R}]"));
|
||||
}
|
||||
|
||||
|
|
@ -197,11 +197,11 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerA, bloodmoon, 1);
|
||||
assertPermanentCount(playerA, urborgtoy, 1);
|
||||
assertType(canopyvista, CardType.LAND, "Mountain");
|
||||
assertNotSubtype(canopyvista, "Island");
|
||||
assertNotSubtype(canopyvista, "Swamp");
|
||||
assertType(urborgtoy, CardType.LAND, "Mountain");
|
||||
assertNotSubtype(urborgtoy, "Swamp");
|
||||
assertType(canopyvista, CardType.LAND, SubType.MOUNTAIN);
|
||||
assertNotSubtype(canopyvista, SubType.ISLAND);
|
||||
assertNotSubtype(canopyvista, SubType.SWAMP);
|
||||
assertType(urborgtoy, CardType.LAND, SubType.MOUNTAIN);
|
||||
assertNotSubtype(urborgtoy, SubType.SWAMP);
|
||||
Assert.assertTrue("The mana the land can produce should be [{R}] but it's " + playerB.getManaAvailable(currentGame).toString(), playerB.getManaAvailable(currentGame).toString().equals("[{R}]"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package org.mage.test.cards.continuous;
|
|||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
import org.junit.Ignore;
|
||||
|
|
@ -53,10 +54,10 @@ public class LayerTests extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertType("Urborg, Tomb of Yawgmoth", CardType.LAND, "Mountain"); // Urborg is a Mountain now
|
||||
assertType("Urborg, Tomb of Yawgmoth", CardType.LAND, SubType.MOUNTAIN); // Urborg is a Mountain now
|
||||
assertPermanentCount(playerA, "Swamp", 0); // no Swamp subtypes on the battlefield
|
||||
assertPermanentCount(playerA, "Plains", 1); // the Plains is not affected by the Urborg
|
||||
assertType("Plains", CardType.LAND, "Plains");
|
||||
assertType("Plains", CardType.LAND, SubType.PLAINS);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +112,7 @@ public class LayerTests extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertType("Urborg, Tomb of Yawgmoth", CardType.CREATURE, "Swamp"); // Urborg is a creature
|
||||
assertType("Urborg, Tomb of Yawgmoth", CardType.CREATURE, SubType.SWAMP); // Urborg is a creature
|
||||
assertPowerToughness(playerA, "Urborg, Tomb of Yawgmoth", 0, 1); // Urborg is a 0/1 creature
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import mage.abilities.keyword.LifelinkAbility;
|
|||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
import org.junit.Test;
|
||||
|
|
@ -58,8 +59,8 @@ public class WardenOfTheFirstTreeTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertPowerToughness(playerA, "Warden of the First Tree", 3, 3, Filter.ComparisonScope.Any);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Human");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Warrior");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.HUMAN);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.WARRIOR);
|
||||
assertAbility(playerA, "Warden of the First Tree", TrampleAbility.getInstance(), false);
|
||||
assertAbility(playerA, "Warden of the First Tree", LifelinkAbility.getInstance(), false);
|
||||
}
|
||||
|
|
@ -81,9 +82,9 @@ public class WardenOfTheFirstTreeTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertPowerToughness(playerA, "Warden of the First Tree", 3, 3, Filter.ComparisonScope.Any);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Human");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Spirit");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Warrior");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.HUMAN);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.SPIRIT);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.WARRIOR);
|
||||
assertAbility(playerA, "Warden of the First Tree", TrampleAbility.getInstance(), true);
|
||||
assertAbility(playerA, "Warden of the First Tree", LifelinkAbility.getInstance(), true);
|
||||
}
|
||||
|
|
@ -107,9 +108,9 @@ public class WardenOfTheFirstTreeTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertPowerToughness(playerA, "Warden of the First Tree", 8, 8, Filter.ComparisonScope.Any);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Human");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Spirit");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, "Warrior");
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.HUMAN);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.SPIRIT);
|
||||
assertType("Warden of the First Tree", CardType.CREATURE, SubType.WARRIOR);
|
||||
assertAbility(playerA, "Warden of the First Tree", TrampleAbility.getInstance(), true);
|
||||
assertAbility(playerA, "Warden of the First Tree", LifelinkAbility.getInstance(), true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ package org.mage.test.cards.enchantments;
|
|||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
|
@ -79,7 +80,7 @@ public class AnimateArtifactTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerA, "Juggernaut", 1);
|
||||
assertPermanentCount(playerA, "Animate Artifact", 1);
|
||||
assertType("Juggernaut", CardType.CREATURE, "Juggernaut");
|
||||
assertType("Juggernaut", CardType.CREATURE, SubType.JUGGERNAUT);
|
||||
assertPowerToughness(playerA, "Juggernaut", 5, 3);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
package org.mage.test.cards.enchantments;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
|
@ -95,7 +96,7 @@ public class SpreadingSeasTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spreading Seas", "Forest");
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertNotSubtype("Forest", "Forest");
|
||||
assertNotSubtype("Forest", SubType.FOREST);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,7 +108,7 @@ public class SpreadingSeasTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spreading Seas", "Urza's Tower");
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertNotSubtype("Urza's Tower", "Urza's");
|
||||
assertNotSubtype("Urza's Tower", "Tower");
|
||||
assertNotSubtype("Urza's Tower", SubType.URZAS);
|
||||
assertNotSubtype("Urza's Tower", SubType.TOWER);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.mage.test.cards.planeswalker;
|
|||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Test;
|
||||
|
|
@ -61,8 +62,8 @@ public class LilianaTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, wShepherd, 1);
|
||||
assertPermanentCount(playerB, yOx, 1);
|
||||
assertCounterCount(playerA, liliannaDM, CounterType.LOYALTY, 2);
|
||||
assertType(wShepherd, CardType.CREATURE, "Zombie"); // should have subtype zombie on top of angel type
|
||||
assertType(wShepherd, CardType.CREATURE, "Angel");
|
||||
assertType(wShepherd, CardType.CREATURE, SubType.ZOMBIE); // should have subtype zombie on top of angel type
|
||||
assertType(wShepherd, CardType.CREATURE, SubType.ANGEL);
|
||||
assertTapped(yOx, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.mage.test.cards.single;
|
|||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
import org.junit.Test;
|
||||
|
|
@ -42,7 +43,7 @@ public class WardenOfTheWallTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
assertPowerToughness(playerA, "Warden of the Wall", 2, 3, Filter.ComparisonScope.All);
|
||||
assertType("Warden of the Wall", CardType.CREATURE, "Gargoyle");
|
||||
assertType("Warden of the Wall", CardType.CREATURE, SubType.GARGOYLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class SoulSeparatorTest extends CardTestPlayerBase {
|
|||
|
||||
Permanent saToken = getPermanent("Sylvan Advocate", playerA);
|
||||
Assert.assertTrue(saToken.getAbilities().contains(FlyingAbility.getInstance()));
|
||||
Assert.assertTrue(saToken.getSubtype(currentGame).contains("Spirit"));
|
||||
Assert.assertTrue(saToken.getSubtype(currentGame).contains(SubType.SPIRIT));
|
||||
Assert.assertTrue(saToken.getAbilities().contains(VigilanceAbility.getInstance()));
|
||||
assertPowerToughness(playerA, "Sylvan Advocate", 1, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -700,11 +700,11 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param type A type to test for
|
||||
* @param subType a subtype to test for
|
||||
*/
|
||||
public void assertType(String cardName, CardType type, String subType) throws AssertionError {
|
||||
public void assertType(String cardName, CardType type, SubType subType) throws AssertionError {
|
||||
Permanent found = getPermanent(cardName);
|
||||
Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
||||
if (subType != null) {
|
||||
Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType));
|
||||
Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ':' + subType.getDescription() + ')', found.getSubtype(currentGame).contains(subType));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -725,10 +725,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param cardName Name of the permanent that should be checked.
|
||||
* @param subType a subtype to test for
|
||||
*/
|
||||
public void assertNotSubtype(String cardName, String subType) throws AssertionError {
|
||||
public void assertNotSubtype(String cardName, SubType subType) throws AssertionError {
|
||||
Permanent found = getPermanent(cardName);
|
||||
if (subType != null) {
|
||||
Assert.assertFalse("(Battlefield) card sub-type equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType));
|
||||
Assert.assertFalse("(Battlefield) card sub-type equal (" + cardName + ':' + subType.getDescription() + ')', found.getSubtype(currentGame).contains(subType));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue