Merge pull request #82 from magefree/master

merge
This commit is contained in:
theelk801 2017-09-25 20:21:01 -04:00 committed by GitHub
commit eb3960bafa
109 changed files with 740 additions and 305 deletions

View file

@ -100,7 +100,7 @@ class AdaptiveAutomatonAddSubtypeEffect extends ContinuousEffectImpl {
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) { if (permanent != null) {
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type"); 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); permanent.getSubtype(game).add(subtype);
} }
} }

View file

@ -27,11 +27,6 @@
*/ */
package mage.cards.a; 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.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility; 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.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
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.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterNonlandPermanent; import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
@ -59,6 +48,8 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetNonlandPermanent; import mage.target.common.TargetNonlandPermanent;
import mage.watchers.Watcher; import mage.watchers.Watcher;
import java.util.*;
/** /**
* *
* @author TheElk801 * @author TheElk801
@ -129,11 +120,11 @@ class DamagedByPiratesWatcher extends Watcher {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
if (((DamagedPlayerEvent) event).isCombatDamage()) { if (((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanentOrLKIBattlefield(event.getSourceId()); 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())) { if (damageSourceIds.keySet().contains(event.getTargetId())) {
damageSourceIds.get(event.getTargetId()).add(creature.getId()); damageSourceIds.get(event.getTargetId()).add(creature.getId());
} else { } else {
Set<UUID> creatureSet = new HashSet(); Set<UUID> creatureSet = new HashSet<>();
creatureSet.add(creature.getId()); creatureSet.add(creature.getId());
damageSourceIds.put(event.getTargetId(), creatureSet); damageSourceIds.put(event.getTargetId(), creatureSet);
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
@ -42,6 +41,8 @@ import mage.game.permanent.token.CatToken;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author Plopman * @author Plopman
@ -95,7 +96,7 @@ class AjanisChosenEffect extends OneShotEffect {
Token token = new CatToken(); Token token = new CatToken();
if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) { if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
Permanent enchantment = game.getPermanent(this.getTargetPointer().getFirst(game, source)); 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()) { for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId); Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) { if (tokenPermanent != null) {

View file

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

View file

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

View file

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

View file

@ -87,7 +87,7 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type"); SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
for (UUID cardId : controller.getGraveyard()) { for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId); 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); game.getState().getCreateCardAttribute(card).getSubtype().add(subtype);
} }
} }

View file

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

View file

@ -109,7 +109,7 @@ class BartelRuneaxeEffect extends ContinuousRuleModifyingEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId()); StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
if (stackObject != null && event.getTargetId().equals(source.getSourceId())) { if (stackObject != null && event.getTargetId().equals(source.getSourceId())) {
if (stackObject.getSubtype(game).contains(SubType.AURA)) { if (stackObject.hasSubtype(SubType.AURA, game)) {
return true; return true;
} }
} }

View file

@ -95,7 +95,7 @@ class DestroyAllAttachedEquipmentEffect extends OneShotEffect {
List<UUID> attachments = new ArrayList<>(target.getAttachments()); List<UUID> attachments = new ArrayList<>(target.getAttachments());
for (UUID attachmentId : attachments) { for (UUID attachmentId : attachments) {
Permanent attachment = game.getPermanent(attachmentId); 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); attachment.destroy(source.getSourceId(), game, false);
} }
} }

View file

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

View file

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

View file

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

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility; import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -52,6 +51,8 @@ import mage.target.TargetPlayer;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author BetaSteward * @author BetaSteward
@ -107,7 +108,7 @@ class CurseOfMisfortunesEffect extends OneShotEffect {
// get the names of attached Curses // get the names of attached Curses
for (UUID attachmentId: targetPlayer.getAttachments()) { for (UUID attachmentId: targetPlayer.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId); 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()))); filter.add(Predicates.not(new NamePredicate(attachment.getName())));
} }
} }

View file

@ -136,7 +136,7 @@ class CursesAttachedCount implements DynamicValue {
if (player != null) { if (player != null) {
for (UUID attachmentId: player.getAttachments()) { for (UUID attachmentId: player.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId); Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getSubtype(game).contains(SubType.CURSE)) if (attachment != null && attachment.hasSubtype(SubType.CURSE, game))
count++; count++;
} }
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.effects.common.TransformSourceEffect;
@ -42,6 +41,8 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/** /**
* *
* @author fireshoes * @author fireshoes
@ -96,7 +97,7 @@ class DaringSleuthTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId()) 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 @Override

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -42,6 +41,8 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
* *
* @author TheElk801 * @author TheElk801
@ -90,7 +91,7 @@ class DauntingDefenderEffect extends PreventionEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) { if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
Permanent permanent = game.getPermanent(event.getTargetId()); 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); return super.applies(event, source, game);
} }
} }

View file

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

View file

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

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.e; package mage.cards.e;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -39,14 +38,12 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.BestowAbility; import mage.abilities.keyword.BestowAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
* *
* @author Quercitron * @author Quercitron
@ -98,7 +95,7 @@ class EverflameEidolonEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceObject != null) { 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); game.addEffect(new BoostEnchantedEffect(1, 0, Duration.EndOfTurn), source);
} else { } else {
game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source); game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);

View file

@ -103,7 +103,7 @@ class FleetingMemoriesTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId()) 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 @Override

View file

@ -0,0 +1,75 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.PreventDamageByTargetEffect;
import mage.abilities.effects.common.PreventDamageToTargetEffect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.target.common.TargetAttackingCreature;
/**
*
* @author L_J
*/
public class Foxfire extends CardImpl {
public Foxfire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}");
// Untap target attacking creature. Prevent all combat damage that would be dealt to and dealt by that creature this turn.
this.getSpellAbility().addTarget(new TargetAttackingCreature());
this.getSpellAbility().addEffect(new UntapTargetEffect());
this.getSpellAbility().addEffect(new PreventDamageByTargetEffect(Duration.EndOfTurn, true));
this.getSpellAbility().addEffect(new PreventDamageToTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE, true));
// Draw a card at the beginning of the next turn's upkeep.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(1)),false));
}
public Foxfire(final Foxfire card) {
super(card);
}
@Override
public Foxfire copy() {
return new Foxfire(this);
}
}

