Include target details in intro goal message

This commit is contained in:
Daddy32
2025-12-14 14:55:53 +01:00
parent f6d35f47cf
commit 22aec33fcb

View File

@@ -1022,6 +1022,7 @@
progress: duration > 0 ? (100 * elapsed) / duration : 0,
met: remainingMs <= 0,
hint: "Survive until the timer ends",
summary: `Survive for ${duration} seconds`,
};
}
if (winCond.type === "clearCount") {
@@ -1032,6 +1033,7 @@
progress: target > 0 ? (100 * clearedCount) / target : 0,
met: clearedCount >= target,
hint: "Clear the required balls",
summary: `Clear ${target} balls`,
};
}
if (winCond.type === "score") {
@@ -1042,6 +1044,7 @@
progress: target > 0 ? (100 * score) / target : 0,
met: score >= target,
hint: "Reach the score target",
summary: `Score ${target} points`,
};
}
if (winCond.type === "colorClear" && Array.isArray(winCond.targets)) {
@@ -1070,6 +1073,9 @@
),
colors: targets.map((t) => t.color),
hint: "Clear the target colors",
summary: `Clear target colors: ${targets
.map((t) => `${t.count}x ${t.color || ""}`.trim())
.join(", ")}`,
};
}
return null;
@@ -1077,7 +1083,7 @@
const formatGoalMessage = (goal, { includeProgress = true } = {}) => {
if (!goal) return null;
const title = goal.hint || goal.label || "Goal";
const title = goal.summary || goal.hint || goal.label || "Goal";
const pieces = [`Goal: ${title}`];
if (includeProgress && Number.isFinite(goal.progress)) {
const pct = Math.max(0, Math.min(100, Math.round(goal.progress)));