some changes to payment text generation

This commit is contained in:
Evan Kranzler 2022-02-19 17:41:57 -05:00
parent fe42bc6e49
commit 4868afe0e0
8 changed files with 25 additions and 48 deletions

View file

@ -17,7 +17,7 @@ public class DoIfCostPaid extends OneShotEffect {
protected Effects executingEffects = new Effects();
protected Effects otherwiseEffects = new Effects(); // used for Imprison
private final Cost cost;
protected final Cost cost;
private final String chooseUseText;
private final boolean optional;
@ -88,7 +88,7 @@ public class DoIfCostPaid extends OneShotEffect {
if (!effectText.isEmpty() && effectText.charAt(effectText.length() - 1) == '.') {
effectText = effectText.substring(0, effectText.length() - 1);
}
message = getCostText() + (effectText.isEmpty() ? "" : " and " + effectText) + "?";
message = CardUtil.addCostVerb(cost.getText()) + (effectText.isEmpty() ? "" : " and " + effectText) + "?";
message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
} else {
message = chooseUseText;
@ -155,19 +155,13 @@ public class DoIfCostPaid extends OneShotEffect {
if (!staticText.isEmpty()) {
return staticText;
}
return (optional ? "you may " : "") + getCostText() + ". If you do, " + executingEffects.getText(mode)
return (optional ? "you may " : "")
+ CardUtil.addCostVerb(cost.getText())
+ ". If you do, "
+ executingEffects.getText(mode)
+ (!otherwiseEffects.isEmpty() ? " If you don't, " + otherwiseEffects.getText(mode) : "");
}
protected String getCostText() {
StringBuilder sb = new StringBuilder();
String costText = cost.getText();
if (!CardUtil.checkCostWords(costText)) {
sb.append("pay ");
}
return sb.append(costText).toString();
}
@Override
public void setValue(String key, Object value) {
super.setValue(key, value);