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.constants.CardType;
import mage.constants.EnlargeMode;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.view.*;
import org.apache.log4j.Logger;
@ -277,7 +278,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
if (!card.getSubTypes().isEmpty()) {
sbType.append("- ");
for (String subType : card.getSubTypes()) {
for (SubType subType : card.getSubTypes()) {
sbType.append(subType).append(' ');
}
}

View file

@ -1,15 +1,5 @@
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.MageCard;
import mage.cards.decks.DeckCardInfo;
@ -23,6 +13,7 @@ import mage.client.dialog.PreferencesDialog;
import mage.client.plugins.impl.Plugins;
import mage.client.util.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.util.RandomUtil;
import mage.view.CardView;
@ -30,6 +21,17 @@ import mage.view.CardsView;
import org.apache.log4j.Logger;
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.
*/
@ -1273,8 +1275,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (SuperType str : card.getSuperTypes()) {
s |= str.toString().toLowerCase().contains(searchStr);
}
for (String str : card.getSubTypes()) {
s |= str.toLowerCase().contains(searchStr);
for (SubType str : card.getSubTypes()) {
s |= str.toString().toLowerCase().contains(searchStr);
}
}
// Rarity
@ -1349,8 +1351,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (SuperType type : card.getSuperTypes()) {
t += ' ' + type.toString().toLowerCase();
}
for (String str : card.getSubTypes()) {
t += ' ' + str.toLowerCase();
for (SubType str : card.getSubTypes()) {
t += " " + str.toString().toLowerCase();
}
for (String qty : qtys.keySet()) {

View file

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

View file

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

View file

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

View file

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

View file

@ -11,6 +11,8 @@ import mage.cards.FrameStyle;
import mage.client.dialog.PreferencesDialog;
import mage.constants.CardType;
import mage.constants.MageObjectType;
import mage.constants.SubType;
import mage.util.SubTypeList;
import mage.view.CardView;
import mage.view.PermanentView;
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
// and the current card.
protected static Paint getBackgroundPaint(ObjectColor colors, Collection<CardType> types, Collection<String> subTypes) {
if (subTypes.contains("Vehicle")) {
protected static Paint getBackgroundPaint(ObjectColor colors, Collection<CardType> types, SubTypeList subTypes) {
if (subTypes.contains(SubType.VEHICLE)) {
return BG_TEXTURE_VEHICLE;
} else if (types.contains(CardType.LAND)) {
return BG_TEXTURE_LAND;

View file

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

View file

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

View file

@ -27,10 +27,6 @@
*/
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.Mana;
import mage.abilities.*;
@ -81,6 +77,11 @@ import mage.util.TournamentUtil;
import mage.util.TreeNode;
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
@ -1340,8 +1341,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (game.getOpponents(this.getId()).contains(permanent.getControllerId())
&& permanent.getCardType().contains(CardType.CREATURE)
&& !permanent.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(permanent.getSubtype(game).get(0))) {
choice.setChoice(permanent.getSubtype(game).get(0));
if (choice.getChoices().contains(permanent.getSubtype(game).get(0).toString())) {
choice.setChoice(permanent.getSubtype(game).get(0).toString());
break;
}
}
@ -1352,8 +1353,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
Player opponent = game.getPlayer(opponentId);
for (Card card : opponent.getGraveyard().getCards(game)) {
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(card.getSubtype(game).get(0))) {
choice.setChoice(card.getSubtype(game).get(0));
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0).toString());
break;
}
}
@ -1368,8 +1369,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
for (UUID cardId : this.getHand()) {
Card card = game.getCard(cardId);
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(card.getSubtype(game).get(0))) {
choice.setChoice(card.getSubtype(game).get(0));
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0).toString());
break;
}
}
@ -1378,8 +1379,8 @@ public class ComputerPlayer extends PlayerImpl implements Player {
for (UUID cardId : this.getLibrary().getCardList()) {
Card card = game.getCard(cardId);
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(card.getSubtype(game).get(0))) {
choice.setChoice(card.getSubtype(game).get(0));
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0).toString());
break;
}
}

View file

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

View file

