update text: sacrifice "of their choice"

This commit is contained in:
xenohedron 2024-11-29 02:36:17 -05:00
parent 7292639137
commit 729869ec36
13 changed files with 41 additions and 69 deletions

View file

@ -1,6 +1,7 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
@ -25,16 +26,6 @@ public class DrawDiscardTargetEffect extends OneShotEffect {
this.cardsToDraw = cardsToDraw;
this.cardsToDiscard = cardsToDiscard;
this.random = random;
staticText = new StringBuilder("target player draws ")
.append(CardUtil.numberToText(cardsToDraw, "a"))
.append(" card")
.append(cardsToDraw > 1 ? "s" : "")
.append(", then discards ")
.append(CardUtil.numberToText(cardsToDiscard, "a"))
.append(" card")
.append(cardsToDiscard > 1 ? "s" : "")
.append(random ? " at random" : "")
.toString();
}
private DrawDiscardTargetEffect(final DrawDiscardTargetEffect effect) {
@ -59,4 +50,16 @@ public class DrawDiscardTargetEffect extends OneShotEffect {
}
return false;
}
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
return getTargetPointer().describeTargets(mode.getTargets(), "that player") + " draws " +
CardUtil.numberToText(cardsToDraw, "a") + " card" + (cardsToDraw > 1 ? "s" : "") +
", then discards " + CardUtil.numberToText(cardsToDiscard, "a") +
" card" + (cardsToDiscard > 1 ? "s" : "") + (random ? " at random" : "");
}
}

View file

@ -139,6 +139,7 @@ public class SacrificeAllEffect extends OneShotEffect {
sb.append(' ');
sb.append(filter.getMessage());
}
sb.append(" of their choice");
staticText = sb.toString();
}

View file

@ -91,7 +91,8 @@ public class SacrificeEffect extends OneShotEffect {
if (preText != null) {
sb.append(preText);
}
if (preText != null && (preText.endsWith("player") || preText.endsWith("opponent") || preText.endsWith("controller"))) {
boolean playerSacs = preText != null && (preText.endsWith("player") || preText.endsWith("opponent") || preText.endsWith("controller"));
if (playerSacs) {
sb.append(" sacrifices ");
} else {
if (preText == null || preText.isEmpty()) {
@ -107,6 +108,9 @@ public class SacrificeEffect extends OneShotEffect {
sb.append(" ");
sb.append(filter.getMessage());
}
if (playerSacs && !filter.getMessage().contains("with")) {
sb.append(" of their choice");
}
staticText = sb.toString();
}
}

View file

@ -34,7 +34,7 @@ public class SacrificeOpponentsUnlessPayEffect extends OneShotEffect {
super(Outcome.Sacrifice);
this.cost = cost;
this.filter = filter;
this.staticText = "each opponent sacrifices " + CardUtil.addArticle(filter.getMessage()) + " unless they " + CardUtil.addCostVerb(cost.getText());
this.staticText = "each opponent sacrifices " + CardUtil.addArticle(filter.getMessage()) + " of their choice unless they " + CardUtil.addCostVerb(cost.getText());
}
protected SacrificeOpponentsUnlessPayEffect(final SacrificeOpponentsUnlessPayEffect effect) {