fix(game): grantXp event fires only on level transition, not while at-band (#45)
CI / build + unit + e2e (pull_request) Successful in 3m8s
CI / build + unit + e2e (pull_request) Successful in 3m8s
This commit is contained in:
+2
-1
@@ -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}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user