@ -39,10 +39,7 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.CounterPredicate;
@ -50,8 +47,8 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.UUID;
/**
@ -76,8 +73,8 @@ public class Aurification extends CardImpl {
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.
ArrayList<String> subtypes = new ArrayList<>(1);
subtypes.add("Wall");
SubTypeList subtypes = new SubTypeList();
subtypes.add(SubType.WALL);
BecomesSubtypeAllEffect becomesSubtypeAllEffect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subtypes, filter, false);
becomesSubtypeAllEffect.setText("");

View file

@ -36,6 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
@ -130,7 +131,7 @@ class BladeOfTheBloodchiefEffect extends OneShotEffect {
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) {
if (creature.hasSubtype("Vampire", game)) {
if (creature.hasSubtype(SubType.VAMPIRE, game)) {
creature.addCounters(CounterType.P1P1.createInstance(2), source, game);
} else {
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.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.util.SubTypeList;
import java.util.UUID;
@ -57,12 +55,14 @@ public class BladedBracers extends CardImpl {
// Equipped creature gets +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.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(
new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT),
new EquippedHasSubtypeCondition("Human", "Angel"), ruleText)));
new EquippedHasSubtypeCondition(subTypes), ruleText)));
// Equip {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.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.constants.*;
import mage.filter.common.FilterLandPermanent;
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
// So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game);
land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes());
land.getSubtype(game).removeAll(SubType.getLandTypes(false));
land.getSubtype(game).add("Mountain");
break;
case AbilityAddingRemovingEffects_6:

View file

@ -34,7 +34,6 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.*;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
@ -47,6 +46,7 @@ import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
@ -103,7 +103,7 @@ class BloodlineShamanEffect extends OneShotEffect {
// Choose a creature type.
Choice typeChoice = new ChoiceImpl(true);
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)) {
if (!controller.canRespond()) {
return false;

View file

@ -39,13 +39,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.UUID;
/**
@ -65,14 +64,14 @@ public class BoldwyrIntimidator extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoldwyrIntimidatorEffect()));
// {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");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}"));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// {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");
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}{R}"));
ability.addTarget(new TargetCreaturePermanent());

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -36,10 +35,7 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.CounterPredicate;
@ -48,6 +44,8 @@ import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author emerald000
@ -111,7 +109,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.getControllerId().equals(source.getControllerId())
&& creature.isCreature()
&& creature.hasSubtype("Warrior", game)
&& creature.hasSubtype(SubType.WARRIOR, game)
&& !event.getTargetId().equals(source.getSourceId());
}

View file

@ -37,10 +37,7 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import java.util.UUID;
@ -62,7 +59,7 @@ public class ButchersCleaver extends CardImpl {
// As long as equipped creature is a Human, it has lifelink.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new GainAbilityAttachedEffect(LifelinkAbility.getInstance(), AttachmentType.EQUIPMENT),
new EquippedHasSubtypeCondition("Human"), staticText)));
new EquippedHasSubtypeCondition(SubType.HUMAN), staticText)));
// Equip {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())) {
StringBuilder sb = new StringBuilder("creature card with at least one subtype from: ");
ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>();
for (String subtype : creature.getSubtype(game)) {
subtypes.add(new SubtypePredicate(SubType.byDescription(subtype)));
for (SubType subtype : creature.getSubtype(game)) {
subtypes.add(new SubtypePredicate(subtype));
sb.append(subtype).append(", ");
}
filter.add(Predicates.or(subtypes));

View file

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

View file

@ -87,13 +87,13 @@ public class CavernOfSouls extends CardImpl {
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
String creatureType;
SubType creatureType;
@Override
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
Object value = game.getState().getValue(source.getSourceId() + "_type");
if (value != null && value instanceof String) {
creatureType = (String) value;
creatureType = SubType.byDescription((String) value);
}
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
@ -117,7 +117,7 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
class CavernOfSoulsConditionalMana extends ConditionalMana {
public CavernOfSoulsConditionalMana(Mana mana, String creatureType) {
public CavernOfSoulsConditionalMana(Mana mana, SubType creatureType) {
super(mana);
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));
@ -126,9 +126,9 @@ class CavernOfSoulsConditionalMana extends ConditionalMana {
class CavernOfSoulsManaCondition extends CreatureCastManaCondition {
String creatureType;
SubType creatureType;
CavernOfSoulsManaCondition(String creatureType) {
CavernOfSoulsManaCondition(SubType creatureType) {
this.creatureType = creatureType;
}

View file

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

View file

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

View file

@ -36,7 +36,6 @@ import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
@ -44,6 +43,7 @@ import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.util.SubTypeList;
import java.util.Iterator;
import java.util.List;
@ -94,32 +94,33 @@ class ConspiracyEffect extends ContinuousEffectImpl {
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_type");
SubType chosenSubtype = SubType.byDescription(choice);
if (controller != null && choice != null) {
// Creature cards you own that aren't on the battlefield
// in graveyard
for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId);
if (card.isCreature()) {
setCreatureSubtype(card, choice, game);
setCreatureSubtype(card, chosenSubtype, game);
}
}
// on Hand
for (UUID cardId : controller.getHand()) {
Card card = game.getCard(cardId);
if (card.isCreature()) {
setCreatureSubtype(card, choice, game);
setCreatureSubtype(card, chosenSubtype, game);
}
}
// in Exile
for (Card card : game.getState().getExile().getAllCards(game)) {
if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) {
setCreatureSubtype(card, choice, game);
setCreatureSubtype(card, chosenSubtype, game);
}
}
// in Library (e.g. for Mystical Teachings)
for (Card card : controller.getLibrary().getCards(game)) {
if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) {
setCreatureSubtype(card, choice, game);
setCreatureSubtype(card, chosenSubtype, game);
}
}
// commander in command zone
@ -127,7 +128,7 @@ class ConspiracyEffect extends ContinuousEffectImpl {
if (game.getState().getZone(commanderId) == Zone.COMMAND) {
Card card = game.getCard(commanderId);
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.isCreature()) {
Card card = ((Spell) stackObject).getCard();
setCreatureSubtype(card, choice, game);
setCreatureSubtype(card, chosenSubtype, game);
}
}
// creatures you control
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
for (Permanent creature : creatures) {
setCreatureSubtype(creature, choice, game);
setCreatureSubtype(creature, chosenSubtype, game);
}
return true;
}
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 instanceof Card) {
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)) {
subtype.removeAll(CardRepository.instance.getCreatureTypes());
subtype.removeAll(SubType.getCreatureTypes(false));
subtype.add(choice);
}
}

View file

@ -31,7 +31,6 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
@ -45,6 +44,7 @@ import mage.players.Player;
import mage.target.common.TargetAttackingOrBlockingCreature;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
@ -92,7 +92,7 @@ class CoordinatedBarrageEffect extends OneShotEffect {
if (controller != null) {
Choice choice = new ChoiceImpl(true);
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)) {
String chosenType = choice.getChoice();
FilterControlledPermanent filter = new FilterControlledPermanent();

View file

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

View file

@ -193,25 +193,25 @@ class CrypticGatewayEffect extends OneShotEffect {
boolean commonSubType = false;
boolean changeling = 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;
}
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;
}
ArrayList<SubtypePredicate> subtypes = new ArrayList<>();
for (String subtype : creature.getSubtype(game)) {
for (SubType subtype : creature.getSubtype(game)) {
if (creature2.getSubtype(game).contains(subtype) || changeling2) {
subtypes.add(new SubtypePredicate(SubType.byDescription(subtype)));
subtypes.add(new SubtypePredicate(subtype));
commonSubType = true;
}
}
for (String subtype : creature2.getSubtype(game)) {
for (SubType subtype : creature2.getSubtype(game)) {
if (creature.getSubtype(game).contains(subtype) || changeling) {
subtypes.add(new SubtypePredicate(SubType.byDescription(subtype)));
subtypes.add(new SubtypePredicate(subtype));
commonSubType = true;
}
}

View file

@ -35,6 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -91,7 +92,7 @@ class DeathcultRogueRestrictionEffect extends RestrictionEffect {
@Override
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 false;

View file

@ -34,6 +34,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
@ -87,7 +88,7 @@ class DefyDeathEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
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);
return true;
}

View file

@ -34,6 +34,7 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
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
// 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);
if (cardInExile != null && cardInExile.hasSubtype("God", game)) {
if (cardInExile != null && cardInExile.hasSubtype(SubType.GOD, game)) {
Player enchantmentController = game.getPlayer(targetEnchantment.getControllerId());
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);
break;
case TypeChangingEffects_4:
if (!object.hasSubtype("Illusion", game)) {
object.getSubtype(game).add("Illusion");
if (!object.hasSubtype(SubType.ILLUSION, game)) {
object.getSubtype(game).add(SubType.ILLUSION);
}
break;
}

View file

@ -33,7 +33,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
@ -45,6 +44,7 @@ import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
@ -92,7 +92,7 @@ class DistantMelodyEffect extends OneShotEffect {
if (player != null) {
Choice typeChoice = new ChoiceImpl(true);
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)) {
if (!player.canRespond()) {
return false;

View file

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

View file

@ -111,7 +111,7 @@ class EbonPraetorEffect extends OneShotEffect {
if (cost instanceof SacrificeTargetCost) {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
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);
return true;
}

View file

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

View file

@ -35,6 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
@ -95,7 +96,7 @@ class ElderCatharAddCountersTargetEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
if (counter != null) {
if (permanent.hasSubtype("Human", game)) {
if (permanent.hasSubtype(SubType.HUMAN, game)) {
permanent.addCounters(counter2.copy(), source, game);
} else {
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.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.Game;
import java.util.UUID;
@ -95,6 +96,6 @@ class EldraziTempleCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
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.Cards;
import mage.cards.CardsImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.choices.ChoiceCreatureType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
@ -98,9 +97,7 @@ class ElvishSoultillerEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null && mageObject != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
Choice typeChoice = new ChoiceCreatureType();
while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) {
return false;

View file

@ -40,11 +40,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.target.common.TargetCardInHand;
import java.util.Collections;
import java.util.UUID;
/**
@ -66,7 +66,7 @@ public class ErebossEmissary extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostEnchantedEffect(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"),
new DiscardTargetCost(new TargetCardInHand(new FilterCreatureCard()))));

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
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);
for (UUID cardId : cardsToBattlefield) {
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.setTargetPointer(new FixedTarget(permanent, game));
return effect.apply(game, source);

View file

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

View file

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

View file

@ -36,6 +36,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
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.
this.getSpellAbility().addEffect(new BoostTargetEffect(-1,-1, Duration.EndOfTurn));
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");
this.getSpellAbility().addEffect(effect);
}

View file

@ -39,10 +39,7 @@ import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -106,7 +103,7 @@ class FalkenrathAristocratEffect extends OneShotEffect {
if (cost instanceof SacrificeTargetCost) {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
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);
return true;
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -45,6 +44,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -98,7 +99,7 @@ class GideonsDefeatEffect extends OneShotEffect {
if (controller != null && permanent != null) {
controller.moveCards(permanent, Zone.EXILED, source, game);
game.applyEffects();
if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.GIDEON.getDescription(), game)) {
if (permanent.isPlaneswalker() && permanent.hasSubtype(SubType.GIDEON, game)) {
controller.gainLife(5, game);
}
return true;

View file

@ -35,6 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -97,7 +98,7 @@ class GoblinAssassinTriggeredAbiliy extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId();
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 false;

View file

@ -34,9 +34,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.choices.ChoiceCreatureType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
@ -97,9 +96,8 @@ class GraveSifterEffect extends OneShotEffect {
@Override
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.setChoices(SubType.getCreatureTypes(false));
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
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.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
@ -152,7 +149,7 @@ class GuardianOfTazeemEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
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");
effect.setTargetPointer(new FixedTarget(targetCreature, game));
game.addEffect(effect, source);

View file

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

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.h;
import java.util.UUID;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
@ -46,6 +45,7 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
@ -53,6 +53,8 @@ import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -123,7 +125,7 @@ class HavenOfTheSpiritManaCondition extends CreatureCastManaCondition {
public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) {
if (super.apply(game, source)) {
MageObject object = game.getObject(source.getSourceId());
if (object.hasSubtype("Dragon", game)
if (object.hasSubtype(SubType.DRAGON, game)
&& object.isCreature()) {
return true;
}
@ -140,7 +142,7 @@ class DragonCreatureCardPredicate implements Predicate<Card> {
@Override
public boolean apply(Card input, Game game) {
return input.isCreature()
&& input.hasSubtype("Dragon", game);
&& input.hasSubtype(SubType.DRAGON, game);
}
@Override

View file

@ -39,6 +39,7 @@ import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
/**
@ -56,7 +57,7 @@ public class HeavyMattock extends CardImpl {
// Equipped creature gets +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.
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}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2)));
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.h;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
@ -35,11 +34,11 @@ import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -107,7 +106,7 @@ class HeraldOfWarCostReductionEffect extends CostModificationEffectImpl {
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
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;
}
}

View file

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

View file

@ -27,21 +27,23 @@
*/
package mage.cards.h;
import java.util.UUID;
import mage.constants.CardType;
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.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.abilities.costs.common.TapSourceCost;
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.CardType;
import mage.constants.Outcome;
import mage.game.permanent.Permanent;
import mage.constants.SubType;
import mage.constants.Zone;
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) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature != null) {
if (creature.hasSubtype("Zombie", game)) {
if (creature.hasSubtype(SubType.ZOMBIE, game)) {
creature.tap(game);
creature.moveToExile(source.getSourceId(), creature.getName(), source.getSourceId(), game);
} else {

View file

@ -27,8 +27,6 @@
*/
package mage.cards.j;
import java.util.Arrays;
import java.util.UUID;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.SourceHasSubtypeCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
@ -39,7 +37,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
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.
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
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.
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
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"));
}

View file

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

View file

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

View file

@ -27,8 +27,6 @@
*/
package mage.cards.k;
import java.util.ArrayList;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
@ -41,6 +39,9 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
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("Warrior");
ObjectColor objectColor = new ObjectColor();

View file

@ -120,7 +120,7 @@ class LimDulTheNecromancerEffect extends OneShotEffect {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)
&& card.isCreature()) {
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()));
game.addEffect(effect, source);
}

