From b36465e5c9a2a3e372e169f2840548ba4196a9fb Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 4 Feb 2019 00:53:51 +0400 Subject: [PATCH] Refactor: removed unused custom set filters in SubType requests; --- .../card/dl/sources/TokensMtgImageSource.java | 2 +- Mage.Sets/src/mage/cards/a/AlpineMoon.java | 16 +++-------- Mage.Sets/src/mage/cards/c/Conspiracy.java | 2 +- Mage.Sets/src/mage/cards/e/EgoErasure.java | 15 +++++------ .../src/mage/cards/m/MagusOfTheMoon.java | 9 +++---- .../mage/cards/m/MetamorphicAlteration.java | 6 ++--- .../src/mage/cards/m/MyriadLandscape.java | 26 +++++++++--------- .../src/mage/cards/n/NyleasPresence.java | 12 ++++----- Mage.Sets/src/mage/cards/p/PlanarOverlay.java | 4 +-- Mage.Sets/src/mage/cards/p/PrismaticOmen.java | 6 ++--- Mage.Sets/src/mage/cards/s/ShadesBreath.java | 17 ++++-------- .../src/mage/cards/s/SunderingTitan.java | 6 ++--- .../effects/common/ChooseLandTypeEffect.java | 6 ++--- .../BecomesBasicLandEnchantedEffect.java | 3 +-- .../BecomesBasicLandTargetEffect.java | 12 ++++----- .../BecomesCreatureAttachedEffect.java | 3 +-- ...chedWithActivatedAbilityOrSpellEffect.java | 6 ++--- .../BecomesCreatureSourceEffect.java | 17 +++++++----- .../BecomesCreatureTargetEffect.java | 7 ++--- .../BecomesCreatureTypeTargetEffect.java | 3 +-- .../continuous/BecomesSubtypeAllEffect.java | 2 +- .../LoseAllCreatureTypesTargetEffect.java | 4 +-- .../LoseArtifactTypeTargetEffect.java | 8 ++---- .../LoseCreatureTypeSourceEffect.java | 4 +-- .../SetCardSubtypeAttachedEffect.java | 10 ++----- .../java/mage/choices/ChoiceLandType.java | 4 +-- .../src/main/java/mage/constants/SubType.java | 27 +++++++++---------- 27 files changed, 94 insertions(+), 143 deletions(-) diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index d501e30ffe..525361ff62 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -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"; } diff --git a/Mage.Sets/src/mage/cards/a/AlpineMoon.java b/Mage.Sets/src/mage/cards/a/AlpineMoon.java index a88fa999f8..364fb82893 100644 --- a/Mage.Sets/src/mage/cards/a/AlpineMoon.java +++ b/Mage.Sets/src/mage/cards/a/AlpineMoon.java @@ -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); diff --git a/Mage.Sets/src/mage/cards/c/Conspiracy.java b/Mage.Sets/src/mage/cards/c/Conspiracy.java index c9d92287aa..934ebd7db9 100644 --- a/Mage.Sets/src/mage/cards/c/Conspiracy.java +++ b/Mage.Sets/src/mage/cards/c/Conspiracy.java @@ -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); } } diff --git a/Mage.Sets/src/mage/cards/e/EgoErasure.java b/Mage.Sets/src/mage/cards/e/EgoErasure.java index 71374e44f7..3f7d2fba9a 100644 --- a/Mage.Sets/src/mage/cards/e/EgoErasure.java +++ b/Mage.Sets/src/mage/cards/e/EgoErasure.java @@ -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 it = affectedObjectList.iterator(); it.hasNext();) { + for (Iterator 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 it = affectedObjectList.iterator(); it.hasNext();) { + for (Iterator it = affectedObjectList.iterator(); it.hasNext(); ) { Permanent permanent = it.next().getPermanent(game); if (permanent != null) { permanent.addPower(-2); diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheMoon.java b/Mage.Sets/src/mage/cards/m/MagusOfTheMoon.java index 07f2a9abae..d4f08962f3 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheMoon.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheMoon.java @@ -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: diff --git a/Mage.Sets/src/mage/cards/m/MetamorphicAlteration.java b/Mage.Sets/src/mage/cards/m/MetamorphicAlteration.java index 6daa9c7245..0057c42fa7 100644 --- a/Mage.Sets/src/mage/cards/m/MetamorphicAlteration.java +++ b/Mage.Sets/src/mage/cards/m/MetamorphicAlteration.java @@ -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); } diff --git a/Mage.Sets/src/mage/cards/m/MyriadLandscape.java b/Mage.Sets/src/mage/cards/m/MyriadLandscape.java index 10de4a54c7..d4aa18ce39 100644 --- a/Mage.Sets/src/mage/cards/m/MyriadLandscape.java +++ b/Mage.Sets/src/mage/cards/m/MyriadLandscape.java @@ -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> 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 iterator = landTypes.iterator(); iterator.hasNext();) { + for (Iterator iterator = landTypes.iterator(); iterator.hasNext(); ) { SubType next = iterator.next(); if (card.hasSubtype(next, game)) { return true; diff --git a/Mage.Sets/src/mage/cards/n/NyleasPresence.java b/Mage.Sets/src/mage/cards/n/NyleasPresence.java index ec6583e080..14cb39ed09 100644 --- a/Mage.Sets/src/mage/cards/n/NyleasPresence.java +++ b/Mage.Sets/src/mage/cards/n/NyleasPresence.java @@ -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)) { diff --git a/Mage.Sets/src/mage/cards/p/PlanarOverlay.java b/Mage.Sets/src/mage/cards/p/PlanarOverlay.java index e86353fc92..d7d8681eec 100644 --- a/Mage.Sets/src/mage/cards/p/PlanarOverlay.java +++ b/Mage.Sets/src/mage/cards/p/PlanarOverlay.java @@ -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)); diff --git a/Mage.Sets/src/mage/cards/p/PrismaticOmen.java b/Mage.Sets/src/mage/cards/p/PrismaticOmen.java index 88898aa75e..9403d698bd 100644 --- a/Mage.Sets/src/mage/cards/p/PrismaticOmen.java +++ b/Mage.Sets/src/mage/cards/p/PrismaticOmen.java @@ -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"; } diff --git a/Mage.Sets/src/mage/cards/s/ShadesBreath.java b/Mage.Sets/src/mage/cards/s/ShadesBreath.java index 92ad48f6b6..f1f8aa659e 100644 --- a/Mage.Sets/src/mage/cards/s/ShadesBreath.java +++ b/Mage.Sets/src/mage/cards/s/ShadesBreath.java @@ -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); } } diff --git a/Mage.Sets/src/mage/cards/s/SunderingTitan.java b/Mage.Sets/src/mage/cards/s/SunderingTitan.java index 16e7eb3356..df2e165460 100644 --- a/Mage.Sets/src/mage/cards/s/SunderingTitan.java +++ b/Mage.Sets/src/mage/cards/s/SunderingTitan.java @@ -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 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); 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 7964752d8c..a078a57c80 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ChooseLandTypeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ChooseLandTypeEffect.java @@ -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()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandEnchantedEffect.java index fc1ab81355..ebf958615d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandEnchantedEffect.java @@ -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; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index 86fa19b7ce..23de1a78d9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -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(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java index 23f00727a2..2a74032610 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java @@ -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)) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java index d127b40943..16b27519ee 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect.java @@ -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)) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index ba868a521f..09a34e730b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -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); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index d386d9c691..b54244b30a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -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()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java index e5a140ff81..839f691d21 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java @@ -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) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java index 3bc5c7a936..97f506cbf3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java @@ -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) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllCreatureTypesTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllCreatureTypesTargetEffect.java index 1385a7b930..e913d661ab 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllCreatureTypesTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllCreatureTypesTargetEffect.java @@ -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; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseArtifactTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseArtifactTypeTargetEffect.java index ac44c271aa..edff38e966 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseArtifactTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseArtifactTypeTargetEffect.java @@ -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; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseCreatureTypeSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseCreatureTypeSourceEffect.java index 1af8b2d87d..02405a9d04 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseCreatureTypeSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseCreatureTypeSourceEffect.java @@ -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); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java index 2afd1c3abd..05da896fff 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java @@ -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); } } diff --git a/Mage/src/main/java/mage/choices/ChoiceLandType.java b/Mage/src/main/java/mage/choices/ChoiceLandType.java index edb20740e7..12cca314a6 100644 --- a/Mage/src/main/java/mage/choices/ChoiceLandType.java +++ b/Mage/src/main/java/mage/choices/ChoiceLandType.java @@ -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"; } diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index dd420b023e..b99eb52ad2 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -471,48 +471,47 @@ public enum SubType { return subTypeSet; } - public static Set getArtifactTypes(boolean withCustomSets) { + public static Set getArtifactTypes() { Set 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 getPlaneswalkerTypes(boolean withCustomSets) { + public static Set getPlaneswalkerTypes() { Set 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 getCreatureTypes(boolean customSet) { + public static Set getCreatureTypes() { Set 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 getBasicLands(boolean customSet) { + public static Set 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;