diff --git a/Mage.Sets/src/mage/cards/a/AdaptiveAutomaton.java b/Mage.Sets/src/mage/cards/a/AdaptiveAutomaton.java index 78669315df2..b9d4da3de95 100644 --- a/Mage.Sets/src/mage/cards/a/AdaptiveAutomaton.java +++ b/Mage.Sets/src/mage/cards/a/AdaptiveAutomaton.java @@ -27,7 +27,6 @@ */ package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; @@ -44,6 +43,8 @@ import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * @author nantuko */ @@ -98,7 +99,7 @@ class AdaptiveAutomatonAddSubtypeEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - String subtype = (String) game.getState().getValue(permanent.getId() + "_type"); + SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type"); if (subtype != null && !permanent.getSubtype(game).contains(subtype)) { permanent.getSubtype(game).add(subtype); } diff --git a/Mage.Sets/src/mage/cards/a/AshesOfTheFallen.java b/Mage.Sets/src/mage/cards/a/AshesOfTheFallen.java index 2a3d3764732..c4246477754 100644 --- a/Mage.Sets/src/mage/cards/a/AshesOfTheFallen.java +++ b/Mage.Sets/src/mage/cards/a/AshesOfTheFallen.java @@ -27,7 +27,6 @@ */ package mage.cards.a; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; @@ -41,6 +40,8 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.UUID; + /** * * @author emerald000 @@ -83,7 +84,7 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - String subtype = (String) game.getState().getValue(permanent.getId() + "_type"); + SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type"); for (UUID cardId : controller.getGraveyard()) { Card card = game.getCard(cardId); if (card != null && card.isCreature() && !card.getSubtype(game).contains(subtype)) { diff --git a/Mage.Sets/src/mage/cards/c/CallerOfTheHunt.java b/Mage.Sets/src/mage/cards/c/CallerOfTheHunt.java index f28f168e6ae..93a6072beb0 100644 --- a/Mage.Sets/src/mage/cards/c/CallerOfTheHunt.java +++ b/Mage.Sets/src/mage/cards/c/CallerOfTheHunt.java @@ -40,10 +40,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.Choice; import mage.choices.ChoiceCreatureType; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.ChosenSubtypePredicate; import mage.game.Game; @@ -141,7 +138,7 @@ class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but t if (!game.isSimulation()) { game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice()); } - game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice()); + game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice())); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java index c5c0509f914..13d5183be34 100644 --- a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java +++ b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java @@ -27,9 +27,6 @@ */ package mage.cards.c; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.ConditionalMana; import mage.MageObject; import mage.Mana; @@ -53,6 +50,10 @@ import mage.game.stack.Spell; import mage.players.Player; import mage.watchers.Watcher; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** * * @author noxx @@ -90,9 +91,9 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder { @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 = SubType.byDescription((String) value); + SubType value = (SubType) game.getState().getValue(source.getSourceId() + "_type"); + if (value != null ) { + creatureType = value; } Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/c/Conspiracy.java b/Mage.Sets/src/mage/cards/c/Conspiracy.java index b8fe6c421e2..7b24ba3cb4c 100644 --- a/Mage.Sets/src/mage/cards/c/Conspiracy.java +++ b/Mage.Sets/src/mage/cards/c/Conspiracy.java @@ -27,9 +27,6 @@ */ package mage.cards.c; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -48,6 +45,10 @@ import mage.game.stack.StackObject; import mage.players.Player; import mage.util.SubTypeList; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + /** * * @author anonymous @@ -92,34 +93,33 @@ class ConspiracyEffect extends ContinuousEffectImpl { @Override 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); + SubType choice = (SubType) game.getState().getValue(source.getSourceId().toString() + "_type"); 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, chosenSubtype, game); + setCreatureSubtype(card, choice, game); } } // on Hand for (UUID cardId : controller.getHand()) { Card card = game.getCard(cardId); if (card.isCreature()) { - setCreatureSubtype(card, chosenSubtype, game); + setCreatureSubtype(card, choice, game); } } // in Exile for (Card card : game.getState().getExile().getAllCards(game)) { if (card.getOwnerId().equals(controller.getId()) && card.isCreature()) { - setCreatureSubtype(card, chosenSubtype, game); + setCreatureSubtype(card, choice, 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, chosenSubtype, game); + setCreatureSubtype(card, choice, game); } } // commander in command zone @@ -127,7 +127,7 @@ class ConspiracyEffect extends ContinuousEffectImpl { if (game.getState().getZone(commanderId) == Zone.COMMAND) { Card card = game.getCard(commanderId); if (card.isCreature()) { - setCreatureSubtype(card, chosenSubtype, game); + setCreatureSubtype(card, choice, game); } } } @@ -138,14 +138,14 @@ class ConspiracyEffect extends ContinuousEffectImpl { stackObject.getControllerId().equals(source.getControllerId()) && stackObject.isCreature()) { Card card = ((Spell) stackObject).getCard(); - setCreatureSubtype(card, chosenSubtype, game); + setCreatureSubtype(card, choice, game); } } // creatures you control List creatures = game.getBattlefield().getAllActivePermanents( new FilterControlledCreaturePermanent(), source.getControllerId(), game); for (Permanent creature : creatures) { - setCreatureSubtype(creature, chosenSubtype, game); + setCreatureSubtype(creature, choice, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java b/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java index 0dfb20ac8dd..a1331d03243 100644 --- a/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java +++ b/Mage.Sets/src/mage/cards/d/DoorOfDestinies.java @@ -102,11 +102,11 @@ class AddCounterAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { Permanent doorOfDestinies = game.getPermanent(getSourceId()); if (doorOfDestinies != null) { - String subtype = (String) game.getState().getValue(doorOfDestinies.getId() + "_type"); + SubType subtype = (SubType) game.getState().getValue(doorOfDestinies.getId() + "_type"); if (subtype != null) { FilterSpell filter = new FilterSpell(); filter.add(new ControllerPredicate(TargetController.YOU)); - filter.add(new SubtypePredicate(SubType.byDescription(subtype))); + filter.add(new SubtypePredicate(subtype)); Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) { return true; diff --git a/Mage.Sets/src/mage/cards/r/RidersOfGavony.java b/Mage.Sets/src/mage/cards/r/RidersOfGavony.java index 76a4058a8cc..c5702049b0a 100644 --- a/Mage.Sets/src/mage/cards/r/RidersOfGavony.java +++ b/Mage.Sets/src/mage/cards/r/RidersOfGavony.java @@ -27,7 +27,6 @@ */ package mage.cards.r; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; @@ -45,6 +44,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * @author noxx */ @@ -107,10 +108,10 @@ class RidersOfGavonyGainAbilityControlledEffect extends ContinuousEffectImpl { if (protectionFilter == null) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - String subtype = (String) game.getState().getValue(permanent.getId() + "_type"); + SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type"); if (subtype != null) { - protectionFilter = new FilterPermanent(subtype + 's'); - protectionFilter.add(new SubtypePredicate(SubType.byDescription(subtype))); + protectionFilter = new FilterPermanent(subtype.getDescription() + 's'); + protectionFilter.add(new SubtypePredicate(subtype)); } } } diff --git a/Mage.Sets/src/mage/cards/r/RiptideReplicator.java b/Mage.Sets/src/mage/cards/r/RiptideReplicator.java index 2c88743fd5d..c328418205a 100644 --- a/Mage.Sets/src/mage/cards/r/RiptideReplicator.java +++ b/Mage.Sets/src/mage/cards/r/RiptideReplicator.java @@ -27,7 +27,6 @@ */ package mage.cards.r; -import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -44,12 +43,15 @@ 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; import mage.game.permanent.token.RiptideReplicatorToken; import mage.game.permanent.token.Token; +import java.util.UUID; + /** * * @author HanClinto @@ -104,7 +106,7 @@ class RiptideReplicatorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); - String type = (String) game.getState().getValue(source.getSourceId() + "_type"); + SubType type = (SubType) game.getState().getValue(source.getSourceId() + "_type"); int x = (new CountersSourceCount(CounterType.CHARGE)).calculate(game, source, this); Token token = new RiptideReplicatorToken(color, type, x); return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java b/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java index a0e7e9948b5..8d689b089e7 100644 --- a/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java +++ b/Mage.Sets/src/mage/cards/v/VolrathsLaboratory.java @@ -27,7 +27,6 @@ */ package mage.cards.v; -import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -42,11 +41,14 @@ 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.permanent.token.Token; import mage.game.permanent.token.VolrathsLaboratoryToken; +import java.util.UUID; + /** * * @author emerald000 @@ -98,7 +100,7 @@ class VolrathsLaboratoryEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); - String type = (String) game.getState().getValue(source.getSourceId() + "_type"); + SubType type = (SubType) game.getState().getValue(source.getSourceId() + "_type"); Token token = new VolrathsLaboratoryToken(color, type); return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); } diff --git a/Mage.Sets/src/mage/cards/x/Xenograft.java b/Mage.Sets/src/mage/cards/x/Xenograft.java index 3d35c68f738..7014fb30010 100644 --- a/Mage.Sets/src/mage/cards/x/Xenograft.java +++ b/Mage.Sets/src/mage/cards/x/Xenograft.java @@ -27,8 +27,6 @@ */ package mage.cards.x; -import java.util.List; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; @@ -36,16 +34,14 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.common.ChooseCreatureTypeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.List; +import java.util.UUID; + /** * * @author North @@ -84,7 +80,7 @@ class XenograftAddSubtypeEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - String subtype = (String) game.getState().getValue(source.getSourceId() + "_type"); + SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); if (subtype != null) { List permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ChooseCreatureTypeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ChooseCreatureTypeEffect.java index 67b8960a008..412278414ff 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ChooseCreatureTypeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ChooseCreatureTypeEffect.java @@ -75,7 +75,7 @@ public class ChooseCreatureTypeEffect extends OneShotEffect { if (!game.isSimulation()) { game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice()); } - game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice()); + game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice())); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ChooseLandTypeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ChooseLandTypeEffect.java index d2a687ef758..d3777a79ed0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ChooseLandTypeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ChooseLandTypeEffect.java @@ -53,7 +53,7 @@ public class ChooseLandTypeEffect extends OneShotEffect { if (!game.isSimulation()) { game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice()); } - game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice()); + game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice())); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllOfChosenSubtypeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllOfChosenSubtypeEffect.java index 5420bd0cf5e..1a9490f9719 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllOfChosenSubtypeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllOfChosenSubtypeEffect.java @@ -48,9 +48,9 @@ public class BoostAllOfChosenSubtypeEffect extends BoostAllEffect { @Override protected void setRuntimeData(Ability source, Game game) { - String s = (String) game.getState().getValue(source.getSourceId() + "_type"); - if (subtype != null) { - subtype = SubType.byDescription(s); + SubType s = (SubType) game.getState().getValue(source.getSourceId() + "_type"); + if (s != null) { + subtype = s; } else { discard(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllOfChosenSubtypeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllOfChosenSubtypeEffect.java index f7447035579..17e459fdc7b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllOfChosenSubtypeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllOfChosenSubtypeEffect.java @@ -44,8 +44,8 @@ public class GainAbilityAllOfChosenSubtypeEffect extends GainAbilityAllEffect { @Override protected void setRuntimeData(Ability source, Game game) { - String s = (String) game.getState().getValue(source.getSourceId() + "_type"); - subtype = SubType.byDescription(s); + subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); + } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllOfChosenSubtypeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllOfChosenSubtypeEffect.java index 8c5bef6861b..e6e0f4073b9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllOfChosenSubtypeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllOfChosenSubtypeEffect.java @@ -32,9 +32,9 @@ public class SpellsCostReductionAllOfChosenSubtypeEffect extends SpellsCostReduc @Override protected boolean selectedByRuntimeData(Card card, Ability source, Game game) { - String subtype = (String) game.getState().getValue(source.getSourceId() + "_type"); + SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); if (subtype != null) { - return card.hasSubtype(SubType.byDescription(subtype), game); + return card.hasSubtype(subtype, game); } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/enterAttribute/EnterAttributeAddChosenSubtypeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/enterAttribute/EnterAttributeAddChosenSubtypeEffect.java index b5db7190aee..812d4a86ca5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/enterAttribute/EnterAttributeAddChosenSubtypeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/enterAttribute/EnterAttributeAddChosenSubtypeEffect.java @@ -31,6 +31,7 @@ import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; +import mage.constants.SubType; import mage.game.Game; import mage.game.permanent.Permanent; @@ -57,7 +58,7 @@ public class EnterAttributeAddChosenSubtypeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); - String subtype = (String) game.getState().getValue(source.getSourceId() + "_type"); + SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); if (permanent != null && subtype != null) { MageObject mageObject = permanent.getBasicMageObject(game); if (!mageObject.getSubtype(null).contains(subtype)) { diff --git a/Mage/src/main/java/mage/cards/ExpansionSet.java b/Mage/src/main/java/mage/cards/ExpansionSet.java index ed9c324b33a..0b312c96aa1 100644 --- a/Mage/src/main/java/mage/cards/ExpansionSet.java +++ b/Mage/src/main/java/mage/cards/ExpansionSet.java @@ -308,29 +308,22 @@ public abstract class ExpansionSet implements Serializable { private void addSpecial(List booster) { int specialCards = 0; List specialBonus = getSpecialBonus(); - if (specialBonus != null) { - specialCards += specialBonus.size(); - } + specialCards += specialBonus.size(); + List specialMythic = getSpecialMythic(); - if (specialMythic != null) { - specialCards += specialMythic.size(); - } + specialCards += specialMythic.size(); List specialRare = getSpecialRare(); - if (specialRare != null) { - specialCards += specialRare.size(); - } + specialCards += specialRare.size(); List specialUncommon = getSpecialUncommon(); - if (specialUncommon != null) { - specialCards += specialUncommon.size(); - } + specialCards += specialUncommon.size(); List specialCommon = getSpecialCommon(); - if (specialCommon != null) { - specialCards += specialCommon.size(); - } + + specialCards += specialCommon.size(); + if (specialCards > 0) { for (int i = 0; i < numBoosterSpecial; i++) { if (RandomUtil.nextInt(15) < 10) { - if (specialCommon != null && !specialCommon.isEmpty()) { + if (!specialCommon.isEmpty()) { addToBooster(booster, specialCommon); } else { i--; @@ -338,7 +331,7 @@ public abstract class ExpansionSet implements Serializable { continue; } if (RandomUtil.nextInt(4) < 3) { - if (specialUncommon != null && !specialUncommon.isEmpty()) { + if (!specialUncommon.isEmpty()) { addToBooster(booster, specialUncommon); } else { i--; @@ -346,15 +339,15 @@ public abstract class ExpansionSet implements Serializable { continue; } if (RandomUtil.nextInt(8) < 7) { - if (specialRare != null && !specialRare.isEmpty()) { + if (!specialRare.isEmpty()) { addToBooster(booster, specialRare); } else { i--; } continue; } - if (specialMythic != null && !specialMythic.isEmpty()) { - if (specialBonus != null && !specialBonus.isEmpty()) { + if (!specialMythic.isEmpty()) { + if (!specialBonus.isEmpty()) { if (RandomUtil.nextInt(3) < 2) { addToBooster(booster, specialMythic); continue; @@ -366,7 +359,7 @@ public abstract class ExpansionSet implements Serializable { } else { i--; } - if (specialBonus != null && !specialBonus.isEmpty()) { + if (!specialBonus.isEmpty()) { addToBooster(booster, specialBonus); } } @@ -407,27 +400,27 @@ public abstract class ExpansionSet implements Serializable { } public List getSpecialCommon() { - return null; + return new ArrayList<>(); } public List getSpecialUncommon() { - return null; + return new ArrayList<>(); } public List getSpecialRare() { - return null; + return new ArrayList<>(); } public List getSpecialMythic() { - return null; + return new ArrayList<>(); } public List getSpecialBonus() { - return null; + return new ArrayList<>(); } public List getSpecialLand() { - return null; + return new ArrayList<>(); } public boolean isCustomSet() { diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/ChosenSubtypePredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/ChosenSubtypePredicate.java index a05900fe051..f5edbfd5d49 100644 --- a/Mage/src/main/java/mage/filter/predicate/mageobject/ChosenSubtypePredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/ChosenSubtypePredicate.java @@ -48,8 +48,8 @@ public class ChosenSubtypePredicate implements Predicate { @Override public boolean apply(MageObject input, Game game) { - String subtype = (String) game.getState().getValue(cardID + "_type"); - return input.hasSubtype(SubType.byDescription(subtype), game); + SubType subtype = (SubType) game.getState().getValue(cardID + "_type"); + return input.hasSubtype(subtype, game); } @Override diff --git a/Mage/src/main/java/mage/game/permanent/token/RiptideReplicatorToken.java b/Mage/src/main/java/mage/game/permanent/token/RiptideReplicatorToken.java index fadefc1844c..3e3f2c28f04 100644 --- a/Mage/src/main/java/mage/game/permanent/token/RiptideReplicatorToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/RiptideReplicatorToken.java @@ -30,6 +30,7 @@ package mage.game.permanent.token; import mage.constants.CardType; import mage.MageInt; import mage.ObjectColor; +import mage.constants.SubType; /** * @@ -40,8 +41,8 @@ public class RiptideReplicatorToken extends Token { public RiptideReplicatorToken() { this(null, null, 1); } - public RiptideReplicatorToken(ObjectColor color, String type, int x) { - super(type, "X/X creature token of the chosen color and type"); + public RiptideReplicatorToken(ObjectColor color, SubType type, int x) { + super(type.getDescription(), "X/X creature token of the chosen color and type"); cardType.add(CardType.CREATURE); if (color != null) { this.color.setColor(color); diff --git a/Mage/src/main/java/mage/game/permanent/token/VolrathsLaboratoryToken.java b/Mage/src/main/java/mage/game/permanent/token/VolrathsLaboratoryToken.java index a58e44e0fc1..d5bd6bf698e 100644 --- a/Mage/src/main/java/mage/game/permanent/token/VolrathsLaboratoryToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/VolrathsLaboratoryToken.java @@ -30,6 +30,7 @@ package mage.game.permanent.token; import mage.constants.CardType; import mage.MageInt; import mage.ObjectColor; +import mage.constants.SubType; /** * @@ -40,8 +41,8 @@ public class VolrathsLaboratoryToken extends Token { public VolrathsLaboratoryToken() { this(null, null); } - public VolrathsLaboratoryToken(ObjectColor color, String type) { - super(type, "2/2 creature token of the chosen color and type"); + public VolrathsLaboratoryToken(ObjectColor color, SubType type) { + super(type.getDescription(), "2/2 creature token of the chosen color and type"); cardType.add(CardType.CREATURE); if (color != null) { this.color.setColor(color);