change subtype.contains() to hasSubtype()

This commit is contained in:
igoudt 2017-09-25 21:20:24 +02:00
parent a316fe508f
commit b12b0e29b8
94 changed files with 250 additions and 277 deletions

View file

@ -100,7 +100,7 @@ class AdaptiveAutomatonAddSubtypeEffect extends ContinuousEffectImpl {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
if (subtype != null && !permanent.getSubtype(game).contains(subtype)) {
if (subtype != null && !permanent.hasSubtype(subtype, game)) {
permanent.getSubtype(game).add(subtype);
}
}

View file

@ -27,11 +27,6 @@
*/
package mage.cards.a;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
@ -40,13 +35,7 @@ import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.Predicate;
@ -59,6 +48,8 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetNonlandPermanent;
import mage.watchers.Watcher;
import java.util.*;
/**
*
* @author TheElk801
@ -129,11 +120,11 @@ class DamagedByPiratesWatcher extends Watcher {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
if (((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanentOrLKIBattlefield(event.getSourceId());
if (creature != null && creature.getSubtype(game).contains(SubType.PIRATE)) {
if (creature != null && creature.hasSubtype(SubType.PIRATE, game)) {
if (damageSourceIds.keySet().contains(event.getTargetId())) {
damageSourceIds.get(event.getTargetId()).add(creature.getId());
} else {
Set<UUID> creatureSet = new HashSet();
Set<UUID> creatureSet = new HashSet<>();
creatureSet.add(creature.getId());
damageSourceIds.put(event.getTargetId(), creatureSet);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
@ -42,6 +41,8 @@ import mage.game.permanent.token.CatToken;
import mage.game.permanent.token.Token;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author Plopman
@ -95,7 +96,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(SubType.AURA)) {
if (enchantment != null && enchantment.hasSubtype(SubType.AURA, game)) {
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.AsEntersBattlefieldAbility;
@ -36,17 +35,14 @@ import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author TheElk801
@ -95,7 +91,7 @@ class AnZerrinRuinsDontUntapEffect extends DontUntapInControllersUntapStepAllEff
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && sourcePerm != null) {
SubType subtype = (SubType) game.getState().getValue(sourcePerm.getId() + "_type");
if (permanent.getSubtype(game).contains(subtype)) {
if (permanent.hasSubtype(subtype, game)) {
return true;
}
}

View file

@ -27,9 +27,6 @@
*/
package mage.cards.a;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -38,13 +35,7 @@ import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -52,6 +43,10 @@ import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
/**
*
* @author TheElk801
@ -102,7 +97,7 @@ class ConspyEffect extends ContinuousEffectImpl {
// in graveyard
for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId);
if (card.isCreature() && !card.getSubtype(game).contains(choice)) {
if (card.isCreature() && !card.hasSubtype(choice, game)) {
for (SubType s : card.getSubtype(game)) {
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
}
@ -112,7 +107,7 @@ class ConspyEffect extends ContinuousEffectImpl {
// on Hand
for (UUID cardId : controller.getHand()) {
Card card = game.getCard(cardId);
if (card.isCreature() && !card.getSubtype(game).contains(choice)) {
if (card.isCreature() && !card.hasSubtype(choice, game)) {
for (SubType s : card.getSubtype(game)) {
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
}
@ -121,7 +116,7 @@ class ConspyEffect extends ContinuousEffectImpl {
}
// in Exile
for (Card card : game.getState().getExile().getAllCards(game)) {
if (card.isCreature() && !card.getSubtype(game).contains(choice)) {
if (card.isCreature() && !card.hasSubtype(choice, game)) {
for (SubType s : card.getSubtype(game)) {
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
}
@ -130,7 +125,7 @@ class ConspyEffect extends ContinuousEffectImpl {
}
// in Library (e.g. for Mystical Teachings)
for (Card card : controller.getLibrary().getCards(game)) {
if (card.getOwnerId().equals(controller.getId()) && card.isCreature() && !card.getSubtype(game).contains(choice)) {
if (card.getOwnerId().equals(controller.getId()) && card.isCreature() && !card.hasSubtype(choice, game)) {
for (SubType s : card.getSubtype(game)) {
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
}
@ -141,7 +136,7 @@ class ConspyEffect extends ContinuousEffectImpl {
for (UUID commanderId : controller.getCommandersIds()) {
if (game.getState().getZone(commanderId) == Zone.COMMAND) {
Card card = game.getCard(commanderId);
if (card.isCreature() && !card.getSubtype(game).contains(choice)) {
if (card.isCreature() && !card.hasSubtype(choice, game)) {
for (SubType s : card.getSubtype(game)) {
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
}
@ -155,7 +150,7 @@ class ConspyEffect extends ContinuousEffectImpl {
if (stackObject instanceof Spell
&& stackObject.getControllerId().equals(source.getControllerId())
&& stackObject.isCreature()
&& !stackObject.getSubtype(game).contains(choice)) {
&& !stackObject.hasSubtype(choice, game)) {
Card card = ((Spell) stackObject).getCard();
for (SubType s : card.getSubtype(game)) {
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
@ -167,7 +162,7 @@ class ConspyEffect extends ContinuousEffectImpl {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
for (Permanent creature : creatures) {
if (creature != null && !creature.getSubtype(game).contains(choice)) {
if (creature != null && !creature.hasSubtype(choice, game)) {
creature.getSubtype(game).add(choice);
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.a;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -41,6 +39,9 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.List;
import java.util.UUID;
/**
*
* @author North
@ -116,7 +117,7 @@ class ArmamentMasterEffect extends ContinuousEffectImpl {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached != null && attached.hasSubtype(SubType.EQUIPMENT, game)) {
count++;
}
}

View file

@ -87,7 +87,7 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId);
if (card != null && card.isCreature() && !card.getSubtype(game).contains(subtype)) {
if (card != null && card.isCreature() && !card.hasSubtype(subtype, game)) {
game.getState().getCreateCardAttribute(card).getSubtype().add(subtype);
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.a;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
@ -46,6 +44,9 @@ import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.List;
import java.util.UUID;
/**
*
* @author spjspj
@ -101,7 +102,7 @@ class EnchantedCreatureAurasCount implements DynamicValue {
List<UUID> attachments = permanent.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) {
if (attached != null && attached.hasSubtype(SubType.AURA, game)) {
count++;
}

View file

@ -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(SubType.AURA)) {
if (stackObject.hasSubtype(SubType.AURA, game)) {
return true;
}
}

View file

@ -95,7 +95,7 @@ class DestroyAllAttachedEquipmentEffect extends OneShotEffect {
List<UUID> attachments = new ArrayList<>(target.getAttachments());
for (UUID attachmentId : attachments) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attachment != null && attachment.hasSubtype(SubType.EQUIPMENT, game)) {
attachment.destroy(source.getSourceId(), game, false);
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.b;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
@ -47,6 +45,9 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.PermanentsSacrificedWatcher;
import java.util.List;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -88,7 +89,7 @@ enum BriarbridgePatrolCondition implements Condition {
if (sacrificedPermanents != null && !sacrificedPermanents.isEmpty()) {
int amountOfClues = 0;
for (Permanent permanent : sacrificedPermanents) {
if (permanent.getSubtype(game).contains(SubType.CLUE)) {
if (permanent.hasSubtype(SubType.CLUE, game)) {
amountOfClues++;
}
}

View file

@ -88,7 +88,7 @@ class CopyEnchantmentEffect extends CopyPermanentEffect {
if (super.apply(game, source)) {
Permanent permanentToCopy = getBluePrintPermanent();
if (permanentToCopy != null) {
if (permanentToCopy.getSubtype(game).contains(SubType.AURA)) {
if (permanentToCopy.hasSubtype(SubType.AURA, game)) {
Target target = getBluePrintPermanent().getSpellAbility().getTargets().get(0);
Outcome auraOutcome = Outcome.BoostCreature;
Ability:

View file

@ -203,14 +203,14 @@ class CrypticGatewayEffect extends OneShotEffect {
List<SubtypePredicate> subtypes = new ArrayList<>();
for (SubType subtype : creature.getSubtype(game)) {
if (creature2.getSubtype(game).contains(subtype) || changeling2) {
if (creature2.hasSubtype(subtype, game) || changeling2) {
subtypes.add(new SubtypePredicate(subtype));
commonSubType = true;
}
}
for (SubType subtype : creature2.getSubtype(game)) {
if (creature.getSubtype(game).contains(subtype) || changeling) {
if (creature.hasSubtype(subtype, game) || changeling) {
subtypes.add(new SubtypePredicate(subtype));
commonSubType = true;
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -52,6 +51,8 @@ import mage.target.TargetPlayer;
import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author BetaSteward
@ -107,7 +108,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(SubType.CURSE)) {
if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) {
filter.add(Predicates.not(new NamePredicate(attachment.getName())));
}
}

View file

@ -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(SubType.CURSE))
if (attachment != null && attachment.hasSubtype(SubType.CURSE, game))
count++;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.TransformSourceEffect;
@ -42,6 +41,8 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/**
*
* @author fireshoes
@ -96,7 +97,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(SubType.CLUE);
&& game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).hasSubtype(SubType.CLUE, game);
}
@Override

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -42,6 +41,8 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author TheElk801
@ -90,7 +91,7 @@ class DauntingDefenderEffect extends PreventionEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.getSubtype(game).contains(SubType.CLERIC)) {
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.hasSubtype(SubType.CLERIC, game)) {
return super.applies(event, source, game);
}
}

View file

@ -110,7 +110,7 @@ class AuraAttachedPredicate implements Predicate<Permanent> {
if (!uuid.equals(ownId)) {
Permanent attachment = game.getPermanent(uuid);
if (attachment != null
&& attachment.getSubtype(game).contains(SubType.AURA)) {
&& attachment.hasSubtype(SubType.AURA, game)) {
return true;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.LandfallAbility;
@ -37,8 +36,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.Predicates;
@ -48,6 +47,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author LevelX2
@ -109,7 +110,7 @@ class EmeriaShepherdReturnToHandTargetEffect extends OneShotEffect {
return false;
}
Zone toZone = Zone.HAND;
if (triggeringLand.getSubtype(game).contains(SubType.PLAINS)
if (triggeringLand.hasSubtype(SubType.PLAINS, game)
&& controller.chooseUse(Outcome.PutCardInPlay, "Put the card to battlefield instead?", source, game)) {
toZone = Zone.BATTLEFIELD;
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -39,14 +38,12 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.BestowAbility;
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;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author Quercitron
@ -98,7 +95,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(SubType.AURA)) {
if (sourceObject.hasSubtype(SubType.AURA, game)) {
game.addEffect(new BoostEnchantedEffect(1, 0, Duration.EndOfTurn), source);
} else {
game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);

View file

@ -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(SubType.CLUE);
&& game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).hasSubtype(SubType.CLUE, game);
}
@Override

View file

@ -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(SubType.EQUIPMENT)) {
if (permanent != null && permanent.hasSubtype(SubType.EQUIPMENT, game)) {
return true;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -36,14 +35,16 @@ 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.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
/**
*
* @author Plopman
@ -102,7 +103,7 @@ class GoblinCharbelcherEffect extends OneShotEffect {
cards.add(card);
if (card.isLand()){
landFound = true;
if(card.getSubtype(game).contains(SubType.MOUNTAIN)){
if(card.hasSubtype(SubType.MOUNTAIN, game)){
isMountain = true;
}
break;
@ -117,7 +118,7 @@ class GoblinCharbelcherEffect extends OneShotEffect {
if (landFound) {
damage--;
}
if(isMountain == true){
if(isMountain){
damage *= 2;
}

View file

@ -91,7 +91,7 @@ class GolemSkinGauntletsAttachedCount implements DynamicValue {
List<UUID> attachments = permanent.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached != null && attached.hasSubtype(SubType.EQUIPMENT, game)) {
count++;
}
}

View file

@ -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(SubType.CLUE);
&& game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).hasSubtype(SubType.CLUE, game);
}
@Override

View file

@ -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(SubType.AURA)) {
if (event.getType() == EventType.LOSE_CONTROL || event.getType() == EventType.ATTACH || event.getType() == EventType.TARGET && spell != null && spell.isEnchantment() && spell.hasSubtype(SubType.AURA, game)) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
if (perm != null && Objects.equals(perm.getId(), targetPermanent.getId()) && !perm.isCreature()) {
return true;

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.LandfallAbility;
@ -41,6 +40,8 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author LevelX2
@ -91,7 +92,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(SubType.SWAMP)) {
if (land.hasSubtype(SubType.SWAMP, game)) {
boost = 2;
}
game.addEffect(new BoostControlledEffect(boost, 0, Duration.EndOfTurn, true), source);

View file

@ -27,7 +27,6 @@
*/
package mage.cards.h;
import java.util.UUID;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
@ -54,6 +53,8 @@ import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -158,7 +159,7 @@ class UginPlaneswalkerCardPredicate implements Predicate<Card> {
@Override
public boolean apply(Card input, Game game) {
return input.isPlaneswalker()
&& input.getSubtype(game).contains(SubType.UGIN);
&& input.hasSubtype(SubType.UGIN, game);
}
@Override

View file

@ -27,7 +27,6 @@
*/
package mage.cards.j;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTappedAbility;
@ -51,6 +50,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
*
* @author fireshoes
@ -110,7 +111,7 @@ class JokulmorderTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent land = game.getPermanent(event.getTargetId());
return land.getSubtype(game).contains(SubType.ISLAND)
return land.hasSubtype(SubType.ISLAND, game)
&& land.getControllerId().equals(this.controllerId);
}

View file

@ -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(SubType.AURA) && card.isPermanent()) {
if (!card.hasSubtype(SubType.AURA, game) && 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(SubType.AURA)) {
if (card.isPermanent() && !card.hasSubtype(SubType.AURA, game)) {
game.getExile().add(exileId, sourceObject.getIdName(), card);
}
}

View file

@ -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(SubType.EQUIPMENT)) {
if (attachment.hasSubtype(SubType.EQUIPMENT, game)) {
return true;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
@ -37,11 +36,7 @@ import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
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.TargetController;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
@ -51,6 +46,8 @@ import mage.game.permanent.token.Token;
import mage.target.common.TargetArtifactPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author fireshoes
@ -101,8 +98,8 @@ 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(SubType.VEHICLE)) {
Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget());
if (!permanent.isCreature() && !permanent.hasSubtype(SubType.VEHICLE, game)) {
ContinuousEffect continuousEffect = new BecomesCreatureTargetEffect(new LifecraftAwakeningToken(), false, true, Duration.Custom);
continuousEffect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(continuousEffect, source);

View file

@ -27,7 +27,6 @@
*/
package mage.cards.l;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
@ -38,15 +37,13 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
*
* @author Styxo
@ -73,7 +70,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(SubType.SITH) || targetCreature.getSubtype(game).contains(SubType.JEDI))) {
if (targetCreature != null && (targetCreature.hasSubtype(SubType.SITH, game) || targetCreature.hasSubtype(SubType.JEDI, game))) {
CardUtil.increaseCost(ability, 1 - ability.getManaCostsToPay().convertedManaCost());
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.l;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -44,6 +43,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -93,7 +94,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)) {
if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.LILIANA, game)) {
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {
permanentController.loseLife(3, game, false);

View file

@ -27,26 +27,19 @@
*/
package mage.cards.l;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AttacksAllTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
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;
import mage.cards.*;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author BetaSteward
@ -95,7 +88,7 @@ class LostInTheWoodsEffect extends OneShotEffect {
controller.revealCards(sourceObject.getName(), cards, game);
if (card != null) {
if (card.getSubtype(game).contains(SubType.FOREST)) {
if (card.hasSubtype(SubType.FOREST, game)) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
permanent.removeFromCombat(game);

View file

@ -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(SubType.AURA)) {
if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) {
toHand.add(attachment);
}
}

View file

@ -98,7 +98,7 @@ class MurderousSpoilsEffect extends OneShotEffect {
List<Permanent> attachments = new ArrayList<>();
for (UUID uuid : target.getAttachments()) {
Permanent attached = game.getBattlefield().getPermanent(uuid);
if (attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached.hasSubtype(SubType.EQUIPMENT, game)) {
attachments.add(attached);
}
}

View file

@ -110,7 +110,7 @@ class TargetCardInLibrarySharingLandType extends TargetCardInLibrary {
if (landTypes.isEmpty()) {
landTypes.addAll(landCard.getSubtype(game));
} else {
landTypes.removeIf(next -> !landCard.getSubtype(game).contains(next));
landTypes.removeIf(next -> !landCard.hasSubtype(next, game));
}
}
}
@ -118,7 +118,7 @@ class TargetCardInLibrarySharingLandType extends TargetCardInLibrary {
if (card != null && !landTypes.isEmpty()) {
for (Iterator<SubType> iterator = landTypes.iterator(); iterator.hasNext();) {
SubType next = iterator.next();
if (card.getSubtype(game).contains(next)) {
if (card.hasSubtype(next, game)) {
return true;
}
}

View file

@ -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(SubType.AURA)) {
if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) {
return true;
}
}

View file

@ -204,7 +204,7 @@ class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements Sour
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!permanent.getSubtype(game).contains(SubType.AURA)) {
if (!permanent.hasSubtype(SubType.AURA, game)) {
permanent.getSubtype(game).add(SubType.AURA);
}
}

View file

@ -27,9 +27,6 @@
*/
package mage.cards.n;
import java.util.LinkedHashSet;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -43,12 +40,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.TextPartSubtypePredicate;
@ -60,6 +52,10 @@ import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.LinkedHashSet;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
* @author LevelX2
@ -187,9 +183,9 @@ class ChangeCreatureTypeTargetEffect extends ContinuousEffectImpl {
break;
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (targetObject.getSubtype(game).contains(fromSubType)) {
if (targetObject.hasSubtype(fromSubType, game)) {
targetObject.getSubtype(game).remove(fromSubType);
if (!targetObject.getSubtype(game).contains(toSubType)) {
if (!targetObject.hasSubtype(toSubType, game)) {
targetObject.getSubtype(game).add(toSubType);
}
}

View file

@ -141,7 +141,7 @@ class NyleasPresenceLandTypeEffect extends ContinuousEffectImpl {
break;
case TypeChangingEffects_4:
for (SubType subtype : landTypes) {
if (!land.getSubtype(game).contains(subtype)) {
if (!land.hasSubtype(subtype, game)) {
land.getSubtype(game).add(subtype);
}
}

View file

@ -119,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(SubType.AURA)) {
&& attachment.hasSubtype(SubType.AURA, game)) {
attachment.moveToZone(Zone.HAND, source.getSourceId(), game, false);
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.cards.p;
import java.util.Iterator;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -47,6 +45,9 @@ import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.players.Player;
import java.util.Iterator;
import java.util.UUID;
/**
*
* @author TheElk801
@ -115,7 +116,7 @@ class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl {
if (sType.getSubTypeSet() == SubTypeSet.CreatureType) {
for (UUID cmdr : controller.getCommandersIds()) {
MageObject commander = game.getObject(cmdr);
if (commander != null && commander.getSubtype(game).contains(sType)) {
if (commander != null && commander.hasSubtype(sType, game)) {
return true;
}
}

View file

@ -27,17 +27,12 @@
*/
package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
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;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
@ -45,6 +40,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.events.NumberOfTriggersEvent;
import mage.game.events.ZoneChangeEvent;
import java.util.UUID;
/**
*
* @author Styxo
@ -101,7 +98,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(SubType.JEDI)) {
if (entersTheBattlefieldEvent.getTarget().hasSubtype(SubType.JEDI, game)) {
// Only for triggers of permanents
if (game.getPermanent(numberOfTriggersEvent.getSourceId()) != null) {
return true;
@ -113,7 +110,7 @@ class PrecipiceOfMortisEffect extends ReplacementEffectImpl {
ZoneChangeEvent leavesTheBattlefieldEvent = (ZoneChangeEvent) sourceEvent;
if (leavesTheBattlefieldEvent.getFromZone() == Zone.BATTLEFIELD) {
// Only for leaving Jedis
if (leavesTheBattlefieldEvent.getTarget().getSubtype(game).contains(SubType.JEDI)) {
if (leavesTheBattlefieldEvent.getTarget().hasSubtype(SubType.JEDI, game)) {
// Only for triggers of permanents
if (game.getPermanent(numberOfTriggersEvent.getSourceId()) != null) {
return true;

View file

@ -123,7 +123,7 @@ class BecomesBasicLandTypeAllEffect extends ContinuousEffectImpl {
break;
case TypeChangingEffects_4:
for (SubType subtype : landTypes) {
if (!land.getSubtype(game).contains(subtype)) {
if (!land.hasSubtype(subtype, game)) {
land.getSubtype(game).add(subtype);
}
}

View file

@ -111,7 +111,7 @@ class RealmwrightEffect2 extends ContinuousEffectImpl {
if (land != null) {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA && !land.getSubtype(game).contains(choice)) {
if (sublayer == SubLayer.NA && !land.hasSubtype(choice, game)) {
land.getSubtype(game).add(choice);
}
break;

View file

@ -105,7 +105,7 @@ class RiptideShapeshifterEffect extends OneShotEffect {
Cards revealedCards = new CardsImpl();
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card.isCreature() && card.getSubtype(game).contains(SubType.byDescription(choice.getChoice()))) {
if (card.isCreature() && card.hasSubtype(SubType.byDescription(choice.getChoice()), game)) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
break;
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesMonstrousSourceTriggeredAbility;
@ -45,6 +44,8 @@ import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -116,7 +117,7 @@ class SealockMonsterBecomesIslandTargetEffect extends ContinuousEffectImpl {
}
break;
case TypeChangingEffects_4:
if (!land.getSubtype(game).contains(SubType.ISLAND)) {
if (!land.hasSubtype(SubType.ISLAND, game)) {
land.getSubtype(game).add(SubType.ISLAND);
}
break;

View file

@ -101,7 +101,7 @@ class SilenceTheBelieversExileEffect extends OneShotEffect {
List<UUID> attachments = new ArrayList<>(creature.getAttachments());
for (UUID attachmentId: attachments) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getSubtype(game).contains(SubType.AURA)) {
if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) {
controller.moveCardToExileWithInfo(attachment, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect;
@ -40,6 +39,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author TheElk801
@ -85,7 +86,7 @@ class SirensRuseEffect extends ExileTargetForSourceEffect {
boolean isPirate = false;
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null && permanent.getSubtype(game).contains(SubType.PIRATE)) {
if (permanent != null && permanent.hasSubtype(SubType.PIRATE, game)) {
isPirate = true;
}
if (super.apply(game, source)) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.ExileTargetCost;
@ -36,8 +35,8 @@ 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.constants.SubType;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
@ -45,22 +44,23 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author MarcoMarin
*/
public class SoulExchange extends CardImpl {
public SoulExchange(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}");
// As an additional cost to cast Soul Exchange, exile a creature you control.
Cost cost = new ExileTargetCost(new TargetControlledCreaturePermanent());
this.getSpellAbility().addCost(cost);
// Return target creature card from your graveyard to the battlefield. Put a +2/+2 counter on that creature if the exiled creature was a Thrull.
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
this.getSpellAbility().addEffect(new SoulExchangeEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
this.getSpellAbility().addEffect(new SoulExchangeEffect());
}
public SoulExchange(final SoulExchange card) {
@ -73,17 +73,17 @@ public class SoulExchange extends CardImpl {
}
}
class SoulExchangeEffect extends OneShotEffect{
class SoulExchangeEffect extends OneShotEffect {
public SoulExchangeEffect() {
super(Outcome.Benefit);
this.setText("Return target creature card from your graveyard to the battlefield. Put a +2/+2 counter on that creature if the exiled creature was a Thrull.");
}
public SoulExchangeEffect(final SoulExchangeEffect effect) {
super(effect);
}
@Override
public SoulExchangeEffect copy() {
return new SoulExchangeEffect(this);
@ -93,22 +93,22 @@ class SoulExchangeEffect extends OneShotEffect{
public boolean apply(Game game, Ability source) {
ReturnFromGraveyardToBattlefieldTargetEffect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
if (!effect.apply(game, source)) return false;
for (Cost c : source.getCosts()){
for (Cost c : source.getCosts()) {
/* if (!c.getTargets().isEmpty()){
UUID t = c.getTargets().getFirstTarget();
Permanent exiled = game.getPermanentOrLKIBattlefield(t);*/
if (c.isPaid() && c instanceof ExileTargetCost) {
for (Permanent exiled : ((ExileTargetCost) c).getPermanents()) {
if (exiled != null){
if(exiled.getSubtype(game).contains(SubType.THRULL)){
game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), source, game);
return true;
if (exiled != null) {
if (exiled.hasSubtype(SubType.THRULL, game)) {
game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), source, game);
return true;
}
} else return false;
}
} else return false;
}
}
}
return true;
}
return true;
}
}

View file

@ -27,22 +27,18 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
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;
import mage.constants.SubLayer;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -90,7 +86,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(SubType.VEHICLE)) {
if (permanent != null && permanent.hasSubtype(SubType.VEHICLE, game)) {
if (sublayer == SubLayer.NA) {
permanent.addCardType(CardType.ARTIFACT);
permanent.addCardType(CardType.CREATURE);// TODO: Chcek if giving CREATURE Type is correct

View file

@ -114,7 +114,7 @@ class StormtideLeviathanEffect extends ContinuousEffectImpl {
for (Permanent land : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
if (!land.getSubtype(game).contains(SubType.ISLAND)) {
if (!land.hasSubtype(SubType.ISLAND, game)) {
land.getSubtype(game).add(SubType.ISLAND);
}
break;

View file

@ -108,7 +108,7 @@ class StreetSweeperDestroyEffect extends OneShotEffect {
for(UUID uuid : attachments)
{
Permanent aura = game.getPermanent(uuid);
if(aura != null && aura.getSubtype(game).contains(SubType.AURA))
if(aura != null && aura.hasSubtype(SubType.AURA, game))
{
aura.destroy(source.getSourceId(), game, false);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -49,6 +48,8 @@ import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author JRHerlehy
@ -127,9 +128,9 @@ class TetsuoUmezawaEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
if (stackObject != null && event.getTargetId().equals(source.getSourceId())) {
if (stackObject.getSubtype(game).contains(SubType.AURA)) {
if (stackObject.hasSubtype(SubType.AURA, game)) {
return true;
}
}

View file

@ -27,9 +27,6 @@
*/
package mage.cards.t;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
@ -42,13 +39,7 @@ import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
@ -57,6 +48,10 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author TheElk801
@ -125,7 +120,7 @@ class DragonsAttackedWatcher extends Watcher {
this.attackedThisTurnCreatures.clear();
}
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) {
if (game.getPermanent(event.getSourceId()).getSubtype(game).contains(SubType.DRAGON)) {
if (game.getPermanent(event.getSourceId()).hasSubtype(SubType.DRAGON, game)) {
this.attackedThisTurnCreatures.add(new MageObjectReference(event.getSourceId(), game));
}
}
@ -166,7 +161,7 @@ class TheUrDragonTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
for (UUID attacker : game.getCombat().getAttackers()) {
Permanent creature = game.getPermanent(attacker);
if (creature != null && creature.getControllerId() == this.getControllerId() && creature.getSubtype(game).contains(SubType.DRAGON)) {
if (creature != null && creature.getControllerId() == this.getControllerId() && creature.hasSubtype(SubType.DRAGON, game)) {
return true;
}
}

View file

@ -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(SubType.CLUE);
&& game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).hasSubtype(SubType.CLUE, game);
}
@Override

View file

@ -86,7 +86,7 @@ class TrainingDroneEffect extends RestrictionEffect {
List<UUID> attachments = permanent.getAttachments();
for (UUID uuid : attachments) {
Permanent attached = game.getBattlefield().getPermanent(uuid);
if (attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached.hasSubtype(SubType.EQUIPMENT, game)) {
return false;
}
}

View file

@ -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(SubType.AURA)) {
if (aura != null && aura.hasSubtype(SubType.AURA, game)) {
aura.destroy(source.getSourceId(), game, false);
}
}

View file

@ -83,7 +83,7 @@ class TurnToSlagEffect extends OneShotEffect {
List<Permanent> attachments = new ArrayList<>();
for (UUID uuid : target.getAttachments()) {
Permanent attached = game.getBattlefield().getPermanent(uuid);
if (attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached.hasSubtype(SubType.EQUIPMENT, game)) {
attachments.add(attached);
}
}

View file

@ -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(SubType.CLUE);
&& game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).hasSubtype(SubType.CLUE, game);
}
@Override

View file

@ -27,7 +27,6 @@
*/
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -42,6 +41,8 @@ import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author ImperatorPrime
*/
@ -108,7 +109,7 @@ class VolrathsShapeshifterEffect extends ContinuousEffectImpl {
permanent.getSubtype(game).clear();
for (SubType type : card.getSubtype(game)) {
if (!permanent.getSubtype(game).contains(type)) {
if (!permanent.hasSubtype(type, game)) {
permanent.getSubtype(game).add(type);
}
}

View file

@ -92,7 +92,7 @@ class WitchbaneOrbEffect extends OneShotEffect {
List<Permanent> toDestroy = new ArrayList<>();
for (UUID attachmentId : controller.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getSubtype(game).contains(SubType.CURSE)) {
if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) {
toDestroy.add(attachment);
}
}

View file

@ -84,7 +84,7 @@ class XenograftAddSubtypeEffect extends ContinuousEffectImpl {
if (subtype != null) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game);
for (Permanent permanent : permanents) {
if (permanent != null && !permanent.getSubtype(game).contains(subtype)) {
if (permanent != null && !permanent.hasSubtype(subtype, game)) {
permanent.getSubtype(game).add(subtype);
}
}

View file

@ -1,9 +1,5 @@
package mage;
import java.io.Serializable;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCost;
@ -19,6 +15,11 @@ import mage.game.Game;
import mage.game.events.ZoneChangeEvent;
import mage.util.SubTypeList;
import java.io.Serializable;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
public interface MageObject extends MageItem, Serializable {
String getName();
@ -177,7 +178,7 @@ public interface MageObject extends MageItem, Serializable {
}
}
for (SubType subtype : this.getSubtype(game)) {
if (otherCard.getSubtype(game).contains(subtype)) {
if (otherCard.hasSubtype(subtype, game)) {
return true;
}
}

View file

@ -58,7 +58,7 @@ public class AuraAttachedTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getSourceId())) {
Permanent attachment = game.getPermanent(event.getSourceId());
if (attachment != null && attachment.getSubtype(game).contains(SubType.AURA)) {
if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) {
return true;
}
}

View file

@ -29,11 +29,11 @@ package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
import mage.constants.SubType;
/**
* Describes condition when creature is equipped with more than one Equipment.
@ -51,7 +51,7 @@ public enum EquippedMultipleSourceCondition implements Condition {
if (permanent != null) {
for (UUID uuid : permanent.getAttachments()) {
Permanent attached = game.getBattlefield().getPermanent(uuid);
if (attached != null && attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached != null && attached.hasSubtype(SubType.EQUIPMENT, game)) {
countEquipped++;
if (countEquipped >= 2) {
return true;

View file

@ -50,7 +50,7 @@ public enum EquippedSourceCondition implements Condition {
if (permanent != null) {
for (UUID uuid : permanent.getAttachments()) {
Permanent attached = game.getBattlefield().getPermanent(uuid);
if (attached != null && attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached != null && attached.hasSubtype(SubType.EQUIPMENT, game)) {
return true;
}
}

View file

@ -64,7 +64,7 @@ public class AuraAttachedCount implements DynamicValue {
List<UUID> attachments = p.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) {
if (attached != null && attached.hasSubtype(SubType.AURA, game)) {
count++;
}
}

View file

@ -1,14 +1,14 @@
package mage.abilities.dynamicvalue.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author Loki
*/
@ -63,19 +63,19 @@ public class DomainValue implements DynamicValue {
}
for (Permanent p : game.getBattlefield().getAllActivePermanents(targetPlayer)) {
if (p.isLand()) {
if (havePlains == 0 && p.getSubtype(game).contains(SubType.PLAINS)) {
if (havePlains == 0 && p.hasSubtype(SubType.PLAINS, game)) {
havePlains = 1;
}
if (haveIslands == 0 && p.getSubtype(game).contains(SubType.ISLAND)) {
if (haveIslands == 0 && p.hasSubtype(SubType.ISLAND, game)) {
haveIslands = 1;
}
if (haveMountains == 0 && p.getSubtype(game).contains(SubType.MOUNTAIN)) {
if (haveMountains == 0 && p.hasSubtype(SubType.MOUNTAIN, game)) {
haveMountains = 1;
}
if (haveSwamps == 0 && p.getSubtype(game).contains(SubType.SWAMP)) {
if (haveSwamps == 0 && p.hasSubtype(SubType.SWAMP, game)) {
haveSwamps = 1;
}
if (haveForests == 0 && p.getSubtype(game).contains(SubType.FOREST)) {
if (haveForests == 0 && p.hasSubtype(SubType.FOREST, game)) {
haveForests = 1;
}
}

View file

@ -27,8 +27,6 @@
*/
package mage.abilities.dynamicvalue.common;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
@ -36,6 +34,9 @@ import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.List;
import java.util.UUID;
/**
*
* @author North, noxx
@ -64,7 +65,7 @@ public class EquipmentAttachedCount implements DynamicValue {
List<UUID> attachments = permanent.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attached = game.getPermanent(attachmentId);
if (attached != null && attached.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attached != null && attached.hasSubtype(SubType.EQUIPMENT, game)) {
count++;
}
}

View file

@ -27,9 +27,6 @@
*/
package mage.abilities.effects.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -51,6 +48,10 @@ import mage.util.CardUtil;
import mage.util.functions.ApplyToPermanent;
import mage.util.functions.EmptyApplyToPermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
*
* @author LevelX2
@ -237,10 +238,10 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
if (tokenToughness != Integer.MIN_VALUE) {
token.getToughness().modifyBaseValue(tokenToughness);
}
if (additionalSubType != null && !token.getSubtype(game).contains(additionalSubType)) {
if (additionalSubType != null && !token.hasSubtype(additionalSubType, game)) {
token.getSubtype(game).add(additionalSubType);
}
if (onlySubType != null && !token.getSubtype(game).contains(onlySubType)) {
if (onlySubType != null && !token.hasSubtype(onlySubType, game)) {
token.getSubtype(game).clear();
token.getSubtype(game).add(onlySubType);
}

View file

@ -59,7 +59,7 @@ public class AddCardSubtypeAllEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if (perm != null && !perm.getSubtype(game).contains(addedSubtype)) {
if (perm != null && !perm.hasSubtype(addedSubtype, game)) {
perm.getSubtype(game).add(addedSubtype);
}
}

View file

@ -59,7 +59,7 @@ public class AddCardSubtypeAttachedEffect extends ContinuousEffectImpl {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent target = game.getPermanent(equipment.getAttachedTo());
if (target != null && !target.getSubtype(game).contains(addedSubtype))
if (target != null && !target.hasSubtype(addedSubtype, game))
target.getSubtype(game).add(addedSubtype);
}
return true;

View file

@ -84,7 +84,7 @@ public class BecomesAuraSourceEffect extends ContinuousEffectImpl implements Sou
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!permanent.getSubtype(game).contains(SubType.AURA)) {
if (!permanent.hasSubtype(SubType.AURA, game)) {
permanent.getSubtype(game).add(SubType.AURA);
}
}

View file

@ -75,27 +75,27 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
for (SubType landType : landTypes) {
switch (landType) {
case SWAMP:
if (permanent.getSubtype(game).contains(SubType.SWAMP)) { // type can be removed by other effect with newer timestamp, so no ability adding
if (permanent.hasSubtype(SubType.SWAMP, game)) { // type can be removed by other effect with newer timestamp, so no ability adding
permanent.addAbility(new BlackManaAbility(), source.getSourceId(), game);
}
break;
case MOUNTAIN:
if (permanent.getSubtype(game).contains(SubType.MOUNTAIN)) {
if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
permanent.addAbility(new RedManaAbility(), source.getSourceId(), game);
}
break;
case FOREST:
if (permanent.getSubtype(game).contains(SubType.FOREST)) {
if (permanent.hasSubtype(SubType.FOREST, game)) {
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
}
break;
case ISLAND:
if (permanent.getSubtype(game).contains(SubType.ISLAND)) {
if (permanent.hasSubtype(SubType.ISLAND, game)) {
permanent.addAbility(new BlueManaAbility(), source.getSourceId(), game);
}
break;
case PLAINS:
if (permanent.getSubtype(game).contains(SubType.PLAINS)) {
if (permanent.hasSubtype(SubType.PLAINS, game)) {
permanent.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
}
break;

View file

@ -149,7 +149,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
} else {
landTypesToAdd.clear();
for (SubType subtype : landTypes) {
if (!land.getSubtype(game).contains(subtype)) {
if (!land.hasSubtype(subtype, game)) {
land.getSubtype(game).add(subtype);
landTypesToAdd.add(subtype);
}

View file

@ -104,7 +104,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
break;
}
for (SubType t : token.getSubtype(game)) {
if (!permanent.getSubtype(game).contains(t)) {
if (!permanent.hasSubtype(t, game)) {
permanent.getSubtype(game).add(t);
}
}

View file

@ -120,7 +120,7 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
break;
}
for (SubType subType : token.getSubtype(game)) {
if (!permanentAttachedTo.getSubtype(game).contains(subType)) {
if (!permanentAttachedTo.hasSubtype(subType, game)) {
permanentAttachedTo.getSubtype(game).add(subType);
}
}

View file

@ -27,7 +27,7 @@ public class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura != null && aura.getAttachedTo() != null) {
Permanent enchanted = game.getPermanent(aura.getAttachedTo());
if (enchanted != null && enchanted.getSubtype(game).contains(SubType.VEHICLE)) {
if (enchanted != null && enchanted.hasSubtype(SubType.VEHICLE, game)) {
enchanted.addCardType(addedType);
}
}

View file

@ -89,7 +89,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
} else {
if (!token.getSubtype(game).isEmpty()) {
for (SubType subtype : token.getSubtype(game)) {
if (!permanent.getSubtype(game).contains(subtype)) {
if (!permanent.hasSubtype(subtype, game)) {
permanent.getSubtype(game).add(subtype);
}
}

View file

@ -77,7 +77,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl {
permanent.getSubtype(game).addAll(subtypes);
} else {
for (SubType subtype : subtypes) {
if (!permanent.getSubtype(game).contains(subtype)) {
if (!permanent.hasSubtype(subtype, game)) {
permanent.getSubtype(game).add(subtype);
}
}

View file

@ -74,7 +74,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl {
permanent.getSubtype(game).addAll(subtypes);
} else {
for (SubType subtype : subtypes) {
if (!permanent.getSubtype(game).contains(subtype)) {
if (!permanent.hasSubtype(subtype, game)) {
permanent.getSubtype(game).add(subtype);
}
}

View file

@ -94,7 +94,7 @@ class AuraSwapEffect extends OneShotEffect {
if (controller != null) {
Permanent auraSourcePermanent = game.getPermanent(source.getSourceId());
if (auraSourcePermanent != null
&& auraSourcePermanent.getSubtype(game).contains(SubType.AURA)
&& auraSourcePermanent.hasSubtype(SubType.AURA, game)
&& auraSourcePermanent.getOwnerId().equals(source.getControllerId())) {
Permanent enchantedPermanent = game.getPermanent(auraSourcePermanent.getAttachedTo());
filterCardToCheck.add(new AuraCardCanAttachToPermanentId(enchantedPermanent.getId()));

View file

@ -188,7 +188,7 @@ class BestowEntersBattlefieldEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent bestowPermanent = game.getPermanentEntering(source.getSourceId());
if (bestowPermanent != null) {
if (bestowPermanent.getSubtype(game).contains(SubType.AURA)) {
if (bestowPermanent.hasSubtype(SubType.AURA, game)) {
MageObject basicObject = bestowPermanent.getBasicMageObject(game);
basicObject.getSubtype(null).add(SubType.AURA);
basicObject.getCardType().remove(CardType.CREATURE);

View file

@ -110,7 +110,7 @@ class EmbalmEffect extends OneShotEffect {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
token.getColor(game).setColor(ObjectColor.WHITE);
if (!token.getSubtype(game).contains(SubType.ZOMBIE)) {
if (!token.hasSubtype(SubType.ZOMBIE, game)) {
token.getSubtype(game).add(0, SubType.ZOMBIE);
}
token.getManaCost().clear();

View file

@ -115,7 +115,7 @@ class EternalizeEffect extends OneShotEffect {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
token.getColor(game).setColor(ObjectColor.BLACK);
if (!token.getSubtype(game).contains(SubType.ZOMBIE)) {
if (!token.hasSubtype(SubType.ZOMBIE, game)) {
token.getSubtype(game).add(0, SubType.ZOMBIE);
}
token.getManaCost().clear();

View file

@ -27,7 +27,6 @@
*/
package mage.abilities.keyword;
import java.util.Iterator;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
@ -38,15 +37,13 @@ import mage.abilities.costs.CostsImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.SpliceCardEffectImpl;
import mage.cards.Card;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import java.util.Iterator;
/**
* 702.45. Splice
@ -183,7 +180,7 @@ class SpliceOntoArcaneEffect extends SpliceCardEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
MageObject object = game.getObject(abilityToModify.getSourceId());
if (object != null && object.getSubtype(game).contains(SubType.ARCANE)) {
if (object != null && object.hasSubtype(SubType.ARCANE, game)) {
return spliceSpellCanBeActivated(source, game);
}
return false;

View file

@ -21,7 +21,7 @@ public class EquippedPredicate implements Predicate<Permanent> {
public boolean apply(Permanent input, Game game) {
for (UUID attachmentId : input.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getSubtype(game).contains(SubType.EQUIPMENT)) {
if (attachment != null && attachment.hasSubtype(SubType.EQUIPMENT, game)) {
return true;
}
}

View file

@ -929,7 +929,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean cantBeAttachedBy(MageObject source, Game game) {
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
if (!(source.getSubtype(game).contains(SubType.AURA)
if (!(source.hasSubtype(SubType.AURA, game)
&& !ability.removesAuras())
&& !source.getId().equals(ability.getAuraIdNotToBeRemoved())
&& !ability.canTarget(source, game)) {

View file

@ -27,10 +27,6 @@
*/
package mage.game.stack;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.Mana;
@ -64,6 +60,11 @@ import mage.players.Player;
import mage.util.GameLog;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -245,7 +246,7 @@ public class Spell extends StackObjImpl implements Card {
}
counter(null, game);
return false;
} else if (this.isEnchantment() && this.getSubtype(game).contains(SubType.AURA)) {
} else if (this.isEnchantment() && this.hasSubtype(SubType.AURA, game)) {
if (ability.getTargets().stillLegal(ability, game)) {
updateOptionalCosts(0);
boolean bestow = ability instanceof BestowAbility;

View file

@ -1,14 +1,17 @@
package mage.util;
import mage.constants.SubType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import mage.constants.SubType;
public class SubTypeList extends ArrayList<SubType> {
@Deprecated
public boolean addAll(List<String> subtypes) {
return addAll(subtypes.stream()

View file

@ -5,13 +5,14 @@
*/
package mage.util.functions;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -26,7 +27,7 @@ public class AddSubtypeApplier extends ApplyToPermanent {
@Override
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
if (!permanent.getSubtype(game).contains(subtype)) {
if (!permanent.hasSubtype(subtype, game)) {
permanent.getSubtype(game).add(subtype);
}
return true;
@ -34,7 +35,7 @@ public class AddSubtypeApplier extends ApplyToPermanent {
@Override
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
if (!mageObject.getSubtype(game).contains(subtype)) {
if (!mageObject.hasSubtype(subtype, game)) {
mageObject.getSubtype(game).add(subtype);
}
return true;