The HTGG is a UX issue of not putting a good default in. Added default parameter to ChooseANumber and updated both HTGG to use it. Also added message to end of form popup reminding people they don't have to double-fill the replay

This commit is contained in:
Christian 'ketura' McCarty
2024-12-08 12:45:18 -06:00
parent 75860d2821
commit 3ef64779dd
4 changed files with 7 additions and 3 deletions

View File

@@ -308,6 +308,7 @@
text: Choose how many times to heal {healingAlly}
from: 0
to: 2
default: 2
memorize: healing
}
{

View File

@@ -149,6 +149,7 @@
}
secondNumber: 2
}
default: 2
memorize: heals
}
{

View File

@@ -17,13 +17,14 @@ import org.json.simple.JSONObject;
public class ChooseANumber implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "player", "text", "from", "to", "memorize");
FieldUtils.validateAllowedFields(effectObject, "player", "text", "from", "to", "default", "memorize");
final String player = FieldUtils.getString(effectObject.get("player"), "player", "you");
final String displayText = FieldUtils.getString(effectObject.get("text"), "text", "Choose a number");
final ValueSource fromSource = ValueResolver.resolveEvaluator(effectObject.get("from"), 0, environment);
Object to = effectObject.get("to");
final ValueSource toSource = to != null ? ValueResolver.resolveEvaluator(to, environment) : null;
final ValueSource defaultSource = ValueResolver.resolveEvaluator(effectObject.get("default"), 0, environment);
final String memorize = FieldUtils.getString(effectObject.get("memorize"), "memorize");
@@ -37,9 +38,10 @@ public class ChooseANumber implements EffectAppenderProducer {
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
int min = fromSource.getEvaluator(actionContext).evaluateExpression(actionContext.getGame(), null);
Integer max = toSource != null ? toSource.getEvaluator(actionContext).evaluateExpression(actionContext.getGame(), null) : null;
int defaultAmount = defaultSource.getEvaluator(actionContext).evaluateExpression(actionContext.getGame(), null);
return new PlayoutDecisionEffect(playerSource.getPlayer(actionContext),
new IntegerAwaitingDecision(1, GameUtils.substituteText(displayText, actionContext),
min, max) {
min, max, defaultAmount) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
actionContext.setValueToMemory(memorize, String.valueOf(getValidatedResult(result)));

View File

@@ -105,7 +105,7 @@ public class GameRecorder {
String winnerURL = "https://play.lotrtcgpc.net/gemp-lotr/game.html%3FreplayId%3D" + winnerName + "$" + playerRecordingId.get(winnerName);
String loserURL = "https://play.lotrtcgpc.net/gemp-lotr/game.html%3FreplayId%3D" + loserName + "$" + playerRecordingId.get(loserName);
url += winnerURL + "%20" + loserURL;
lotroGame.sendMessageToPlayers("Thank you for playing! If you have any feedback, bugs, or other issues to report about this match, <a href= '" + url + "'>please do so using this form.</a>");
lotroGame.sendMessageToPlayers("Thank you for playing! If you have any feedback, bugs, or other issues to report about this match, <a href= '" + url + "'>please do so using this form.<br><br>If you use this link, it will fill in the replay for you automatically.</a>");
// }
};