Fixed text generation for LoseLifeOpponentsEffect

This commit is contained in:
Alex Vasile 2022-09-05 14:26:36 -04:00
parent bfa5b6ab5f
commit 138fa46824

View file

@ -17,7 +17,7 @@ import java.util.UUID;
*/ */
public class LoseLifeOpponentsEffect extends OneShotEffect { public class LoseLifeOpponentsEffect extends OneShotEffect {
private DynamicValue amount; private final DynamicValue amount;
public LoseLifeOpponentsEffect(int amount) { public LoseLifeOpponentsEffect(int amount) {
this(StaticValue.get(amount)); this(StaticValue.get(amount));
@ -26,7 +26,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect {
public LoseLifeOpponentsEffect(DynamicValue amount) { public LoseLifeOpponentsEffect(DynamicValue amount) {
super(Outcome.Damage); super(Outcome.Damage);
this.amount = amount; this.amount = amount;
staticText = "each opponent loses " + amount + " life"; staticText = generateStaticText();
} }
public LoseLifeOpponentsEffect(final LoseLifeOpponentsEffect effect) { public LoseLifeOpponentsEffect(final LoseLifeOpponentsEffect effect) {
@ -50,8 +50,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect {
return new LoseLifeOpponentsEffect(this); return new LoseLifeOpponentsEffect(this);
} }
@Override private String generateStaticText() {
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) { if (staticText != null && !staticText.isEmpty()) {
return staticText; return staticText;
} }
@ -59,7 +58,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect {
String message = amount.getMessage(); String message = amount.getMessage();
sb.append("each opponent loses "); sb.append("each opponent loses ");
if (message.isEmpty() || !message.equals("1")) { if (!message.equals("1")) {
sb.append(amount).append(' '); sb.append(amount).append(' ');
} }
sb.append("life"); sb.append("life");