View file

@ -99,7 +99,7 @@ class CantBeEquippedSourceEffect extends ContinuousRuleModifyingEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) { if (event.getTargetId().equals(source.getSourceId())) {
Permanent permanent = game.getPermanent(event.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; return true;
} }
} }

View file

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

View file

@ -36,7 +36,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;

View file

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

View file

@ -91,7 +91,7 @@ class GrafMoleTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId()) 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 @Override

View file

@ -0,0 +1,73 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.g;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.FilterObject;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
/**
*
* @author L_J
*/
public class GreaterRealmOfPreservation extends CardImpl {
private static final FilterObject filter = new FilterObject("black or red source");
static{
filter.add(Predicates.or(new ColorPredicate(ObjectColor.BLACK), new ColorPredicate(ObjectColor.RED)));
}
public GreaterRealmOfPreservation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
// {1}{W}: The next time a black or red source of your choice would deal damage to you this turn, prevent that damage.
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{W}")));
}
public GreaterRealmOfPreservation(final GreaterRealmOfPreservation card) {
super(card);
}
@Override
public GreaterRealmOfPreservation copy() {
return new GreaterRealmOfPreservation(this);
}
}

View file

@ -142,7 +142,7 @@ class GuardianBeastConditionalEffect extends ContinuousRuleModifyingEffectImpl {
} }
StackObject spell = game.getStack().getStackObject(event.getSourceId()); 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)) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
if (perm != null && Objects.equals(perm.getId(), targetPermanent.getId()) && !perm.isCreature()) { if (perm != null && Objects.equals(perm.getId(), targetPermanent.getId()) && !perm.isCreature()) {
return true; return true;

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.LandfallAbility; import mage.abilities.common.LandfallAbility;
@ -41,6 +40,8 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -91,7 +92,7 @@ class GuulDrazOverseerEffect extends OneShotEffect {
Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
if (controller != null && land != null) { if (controller != null && land != null) {
int boost = 1; int boost = 1;
if (land.getSubtype(game).contains(SubType.SWAMP)) { if (land.hasSubtype(SubType.SWAMP, game)) {
boost = 2; boost = 2;
} }
game.addEffect(new BoostControlledEffect(boost, 0, Duration.EndOfTurn, true), source); game.addEffect(new BoostControlledEffect(boost, 0, Duration.EndOfTurn, true), source);

View file

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

View file

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

View file

@ -123,7 +123,7 @@ class KarnLiberatedEffect extends OneShotEffect {
for (ExileZone zone : game.getExile().getExileZones()) { for (ExileZone zone : game.getExile().getExileZones()) {
if (zone.getId().equals(exileId)) { if (zone.getId().equals(exileId)) {
for (Card card : zone.getCards(game)) { 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); cards.add(card);
} }
} }
@ -155,7 +155,7 @@ class KarnLiberatedEffect extends OneShotEffect {
} }
for (Card card : cards) { for (Card card : cards) {
game.getState().setZone(card.getId(), Zone.EXILED); 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); game.getExile().add(exileId, sourceObject.getIdName(), card);
} }
} }

View file

@ -84,7 +84,7 @@ class SourceIsEquiped implements Condition {
for (UUID attachmentUUID : attachments) { for (UUID attachmentUUID : attachments) {
Permanent attachment = game.getPermanent(attachmentUUID); Permanent attachment = game.getPermanent(attachmentUUID);
if (attachment != null) { if (attachment != null) {
if (attachment.getSubtype(game).contains(SubType.EQUIPMENT)) { if (attachment.hasSubtype(SubType.EQUIPMENT, game)) {
return true; return true;
} }
} }

View file

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

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.l; package mage.cards.l;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
@ -38,15 +37,13 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AttachmentType; import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.UUID;
/** /**
* *
* @author Styxo * @author Styxo
@ -73,7 +70,7 @@ public class Lightsaber extends CardImpl {
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
if (ability instanceof EquipAbility) { if (ability instanceof EquipAbility) {
Permanent targetCreature = game.getPermanent(ability.getTargets().getFirstTarget()); 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()); CardUtil.increaseCost(ability, 1 - ability.getManaCostsToPay().convertedManaCost());
} }
} }

View file

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

View file

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

View file

@ -108,7 +108,7 @@ class MarkOfEvictionEffect extends OneShotEffect {
toHand.add(enchanted); toHand.add(enchanted);
for (UUID attachmentId : enchanted.getAttachments()) { for (UUID attachmentId : enchanted.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId); 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); toHand.add(attachment);
} }
} }

View file

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

View file

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

View file

@ -142,7 +142,7 @@ class NecromancersMagemarkEffect extends ReplacementEffectImpl {
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
for (UUID attachmentId : permanent.getAttachments()) { for (UUID attachmentId : permanent.getAttachments()) {
Permanent attachment = game.getPermanentOrLKIBattlefield(attachmentId); Permanent attachment = game.getPermanentOrLKIBattlefield(attachmentId);
if (attachment != null && attachment.getSubtype(game).contains(SubType.AURA)) { if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) {
return true; return true;
} }
} }

View file

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

View file

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

View file

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

View file

@ -119,7 +119,7 @@ class OrzhovCharmReturnToHandEffect extends OneShotEffect {
for (UUID attachmentId : attachments) { for (UUID attachmentId : attachments) {
Permanent attachment = game.getPermanent(attachmentId); Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getControllerId().equals(source.getControllerId()) 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); attachment.moveToZone(Zone.HAND, source.getSourceId(), game, false);
} }
} }

View file

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

View file

@ -115,7 +115,7 @@ class PlaneswalkersMischiefEffect extends OneShotEffect {
effect.setTargetPointer(new FixedTarget(revealedCard.getId())); effect.setTargetPointer(new FixedTarget(revealedCard.getId()));
game.addEffect(effect, source); game.addEffect(effect, source);
OneShotEffect effect2 = new ReturnFromExileEffect(source.getSourceId(), Zone.HAND); OneShotEffect effect2 = new ReturnFromExileEffect(source.getSourceId(), Zone.HAND);
Condition condition = new SpellWasNotCastCondition(source.getSourceId(), revealedCard.getId()); Condition condition = new PlaneswalkersMischiefCondition(source.getSourceId(), revealedCard.getId());
ConditionalOneShotEffect effect3 = new ConditionalOneShotEffect(effect2, condition, "if you haven't cast it, return it to its owner's hand."); ConditionalOneShotEffect effect3 = new ConditionalOneShotEffect(effect2, condition, "if you haven't cast it, return it to its owner's hand.");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect3); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect3);
game.addDelayedTriggeredAbility(delayedAbility, source); game.addDelayedTriggeredAbility(delayedAbility, source);
@ -163,12 +163,12 @@ class PlaneswalkersMischiefCastFromExileEffect extends AsThoughEffectImpl {
} }
} }
class SpellWasNotCastCondition implements Condition { class PlaneswalkersMischiefCondition implements Condition {
protected UUID exileId; protected UUID exileId;
protected UUID cardId; protected UUID cardId;
public SpellWasNotCastCondition(UUID exileId, UUID cardId) { public PlaneswalkersMischiefCondition(UUID exileId, UUID cardId) {
this.exileId = exileId; this.exileId = exileId;
this.cardId = cardId; this.cardId = cardId;
} }

View file

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

View file

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

View file

@ -42,8 +42,6 @@ import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.filter.common.FilterInstantOrSorceryCard; import mage.filter.common.FilterInstantOrSorceryCard;
import mage.constants.AsThoughEffectType; import mage.constants.AsThoughEffectType;
import mage.constants.CardType; import mage.constants.CardType;
@ -58,7 +56,6 @@ import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.SpellsCastWatcher; import mage.watchers.common.SpellsCastWatcher;
/** /**
* *
* @author L_J (significantly based on code by jeffwadsworth and Styxo) * @author L_J (significantly based on code by jeffwadsworth and Styxo)
@ -127,7 +124,7 @@ class PsychicTheftEffect extends OneShotEffect {
game.addEffect(effect, source); game.addEffect(effect, source);
OneShotEffect effect2 = new ReturnFromExileEffect(source.getSourceId(), Zone.HAND); OneShotEffect effect2 = new ReturnFromExileEffect(source.getSourceId(), Zone.HAND);
Condition condition = new SpellWasNotCastCondition(source.getSourceId(), chosenCard.getId()); Condition condition = new PsychicTheftCondition(source.getSourceId(), chosenCard.getId());
ConditionalOneShotEffect effect3 = new ConditionalOneShotEffect(effect2, condition, "if you haven't cast it, return it to its owner's hand."); ConditionalOneShotEffect effect3 = new ConditionalOneShotEffect(effect2, condition, "if you haven't cast it, return it to its owner's hand.");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect3); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect3);
@ -176,12 +173,12 @@ class PsychicTheftCastFromExileEffect extends AsThoughEffectImpl {
} }
} }
class SpellWasNotCastCondition implements Condition { class PsychicTheftCondition implements Condition {
protected UUID exileId; protected UUID exileId;
protected UUID cardId; protected UUID cardId;
public SpellWasNotCastCondition(UUID exileId, UUID cardId) { public PsychicTheftCondition(UUID exileId, UUID cardId) {
this.exileId = exileId; this.exileId = exileId;
this.cardId = cardId; this.cardId = cardId;
} }

View file

@ -111,7 +111,7 @@ class RealmwrightEffect2 extends ContinuousEffectImpl {
if (land != null) { if (land != null) {
switch (layer) { switch (layer) {
case TypeChangingEffects_4: 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); land.getSubtype(game).add(choice);
} }
break; break;

View file

@ -0,0 +1,111 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.WishEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
*
* @author L_J
*/
public class RingOfMaruf extends CardImpl {
public RingOfMaruf(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
// {5}, {Tap}, Exile Ring of Maruf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RingOfMarufEffect(), new ManaCostsImpl("{5}"));
ability.addCost(new TapSourceCost());
ability.addCost(new ExileSourceCost());
this.addAbility(ability);
}
public RingOfMaruf(final RingOfMaruf card) {
super(card);
}
@Override
public RingOfMaruf copy() {
return new RingOfMaruf(this);
}
}
class RingOfMarufEffect extends ReplacementEffectImpl {
public RingOfMarufEffect() {
super(Duration.EndOfTurn, Outcome.Benefit);
staticText = "The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.";
}
public RingOfMarufEffect(final RingOfMarufEffect effect) {
super(effect);
}
@Override
public RingOfMarufEffect copy() {
return new RingOfMarufEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
new WishEffect(new FilterCard(), false).apply(game, source);
this.discard();
return true;
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_CARD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.getControllerId().equals(event.getPlayerId());
}
}

View file

@ -105,7 +105,7 @@ class RiptideShapeshifterEffect extends OneShotEffect {
Cards revealedCards = new CardsImpl(); Cards revealedCards = new CardsImpl();
while (controller.getLibrary().hasCards()) { while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game); 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); controller.moveCards(card, Zone.BATTLEFIELD, source, game);
break; break;
} }

View file

@ -0,0 +1,115 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.r;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
*
* @author L_J
*/
public class RishadanPawnshop extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("nontoken permanent you control");
static {
filter.add(Predicates.not(new TokenPredicate()));
filter.add(new ControllerPredicate(TargetController.YOU));
}
public RishadanPawnshop(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
// Shuffle target nontoken permanent you control into its owner's library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RishadanPawnshopShuffleIntoLibraryEffect(), new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
public RishadanPawnshop(final RishadanPawnshop card) {
super(card);
}
@Override
public RishadanPawnshop copy() {
return new RishadanPawnshop(this);
}
}
class RishadanPawnshopShuffleIntoLibraryEffect extends OneShotEffect {
public RishadanPawnshopShuffleIntoLibraryEffect() {
super(Outcome.Detriment);
this.staticText = "The owner of target nontoken permanent you control shuffles it into his or her library";
}
public RishadanPawnshopShuffleIntoLibraryEffect(final RishadanPawnshopShuffleIntoLibraryEffect effect) {
super(effect);
}
@Override
public RishadanPawnshopShuffleIntoLibraryEffect copy() {
return new RishadanPawnshopShuffleIntoLibraryEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
Player owner = game.getPlayer(permanent.getOwnerId());
if (owner != null) {
owner.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, true);
owner.shuffleLibrary(source, game);
return true;
}
}
return false;
}
}

View file

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

View file

@ -101,7 +101,7 @@ class SilenceTheBelieversExileEffect extends OneShotEffect {
List<UUID> attachments = new ArrayList<>(creature.getAttachments()); List<UUID> attachments = new ArrayList<>(creature.getAttachments());
for (UUID attachmentId: attachments) { for (UUID attachmentId: attachments) {
Permanent attachment = game.getPermanent(attachmentId); 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); controller.moveCardToExileWithInfo(attachment, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true);
} }
} }

