huge rework on subtypes (#3668)

* huge rework on subtypes

* update for coat of arms

* fix test
This commit is contained in:
ingmargoudt 2017-07-16 23:57:39 +02:00 committed by Jeff Wadsworth
parent 81fb4b5d92
commit 09f0c9ad97
185 changed files with 1068 additions and 906 deletions

View file

@ -46,6 +46,7 @@ import mage.client.util.ImageHelper;
import mage.client.util.gui.ArrowBuilder; import mage.client.util.gui.ArrowBuilder;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.EnlargeMode; import mage.constants.EnlargeMode;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.view.*; import mage.view.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -277,7 +278,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
if (!card.getSubTypes().isEmpty()) { if (!card.getSubTypes().isEmpty()) {
sbType.append("- "); sbType.append("- ");
for (String subType : card.getSubTypes()) { for (SubType subType : card.getSubTypes()) {
sbType.append(subType).append(' '); sbType.append(subType).append(' ');
} }
} }

View file

@ -1,15 +1,5 @@
package mage.client.cards; package mage.client.cards;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.swing.*;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.MageCard; import mage.cards.MageCard;
import mage.cards.decks.DeckCardInfo; import mage.cards.decks.DeckCardInfo;
@ -23,6 +13,7 @@ import mage.client.dialog.PreferencesDialog;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.*; import mage.client.util.*;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.util.RandomUtil; import mage.util.RandomUtil;
import mage.view.CardView; import mage.view.CardView;
@ -30,6 +21,17 @@ import mage.view.CardsView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.mage.card.arcane.CardRenderer; import org.mage.card.arcane.CardRenderer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/** /**
* Created by StravantUser on 2016-09-20. * Created by StravantUser on 2016-09-20.
*/ */
@ -1273,8 +1275,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (SuperType str : card.getSuperTypes()) { for (SuperType str : card.getSuperTypes()) {
s |= str.toString().toLowerCase().contains(searchStr); s |= str.toString().toLowerCase().contains(searchStr);
} }
for (String str : card.getSubTypes()) { for (SubType str : card.getSubTypes()) {
s |= str.toLowerCase().contains(searchStr); s |= str.toString().toLowerCase().contains(searchStr);
} }
} }
// Rarity // Rarity
@ -1349,8 +1351,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (SuperType type : card.getSuperTypes()) { for (SuperType type : card.getSuperTypes()) {
t += ' ' + type.toString().toLowerCase(); t += ' ' + type.toString().toLowerCase();
} }
for (String str : card.getSubTypes()) { for (SubType str : card.getSubTypes()) {
t += ' ' + str.toLowerCase(); t += " " + str.toString().toLowerCase();
} }
for (String qty : qtys.keySet()) { for (String qty : qtys.keySet()) {

View file

@ -357,8 +357,8 @@ public final class GuiDisplayUtil {
if (!card.getSubTypes().isEmpty()) { if (!card.getSubTypes().isEmpty()) {
types += "- "; types += "- ";
} }
for (String subType : card.getSubTypes()) { for (SubType subType : card.getSubTypes()) {
types += subType + ' '; types += subType + " ";
} }
return types.trim(); return types.trim();
} }

View file

@ -9,6 +9,7 @@ import mage.client.plugins.impl.Plugins;
import mage.client.util.audio.AudioManager; import mage.client.util.audio.AudioManager;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.EnlargeMode; import mage.constants.EnlargeMode;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.view.AbilityView; import mage.view.AbilityView;
import mage.view.CardView; import mage.view.CardView;
@ -681,7 +682,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
if (!card.getSubTypes().isEmpty()) { if (!card.getSubTypes().isEmpty()) {
sbType.append("- "); sbType.append("- ");
for (String subType : card.getSubTypes()) { for (SubType subType : card.getSubTypes()) {
sbType.append(subType).append(' '); sbType.append(subType).append(' ');
} }
} }

View file

@ -3,6 +3,7 @@ package org.mage.card.arcane;
import com.google.common.collect.MapMaker; import com.google.common.collect.MapMaker;
import mage.cards.action.ActionCallback; import mage.cards.action.ActionCallback;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.view.CardView; import mage.view.CardView;
import mage.view.CounterView; import mage.view.CounterView;
@ -161,7 +162,7 @@ public class CardPanelRenderImpl extends CardPanel {
for (SuperType s : this.view.getSuperTypes()) { for (SuperType s : this.view.getSuperTypes()) {
sb.append(s); sb.append(s);
} }
for (String s : this.view.getSubTypes()) { for (SubType s : this.view.getSubTypes()) {
sb.append(s); sb.append(s);
} }
for (String s : this.view.getManaCost()) { for (String s : this.view.getManaCost()) {

View file

@ -9,6 +9,7 @@ import mage.cards.ArtRect;
import mage.client.dialog.PreferencesDialog; import mage.client.dialog.PreferencesDialog;
import mage.constants.AbilityType; import mage.constants.AbilityType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.view.CardView; import mage.view.CardView;
import mage.view.CounterView; import mage.view.CounterView;
@ -428,7 +429,7 @@ public abstract class CardRenderer {
} }
if (!cardView.getSubTypes().isEmpty()) { if (!cardView.getSubTypes().isEmpty()) {
sbType.append("- "); sbType.append("- ");
for (String subType : cardView.getSubTypes()) { for (SubType subType : cardView.getSubTypes()) {
sbType.append(subType).append(' '); sbType.append(subType).append(' ');
} }
} }

View file

@ -11,6 +11,8 @@ import mage.cards.FrameStyle;
import mage.client.dialog.PreferencesDialog; import mage.client.dialog.PreferencesDialog;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.MageObjectType; import mage.constants.MageObjectType;
import mage.constants.SubType;
import mage.util.SubTypeList;
import mage.view.CardView; import mage.view.CardView;
import mage.view.PermanentView; import mage.view.PermanentView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -1024,8 +1026,8 @@ public class ModernCardRenderer extends CardRenderer {
// Determine which background paint to use from a set of colors // Determine which background paint to use from a set of colors
// and the current card. // and the current card.
protected static Paint getBackgroundPaint(ObjectColor colors, Collection<CardType> types, Collection<String> subTypes) { protected static Paint getBackgroundPaint(ObjectColor colors, Collection<CardType> types, SubTypeList subTypes) {
if (subTypes.contains("Vehicle")) { if (subTypes.contains(SubType.VEHICLE)) {
return BG_TEXTURE_VEHICLE; return BG_TEXTURE_VEHICLE;
} else if (types.contains(CardType.LAND)) { } else if (types.contains(CardType.LAND)) {
return BG_TEXTURE_LAND; return BG_TEXTURE_LAND;

View file

@ -32,6 +32,7 @@ import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.util.SubTypeList;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
@ -57,7 +58,7 @@ public class AbilityView extends CardView {
this.toughness = ""; this.toughness = "";
this.loyalty = ""; this.loyalty = "";
this.cardTypes = EnumSet.noneOf(CardType.class); this.cardTypes = EnumSet.noneOf(CardType.class);
this.subTypes = new ArrayList<>(); this.subTypes = new SubTypeList();
this.superTypes =EnumSet.noneOf(SuperType.class); this.superTypes =EnumSet.noneOf(SuperType.class);
this.color = new ObjectColor(); this.color = new ObjectColor();
this.manaCost = ability.getManaCosts().getSymbols(); this.manaCost = ability.getManaCosts().getSymbols();

View file

@ -27,8 +27,6 @@
*/ */
package mage.view; package mage.view;
import java.util.*;
import java.util.stream.Collectors;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Abilities; import mage.abilities.Abilities;
@ -51,6 +49,10 @@ import mage.game.stack.Spell;
import mage.game.stack.StackAbility; import mage.game.stack.StackAbility;
import mage.target.Target; import mage.target.Target;
import mage.target.Targets; import mage.target.Targets;
import mage.util.SubTypeList;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -68,7 +70,7 @@ public class CardView extends SimpleCardView {
protected String loyalty = ""; protected String loyalty = "";
protected String startingLoyalty; protected String startingLoyalty;
protected EnumSet<CardType> cardTypes; protected EnumSet<CardType> cardTypes;
protected List<String> subTypes; protected SubTypeList subTypes;
protected EnumSet<SuperType> superTypes; protected EnumSet<SuperType> superTypes;
protected ObjectColor color; protected ObjectColor color;
protected ObjectColor frameColor; protected ObjectColor frameColor;
@ -238,7 +240,7 @@ public class CardView extends SimpleCardView {
} }
if (!card.getSubtype(game).isEmpty()) { if (!card.getSubtype(game).isEmpty()) {
sbType.append("- "); sbType.append("- ");
for (String subType : card.getSubtype(game)) { for (SubType subType : card.getSubtype(game)) {
sbType.append(subType).append(' '); sbType.append(subType).append(' ');
} }
} }
@ -573,7 +575,7 @@ public class CardView extends SimpleCardView {
this.loyalty = ""; this.loyalty = "";
this.startingLoyalty = ""; this.startingLoyalty = "";
this.cardTypes = EnumSet.noneOf(CardType.class); this.cardTypes = EnumSet.noneOf(CardType.class);
this.subTypes = new ArrayList<>(); this.subTypes = new SubTypeList();
this.superTypes = EnumSet.noneOf(SuperType.class); this.superTypes = EnumSet.noneOf(SuperType.class);
this.color = new ObjectColor(); this.color = new ObjectColor();
this.frameColor = new ObjectColor(); this.frameColor = new ObjectColor();
@ -697,7 +699,7 @@ public class CardView extends SimpleCardView {
return cardTypes; return cardTypes;
} }
public List<String> getSubTypes() { public SubTypeList getSubTypes() {
return subTypes; return subTypes;
} }
@ -985,7 +987,7 @@ public class CardView extends SimpleCardView {
} }
if (!getSubTypes().isEmpty()) { if (!getSubTypes().isEmpty()) {
type.append(" - "); type.append(" - ");
type.append(String.join(" ", getSubTypes())); type.append(String.join(" ", getSubTypes().stream().map(p->p.toString()).collect(Collectors.toSet())));
} }
return type.toString(); return type.toString();
} }

View file

@ -27,10 +27,6 @@
*/ */
package mage.player.ai; package mage.player.ai;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.Map.Entry;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
import mage.abilities.*; import mage.abilities.*;
@ -81,6 +77,11 @@ import mage.util.TournamentUtil;
import mage.util.TreeNode; import mage.util.TreeNode;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.Map.Entry;
/** /**
* *
* suitable for two player games and some multiplayer games * suitable for two player games and some multiplayer games
@ -1340,8 +1341,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (game.getOpponents(this.getId()).contains(permanent.getControllerId()) if (game.getOpponents(this.getId()).contains(permanent.getControllerId())
&& permanent.getCardType().contains(CardType.CREATURE) && permanent.getCardType().contains(CardType.CREATURE)
&& !permanent.getSubtype(game).isEmpty()) { && !permanent.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(permanent.getSubtype(game).get(0))) { if (choice.getChoices().contains(permanent.getSubtype(game).get(0).toString())) {
choice.setChoice(permanent.getSubtype(game).get(0)); choice.setChoice(permanent.getSubtype(game).get(0).toString());
break; break;
} }
} }
@ -1352,8 +1353,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
Player opponent = game.getPlayer(opponentId); Player opponent = game.getPlayer(opponentId);
for (Card card : opponent.getGraveyard().getCards(game)) { for (Card card : opponent.getGraveyard().getCards(game)) {
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(card.getSubtype(game).get(0))) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0)); choice.setChoice(card.getSubtype(game).get(0).toString());
break; break;
} }
} }
@ -1368,8 +1369,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
for (UUID cardId : this.getHand()) { for (UUID cardId : this.getHand()) {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(card.getSubtype(game).get(0))) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0)); choice.setChoice(card.getSubtype(game).get(0).toString());
break; break;
} }
} }
@ -1378,8 +1379,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
for (UUID cardId : this.getLibrary().getCardList()) { for (UUID cardId : this.getLibrary().getCardList()) {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(card.getSubtype(game).get(0))) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0)); choice.setChoice(card.getSubtype(game).get(0).toString());
break; break;
} }
} }

View file

@ -33,9 +33,8 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -67,9 +66,7 @@ public class AphettoDredging extends CardImpl {
if (ability instanceof SpellAbility) { if (ability instanceof SpellAbility) {
Player controller = game.getPlayer(ability.getControllerId()); Player controller = game.getPlayer(ability.getControllerId());
if (controller != null) { if (controller != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type");
typeChoice.setChoices(SubType.getCreatureTypes(false));
while (!controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) { while (!controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return; return;

View file

@ -39,10 +39,7 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
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.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.CounterPredicate; import mage.filter.predicate.permanent.CounterPredicate;
@ -50,8 +47,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 mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.UUID; import java.util.UUID;
/** /**
@ -76,8 +73,8 @@ public class Aurification extends CardImpl {
this.addAbility(new AddGoldCountersAbility()); this.addAbility(new AddGoldCountersAbility());
// Each creature with a gold counter on it is a Wall in addition to its other creature types and has defender. // Each creature with a gold counter on it is a Wall in addition to its other creature types and has defender.
ArrayList<String> subtypes = new ArrayList<>(1); SubTypeList subtypes = new SubTypeList();
subtypes.add("Wall"); subtypes.add(SubType.WALL);
BecomesSubtypeAllEffect becomesSubtypeAllEffect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subtypes, filter, false); BecomesSubtypeAllEffect becomesSubtypeAllEffect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subtypes, filter, false);
becomesSubtypeAllEffect.setText(""); becomesSubtypeAllEffect.setText("");

View file

@ -36,6 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
@ -130,7 +131,7 @@ class BladeOfTheBloodchiefEffect extends OneShotEffect {
if (enchantment != null && enchantment.getAttachedTo() != null) { if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo()); Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) { if (creature != null) {
if (creature.hasSubtype("Vampire", game)) { if (creature.hasSubtype(SubType.VAMPIRE, game)) {
creature.addCounters(CounterType.P1P1.createInstance(2), source, game); creature.addCounters(CounterType.P1P1.createInstance(2), source, game);
} else { } else {
creature.addCounters(CounterType.P1P1.createInstance(), source, game); creature.addCounters(CounterType.P1P1.createInstance(), source, game);

View file

@ -37,10 +37,8 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
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.util.SubTypeList;
import mage.constants.Outcome;
import mage.constants.Zone;
import java.util.UUID; import java.util.UUID;
@ -57,12 +55,14 @@ public class BladedBracers extends CardImpl {
// Equipped creature gets +1/+1. // Equipped creature gets +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1)));
SubTypeList subTypes = new SubTypeList();
subTypes.add(SubType.HUMAN);
subTypes.add(SubType.ANGEL);
// As long as equipped creature is a Human or an Angel, it has vigilance. // As long as equipped creature is a Human or an Angel, it has vigilance.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect( new ConditionalContinuousEffect(
new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT), new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT),
new EquippedHasSubtypeCondition("Human", "Angel"), ruleText))); new EquippedHasSubtypeCondition(subTypes), ruleText)));
// Equip {2} // Equip {2}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2))); this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2)));

View file

@ -33,7 +33,6 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.mana.RedManaAbility; import mage.abilities.mana.RedManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterLandPermanent; import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -101,7 +100,7 @@ class BloodMoonEffect extends ContinuousEffectImpl {
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects // 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
// So the ability removing has to be done before Layer 6 // So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game); land.removeAllAbilities(source.getSourceId(), game);
land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes()); land.getSubtype(game).removeAll(SubType.getLandTypes(false));
land.getSubtype(game).add("Mountain"); land.getSubtype(game).add("Mountain");
break; break;
case AbilityAddingRemovingEffects_6: case AbilityAddingRemovingEffects_6:

View file

@ -34,7 +34,6 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.*; import mage.cards.*;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -47,6 +46,7 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* *
@ -103,7 +103,7 @@ class BloodlineShamanEffect extends OneShotEffect {
// Choose a creature type. // Choose a creature type.
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:"); typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!controller.choose(outcome, typeChoice, game)) { while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -39,13 +39,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
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.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.UUID; import java.util.UUID;
/** /**
@ -65,14 +64,14 @@ public class BoldwyrIntimidator extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoldwyrIntimidatorEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoldwyrIntimidatorEffect()));
// {R}: Target creature becomes a Coward until end of turn. // {R}: Target creature becomes a Coward until end of turn.
Effect effect = new BecomesCreatureTypeTargetEffect(Duration.EndOfTurn, new ArrayList<>(Collections.singletonList("Coward")), true); Effect effect = new BecomesCreatureTypeTargetEffect(Duration.EndOfTurn, SubType.COWARD);
effect.setText("Target creature becomes a Coward until end of turn"); effect.setText("Target creature becomes a Coward until end of turn");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}"));
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
// {2}{R}: Target creature becomes a Warrior until end of turn. // {2}{R}: Target creature becomes a Warrior until end of turn.
effect = new BecomesCreatureTypeTargetEffect(Duration.EndOfTurn, new ArrayList<>(Collections.singletonList("Warrior")), true); effect = new BecomesCreatureTypeTargetEffect(Duration.EndOfTurn, SubType.WARRIOR);
effect.setText("Target creature becomes a Warrior until end of turn"); effect.setText("Target creature becomes a Warrior until end of turn");
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}{R}")); ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}{R}"));
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());

View file

@ -40,10 +40,7 @@ import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
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.Outcome;
import mage.constants.Zone;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -69,8 +66,8 @@ public class BondsOfFaith extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Enchanted creature gets +2/+2 as long as it's a Human. Otherwise, it can't attack or block. // Enchanted creature gets +2/+2 as long as it's a Human. Otherwise, it can't attack or block.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(2, 2), new EquippedHasSubtypeCondition("Human"), rule))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(2, 2), new EquippedHasSubtypeCondition(SubType.HUMAN), rule)));
Effect effect = new ConditionalRestrictionEffect(new CantAttackBlockAttachedEffect(AttachmentType.AURA), new InvertCondition(new EquippedHasSubtypeCondition("Human"))); Effect effect = new ConditionalRestrictionEffect(new CantAttackBlockAttachedEffect(AttachmentType.AURA), new InvertCondition(new EquippedHasSubtypeCondition(SubType.HUMAN)));
effect.setText("Otherwise, it can't attack or block"); effect.setText("Otherwise, it can't attack or block");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.b; package mage.cards.b;
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;
@ -36,10 +35,7 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
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.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.CounterPredicate; import mage.filter.predicate.permanent.CounterPredicate;
@ -48,6 +44,8 @@ import mage.game.events.EntersTheBattlefieldEvent;
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 emerald000 * @author emerald000
@ -111,7 +109,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.getControllerId().equals(source.getControllerId()) return creature != null && creature.getControllerId().equals(source.getControllerId())
&& creature.isCreature() && creature.isCreature()
&& creature.hasSubtype("Warrior", game) && creature.hasSubtype(SubType.WARRIOR, game)
&& !event.getTargetId().equals(source.getSourceId()); && !event.getTargetId().equals(source.getSourceId());
} }

View file

@ -37,10 +37,7 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.LifelinkAbility;
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.Outcome;
import mage.constants.Zone;
import java.util.UUID; import java.util.UUID;
@ -62,7 +59,7 @@ public class ButchersCleaver extends CardImpl {
// As long as equipped creature is a Human, it has lifelink. // As long as equipped creature is a Human, it has lifelink.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new GainAbilityAttachedEffect(LifelinkAbility.getInstance(), AttachmentType.EQUIPMENT), new ConditionalContinuousEffect(new GainAbilityAttachedEffect(LifelinkAbility.getInstance(), AttachmentType.EQUIPMENT),
new EquippedHasSubtypeCondition("Human"), staticText))); new EquippedHasSubtypeCondition(SubType.HUMAN), staticText)));
// Equip {3} // Equip {3}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3))); this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));

View file

@ -124,8 +124,8 @@ class CallToTheKindredEffect extends OneShotEffect {
if (!creature.getAbilities().contains(ChangelingAbility.getInstance())) { if (!creature.getAbilities().contains(ChangelingAbility.getInstance())) {
StringBuilder sb = new StringBuilder("creature card with at least one subtype from: "); StringBuilder sb = new StringBuilder("creature card with at least one subtype from: ");
ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>(); ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>();
for (String subtype : creature.getSubtype(game)) { for (SubType subtype : creature.getSubtype(game)) {
subtypes.add(new SubtypePredicate(SubType.byDescription(subtype))); subtypes.add(new SubtypePredicate(subtype));
sb.append(subtype).append(", "); sb.append(subtype).append(", ");
} }
filter.add(Predicates.or(subtypes)); filter.add(Predicates.or(subtypes));

View file

@ -119,7 +119,7 @@ class CaptivatingVampireEffect extends ContinuousEffectImpl {
break; break;
case TypeChangingEffects_4: case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) { if (sublayer == SubLayer.NA) {
if (!permanent.hasSubtype("Vampire", game)) { if (!permanent.hasSubtype(SubType.VAMPIRE, game)) {
permanent.getSubtype(game).add("Vampire"); permanent.getSubtype(game).add("Vampire");
} }
} }

View file

@ -87,13 +87,13 @@ public class CavernOfSouls extends CardImpl {
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder { class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
String creatureType; SubType creatureType;
@Override @Override
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) { public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
Object value = game.getState().getValue(source.getSourceId() + "_type"); Object value = game.getState().getValue(source.getSourceId() + "_type");
if (value != null && value instanceof String) { if (value != null && value instanceof String) {
creatureType = (String) value; creatureType = SubType.byDescription((String) value);
} }
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId());
@ -117,7 +117,7 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
class CavernOfSoulsConditionalMana extends ConditionalMana { class CavernOfSoulsConditionalMana extends ConditionalMana {
public CavernOfSoulsConditionalMana(Mana mana, String creatureType) { public CavernOfSoulsConditionalMana(Mana mana, SubType creatureType) {
super(mana); super(mana);
staticText = "Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered"; staticText = "Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered";
addCondition(new CavernOfSoulsManaCondition(creatureType)); addCondition(new CavernOfSoulsManaCondition(creatureType));
@ -126,9 +126,9 @@ class CavernOfSoulsConditionalMana extends ConditionalMana {
class CavernOfSoulsManaCondition extends CreatureCastManaCondition { class CavernOfSoulsManaCondition extends CreatureCastManaCondition {
String creatureType; SubType creatureType;
CavernOfSoulsManaCondition(String creatureType) { CavernOfSoulsManaCondition(SubType creatureType) {
this.creatureType = creatureType; this.creatureType = creatureType;
} }

View file

@ -55,8 +55,6 @@ import mage.players.Player;
import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInGraveyard;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.ArrayList;
import java.util.Collections;
import java.util.UUID; import java.util.UUID;
/** /**
@ -130,7 +128,7 @@ class ChainerDementiaMasterEffect extends OneShotEffect {
ContinuousEffectImpl effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield); ContinuousEffectImpl effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield);
effect.setTargetPointer(new FixedTarget(permanent, game)); effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source); game.addEffect(effect, source);
effect = new BecomesCreatureTypeTargetEffect(Duration.WhileOnBattlefield, new ArrayList<>(Collections.singletonList("Nightmare")), false); effect = new BecomesCreatureTypeTargetEffect(Duration.WhileOnBattlefield, SubType.NIGHTMARE, false);
effect.setTargetPointer(new FixedTarget(permanent, game)); effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source); game.addEffect(effect, source);
} }

View file

@ -61,7 +61,7 @@ public class CoalitionFlag extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Enchanted creature is a Flagbearer. // Enchanted creature is a Flagbearer.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetCardSubtypeAttachedEffect("Flagbearer", Duration.WhileOnBattlefield, AttachmentType.AURA))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetCardSubtypeAttachedEffect(SubType.FLAGBEARER, Duration.WhileOnBattlefield, AttachmentType.AURA)));
// While choosing targets as part of casting a spell or activating an ability, your opponents must choose at least one Flagbearer on the battlefield if able. // While choosing targets as part of casting a spell or activating an ability, your opponents must choose at least one Flagbearer on the battlefield if able.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TargetsHaveToTargetPermanentIfAbleEffect(new FilterPermanent(SubType.FLAGBEARER, "one Flagbearer")))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TargetsHaveToTargetPermanentIfAbleEffect(new FilterPermanent(SubType.FLAGBEARER, "one Flagbearer"))));

View file

@ -37,7 +37,7 @@ import mage.constants.*;
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.util.CardUtil; import mage.util.SubTypeList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -94,14 +94,14 @@ class CoatOfArmsEffect extends ContinuousEffectImpl {
private int getAmount(List<Permanent> permanents, Permanent target, Game game) { private int getAmount(List<Permanent> permanents, Permanent target, Game game) {
int amount = 0; int amount = 0;
List<String> targetSubtype = target.getSubtype(game); SubTypeList targetSubtype = target.getSubtype(game);
if (target.getAbilities().contains(ChangelingAbility.getInstance())) { if (target.getAbilities().contains(ChangelingAbility.getInstance()) || target.isAllCreatureTypes()) {
return permanents.size() - 1; return permanents.size() - 1;
} }
for (Permanent permanent : permanents) { for (Permanent permanent : permanents) {
if (!permanent.getId().equals(target.getId())) { if (!permanent.getId().equals(target.getId())) {
for (String subtype : targetSubtype) { for (SubType subtype : targetSubtype) {
if (!CardUtil.isNonCreatureSubtype(subtype)) { if (subtype.getSubTypeSet() == SubTypeSet.CreatureType) {
if (permanent.hasSubtype(subtype, game)) { if (permanent.hasSubtype(subtype, game)) {
amount++; amount++;
break; break;

View file

@ -36,7 +36,6 @@ 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.cards.repository.CardRepository;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game; import mage.game.Game;
@ -44,6 +43,7 @@ import mage.game.permanent.Permanent;
import mage.game.stack.Spell; import mage.game.stack.Spell;
import mage.game.stack.StackObject; import mage.game.stack.StackObject;
import mage.players.Player; import mage.players.Player;
import mage.util.SubTypeList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -94,32 +94,33 @@ class ConspiracyEffect extends ContinuousEffectImpl {
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_type"); String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_type");
SubType chosenSubtype = SubType.byDescription(choice);
if (controller != null && choice != null) { if (controller != null && choice != null) {
// Creature cards you own that aren't on the battlefield // Creature cards you own that aren't on the battlefield
// 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()) { if (card.isCreature()) {
setCreatureSubtype(card, choice, game); setCreatureSubtype(card, chosenSubtype, game);
} }
} }
// 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()) { if (card.isCreature()) {
setCreatureSubtype(card, choice, game); setCreatureSubtype(card, chosenSubtype, game);
} }
} }
// in Exile // in Exile
for (Card card : game.getState().getExile().getAllCards(game)) { for (Card card : game.getState().getExile().getAllCards(game)) {
if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) { if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) {
setCreatureSubtype(card, choice, game); setCreatureSubtype(card, chosenSubtype, game);
} }
} }
// 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()) { if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) {
setCreatureSubtype(card, choice, game); setCreatureSubtype(card, chosenSubtype, game);
} }
} }
// commander in command zone // commander in command zone
@ -127,7 +128,7 @@ class ConspiracyEffect extends ContinuousEffectImpl {
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()) { if (card.isCreature()) {
setCreatureSubtype(card, choice, game); setCreatureSubtype(card, chosenSubtype, game);
} }
} }
} }
@ -138,21 +139,21 @@ class ConspiracyEffect extends ContinuousEffectImpl {
stackObject.getControllerId().equals(source.getControllerId()) && stackObject.getControllerId().equals(source.getControllerId()) &&
stackObject.isCreature()) { stackObject.isCreature()) {
Card card = ((Spell) stackObject).getCard(); Card card = ((Spell) stackObject).getCard();
setCreatureSubtype(card, choice, game); setCreatureSubtype(card, chosenSubtype, game);
} }
} }
// creatures you control // creatures you control
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) {
setCreatureSubtype(creature, choice, game); setCreatureSubtype(creature, chosenSubtype, game);
} }
return true; return true;
} }
return false; return false;
} }
private void setCreatureSubtype(MageObject object, String subtype, Game game) { private void setCreatureSubtype(MageObject object, SubType subtype, Game game) {
if (object != null) { if (object != null) {
if (object instanceof Card) { if (object instanceof Card) {
Card card = (Card) object; Card card = (Card) object;
@ -165,9 +166,9 @@ class ConspiracyEffect extends ContinuousEffectImpl {
} }
} }
private void setChosenSubtype(List<String> subtype, String choice) { private void setChosenSubtype(SubTypeList subtype, SubType choice) {
if (subtype.size() != 1 || !subtype.contains(choice)) { if (subtype.size() != 1 || !subtype.contains(choice)) {
subtype.removeAll(CardRepository.instance.getCreatureTypes()); subtype.removeAll(SubType.getCreatureTypes(false));
subtype.add(choice); subtype.add(choice);
} }
} }

View file

@ -31,7 +31,6 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -45,6 +44,7 @@ import mage.players.Player;
import mage.target.common.TargetAttackingOrBlockingCreature; import mage.target.common.TargetAttackingOrBlockingCreature;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* *
@ -92,7 +92,7 @@ class CoordinatedBarrageEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose a creature type"); choice.setMessage("Choose a creature type");
choice.setChoices(SubType.getCreatureTypes(false)); choice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
if (controller.choose(Outcome.Damage, choice, game)) { if (controller.choose(Outcome.Damage, choice, game)) {
String chosenType = choice.getChoice(); String chosenType = choice.getChoice();
FilterControlledPermanent filter = new FilterControlledPermanent(); FilterControlledPermanent filter = new FilterControlledPermanent();

View file

@ -44,6 +44,7 @@ import mage.abilities.mana.builder.ConditionalManaBuilder;
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.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
@ -115,7 +116,7 @@ class CrucibleOfTheSpiritDragonManaCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
if (object != null && object.hasSubtype("Dragon", game)) { if (object != null && object.hasSubtype(SubType.DRAGON, game)) {
return true; return true;
} }
return false; return false;

View file

@ -193,25 +193,25 @@ class CrypticGatewayEffect extends OneShotEffect {
boolean commonSubType = false; boolean commonSubType = false;
boolean changeling = false; boolean changeling = false;
boolean changeling2 = false; boolean changeling2 = false;
if (creature.getAbilities().containsKey(ChangelingAbility.getInstance().getId()) || creature.getSubtype(game).contains(ChangelingAbility.ALL_CREATURE_TYPE)) { if (creature.getAbilities().containsKey(ChangelingAbility.getInstance().getId()) || creature.isAllCreatureTypes()) {
changeling = true; changeling = true;
} }
if (creature2.getAbilities().containsKey(ChangelingAbility.getInstance().getId()) || creature2.getSubtype(game).contains(ChangelingAbility.ALL_CREATURE_TYPE)) { if (creature2.getAbilities().containsKey(ChangelingAbility.getInstance().getId()) || creature2.isAllCreatureTypes()) {
changeling2 = true; changeling2 = true;
} }
ArrayList<SubtypePredicate> subtypes = new ArrayList<>(); ArrayList<SubtypePredicate> subtypes = new ArrayList<>();
for (String subtype : creature.getSubtype(game)) { for (SubType subtype : creature.getSubtype(game)) {
if (creature2.getSubtype(game).contains(subtype) || changeling2) { if (creature2.getSubtype(game).contains(subtype) || changeling2) {
subtypes.add(new SubtypePredicate(SubType.byDescription(subtype))); subtypes.add(new SubtypePredicate(subtype));
commonSubType = true; commonSubType = true;
} }
} }
for (String subtype : creature2.getSubtype(game)) { for (SubType subtype : creature2.getSubtype(game)) {
if (creature.getSubtype(game).contains(subtype) || changeling) { if (creature.getSubtype(game).contains(subtype) || changeling) {
subtypes.add(new SubtypePredicate(SubType.byDescription(subtype))); subtypes.add(new SubtypePredicate(subtype));
commonSubType = true; commonSubType = true;
} }
} }

View file

@ -35,6 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
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;
@ -91,7 +92,7 @@ class DeathcultRogueRestrictionEffect extends RestrictionEffect {
@Override @Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (blocker.hasSubtype("Rogue", game)) { if (blocker.hasSubtype(SubType.ROGUE, game)) {
return true; return true;
} }
return false; return false;

View file

@ -34,6 +34,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
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;
@ -87,7 +88,7 @@ class DefyDeathEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget()); Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null && permanent.hasSubtype("Angel", game)) { if (permanent != null && permanent.hasSubtype(SubType.ANGEL, game)) {
permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); permanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
return true; return true;
} }

View file

@ -34,6 +34,7 @@ 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.CardType;
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;
@ -92,7 +93,7 @@ class DeicideExileEffect extends SearchTargetGraveyardHandLibraryForCardNameAndE
// if it is a God. For each of the Gods in the Theros block, it wont matter what your // if it is a God. For each of the Gods in the Theros block, it wont matter what your
// devotion to its color(s) was. The card is a God card when not on the battlefield. // devotion to its color(s) was. The card is a God card when not on the battlefield.
Card cardInExile = game.getExile().getCard(targetEnchantment.getId(), game); Card cardInExile = game.getExile().getCard(targetEnchantment.getId(), game);
if (cardInExile != null && cardInExile.hasSubtype("God", game)) { if (cardInExile != null && cardInExile.hasSubtype(SubType.GOD, game)) {
Player enchantmentController = game.getPlayer(targetEnchantment.getControllerId()); Player enchantmentController = game.getPlayer(targetEnchantment.getControllerId());
return super.applySearchAndExile(game, source, cardInExile.getName(), enchantmentController.getId()); return super.applySearchAndExile(game, source, cardInExile.getName(), enchantmentController.getId());
} }

View file

@ -101,8 +101,8 @@ class DismissIntoDreamEffect extends ContinuousEffectImpl {
object.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), source.getSourceId(), game); object.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), source.getSourceId(), game);
break; break;
case TypeChangingEffects_4: case TypeChangingEffects_4:
if (!object.hasSubtype("Illusion", game)) { if (!object.hasSubtype(SubType.ILLUSION, game)) {
object.getSubtype(game).add("Illusion"); object.getSubtype(game).add(SubType.ILLUSION);
} }
break; break;
} }

View file

@ -33,7 +33,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -45,6 +44,7 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* *
@ -92,7 +92,7 @@ class DistantMelodyEffect extends OneShotEffect {
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:"); typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -34,6 +34,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game; import mage.game.Game;
@ -99,7 +100,7 @@ class EatenBySpidersEffect extends OneShotEffect {
for (UUID attachmentId : attachments) { for (UUID attachmentId : attachments) {
Permanent attachment = game.getPermanent(attachmentId); Permanent attachment = game.getPermanent(attachmentId);
if (attachment.hasSubtype("Equipment", game)) { if (attachment.hasSubtype(SubType.EQUIPMENT, game)) {
attachment.destroy(source.getSourceId(), game, false); attachment.destroy(source.getSourceId(), game, false);
} }
} }

View file

@ -111,7 +111,7 @@ class EbonPraetorEffect extends OneShotEffect {
if (cost instanceof SacrificeTargetCost) { if (cost instanceof SacrificeTargetCost) {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0); Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
Permanent sourceCreature = game.getPermanent(source.getSourceId()); Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sacrificedCreature.hasSubtype("Thrull", game) && sourceCreature != null) { if (sacrificedCreature.hasSubtype(SubType.THRULL, game) && sourceCreature != null) {
sourceCreature.addCounters(CounterType.P1P0.createInstance(), source, game); sourceCreature.addCounters(CounterType.P1P0.createInstance(), source, game);
return true; return true;
} }

View file

@ -34,7 +34,6 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.ChangelingAbility; import mage.abilities.keyword.ChangelingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
@ -106,7 +105,7 @@ class EgoErasureLoseEffect extends ContinuousEffectImpl {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game); Permanent permanent = it.next().getPermanent(game);
if (permanent != null) { if (permanent != null) {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
} else { } else {
it.remove(); it.remove();
} }

View file

@ -35,6 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.Counter; import mage.counters.Counter;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
@ -95,7 +96,7 @@ class ElderCatharAddCountersTargetEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) { if (permanent != null) {
if (counter != null) { if (counter != null) {
if (permanent.hasSubtype("Human", game)) { if (permanent.hasSubtype(SubType.HUMAN, game)) {
permanent.addCounters(counter2.copy(), source, game); permanent.addCounters(counter2.copy(), source, game);
} else { } else {
permanent.addCounters(counter.copy(), source, game); permanent.addCounters(counter.copy(), source, game);

View file

@ -39,6 +39,7 @@ import mage.abilities.mana.builder.ConditionalManaBuilder;
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.game.Game; import mage.game.Game;
import java.util.UUID; import java.util.UUID;
@ -95,6 +96,6 @@ class EldraziTempleCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
return object != null && object.hasSubtype("Eldrazi", game) && object.getColor(game).isColorless(); return object != null && object.hasSubtype(SubType.ELDRAZI, game) && object.getColor(game).isColorless();
} }
} }

View file

@ -36,9 +36,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards; import mage.cards.Cards;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -98,9 +97,7 @@ class ElvishSoultillerEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId()); MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null && mageObject != null) { if (controller != null && mageObject != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
while (!controller.choose(outcome, typeChoice, game)) { while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -40,11 +40,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.Collections;
import java.util.UUID; import java.util.UUID;
/** /**
@ -66,7 +66,7 @@ public class ErebossEmissary extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostEnchantedEffect(2, 2, Duration.EndOfTurn), new BoostEnchantedEffect(2, 2, Duration.EndOfTurn),
new BoostSourceEffect(2, 2, Duration.EndOfTurn), new BoostSourceEffect(2, 2, Duration.EndOfTurn),
new SourceHasSubtypeCondition(Collections.singletonList("Aura")), new SourceHasSubtypeCondition(SubType.AURA),
"{this} gets +2/+2 until end of turn. If Erebos's Emissary is an Aura, enchanted creature gets +2/+2 until end of turn instead"), "{this} gets +2/+2 until end of turn. If Erebos's Emissary is an Aura, enchanted creature gets +2/+2 until end of turn instead"),
new DiscardTargetCost(new TargetCardInHand(new FilterCreatureCard())))); new DiscardTargetCost(new TargetCardInHand(new FilterCreatureCard()))));

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.*; import mage.cards.*;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.ExileZone; import mage.game.ExileZone;
@ -124,7 +125,7 @@ class EssenceFluxEffect extends OneShotEffect {
controller.moveCards(cardsToBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null); controller.moveCards(cardsToBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null);
for (UUID cardId : cardsToBattlefield) { for (UUID cardId : cardsToBattlefield) {
Permanent permanent = game.getPermanent(cardId); Permanent permanent = game.getPermanent(cardId);
if (permanent != null && permanent.hasSubtype("Spirit", game)) { if (permanent != null && permanent.hasSubtype(SubType.SPIRIT, game)) {
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance()); Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
effect.setTargetPointer(new FixedTarget(permanent, game)); effect.setTargetPointer(new FixedTarget(permanent, game));
return effect.apply(game, source); return effect.apply(game, source);

View file

@ -107,23 +107,23 @@ class ExcavatorEffect extends ContinuousEffectImpl implements SourceEffect {
if(cost instanceof SacrificeTargetCost) { if(cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
for(Permanent permanent : sacrificeCost.getPermanents()) { for(Permanent permanent : sacrificeCost.getPermanents()) {
if(permanent.hasSubtype("Forest", game)) if(permanent.hasSubtype(SubType.FOREST, game))
{ {
abilities.add(new ForestwalkAbility()); abilities.add(new ForestwalkAbility());
} }
if(permanent.hasSubtype("Plains", game)) if(permanent.hasSubtype(SubType.PLAINS, game))
{ {
abilities.add(new PlainswalkAbility()); abilities.add(new PlainswalkAbility());
} }
if(permanent.hasSubtype("Island", game)) if(permanent.hasSubtype(SubType.ISLAND, game))
{ {
abilities.add(new IslandwalkAbility()); abilities.add(new IslandwalkAbility());
} }
if(permanent.hasSubtype("Mountain", game)) if(permanent.hasSubtype(SubType.MOUNTAIN, game))
{ {
abilities.add(new MountainwalkAbility()); abilities.add(new MountainwalkAbility());
} }
if(permanent.hasSubtype("Swamp", game)) if(permanent.hasSubtype(SubType.SWAMP, game))
{ {
abilities.add(new SwampwalkAbility()); abilities.add(new SwampwalkAbility());
} }

View file

@ -32,9 +32,8 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -85,9 +84,7 @@ class ExtinctionEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false));
while (!player.choose(outcome, typeChoice, game)) { while (!player.choose(outcome, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -36,6 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -53,7 +54,7 @@ public class EyeGouge extends CardImpl {
// Target creature gets -1/-1 until end of turn. If it's a Cyclops, destroy it. // Target creature gets -1/-1 until end of turn. If it's a Cyclops, destroy it.
this.getSpellAbility().addEffect(new BoostTargetEffect(-1,-1, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new BoostTargetEffect(-1,-1, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
Effect effect = new ConditionalOneShotEffect(new DestroyTargetEffect(), new TargetHasSubtypeCondition("Cyclops"), Effect effect = new ConditionalOneShotEffect(new DestroyTargetEffect(), new TargetHasSubtypeCondition(SubType.CYCLOPS),
"If it's a Cyclops, destroy it"); "If it's a Cyclops, destroy it");
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);
} }

View file

@ -39,10 +39,7 @@ import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
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.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -106,7 +103,7 @@ class FalkenrathAristocratEffect extends OneShotEffect {
if (cost instanceof SacrificeTargetCost) { if (cost instanceof SacrificeTargetCost) {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0); Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
Permanent sourceCreature = game.getPermanent(source.getSourceId()); Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sacrificedCreature.hasSubtype("Human", game) && sourceCreature != null) { if (sacrificedCreature.hasSubtype(SubType.HUMAN, game) && sourceCreature != null) {
sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game); sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, 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.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -45,6 +44,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -98,7 +99,7 @@ class GideonsDefeatEffect extends OneShotEffect {
if (controller != null && permanent != null) { if (controller != null && permanent != null) {
controller.moveCards(permanent, Zone.EXILED, source, game); controller.moveCards(permanent, Zone.EXILED, source, game);
game.applyEffects(); game.applyEffects();
if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.GIDEON.getDescription(), game)) { if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.GIDEON, game)) {
controller.gainLife(5, game); controller.gainLife(5, game);
} }
return true; return true;

View file

@ -35,6 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
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.events.GameEvent; import mage.game.events.GameEvent;
@ -97,7 +98,7 @@ class GoblinAssassinTriggeredAbiliy extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId(); UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId); Permanent permanent = game.getPermanent(targetId);
if ((targetId.equals(this.getSourceId())) || (permanent.hasSubtype("Goblin", game) && !targetId.equals(this.getSourceId()))) { if ((targetId.equals(this.getSourceId())) || (permanent.hasSubtype(SubType.GOBLIN, game) && !targetId.equals(this.getSourceId()))) {
return true; return true;
} }
return false; return false;

View file

@ -34,9 +34,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -97,9 +96,8 @@ class GraveSifterEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose creature type to return cards from your graveyard"); typeChoice.setMessage("Choose creature type to return cards from your graveyard");
typeChoice.setChoices(SubType.getCreatureTypes(false));
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {

View file

@ -38,10 +38,7 @@ import mage.abilities.effects.common.TapTargetEffect;
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.CardType; import mage.constants.*;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game; import mage.game.Game;
@ -152,7 +149,7 @@ class GuardianOfTazeemEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
Permanent targetCreature = game.getPermanent(source.getFirstTarget()); Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (land != null && targetCreature != null && land.hasSubtype("Island", game)) { if (land != null && targetCreature != null && land.hasSubtype(SubType.ISLAND, game)) {
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("that creature"); ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("that creature");
effect.setTargetPointer(new FixedTarget(targetCreature, game)); effect.setTargetPointer(new FixedTarget(targetCreature, game));
game.addEffect(effect, source); game.addEffect(effect, source);

View file

@ -182,7 +182,7 @@ class HaakonPlayKnightsFromGraveyardEffect extends AsThoughEffectImpl {
if (affectedControllerId.equals(source.getControllerId())) { if (affectedControllerId.equals(source.getControllerId())) {
Card knightToCast = game.getCard(objectId); Card knightToCast = game.getCard(objectId);
if (knightToCast != null if (knightToCast != null
&& knightToCast.hasSubtype("Knight", game) && knightToCast.hasSubtype(SubType.KNIGHT, game)
&& knightToCast.getOwnerId().equals(source.getControllerId()) && knightToCast.getOwnerId().equals(source.getControllerId())
&& game.getState().getZone(objectId) == Zone.GRAVEYARD) { && game.getState().getZone(objectId) == Zone.GRAVEYARD) {
return true; return true;

View file

@ -27,18 +27,14 @@
*/ */
package mage.cards.h; package mage.cards.h;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect; import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -49,6 +45,10 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/** /**
* *
* @author pcasaretto * @author pcasaretto
@ -97,9 +97,7 @@ class HarshMercyEffect extends OneShotEffect {
PlayerIteration: PlayerIteration:
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type");
typeChoice.setChoices(SubType.getCreatureTypes(false));
while (!player.choose(Outcome.DestroyPermanent, typeChoice, game)) { while (!player.choose(Outcome.DestroyPermanent, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
continue PlayerIteration; continue PlayerIteration;

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;
@ -46,6 +45,7 @@ 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.CardType;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
@ -53,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
@ -123,7 +125,7 @@ class HavenOfTheSpiritManaCondition extends CreatureCastManaCondition {
public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) { public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) {
if (super.apply(game, source)) { if (super.apply(game, source)) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
if (object.hasSubtype("Dragon", game) if (object.hasSubtype(SubType.DRAGON, game)
&& object.isCreature()) { && object.isCreature()) {
return true; return true;
} }
@ -140,7 +142,7 @@ class DragonCreatureCardPredicate implements Predicate<Card> {
@Override @Override
public boolean apply(Card input, Game game) { public boolean apply(Card input, Game game) {
return input.isCreature() return input.isCreature()
&& input.hasSubtype("Dragon", game); && input.hasSubtype(SubType.DRAGON, game);
} }
@Override @Override

View file

@ -39,6 +39,7 @@ import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
/** /**
@ -56,7 +57,7 @@ public class HeavyMattock extends CardImpl {
// Equipped creature gets +1/+1. // Equipped creature gets +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1)));
// As long as equipped creature is a Human, it gets an additional +1/+1. // As long as equipped creature is a Human, it gets an additional +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(1, 1), new EquippedHasSubtypeCondition("Human"), staticText))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(1, 1), new EquippedHasSubtypeCondition(SubType.HUMAN), staticText)));
// Equip {2} // Equip {2}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2))); this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2)));
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.h; package mage.cards.h;
import mage.constants.*;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
@ -35,11 +34,11 @@ import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
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.*;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -107,7 +106,7 @@ class HeraldOfWarCostReductionEffect extends CostModificationEffectImpl {
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) { if (abilityToModify instanceof SpellAbility) {
Card sourceCard = game.getCard(abilityToModify.getSourceId()); Card sourceCard = game.getCard(abilityToModify.getSourceId());
if (sourceCard != null && abilityToModify.getControllerId().equals(source.getControllerId()) && (sourceCard.hasSubtype("Angel", game) || sourceCard.hasSubtype("Human", game))) { if (sourceCard != null && abilityToModify.getControllerId().equals(source.getControllerId()) && (sourceCard.hasSubtype(SubType.ANGEL, game) || sourceCard.hasSubtype(SubType.HUMAN, game))) {
return true; return true;
} }
} }

View file

@ -1,7 +1,5 @@
package mage.cards.h; package mage.cards.h;
import java.util.ArrayList;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect; import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect;
@ -11,6 +9,9 @@ import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import mage.util.SubTypeList;
import java.util.UUID;
/** /**
* Created by Alexsandr0x. * Created by Alexsandr0x.
@ -27,8 +28,8 @@ public class Hivestone extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Creatures you control are Slivers in addition to their other creature types. // Creatures you control are Slivers in addition to their other creature types.
ArrayList<String> subTypes = new ArrayList<>(); SubTypeList subTypes = new SubTypeList();
subTypes.add("Sliver"); subTypes.add(SubType.SLIVER);
Effect effect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subTypes, filter, false); Effect effect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subTypes, filter, false);
effect.setText("Creatures you control are Slivers in addition to their other creature types"); effect.setText("Creatures you control are Slivers in addition to their other creature types");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -27,21 +27,23 @@
*/ */
package mage.cards.h; package mage.cards.h;
import java.util.UUID;
import mage.constants.CardType;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.abilities.costs.common.TapSourceCost; import mage.constants.CardType;
import mage.abilities.Ability;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.common.SimpleActivatedAbility;
import mage.constants.Zone;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.game.permanent.Permanent; import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
* *
@ -90,7 +92,7 @@ class HolyJusticiarEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget()); Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature != null) { if (creature != null) {
if (creature.hasSubtype("Zombie", game)) { if (creature.hasSubtype(SubType.ZOMBIE, game)) {
creature.tap(game); creature.tap(game);
creature.moveToExile(source.getSourceId(), creature.getName(), source.getSourceId(), game); creature.moveToExile(source.getSourceId(), creature.getName(), source.getSourceId(), game);
} else { } else {

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.j; package mage.cards.j;
import java.util.Arrays;
import java.util.UUID;
import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.SourceHasSubtypeCondition; import mage.abilities.condition.common.SourceHasSubtypeCondition;
import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.decorator.ConditionalContinuousEffect;
@ -39,7 +37,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.util.SubTypeList;
import java.util.UUID;
/** /**
* *
@ -53,11 +55,13 @@ public class JarKaiBattleStance extends CardImpl {
// Target creature gains double strike until end of turn. // Target creature gains double strike until end of turn.
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn)); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
SubTypeList s = new SubTypeList();
s.add(SubType.JEDI);
s.add(SubType.SITH);
// If that creature is a Jedi or Sith, it also gains trample until end of turn. // If that creature is a Jedi or Sith, it also gains trample until end of turn.
this.getSpellAbility().addEffect(new ConditionalContinuousEffect( this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn),
new LockedInCondition(new SourceHasSubtypeCondition(Arrays.asList("Jedi", "Sith"))), new LockedInCondition(new SourceHasSubtypeCondition(s)),
"If that creature is a Jedi or Sith, it also gains trample until end of turn")); "If that creature is a Jedi or Sith, it also gains trample until end of turn"));
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.k; package mage.cards.k;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
@ -36,6 +35,7 @@ import mage.abilities.effects.common.LoseLifeTargetEffect;
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.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -44,6 +44,8 @@ import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.UUID;
/** /**
* *
* @author maurer.it_at_gmail.com * @author maurer.it_at_gmail.com
@ -110,7 +112,7 @@ class KalastriaHighbornTriggeredAbility extends TriggeredAbilityImpl {
zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getFromZone() == Zone.BATTLEFIELD &&
(permanent.getControllerId().equals(this.getControllerId()) && (permanent.getControllerId().equals(this.getControllerId()) &&
permanent.hasSubtype("Vampire", game) || permanent.getId().equals(this.getSourceId())); permanent.hasSubtype(SubType.VAMPIRE, game) || permanent.getId().equals(this.getSourceId()));
} }
@Override @Override

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.k; package mage.cards.k;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -40,9 +39,8 @@ import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
@ -51,6 +49,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author emerald000 * @author emerald000
@ -153,9 +153,7 @@ class KaronaFalseGodEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && controller != null) { if (sourceObject != null && controller != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
while (!controller.choose(Outcome.BoostCreature, typeChoice, game)) { while (!controller.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.k; package mage.cards.k;
import java.util.ArrayList;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.AbilitiesImpl; import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -41,6 +39,9 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.util.SubTypeList;
import java.util.UUID;
/** /**
* *
@ -92,7 +93,7 @@ class KinTreeInvocationCreateTokenEffect extends OneShotEffect {
} }
} }
ArrayList<String> list = new ArrayList<>(); SubTypeList list = new SubTypeList();
list.add("Spirit"); list.add("Spirit");
list.add("Warrior"); list.add("Warrior");
ObjectColor objectColor = new ObjectColor(); ObjectColor objectColor = new ObjectColor();

View file

@ -120,7 +120,7 @@ class LimDulTheNecromancerEffect extends OneShotEffect {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game) if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)
&& card.isCreature()) { && card.isCreature()) {
Permanent creature = game.getPermanent(card.getId()); Permanent creature = game.getPermanent(card.getId());
ContinuousEffect effect = new AddCardSubTypeTargetEffect("Zombie", Duration.WhileOnBattlefield); ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.ZOMBIE, Duration.WhileOnBattlefield);
effect.setTargetPointer(new FixedTarget(creature.getId())); effect.setTargetPointer(new FixedTarget(creature.getId()));
game.addEffect(effect, source); game.addEffect(effect, source);
} }

View file

@ -44,6 +44,7 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* *
@ -90,7 +91,7 @@ class LuminescentRainEffect extends OneShotEffect {
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:"); typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false)); typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(p->p.toString()).collect(Collectors.toSet()));
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -34,7 +34,6 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.mana.RedManaAbility; import mage.abilities.mana.RedManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterLandPermanent; import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -107,7 +106,7 @@ public class MagusOfTheMoon extends CardImpl {
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects // 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
// So the ability removing has to be done before Layer 6 // So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game); land.removeAllAbilities(source.getSourceId(), game);
land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes()); land.getSubtype(game).removeAll(SubType.getLandTypes(false));
land.getSubtype(game).add("Mountain"); land.getSubtype(game).add("Mountain");
break; break;
case AbilityAddingRemovingEffects_6: case AbilityAddingRemovingEffects_6:

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -37,6 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.game.Game; import mage.game.Game;
@ -45,6 +45,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/** /**
* *
* @author emerald000 * @author emerald000
@ -98,7 +100,7 @@ class MarduWoeReaperTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) { if (event.getPlayerId().equals(this.getControllerId())) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && (permanent.getId().equals(this.getSourceId()) || permanent.hasSubtype("Warrior", game))) { if (permanent != null && (permanent.getId().equals(this.getSourceId()) || permanent.hasSubtype(SubType.WARRIOR, game))) {
return true; return true;
} }
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.m; package mage.cards.m;
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;
@ -36,10 +35,7 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect; import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect;
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.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.EntersTheBattlefieldEvent;
@ -48,6 +44,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -109,7 +107,7 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl {
if (power > 0) { if (power > 0) {
creature.addCounters(CounterType.P1P1.createInstance(power), source, game); creature.addCounters(CounterType.P1P1.createInstance(power), source, game);
} }
ContinuousEffect effect = new AddCardSubTypeTargetEffect("Mutant", Duration.Custom); ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.MUTANT, Duration.Custom);
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1)); effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));
game.addEffect(effect, source); game.addEffect(effect, source);
} }

View file

@ -115,7 +115,7 @@ class MazesEndEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent.hasSubtype("Gate", game)) { if (permanent.hasSubtype(SubType.GATE, game)) {
if (!names.contains(permanent.getName())) { if (!names.contains(permanent.getName())) {
names.add(permanent.getName()); names.add(permanent.getName());
} }

View file

@ -109,7 +109,7 @@ class MistbindCliqueAbility extends ZoneChangeTriggeredAbility {
&& event.getSourceId().equals(getSourceId()) && event.getSourceId().equals(getSourceId())
&& !event.getSourceId().equals(event.getTargetId())) { && !event.getSourceId().equals(event.getTargetId())) {
Permanent sacrificed = game.getPermanentOrLKIBattlefield(event.getTargetId()); Permanent sacrificed = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (sacrificed != null && sacrificed.hasSubtype("Faerie", game)) { if (sacrificed != null && sacrificed.hasSubtype(SubType.FAERIE, game)) {
return true; return true;
} }
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.m; package mage.cards.m;
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,21 +38,18 @@ import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
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 mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author cbt33, Plopman (Engineered Plague) * @author cbt33, Plopman (Engineered Plague)
*/ */
public class MistformSliver extends CardImpl { public class MistformSliver extends CardImpl {
@ -97,16 +93,14 @@ class MistformSliverEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) { if (player != null && permanent != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
while (!player.choose(Outcome.Detriment, typeChoice, game)) { while (!player.choose(Outcome.Detriment, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;
} }
} }
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice()); game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
ContinuousEffect effect = new AddCardSubTypeTargetEffect(typeChoice.getChoice(), Duration.EndOfTurn); ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.byDescription(typeChoice.getChoice()), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent.getId())); effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source); game.addEffect(effect, source);
} }

View file

@ -27,20 +27,20 @@
*/ */
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.ChangelingAbility;
import mage.abilities.mana.ColorlessManaAbility; import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import java.util.UUID;
/** /**
* *
* @author jonubuu * @author jonubuu
@ -73,7 +73,7 @@ class MutavaultToken extends Token {
public MutavaultToken() { public MutavaultToken() {
super("", "2/2 creature with all creature types"); super("", "2/2 creature with all creature types");
cardType.add(CardType.CREATURE); cardType.add(CardType.CREATURE);
subtype.add(ChangelingAbility.ALL_CREATURE_TYPE); setIsAllCreatureTypes(true);
power = new MageInt(2); power = new MageInt(2);
toughness = new MageInt(2); toughness = new MageInt(2);
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.ConditionalMana; import mage.ConditionalMana;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
@ -49,6 +48,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/** /**
* @author nantuko * @author nantuko
*/ */
@ -114,7 +115,7 @@ class MyrManaCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
if (object != null && object.hasSubtype("Myr", game)) { if (object != null && object.hasSubtype(SubType.MYR, game)) {
return true; return true;
} }
return false; return false;

View file

@ -27,9 +27,6 @@
*/ */
package mage.cards.m; package mage.cards.m;
import java.util.HashSet;
import java.util.Iterator;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -44,11 +41,16 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.Cards; import mage.cards.Cards;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterBasicLandCard; import mage.filter.common.FilterBasicLandCard;
import mage.game.Game; import mage.game.Game;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.util.SubTypeList;
import java.util.Iterator;
import java.util.UUID;
/** /**
* *
@ -103,12 +105,11 @@ class TargetCardInLibrarySharingLandType extends TargetCardInLibrary {
if (super.canTarget(id, cards, game)) { if (super.canTarget(id, cards, game)) {
if (!getTargets().isEmpty()) { if (!getTargets().isEmpty()) {
// check if new target shares a Land Type // check if new target shares a Land Type
HashSet<String> landTypes = null; SubTypeList landTypes = new SubTypeList();
for (UUID landId: getTargets()) { for (UUID landId: getTargets()) {
Card landCard = game.getCard(landId); Card landCard = game.getCard(landId);
if (landCard != null) { if (landCard != null) {
if (landTypes == null) { if (landTypes.isEmpty()) {
landTypes = new HashSet<>();
landTypes.addAll(landCard.getSubtype(game)); landTypes.addAll(landCard.getSubtype(game));
} else { } else {
landTypes.removeIf(next -> !landCard.getSubtype(game).contains(next)); landTypes.removeIf(next -> !landCard.getSubtype(game).contains(next));
@ -116,9 +117,9 @@ class TargetCardInLibrarySharingLandType extends TargetCardInLibrary {
} }
} }
Card card = game.getCard(id); Card card = game.getCard(id);
if (card != null && landTypes != null) { if (card != null && !landTypes.isEmpty()) {
for (Iterator<String> iterator = landTypes.iterator(); iterator.hasNext();) { for (Iterator<SubType> iterator = landTypes.iterator(); iterator.hasNext();) {
String next = iterator.next(); SubType next = iterator.next();
if (card.getSubtype(game).contains(next)) { if (card.getSubtype(game).contains(next)) {
return true; return true;
} }

View file

@ -38,10 +38,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceColor; import mage.choices.ChoiceColor;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ManaEvent; import mage.game.events.ManaEvent;
@ -103,19 +100,19 @@ class NakedSingularityEffect extends ReplacementEffectImpl {
Choice choice = new ChoiceColor(true); Choice choice = new ChoiceColor(true);
choice.getChoices().clear(); choice.getChoices().clear();
choice.setMessage("Pick a color to produce"); choice.setMessage("Pick a color to produce");
if (permanent.hasSubtype("Plains", game)) { if (permanent.hasSubtype(SubType.PLAINS, game)) {
choice.getChoices().add("Red"); choice.getChoices().add("Red");
} }
if (permanent.hasSubtype("Island", game)) { if (permanent.hasSubtype(SubType.ISLAND, game)) {
choice.getChoices().add("Green"); choice.getChoices().add("Green");
} }
if (permanent.hasSubtype("Swamp", game)) { if (permanent.hasSubtype(SubType.SWAMP, game)) {
choice.getChoices().add("White"); choice.getChoices().add("White");
} }
if (permanent.hasSubtype("Mountain", game)) { if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
choice.getChoices().add("Blue"); choice.getChoices().add("Blue");
} }
if (permanent.hasSubtype("Forest", game)) { if (permanent.hasSubtype(SubType.FOREST, game)) {
choice.getChoices().add("Black"); choice.getChoices().add("Black");
} }
String chosenColor; String chosenColor;

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
@ -41,6 +40,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.game.Game; import mage.game.Game;
@ -48,6 +48,8 @@ import mage.game.permanent.token.ZombieToken;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.UUID;
/** /**
* @author noxx * @author noxx
*/ */
@ -97,7 +99,7 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl {
if (card == null) { if (card == null) {
return false; return false;
} }
isZombieCard = card.hasSubtype("Zombie", game); isZombieCard = card.hasSubtype(SubType.ZOMBIE, game);
paid |= player.discard(card, null, game); paid |= player.discard(card, null, game);
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -44,11 +43,7 @@ import mage.abilities.keyword.IntimidateAbility;
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.AttachmentType; import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; 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;
@ -58,6 +53,8 @@ import mage.game.permanent.PermanentToken;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author nantuko * @author nantuko
@ -74,7 +71,7 @@ public class NimDeathmantle extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(IntimidateAbility.getInstance(), AttachmentType.EQUIPMENT))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(IntimidateAbility.getInstance(), AttachmentType.EQUIPMENT)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetCardColorAttachedEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetCardColorAttachedEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetCardSubtypeAttachedEffect("Zombie", Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetCardSubtypeAttachedEffect(SubType.ZOMBIE, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT)));
// Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it. // Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it.
this.addAbility(new NimDeathmantleTriggeredAbility()); this.addAbility(new NimDeathmantleTriggeredAbility());

View file

@ -66,7 +66,7 @@ public class NuteGunray extends CardImpl {
public NuteGunray(UUID ownerId, CardSetInfo setInfo) { public NuteGunray(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add("Neimidian"); this.subtype.add("Neimoidian");
this.subtype.add("Advisor"); this.subtype.add("Advisor");
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);

View file

@ -41,14 +41,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.counters.CounterType; import mage.counters.CounterType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.UUID;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public class OliviaMobilizedForWar extends CardImpl { public class OliviaMobilizedForWar extends CardImpl {
@ -72,7 +69,7 @@ public class OliviaMobilizedForWar extends CardImpl {
effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setText(", it gains haste until end of turn,"); effect.setText(", it gains haste until end of turn,");
doIfCostPaid.addEffect(effect); doIfCostPaid.addEffect(effect);
effect = new BecomesCreatureTypeTargetEffect(Duration.WhileOnBattlefield, new ArrayList<>(Collections.singletonList("Vampire")), false); effect = new BecomesCreatureTypeTargetEffect(Duration.WhileOnBattlefield, SubType.VAMPIRE, false);
effect.setText("and it becomes a Vampire in addition to its other types"); effect.setText("and it becomes a Vampire in addition to its other types");
doIfCostPaid.addEffect(effect); doIfCostPaid.addEffect(effect);
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, doIfCostPaid, this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, doIfCostPaid,

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.o; package mage.cards.o;
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;
@ -52,6 +51,8 @@ import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
* *
* @author nantuko * @author nantuko
@ -85,7 +86,7 @@ public class OliviaVoldaren extends CardImpl {
// {1}{R}: Olivia Voldaren deals 1 damage to another target creature. That creature becomes a Vampire in addition to its other types. Put a +1/+1 counter on Olivia Voldaren. // {1}{R}: Olivia Voldaren deals 1 damage to another target creature. That creature becomes a Vampire in addition to its other types. Put a +1/+1 counter on Olivia Voldaren.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}"));
ability.addTarget(new TargetCreaturePermanent(filter)); ability.addTarget(new TargetCreaturePermanent(filter));
Effect effect = new AddCardSubTypeTargetEffect("Vampire", Duration.WhileOnBattlefield); Effect effect = new AddCardSubTypeTargetEffect(SubType.VAMPIRE, Duration.WhileOnBattlefield);
effect.setText("That creature becomes a Vampire in addition to its other types"); effect.setText("That creature becomes a Vampire in addition to its other types");
ability.addEffect(effect); ability.addEffect(effect);
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()));

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -38,10 +37,7 @@ import mage.abilities.effects.common.discard.DiscardTargetEffect;
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.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamagedPlayerEvent; import mage.game.events.DamagedPlayerEvent;
@ -51,6 +47,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author fireshoes * @author fireshoes
@ -105,7 +103,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null && creature.getControllerId().equals(source.getControllerId()) if (creature != null && creature.getControllerId().equals(source.getControllerId())
&& creature.isCreature() && creature.isCreature()
&& creature.hasSubtype("Rogue", game) && creature.hasSubtype(SubType.ROGUE, game)
&& !event.getTargetId().equals(source.getSourceId())) { && !event.getTargetId().equals(source.getSourceId())) {
return true; return true;
} }

View file

@ -27,10 +27,6 @@
*/ */
package mage.cards.o; package mage.cards.o;
import java.util.ArrayList;
import java.util.UUID;
import mage.constants.CardType;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.AbilitiesImpl; import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -41,6 +37,7 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; 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.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
@ -50,6 +47,9 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.util.SubTypeList;
import java.util.UUID;
/** /**
* *
@ -105,8 +105,8 @@ class OozeGardenCreateTokenEffect extends OneShotEffect {
value = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue(); value = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue();
} }
} }
ArrayList<String> list = new ArrayList<>(); SubTypeList list = new SubTypeList();
list.add("Ooze"); list.add(SubType.OOZE);
Token token = new Token("Ooze", "X/X green Ooze creature token, where X is the sacrificed creature's power", ObjectColor.GREEN, list, value, value, new AbilitiesImpl<>()) { Token token = new Token("Ooze", "X/X green Ooze creature token, where X is the sacrificed creature's power", ObjectColor.GREEN, list, value, value, new AbilitiesImpl<>()) {

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -38,6 +37,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
@ -45,6 +45,8 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author fireshoes * @author fireshoes
@ -143,7 +145,7 @@ class OranRiefHydraEffect extends OneShotEffect {
Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (land != null && sourcePermanent != null) { if (land != null && sourcePermanent != null) {
if (land.hasSubtype("Forest", game)) { if (land.hasSubtype(SubType.FOREST, game)) {
sourcePermanent.addCounters(CounterType.P1P1.createInstance(2), source, game); sourcePermanent.addCounters(CounterType.P1P1.createInstance(2), source, game);
} else { } else {
sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game);

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.o; package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.common.DiscardTargetCost; import mage.abilities.costs.common.DiscardTargetCost;
@ -36,7 +35,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -50,8 +48,10 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.UUID;
import java.util.stream.Collectors;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public class Outbreak extends CardImpl { public class Outbreak extends CardImpl {
@ -99,7 +99,7 @@ class OutbreakEffect extends OneShotEffect {
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:"); typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false)); typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(p -> p.toString()).collect(Collectors.toSet()));
while (!player.choose(outcome, typeChoice, game)) { while (!player.choose(outcome, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.p; package mage.cards.p;
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.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
@ -36,9 +35,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -50,6 +48,8 @@ import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author fenhl * @author fenhl
@ -94,9 +94,7 @@ class PacksDisdainEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
while (!player.choose(Outcome.UnboostCreature, typeChoice, game)) { while (!player.choose(Outcome.UnboostCreature, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -27,17 +27,11 @@
*/ */
package mage.cards.p; package mage.cards.p;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -51,6 +45,9 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author duncant * @author duncant
*/ */
@ -99,7 +96,7 @@ class PatriarchsBiddingEffect extends OneShotEffect {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type"); typeChoice.setMessage("Choose a creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(Outcome.PutCreatureInPlay, typeChoice, game)) { while (!player.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
break; break;

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
@ -35,7 +34,6 @@ import mage.abilities.effects.OneShotEffect;
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.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -50,6 +48,9 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* *
* @author emerald000 * @author emerald000
@ -95,7 +96,7 @@ class PeerPressureEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose creature type"); choice.setMessage("Choose creature type");
choice.setChoices(SubType.getCreatureTypes(false)); choice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::getDescription).collect(Collectors.toSet()));
while (!controller.choose(Outcome.GainControl, choice, game)) { while (!controller.choose(Outcome.GainControl, choice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -51,6 +50,8 @@ import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.util.TargetAddress; import mage.util.TargetAddress;
import java.util.UUID;
/** /**
* @author duncant * @author duncant
*/ */
@ -114,7 +115,7 @@ class PrecursorGolemCopyTriggeredAbility extends TriggeredAbilityImpl {
Target targetInstance = addr.getTarget(spell); Target targetInstance = addr.getTarget(spell);
for (UUID target : targetInstance.getTargets()) { for (UUID target : targetInstance.getTargets()) {
Permanent permanent = game.getPermanent(target); Permanent permanent = game.getPermanent(target);
if (permanent == null || !permanent.hasSubtype("Golem", game)) { if (permanent == null || !permanent.hasSubtype(SubType.GOLEM, game)) {
return false; return false;
} }
if (targetGolem == null) { if (targetGolem == null) {

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.ConditionalMana; import mage.ConditionalMana;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
@ -49,6 +48,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.UUID;
/** /**
* *
* @author TGower * @author TGower
@ -110,6 +111,6 @@ class PrimalBeyondManaCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
return object != null && object.hasSubtype("Elemental", game); return object != null && object.hasSubtype(SubType.ELEMENTAL, game);
} }
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.common.PayLifeCost;
@ -38,12 +37,15 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamagedPlayerEvent; import mage.game.events.DamagedPlayerEvent;
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 emerald000 * @author emerald000
@ -95,7 +97,7 @@ class RaidersSpoilsTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent permanent = game.getPermanent(event.getSourceId()); Permanent permanent = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && permanent != null && permanent.hasSubtype("Warrior", game) && permanent.getControllerId().equals(controllerId)) { if (damageEvent.isCombatDamage() && permanent != null && permanent.hasSubtype(SubType.WARRIOR, game) && permanent.getControllerId().equals(controllerId)) {
return true; return true;
} }
return false; return false;

View file

@ -27,8 +27,6 @@
*/ */
package mage.cards.r; package mage.cards.r;
import java.util.ArrayList;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DiesAttachedTriggeredAbility; import mage.abilities.common.DiesAttachedTriggeredAbility;
@ -51,6 +49,9 @@ import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.ArrayList;
import java.util.UUID;
/** /**
* *
* @author jeffwadsworth * @author jeffwadsworth
@ -111,8 +112,8 @@ class ReinsOfTheVinesteedEffect extends OneShotEffect {
FilterCreaturePermanent FILTER = new FilterCreaturePermanent(); FilterCreaturePermanent FILTER = new FilterCreaturePermanent();
StringBuilder sb = new StringBuilder("creature that shares a creature type with the formerly attached creature: "); StringBuilder sb = new StringBuilder("creature that shares a creature type with the formerly attached creature: ");
ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>(); ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>();
for (String subtype : lastStateCreature.getSubtype(game)) { for (SubType subtype : lastStateCreature.getSubtype(game)) {
subtypes.add(new SubtypePredicate(SubType.byDescription(subtype))); subtypes.add(new SubtypePredicate(subtype));
sb.append(subtype).append(", "); sb.append(subtype).append(", ");
} }
FILTER.add(Predicates.or(subtypes)); FILTER.add(Predicates.or(subtypes));

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -37,7 +36,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
@ -50,8 +48,10 @@ 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;
import java.util.stream.Collectors;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public class RiptideChronologist extends CardImpl { public class RiptideChronologist extends CardImpl {
@ -97,7 +97,7 @@ class RiptideChronologistEffect extends OneShotEffect {
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:"); typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false)); typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!player.choose(outcome, typeChoice, game)) { while (!player.choose(outcome, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; return false;

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -35,20 +34,19 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
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.players.Player; import mage.players.Player;
import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* *
* @author emerald000 * @author emerald000
@ -101,7 +99,7 @@ class RiptideShapeshifterEffect extends OneShotEffect {
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose a creature type:"); choice.setMessage("Choose a creature type:");
choice.setChoices(CardRepository.instance.getCreatureTypes()); choice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
while (!controller.choose(Outcome.BoostCreature, choice, game)) { while (!controller.choose(Outcome.BoostCreature, choice, game)) {
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;

View file

@ -27,16 +27,14 @@
*/ */
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceCreatureType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
@ -46,8 +44,9 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
/** /**
*
* @author michael.napoleon@gmail.com * @author michael.napoleon@gmail.com
*/ */
public class RoarOfTheCrowd extends CardImpl { public class RoarOfTheCrowd extends CardImpl {
@ -87,12 +86,11 @@ class RoarOfTheCrowdEffect extends OneShotEffect {
return new RoarOfTheCrowdEffect(this); return new RoarOfTheCrowdEffect(this);
} }
@Override public boolean apply(Game game, Ability source) { @Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
Choice typeChoice = new ChoiceImpl(true); Choice typeChoice = new ChoiceCreatureType();
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false));
while (!player.choose(Outcome.LoseLife, typeChoice, game)) { while (!player.choose(Outcome.LoseLife, typeChoice, game)) {
if (!player.canRespond()) { if (!player.canRespond()) {
return false; 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.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -38,10 +37,7 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
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.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.EntersTheBattlefieldEvent;
@ -49,6 +45,8 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/** /**
* *
* @author fireshoes * @author fireshoes
@ -102,7 +100,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.getControllerId().equals(source.getControllerId()) return creature != null && creature.getControllerId().equals(source.getControllerId())
&& creature.isCreature() && creature.isCreature()
&& creature.hasSubtype("Wizard", game) && creature.hasSubtype(SubType.WIZARD, game)
&& !event.getTargetId().equals(source.getSourceId()); && !event.getTargetId().equals(source.getSourceId());
} }

View file

@ -28,7 +28,6 @@
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EquippedHasSubtypeCondition; import mage.abilities.condition.common.EquippedHasSubtypeCondition;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
@ -39,10 +38,9 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.MenaceAbility; import mage.abilities.keyword.MenaceAbility;
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.Outcome; import java.util.UUID;
import mage.constants.Zone;
/** /**
* *
@ -64,7 +62,7 @@ public class ScroungedScythe extends CardImpl {
// As long as equipped creature is a Human, it has menace. // As long as equipped creature is a Human, it has menace.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new GainAbilityAttachedEffect(new MenaceAbility(), AttachmentType.EQUIPMENT), new ConditionalContinuousEffect(new GainAbilityAttachedEffect(new MenaceAbility(), AttachmentType.EQUIPMENT),
new EquippedHasSubtypeCondition("Human"), staticText))); new EquippedHasSubtypeCondition(SubType.HUMAN), staticText)));
// Equip {2} // Equip {2}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2))); this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));

View file

@ -39,10 +39,7 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.BushidoAbility; import mage.abilities.keyword.BushidoAbility;
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.SuperType;
import mage.constants.Zone;
import mage.counters.Counter; import mage.counters.Counter;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -71,7 +68,7 @@ public class SenseiGoldenTail extends CardImpl {
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
// That creature gains bushido 1 and becomes a Samurai in addition to its other creature types. Activate this ability only any time you could cast a sorcery. // That creature gains bushido 1 and becomes a Samurai in addition to its other creature types. Activate this ability only any time you could cast a sorcery.
ability.addEffect(new GainAbilityTargetEffect(new BushidoAbility(1),Duration.Custom)); ability.addEffect(new GainAbilityTargetEffect(new BushidoAbility(1),Duration.Custom));
ability.addEffect(new AddCardSubTypeTargetEffect("Samurai",Duration.Custom)); ability.addEffect(new AddCardSubTypeTargetEffect(SubType.SAMURAI,Duration.Custom));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -27,10 +27,6 @@
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.ArrayList;
import java.util.UUID;
import mage.constants.*;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
@ -39,6 +35,7 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.ChangelingAbility; import mage.abilities.keyword.ChangelingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -48,6 +45,9 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.ArrayList;
import java.util.UUID;
/** /**
* *
* @author Plopman * @author Plopman
@ -100,7 +100,7 @@ class SharedAnimosityEffect extends ContinuousEffectImpl {
filter.add(Predicates.not(new PermanentIdPredicate(this.targetPointer.getFirst(game, source)))); filter.add(Predicates.not(new PermanentIdPredicate(this.targetPointer.getFirst(game, source))));
filter.add(new AttackingPredicate()); filter.add(new AttackingPredicate());
boolean allCreatureTypes = false; boolean allCreatureTypes = false;
if (permanent.getSubtype(game).contains(ChangelingAbility.ALL_CREATURE_TYPE)) { if (permanent.isAllCreatureTypes()) {
allCreatureTypes = true; allCreatureTypes = true;
} else { } else {
for(Ability ability : permanent.getAbilities()){ for(Ability ability : permanent.getAbilities()){
@ -111,8 +111,8 @@ class SharedAnimosityEffect extends ContinuousEffectImpl {
} }
if(!allCreatureTypes){ if(!allCreatureTypes){
ArrayList<Predicate<MageObject>> predicateList = new ArrayList<>(); ArrayList<Predicate<MageObject>> predicateList = new ArrayList<>();
for(String subtype : permanent.getSubtype(game)){ for(SubType subtype : permanent.getSubtype(game)){
predicateList.add(new SubtypePredicate(SubType.byDescription(subtype))); predicateList.add(new SubtypePredicate(subtype));
} }
filter.add(Predicates.or(predicateList)); filter.add(Predicates.or(predicateList));
} }

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EquippedHasSubtypeCondition; import mage.abilities.condition.common.EquippedHasSubtypeCondition;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
@ -38,10 +37,9 @@ 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.Outcome; import java.util.UUID;
import mage.constants.Zone;
/** /**
* *
@ -62,7 +60,7 @@ public class SharpenedPitchfork extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT)));
// As long as equipped creature is a Human, it gets +1/+1. // As long as equipped creature is a Human, it gets +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(1, 1), new EquippedHasSubtypeCondition("Human"), staticText))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(1, 1), new EquippedHasSubtypeCondition(SubType.HUMAN), staticText)));
} }
public SharpenedPitchfork(final SharpenedPitchfork card) { public SharpenedPitchfork(final SharpenedPitchfork card) {

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.Mode; import mage.abilities.Mode;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -43,18 +42,14 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.EquipAbility;
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.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -207,7 +202,7 @@ class ShurikenControlEffect extends OneShotEffect {
if (equipment != null) { if (equipment != null) {
Permanent creature = game.getPermanent(source.getSourceId()); Permanent creature = game.getPermanent(source.getSourceId());
if (creature != null) { if (creature != null) {
if (!creature.hasSubtype("Ninja", game)) { if (!creature.hasSubtype(SubType.NINJA, game)) {
Permanent damagedCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); Permanent damagedCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (damagedCreature == null) { if (damagedCreature == null) {
damagedCreature = (Permanent) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD); damagedCreature = (Permanent) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);

View file

@ -27,9 +27,6 @@
*/ */
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.constants.CardType;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EquippedHasSubtypeCondition; import mage.abilities.condition.common.EquippedHasSubtypeCondition;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
@ -38,9 +35,13 @@ import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import java.util.UUID;
/** /**
* @author nantuko * @author nantuko
*/ */
@ -59,7 +60,7 @@ public class SilverInlaidDagger extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 0))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 0)));
// As long as equipped creature is a Human, it gets an additional +1/+0 // As long as equipped creature is a Human, it gets an additional +1/+0
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(1, 0), new EquippedHasSubtypeCondition("Human"), staticText))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(1, 0), new EquippedHasSubtypeCondition(SubType.HUMAN), staticText)));
} }
public SilverInlaidDagger(final SilverInlaidDagger card) { public SilverInlaidDagger(final SilverInlaidDagger card) {

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