text fix for fetch lands

This commit is contained in:
Evan Kranzler 2021-04-22 17:34:22 -04:00
parent 97b8871122
commit a8096fc0a7
17 changed files with 23 additions and 38 deletions

View file

@ -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) {

View file

@ -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));
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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));
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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<SubType> subtypes) {
this(true, subtypes);
public FetchLandActivatedAbility(SubType subType1, SubType subType2) {
this(true, subType1, subType2);
}
public FetchLandActivatedAbility(boolean withDamage, Set<SubType> 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<Predicate<MageObject>> 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<SubType> subTypes) {
return subTypes.stream().map(SubType::getDescription).collect(Collectors.joining(" or ")) + " card";
}
@Override
public FetchLandActivatedAbility copy() {
return new FetchLandActivatedAbility(this);

View file

@ -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<UUID> getAllSelectedTargets(Ability ability, Game game) {