diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java index f44e232307..1215ba09d2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java @@ -209,8 +209,8 @@ public class TransformTest extends CardTestPlayerBase { assertGraveyardCount(playerA, "Startled Awake", 0); assertPermanentCount(playerA, "Persistent Nightmare", 1); // Night-side card of Startled Awake Permanent nightmare = getPermanent("Persistent Nightmare", playerA); - Assert.assertTrue("Has to have creature card type", nightmare.getCardType().contains(CardType.CREATURE)); - Assert.assertFalse("Has not to have sorcery card type", nightmare.getCardType().contains(CardType.SORCERY)); + Assert.assertTrue("Has to have creature card type", nightmare.isCreature()); + Assert.assertFalse("Has not to have sorcery card type", nightmare.isSorcery()); } /** diff --git a/Mage/src/main/java/mage/MageObject.java b/Mage/src/main/java/mage/MageObject.java index be1c2045a4..1bdbd40c95 100644 --- a/Mage/src/main/java/mage/MageObject.java +++ b/Mage/src/main/java/mage/MageObject.java @@ -82,4 +82,34 @@ public interface MageObject extends MageItem, Serializable { void setZoneChangeCounter(int value, Game game); + + + default boolean isCreature(){ + return getCardType().contains(CardType.CREATURE); + } + + default boolean isArtifact(){ + return getCardType().contains(CardType.ARTIFACT); + } + + default boolean isLand(){ + return getCardType().contains(CardType.LAND); + } + + default boolean isEnchantment(){ + return getCardType().contains(CardType.ENCHANTMENT); + } + + default boolean isInstant(){ + return getCardType().contains(CardType.INSTANT); + } + + default boolean isSorcery(){ + return getCardType().contains(CardType.SORCERY); + } + + default boolean isPlaneswalker(){ + return getCardType().contains(CardType.PLANESWALKER); + } + } diff --git a/Mage/src/main/java/mage/MageObjectImpl.java b/Mage/src/main/java/mage/MageObjectImpl.java index 46e0dc5505..a6331f5972 100644 --- a/Mage/src/main/java/mage/MageObjectImpl.java +++ b/Mage/src/main/java/mage/MageObjectImpl.java @@ -183,7 +183,7 @@ public abstract class MageObjectImpl implements MageObject { public ObjectColor getFrameColor(Game game) { // For lands, add any colors of mana the land can produce to // its frame colors. - if (getCardType().contains(CardType.LAND)) { + if (this.isLand()) { ObjectColor cl = frameColor.copy(); for (Ability ab: getAbilities()) { if (ab instanceof ActivatedManaAbilityImpl) { diff --git a/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java b/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java index 4836e8b0a5..0acfd45616 100644 --- a/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java +++ b/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java @@ -71,7 +71,7 @@ public class ConstellationAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.ENCHANTMENT)) { + if (permanent != null && permanent.isEnchantment()) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java index a9e054850c..b7dc86a895 100644 --- a/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/AttacksAllTriggeredAbility.java @@ -93,7 +93,7 @@ public class AttacksAllTriggeredAbility extends TriggeredAbilityImpl { check = true; } else { Permanent planeswalker = game.getPermanent(event.getTargetId()); - if (planeswalker != null && planeswalker.getCardType().contains(CardType.PLANESWALKER) && planeswalker.getControllerId().equals(getControllerId())) { + if (planeswalker != null && planeswalker.isPlaneswalker() && planeswalker.getControllerId().equals(getControllerId())) { check = true; } } diff --git a/Mage/src/main/java/mage/abilities/common/DealtDamageAndDiedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealtDamageAndDiedTriggeredAbility.java index 1f85c92c0e..9bb5f4458e 100644 --- a/Mage/src/main/java/mage/abilities/common/DealtDamageAndDiedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DealtDamageAndDiedTriggeredAbility.java @@ -38,7 +38,7 @@ public class DealtDamageAndDiedTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (((ZoneChangeEvent)event).isDiesEvent()) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getTarget().getCardType().contains(CardType.CREATURE)) { + if (zEvent.getTarget().isCreature()) { boolean damageDealt = false; for (MageObjectReference mor : zEvent.getTarget().getDealtDamageByThisTurn()) { if (mor.refersTo(getSourceObject(game), game)) { diff --git a/Mage/src/main/java/mage/abilities/common/FeralDeceiverAbility.java b/Mage/src/main/java/mage/abilities/common/FeralDeceiverAbility.java index 7258b908e3..49c73bb613 100644 --- a/Mage/src/main/java/mage/abilities/common/FeralDeceiverAbility.java +++ b/Mage/src/main/java/mage/abilities/common/FeralDeceiverAbility.java @@ -36,7 +36,7 @@ public class FeralDeceiverAbility extends LimitedTimesPerTurnActivatedAbility { Card card = player.getLibrary().getFromTop(game); cards.add(card); player.revealCards("Feral Deceiver", cards, game); - if (card != null && card.getCardType().contains(CardType.LAND)) { + if (card != null && card.isLand()) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/common/LandfallAbility.java b/Mage/src/main/java/mage/abilities/common/LandfallAbility.java index 646f3f8462..4fbcbe5ffc 100644 --- a/Mage/src/main/java/mage/abilities/common/LandfallAbility.java +++ b/Mage/src/main/java/mage/abilities/common/LandfallAbility.java @@ -74,7 +74,7 @@ public class LandfallAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null - && permanent.getCardType().contains(CardType.LAND) + && permanent.isLand() && permanent.getControllerId().equals(this.controllerId)) { triggeringLand = permanent; if (setTargetPointer == SetTargetPointer.PERMANENT) { diff --git a/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredAbility.java index de58312226..f46aac825d 100644 --- a/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredAbility.java @@ -62,7 +62,7 @@ public class TapLandForManaAllTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { + if (permanent != null && permanent.isLand()) { if (setTargetPointer) { getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); } diff --git a/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java index a24f512d3d..6de0cf8a90 100644 --- a/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java @@ -63,7 +63,7 @@ public class TapLandForManaAllTriggeredManaAbility extends TriggeredManaAbility @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { + if (permanent != null && permanent.isLand()) { if (setTargetPointer) { getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); } diff --git a/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java b/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java index 133fb9c3b0..e405cb7b06 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/EnchantedSourceCondition.java @@ -57,7 +57,7 @@ public class EnchantedSourceCondition implements Condition { if (permanent != null) { for (UUID uuid : permanent.getAttachments()) { Permanent attached = game.getBattlefield().getPermanent(uuid); - if (attached != null && attached.getCardType().contains(CardType.ENCHANTMENT)) { + if (attached != null && attached.isEnchantment()) { if (++numberOfFoundEnchantments >= numberOfEnchantments) { return true; } diff --git a/Mage/src/main/java/mage/abilities/condition/common/EnchantedTargetCondition.java b/Mage/src/main/java/mage/abilities/condition/common/EnchantedTargetCondition.java index b13814fb35..ef1e957f5c 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/EnchantedTargetCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/EnchantedTargetCondition.java @@ -28,7 +28,7 @@ public class EnchantedTargetCondition implements Condition { if (targetPermanent != null) { for (UUID uuid : targetPermanent.getAttachments()) { Permanent attached = game.getBattlefield().getPermanent(uuid); - if (attached != null && attached.getCardType().contains(CardType.ENCHANTMENT)) { + if (attached != null && attached.isEnchantment()) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceIsSpellCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceIsSpellCondition.java index 8e2dd64b54..42d964d1ef 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceIsSpellCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceIsSpellCondition.java @@ -49,6 +49,6 @@ public class SourceIsSpellCondition implements Condition { @Override public boolean apply(Game game, Ability source) { MageObject object = game.getObject(source.getSourceId()); - return object != null && !object.getCardType().contains(CardType.LAND); + return object != null && !object.isLand(); } } diff --git a/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java index 1e9a9d5356..a78287dcda 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java @@ -39,39 +39,34 @@ import mage.players.Player; */ public class TopLibraryCardTypeCondition implements Condition { - public static enum CheckType { + public enum CheckType { CREATURE, LAND, SORCERY, INSTANT } - private TopLibraryCardTypeCondition.CheckType type; + private CheckType type; - public TopLibraryCardTypeCondition(TopLibraryCardTypeCondition.CheckType type) { + public TopLibraryCardTypeCondition(CheckType type) { this.type = type; } @Override public boolean apply(Game game, Ability source) { - boolean conditionApplies = false; Player controller = game.getPlayer(source.getControllerId()); if (controller != null && controller.getLibrary().size() > 0) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { switch (this.type) { case CREATURE: - conditionApplies |= card.getCardType().contains(CardType.CREATURE); - break; + return card.isCreature(); case LAND: - conditionApplies |= card.getCardType().contains(CardType.LAND); - break; + return card.isLand(); case SORCERY: - conditionApplies |= card.getCardType().contains(CardType.SORCERY); - break; + return card.isSorcery(); case INSTANT: - conditionApplies |= card.getCardType().contains(CardType.INSTANT); - break; + return card.isInstant(); } } } - return conditionApplies; + return false; } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java index 3781f3e4ed..2af8d31efc 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java @@ -48,7 +48,7 @@ public class ExileTopCreatureCardOfGraveyardCost extends CostImpl { if(controller != null) { Card topCard = null; for (Card card :controller.getGraveyard().getCards(game)) { - if (card.getCardType().contains(CardType.CREATURE)) { + if (card.isCreature()) { topCard = card; } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/DomainValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/DomainValue.java index fc597b9fca..9b878e57a5 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/DomainValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/DomainValue.java @@ -61,7 +61,7 @@ public class DomainValue implements DynamicValue { targetPlayer = sourceAbility.getControllerId(); } for (Permanent p : game.getBattlefield().getAllActivePermanents(targetPlayer)) { - if (p.getCardType().contains(CardType.LAND)) { + if (p.isLand()) { if (havePlains == 0 && p.getSubtype(game).contains("Plains")) { havePlains = 1; } @@ -98,6 +98,6 @@ public class DomainValue implements DynamicValue { @Override public String getMessage() { - return "basic land type among lands " + (countTargetPlayer ? "he or she controls" : "you control"); + return "basic land type among lands " + (countTargetPlayer ? "he or she controls" : "you control"); } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java index 4903c8e82f..cbb533f2ae 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java @@ -68,7 +68,7 @@ public class ParleyCount implements DynamicValue, MageSingleton { if (player != null) { Card card = player.getLibrary().getFromTop(game); if (card != null) { - if (!card.getCardType().contains(CardType.LAND)) { + if (!card.isLand()) { parleyValue++; } player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', new CardsImpl(card), game); diff --git a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java index 0916c4f730..f7e5db45a0 100644 --- a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java @@ -208,11 +208,11 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD && (((ZoneChangeEvent) event).getFromZone() != Zone.STACK)) { Card card = game.getCard(event.getTargetId()); - if (card != null && (card.getCardType().contains(CardType.ENCHANTMENT) && card.hasSubtype("Aura", game) + if (card != null && (card.isEnchantment() && card.hasSubtype("Aura", game) || // in case of transformable enchantments (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null && card.getSecondCardFace() != null - && card.getSecondCardFace().getCardType().contains(CardType.ENCHANTMENT) + && card.getSecondCardFace().isEnchantment() && card.getSecondCardFace().hasSubtype("Aura", game)))) { return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java index 4c58bf38f5..da8a815b3a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageEachOtherEffect.java @@ -66,8 +66,8 @@ public class DamageEachOtherEffect extends OneShotEffect { } if (sourceCreature != null && targetCreature != null - && sourceCreature.getCardType().contains(CardType.CREATURE) - && targetCreature.getCardType().contains(CardType.CREATURE)) { + && sourceCreature.isCreature() + && targetCreature.isCreature()) { targetCreature.damage(sourceCreature.getPower().getValue(), sourceCreature.getId(), game, false, true); if (sourceOnBattlefield) { sourceCreature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game, false, true); diff --git a/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java index f4830ac460..0f1ca827f6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/FightTargetSourceEffect.java @@ -59,7 +59,7 @@ public class FightTargetSourceEffect extends OneShotEffect { Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget()); // 20110930 - 701.10 if (creature1 != null && sourcePermanent != null) { - if (creature1.getCardType().contains(CardType.CREATURE) && sourcePermanent.getCardType().contains(CardType.CREATURE)) { + if (creature1.isCreature() && sourcePermanent.isCreature()) { return sourcePermanent.fight(creature1, source, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java index b955cb2eba..1cf4b86d38 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/FightTargetsEffect.java @@ -65,7 +65,7 @@ public class FightTargetsEffect extends OneShotEffect { Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget()); // 20110930 - 701.10 if (creature1 != null && creature2 != null) { - if (creature1.getCardType().contains(CardType.CREATURE) && creature2.getCardType().contains(CardType.CREATURE)) { + if (creature1.isCreature() && creature2.isCreature()) { return creature1.fight(creature2, source, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/HideawayPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/HideawayPlayEffect.java index 98eeeb1231..986711813a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/HideawayPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/HideawayPlayEffect.java @@ -76,7 +76,7 @@ public class HideawayPlayEffect extends OneShotEffect { * If the removed card is a land, you may play it as a result of the last ability only if it's your turn * and you haven't already played a land that turn. This counts as your land play for the turn. */ - if (card.getCardType().contains(CardType.LAND)) { + if (card.isLand()) { UUID playerId = controller.getId(); if (!game.getActivePlayerId().equals(playerId) || !game.getPlayer(playerId).canPlayLand()) { return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageByTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageByTargetEffect.java index 5d047321a7..e26affa441 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageByTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageByTargetEffect.java @@ -73,7 +73,7 @@ public class PreventDamageByTargetEffect extends PreventionEffectImpl { if (!this.used && super.applies(event, source, game)) { MageObject mageObject = game.getObject(event.getSourceId()); if (mageObject != null - && (mageObject.getCardType().contains(CardType.INSTANT) || mageObject.getCardType().contains(CardType.SORCERY))) { + && (mageObject.isInstant() || mageObject.isSorcery())) { for (Target target : source.getTargets()) { if (target instanceof TargetSpell) { if (((TargetSpell) target).getSourceIds().contains(event.getSourceId())) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealTopLandToBattlefieldElseHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealTopLandToBattlefieldElseHandEffect.java index a3cfd54854..8da3ce2be0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealTopLandToBattlefieldElseHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealTopLandToBattlefieldElseHandEffect.java @@ -42,7 +42,7 @@ public class RevealTopLandToBattlefieldElseHandEffect extends OneShotEffect { } cards.add(card); controller.revealCards(sourceObject.getName(), cards, game); - if (card.getCardType().contains(CardType.LAND)) { + if (card.isLand()) { return controller.moveCards(card, Zone.BATTLEFIELD, source, game); } else { controller.moveCards(card, Zone.HAND, source, game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/UntapAllThatAttackedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UntapAllThatAttackedEffect.java index 512addc459..3500e73a8a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/UntapAllThatAttackedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/UntapAllThatAttackedEffect.java @@ -68,7 +68,7 @@ public class UntapAllThatAttackedEffect extends OneShotEffect { Set attackedThisTurn = ((AttackedThisTurnWatcher) watcher).getAttackedThisTurnCreatures(); for (UUID uuid : attackedThisTurn) { Permanent permanent = game.getPermanent(uuid); - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { + if (permanent != null && permanent.isCreature()) { permanent.untap(game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouUnlessPayManaAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouUnlessPayManaAllEffect.java index 77b776eca4..49eec36456 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouUnlessPayManaAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackYouUnlessPayManaAllEffect.java @@ -90,7 +90,7 @@ public class CantAttackYouUnlessPayManaAllEffect extends PayCostToAttackBlockEff if (payAlsoForAttackingPlaneswalker) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null - && permanent.getCardType().contains(CardType.PLANESWALKER) + && permanent.isPlaneswalker() && permanent.getControllerId().equals(source.getControllerId())) { return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index ef525ea505..dd1fbc9c6f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -144,7 +144,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: // Attention: Cards like Unstable Frontier that use this class do not give the "Basic" supertype to the target - if (!land.getCardType().contains(CardType.LAND)) { + if (!land.isLand()) { land.getCardType().add(CardType.LAND); } if (loseOther) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index 2464a08497..8e0c19724e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -120,7 +120,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements } } } - if (type != null && type.isEmpty() || type == null && permanent.getCardType().contains(CardType.LAND)) { + if (type != null && type.isEmpty() || type == null && permanent.isLand()) { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); } if (!token.getSubtype(game).isEmpty()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java index 6b8eaed477..f1a6aca4dd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java @@ -101,7 +101,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl { int affectedTargets = 0; for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent target = game.getPermanent(permanentId); - if (target != null && target.getCardType().contains(CardType.CREATURE)) { + if (target != null && target.isCreature()) { target.addPower(power.calculate(game, source, this)); target.addToughness(toughness.calculate(game, source, this)); affectedTargets++; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java index 8c16384dff..0f7ed64790 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java @@ -78,7 +78,7 @@ public class PlayTheTopCardEffect extends AsThoughEffectImpl { if (cardOnTop != null && affectedControllerId.equals(source.getControllerId()) && cardOnTop.getOwnerId().equals(source.getControllerId()) - && (!cardOnTop.getManaCost().isEmpty() || cardOnTop.getCardType().contains(CardType.LAND)) + && (!cardOnTop.getManaCost().isEmpty() || cardOnTop.isLand()) && filter.match(cardOnTop, game)) { Player player = game.getPlayer(cardOnTop.getOwnerId()); if (player != null && cardOnTop.equals(player.getLibrary().getFromTop(game))) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java b/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java index 8eab9e6896..dc716b5026 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java +++ b/Mage/src/main/java/mage/abilities/effects/common/replacement/DealtDamageToCreatureBySourceDies.java @@ -50,7 +50,7 @@ public class DealtDamageToCreatureBySourceDies extends ReplacementEffectImpl { public DealtDamageToCreatureBySourceDies(Card card, Duration duration) { super(duration, Outcome.Exile); - if (card.getCardType().contains(CardType.CREATURE)) { + if (card.isCreature()) { staticText = "If a creature dealt damage by {this} this turn would die, exile it instead"; } else { staticText = "If a creature dealt damage this way would die this turn, exile it instead"; diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestEffect.java index 206eb12a41..21ac9b9875 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestEffect.java @@ -78,7 +78,7 @@ public class ManifestEffect extends OneShotEffect { Set cards = controller.getLibrary().getTopCards(game, amount); for (Card card : cards) { ManaCosts manaCosts = null; - if (card.getCardType().contains(CardType.CREATURE)) { + if (card.isCreature()) { manaCosts = card.getSpellAbility() != null ? card.getSpellAbility().getManaCosts() : null; if (manaCosts == null) { manaCosts = new ManaCostsImpl("{0}"); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java index 184850b354..225a530f54 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java @@ -81,7 +81,7 @@ public class ManifestTargetPlayerEffect extends OneShotEffect { Set cards = targetPlayer.getLibrary().getTopCards(game, amount); for (Card card : cards) { ManaCosts manaCosts = null; - if (card.getCardType().contains(CardType.CREATURE)) { + if (card.isCreature()) { manaCosts = card.getSpellAbility().getManaCosts(); if (manaCosts == null) { manaCosts = new ManaCostsImpl("{0}"); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/SupportEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/SupportEffect.java index e2e4dd4537..32a979618b 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/SupportEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/SupportEffect.java @@ -50,7 +50,7 @@ public class SupportEffect extends AddCountersTargetEffect { super(CounterType.P1P1.createInstance(0), new StaticValue(1)); this.amountSupportTargets = new StaticValue(amount); this.otherPermanent = otherPermanent; - if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) { + if (card.isInstant() || card.isSorcery()) { card.getSpellAbility().addTarget(new TargetCreaturePermanent(0, amount, new FilterCreaturePermanent("target creatures"), false)); } staticText = setText(); diff --git a/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java b/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java index ab0dbd2c06..6d35515677 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java @@ -150,12 +150,12 @@ public class BestowAbility extends SpellAbility { MageObject basicObject = permanent.getBasicMageObject(game); if (basicObject != null) { basicObject.getSubtype(null).remove("Aura"); - if (!basicObject.getCardType().contains(CardType.CREATURE)) { + if (!basicObject.isCreature()) { basicObject.getCardType().add(CardType.CREATURE); } } permanent.getSubtype(null).remove("Aura"); - if (!permanent.getCardType().contains(CardType.CREATURE)) { + if (!permanent.isCreature()) { permanent.getCardType().add(CardType.CREATURE); } diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index b39b5e2f74..2eafa6a21f 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -120,7 +120,7 @@ class CascadeEffect extends OneShotEffect { } controller.moveCardsToExile(card, source, game, true, exile.getId(), exile.getName()); } while (controller.isInGame() - && (card.getCardType().contains(CardType.LAND) + && (card.isLand() || !cardThatCostsLess(sourceCost, card, game))); controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw diff --git a/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java b/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java index 77bebff2ef..3dc4faac65 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java @@ -110,7 +110,7 @@ public class EvolveAbility extends TriggeredAbilityImpl { if (!event.getTargetId().equals(this.getSourceId())) { Permanent triggeringCreature = game.getPermanent(event.getTargetId()); if (triggeringCreature != null - && triggeringCreature.getCardType().contains(CardType.CREATURE) + && triggeringCreature.isCreature() && triggeringCreature.getControllerId().equals(this.controllerId)) { Permanent sourceCreature = game.getPermanent(sourceId); if (sourceCreature != null && isPowerOrThoughnessGreater(sourceCreature, triggeringCreature)) { diff --git a/Mage/src/main/java/mage/abilities/keyword/FearAbility.java b/Mage/src/main/java/mage/abilities/keyword/FearAbility.java index 9324251eb8..970232efcf 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FearAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FearAbility.java @@ -91,7 +91,7 @@ class FearEffect extends RestrictionEffect implements MageSingleton { @Override public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { - if (blocker.getCardType().contains(CardType.ARTIFACT) || blocker.getColor(game).isBlack()) { + if (blocker.isArtifact() || blocker.getColor(game).isBlack()) { return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java index 5a033f3a2d..2ef128b03a 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java @@ -69,7 +69,7 @@ public class HauntAbility extends TriggeredAbilityImpl { public HauntAbility(Card card, Effect effect) { super(Zone.ALL, effect , false); - creatureHaunt = card.getCardType().contains(CardType.CREATURE); + creatureHaunt = card.isCreature(); addSubAbility(new HauntExileAbility(creatureHaunt)); } diff --git a/Mage/src/main/java/mage/abilities/keyword/IntimidateAbility.java b/Mage/src/main/java/mage/abilities/keyword/IntimidateAbility.java index 800ce6d7a0..6808338952 100644 --- a/Mage/src/main/java/mage/abilities/keyword/IntimidateAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/IntimidateAbility.java @@ -61,7 +61,7 @@ class IntimidateEffect extends RestrictionEffect implements MageSingleton { @Override public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { boolean result = false; - if (blocker.getCardType().contains(CardType.ARTIFACT) && (blocker.getCardType().contains(CardType.CREATURE))) { + if (blocker.isArtifact() && (blocker.isCreature())) { result = true; } if (attacker.getColor(game).shares(blocker.getColor(game))) { diff --git a/Mage/src/main/java/mage/abilities/keyword/ProtectionAbility.java b/Mage/src/main/java/mage/abilities/keyword/ProtectionAbility.java index 5db0f90de4..1e8c5adc2b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ProtectionAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ProtectionAbility.java @@ -115,7 +115,7 @@ public class ProtectionAbility extends StaticAbility { // object is still a card and not a spell yet. So return only if the source object can't be a spell // otherwise the following FilterObject check will be applied if (source instanceof StackObject - || (!source.getCardType().contains(CardType.INSTANT) && !source.getCardType().contains(CardType.SORCERY))) { + || (!source.isInstant() && !source.isSorcery())) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java index 903e580bdf..24821a1fd4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java @@ -55,7 +55,7 @@ import mage.players.Player; public class RecoverAbility extends TriggeredAbilityImpl { public RecoverAbility(Cost cost, Card card) { - super(Zone.GRAVEYARD, new RecoverEffect(cost, card.getCardType().contains(CardType.CREATURE)), false); + super(Zone.GRAVEYARD, new RecoverEffect(cost, card.isCreature()), false); } public RecoverAbility(final RecoverAbility ability) { @@ -77,7 +77,7 @@ public class RecoverAbility extends TriggeredAbilityImpl { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { if (zEvent.getTarget().getOwnerId().equals(getControllerId()) - && zEvent.getTarget().getCardType().contains(CardType.CREATURE) + && zEvent.getTarget().isCreature() && !zEvent.getTarget().getId().equals(getSourceId())) { return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/SoulbondAbility.java b/Mage/src/main/java/mage/abilities/keyword/SoulbondAbility.java index 1029ffc903..26226c8ac0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SoulbondAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SoulbondAbility.java @@ -102,7 +102,7 @@ public class SoulbondAbility extends EntersBattlefieldTriggeredAbility { boolean self = false; boolean other = false; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(getControllerId())) { - if (permanent.getCardType().contains(CardType.CREATURE)) { + if (permanent.isCreature()) { if (permanent.getId().equals(getSourceId())) { if (permanent.getControllerId().equals(getControllerId())) { self = true; @@ -158,7 +158,7 @@ class SoulboundEntersSelfEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { + if (permanent != null && permanent.isCreature()) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { TargetControlledPermanent target = new TargetControlledPermanent(filter); @@ -259,11 +259,11 @@ class SoulboundEntersOtherEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && permanent.getPairedCard() == null - && permanent.getCardType().contains(CardType.CREATURE)) { + && permanent.isCreature()) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { Permanent enteringPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (enteringPermanent != null && enteringPermanent.getCardType().contains(CardType.CREATURE) && enteringPermanent.getPairedCard() == null) { + if (enteringPermanent != null && enteringPermanent.isCreature() && enteringPermanent.getPairedCard() == null) { enteringPermanent.setPairedCard(new MageObjectReference(permanent, game)); permanent.setPairedCard(new MageObjectReference(enteringPermanent, game)); if (!game.isSimulation()) { diff --git a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java index 80b10df022..3aa9182d2f 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java @@ -53,7 +53,7 @@ public class SunburstAbility extends EntersBattlefieldAbility { public SunburstAbility(Card card) { super(new SunburstEffect(), ""); - isCreature = card.getCardType().contains(CardType.CREATURE); + isCreature = card.isCreature(); } public SunburstAbility(final SunburstAbility ability) { @@ -91,7 +91,7 @@ class SunburstEffect extends OneShotEffect { Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent != null) { Counter counter; - if (permanent.getCardType().contains(CardType.CREATURE)) { + if (permanent.isCreature()) { counter = CounterType.P1P1.createInstance(amount.calculate(game, source, this)); } else { counter = CounterType.CHARGE.createInstance(amount.calculate(game, source, this)); diff --git a/Mage/src/main/java/mage/abilities/keyword/SupportAbility.java b/Mage/src/main/java/mage/abilities/keyword/SupportAbility.java index 042c8e6bbf..2d7910e609 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SupportAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SupportAbility.java @@ -48,9 +48,9 @@ public class SupportAbility extends EntersBattlefieldTriggeredAbility { public SupportAbility(Card card, int amount) { super(new SupportEffect(card, amount, true)); - if (!card.getCardType().contains(CardType.INSTANT) && !card.getCardType().contains(CardType.SORCERY)) { + if (!card.isInstant() && !card.isSorcery()) { FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures"); - if (card.getCardType().contains(CardType.CREATURE)) { + if (card.isCreature()) { filter.add(new AnotherPredicate()); filter.setMessage("other target creatures"); } diff --git a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java index 5de5b130a5..da004d5b75 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java @@ -180,7 +180,7 @@ public class SuspendAbility extends SpecialAction { .append((suspend == 1 ? "a time counter" : (suspend == Integer.MAX_VALUE ? "X time counters" : suspend + " time counters"))) .append(" on it.") .append(" At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.") - .append(card.getCardType().contains(CardType.CREATURE) ? " If you play it this way and it's a creature, it gains haste until you lose control of it." : "") + .append(card.isCreature() ? " If you play it this way and it's a creature, it gains haste until you lose control of it." : "") .append(")"); } if (card.getManaCost().isEmpty()) { @@ -241,7 +241,7 @@ public class SuspendAbility extends SpecialAction { return false; } MageObject object = game.getObject(sourceId); - return (object.getCardType().contains(CardType.INSTANT) + return (object.isInstant() || object.hasAbility(FlashAbility.getInstance().getId(), game) || game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.CAST_AS_INSTANT, this, playerId, game) || game.canPlaySorcery(playerId)); @@ -384,7 +384,7 @@ class SuspendPlayCardEffect extends OneShotEffect { } // cast the card for free if (player.cast(card.getSpellAbility(), game, true)) { - if (card.getCardType().contains(CardType.CREATURE)) { + if (card.isCreature()) { ContinuousEffect effect = new GainHasteEffect(); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game) + 1)); game.addEffect(effect, source); diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java b/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java index b559f71772..7df3d14704 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java @@ -46,7 +46,7 @@ public class ArtifactCastManaCondition extends ManaCondition implements Conditio public boolean apply(Game game, Ability source) { if (source instanceof SpellAbility) { MageObject object = game.getObject(source.getSourceId()); - if (object != null && object.getCardType().contains(CardType.ARTIFACT)) { + if (object != null && object.isArtifact()) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java b/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java index f5f29b22a3..f1deebbca7 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java @@ -45,7 +45,7 @@ public class CreatureCastManaCondition extends ManaCondition implements Conditio public boolean apply(Game game, Ability source) { if (source instanceof SpellAbility) { MageObject object = game.getObject(source.getSourceId()); - if (object != null && object.getCardType().contains(CardType.CREATURE)) { + if (object != null && object.isCreature()) { return true; } } diff --git a/Mage/src/main/java/mage/cards/Card.java b/Mage/src/main/java/mage/cards/Card.java index 24d006f9ba..49e41a9b21 100644 --- a/Mage/src/main/java/mage/cards/Card.java +++ b/Mage/src/main/java/mage/cards/Card.java @@ -35,6 +35,7 @@ import mage.Mana; import mage.abilities.Abilities; import mage.abilities.Ability; import mage.abilities.SpellAbility; +import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.Counter; @@ -174,4 +175,7 @@ public interface Card extends MageObject { * returned */ Card getMainCard(); + + + } diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 4386895bc2..bf458ac1fa 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -93,13 +93,13 @@ public abstract class CardImpl extends MageObjectImpl implements Card { this.cardType.addAll(Arrays.asList(cardTypes)); this.manaCost.load(costs); setDefaultColor(); - if (cardType.contains(CardType.LAND)) { + if (this.isLand()) { Ability ability = new PlayLandAbility(name); ability.setSourceId(this.getId()); abilities.add(ability); } else { SpellAbility ability = new SpellAbility(manaCost, name, Zone.HAND, spellAbilityType); - if (!cardType.contains(CardType.INSTANT)) { + if (!this.isInstant()) { ability.setTiming(TimingRule.SORCERY); } ability.setSourceId(this.getId()); diff --git a/Mage/src/main/java/mage/cards/mock/MockCard.java b/Mage/src/main/java/mage/cards/mock/MockCard.java index fd4cacfcb8..38d19d82ec 100644 --- a/Mage/src/main/java/mage/cards/mock/MockCard.java +++ b/Mage/src/main/java/mage/cards/mock/MockCard.java @@ -49,7 +49,7 @@ public class MockCard extends CardImpl { this.secondSideCard = new MockCard(CardRepository.instance.findCard(card.getSecondSideName())); } - if (this.cardType.contains(CardType.PLANESWALKER)) { + if (this.isPlaneswalker()) { String startingLoyaltyString = card.getStartingLoyalty(); if (startingLoyaltyString.isEmpty()) { //Logger.getLogger(MockCard.class).warn("Planeswalker `" + this.name + "` has empty starting loyalty."); diff --git a/Mage/src/main/java/mage/cards/repository/CardInfo.java b/Mage/src/main/java/mage/cards/repository/CardInfo.java index 5fdf545356..139f2b3248 100644 --- a/Mage/src/main/java/mage/cards/repository/CardInfo.java +++ b/Mage/src/main/java/mage/cards/repository/CardInfo.java @@ -188,7 +188,7 @@ public class CardInfo { } // Starting loyalty - if (card.getCardType().contains(CardType.PLANESWALKER)) { + if (card.isPlaneswalker()) { for (Ability ab : card.getAbilities()) { if (ab instanceof PlanswalkerEntersWithLoyalityCountersAbility) { this.startingLoyalty = "" + ((PlanswalkerEntersWithLoyalityCountersAbility) ab).getStartingLoyalty(); diff --git a/Mage/src/main/java/mage/designations/Monarch.java b/Mage/src/main/java/mage/designations/Monarch.java index 1277945e43..8420faa392 100644 --- a/Mage/src/main/java/mage/designations/Monarch.java +++ b/Mage/src/main/java/mage/designations/Monarch.java @@ -125,7 +125,7 @@ class MonarchDealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility MageObject damagingObject = game.getObject(event.getSourceId()); if (damagingObject != null && damagingObject instanceof Permanent - && damagingObject.getCardType().contains(CardType.CREATURE) + && damagingObject.isCreature() && event.getTargetId().equals(game.getMonarchId())) { setControllerId(event.getPlayerId()); getEffects().get(0).setTargetPointer(new FixedTarget(((Permanent) damagingObject).getControllerId())); diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CommanderPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CommanderPredicate.java index c96298c33f..b7cddc3f15 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CommanderPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CommanderPredicate.java @@ -20,7 +20,7 @@ public class CommanderPredicate implements Predicate { @Override public boolean apply(Permanent input, Game game) { Player owner = game.getPlayer(input.getOwnerId()); - return input.getCardType().contains(CardType.CREATURE) + return input.isCreature() && owner != null && owner.getCommandersIds().contains(input.getId()); } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/EnchantedPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/EnchantedPredicate.java index d74274297f..a8c0e8f873 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/EnchantedPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/EnchantedPredicate.java @@ -43,7 +43,7 @@ public class EnchantedPredicate implements Predicate { public boolean apply(Permanent input, Game game) { for (UUID attachmentId : input.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); - if (attachment != null && attachment.getCardType().contains(CardType.ENCHANTMENT)) { + if (attachment != null && attachment.isEnchantment()) { return true; } } diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 44b7f63427..cd955996c9 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1688,7 +1688,7 @@ public abstract class GameImpl implements Game, Serializable { List legendary = new ArrayList<>(); List worldEnchantment = new ArrayList<>(); for (Permanent perm : getBattlefield().getAllActivePermanents()) { - if (perm.getCardType().contains(CardType.CREATURE)) { + if (perm.isCreature()) { //20091005 - 704.5f if (perm.getToughness().getValue() <= 0) { if (movePermanentToGraveyardWithInfo(perm)) { @@ -1723,7 +1723,7 @@ public abstract class GameImpl implements Game, Serializable { } somethingHappened = true; } - if (perm.getCardType().contains(CardType.PLANESWALKER)) { + if (perm.isPlaneswalker()) { //20091005 - 704.5i if (perm.getCounters(this).getCount(CounterType.LOYALTY) == 0) { if (movePermanentToGraveyardWithInfo(perm)) { @@ -1740,7 +1740,7 @@ public abstract class GameImpl implements Game, Serializable { //20091005 - 704.5n, 702.14c if (perm.getAttachedTo() == null) { Card card = this.getCard(perm.getId()); - if (card != null && !card.getCardType().contains(CardType.CREATURE)) { // no bestow creature + if (card != null && !card.isCreature()) { // no bestow creature if (movePermanentToGraveyardWithInfo(perm)) { somethingHappened = true; } @@ -1767,7 +1767,7 @@ public abstract class GameImpl implements Game, Serializable { if (attachedTo == null || !attachedTo.getAttachments().contains(perm.getId())) { // handle bestow unattachment Card card = this.getCard(perm.getId()); - if (card != null && card.getCardType().contains(CardType.CREATURE)) { + if (card != null && card.isCreature()) { UUID wasAttachedTo = perm.getAttachedTo(); perm.attachTo(null, this); BestowAbility.becomeCreature(perm, this); @@ -1787,7 +1787,7 @@ public abstract class GameImpl implements Game, Serializable { } else if (!auraFilter.match(attachedTo, this) || attachedTo.cantBeAttachedBy(perm, this)) { // handle bestow unattachment Card card = this.getCard(perm.getId()); - if (card != null && card.getCardType().contains(CardType.CREATURE)) { + if (card != null && card.isCreature()) { UUID wasAttachedTo = perm.getAttachedTo(); perm.attachTo(null, this); fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId())); @@ -1835,7 +1835,7 @@ public abstract class GameImpl implements Game, Serializable { UUID wasAttachedTo = perm.getAttachedTo(); perm.attachTo(null, this); fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId())); - } else if (!attachedTo.getCardType().contains(CardType.CREATURE) || attachedTo.hasProtectionFrom(perm, this)) { + } else if (!attachedTo.isCreature() || attachedTo.hasProtectionFrom(perm, this)) { if (attachedTo.removeAttachment(perm.getId(), this)) { somethingHappened = true; } @@ -1847,7 +1847,7 @@ public abstract class GameImpl implements Game, Serializable { Permanent land = getPermanent(perm.getAttachedTo()); if (land == null || !land.getAttachments().contains(perm.getId())) { perm.attachTo(null, this); - } else if (!land.getCardType().contains(CardType.LAND) || land.hasProtectionFrom(perm, this)) { + } else if (!land.isLand() || land.hasProtectionFrom(perm, this)) { if (land.removeAttachment(perm.getId(), this)) { somethingHappened = true; } @@ -1861,7 +1861,7 @@ public abstract class GameImpl implements Game, Serializable { for (UUID attachmentId : perm.getAttachments()) { Permanent attachment = getPermanent(attachmentId); if (attachment != null - && (attachment.getCardType().contains(CardType.CREATURE) + && (attachment.isCreature() || !(attachment.getSubtype(this).contains("Aura") || attachment.getSubtype(this).contains("Equipment") || attachment.getSubtype(this).contains("Fortification")))) { @@ -2293,7 +2293,7 @@ public abstract class GameImpl implements Game, Serializable { } } // check if it's a creature and must be removed from combat - if (perm.getCardType().contains(CardType.CREATURE) && this.getCombat() != null) { + if (perm.isCreature() && this.getCombat() != null) { perm.removeFromCombat(this, true); } it.remove(); diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index fdf52a3d69..fadac2870f 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -172,13 +172,13 @@ public class Combat implements Serializable, Copyable { public void checkForRemoveFromCombat(Game game) { for (UUID creatureId : getAttackers()) { Permanent creature = game.getPermanent(creatureId); - if (creature != null && !creature.getCardType().contains(CardType.CREATURE)) { + if (creature != null && !creature.isCreature()) { removeFromCombat(creatureId, game, true); } } for (UUID creatureId : getBlockers()) { Permanent creature = game.getPermanent(creatureId); - if (creature != null && !creature.getCardType().contains(CardType.CREATURE)) { + if (creature != null && !creature.isCreature()) { removeFromCombat(creatureId, game, true); } } diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 85c011229e..77a249134d 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -359,7 +359,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { @Override public boolean canTap() { - return !cardType.contains(CardType.CREATURE) || !hasSummoningSickness(); + return !isCreature() || !hasSummoningSickness(); } @Override @@ -701,7 +701,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { private int damage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat, boolean markDamage, ArrayList appliedEffects) { int damageDone = 0; if (damageAmount > 0 && canDamage(game.getObject(sourceId), game)) { - if (cardType.contains(CardType.PLANESWALKER)) { + if (this.isPlaneswalker()) { damageDone = damagePlaneswalker(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects); } else { damageDone = damageCreature(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects); @@ -945,7 +945,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } else { logName = this.getLogName(); } - if (this.getCardType().contains(CardType.CREATURE)) { + if (this.isCreature()) { game.informPlayers(logName + " died"); } else { game.informPlayers(logName + " was destroyed"); @@ -1175,7 +1175,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { public boolean removeFromCombat(Game game, boolean withInfo) { if (this.isAttacking() || this.blocking > 0) { return game.getCombat().removeFromCombat(objectId, game, withInfo); - } else if (getCardType().contains(CardType.PLANESWALKER)) { + } else if (this.isPlaneswalker()) { if (game.getCombat().getDefenders().contains(getId())) { game.getCombat().removePlaneswalkerFromCombat(objectId, game, withInfo); } diff --git a/Mage/src/main/java/mage/game/permanent/token/Token.java b/Mage/src/main/java/mage/game/permanent/token/Token.java index 46b7fd4918..c741fd4a99 100644 --- a/Mage/src/main/java/mage/game/permanent/token/Token.java +++ b/Mage/src/main/java/mage/game/permanent/token/Token.java @@ -195,7 +195,7 @@ public class Token extends MageObjectImpl { expansionSetCodeChecked = this.updateExpansionSetCode(setCode); } - GameEvent event = new GameEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount, this.getCardType().contains(CardType.CREATURE)); + GameEvent event = new GameEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount, this.isCreature()); if (!game.replaceEvent(event)) { amount = event.getAmount(); diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index 77575be048..8f7b8da978 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -191,7 +191,7 @@ public class Spell extends StackObjImpl implements Card { if (controller == null) { return false; } - if (this.getCardType().contains(CardType.INSTANT) || this.getCardType().contains(CardType.SORCERY)) { + if (this.isInstant() || this.isSorcery()) { int index = 0; result = false; boolean legalParts = false; @@ -239,7 +239,7 @@ public class Spell extends StackObjImpl implements Card { } counter(null, game); return false; - } else if (this.getCardType().contains(CardType.ENCHANTMENT) && this.getSubtype(game).contains("Aura")) { + } else if (this.isEnchantment() && this.getSubtype(game).contains("Aura")) { if (ability.getTargets().stillLegal(ability, game)) { updateOptionalCosts(0); boolean bestow = ability instanceof BestowAbility; @@ -432,7 +432,7 @@ public class Spell extends StackObjImpl implements Card { @Override public String getLogName() { if (faceDown) { - if (getCardType().contains(CardType.CREATURE)) { + if (this.isCreature()) { return "face down creature spell"; } else { return "face down spell"; diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index dd1b9ced7c..3e8097b597 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -938,7 +938,7 @@ public abstract class PlayerImpl implements Player, Serializable { return false; } boolean result; - if (card.getCardType().contains(CardType.LAND)) { + if (card.isLand()) { result = playLand(card, game, ignoreTiming); } else { result = cast(card.getSpellAbility(), game, noMana); @@ -1264,7 +1264,7 @@ public abstract class PlayerImpl implements Player, Serializable { useable.put(ability.getId(), (ActivatedAbility) ability); } } else if (ability instanceof AlternativeSourceCosts) { - if (object.getCardType().contains(CardType.LAND)) { + if (object.isLand()) { for (Ability ability2 : object.getAbilities().copy()) { if (ability2 instanceof PlayLandAbility) { useable.put(ability2.getId(), (ActivatedAbility) ability2); @@ -1319,7 +1319,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (card.isSplitCard() && ability instanceof FlashbackAbility) { FlashbackAbility flashbackAbility; // Left Half - if (card.getCardType().contains(CardType.INSTANT)) { + if (card.isInstant()) { flashbackAbility = new FlashbackAbility(((SplitCard) card).getLeftHalfCard().getManaCost(), TimingRule.INSTANT); } else { flashbackAbility = new FlashbackAbility(((SplitCard) card).getLeftHalfCard().getManaCost(), TimingRule.SORCERY); @@ -1332,7 +1332,7 @@ public abstract class PlayerImpl implements Player, Serializable { useable.put(flashbackAbility.getId(), flashbackAbility); } // Right Half - if (card.getCardType().contains(CardType.INSTANT)) { + if (card.isInstant()) { flashbackAbility = new FlashbackAbility(((SplitCard) card).getRightHalfCard().getManaCost(), TimingRule.INSTANT); } else { flashbackAbility = new FlashbackAbility(((SplitCard) card).getRightHalfCard().getManaCost(), TimingRule.SORCERY); @@ -2616,11 +2616,11 @@ public abstract class PlayerImpl implements Player, Serializable { } } } else if (ability instanceof AlternativeSourceCosts) { - if (card.getCardType().contains(CardType.LAND)) { + if (card.isLand()) { if (canLandPlayAlternateSourceCostsAbility(card, availableMana, ability, game)) { // e.g. Land with Morph playable.add(ability); } - } else if (card.getCardType().contains(CardType.CREATURE)) { // e.g. makes a card available for play by Morph if the card may not be cast normally + } else if (card.isCreature()) { // e.g. makes a card available for play by Morph if the card may not be cast normally if (!playable.contains(card.getSpellAbility())) { if (((AlternativeSourceCosts) ability).isAvailable(card.getSpellAbility(), game)) { playable.add(card.getSpellAbility()); @@ -2766,7 +2766,7 @@ public abstract class PlayerImpl implements Player, Serializable { } break; case STATIC: - if (card.getCardType().contains(CardType.LAND) && ability instanceof AlternativeSourceCosts) { + if (card.isLand() && ability instanceof AlternativeSourceCosts) { if (canLandPlayAlternateSourceCostsAbility(card, available, ability, game)) { // e.g. Land with Morph if (game.canPlaySorcery(getId())) { playable.add(card.getId()); diff --git a/Mage/src/main/java/mage/util/CardUtil.java b/Mage/src/main/java/mage/util/CardUtil.java index 5bc6fbb50c..85911fb421 100644 --- a/Mage/src/main/java/mage/util/CardUtil.java +++ b/Mage/src/main/java/mage/util/CardUtil.java @@ -124,7 +124,7 @@ public final class CardUtil { throw new IllegalArgumentException("Params can't be null"); } - if (card1.getCardType().contains(CardType.CREATURE) && card2.getCardType().contains(CardType.CREATURE)) { + if (card1.isCreature() && card2.isCreature()) { if (card1.getAbilities().contains(ChangelingAbility.getInstance()) || card1.getSubtype(game).contains(ChangelingAbility.ALL_CREATURE_TYPE) || card2.getAbilities().contains(ChangelingAbility.getInstance()) @@ -411,11 +411,11 @@ public final class CardUtil { public static boolean isPermanentCard(Card card) { boolean permanent = false; - permanent |= card.getCardType().contains(CardType.ARTIFACT); - permanent |= card.getCardType().contains(CardType.CREATURE); - permanent |= card.getCardType().contains(CardType.ENCHANTMENT); - permanent |= card.getCardType().contains(CardType.LAND); - permanent |= card.getCardType().contains(CardType.PLANESWALKER); + permanent |= card.isArtifact(); + permanent |= card.isCreature(); + permanent |= card.isEnchantment(); + permanent |= card.isLand(); + permanent |= card.isPlaneswalker(); return permanent; } @@ -676,7 +676,7 @@ public final class CardUtil { } public static boolean cardCanBePlayedNow(Card card, UUID playerId, Game game) { - if (card.getCardType().contains(CardType.LAND)) { + if (card.isLand()) { return game.canPlaySorcery(playerId) && game.getPlayer(playerId).canPlayLand(); } else { return card.getSpellAbility() != null && card.getSpellAbility().spellCanBeActivatedRegularlyNow(playerId, game); diff --git a/Mage/src/main/java/mage/util/trace/TraceUtil.java b/Mage/src/main/java/mage/util/trace/TraceUtil.java index 671703049e..e36028cb9a 100644 --- a/Mage/src/main/java/mage/util/trace/TraceUtil.java +++ b/Mage/src/main/java/mage/util/trace/TraceUtil.java @@ -58,7 +58,7 @@ public final class TraceUtil { if (hasIntimidate(attacker)) { for (UUID blockerId : group.getBlockers()) { Permanent blocker = game.getPermanent(blockerId); - if (blocker != null && !blocker.getCardType().contains(CardType.ARTIFACT) + if (blocker != null && !blocker.isArtifact() && !attacker.getColor(game).shares(blocker.getColor(game))) { log.warn("Found creature with intimidate blocked by non artifact not sharing color creature"); traceCombat(game, attacker, blocker); diff --git a/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java b/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java index d4b7f42b39..e42d17a714 100644 --- a/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CreatureWasCastWatcher.java @@ -62,7 +62,7 @@ public class CreatureWasCastWatcher extends Watcher { Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null) { Card card = game.getCard(spell.getSourceId()); - if (card != null && card.getCardType().contains(CardType.CREATURE)) { + if (card != null && card.isCreature()) { creaturesCasted.add(card.getId()); } } @@ -70,7 +70,7 @@ public class CreatureWasCastWatcher extends Watcher { if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Card card = game.getCard(event.getTargetId()); - if (card != null && card.getCardType().contains(CardType.CREATURE)) { + if (card != null && card.isCreature()) { creaturesCasted.remove(card.getId()); } } diff --git a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java index 669d37026d..caf6a155ab 100644 --- a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java @@ -59,7 +59,9 @@ public class CreaturesDiedWatcher extends Watcher { public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.isDiesEvent() && zEvent.getTarget() != null && zEvent.getTarget().getCardType().contains(CardType.CREATURE)) { + if (zEvent.isDiesEvent() + && zEvent.getTarget() != null + && zEvent.getTarget().isCreature()) { amountOfCreaturesThatDied++; int amount = 0; if (amountOfCreaturesThatDiedByController.containsKey(zEvent.getTarget().getControllerId())) { diff --git a/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java b/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java index 4767cb7553..51748037c6 100644 --- a/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/LandfallWatcher.java @@ -36,7 +36,7 @@ public class LandfallWatcher extends Watcher { public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.LAND) && !playerPlayedLand.contains(event.getPlayerId())) { + if (permanent != null && permanent.isLand() && !playerPlayedLand.contains(event.getPlayerId())) { playerPlayedLand.add(event.getPlayerId()); } } diff --git a/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java b/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java index f0e7fe0659..e1df966f92 100644 --- a/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/MorbidWatcher.java @@ -58,7 +58,7 @@ public class MorbidWatcher extends Watcher { } if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (p != null && p.getCardType().contains(CardType.CREATURE)) { + if (p != null && p.isCreature()) { condition = true; } } diff --git a/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java b/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java index d91b10e583..9965028257 100644 --- a/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java @@ -77,7 +77,7 @@ public class PermanentsEnteredBattlefieldWatcher extends Watcher { for (Permanent permanent : enteringBattlefieldLastTurn.get(sourcePermanent.getControllerId())) { if (!permanent.getId().equals(sourcePermanent.getId()) //|| permanent.getZoneChangeCounter(game) == sourcePermanent.getZoneChangeCounter(game) why is this needed? - && permanent.getCardType().contains(CardType.CREATURE)) { + && permanent.isCreature()) { return true; } } diff --git a/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java index b9af874ca3..d5fc443f1c 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerCastCreatureWatcher.java @@ -58,7 +58,7 @@ public class PlayerCastCreatureWatcher extends Watcher { public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.SPELL_CAST) { Spell spell = (Spell) game.getObject(event.getTargetId()); - if (spell.getCardType().contains(CardType.CREATURE)) { + if (spell.isCreature()) { playerIds.add(spell.getControllerId()); } }