mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
text fix for fetch lands
This commit is contained in:
parent
97b8871122
commit
a8096fc0a7
17 changed files with 23 additions and 38 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue