feat(game): skill XP on task completion + power bands in duration (#45)
CI / build + unit + e2e (pull_request) Successful in 2m48s

This commit is contained in:
2026-10-04 02:34:56 +00:00
parent 5bc411cb76
commit f3751b4747
13 changed files with 209 additions and 26 deletions
+4 -2
View File
@@ -1,6 +1,7 @@
import { getGameDb } from '@/lib/db/client'
import * as schema from '@/lib/db/schema'
import { parseCrewTeam } from '@/app/api/crew-team'
import { checkJumpTarget, getWorldState, JumpError, queueStateFromSave, saveTaskRow } from '@/lib/game/save'
import { checkJumpTarget, getWorldState, JumpError, makePowerOfFor, queueStateFromSave, saveTaskRow } from '@/lib/game/save'
import { queueTask, TaskError } from '@/lib/game/tasks'
// Jump to a system within range: assign the crew team (lead + helpers) and queue the JUMP
@@ -28,7 +29,8 @@ export async function POST(req: Request) {
const db = await getGameDb()
const hops = await checkJumpTarget(db, systemId) // existing pre-checks: 404 unknown · 409 already there / out of range
const state = await queueStateFromSave(db)
const { task } = queueTask(state, { type: 'JUMP', payload: { systemId, hops }, leadCrewId: team.leadCrewId, helperCrewIds: team.helperCrewIds })
const [save] = await db.db.select().from(schema.saves).limit(1)
const { task } = queueTask(state, { type: 'JUMP', payload: { systemId, hops }, leadCrewId: team.leadCrewId, helperCrewIds: team.helperCrewIds }, await makePowerOfFor(db, save, 'JUMP'))
await saveTaskRow(db, task) // inventory is unchanged for a JUMP — no hold write
return Response.json(await getWorldState(db))
} catch (err) {