mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
reworked alara heralds
This commit is contained in:
parent
e56264ff74
commit
01b797f494
10 changed files with 152 additions and 118 deletions
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -14,13 +11,12 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledCreatureEachColor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
@ -28,19 +24,13 @@ import mage.target.common.TargetControlledCreaturePermanent;
|
|||
public final class AngelsHerald extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("card named Empyrial Archangel");
|
||||
private static final FilterControlledCreaturePermanent filterGreen = new FilterControlledCreaturePermanent("a green creature");
|
||||
private static final FilterControlledCreaturePermanent filterWhite = new FilterControlledCreaturePermanent("a white creature");
|
||||
private static final FilterControlledCreaturePermanent filterBlue = new FilterControlledCreaturePermanent("a blue creature");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Empyrial Archangel"));
|
||||
filterGreen.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
filterWhite.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
}
|
||||
|
||||
public AngelsHerald(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.CLERIC);
|
||||
|
||||
|
@ -49,13 +39,11 @@ public final class AngelsHerald extends CardImpl {
|
|||
|
||||
// {2}{W}, {tap}, Sacrifice a green creature, a white creature, and a blue creature:
|
||||
// Search your library for a card named Empyrial Archangel and put it onto the battlefield. Then shuffle your library.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(1, 1, new FilterCard(filter))),
|
||||
new ManaCostsImpl("{2}{W}"));
|
||||
Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{W}")
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterGreen, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlue, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("GWU")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -14,34 +11,26 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledCreatureEachColor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class BehemothsHerald extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("card named Godsire");
|
||||
private static final FilterControlledCreaturePermanent filterRed = new FilterControlledCreaturePermanent("a red creature");
|
||||
private static final FilterControlledCreaturePermanent filterGreen = new FilterControlledCreaturePermanent("a green creature");
|
||||
private static final FilterControlledCreaturePermanent filterWhite = new FilterControlledCreaturePermanent("a white creature");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Godsire"));
|
||||
filterRed.add(new ColorPredicate(ObjectColor.RED));
|
||||
filterGreen.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
filterWhite.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
}
|
||||
|
||||
public BehemothsHerald(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
|
||||
this.subtype.add(SubType.ELF, SubType.SHAMAN);
|
||||
|
||||
this.power = new MageInt(1);
|
||||
|
@ -49,14 +38,11 @@ public final class BehemothsHerald extends CardImpl {
|
|||
|
||||
// {2}{G}, {tap}, Sacrifice a red creature, a green creature, and a white creature:
|
||||
// Search your library for a card named Godsire and put it onto the battlefield. Then shuffle your library.
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, new FilterCard(filter));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayEffect(target),
|
||||
new ManaCostsImpl("{2}{G}"));
|
||||
Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{G}")
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterRed, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterGreen, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("RGW")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class ConfluxTarget extends TargetCardInLibrary {
|
|||
filter.add(Predicates.not(ColorlessPredicate.instance));
|
||||
}
|
||||
|
||||
private static final ColorAssignment colorAssigner = new ColorAssignment();
|
||||
private static final ColorAssignment colorAssigner = new ColorAssignment("W", "U", "B", "R", "G");
|
||||
|
||||
ConfluxTarget() {
|
||||
super(0, 5, filter);
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -14,34 +11,26 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledCreatureEachColor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class DemonsHerald extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("card named Prince of Thralls");
|
||||
private static final FilterControlledCreaturePermanent filterBlue = new FilterControlledCreaturePermanent("a blue creature");
|
||||
private static final FilterControlledCreaturePermanent filterBlack = new FilterControlledCreaturePermanent("a black creature");
|
||||
private static final FilterControlledCreaturePermanent filterRed = new FilterControlledCreaturePermanent("a red creature");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Prince of Thralls"));
|
||||
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
filterBlack.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
filterRed.add(new ColorPredicate(ObjectColor.RED));
|
||||
}
|
||||
|
||||
public DemonsHerald(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
|
||||
|
@ -50,14 +39,11 @@ public final class DemonsHerald extends CardImpl {
|
|||
|
||||
// {2}{B}, {tap}, Sacrifice a blue creature, a black creature, and a red creature:
|
||||
// Search your library for a card named Prince of Thralls and put it onto the battlefield. Then shuffle your library.
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, new FilterCard(filter));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayEffect(target),
|
||||
new ManaCostsImpl("{2}{B}"));
|
||||
Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{B}")
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlue, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlack, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterRed, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("UBR")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -14,34 +11,26 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledCreatureEachColor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class DragonsHerald extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("card named Hellkite Overlord");
|
||||
private static final FilterControlledCreaturePermanent filterBlack = new FilterControlledCreaturePermanent("a black creature");
|
||||
private static final FilterControlledCreaturePermanent filterRed = new FilterControlledCreaturePermanent("a red creature");
|
||||
private static final FilterControlledCreaturePermanent filterGreen = new FilterControlledCreaturePermanent("a green creature");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Hellkite Overlord"));
|
||||
filterBlack.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
filterRed.add(new ColorPredicate(ObjectColor.RED));
|
||||
filterGreen.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
}
|
||||
|
||||
public DragonsHerald(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
|
||||
this.subtype.add(SubType.GOBLIN);
|
||||
this.subtype.add(SubType.SHAMAN);
|
||||
|
||||
|
@ -50,14 +39,11 @@ public final class DragonsHerald extends CardImpl {
|
|||
|
||||
// {2}{R}, {tap}, Sacrifice a black creature, a red creature, and a green creature:
|
||||
// Search your library for a card named Hellkite Overlord and put it onto the battlefield. Then shuffle your library.
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, new FilterCard(filter));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayEffect(target),
|
||||
new ManaCostsImpl("{2}{R}"));
|
||||
Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{R}")
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlack, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterRed, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterGreen, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("BRG")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -14,32 +11,26 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetControlledCreatureEachColor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class SphinxsHerald extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("card named Sphinx Sovereign");
|
||||
private static final FilterControlledCreaturePermanent filterWhite = new FilterControlledCreaturePermanent("a white creature");
|
||||
private static final FilterControlledCreaturePermanent filterBlue = new FilterControlledCreaturePermanent("a blue creature");
|
||||
private static final FilterControlledCreaturePermanent filterBlack = new FilterControlledCreaturePermanent("a black creature");
|
||||
|
||||
static {
|
||||
filter.add(new NamePredicate("Sphinx Sovereign"));
|
||||
filterWhite.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
filterBlack.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
|
||||
public SphinxsHerald(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{U}");
|
||||
this.subtype.add(SubType.VEDALKEN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
|
||||
|
@ -48,14 +39,11 @@ public final class SphinxsHerald extends CardImpl {
|
|||
|
||||
// {2}{U}, {tap}, Sacrifice a white creature, a blue creature, and a black creature:
|
||||
// Search your library for a card named Sphinx Sovereign and put it onto the battlefield. Then shuffle your library.
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, new FilterCard(filter));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayEffect(target),
|
||||
new ManaCostsImpl("{2}{U}"));
|
||||
Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{U}")
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlue, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlack, false)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("WUB")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,9 @@ public class SacrificeTargetCost extends CostImpl {
|
|||
if (target.getMinNumberOfTargets() != target.getMaxNumberOfTargets()) {
|
||||
return target.getTargetName();
|
||||
}
|
||||
if (target.getNumberOfTargets() == 1) {
|
||||
if (target.getNumberOfTargets() == 1
|
||||
|| target.getTargetName().startsWith("a ")
|
||||
|| target.getTargetName().startsWith("an ")) {
|
||||
return CardUtil.addArticle(target.getTargetName());
|
||||
}
|
||||
return CardUtil.numberToText(target.getNumberOfTargets()) + ' ' + target.getTargetName();
|
||||
|
|
|
@ -4,21 +4,20 @@ import mage.abilities.dynamicvalue.RoleAssignment;
|
|||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ColorAssignment extends RoleAssignment<String> {
|
||||
|
||||
public ColorAssignment() {
|
||||
super("W", "U", "B", "R", "G");
|
||||
public ColorAssignment(String... colors) {
|
||||
super(colors);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> makeSet(Card card, Game game) {
|
||||
Set<String> strings = new HashSet<>();
|
||||
for (char c : card.getColor(game).toString().toCharArray()) {
|
||||
strings.add("" + c);
|
||||
}
|
||||
return strings;
|
||||
return Arrays.stream(card.getColor(game).toString().split(""))
|
||||
.filter(attributes::contains)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package mage.target.common;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.ColorAssignment;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class TargetControlledCreatureEachColor extends TargetControlledPermanent {
|
||||
|
||||
private final ColorAssignment colorAssigner;
|
||||
|
||||
private static final FilterControlledPermanent makeFilter(String colors) {
|
||||
List<ObjectColor> objectColors
|
||||
= Arrays.stream(colors.split(""))
|
||||
.map(ObjectColor::new)
|
||||
.collect(Collectors.toList());
|
||||
FilterControlledPermanent filter
|
||||
= new FilterControlledCreaturePermanent(CardUtil.concatWithAnd(
|
||||
objectColors
|
||||
.stream()
|
||||
.map(ObjectColor::getDescription)
|
||||
.map(s -> CardUtil.addArticle(s) + " creature")
|
||||
.collect(Collectors.toList())
|
||||
));
|
||||
filter.add(Predicates.or(objectColors.stream().map(ColorPredicate::new).collect(Collectors.toList())));
|
||||
return filter;
|
||||
}
|
||||
|
||||
public TargetControlledCreatureEachColor(String colors) {
|
||||
super(colors.length(), makeFilter(colors));
|
||||
colorAssigner = new ColorAssignment(colors.split(""));
|
||||
}
|
||||
|
||||
private TargetControlledCreatureEachColor(final TargetControlledCreatureEachColor target) {
|
||||
super(target);
|
||||
this.colorAssigner = target.colorAssigner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
|
||||
if (!super.canTarget(playerId, id, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(id);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getTargets().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
Cards cards = new CardsImpl(this.getTargets());
|
||||
cards.add(permanent);
|
||||
return colorAssigner.getRoleCount(cards, game) >= cards.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetControlledCreatureEachColor copy() {
|
||||
return new TargetControlledCreatureEachColor(this);
|
||||
}
|
||||
}
|
|
@ -1338,4 +1338,27 @@ public final class CardUtil {
|
|||
// normal game
|
||||
return "T" + gameState.getTurnNum() + "." + gameState.getTurn().getStep().getType().getStepShortText();
|
||||
}
|
||||
|
||||
public static String concatWithAnd(List<String> strings) {
|
||||
switch (strings.size()) {
|
||||
case 0:
|
||||
return "";
|
||||
case 1:
|
||||
return strings.get(0);
|
||||
case 2:
|
||||
return strings.get(0) + " and " + strings.get(1);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
sb.append(strings.get(i));
|
||||
if (i == strings.size() - 1) {
|
||||
break;
|
||||
}
|
||||
sb.append(", ");
|
||||
if (i == strings.size() - 2) {
|
||||
sb.append("and ");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue