From 92b999a9b444f60b625aa280c5f1103e010806ba Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 8 Sep 2017 10:26:03 -0400 Subject: [PATCH] Refactored more subtypes usages to enum --- Mage.Sets/src/mage/cards/a/AjanisChosen.java | 2 +- .../src/mage/cards/a/ArmamentMaster.java | 2 +- .../src/mage/cards/a/AuramancersGuise.java | 2 +- Mage.Sets/src/mage/cards/b/BartelRuneaxe.java | 2 +- Mage.Sets/src/mage/cards/b/BlastfireBolt.java | 3 +- .../src/mage/cards/b/BriarbridgePatrol.java | 2 +- .../src/mage/cards/c/CopyEnchantment.java | 3 +- .../src/mage/cards/c/CultivatorDrone.java | 2 +- .../src/mage/cards/c/CurseOfMisfortunes.java | 2 +- Mage.Sets/src/mage/cards/c/CurseOfThirst.java | 2 +- Mage.Sets/src/mage/cards/d/DaringSleuth.java | 2 +- .../src/mage/cards/d/DaybreakCoronet.java | 2 +- .../src/mage/cards/e/EmeriaShepherd.java | 2 +- .../src/mage/cards/e/EverflameEidolon.java | 2 +- .../src/mage/cards/f/FleetingMemories.java | 2 +- Mage.Sets/src/mage/cards/g/GaddockTeeg.java | 2 +- Mage.Sets/src/mage/cards/g/GoblinBrawler.java | 2 +- .../src/mage/cards/g/GoblinCharbelcher.java | 3 +- .../src/mage/cards/g/GolemSkinGauntlets.java | 2 +- Mage.Sets/src/mage/cards/g/GrafMole.java | 2 +- Mage.Sets/src/mage/cards/g/GuardianBeast.java | 2 +- .../src/mage/cards/g/GuulDrazOverseer.java | 2 +- .../mage/cards/h/HavenOfTheSpiritDragon.java | 2 +- Mage.Sets/src/mage/cards/j/Jokulmorder.java | 2 +- Mage.Sets/src/mage/cards/k/KarnLiberated.java | 4 +- Mage.Sets/src/mage/cards/k/KorDuelist.java | 2 +- .../src/mage/cards/l/LifecraftAwakening.java | 2 +- Mage.Sets/src/mage/cards/l/Lightsaber.java | 2 +- .../src/mage/cards/l/LilianasDefeat.java | 2 +- .../src/mage/cards/l/LostInTheWoods.java | 3 +- .../src/mage/cards/m/MarkOfEviction.java | 2 +- .../src/mage/cards/m/MurderousSpoils.java | 3 +- .../mage/cards/n/NecromancersMagemark.java | 2 +- Mage.Sets/src/mage/cards/o/OrzhovCharm.java | 3 +- .../src/mage/cards/p/PrecipiceOfMortis.java | 5 +- .../src/mage/cards/r/RosheenMeanderer.java | 4 +- .../src/mage/cards/s/SilenceTheBelievers.java | 3 +- Mage.Sets/src/mage/cards/s/SoulExchange.java | 3 +- .../src/mage/cards/s/StartYourEngines.java | 3 +- Mage.Sets/src/mage/cards/s/StreetSweeper.java | 2 +- Mage.Sets/src/mage/cards/t/Tallowisp.java | 2 +- Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java | 2 +- .../src/mage/cards/t/TirelessTracker.java | 2 +- Mage.Sets/src/mage/cards/t/TrainingDrone.java | 2 +- .../src/mage/cards/t/TreefolkMystic.java | 2 +- Mage.Sets/src/mage/cards/t/TurnToSlag.java | 3 +- .../src/mage/cards/u/UlvenwaldMysteries.java | 2 +- .../src/mage/cards/v/VoraciousDragon.java | 2 +- Mage.Sets/src/mage/cards/w/WitchbaneOrb.java | 3 +- .../test/cards/copy/IdentityThiefTest.java | 258 +++++++++--------- .../cards/copy/LazavDimirMastermindTest.java | 15 +- .../mage/test/cards/copy/MimicVatTest.java | 228 ++++++++-------- .../cards/copy/VolrathsShapshifterTest.java | 7 +- .../test/cards/enchantments/LignifyTest.java | 3 +- .../cards/single/emn/SoulSeparatorTest.java | 3 +- .../test/cards/triggers/FathomMageTest.java | 3 +- 56 files changed, 325 insertions(+), 308 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AjanisChosen.java b/Mage.Sets/src/mage/cards/a/AjanisChosen.java index fd837215daa..6fbd79e5c5d 100644 --- a/Mage.Sets/src/mage/cards/a/AjanisChosen.java +++ b/Mage.Sets/src/mage/cards/a/AjanisChosen.java @@ -95,7 +95,7 @@ class AjanisChosenEffect extends OneShotEffect { Token token = new CatToken(); if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) { Permanent enchantment = game.getPermanent(this.getTargetPointer().getFirst(game, source)); - if (enchantment != null && enchantment.getSubtype(game).contains("Aura")) { + if (enchantment != null && enchantment.getSubtype(game).contains(SubType.AURA)) { for (UUID tokenId : token.getLastAddedTokenIds()) { Permanent tokenPermanent = game.getPermanent(tokenId); if (tokenPermanent != null) { diff --git a/Mage.Sets/src/mage/cards/a/ArmamentMaster.java b/Mage.Sets/src/mage/cards/a/ArmamentMaster.java index 89cdd088235..9d4151670b0 100644 --- a/Mage.Sets/src/mage/cards/a/ArmamentMaster.java +++ b/Mage.Sets/src/mage/cards/a/ArmamentMaster.java @@ -116,7 +116,7 @@ class ArmamentMasterEffect extends ContinuousEffectImpl { List attachments = p.getAttachments(); for (UUID attachmentId : attachments) { Permanent attached = game.getPermanent(attachmentId); - if (attached != null && attached.getSubtype(game).contains("Equipment")) { + if (attached != null && attached.getSubtype(game).contains(SubType.EQUIPMENT)) { count++; } } diff --git a/Mage.Sets/src/mage/cards/a/AuramancersGuise.java b/Mage.Sets/src/mage/cards/a/AuramancersGuise.java index 2068346c598..fb9bc68a8ae 100644 --- a/Mage.Sets/src/mage/cards/a/AuramancersGuise.java +++ b/Mage.Sets/src/mage/cards/a/AuramancersGuise.java @@ -101,7 +101,7 @@ class EnchantedCreatureAurasCount implements DynamicValue { List attachments = permanent.getAttachments(); for (UUID attachmentId : attachments) { Permanent attached = game.getPermanent(attachmentId); - if (attached != null && attached.getSubtype(game).contains("Aura")) { + if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) { count++; } diff --git a/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java b/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java index 206787f6058..6db21c27a6f 100644 --- a/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java +++ b/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java @@ -109,7 +109,7 @@ class BartelRuneaxeEffect extends ContinuousRuleModifyingEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId()); if (stackObject != null && event.getTargetId().equals(source.getSourceId())) { - if (stackObject.getSubtype(game).contains("Aura")) { + if (stackObject.getSubtype(game).contains(SubType.AURA)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BlastfireBolt.java b/Mage.Sets/src/mage/cards/b/BlastfireBolt.java index 723e0243687..327a631c746 100644 --- a/Mage.Sets/src/mage/cards/b/BlastfireBolt.java +++ b/Mage.Sets/src/mage/cards/b/BlastfireBolt.java @@ -33,6 +33,7 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; @@ -94,7 +95,7 @@ class DestroyAllAttachedEquipmentEffect extends OneShotEffect { List attachments = new ArrayList<>(target.getAttachments()); for (UUID attachmentId : attachments) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && attachment.getSubtype(game).contains("Equipment")) { + if (attachment != null && attachment.getSubtype(game).contains(SubType.EQUIPMENT)) { attachment.destroy(source.getSourceId(), game, false); } } diff --git a/Mage.Sets/src/mage/cards/b/BriarbridgePatrol.java b/Mage.Sets/src/mage/cards/b/BriarbridgePatrol.java index 565cafc01ef..bd48a4c2fa0 100644 --- a/Mage.Sets/src/mage/cards/b/BriarbridgePatrol.java +++ b/Mage.Sets/src/mage/cards/b/BriarbridgePatrol.java @@ -88,7 +88,7 @@ enum BriarbridgePatrolCondition implements Condition { if (sacrificedPermanents != null && !sacrificedPermanents.isEmpty()) { int amountOfClues = 0; for (Permanent permanent : sacrificedPermanents) { - if (permanent.getSubtype(game).contains("Clue")) { + if (permanent.getSubtype(game).contains(SubType.CLUE)) { amountOfClues++; } } diff --git a/Mage.Sets/src/mage/cards/c/CopyEnchantment.java b/Mage.Sets/src/mage/cards/c/CopyEnchantment.java index 210deb016eb..24761d4680f 100644 --- a/Mage.Sets/src/mage/cards/c/CopyEnchantment.java +++ b/Mage.Sets/src/mage/cards/c/CopyEnchantment.java @@ -37,6 +37,7 @@ import mage.abilities.effects.common.CopyPermanentEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.filter.FilterPermanent; import mage.filter.common.FilterEnchantmentPermanent; @@ -87,7 +88,7 @@ class CopyEnchantmentEffect extends CopyPermanentEffect { if (super.apply(game, source)) { Permanent permanentToCopy = getBluePrintPermanent(); if (permanentToCopy != null) { - if (permanentToCopy.getSubtype(game).contains("Aura")) { + if (permanentToCopy.getSubtype(game).contains(SubType.AURA)) { Target target = getBluePrintPermanent().getSpellAbility().getTargets().get(0); Outcome auraOutcome = Outcome.BoostCreature; Ability: diff --git a/Mage.Sets/src/mage/cards/c/CultivatorDrone.java b/Mage.Sets/src/mage/cards/c/CultivatorDrone.java index a05b89470a3..568d13f0ea7 100644 --- a/Mage.Sets/src/mage/cards/c/CultivatorDrone.java +++ b/Mage.Sets/src/mage/cards/c/CultivatorDrone.java @@ -118,7 +118,7 @@ class CultivatorDroneManaCondition extends ManaCondition implements Condition { } } if (costToPay instanceof ManaCost) { - return ((ManaCost) costToPay).getText().contains("{C}"); + return ((ManaCost) costToPay).getText().contains(SubType.{C}); } return false; } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java b/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java index 4d128d2c0d1..12c2c2dd7fd 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfMisfortunes.java @@ -107,7 +107,7 @@ class CurseOfMisfortunesEffect extends OneShotEffect { // get the names of attached Curses for (UUID attachmentId: targetPlayer.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && attachment.getSubtype(game).contains("Curse")) { + if (attachment != null && attachment.getSubtype(game).contains(SubType.CURSE)) { filter.add(Predicates.not(new NamePredicate(attachment.getName()))); } } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfThirst.java b/Mage.Sets/src/mage/cards/c/CurseOfThirst.java index 81f1c82467b..7824f0e2ffc 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfThirst.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfThirst.java @@ -136,7 +136,7 @@ class CursesAttachedCount implements DynamicValue { if (player != null) { for (UUID attachmentId: player.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && attachment.getSubtype(game).contains("Curse")) + if (attachment != null && attachment.getSubtype(game).contains(SubType.CURSE)) count++; } } diff --git a/Mage.Sets/src/mage/cards/d/DaringSleuth.java b/Mage.Sets/src/mage/cards/d/DaringSleuth.java index ad8b247bb97..417ac40ae3c 100644 --- a/Mage.Sets/src/mage/cards/d/DaringSleuth.java +++ b/Mage.Sets/src/mage/cards/d/DaringSleuth.java @@ -96,7 +96,7 @@ class DaringSleuthTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { return event.getPlayerId().equals(this.getControllerId()) - && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains("Clue"); + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains(SubType.CLUE); } @Override diff --git a/Mage.Sets/src/mage/cards/d/DaybreakCoronet.java b/Mage.Sets/src/mage/cards/d/DaybreakCoronet.java index b9872301e90..e95b1b081f5 100644 --- a/Mage.Sets/src/mage/cards/d/DaybreakCoronet.java +++ b/Mage.Sets/src/mage/cards/d/DaybreakCoronet.java @@ -110,7 +110,7 @@ class AuraAttachedPredicate implements Predicate { if (!uuid.equals(ownId)) { Permanent attachment = game.getPermanent(uuid); if (attachment != null - && attachment.getSubtype(game).contains("Aura")) { + && attachment.getSubtype(game).contains(SubType.AURA)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/e/EmeriaShepherd.java b/Mage.Sets/src/mage/cards/e/EmeriaShepherd.java index b29bc60199c..c0867898a8f 100644 --- a/Mage.Sets/src/mage/cards/e/EmeriaShepherd.java +++ b/Mage.Sets/src/mage/cards/e/EmeriaShepherd.java @@ -109,7 +109,7 @@ class EmeriaShepherdReturnToHandTargetEffect extends OneShotEffect { return false; } Zone toZone = Zone.HAND; - if (triggeringLand.getSubtype(game).contains("Plains") + if (triggeringLand.getSubtype(game).contains(SubType.PLAINS) && controller.chooseUse(Outcome.PutCardInPlay, "Put the card to battlefield instead?", source, game)) { toZone = Zone.BATTLEFIELD; } diff --git a/Mage.Sets/src/mage/cards/e/EverflameEidolon.java b/Mage.Sets/src/mage/cards/e/EverflameEidolon.java index cebffdaf4cf..cd976d672e3 100644 --- a/Mage.Sets/src/mage/cards/e/EverflameEidolon.java +++ b/Mage.Sets/src/mage/cards/e/EverflameEidolon.java @@ -98,7 +98,7 @@ class EverflameEidolonEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceObject != null) { - if (sourceObject.getSubtype(game).contains("Aura")) { + if (sourceObject.getSubtype(game).contains(SubType.AURA)) { game.addEffect(new BoostEnchantedEffect(1, 0, Duration.EndOfTurn), source); } else { game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source); diff --git a/Mage.Sets/src/mage/cards/f/FleetingMemories.java b/Mage.Sets/src/mage/cards/f/FleetingMemories.java index e091defeeb3..c02a3e51e35 100644 --- a/Mage.Sets/src/mage/cards/f/FleetingMemories.java +++ b/Mage.Sets/src/mage/cards/f/FleetingMemories.java @@ -103,7 +103,7 @@ class FleetingMemoriesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { return event.getPlayerId().equals(this.getControllerId()) - && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains("Clue"); + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains(SubType.CLUE); } @Override diff --git a/Mage.Sets/src/mage/cards/g/GaddockTeeg.java b/Mage.Sets/src/mage/cards/g/GaddockTeeg.java index 5aeb4527399..2e3cc80183e 100644 --- a/Mage.Sets/src/mage/cards/g/GaddockTeeg.java +++ b/Mage.Sets/src/mage/cards/g/GaddockTeeg.java @@ -136,7 +136,7 @@ class GaddockTeegReplacementEffectX extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { Card card = game.getCard(event.getSourceId()); - if (card != null && !card.isCreature() && card.getManaCost().getText().contains("X")) { + if (card != null && !card.isCreature() && card.getManaCost().getText().contains(SubType.X)) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GoblinBrawler.java b/Mage.Sets/src/mage/cards/g/GoblinBrawler.java index 1e939ee4fc3..40ecab1bbe4 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinBrawler.java +++ b/Mage.Sets/src/mage/cards/g/GoblinBrawler.java @@ -99,7 +99,7 @@ class CantBeEquippedSourceEffect extends ContinuousRuleModifyingEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent != null && permanent.getSubtype(game).contains("Equipment")) { + if (permanent != null && permanent.getSubtype(game).contains(SubType.EQUIPMENT)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java b/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java index c8306018ddf..b2201c3a1f1 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java +++ b/Mage.Sets/src/mage/cards/g/GoblinCharbelcher.java @@ -36,6 +36,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.*; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; @@ -101,7 +102,7 @@ class GoblinCharbelcherEffect extends OneShotEffect { cards.add(card); if (card.isLand()){ landFound = true; - if(card.getSubtype(game).contains("Mountain")){ + if(card.getSubtype(game).contains(SubType.MOUNTAIN)){ isMountain = true; } break; diff --git a/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java b/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java index a4814fed05b..f640905ac1d 100644 --- a/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java +++ b/Mage.Sets/src/mage/cards/g/GolemSkinGauntlets.java @@ -91,7 +91,7 @@ class GolemSkinGauntletsAttachedCount implements DynamicValue { List attachments = permanent.getAttachments(); for (UUID attachmentId : attachments) { Permanent attached = game.getPermanent(attachmentId); - if (attached != null && attached.getSubtype(game).contains("Equipment")) { + if (attached != null && attached.getSubtype(game).contains(SubType.EQUIPMENT)) { count++; } } diff --git a/Mage.Sets/src/mage/cards/g/GrafMole.java b/Mage.Sets/src/mage/cards/g/GrafMole.java index aaf0b6e78bf..814cbd73a90 100644 --- a/Mage.Sets/src/mage/cards/g/GrafMole.java +++ b/Mage.Sets/src/mage/cards/g/GrafMole.java @@ -91,7 +91,7 @@ class GrafMoleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { return event.getPlayerId().equals(this.getControllerId()) - && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains("Clue"); + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains(SubType.CLUE); } @Override diff --git a/Mage.Sets/src/mage/cards/g/GuardianBeast.java b/Mage.Sets/src/mage/cards/g/GuardianBeast.java index 6039bb1e289..eb53911dbcf 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianBeast.java +++ b/Mage.Sets/src/mage/cards/g/GuardianBeast.java @@ -142,7 +142,7 @@ class GuardianBeastConditionalEffect extends ContinuousRuleModifyingEffectImpl { } StackObject spell = game.getStack().getStackObject(event.getSourceId()); - if (event.getType() == EventType.LOSE_CONTROL || event.getType() == EventType.ATTACH || event.getType() == EventType.TARGET && spell != null && spell.isEnchantment() && spell.getSubtype(game).contains("Aura")) { + if (event.getType() == EventType.LOSE_CONTROL || event.getType() == EventType.ATTACH || event.getType() == EventType.TARGET && spell != null && spell.isEnchantment() && spell.getSubtype(game).contains(SubType.AURA)) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (perm != null && Objects.equals(perm.getId(), targetPermanent.getId()) && !perm.isCreature()) { return true; diff --git a/Mage.Sets/src/mage/cards/g/GuulDrazOverseer.java b/Mage.Sets/src/mage/cards/g/GuulDrazOverseer.java index 405eabc139a..bb5a97d3d60 100644 --- a/Mage.Sets/src/mage/cards/g/GuulDrazOverseer.java +++ b/Mage.Sets/src/mage/cards/g/GuulDrazOverseer.java @@ -91,7 +91,7 @@ class GuulDrazOverseerEffect extends OneShotEffect { Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (controller != null && land != null) { int boost = 1; - if (land.getSubtype(game).contains("Swamp")) { + if (land.getSubtype(game).contains(SubType.SWAMP)) { boost = 2; } game.addEffect(new BoostControlledEffect(boost, 0, Duration.EndOfTurn, true), source); diff --git a/Mage.Sets/src/mage/cards/h/HavenOfTheSpiritDragon.java b/Mage.Sets/src/mage/cards/h/HavenOfTheSpiritDragon.java index d823b2c5038..b11cdc5e74a 100644 --- a/Mage.Sets/src/mage/cards/h/HavenOfTheSpiritDragon.java +++ b/Mage.Sets/src/mage/cards/h/HavenOfTheSpiritDragon.java @@ -158,7 +158,7 @@ class UginPlaneswalkerCardPredicate implements Predicate { @Override public boolean apply(Card input, Game game) { return input.isPlaneswalker() - && input.getName().contains("Ugin, the Spirit Dragon"); + && input.getName().contains(SubType.UGIN, THE SPIRIT DRAGON); } @Override diff --git a/Mage.Sets/src/mage/cards/j/Jokulmorder.java b/Mage.Sets/src/mage/cards/j/Jokulmorder.java index 6e026dabd04..3b7c1480069 100644 --- a/Mage.Sets/src/mage/cards/j/Jokulmorder.java +++ b/Mage.Sets/src/mage/cards/j/Jokulmorder.java @@ -110,7 +110,7 @@ class JokulmorderTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - return land.getSubtype(game).contains("Island") + return land.getSubtype(game).contains(SubType.ISLAND) && land.getControllerId().equals(this.controllerId); } diff --git a/Mage.Sets/src/mage/cards/k/KarnLiberated.java b/Mage.Sets/src/mage/cards/k/KarnLiberated.java index ee9b27751ae..8d474da8d6d 100644 --- a/Mage.Sets/src/mage/cards/k/KarnLiberated.java +++ b/Mage.Sets/src/mage/cards/k/KarnLiberated.java @@ -123,7 +123,7 @@ class KarnLiberatedEffect extends OneShotEffect { for (ExileZone zone : game.getExile().getExileZones()) { if (zone.getId().equals(exileId)) { for (Card card : zone.getCards(game)) { - if (!card.getSubtype(game).contains("Aura") && card.isPermanent()) { + if (!card.getSubtype(game).contains(SubType.AURA) && card.isPermanent()) { cards.add(card); } } @@ -155,7 +155,7 @@ class KarnLiberatedEffect extends OneShotEffect { } for (Card card : cards) { game.getState().setZone(card.getId(), Zone.EXILED); - if (card.isPermanent() && !card.getSubtype(game).contains("Aura")) { + if (card.isPermanent() && !card.getSubtype(game).contains(SubType.AURA)) { game.getExile().add(exileId, sourceObject.getIdName(), card); } } diff --git a/Mage.Sets/src/mage/cards/k/KorDuelist.java b/Mage.Sets/src/mage/cards/k/KorDuelist.java index 3f7442ddadd..5cbbcfead5c 100644 --- a/Mage.Sets/src/mage/cards/k/KorDuelist.java +++ b/Mage.Sets/src/mage/cards/k/KorDuelist.java @@ -84,7 +84,7 @@ class SourceIsEquiped implements Condition { for (UUID attachmentUUID : attachments) { Permanent attachment = game.getPermanent(attachmentUUID); if (attachment != null) { - if (attachment.getSubtype(game).contains("Equipment")) { + if (attachment.getSubtype(game).contains(SubType.EQUIPMENT)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/l/LifecraftAwakening.java b/Mage.Sets/src/mage/cards/l/LifecraftAwakening.java index 7d54e405fa4..63c9bf294c3 100644 --- a/Mage.Sets/src/mage/cards/l/LifecraftAwakening.java +++ b/Mage.Sets/src/mage/cards/l/LifecraftAwakening.java @@ -102,7 +102,7 @@ class LifecraftAwakeningEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) game.getPermanent(source.getTargets().getFirstTarget()); - if (!permanent.isCreature() && !permanent.getSubtype(game).contains("Vehicle")) { + if (!permanent.isCreature() && !permanent.getSubtype(game).contains(SubType.VEHICLE)) { ContinuousEffect continuousEffect = new BecomesCreatureTargetEffect(new LifecraftAwakeningToken(), false, true, Duration.Custom); continuousEffect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(continuousEffect, source); diff --git a/Mage.Sets/src/mage/cards/l/Lightsaber.java b/Mage.Sets/src/mage/cards/l/Lightsaber.java index 1a89830e60c..c820ad153b9 100644 --- a/Mage.Sets/src/mage/cards/l/Lightsaber.java +++ b/Mage.Sets/src/mage/cards/l/Lightsaber.java @@ -73,7 +73,7 @@ public class Lightsaber extends CardImpl { public void adjustCosts(Ability ability, Game game) { if (ability instanceof EquipAbility) { Permanent targetCreature = game.getPermanent(ability.getTargets().getFirstTarget()); - if (targetCreature != null && (targetCreature.getSubtype(game).contains("Sith") || targetCreature.getSubtype(game).contains("Jedi"))) { + if (targetCreature != null && (targetCreature.getSubtype(game).contains(SubType.SITH) || targetCreature.getSubtype(game).contains(SubType.JEDI))) { CardUtil.increaseCost(ability, 1 - ability.getManaCostsToPay().convertedManaCost()); } } diff --git a/Mage.Sets/src/mage/cards/l/LilianasDefeat.java b/Mage.Sets/src/mage/cards/l/LilianasDefeat.java index 81ba966a6ea..072a84ea987 100644 --- a/Mage.Sets/src/mage/cards/l/LilianasDefeat.java +++ b/Mage.Sets/src/mage/cards/l/LilianasDefeat.java @@ -93,7 +93,7 @@ class LilianasDefeatEffect extends OneShotEffect { if (player != null && permanent != null) { permanent.destroy(source.getSourceId(), game, true); game.applyEffects(); - if (permanent.isPlaneswalker() && permanent.getSubtype(game).contains(SubType.LILIANA.getDescription())) { + if (permanent.isPlaneswalker() && permanent.getSubtype(game).contains(SubType.LILIANA)) { Player permanentController = game.getPlayer(permanent.getControllerId()); if (permanentController != null) { permanentController.loseLife(3, game, false); diff --git a/Mage.Sets/src/mage/cards/l/LostInTheWoods.java b/Mage.Sets/src/mage/cards/l/LostInTheWoods.java index 4238c903bf4..e248d911dba 100644 --- a/Mage.Sets/src/mage/cards/l/LostInTheWoods.java +++ b/Mage.Sets/src/mage/cards/l/LostInTheWoods.java @@ -38,6 +38,7 @@ import mage.cards.CardSetInfo; import mage.cards.Cards; import mage.cards.CardsImpl; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.constants.SetTargetPointer; import mage.constants.Zone; @@ -94,7 +95,7 @@ class LostInTheWoodsEffect extends OneShotEffect { controller.revealCards(sourceObject.getName(), cards, game); if (card != null) { - if (card.getSubtype(game).contains("Forest")) { + if (card.getSubtype(game).contains(SubType.FOREST)) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { permanent.removeFromCombat(game); diff --git a/Mage.Sets/src/mage/cards/m/MarkOfEviction.java b/Mage.Sets/src/mage/cards/m/MarkOfEviction.java index e7a87d816f7..335f8b2d78a 100644 --- a/Mage.Sets/src/mage/cards/m/MarkOfEviction.java +++ b/Mage.Sets/src/mage/cards/m/MarkOfEviction.java @@ -108,7 +108,7 @@ class MarkOfEvictionEffect extends OneShotEffect { toHand.add(enchanted); for (UUID attachmentId : enchanted.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && attachment.getSubtype(game).contains("Aura")) { + if (attachment != null && attachment.getSubtype(game).contains(SubType.AURA)) { toHand.add(attachment); } } diff --git a/Mage.Sets/src/mage/cards/m/MurderousSpoils.java b/Mage.Sets/src/mage/cards/m/MurderousSpoils.java index 327cfe9d6d3..c8f15e89491 100644 --- a/Mage.Sets/src/mage/cards/m/MurderousSpoils.java +++ b/Mage.Sets/src/mage/cards/m/MurderousSpoils.java @@ -38,6 +38,7 @@ import mage.abilities.effects.common.continuous.GainControlTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Outcome; import mage.filter.common.FilterCreaturePermanent; @@ -97,7 +98,7 @@ class MurderousSpoilsEffect extends OneShotEffect { List attachments = new ArrayList<>(); for (UUID uuid : target.getAttachments()) { Permanent attached = game.getBattlefield().getPermanent(uuid); - if (attached.getSubtype(game).contains("Equipment")) { + if (attached.getSubtype(game).contains(SubType.EQUIPMENT)) { attachments.add(attached); } } diff --git a/Mage.Sets/src/mage/cards/n/NecromancersMagemark.java b/Mage.Sets/src/mage/cards/n/NecromancersMagemark.java index a68f36a0398..3bc661f5e2b 100644 --- a/Mage.Sets/src/mage/cards/n/NecromancersMagemark.java +++ b/Mage.Sets/src/mage/cards/n/NecromancersMagemark.java @@ -142,7 +142,7 @@ class NecromancersMagemarkEffect extends ReplacementEffectImpl { if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { for (UUID attachmentId : permanent.getAttachments()) { Permanent attachment = game.getPermanentOrLKIBattlefield(attachmentId); - if (attachment != null && attachment.getSubtype(game).contains("Aura")) { + if (attachment != null && attachment.getSubtype(game).contains(SubType.AURA)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/o/OrzhovCharm.java b/Mage.Sets/src/mage/cards/o/OrzhovCharm.java index 4d8cda77cf4..512a8098e56 100644 --- a/Mage.Sets/src/mage/cards/o/OrzhovCharm.java +++ b/Mage.Sets/src/mage/cards/o/OrzhovCharm.java @@ -36,6 +36,7 @@ import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffec import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.ComparisonType; import mage.constants.Outcome; import mage.constants.Zone; @@ -118,7 +119,7 @@ class OrzhovCharmReturnToHandEffect extends OneShotEffect { for (UUID attachmentId : attachments) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.getControllerId().equals(source.getControllerId()) - && attachment.getSubtype(game).contains("Aura")) { + && attachment.getSubtype(game).contains(SubType.AURA)) { attachment.moveToZone(Zone.HAND, source.getSourceId(), game, false); } } diff --git a/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java b/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java index c9ab7e0e8d7..a595c4d194d 100644 --- a/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java +++ b/Mage.Sets/src/mage/cards/p/PrecipiceOfMortis.java @@ -34,6 +34,7 @@ import mage.abilities.effects.ReplacementEffectImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; @@ -100,7 +101,7 @@ class PrecipiceOfMortisEffect extends ReplacementEffectImpl { if (sourceEvent.getType() == EventType.ENTERS_THE_BATTLEFIELD && sourceEvent instanceof EntersTheBattlefieldEvent) { EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) sourceEvent; // Only for entering Jedis - if (entersTheBattlefieldEvent.getTarget().getSubtype(game).contains("Jedi")) { + if (entersTheBattlefieldEvent.getTarget().getSubtype(game).contains(SubType.JEDI)) { // Only for triggers of permanents if (game.getPermanent(numberOfTriggersEvent.getSourceId()) != null) { return true; @@ -112,7 +113,7 @@ class PrecipiceOfMortisEffect extends ReplacementEffectImpl { ZoneChangeEvent leavesTheBattlefieldEvent = (ZoneChangeEvent) sourceEvent; if (leavesTheBattlefieldEvent.getFromZone() == Zone.BATTLEFIELD) { // Only for leaving Jedis - if (leavesTheBattlefieldEvent.getTarget().getSubtype(game).contains("Jedi")) { + if (leavesTheBattlefieldEvent.getTarget().getSubtype(game).contains(SubType.JEDI)) { // Only for triggers of permanents if (game.getPermanent(numberOfTriggersEvent.getSourceId()) != null) { return true; diff --git a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java index 42989c8f5a9..4eb01cbf132 100644 --- a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java +++ b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java @@ -106,10 +106,10 @@ class RosheenMeandererManaCondition implements Condition { if (AbilityType.SPELL == source.getAbilityType()) { MageObject object = game.getObject(source.getSourceId()); return object != null - && object.getManaCost().getText().contains("X"); + && object.getManaCost().getText().contains(SubType.X); } else { - return source.getManaCosts().getText().contains("X"); + return source.getManaCosts().getText().contains(SubType.X); } } } diff --git a/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java b/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java index 6ec74cc10a9..d67051f38cb 100644 --- a/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java +++ b/Mage.Sets/src/mage/cards/s/SilenceTheBelievers.java @@ -33,6 +33,7 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; @@ -100,7 +101,7 @@ class SilenceTheBelieversExileEffect extends OneShotEffect { List attachments = new ArrayList<>(creature.getAttachments()); for (UUID attachmentId: attachments) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && attachment.getSubtype(game).contains("Aura")) { + if (attachment != null && attachment.getSubtype(game).contains(SubType.AURA)) { controller.moveCardToExileWithInfo(attachment, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); } } diff --git a/Mage.Sets/src/mage/cards/s/SoulExchange.java b/Mage.Sets/src/mage/cards/s/SoulExchange.java index 5544de14447..08f28b85876 100644 --- a/Mage.Sets/src/mage/cards/s/SoulExchange.java +++ b/Mage.Sets/src/mage/cards/s/SoulExchange.java @@ -36,6 +36,7 @@ import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffec import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.counters.CounterType; import mage.filter.common.FilterCreatureCard; @@ -100,7 +101,7 @@ class SoulExchangeEffect extends OneShotEffect{ if (c.isPaid() && c instanceof ExileTargetCost) { for (Permanent exiled : ((ExileTargetCost) c).getPermanents()) { if (exiled != null){ - if(exiled.getSubtype(game).contains("Thrull")){ + if(exiled.getSubtype(game).contains(SubType.THRULL)){ game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/s/StartYourEngines.java b/Mage.Sets/src/mage/cards/s/StartYourEngines.java index d7232d26c69..631bb9eb514 100644 --- a/Mage.Sets/src/mage/cards/s/StartYourEngines.java +++ b/Mage.Sets/src/mage/cards/s/StartYourEngines.java @@ -35,6 +35,7 @@ import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Layer; import mage.constants.Outcome; @@ -89,7 +90,7 @@ class StartYourEnginesEffect extends ContinuousEffectImpl { @Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { - if (permanent != null && permanent.getSubtype(game).contains("Vehicle")) { + if (permanent != null && permanent.getSubtype(game).contains(SubType.VEHICLE)) { if (sublayer == SubLayer.NA) { permanent.addCardType(CardType.ARTIFACT); permanent.addCardType(CardType.CREATURE);// TODO: Chcek if giving CREATURE Type is correct diff --git a/Mage.Sets/src/mage/cards/s/StreetSweeper.java b/Mage.Sets/src/mage/cards/s/StreetSweeper.java index eb9e03d46c1..55d0237f945 100644 --- a/Mage.Sets/src/mage/cards/s/StreetSweeper.java +++ b/Mage.Sets/src/mage/cards/s/StreetSweeper.java @@ -108,7 +108,7 @@ class StreetSweeperDestroyEffect extends OneShotEffect { for(UUID uuid : attachments) { Permanent aura = game.getPermanent(uuid); - if(aura != null && aura.getSubtype(game).contains("Aura")) + if(aura != null && aura.getSubtype(game).contains(SubType.AURA)) { aura.destroy(source.getSourceId(), game, false); } diff --git a/Mage.Sets/src/mage/cards/t/Tallowisp.java b/Mage.Sets/src/mage/cards/t/Tallowisp.java index 497400e4175..657262e079b 100644 --- a/Mage.Sets/src/mage/cards/t/Tallowisp.java +++ b/Mage.Sets/src/mage/cards/t/Tallowisp.java @@ -93,7 +93,7 @@ class TallowispAbilityPredicate implements Predicate { for (int i = 0; i < abilities.size(); i++) { if (abilities.get(i) instanceof EnchantAbility) { String enchantText = abilities.get(i).getRule(); - if (enchantText.startsWith("Enchant") && enchantText.contains("creature")) { + if (enchantText.startsWith(SubType.ENCHANT) && enchantText.contains(creature)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java b/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java index 422467e9b2e..c8db2f395a0 100644 --- a/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java +++ b/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java @@ -129,7 +129,7 @@ class TetsuoUmezawaEffect extends ContinuousRuleModifyingEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId()); if (stackObject != null && event.getTargetId().equals(source.getSourceId())) { - if (stackObject.getSubtype(game).contains("Aura")) { + if (stackObject.getSubtype(game).contains(SubType.AURA)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/t/TirelessTracker.java b/Mage.Sets/src/mage/cards/t/TirelessTracker.java index 8cb54bfba58..790f2081e0a 100644 --- a/Mage.Sets/src/mage/cards/t/TirelessTracker.java +++ b/Mage.Sets/src/mage/cards/t/TirelessTracker.java @@ -106,7 +106,7 @@ class TirelessTrackerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { return event.getPlayerId().equals(this.getControllerId()) - && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains("Clue"); + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains(SubType.CLUE); } @Override diff --git a/Mage.Sets/src/mage/cards/t/TrainingDrone.java b/Mage.Sets/src/mage/cards/t/TrainingDrone.java index 1eba6e00b84..930d3cc932a 100644 --- a/Mage.Sets/src/mage/cards/t/TrainingDrone.java +++ b/Mage.Sets/src/mage/cards/t/TrainingDrone.java @@ -86,7 +86,7 @@ class TrainingDroneEffect extends RestrictionEffect { List attachments = permanent.getAttachments(); for (UUID uuid : attachments) { Permanent attached = game.getBattlefield().getPermanent(uuid); - if (attached.getSubtype(game).contains("Equipment")) { + if (attached.getSubtype(game).contains(SubType.EQUIPMENT)) { return false; } } diff --git a/Mage.Sets/src/mage/cards/t/TreefolkMystic.java b/Mage.Sets/src/mage/cards/t/TreefolkMystic.java index 9efeedb5b31..e1b40c9020a 100644 --- a/Mage.Sets/src/mage/cards/t/TreefolkMystic.java +++ b/Mage.Sets/src/mage/cards/t/TreefolkMystic.java @@ -92,7 +92,7 @@ class TreefolkMysticEffect extends OneShotEffect { attachments.addAll(permanent.getAttachments()); for (UUID uuid : attachments) { Permanent aura = game.getPermanent(uuid); - if (aura != null && aura.getSubtype(game).contains("Aura")) { + if (aura != null && aura.getSubtype(game).contains(SubType.AURA)) { aura.destroy(source.getSourceId(), game, false); } } diff --git a/Mage.Sets/src/mage/cards/t/TurnToSlag.java b/Mage.Sets/src/mage/cards/t/TurnToSlag.java index 6ba23721b39..baa52c6d217 100644 --- a/Mage.Sets/src/mage/cards/t/TurnToSlag.java +++ b/Mage.Sets/src/mage/cards/t/TurnToSlag.java @@ -36,6 +36,7 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; @@ -82,7 +83,7 @@ class TurnToSlagEffect extends OneShotEffect { List attachments = new ArrayList<>(); for (UUID uuid : target.getAttachments()) { Permanent attached = game.getBattlefield().getPermanent(uuid); - if (attached.getSubtype(game).contains("Equipment")) { + if (attached.getSubtype(game).contains(SubType.EQUIPMENT)) { attachments.add(attached); } } diff --git a/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java b/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java index a18776a2ff5..cdfaacb3746 100644 --- a/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java +++ b/Mage.Sets/src/mage/cards/u/UlvenwaldMysteries.java @@ -108,7 +108,7 @@ class UlvenwaldMysteriesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { return event.getPlayerId().equals(this.getControllerId()) - && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains("Clue"); + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype(game).contains(SubType.CLUE); } @Override diff --git a/Mage.Sets/src/mage/cards/v/VoraciousDragon.java b/Mage.Sets/src/mage/cards/v/VoraciousDragon.java index 9560a449961..aac4d5491ec 100644 --- a/Mage.Sets/src/mage/cards/v/VoraciousDragon.java +++ b/Mage.Sets/src/mage/cards/v/VoraciousDragon.java @@ -96,7 +96,7 @@ class TwiceDevouredGoblins implements DynamicValue { DevourEffect devourEffect = (DevourEffect) abilityEffect; int amountGoblins = 0; for (List subtypesItem :devourEffect.getSubtypes(game, sourcePermanent.getId())) { - if (subtypesItem.contains("Goblin")) { + if (subtypesItem.contains(SubType.GOBLIN)) { ++amountGoblins; } } diff --git a/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java b/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java index 2eeb027bb3e..ecd73bbb804 100644 --- a/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java +++ b/Mage.Sets/src/mage/cards/w/WitchbaneOrb.java @@ -36,6 +36,7 @@ import mage.abilities.keyword.HexproofAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; @@ -91,7 +92,7 @@ class WitchbaneOrbEffect extends OneShotEffect { List toDestroy = new ArrayList<>(); for (UUID attachmentId : controller.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && attachment.getSubtype(game).contains("Curse")) { + if (attachment != null && attachment.getSubtype(game).contains(SubType.CURSE)) { toDestroy.add(attachment); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/IdentityThiefTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/IdentityThiefTest.java index 9c148eb1159..7cbddace353 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/IdentityThiefTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/IdentityThiefTest.java @@ -1,129 +1,129 @@ -/* - * 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.copy; - -import mage.constants.PhaseStep; -import mage.constants.Zone; -import mage.counters.CounterType; -import org.junit.Test; -import org.mage.test.serverside.base.CardTestPlayerBase; - -/** - * - * @author LevelX2 - */ -public class IdentityThiefTest extends CardTestPlayerBase { - - /** - * This is probably a narrow case of a wider problem base. Identity Thief - * copied Molten Sentry and died immediately (should have been either a 5/2 - * or a 2/5, whatever the original Molten Sentry was). - */ - @Test - public void testCopyCreature() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); - // As Molten Sentry enters the battlefield, flip a coin. If the coin comes up heads, Molten Sentry enters the battlefield as a 5/2 creature with haste. - // If it comes up tails, Molten Sentry enters the battlefield as a 2/5 creature with defender. - addCard(Zone.HAND, playerA, "Molten Sentry"); // {3}{R} - - // Whenever Identity Thief attacks, you may exile another target nontoken creature. - // If you do, Identity Thief becomes a copy of that creature until end of turn. - // Return the exiled card to the battlefield under its owner's control at the beginning of the next end step. - addCard(Zone.BATTLEFIELD, playerB, "Identity Thief"); // {2}{U}{U} - - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Molten Sentry"); - - attack(2, playerB, "Identity Thief"); - addTarget(playerB, "Molten Sentry"); - - setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); - execute(); - - assertExileCount(playerA, 1); - assertExileCount("Molten Sentry", 1); - - assertPermanentCount(playerB, "Identity Thief", 0); - assertPermanentCount(playerB, "Molten Sentry", 1); - } - - @Test - public void testCopyPrimalClay() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); - // As Primal Clay enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types. - addCard(Zone.HAND, playerA, "Primal Clay"); // {4} - - // Whenever Identity Thief attacks, you may exile another target nontoken creature. - // If you do, Identity Thief becomes a copy of that creature until end of turn. - // Return the exiled card to the battlefield under its owner's control at the beginning of the next end step. - addCard(Zone.BATTLEFIELD, playerB, "Identity Thief"); // {2}{U}{U} - - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Primal Clay"); - - attack(2, playerB, "Identity Thief"); - addTarget(playerB, "Primal Clay"); - - setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); - execute(); - - assertExileCount(playerA, 1); - assertExileCount("Primal Clay", 1); - - assertPermanentCount(playerB, "Identity Thief", 0); - assertPermanentCount(playerB, "Primal Clay", 1); - } - - @Test - public void testShouldNotCopyP1P1Counters() { - addCard(Zone.BATTLEFIELD, playerA, "Sylvan Advocate", 1); // {1}{G} 2/3 vigilance - addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); - addCard(Zone.HAND, playerA, "Battlegrowth"); // {G} instant - Put a +1/+1 counter on target creature. - - // Whenever Identity Thief attacks, you may exile another target nontoken creature. - // If you do, Identity Thief becomes a copy of that creature until end of turn. - // Return the exiled card to the battlefield under its owner's control at the beginning of the next end step. - addCard(Zone.BATTLEFIELD, playerB, "Identity Thief"); // {2}{U}{U} - - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Battlegrowth"); - addTarget(playerA, "Sylvan Advocate"); - - attack(2, playerB, "Identity Thief"); - addTarget(playerB, "Sylvan Advocate"); - - setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); - execute(); - - assertExileCount(playerA, 1); - assertExileCount("Sylvan Advocate", 1); - - assertGraveyardCount(playerA, "Battlegrowth", 1); - assertPermanentCount(playerB, "Identity Thief", 0); - assertPermanentCount(playerB, "Sylvan Advocate", 1); - assertCounterCount(playerB, "Sylvan Advocate", CounterType.P1P1, 0); - assertPowerToughness(playerB, "Sylvan Advocate", 2, 3); // finds it with 3 power 4 toughness - } -} +/* + * 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.copy; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class IdentityThiefTest extends CardTestPlayerBase { + + /** + * This is probably a narrow case of a wider problem base. Identity Thief + * copied Molten Sentry and died immediately (should have been either a 5/2 + * or a 2/5, whatever the original Molten Sentry was). + */ + @Test + public void testCopyCreature() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + // As Molten Sentry enters the battlefield, flip a coin. If the coin comes up heads, Molten Sentry enters the battlefield as a 5/2 creature with haste. + // If it comes up tails, Molten Sentry enters the battlefield as a 2/5 creature with defender. + addCard(Zone.HAND, playerA, "Molten Sentry"); // {3}{R} + + // Whenever Identity Thief attacks, you may exile another target nontoken creature. + // If you do, Identity Thief becomes a copy of that creature until end of turn. + // Return the exiled card to the battlefield under its owner's control at the beginning of the next end step. + addCard(Zone.BATTLEFIELD, playerB, "Identity Thief"); // {2}{U}{U} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Molten Sentry"); + + attack(2, playerB, "Identity Thief"); + addTarget(playerB, "Molten Sentry"); + + setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertExileCount(playerA, 1); + assertExileCount("Molten Sentry", 1); + + assertPermanentCount(playerB, "Identity Thief", 0); + assertPermanentCount(playerB, "Molten Sentry", 1); + } + + @Test + public void testCopyPrimalClay() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + // As Primal Clay enters the battlefield, it becomes your choice of a 3/3 artifact creature, a 2/2 artifact creature with flying, or a 1/6 Wall artifact creature with defender in addition to its other types. + addCard(Zone.HAND, playerA, "Primal Clay"); // {4} + + // Whenever Identity Thief attacks, you may exile another target nontoken creature. + // If you do, Identity Thief becomes a copy of that creature until end of turn. + // Return the exiled card to the battlefield under its owner's control at the beginning of the next end step. + addCard(Zone.BATTLEFIELD, playerB, "Identity Thief"); // {2}{U}{U} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Primal Clay"); + + attack(2, playerB, "Identity Thief"); + addTarget(playerB, "Primal Clay"); + + setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertExileCount(playerA, 1); + assertExileCount("Primal Clay", 1); + + assertPermanentCount(playerB, "Identity Thief", 0); + assertPermanentCount(playerB, "Primal Clay", 1); + } + + @Test + public void testShouldNotCopyP1P1Counters() { + addCard(Zone.BATTLEFIELD, playerA, "Sylvan Advocate", 1); // {1}{G} 2/3 vigilance + addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); + addCard(Zone.HAND, playerA, "Battlegrowth"); // {G} instant - Put a +1/+1 counter on target creature. + + // Whenever Identity Thief attacks, you may exile another target nontoken creature. + // If you do, Identity Thief becomes a copy of that creature until end of turn. + // Return the exiled card to the battlefield under its owner's control at the beginning of the next end step. + addCard(Zone.BATTLEFIELD, playerB, "Identity Thief"); // {2}{U}{U} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Battlegrowth"); + addTarget(playerA, "Sylvan Advocate"); + + attack(2, playerB, "Identity Thief"); + addTarget(playerB, "Sylvan Advocate"); + + setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertExileCount(playerA, 1); + assertExileCount("Sylvan Advocate", 1); + + assertGraveyardCount(playerA, "Battlegrowth", 1); + assertPermanentCount(playerB, "Identity Thief", 0); + assertPermanentCount(playerB, "Sylvan Advocate", 1); + assertCounterCount(playerB, "Sylvan Advocate", CounterType.P1P1, 0); + assertPowerToughness(playerB, "Sylvan Advocate", 2, 3); // finds it with 3 power 4 toughness + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/LazavDimirMastermindTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/LazavDimirMastermindTest.java index 9586b31992f..6d0c8f05191 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/LazavDimirMastermindTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/LazavDimirMastermindTest.java @@ -1,6 +1,7 @@ package org.mage.test.cards.copy; import mage.abilities.keyword.DeathtouchAbility; +import mage.constants.SubType; import mage.abilities.keyword.FlyingAbility; import mage.constants.PhaseStep; import mage.constants.Zone; @@ -48,7 +49,7 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Lazav, Dimir Mastermind", 3, 2); Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId()); - Assert.assertTrue(lazav.getSubtype(currentGame).contains("Griffin")); + Assert.assertTrue(lazav.getSubtype(currentGame).contains(SubType.GRIFFIN)); Assert.assertTrue("Lazav, Dimir Mastermind must have flying",lazav.getAbilities().contains(FlyingAbility.getInstance())); } @@ -74,8 +75,8 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Lazav, Dimir Mastermind", 1); assertPowerToughness(playerA, "Lazav, Dimir Mastermind", 3, 3); Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId()); - Assert.assertTrue(lazav.getSubtype(currentGame).contains("Ogre")); - Assert.assertTrue(lazav.getSubtype(currentGame).contains("Rogue")); + Assert.assertTrue(lazav.getSubtype(currentGame).contains(SubType.OGRE)); + Assert.assertTrue(lazav.getSubtype(currentGame).contains(SubType.ROGUE)); Permanent gutterSkulk = getPermanent("Gutter Skulk", playerA.getId()); Assert.assertTrue("Gutter Skulk should have deathtouch but hasn't", gutterSkulk.getAbilities().contains(DeathtouchAbility.getInstance())); @@ -116,7 +117,7 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase { Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId()); Assert.assertTrue(lazav.getAbilities().contains(FlyingAbility.getInstance())); - Assert.assertTrue(lazav.getSubtype(currentGame).contains("Specter")); + Assert.assertTrue(lazav.getSubtype(currentGame).contains(SubType.SPECTER)); Assert.assertTrue(lazav.isLegendary()); assertPermanentCount(playerA, "Silvercoat Lion", 1); @@ -146,7 +147,7 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Lazav, Dimir Mastermind", 2, 2); Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId()); - Assert.assertTrue(lazav.getSubtype(currentGame).contains("Cat")); + Assert.assertTrue(lazav.getSubtype(currentGame).contains(SubType.CAT)); Assert.assertTrue(lazav.isLegendary()); } @@ -190,7 +191,7 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Lazav, Dimir Mastermind", 1); assertPowerToughness(playerA, "Lazav, Dimir Mastermind", 3, 3); Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId()); - Assert.assertFalse(lazav.getSubtype(currentGame).contains("Griffin")); // no Griffin type + Assert.assertFalse(lazav.getSubtype(currentGame).contains(SubType.GRIFFIN)); // no Griffin type Assert.assertFalse("Lazav, Dimir Mastermind must have flying",lazav.getAbilities().contains(FlyingAbility.getInstance())); @@ -226,7 +227,7 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Lazav, Dimir Mastermind", 3, 2); Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId()); - Assert.assertTrue(lazav.getSubtype(currentGame).contains("Griffin")); + Assert.assertTrue(lazav.getSubtype(currentGame).contains(SubType.GRIFFIN)); Assert.assertTrue("Lazav, Dimir Mastermind must have flying",lazav.getAbilities().contains(FlyingAbility.getInstance())); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/MimicVatTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/MimicVatTest.java index ca5ab2ebfd9..9004e3a81aa 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/MimicVatTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/MimicVatTest.java @@ -1,114 +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.copy; - -import mage.constants.PhaseStep; -import mage.constants.Zone; -import org.junit.Test; -import org.mage.test.serverside.base.CardTestPlayerBase; - -/** - * - * @author LevelX2 - */ -public class MimicVatTest extends CardTestPlayerBase { - - /** - * All the clone type cards that may enter as a copy of something don't work - * correctly with Mimic Vat. The only one I found that works (the token - * being able to clone something) is Phyrexian Metamorph. Phyrexian - * Metamorph is implemented differently than the rest of similar functioning - * cards, ie. Clone, Phantasmal Image, Body Double, Clever Impersonator. - * Also The copy ability on Phyrexian Metamorph is optional but it is forced - * in game - */ - @Test - public void TestClone() { - addCard(Zone.BATTLEFIELD, playerA, "Island", 6); - // Imprint - Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with Mimic Vat to its owner's graveyard. - // {3}, {T}: Create a tokenonto the battlefield that's a copy of the exiled card. It gains haste. Exile it at the beginning of the next end step. - addCard(Zone.BATTLEFIELD, playerA, "Mimic Vat", 1); // Artifact {3} - // {2}, {T}, Sacrifice a creature: Draw a card. - addCard(Zone.BATTLEFIELD, playerA, "Phyrexian Vault", 1); - - // You may have Clone enter the battlefield as a copy of any creature on the battlefield. - addCard(Zone.HAND, playerA, "Clone", 1);// Creature {3}{U} - - addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); - - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clone"); - setChoice(playerA, "Silvercoat Lion"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}, Sacrifice a creature"); - setChoice(playerA, "Yes"); - - activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{3},{T}: Create a token"); - setChoice(playerA, "Silvercoat Lion"); - - setStopAt(3, PhaseStep.BEGIN_COMBAT); - execute(); - - assertExileCount("Clone", 1); - assertPermanentCount(playerB, "Silvercoat Lion", 1); - assertPermanentCount(playerA, "Silvercoat Lion", 1); - - } - - @Test - public void TestPhyrexianMetamorph() { - addCard(Zone.BATTLEFIELD, playerA, "Island", 6); - // Imprint - Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with Mimic Vat to its owner's graveyard. - // {3}, {T}: Create a token that's a copy of a card exiled with Mimic Vat. It gains haste. Exile it at the beginning of the next end step. - addCard(Zone.BATTLEFIELD, playerA, "Mimic Vat", 1); // Artifact {3} - // {2}, {T}, Sacrifice a creature: Draw a card. - addCard(Zone.BATTLEFIELD, playerA, "Phyrexian Vault", 1); - - // You may have Phyrexian Metamorph enter the battlefield as a copy of any artifact or creature on the battlefield, except it's an artifact in addition to its other types. - addCard(Zone.HAND, playerA, "Phyrexian Metamorph", 1);// Creature {3}{U/P} - - addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); - - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phyrexian Metamorph"); - setChoice(playerA, "Yes"); - setChoice(playerA, "Silvercoat Lion"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}, Sacrifice a creature"); - setChoice(playerA, "Yes"); - - activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{3},{T}: Create a token that's a copy of a card exiled with "); - setChoice(playerA, "Yes"); - setChoice(playerA, "Silvercoat Lion"); - - setStopAt(3, PhaseStep.BEGIN_COMBAT); - execute(); - - assertExileCount("Phyrexian Metamorph", 1); - assertPermanentCount(playerB, "Silvercoat Lion", 1); - assertPermanentCount(playerA, "Silvercoat Lion", 1); - - } - -} +/* + * 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.copy; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class MimicVatTest extends CardTestPlayerBase { + + /** + * All the clone type cards that may enter as a copy of something don't work + * correctly with Mimic Vat. The only one I found that works (the token + * being able to clone something) is Phyrexian Metamorph. Phyrexian + * Metamorph is implemented differently than the rest of similar functioning + * cards, ie. Clone, Phantasmal Image, Body Double, Clever Impersonator. + * Also The copy ability on Phyrexian Metamorph is optional but it is forced + * in game + */ + @Test + public void TestClone() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 6); + // Imprint - Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with Mimic Vat to its owner's graveyard. + // {3}, {T}: Create a tokenonto the battlefield that's a copy of the exiled card. It gains haste. Exile it at the beginning of the next end step. + addCard(Zone.BATTLEFIELD, playerA, "Mimic Vat", 1); // Artifact {3} + // {2}, {T}, Sacrifice a creature: Draw a card. + addCard(Zone.BATTLEFIELD, playerA, "Phyrexian Vault", 1); + + // You may have Clone enter the battlefield as a copy of any creature on the battlefield. + addCard(Zone.HAND, playerA, "Clone", 1);// Creature {3}{U} + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clone"); + setChoice(playerA, "Silvercoat Lion"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}, Sacrifice a creature"); + setChoice(playerA, "Yes"); + + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{3},{T}: Create a token"); + setChoice(playerA, "Silvercoat Lion"); + + setStopAt(3, PhaseStep.BEGIN_COMBAT); + execute(); + + assertExileCount("Clone", 1); + assertPermanentCount(playerB, "Silvercoat Lion", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 1); + + } + + @Test + public void TestPhyrexianMetamorph() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 6); + // Imprint - Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with Mimic Vat to its owner's graveyard. + // {3}, {T}: Create a token that's a copy of a card exiled with Mimic Vat. It gains haste. Exile it at the beginning of the next end step. + addCard(Zone.BATTLEFIELD, playerA, "Mimic Vat", 1); // Artifact {3} + // {2}, {T}, Sacrifice a creature: Draw a card. + addCard(Zone.BATTLEFIELD, playerA, "Phyrexian Vault", 1); + + // You may have Phyrexian Metamorph enter the battlefield as a copy of any artifact or creature on the battlefield, except it's an artifact in addition to its other types. + addCard(Zone.HAND, playerA, "Phyrexian Metamorph", 1);// Creature {3}{U/P} + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phyrexian Metamorph"); + setChoice(playerA, "Yes"); + setChoice(playerA, "Silvercoat Lion"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}, Sacrifice a creature"); + setChoice(playerA, "Yes"); + + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{3},{T}: Create a token that's a copy of a card exiled with "); + setChoice(playerA, "Yes"); + setChoice(playerA, "Silvercoat Lion"); + + setStopAt(3, PhaseStep.BEGIN_COMBAT); + execute(); + + assertExileCount("Phyrexian Metamorph", 1); + assertPermanentCount(playerB, "Silvercoat Lion", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 1); + + } + +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VolrathsShapshifterTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VolrathsShapshifterTest.java index 72e517ed034..0bd4bc3f916 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VolrathsShapshifterTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VolrathsShapshifterTest.java @@ -1,6 +1,7 @@ package org.mage.test.cards.copy; import mage.abilities.Ability; +import mage.constants.SubType; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.discard.DiscardControllerEffect; @@ -43,7 +44,7 @@ public class VolrathsShapshifterTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Assault Griffin", 3, 2); Permanent shapeshifter = getPermanent("Assault Griffin", playerA.getId()); - Assert.assertTrue(shapeshifter.getSubtype(currentGame).contains("Griffin")); + Assert.assertTrue(shapeshifter.getSubtype(currentGame).contains(SubType.GRIFFIN)); Assert.assertTrue("Volrath's Shapeshifter must have flying", shapeshifter.getAbilities().contains(FlyingAbility.getInstance())); Assert.assertTrue("Volrath's Shapeshifter must have {2} : Discard a card", hasShapeshiftersOriginalAbility(shapeshifter)); } @@ -73,7 +74,7 @@ public class VolrathsShapshifterTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Volrath's Shapeshifter", 0, 1); Permanent shapeshifter = getPermanent("Volrath's Shapeshifter", playerA.getId()); - Assert.assertTrue(shapeshifter.getSubtype(currentGame).contains("Shapeshifter")); + Assert.assertTrue(shapeshifter.getSubtype(currentGame).contains(SubType.SHAPESHIFTER)); Assert.assertTrue("Volrath's Shapeshifter must have {2} : Discard a card", hasShapeshiftersOriginalAbility(shapeshifter)); } @@ -100,7 +101,7 @@ public class VolrathsShapshifterTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Dutiful Thrull", 1, 1); Permanent shapeshifter = getPermanent("Dutiful Thrull", playerA.getId()); - Assert.assertTrue(shapeshifter.getSubtype(currentGame).contains("Thrull")); + Assert.assertTrue(shapeshifter.getSubtype(currentGame).contains(SubType.THRULL)); Assert.assertTrue("Volrath's Shapeshifter must have {2} : Discard a card", hasShapeshiftersOriginalAbility(shapeshifter)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/LignifyTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/LignifyTest.java index 483c3a6bc0a..342991774ae 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/LignifyTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/LignifyTest.java @@ -29,6 +29,7 @@ package org.mage.test.cards.enchantments; import mage.abilities.keyword.IndestructibleAbility; import mage.constants.PhaseStep; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.permanent.Permanent; import org.junit.Assert; @@ -70,7 +71,7 @@ public class LignifyTest extends CardTestPlayerBase { Permanent hivelord = getPermanent("Sliver Hivelord", playerB); - Assert.assertFalse("Sliver Hivelord may not be of subtype Sliver", hivelord.getSubtype(currentGame).contains("Sliver")); + Assert.assertFalse("Sliver Hivelord may not be of subtype Sliver", hivelord.getSubtype(currentGame).contains(SubType.SLIVER)); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java index 5ab20b8a430..8d48a5c9755 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java @@ -4,6 +4,7 @@ import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.VigilanceAbility; import mage.constants.PhaseStep; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.permanent.Permanent; import org.junit.Assert; @@ -76,7 +77,7 @@ public class SoulSeparatorTest extends CardTestPlayerBase { Permanent treeToken = getPermanent("Tree of Perdition", playerA); Assert.assertTrue(treeToken.getAbilities().contains(FlyingAbility.getInstance())); - Assert.assertTrue(treeToken.getSubtype(currentGame).contains("Spirit")); + Assert.assertTrue(treeToken.getSubtype(currentGame).contains(SubType.SPIRIT)); Assert.assertTrue(treeToken.getAbilities().contains(DefenderAbility.getInstance())); assertLife(playerA, 20); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java index c9191ff2554..99a884487b4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java @@ -1,6 +1,7 @@ package org.mage.test.cards.triggers; import mage.constants.PhaseStep; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.permanent.Permanent; import org.junit.Assert; @@ -60,7 +61,7 @@ public class FathomMageTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Fathom Mage", 3, 3); Permanent fathomMage = getPermanent("Fathom Mage", playerA); - Assert.assertEquals("Fathom Mage has to be a Mutant", true, fathomMage.getSubtype(currentGame).contains("Mutant")); + Assert.assertEquals("Fathom Mage has to be a Mutant", true, fathomMage.getSubtype(currentGame).contains(SubType.MUTANT)); assertHandCount(playerA, 2); }