Implemented Pirate's Cutlass, changed text templating for creating token effects

This commit is contained in:
Evan Kranzler 2017-09-06 16:19:53 -04:00
parent 1021ba2d61
commit 6fc78d1d78
5 changed files with 131 additions and 18 deletions

View file

@ -113,7 +113,7 @@ public class CreateTokenEffect extends OneShotEffect {
public ArrayList<UUID> getLastAddedTokenIds() {
return lastAddedTokenIds;
}
public void exileTokensCreatedAtNextEndStep(Game game, Ability source) {
for (UUID tokenId : this.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId);
@ -122,7 +122,7 @@ public class CreateTokenEffect extends OneShotEffect {
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source);
}
}
}
}
public void exileTokensCreatedAtEndOfCombat(Game game, Ability source) {
@ -133,9 +133,9 @@ public class CreateTokenEffect extends OneShotEffect {
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
}
}
}
}
private void setText() {
StringBuilder sb = new StringBuilder("create ");
if (amount.toString().equals("1")) {
@ -153,6 +153,10 @@ public class CreateTokenEffect extends OneShotEffect {
if (token.getDescription().endsWith("token")) {
sb.append("s ");
}
int tokenLocation = sb.indexOf("token ");
if (tokenLocation != -1) {
sb.replace(tokenLocation, tokenLocation + 6, "tokens ");
}
}
if (attacking) {
if (tapped) {

View file

@ -67,25 +67,44 @@ public class CreateTokenTargetEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder("put ");
sb.append(CardUtil.numberToText(amount.toString(), "a"));
sb.append(' ').append(token.getDescription()).append(" onto the battlefield");
if (tapped) {
sb.append(" tapped");
StringBuilder sb = new StringBuilder();
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
sb.append(" creates ");
if (amount.toString().equals("1")) {
sb.append("a ");
if (tapped && !attacking) {
sb.append("tapped ");
}
sb.append(token.getDescription());
} else {
sb.append(CardUtil.numberToText(amount.toString())).append(' ');
if (tapped && !attacking) {
sb.append("tapped ");
}
sb.append(token.getDescription());
if (token.getDescription().endsWith("token")) {
sb.append("s ");
}
int tokenLocation = sb.indexOf("token ");
if (tokenLocation != -1) {
sb.replace(tokenLocation, tokenLocation + 6, "tokens ");
}
}
if (attacking) {
if (tapped) {
sb.append(" and");
sb.append(" tapped and");
}
sb.append(" attacking");
}
String message = amount.getMessage();
if (!message.isEmpty()) {
sb.append(" for each ");
if (amount.toString().equals("X")) {
sb.append(", where X is ");
} else {
sb.append(" for each ");
}
}
sb.append(message);
sb.append(" under target ").append(mode.getTargets().get(0).getTargetName());
sb.append("'s control");
return sb.toString();
}
}