reworked alara heralds

This commit is contained in:
Evan Kranzler 2021-04-23 09:42:06 -04:00
parent e56264ff74
commit 01b797f494
10 changed files with 152 additions and 118 deletions

View file

@ -1,9 +1,6 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
@ -14,13 +11,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreatureEachColor;
import java.util.UUID;
/** /**
* @author nantuko * @author nantuko
@ -28,15 +24,9 @@ import mage.target.common.TargetControlledCreaturePermanent;
public final class AngelsHerald extends CardImpl { public final class AngelsHerald extends CardImpl {
private static final FilterCard filter = new FilterCard("card named Empyrial Archangel"); 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 { static {
filter.add(new NamePredicate("Empyrial Archangel")); 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) { public AngelsHerald(UUID ownerId, CardSetInfo setInfo) {
@ -49,13 +39,11 @@ public final class AngelsHerald extends CardImpl {
// {2}{W}, {tap}, Sacrifice a green creature, a white creature, and a blue creature: // {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. // 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, Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(1, 1, new FilterCard(filter))), new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{W}")
new ManaCostsImpl("{2}{W}")); );
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterGreen, false))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("GWU")));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlue, false)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,9 +1,6 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
@ -14,30 +11,22 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreatureEachColor;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class BehemothsHerald extends CardImpl { public final class BehemothsHerald extends CardImpl {
private static final FilterCard filter = new FilterCard("card named Godsire"); 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 { static {
filter.add(new NamePredicate("Godsire")); 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) { public BehemothsHerald(UUID ownerId, CardSetInfo setInfo) {
@ -49,14 +38,11 @@ public final class BehemothsHerald extends CardImpl {
// {2}{G}, {tap}, Sacrifice a red creature, a green creature, and a white creature: // {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. // 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(new SearchLibraryPutInPlayEffect(
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{G}")
new SearchLibraryPutInPlayEffect(target), );
new ManaCostsImpl("{2}{G}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterRed, false))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("RGW")));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterGreen, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -47,7 +47,7 @@ class ConfluxTarget extends TargetCardInLibrary {
filter.add(Predicates.not(ColorlessPredicate.instance)); 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() { ConfluxTarget() {
super(0, 5, filter); super(0, 5, filter);

View file

@ -1,9 +1,6 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
@ -14,30 +11,22 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreatureEachColor;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class DemonsHerald extends CardImpl { public final class DemonsHerald extends CardImpl {
private static final FilterCard filter = new FilterCard("card named Prince of Thralls"); 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 { static {
filter.add(new NamePredicate("Prince of Thralls")); 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) { public DemonsHerald(UUID ownerId, CardSetInfo setInfo) {
@ -50,14 +39,11 @@ public final class DemonsHerald extends CardImpl {
// {2}{B}, {tap}, Sacrifice a blue creature, a black creature, and a red creature: // {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. // 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(new SearchLibraryPutInPlayEffect(
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{B}")
new SearchLibraryPutInPlayEffect(target), );
new ManaCostsImpl("{2}{B}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlue, false))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("UBR")));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlack, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterRed, false)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,9 +1,6 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
@ -14,30 +11,22 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreatureEachColor;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class DragonsHerald extends CardImpl { public final class DragonsHerald extends CardImpl {
private static final FilterCard filter = new FilterCard("card named Hellkite Overlord"); 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 { static {
filter.add(new NamePredicate("Hellkite Overlord")); 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) { public DragonsHerald(UUID ownerId, CardSetInfo setInfo) {
@ -50,14 +39,11 @@ public final class DragonsHerald extends CardImpl {
// {2}{R}, {tap}, Sacrifice a black creature, a red creature, and a green creature: // {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. // 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(new SearchLibraryPutInPlayEffect(
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{R}")
new SearchLibraryPutInPlayEffect(target), );
new ManaCostsImpl("{2}{R}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlack, false))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("BRG")));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterRed, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterGreen, false)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,9 +1,6 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
@ -14,30 +11,24 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreatureEachColor;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class SphinxsHerald extends CardImpl { public final class SphinxsHerald extends CardImpl {
private static final FilterCard filter = new FilterCard("card named Sphinx Sovereign"); 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 { static {
filter.add(new NamePredicate("Sphinx Sovereign")); 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) { 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.VEDALKEN);
@ -48,14 +39,11 @@ public final class SphinxsHerald extends CardImpl {
// {2}{U}, {tap}, Sacrifice a white creature, a blue creature, and a black creature: // {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. // 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(new SearchLibraryPutInPlayEffect(
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TargetCardInLibrary(filter)), new ManaCostsImpl<>("{2}{U}")
new SearchLibraryPutInPlayEffect(target), );
new ManaCostsImpl("{2}{U}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreatureEachColor("WUB")));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlue, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlack, false)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -103,7 +103,9 @@ public class SacrificeTargetCost extends CostImpl {
if (target.getMinNumberOfTargets() != target.getMaxNumberOfTargets()) { if (target.getMinNumberOfTargets() != target.getMaxNumberOfTargets()) {
return target.getTargetName(); 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.addArticle(target.getTargetName());
} }
return CardUtil.numberToText(target.getNumberOfTargets()) + ' ' + target.getTargetName(); return CardUtil.numberToText(target.getNumberOfTargets()) + ' ' + target.getTargetName();

View file

@ -4,21 +4,20 @@ import mage.abilities.dynamicvalue.RoleAssignment;
import mage.cards.Card; import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import java.util.HashSet; import java.util.Arrays;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
public class ColorAssignment extends RoleAssignment<String> { public class ColorAssignment extends RoleAssignment<String> {
public ColorAssignment() { public ColorAssignment(String... colors) {
super("W", "U", "B", "R", "G"); super(colors);
} }
@Override @Override
protected Set<String> makeSet(Card card, Game game) { protected Set<String> makeSet(Card card, Game game) {
Set<String> strings = new HashSet<>(); return Arrays.stream(card.getColor(game).toString().split(""))
for (char c : card.getColor(game).toString().toCharArray()) { .filter(attributes::contains)
strings.add("" + c); .collect(Collectors.toSet());
}
return strings;
} }
} }

View file

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

View file

@ -1338,4 +1338,27 @@ public final class CardUtil {
// normal game // normal game
return "T" + gameState.getTurnNum() + "." + gameState.getTurn().getStep().getType().getStepShortText(); 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();
}
} }