diff --git a/Mage.Sets/src/mage/cards/a/AridMesa.java b/Mage.Sets/src/mage/cards/a/AridMesa.java index 3d060b3219..6178641b3d 100644 --- a/Mage.Sets/src/mage/cards/a/AridMesa.java +++ b/Mage.Sets/src/mage/cards/a/AridMesa.java @@ -20,7 +20,7 @@ public final class AridMesa extends CardImpl { public AridMesa(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.LAND},null); this.frameColor = new ObjectColor("WR"); - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.MOUNTAIN, SubType.PLAINS))); + this.addAbility(new FetchLandActivatedAbility(SubType.MOUNTAIN, SubType.PLAINS)); } private AridMesa(final AridMesa card) { diff --git a/Mage.Sets/src/mage/cards/b/BadRiver.java b/Mage.Sets/src/mage/cards/b/BadRiver.java index 12cfa364aa..0c2b71beef 100644 --- a/Mage.Sets/src/mage/cards/b/BadRiver.java +++ b/Mage.Sets/src/mage/cards/b/BadRiver.java @@ -22,7 +22,7 @@ public final class BadRiver extends CardImpl { // Bad River enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); // {tap}, Sacrifice Bad River: Search your library for an Island or Swamp card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(false, EnumSet.of(SubType.ISLAND, SubType.SWAMP))); + this.addAbility(new FetchLandActivatedAbility(false, SubType.ISLAND, SubType.SWAMP)); } diff --git a/Mage.Sets/src/mage/cards/b/BloodstainedMire.java b/Mage.Sets/src/mage/cards/b/BloodstainedMire.java index 67dfdeabd7..d57f4219a1 100644 --- a/Mage.Sets/src/mage/cards/b/BloodstainedMire.java +++ b/Mage.Sets/src/mage/cards/b/BloodstainedMire.java @@ -21,7 +21,7 @@ public final class BloodstainedMire extends CardImpl { this.frameColor = new ObjectColor("RB"); // {tap}, Pay 1 life, Sacrifice Bloodstained Mire: Search your library for a Swamp or Mountain card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.SWAMP,SubType.MOUNTAIN))); + this.addAbility(new FetchLandActivatedAbility(SubType.SWAMP,SubType.MOUNTAIN)); } private BloodstainedMire(final BloodstainedMire card) { diff --git a/Mage.Sets/src/mage/cards/f/FloodPlain.java b/Mage.Sets/src/mage/cards/f/FloodPlain.java index 5b5ac1d3a0..00b12b1f31 100644 --- a/Mage.Sets/src/mage/cards/f/FloodPlain.java +++ b/Mage.Sets/src/mage/cards/f/FloodPlain.java @@ -22,7 +22,7 @@ public final class FloodPlain extends CardImpl { // Flood Plain enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); // {tap}, Sacrifice Flood Plain: Search your library for a Plains or Island card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(false, EnumSet.of(SubType.PLAINS, SubType.ISLAND))); + this.addAbility(new FetchLandActivatedAbility(false, SubType.PLAINS, SubType.ISLAND)); } private FloodPlain(final FloodPlain card) { diff --git a/Mage.Sets/src/mage/cards/f/FloodedStrand.java b/Mage.Sets/src/mage/cards/f/FloodedStrand.java index e2b3e4bebc..5c42b4f7e2 100644 --- a/Mage.Sets/src/mage/cards/f/FloodedStrand.java +++ b/Mage.Sets/src/mage/cards/f/FloodedStrand.java @@ -21,7 +21,7 @@ public final class FloodedStrand extends CardImpl { this.frameColor = new ObjectColor("UW"); // {tap}, Pay 1 life, Sacrifice Flooded Strand: Search your library for a Plains or Island card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.PLAINS, SubType.ISLAND))); + this.addAbility(new FetchLandActivatedAbility(SubType.PLAINS, SubType.ISLAND)); } private FloodedStrand(final FloodedStrand card) { diff --git a/Mage.Sets/src/mage/cards/g/Grasslands.java b/Mage.Sets/src/mage/cards/g/Grasslands.java index 4d94e9b929..a22d475b1b 100644 --- a/Mage.Sets/src/mage/cards/g/Grasslands.java +++ b/Mage.Sets/src/mage/cards/g/Grasslands.java @@ -21,7 +21,7 @@ public final class Grasslands extends CardImpl { // Grasslands enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); // {tap}, Sacrifice Grasslands: Search your library for a Forest or Plains card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(false, EnumSet.of(SubType.FOREST, SubType.PLAINS))); + this.addAbility(new FetchLandActivatedAbility(false, SubType.FOREST, SubType.PLAINS)); } private Grasslands(final Grasslands card) { diff --git a/Mage.Sets/src/mage/cards/m/MarshFlats.java b/Mage.Sets/src/mage/cards/m/MarshFlats.java index f512025035..567c28ab61 100644 --- a/Mage.Sets/src/mage/cards/m/MarshFlats.java +++ b/Mage.Sets/src/mage/cards/m/MarshFlats.java @@ -20,7 +20,7 @@ public final class MarshFlats extends CardImpl { public MarshFlats(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.LAND},null); this.frameColor = new ObjectColor("WB"); - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.SWAMP, SubType.PLAINS))); + this.addAbility(new FetchLandActivatedAbility(SubType.PLAINS, SubType.SWAMP)); } private MarshFlats(final MarshFlats card) { diff --git a/Mage.Sets/src/mage/cards/m/MistyRainforest.java b/Mage.Sets/src/mage/cards/m/MistyRainforest.java index 18824b1b9e..21154548aa 100644 --- a/Mage.Sets/src/mage/cards/m/MistyRainforest.java +++ b/Mage.Sets/src/mage/cards/m/MistyRainforest.java @@ -20,7 +20,7 @@ public final class MistyRainforest extends CardImpl { public MistyRainforest(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.LAND},null); this.frameColor = new ObjectColor("UG"); - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.FOREST, SubType.ISLAND))); + this.addAbility(new FetchLandActivatedAbility(SubType.FOREST, SubType.ISLAND)); } private MistyRainforest(final MistyRainforest card) { diff --git a/Mage.Sets/src/mage/cards/m/MountainValley.java b/Mage.Sets/src/mage/cards/m/MountainValley.java index 1e5e817a75..7fbf269fd6 100644 --- a/Mage.Sets/src/mage/cards/m/MountainValley.java +++ b/Mage.Sets/src/mage/cards/m/MountainValley.java @@ -22,7 +22,7 @@ public final class MountainValley extends CardImpl { // Mountain Valley enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); // {tap}, Sacrifice Mountain Valley: Search your library for a Mountain or Forest card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(false, EnumSet.of(SubType.MOUNTAIN, SubType.FOREST))); + this.addAbility(new FetchLandActivatedAbility(false, SubType.MOUNTAIN, SubType.FOREST)); } diff --git a/Mage.Sets/src/mage/cards/p/PollutedDelta.java b/Mage.Sets/src/mage/cards/p/PollutedDelta.java index 25805ace50..63e3549f90 100644 --- a/Mage.Sets/src/mage/cards/p/PollutedDelta.java +++ b/Mage.Sets/src/mage/cards/p/PollutedDelta.java @@ -21,7 +21,7 @@ public final class PollutedDelta extends CardImpl { this.frameColor = new ObjectColor("UB"); // {tap}, Pay 1 life, Sacrifice Polluted Delta: Search your library for an Island or Swamp card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.ISLAND, SubType.SWAMP))); + this.addAbility(new FetchLandActivatedAbility(SubType.ISLAND, SubType.SWAMP)); } private PollutedDelta(final PollutedDelta card) { diff --git a/Mage.Sets/src/mage/cards/r/RockyTarPit.java b/Mage.Sets/src/mage/cards/r/RockyTarPit.java index 4f3e26bb9d..0cc8671a8a 100644 --- a/Mage.Sets/src/mage/cards/r/RockyTarPit.java +++ b/Mage.Sets/src/mage/cards/r/RockyTarPit.java @@ -22,7 +22,7 @@ public final class RockyTarPit extends CardImpl { // Rocky Tar Pit enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); // {tap}, Sacrifice Rocky Tar Pit: Search your library for a Swamp or Mountain card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(false, EnumSet.of(SubType.SWAMP, SubType.MOUNTAIN))); + this.addAbility(new FetchLandActivatedAbility(false, SubType.SWAMP, SubType.MOUNTAIN)); } private RockyTarPit(final RockyTarPit card) { diff --git a/Mage.Sets/src/mage/cards/s/ScaldingTarn.java b/Mage.Sets/src/mage/cards/s/ScaldingTarn.java index c57abc01a5..2d0ee21edc 100644 --- a/Mage.Sets/src/mage/cards/s/ScaldingTarn.java +++ b/Mage.Sets/src/mage/cards/s/ScaldingTarn.java @@ -20,7 +20,7 @@ public final class ScaldingTarn extends CardImpl { public ScaldingTarn(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.LAND},null); this.frameColor = new ObjectColor("UR"); - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.ISLAND, SubType.MOUNTAIN))); + this.addAbility(new FetchLandActivatedAbility(SubType.ISLAND, SubType.MOUNTAIN)); } private ScaldingTarn(final ScaldingTarn card) { diff --git a/Mage.Sets/src/mage/cards/v/VerdantCatacombs.java b/Mage.Sets/src/mage/cards/v/VerdantCatacombs.java index 8adfc3c365..ef83373fa4 100644 --- a/Mage.Sets/src/mage/cards/v/VerdantCatacombs.java +++ b/Mage.Sets/src/mage/cards/v/VerdantCatacombs.java @@ -20,7 +20,7 @@ public final class VerdantCatacombs extends CardImpl { public VerdantCatacombs(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.LAND},null); this.frameColor = new ObjectColor("BG"); - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.FOREST, SubType.SWAMP))); + this.addAbility(new FetchLandActivatedAbility(SubType.SWAMP, SubType.FOREST)); } private VerdantCatacombs(final VerdantCatacombs card) { diff --git a/Mage.Sets/src/mage/cards/w/WindsweptHeath.java b/Mage.Sets/src/mage/cards/w/WindsweptHeath.java index b8b271cb2c..9a289965c3 100644 --- a/Mage.Sets/src/mage/cards/w/WindsweptHeath.java +++ b/Mage.Sets/src/mage/cards/w/WindsweptHeath.java @@ -21,7 +21,7 @@ public final class WindsweptHeath extends CardImpl { this.frameColor = new ObjectColor("GW"); // {tap}, Pay 1 life, Sacrifice Windswept Heath: Search your library for a Forest or Plains card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.FOREST, SubType.PLAINS))); + this.addAbility(new FetchLandActivatedAbility(SubType.FOREST, SubType.PLAINS)); } private WindsweptHeath(final WindsweptHeath card) { diff --git a/Mage.Sets/src/mage/cards/w/WoodedFoothills.java b/Mage.Sets/src/mage/cards/w/WoodedFoothills.java index a4e5f55ee8..cfc580933f 100644 --- a/Mage.Sets/src/mage/cards/w/WoodedFoothills.java +++ b/Mage.Sets/src/mage/cards/w/WoodedFoothills.java @@ -21,7 +21,7 @@ public final class WoodedFoothills extends CardImpl { this.frameColor = new ObjectColor("RG"); // {tap}, Pay 1 life, Sacrifice Wooded Foothills: Search your library for a Mountain or Forest card and put it onto the battlefield. Then shuffle your library. - this.addAbility(new FetchLandActivatedAbility(EnumSet.of(SubType.MOUNTAIN, SubType.FOREST))); + this.addAbility(new FetchLandActivatedAbility(SubType.MOUNTAIN, SubType.FOREST)); } private WoodedFoothills(final WoodedFoothills card) { diff --git a/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java b/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java index 0180f8ece0..157a18dc37 100644 --- a/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java +++ b/Mage/src/main/java/mage/abilities/common/FetchLandActivatedAbility.java @@ -2,49 +2,36 @@ package mage.abilities.common; -import mage.MageObject; import mage.abilities.ActivatedAbilityImpl; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; -import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.Zone; import mage.filter.FilterCard; -import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicates; import mage.target.common.TargetCardInLibrary; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - /** * @author BetaSteward_at_googlemail.com */ public class FetchLandActivatedAbility extends ActivatedAbilityImpl { - public FetchLandActivatedAbility(Set subtypes) { - this(true, subtypes); + public FetchLandActivatedAbility(SubType subType1, SubType subType2) { + this(true, subType1, subType2); } - public FetchLandActivatedAbility(boolean withDamage, Set subtypes) { + public FetchLandActivatedAbility(boolean withDamage, SubType subType1, SubType subType2) { super(Zone.BATTLEFIELD, null); addCost(new TapSourceCost()); if (withDamage) { addCost(new PayLifeCost(1)); } addCost(new SacrificeSourceCost()); - FilterCard filter = new FilterCard(subTypeNames(subtypes)); - filter.add(CardType.LAND.getPredicate()); - List> subtypePredicates = new ArrayList<>(); - for (SubType subtype : subtypes) { - subtypePredicates.add(subtype.getPredicate()); - } - filter.add(Predicates.or(subtypePredicates)); + FilterCard filter = new FilterCard(subType1.getDescription() + " or " + subType2.getDescription() + " card"); + filter.add(Predicates.or(subType1.getPredicate(), subType2.getPredicate())); TargetCardInLibrary target = new TargetCardInLibrary(filter); addEffect(new SearchLibraryPutInPlayEffect(target, false, true, Outcome.PutLandInPlay)); } @@ -53,10 +40,6 @@ public class FetchLandActivatedAbility extends ActivatedAbilityImpl { super(ability); } - private String subTypeNames(Set subTypes) { - return subTypes.stream().map(SubType::getDescription).collect(Collectors.joining(" or ")) + " card"; - } - @Override public FetchLandActivatedAbility copy() { return new FetchLandActivatedAbility(this); diff --git a/Mage/src/main/java/mage/util/CardUtil.java b/Mage/src/main/java/mage/util/CardUtil.java index 39647d0f4a..7b72bc97e4 100644 --- a/Mage/src/main/java/mage/util/CardUtil.java +++ b/Mage/src/main/java/mage/util/CardUtil.java @@ -911,6 +911,8 @@ public final class CardUtil { } } + private static final String vowels = "aeiouAEIOU"; + public static String addArticle(String text) { if (text.startsWith("a ") || text.startsWith("an ") @@ -918,7 +920,7 @@ public final class CardUtil { || text.startsWith("any ")) { return text; } - return "aeiou".contains("" + text.charAt(0)) ? "an " + text : "a " + text; + return vowels.contains(text.substring(0, 1)) ? "an " + text : "a " + text; } public static Set getAllSelectedTargets(Ability ability, Game game) {