update energy text generation (errata confirmed by commander deck reprints)

This commit is contained in:
theelk801 2024-05-28 15:01:22 -04:00
parent ba36eac7f8
commit b475e03255
2 changed files with 25 additions and 12 deletions

View file

@ -1,16 +1,17 @@
package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID;
/**
*
* @author emerald000
*/
public class PayEnergyCost extends CostImpl {
@ -19,7 +20,7 @@ public class PayEnergyCost extends CostImpl {
public PayEnergyCost(int amount) {
this.amount = amount;
setText();
this.text = makeText(amount);
}
public PayEnergyCost(PayEnergyCost cost) {
@ -48,11 +49,16 @@ public class PayEnergyCost extends CostImpl {
return new PayEnergyCost(this);
}
private void setText() {
private static String makeText(int amount) {
StringBuilder sb = new StringBuilder("pay ");
for (int i = 0; i < amount; i++) {
sb.append("{E}");
if (amount < 6) {
for (int i = 0; i < amount; i++) {
sb.append("{E}");
}
} else {
sb.append(CardUtil.numberToText(amount));
sb.append(" {E}");
}
this.text = sb.toString();
return sb.toString();
}
}

View file

@ -49,17 +49,24 @@ public class GetEnergyCountersControllerEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
sb.append("you get ");
int val = 1;
int val;
if (value instanceof StaticValue) {
val = ((StaticValue) value).getValue();
} else {
val = 1;
}
for (int i = 0; i < val; i++) {
sb.append("{E}");
if (val < 6) {
for (int i = 0; i < val; i++) {
sb.append("{E}");
}
} else {
sb.append(CardUtil.numberToText(val));
sb.append(" {E}");
}
sb.append(" <i>(");
sb.append(CardUtil.getSimpleCountersText(val, "an", "energy"));
sb.append(CardUtil.getSimpleCountersText(val, "an", "energy"));
sb.append(")</i>");
if ((value instanceof StaticValue)) {
if (value instanceof StaticValue) {
sb.append('.');
} else {
sb.append(" for each ");