fix(game): grantXp event fires only on level transition, not while at-band (#45)
CI / build + unit + e2e (pull_request) Successful in 3m8s

This commit is contained in:
2026-10-04 02:50:47 +00:00
parent f3751b4747
commit 9d1a8e9d89
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -45,8 +45,9 @@ export function grantXp(
for (const crewId of crewIds) {
const member = members[crewId]
if (!member) continue
const oldLevel = skillRows.find((r) => r.crewId === crewId && r.skill === skill)?.level ?? 0
const newLevel = rows.find((r) => r.crewId === crewId && r.skill === skill)?.level ?? 0
if (newLevel === 3 || newLevel === 5) {
if (newLevel > oldLevel && (newLevel === 3 || newLevel === 5)) {
const title = titleFor(member, rows.filter((r) => r.crewId === crewId))
if (title) events.push(`${member.name} is now a ${title} — ${skill} L${newLevel}`)
}