View file

@ -44,6 +44,7 @@ import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
@ -90,7 +91,7 @@ class LuminescentRainEffect extends OneShotEffect {
if (player != null) {
Choice typeChoice = new ChoiceImpl(true);
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)) {
if (!player.canRespond()) {
return false;

View file

@ -34,7 +34,6 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.mana.RedManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.constants.*;
import mage.filter.common.FilterLandPermanent;
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
// So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game);
land.getSubtype(game).removeAll(CardRepository.instance.getLandTypes());
land.getSubtype(game).removeAll(SubType.getLandTypes(false));
land.getSubtype(game).add("Mountain");
break;
case AbilityAddingRemovingEffects_6:

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -36,10 +35,7 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
@ -48,6 +44,8 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author LevelX2
@ -109,7 +107,7 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl {
if (power > 0) {
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));
game.addEffect(effect, source);
}

View file

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

View file

@ -109,7 +109,7 @@ class MistbindCliqueAbility extends ZoneChangeTriggeredAbility {
&& event.getSourceId().equals(getSourceId())
&& !event.getSourceId().equals(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;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
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.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.choices.ChoiceCreatureType;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author cbt33, Plopman (Engineered Plague)
*/
public class MistformSliver extends CardImpl {
@ -97,16 +93,14 @@ class MistformSliverEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
Choice typeChoice = new ChoiceCreatureType();
while (!player.choose(Outcome.Detriment, typeChoice, game)) {
if (!player.canRespond()) {
return false;
}
}
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()));
game.addEffect(effect, source);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.n;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -44,11 +43,7 @@ import mage.abilities.keyword.IntimidateAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -58,6 +53,8 @@ import mage.game.permanent.PermanentToken;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @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 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 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.
this.addAbility(new NimDeathmantleTriggeredAbility());

View file

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

View file

@ -41,14 +41,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.UUID;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class OliviaMobilizedForWar extends CardImpl {
@ -72,7 +69,7 @@ public class OliviaMobilizedForWar extends CardImpl {
effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setText(", it gains haste until end of turn,");
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");
doIfCostPaid.addEffect(effect);
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, doIfCostPaid,

View file

@ -27,7 +27,6 @@
*/
package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -52,6 +51,8 @@ import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @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.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}"));
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");
ability.addEffect(effect);
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()));

View file

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

View file

@ -27,10 +27,6 @@
*/
package mage.cards.o;
import java.util.ArrayList;
import java.util.UUID;
import mage.constants.CardType;
import mage.ObjectColor;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
@ -41,6 +37,7 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
@ -50,6 +47,9 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.token.Token;
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();
}
}
ArrayList<String> list = new ArrayList<>();
list.add("Ooze");
SubTypeList list = new SubTypeList();
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<>()) {

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.common.DiscardTargetCost;
@ -36,7 +35,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
@ -50,8 +48,10 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
* @author fireshoes
*/
public class Outbreak extends CardImpl {
@ -63,7 +63,7 @@ public class Outbreak extends CardImpl {
}
public Outbreak(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
// You may discard a Swamp card rather than pay Outbreak's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new DiscardTargetCost(new TargetCardInHand(filterLand))));
@ -99,7 +99,7 @@ class OutbreakEffect extends OneShotEffect {
if (player != null) {
Choice typeChoice = new ChoiceImpl(true);
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)) {
if (!player.canRespond()) {
return false;

View file

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

View file

@ -27,17 +27,11 @@
*/
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.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
@ -51,6 +45,9 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author duncant
*/
@ -99,7 +96,7 @@ class PatriarchsBiddingEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
Choice typeChoice = new ChoiceImpl(true);
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)) {
if (!player.canRespond()) {
break;

View file

@ -27,7 +27,6 @@
*/
package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.ContinuousEffect;
@ -35,7 +34,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
@ -50,6 +48,9 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
* @author emerald000
@ -95,7 +96,7 @@ class PeerPressureEffect extends OneShotEffect {
if (controller != null) {
Choice choice = new ChoiceImpl(true);
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)) {
if (!controller.canRespond()) {
return false;

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.p;
import java.util.UUID;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
@ -49,6 +48,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
/**
*
* @author TGower
@ -110,6 +111,6 @@ class PrimalBeyondManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
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;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.PayLifeCost;
@ -38,12 +37,15 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author emerald000
@ -95,7 +97,7 @@ class RaidersSpoilsTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
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 false;

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
@ -37,7 +36,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
@ -50,14 +48,16 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
* @author fireshoes
*/
public class RiptideChronologist extends CardImpl {
public RiptideChronologist(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(1);
@ -97,7 +97,7 @@ class RiptideChronologistEffect extends OneShotEffect {
if (player != null) {
Choice typeChoice = new ChoiceImpl(true);
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)) {
if (!player.canRespond()) {
return false;

View file

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

View file

@ -27,16 +27,14 @@
*/
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.choices.ChoiceCreatureType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
@ -46,14 +44,15 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
/**
*
* @author michael.napoleon@gmail.com
*/
public class RoarOfTheCrowd extends CardImpl {
public RoarOfTheCrowd(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
// Choose a creature type. Roar of the Crowd deals damage to target creature or player equal to the number of permanents you control of the chosen type.
TargetCreatureOrPlayer target = new TargetCreatureOrPlayer();
@ -72,27 +71,26 @@ public class RoarOfTheCrowd extends CardImpl {
}
class RoarOfTheCrowdEffect extends OneShotEffect {
RoarOfTheCrowdEffect() {
super(Outcome.LoseLife);
this.staticText = "Choose a creature type. {this} deals damage to target creature or player equal to the number of permanents you control of the chosen type.";
}
RoarOfTheCrowdEffect(final RoarOfTheCrowdEffect effect) {
super(effect);
}
@Override
public RoarOfTheCrowdEffect copy() {
return new RoarOfTheCrowdEffect(this);
}
@Override public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
RoarOfTheCrowdEffect() {
super(Outcome.LoseLife);
this.staticText = "Choose a creature type. {this} deals damage to target creature or player equal to the number of permanents you control of the chosen type.";
}
RoarOfTheCrowdEffect(final RoarOfTheCrowdEffect effect) {
super(effect);
}
@Override
public RoarOfTheCrowdEffect copy() {
return new RoarOfTheCrowdEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose a creature type:");
typeChoice.setChoices(SubType.getCreatureTypes(false));
Choice typeChoice = new ChoiceCreatureType();
while (!player.choose(Outcome.LoseLife, typeChoice, game)) {
if (!player.canRespond()) {
return false;
@ -103,5 +101,5 @@ class RoarOfTheCrowdEffect extends OneShotEffect {
return new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter)).apply(game, source);
}
return false;
}
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -38,10 +37,7 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
@ -49,6 +45,8 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author fireshoes
@ -102,7 +100,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.getControllerId().equals(source.getControllerId())
&& creature.isCreature()
&& creature.hasSubtype("Wizard", game)
&& creature.hasSubtype(SubType.WIZARD, game)
&& !event.getTargetId().equals(source.getSourceId());
}

View file

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

View file

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

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EquippedHasSubtypeCondition;
import mage.abilities.costs.mana.GenericManaCost;
@ -38,10 +37,9 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import java.util.UUID;
/**
*
@ -62,7 +60,7 @@ public class SharpenedPitchfork extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT)));
// 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) {

View file

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

View file

@ -27,9 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.constants.CardType;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EquippedHasSubtypeCondition;
import mage.abilities.costs.mana.GenericManaCost;
@ -38,9 +35,13 @@ import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import java.util.UUID;
/**
* @author nantuko
*/
@ -59,7 +60,7 @@ public class SilverInlaidDagger extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 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) {

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