View file

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

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.common.ExileTargetCost; import mage.abilities.costs.common.ExileTargetCost;
@ -36,8 +35,8 @@ import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffec
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.game.Game; import mage.game.Game;
@ -45,8 +44,9 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author MarcoMarin * @author MarcoMarin
*/ */
public class SoulExchange extends CardImpl { public class SoulExchange extends CardImpl {
@ -101,7 +101,7 @@ class SoulExchangeEffect extends OneShotEffect{
if (c.isPaid() && c instanceof ExileTargetCost) { if (c.isPaid() && c instanceof ExileTargetCost) {
for (Permanent exiled : ((ExileTargetCost) c).getPermanents()) { for (Permanent exiled : ((ExileTargetCost) c).getPermanents()) {
if (exiled != null) { if (exiled != null) {
if(exiled.getSubtype(game).contains(SubType.THRULL)){ if (exiled.hasSubtype(SubType.THRULL, game)) {
game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), source, game); game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), source, game);
return true; return true;
} }

View file

@ -27,22 +27,18 @@
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -90,7 +86,7 @@ class StartYourEnginesEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { 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) { if (sublayer == SubLayer.NA) {
permanent.addCardType(CardType.ARTIFACT); permanent.addCardType(CardType.ARTIFACT);
permanent.addCardType(CardType.CREATURE);// TODO: Chcek if giving CREATURE Type is correct 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)) { for (Permanent land : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), game)) {
switch (layer) { switch (layer) {
case TypeChangingEffects_4: case TypeChangingEffects_4:
if (!land.getSubtype(game).contains(SubType.ISLAND)) { if (!land.hasSubtype(SubType.ISLAND, game)) {
land.getSubtype(game).add(SubType.ISLAND); land.getSubtype(game).add(SubType.ISLAND);
} }
break; break;

View file

@ -108,7 +108,7 @@ class StreetSweeperDestroyEffect extends OneShotEffect {
for(UUID uuid : attachments) for(UUID uuid : attachments)
{ {
Permanent aura = game.getPermanent(uuid); 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); aura.destroy(source.getSourceId(), game, false);
} }

View file

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

View file

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

View file

@ -0,0 +1,83 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.OrCost;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterUnlessPaysEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.TargetSpell;
/**
*
* @author L_J
*/
public class ThrullWizard extends CardImpl {
private static final FilterSpell filter = new FilterSpell("black spell");
static{
filter.add(new ColorPredicate(ObjectColor.BLACK));
}
public ThrullWizard(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
this.subtype.add(SubType.THRULL);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {1}{B}: Counter target black spell unless that spell's controller pays {B} or {3}.
Cost cost = new OrCost(new ColoredManaCost(ColoredManaSymbol.B), new GenericManaCost(3), "pay {B} or pay {3}");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(cost), new ManaCostsImpl("{1}{B}"));
ability.addTarget(new TargetSpell(filter));
this.addAbility(ability);
}
public ThrullWizard(final ThrullWizard card) {
super(card);
}
@Override
public ThrullWizard copy() {
return new ThrullWizard(this);
}
}

View file

@ -106,7 +106,7 @@ class TirelessTrackerTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId()) 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 @Override

View file

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

View file

@ -92,7 +92,7 @@ class TreefolkMysticEffect extends OneShotEffect {
attachments.addAll(permanent.getAttachments()); attachments.addAll(permanent.getAttachments());
for (UUID uuid : attachments) { for (UUID uuid : attachments) {
Permanent aura = game.getPermanent(uuid); 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); aura.destroy(source.getSourceId(), game, false);
} }
} }

View file

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

View file

@ -108,7 +108,7 @@ class UlvenwaldMysteriesTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId()) 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 @Override

View file

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

View file

@ -92,7 +92,7 @@ class WitchbaneOrbEffect extends OneShotEffect {
List<Permanent> toDestroy = new ArrayList<>(); List<Permanent> toDestroy = new ArrayList<>();
for (UUID attachmentId : controller.getAttachments()) { for (UUID attachmentId : controller.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId); 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); toDestroy.add(attachment);
} }
} }

View file

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

View file

@ -130,6 +130,7 @@ public class ArabianNights extends ExpansionSet {
cards.add(new SetCardInfo("Piety", 65, Rarity.COMMON, Piety.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Piety", 65, Rarity.COMMON, Piety.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Pyramids", 81, Rarity.RARE, mage.cards.p.Pyramids.class)); cards.add(new SetCardInfo("Pyramids", 81, Rarity.RARE, mage.cards.p.Pyramids.class));
cards.add(new SetCardInfo("Repentant Blacksmith", 66, Rarity.RARE, mage.cards.r.RepentantBlacksmith.class)); cards.add(new SetCardInfo("Repentant Blacksmith", 66, Rarity.RARE, mage.cards.r.RepentantBlacksmith.class));
cards.add(new SetCardInfo("Ring of Ma'rûf", 82, Rarity.RARE, mage.cards.r.RingOfMaruf.class));
cards.add(new SetCardInfo("Rukh Egg", 52, Rarity.COMMON, RukhEgg.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Rukh Egg", 52, Rarity.COMMON, RukhEgg.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Rukh Egg", 53, Rarity.COMMON, RukhEgg.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Rukh Egg", 53, Rarity.COMMON, RukhEgg.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Sandals of Abdallah", 83, Rarity.UNCOMMON, mage.cards.s.SandalsOfAbdallah.class)); cards.add(new SetCardInfo("Sandals of Abdallah", 83, Rarity.UNCOMMON, mage.cards.s.SandalsOfAbdallah.class));

View file

@ -235,6 +235,7 @@ public class FallenEmpires extends ExpansionSet {
cards.add(new SetCardInfo("Thorn Thallid", 99, Rarity.COMMON, ThornThallid.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Thorn Thallid", 99, Rarity.COMMON, ThornThallid.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Thrull Champion", 29, Rarity.RARE, mage.cards.t.ThrullChampion.class)); cards.add(new SetCardInfo("Thrull Champion", 29, Rarity.RARE, mage.cards.t.ThrullChampion.class));
cards.add(new SetCardInfo("Thrull Retainer", 30, Rarity.UNCOMMON, mage.cards.t.ThrullRetainer.class)); cards.add(new SetCardInfo("Thrull Retainer", 30, Rarity.UNCOMMON, mage.cards.t.ThrullRetainer.class));
cards.add(new SetCardInfo("Thrull Wizard", 31, Rarity.UNCOMMON, mage.cards.t.ThrullWizard.class));
cards.add(new SetCardInfo("Tidal Influence", 57, Rarity.UNCOMMON, mage.cards.t.TidalInfluence.class)); cards.add(new SetCardInfo("Tidal Influence", 57, Rarity.UNCOMMON, mage.cards.t.TidalInfluence.class));
cards.add(new SetCardInfo("Vodalian Knights", 58, Rarity.RARE, mage.cards.v.VodalianKnights.class)); cards.add(new SetCardInfo("Vodalian Knights", 58, Rarity.RARE, mage.cards.v.VodalianKnights.class));
cards.add(new SetCardInfo("Vodalian Mage", 59, Rarity.COMMON, VodalianMage.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Vodalian Mage", 59, Rarity.COMMON, VodalianMage.class, NON_FULL_USE_VARIOUS));

View file

@ -177,6 +177,7 @@ public class FifthEdition extends ExpansionSet {
cards.add(new SetCardInfo("Forest", 419, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Forest", 419, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Forest", 420, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Forest", 420, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Forget", 89, Rarity.RARE, mage.cards.f.Forget.class)); cards.add(new SetCardInfo("Forget", 89, Rarity.RARE, mage.cards.f.Forget.class));
cards.add(new SetCardInfo("Foxfire", 157, Rarity.COMMON, mage.cards.f.Foxfire.class));
cards.add(new SetCardInfo("Fountain of Youth", 372, Rarity.UNCOMMON, mage.cards.f.FountainOfYouth.class)); cards.add(new SetCardInfo("Fountain of Youth", 372, Rarity.UNCOMMON, mage.cards.f.FountainOfYouth.class));
cards.add(new SetCardInfo("Frozen Shade", 25, Rarity.COMMON, mage.cards.f.FrozenShade.class)); cards.add(new SetCardInfo("Frozen Shade", 25, Rarity.COMMON, mage.cards.f.FrozenShade.class));
cards.add(new SetCardInfo("Fungusaur", 158, Rarity.RARE, mage.cards.f.Fungusaur.class)); cards.add(new SetCardInfo("Fungusaur", 158, Rarity.RARE, mage.cards.f.Fungusaur.class));
@ -196,6 +197,7 @@ public class FifthEdition extends ExpansionSet {
cards.add(new SetCardInfo("Goblin War Drums", 237, Rarity.COMMON, GoblinWarDrums.class)); cards.add(new SetCardInfo("Goblin War Drums", 237, Rarity.COMMON, GoblinWarDrums.class));
cards.add(new SetCardInfo("Goblin Warrens", 238, Rarity.RARE, mage.cards.g.GoblinWarrens.class)); cards.add(new SetCardInfo("Goblin Warrens", 238, Rarity.RARE, mage.cards.g.GoblinWarrens.class));
cards.add(new SetCardInfo("Grapeshot Catapult", 375, Rarity.COMMON, mage.cards.g.GrapeshotCatapult.class)); cards.add(new SetCardInfo("Grapeshot Catapult", 375, Rarity.COMMON, mage.cards.g.GrapeshotCatapult.class));
cards.add(new SetCardInfo("Greater Realm of Preservation", 307, Rarity.UNCOMMON, mage.cards.g.GreaterRealmOfPreservation.class));
cards.add(new SetCardInfo("Grizzly Bears", 163, Rarity.COMMON, mage.cards.g.GrizzlyBears.class)); cards.add(new SetCardInfo("Grizzly Bears", 163, Rarity.COMMON, mage.cards.g.GrizzlyBears.class));
cards.add(new SetCardInfo("Havenwood Battleground", 421, Rarity.UNCOMMON, mage.cards.h.HavenwoodBattleground.class)); cards.add(new SetCardInfo("Havenwood Battleground", 421, Rarity.UNCOMMON, mage.cards.h.HavenwoodBattleground.class));
cards.add(new SetCardInfo("Heal", 308, Rarity.COMMON, mage.cards.h.Heal.class)); cards.add(new SetCardInfo("Heal", 308, Rarity.COMMON, mage.cards.h.Heal.class));

View file

@ -129,6 +129,7 @@ public class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Forgotten Lore", 125, Rarity.UNCOMMON, mage.cards.f.ForgottenLore.class)); cards.add(new SetCardInfo("Forgotten Lore", 125, Rarity.UNCOMMON, mage.cards.f.ForgottenLore.class));
cards.add(new SetCardInfo("Foul Familiar", 14, Rarity.COMMON, mage.cards.f.FoulFamiliar.class)); cards.add(new SetCardInfo("Foul Familiar", 14, Rarity.COMMON, mage.cards.f.FoulFamiliar.class));
cards.add(new SetCardInfo("Freyalise's Charm", 128, Rarity.UNCOMMON, mage.cards.f.FreyalisesCharm.class)); cards.add(new SetCardInfo("Freyalise's Charm", 128, Rarity.UNCOMMON, mage.cards.f.FreyalisesCharm.class));
cards.add(new SetCardInfo("Foxfire", 126, Rarity.COMMON, mage.cards.f.Foxfire.class));
cards.add(new SetCardInfo("Fumarole", 369, Rarity.UNCOMMON, mage.cards.f.Fumarole.class)); cards.add(new SetCardInfo("Fumarole", 369, Rarity.UNCOMMON, mage.cards.f.Fumarole.class));
cards.add(new SetCardInfo("Fyndhorn Bow", 293, Rarity.UNCOMMON, mage.cards.f.FyndhornBow.class)); cards.add(new SetCardInfo("Fyndhorn Bow", 293, Rarity.UNCOMMON, mage.cards.f.FyndhornBow.class));
cards.add(new SetCardInfo("Fyndhorn Brownie", 130, Rarity.COMMON, mage.cards.f.FyndhornBrownie.class)); cards.add(new SetCardInfo("Fyndhorn Brownie", 130, Rarity.COMMON, mage.cards.f.FyndhornBrownie.class));

View file

@ -124,6 +124,7 @@ public class Legends extends ExpansionSet {
cards.add(new SetCardInfo("Giant Strength", 147, Rarity.COMMON, mage.cards.g.GiantStrength.class)); cards.add(new SetCardInfo("Giant Strength", 147, Rarity.COMMON, mage.cards.g.GiantStrength.class));
cards.add(new SetCardInfo("Gravity Sphere", 149, Rarity.RARE, mage.cards.g.GravitySphere.class)); cards.add(new SetCardInfo("Gravity Sphere", 149, Rarity.RARE, mage.cards.g.GravitySphere.class));
cards.add(new SetCardInfo("Great Defender", 185, Rarity.UNCOMMON, mage.cards.g.GreatDefender.class)); cards.add(new SetCardInfo("Great Defender", 185, Rarity.UNCOMMON, mage.cards.g.GreatDefender.class));
cards.add(new SetCardInfo("Greater Realm of Preservation", 187, Rarity.UNCOMMON, mage.cards.g.GreaterRealmOfPreservation.class));
cards.add(new SetCardInfo("Greed", 15, Rarity.RARE, mage.cards.g.Greed.class)); cards.add(new SetCardInfo("Greed", 15, Rarity.RARE, mage.cards.g.Greed.class));
cards.add(new SetCardInfo("Green Mana Battery", 223, Rarity.UNCOMMON, mage.cards.g.GreenManaBattery.class)); cards.add(new SetCardInfo("Green Mana Battery", 223, Rarity.UNCOMMON, mage.cards.g.GreenManaBattery.class));
cards.add(new SetCardInfo("Gwendlyn Di Corci", 268, Rarity.RARE, mage.cards.g.GwendlynDiCorci.class)); cards.add(new SetCardInfo("Gwendlyn Di Corci", 268, Rarity.RARE, mage.cards.g.GwendlynDiCorci.class));

View file

@ -128,6 +128,7 @@ public class MastersEdition extends ExpansionSet {
cards.add(new SetCardInfo("Goblins of the Flarg", 98, Rarity.COMMON, mage.cards.g.GoblinsOfTheFlarg.class)); cards.add(new SetCardInfo("Goblins of the Flarg", 98, Rarity.COMMON, mage.cards.g.GoblinsOfTheFlarg.class));
cards.add(new SetCardInfo("Goblin Wizard", 97, Rarity.RARE, mage.cards.g.GoblinWizard.class)); cards.add(new SetCardInfo("Goblin Wizard", 97, Rarity.RARE, mage.cards.g.GoblinWizard.class));
cards.add(new SetCardInfo("Granite Gargoyle", 99, Rarity.UNCOMMON, mage.cards.g.GraniteGargoyle.class)); cards.add(new SetCardInfo("Granite Gargoyle", 99, Rarity.UNCOMMON, mage.cards.g.GraniteGargoyle.class));
cards.add(new SetCardInfo("Greater Realm of Preservation", 13, Rarity.UNCOMMON, mage.cards.g.GreaterRealmOfPreservation.class));
cards.add(new SetCardInfo("Hallowed Ground", 14, Rarity.UNCOMMON, mage.cards.h.HallowedGround.class)); cards.add(new SetCardInfo("Hallowed Ground", 14, Rarity.UNCOMMON, mage.cards.h.HallowedGround.class));
cards.add(new SetCardInfo("Hand of Justice", 15, Rarity.RARE, mage.cards.h.HandOfJustice.class)); cards.add(new SetCardInfo("Hand of Justice", 15, Rarity.RARE, mage.cards.h.HandOfJustice.class));
cards.add(new SetCardInfo("Hecatomb", 71, Rarity.RARE, mage.cards.h.Hecatomb.class)); cards.add(new SetCardInfo("Hecatomb", 71, Rarity.RARE, mage.cards.h.Hecatomb.class));
@ -196,6 +197,7 @@ public class MastersEdition extends ExpansionSet {
cards.add(new SetCardInfo("Rabid Wombat", 126, Rarity.UNCOMMON, mage.cards.r.RabidWombat.class)); cards.add(new SetCardInfo("Rabid Wombat", 126, Rarity.UNCOMMON, mage.cards.r.RabidWombat.class));
cards.add(new SetCardInfo("Rainbow Vale", 179, Rarity.RARE, mage.cards.r.RainbowVale.class)); cards.add(new SetCardInfo("Rainbow Vale", 179, Rarity.RARE, mage.cards.r.RainbowVale.class));
cards.add(new SetCardInfo("Righteous Avengers", 25, Rarity.COMMON, mage.cards.r.RighteousAvengers.class)); cards.add(new SetCardInfo("Righteous Avengers", 25, Rarity.COMMON, mage.cards.r.RighteousAvengers.class));
cards.add(new SetCardInfo("Ring of Ma'rûf", 163, Rarity.RARE, mage.cards.r.RingOfMaruf.class));
cards.add(new SetCardInfo("River Merfolk", 47, Rarity.COMMON, mage.cards.r.RiverMerfolk.class)); cards.add(new SetCardInfo("River Merfolk", 47, Rarity.COMMON, mage.cards.r.RiverMerfolk.class));
cards.add(new SetCardInfo("Roots", 127, Rarity.COMMON, mage.cards.r.Roots.class)); cards.add(new SetCardInfo("Roots", 127, Rarity.COMMON, mage.cards.r.Roots.class));
cards.add(new SetCardInfo("Scryb Sprites", 128, Rarity.COMMON, mage.cards.s.ScrybSprites.class)); cards.add(new SetCardInfo("Scryb Sprites", 128, Rarity.COMMON, mage.cards.s.ScrybSprites.class));

View file

@ -255,6 +255,7 @@ public class MercadianMasques extends ExpansionSet {
cards.add(new SetCardInfo("Rishadan Brigand", 92, Rarity.RARE, mage.cards.r.RishadanBrigand.class)); cards.add(new SetCardInfo("Rishadan Brigand", 92, Rarity.RARE, mage.cards.r.RishadanBrigand.class));
cards.add(new SetCardInfo("Rishadan Cutpurse", 93, Rarity.COMMON, mage.cards.r.RishadanCutpurse.class)); cards.add(new SetCardInfo("Rishadan Cutpurse", 93, Rarity.COMMON, mage.cards.r.RishadanCutpurse.class));
cards.add(new SetCardInfo("Rishadan Footpad", 94, Rarity.UNCOMMON, mage.cards.r.RishadanFootpad.class)); cards.add(new SetCardInfo("Rishadan Footpad", 94, Rarity.UNCOMMON, mage.cards.r.RishadanFootpad.class));
cards.add(new SetCardInfo("Rishadan Pawnshop", 311, Rarity.RARE, mage.cards.r.RishadanPawnshop.class));
cards.add(new SetCardInfo("Rishadan Port", 324, Rarity.RARE, mage.cards.r.RishadanPort.class)); cards.add(new SetCardInfo("Rishadan Port", 324, Rarity.RARE, mage.cards.r.RishadanPort.class));
cards.add(new SetCardInfo("Rock Badger", 210, Rarity.UNCOMMON, mage.cards.r.RockBadger.class)); cards.add(new SetCardInfo("Rock Badger", 210, Rarity.UNCOMMON, mage.cards.r.RockBadger.class));
cards.add(new SetCardInfo("Rushwood Dryad", 263, Rarity.COMMON, mage.cards.r.RushwoodDryad.class)); cards.add(new SetCardInfo("Rushwood Dryad", 263, Rarity.COMMON, mage.cards.r.RushwoodDryad.class));

View file

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

View file

@ -58,7 +58,7 @@ public class AuraAttachedTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getSourceId())) { if (event.getTargetId().equals(this.getSourceId())) {
Permanent attachment = game.getPermanent(event.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; return true;
} }
} }

View file

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

View file

@ -50,7 +50,7 @@ public enum EquippedSourceCondition implements Condition {
if (permanent != null) { if (permanent != null) {
for (UUID uuid : permanent.getAttachments()) { for (UUID uuid : permanent.getAttachments()) {
Permanent attached = game.getBattlefield().getPermanent(uuid); 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; return true;
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -59,7 +59,7 @@ public class AddCardSubtypeAllEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { 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); perm.getSubtype(game).add(addedSubtype);
} }
} }

View file

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

View file

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

View file

@ -75,27 +75,27 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
for (SubType landType : landTypes) { for (SubType landType : landTypes) {
switch (landType) { switch (landType) {
case SWAMP: 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); permanent.addAbility(new BlackManaAbility(), source.getSourceId(), game);
} }
break; break;
case MOUNTAIN: case MOUNTAIN:
if (permanent.getSubtype(game).contains(SubType.MOUNTAIN)) { if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
permanent.addAbility(new RedManaAbility(), source.getSourceId(), game); permanent.addAbility(new RedManaAbility(), source.getSourceId(), game);
} }
break; break;
case FOREST: case FOREST:
if (permanent.getSubtype(game).contains(SubType.FOREST)) { if (permanent.hasSubtype(SubType.FOREST, game)) {
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game); permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
} }
break; break;
case ISLAND: case ISLAND:
if (permanent.getSubtype(game).contains(SubType.ISLAND)) { if (permanent.hasSubtype(SubType.ISLAND, game)) {
permanent.addAbility(new BlueManaAbility(), source.getSourceId(), game); permanent.addAbility(new BlueManaAbility(), source.getSourceId(), game);
} }
break; break;
case PLAINS: case PLAINS:
if (permanent.getSubtype(game).contains(SubType.PLAINS)) { if (permanent.hasSubtype(SubType.PLAINS, game)) {
permanent.addAbility(new WhiteManaAbility(), source.getSourceId(), game); permanent.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
} }
break; break;

View file

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

View file

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

View file

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

View file

@ -27,7 +27,7 @@ public class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl {
Permanent aura = game.getPermanent(source.getSourceId()); Permanent aura = game.getPermanent(source.getSourceId());
if (aura != null && aura.getAttachedTo() != null) { if (aura != null && aura.getAttachedTo() != null) {
Permanent enchanted = game.getPermanent(aura.getAttachedTo()); 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); enchanted.addCardType(addedType);
} }
} }

View file

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

View file

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

View file

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

View file

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

Some files were not shown because too many files have changed in this diff Show more