Incorporating PR #121 from Phallen Cassidy: when neither branch of a choice can be fulfilled, resorts to having the player choose which to perform rather than performing neither.

This commit is contained in:
Christian 'ketura' McCarty
2024-11-16 21:24:00 -06:00
parent 126c282172
commit d5bc1492b9

View File

@@ -53,11 +53,6 @@ public class Choice implements EffectAppenderProducer {
textIndex++;
}
if (playableEffectAppenders.size() == 0) {
actionContext.setValueToMemory(memorize, "");
return null;
}
if (playableEffectAppenders.size() == 1) {
SubAction subAction = new SubAction(action);
playableEffectAppenders.get(0).appendEffect(cost, subAction, delegateActionContext);
@@ -65,6 +60,16 @@ public class Choice implements EffectAppenderProducer {
return new StackActionEffect(subAction);
}
if (playableEffectAppenders.isEmpty()) {
actionContext.setValueToMemory(memorize, "");
textIndex = 0;
for (EffectAppender possibleEffectAppender : possibleEffectAppenders) {
playableEffectAppenders.add(possibleEffectAppender);
effectTexts.add(GameUtils.substituteText(textArray[textIndex], actionContext));
textIndex++;
}
}
SubAction subAction = new SubAction(action);
subAction.appendCost(
new PlayoutDecisionEffect(choosingPlayer,