Refactor: removed unused custom set filters in SubType requests;

This commit is contained in:
Oleg Agafonov 2019-02-04 00:53:51 +04:00
parent e9c6c4fefa
commit b36465e5c9
27 changed files with 94 additions and 143 deletions

View file

@ -64,7 +64,7 @@ public enum TokensMtgImageSource implements CardImageSource {
private String getEmblemName(String originalName) {
for (SubType subType : SubType.getPlaneswalkerTypes(true)) {
for (SubType subType : SubType.getPlaneswalkerTypes()) {
if (originalName.toLowerCase(Locale.ENGLISH).contains(subType.toString().toLowerCase(Locale.ENGLISH))) {
return subType.getDescription() + " Emblem";
}

View file

@ -1,6 +1,5 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -9,15 +8,7 @@ import mage.abilities.effects.common.ChooseACardNameEffect;
import mage.abilities.mana.AnyColorManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
@ -27,8 +18,9 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class AlpineMoon extends CardImpl {
@ -97,7 +89,7 @@ class AlpineMoonEffect 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(SubType.getLandTypes(false));
land.getSubtype(game).removeAll(SubType.getLandTypes());
break;
case AbilityAddingRemovingEffects_6:
land.addAbility(new AnyColorManaAbility(), source.getSourceId(), game);

View file

@ -139,7 +139,7 @@ class ConspiracyEffect extends ContinuousEffectImpl {
private void setChosenSubtype(SubTypeList subtype, SubType choice) {
if (subtype.size() != 1 || !subtype.contains(choice)) {
subtype.removeAll(SubType.getCreatureTypes(false));
subtype.clear();
subtype.add(choice);
}
}

View file

@ -1,9 +1,5 @@
package mage.cards.e;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
@ -16,8 +12,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
/**
*
* @author Styxo
*/
public final class EgoErasure extends CardImpl {
@ -74,10 +73,10 @@ class EgoErasureLoseEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
} else {
it.remove();
}
@ -115,7 +114,7 @@ class EgoErasureBoostEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
permanent.addPower(-2);

View file

@ -1,7 +1,5 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -16,8 +14,9 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class MagusOfTheMoon extends CardImpl {
@ -29,7 +28,7 @@ public final class MagusOfTheMoon extends CardImpl {
}
public MagusOfTheMoon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
@ -79,7 +78,7 @@ public final 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(SubType.getLandTypes(false));
land.getSubtype(game).removeAll(SubType.getLandTypes());
land.getSubtype(game).add(SubType.MOUNTAIN);
break;
case AbilityAddingRemovingEffects_6:

View file

@ -1,6 +1,5 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
@ -19,8 +18,9 @@ import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author noahg
*/
public final class MetamorphicAlteration extends CardImpl {
@ -126,7 +126,7 @@ class MetamorphicAlterationEffect extends ContinuousEffectImpl {
for (CardType t : copied.getCardType()) {
permanent.addCardType(t);
}
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
for (SubType t : copied.getSubtype(game)) {
permanent.getSubtype(game).add(t);
}

View file

@ -1,7 +1,6 @@
package mage.cards.m;
import java.util.ArrayList;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -17,24 +16,23 @@ import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
import mage.util.SubTypeList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.constants.SuperType;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class MyriadLandscape extends CardImpl {
@ -74,7 +72,7 @@ class TargetCardInLibrarySharingLandType extends TargetCardInLibrary {
static {
List<Predicate<MageObject>> subTypePreds = new ArrayList<>();
for (SubType landType : SubType.getLandTypes(false)) {
for (SubType landType : SubType.getLandTypes()) {
subTypePreds.add(new SubtypePredicate(landType));
}
filter.add(Predicates.or(subTypePreds));
@ -107,7 +105,7 @@ class TargetCardInLibrarySharingLandType extends TargetCardInLibrary {
}
Card card = game.getCard(id);
if (card != null && !landTypes.isEmpty()) {
for (Iterator<SubType> iterator = landTypes.iterator(); iterator.hasNext();) {
for (Iterator<SubType> iterator = landTypes.iterator(); iterator.hasNext(); ) {
SubType next = iterator.next();
if (card.hasSubtype(next, game)) {
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.n;
import mage.Mana;
@ -23,13 +22,12 @@ import java.util.List;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class NyleasPresence extends CardImpl {
public NyleasPresence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
this.subtype.add(SubType.AURA);
@ -62,7 +60,7 @@ class NyleasPresenceLandTypeEffect extends ContinuousEffectImpl {
public NyleasPresenceLandTypeEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
landTypes.addAll(SubType.getBasicLands(false));
landTypes.addAll(SubType.getBasicLands());
this.staticText = "Enchanted land is every basic land type in addition to its other types";
}
@ -90,11 +88,11 @@ class NyleasPresenceLandTypeEffect extends ContinuousEffectImpl {
switch (layer) {
case AbilityAddingRemovingEffects_6:
Mana mana = new Mana();
for (Ability ability : land.getAbilities()){
for (Ability ability : land.getAbilities()) {
if (ability instanceof BasicManaAbility) {
for (Mana netMana: ((BasicManaAbility)ability ).getNetMana(game)) {
for (Mana netMana : ((BasicManaAbility) ability).getNetMana(game)) {
mana.add(netMana);
}
}
}
}
if (mana.getGreen() == 0 && landTypes.contains(SubType.FOREST)) {

View file

@ -1,4 +1,3 @@
package mage.cards.p;
import mage.abilities.Ability;
@ -20,7 +19,6 @@ import java.util.Set;
import java.util.UUID;
/**
*
* @author Styxo
*/
public final class PlanarOverlay extends CardImpl {
@ -66,7 +64,7 @@ class PlanarOverlayEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (SubType landName : SubType.getBasicLands(false)) {
for (SubType landName : SubType.getBasicLands()) {
FilterLandPermanent filter = new FilterLandPermanent(landName + " to return to hand");
filter.add(new SubtypePredicate(landName));
filter.add(new ControllerPredicate(TargetController.YOU));

View file

@ -1,4 +1,3 @@
package mage.cards.p;
import mage.Mana;
@ -18,13 +17,12 @@ import java.util.List;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class PrismaticOmen extends CardImpl {
public PrismaticOmen(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
// Lands you control are every basic land type in addition to their other types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandTypeAllEffect("Swamp", "Mountain", "Forest", "Island", "Plains")));
@ -46,7 +44,7 @@ class BecomesBasicLandTypeAllEffect extends ContinuousEffectImpl {
public BecomesBasicLandTypeAllEffect(String... landNames) {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
landTypes.addAll(SubType.getBasicLands(false));
landTypes.addAll(SubType.getBasicLands());
this.staticText = "Lands you control are every basic land type in addition to their other types";
}

View file

@ -1,8 +1,5 @@
package mage.cards.s;
import java.util.List;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -12,20 +9,16 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.SubTypeList;
import java.util.List;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class ShadesBreath extends CardImpl {
@ -102,7 +95,7 @@ class ShadesBreathSetSubtypeEffect extends ContinuousEffectImpl {
if (permanent != null) {
SubTypeList subtype = permanent.getSubtype(game);
if (subtype != null && (subtype.size() != 1 || !subtype.contains(SubType.SHADE))) {
subtype.removeAll(SubType.getCreatureTypes(false));
subtype.clear();
subtype.add(SubType.SHADE);
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.s;
import mage.MageInt;
@ -23,13 +22,12 @@ import java.util.Set;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class SunderingTitan extends CardImpl {
public SunderingTitan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{8}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{8}");
this.subtype.add(SubType.GOLEM);
this.power = new MageInt(7);
@ -71,7 +69,7 @@ class SunderingTitanDestroyLandEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
Set<UUID> lands = new HashSet<>();
if (controller != null && sourcePermanent != null) {
for (SubType landName : SubType.getBasicLands(false)) {
for (SubType landName : SubType.getBasicLands()) {
FilterLandPermanent filter = new FilterLandPermanent(landName + " to destroy");
filter.add(new SubtypePredicate(landName));
Target target = new TargetLandPermanent(1, 1, filter, true);

View file

@ -5,7 +5,6 @@
*/
package mage.abilities.effects.common;
import java.util.stream.Collectors;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -18,8 +17,9 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.stream.Collectors;
/**
*
* @author fireshoes
*/
public class ChooseLandTypeEffect extends OneShotEffect {
@ -43,7 +43,7 @@ public class ChooseLandTypeEffect extends OneShotEffect {
if (controller != null && mageObject != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose land type");
typeChoice.setChoices(SubType.getLandTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
typeChoice.setChoices(SubType.getLandTypes().stream().map(SubType::toString).collect(Collectors.toSet()));
if (controller.choose(outcome, typeChoice, game)) {
if (!game.isSimulation()) {
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -78,7 +77,7 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
break;
case TypeChangingEffects_4:
// subtypes are all removed by changing the subtype to a land type.
permanent.getSubtype(game).removeAll(SubType.getLandTypes(false));
permanent.getSubtype(game).removeAll(SubType.getLandTypes());
permanent.getSubtype(game).addAll(landTypes);
break;
}

View file

@ -1,10 +1,5 @@
package mage.abilities.effects.common.continuous;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.mana.*;
@ -15,6 +10,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
* http://mtgsalvation.gamepedia.com/Land_changers
*
@ -116,7 +116,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
// So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game);
// 305.7
land.getSubtype(game).removeAll(SubType.getLandTypes(false));
land.getSubtype(game).removeAll(SubType.getLandTypes());
land.getSubtype(game).addAll(landTypes);
} else {
landTypesToAdd.clear();

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -73,7 +72,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
case ALL:
case ALL_BUT_COLOR:
case ABILITIES_SUBTYPE:
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
break;
}
for (SubType t : token.getSubtype(game)) {

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.MageObjectReference;
@ -7,7 +6,6 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
/**
@ -71,7 +69,7 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
for (SuperType superType : token.getSuperType()) {
permanentAttachedTo.addSuperType(superType);
permanentAttachedTo.addSuperType(superType);
}
// card type
@ -90,7 +88,7 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
case ALL:
case ALL_BUT_COLOR:
case ABILITIES_SUBTYPE_AND_PT:
permanentAttachedTo.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanentAttachedTo.getSubtype(game).retainAll(SubType.getLandTypes());
break;
}
for (SubType subType : token.getSubtype(game)) {

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.MageObjectReference;
@ -31,8 +30,9 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
}
public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes, boolean characterDefining, DynamicValue power, DynamicValue toughness) {
this(token, theyAreStillType,duration,losePreviousTypes,characterDefining,power,toughness,false);
this(token, theyAreStillType, duration, losePreviousTypes, characterDefining, power, toughness, false);
}
public BecomesCreatureSourceEffect(Token token, String theyAreStillType, Duration duration, boolean losePreviousTypes, boolean characterDefining, DynamicValue power, DynamicValue toughness, boolean loseAbilities) {
super(duration, Outcome.BecomeCreature);
this.characterDefining = characterDefining;
@ -40,7 +40,8 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
this.theyAreStillType = theyAreStillType;
this.losePreviousTypes = losePreviousTypes;
this.power = power;
this.toughness = toughness;this.loseAbilities=loseAbilities;
this.toughness = toughness;
this.loseAbilities = loseAbilities;
setText();
this.addDependencyType(DependencyType.BecomeCreature);
@ -50,7 +51,8 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
super(effect);
this.token = effect.token.copy();
this.theyAreStillType = effect.theyAreStillType;
this.losePreviousTypes = effect.losePreviousTypes;this.loseAbilities=effect.loseAbilities;
this.losePreviousTypes = effect.losePreviousTypes;
this.loseAbilities = effect.loseAbilities;
if (effect.power != null) {
this.power = effect.power.copy();
}
@ -92,7 +94,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
}
if (theyAreStillType != null && theyAreStillType.isEmpty() || theyAreStillType == null && permanent.isLand()) {
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
}
if (!token.getSubtype(game).isEmpty()) {
permanent.getSubtype(game).addAll(token.getSubtype(game));
@ -111,8 +113,9 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
if(loseAbilities){
permanent.removeAllAbilities(source.getSourceId(), game);}
if (loseAbilities) {
permanent.removeAllAbilities(source.getSourceId(), game);
}
for (Ability ability : token.getAbilities()) {
permanent.addAbility(ability, source.getSourceId(), game);
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -7,7 +6,6 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.target.Target;
import mage.util.CardUtil;
@ -24,10 +22,9 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
protected boolean addStillALandText;
/**
*
* @param token
* @param loseAllAbilities loses all subtypes and colors
* @param stillALand add rule text, "it's still a land"
* @param stillALand add rule text, "it's still a land"
* @param duration
*/
public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration) {
@ -59,7 +56,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (loseAllAbilities) {
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
permanent.getSubtype(game).addAll(token.getSubtype(game));
} else {
if (!token.getSubtype(game).isEmpty()) {

View file

@ -15,7 +15,6 @@ import mage.util.SubTypeList;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl {
@ -73,7 +72,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (loseOther) {
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
permanent.getSubtype(game).addAll(subtypes);
} else {
for (SubType subtype : subtypes) {

View file

@ -70,7 +70,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (loseOther) {
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
permanent.getSubtype(game).addAll(subtypes);
} else {
for (SubType subtype : subtypes) {

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -9,7 +8,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author emerald000
*/
public class LoseAllCreatureTypesTargetEffect extends ContinuousEffectImpl {
@ -32,7 +30,7 @@ public class LoseAllCreatureTypesTargetEffect extends ContinuousEffectImpl {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
permanent.setIsAllCreatureTypes(false);
return permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
return permanent.getSubtype(game).retainAll(SubType.getLandTypes());
}
return false;
}

View file

@ -1,21 +1,17 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
*
* @author noahg
*/
public class LoseArtifactTypeTargetEffect extends ContinuousEffectImpl{
public class LoseArtifactTypeTargetEffect extends ContinuousEffectImpl {
public LoseArtifactTypeTargetEffect(Duration duration) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
@ -53,7 +49,7 @@ public class LoseArtifactTypeTargetEffect extends ContinuousEffectImpl{
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
permanent.getCardType().remove(CardType.ARTIFACT);
permanent.getSubtype(game).removeAll(SubType.getArtifactTypes(false));
permanent.getSubtype(game).removeAll(SubType.getArtifactTypes());
}
break;
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -10,7 +9,6 @@ import mage.game.permanent.Permanent;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class LoseCreatureTypeSourceEffect extends ContinuousEffectImpl implements SourceEffect {
@ -65,7 +63,7 @@ public class LoseCreatureTypeSourceEffect extends ContinuousEffectImpl implement
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
permanent.getCardType().remove(CardType.CREATURE);
permanent.getSubtype(game).retainAll(SubType.getLandTypes(false));
permanent.getSubtype(game).retainAll(SubType.getLandTypes());
if (permanent.isAttacking() || permanent.getBlocking() > 0) {
permanent.removeFromCombat(game);
}

View file

@ -1,14 +1,8 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.SubTypeList;
@ -54,7 +48,7 @@ public class SetCardSubtypeAttachedEffect extends ContinuousEffectImpl {
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent target = game.getPermanent(equipment.getAttachedTo());
if (target != null) {
target.getSubtype(game).retainAll(SubType.getLandTypes(false));
target.getSubtype(game).retainAll(SubType.getLandTypes());
target.getSubtype(game).addAll(setSubtypes);
}
}

View file

@ -1,5 +1,3 @@
package mage.choices;
import mage.constants.SubType;
@ -13,7 +11,7 @@ public class ChoiceLandType extends ChoiceImpl {
public ChoiceLandType() {
super(true);
this.setChoices(SubType.getLandTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
this.setChoices(SubType.getLandTypes().stream().map(SubType::toString).collect(Collectors.toSet()));
this.message = "Choose a land type";
}

View file

@ -471,48 +471,47 @@ public enum SubType {
return subTypeSet;
}
public static Set<SubType> getArtifactTypes(boolean withCustomSets) {
public static Set<SubType> getArtifactTypes() {
Set<SubType> subTypes = EnumSet.noneOf(SubType.class);
for (SubType subType : values()) {
if (subType.getSubTypeSet() == SubTypeSet.ArtifactType && (withCustomSets || !subType.customSet)) {
if (subType.getSubTypeSet() == SubTypeSet.ArtifactType) {
subTypes.add(subType);
}
}
return subTypes;
}
public static Set<SubType> getPlaneswalkerTypes(boolean withCustomSets) {
public static Set<SubType> getPlaneswalkerTypes() {
Set<SubType> subTypes = EnumSet.noneOf(SubType.class);
for (SubType subType : values()) {
if (subType.getSubTypeSet() == SubTypeSet.PlaneswalkerType && (withCustomSets || !subType.customSet)) {
if (subType.getSubTypeSet() == SubTypeSet.PlaneswalkerType) {
subTypes.add(subType);
}
}
return subTypes;
}
public static Set<SubType> getCreatureTypes(boolean customSet) {
public static Set<SubType> getCreatureTypes() {
Set<SubType> subTypes = EnumSet.noneOf(SubType.class);
for (SubType s : values()) {
if (s.customSet == customSet && s.getSubTypeSet() == SubTypeSet.CreatureType) {
subTypes.add(s);
for (SubType subType : values()) {
if (subType.getSubTypeSet() == SubTypeSet.CreatureType) {
subTypes.add(subType);
}
}
return subTypes;
}
public static Set<SubType> getBasicLands(boolean customSet) {
public static Set<SubType> getBasicLands() {
return Arrays.stream(values())
.filter(p -> p.getSubTypeSet() == SubTypeSet.BasicLandType)
.filter(s -> s.customSet == customSet)
.collect(Collectors.toSet());
}
public static SubTypeList getLandTypes(boolean customSet) {
public static SubTypeList getLandTypes() {
SubTypeList landTypes = new SubTypeList();
for (SubType s : values()) {
if (s.getSubTypeSet() == SubTypeSet.BasicLandType || s.getSubTypeSet() == SubTypeSet.NonBasicLandType) {
landTypes.add(s);
for (SubType subType : values()) {
if (subType.getSubTypeSet() == SubTypeSet.BasicLandType || subType.getSubTypeSet() == SubTypeSet.NonBasicLandType) {
landTypes.add(subType);
}
}
return landTypes;