Adv 2.0 D&D Phase R R2: Harvest nodes & per-room registry

Per-zone resource registry (§3, all 10 zones) and full per-room harvest
layer wired into expeditions: !forage / !mine / !scavenge / !essence /
!commune / !resources. Auto-spawns a DungeonRun per region on
!expedition start, swaps it on !region travel, retires on
abandon/extract. Long rest at camp replenishes nodes across every
room and region. Reuses existing flavor.Harvest* / RichYield /
NodeDepleted / per-zone Harvest<Zone> pools.

Also clears two pre-existing test failures introduced by the E6c
flavor expansion (briefing substring list + combat-lift trial count).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-08 17:34:49 -07:00
parent cb51c56f00
commit 83cdf07374
13 changed files with 1314 additions and 6 deletions

View File

@@ -63,6 +63,7 @@ func voluntaryExtractExpedition(userID id.UserID) (*Expedition, error) {
}
e.CurrentDay++
e.Status = ExpeditionStatusExtracting
_ = retireAllRegionRuns(e)
return e, nil
}
@@ -87,6 +88,7 @@ func forcedExtractExpedition(expID, reason string) (*Expedition, int, error) {
return nil, 0, fmt.Errorf("forced extract: %w", err)
}
e.Status = ExpeditionStatusAbandoned
_ = retireAllRegionRuns(e)
return e, tax, nil
}
@@ -223,6 +225,18 @@ func (p *AdventurePlugin) handleResumeCmd(ctx MessageContext, args string) error
p.euro.Credit(ctx.Sender, cost, "expedition resume refund")
return p.SendDM(ctx.Sender, "Couldn't resume: "+err.Error())
}
exp.Status = ExpeditionStatusActive
exp.Supplies = supplies
// Spawn a fresh DungeonRun for the resumed region; the prior run was
// abandoned at extract time. Per-room harvest state in RegionState is
// preserved as-is so progression isn't reset.
exp.RunID = ""
exp.RegionState[regionStateRegionRuns] = map[string]string{}
_ = persistRegionState(exp)
if _, err := ensureRegionRun(exp, c.Level); err != nil {
p.euro.Credit(ctx.Sender, cost, "expedition resume refund (run-spawn failed)")
return p.SendDM(ctx.Sender, "Couldn't outfit the resumed region: "+err.Error())
}
line := flavor.Pick(flavor.ExpeditionResume)
_ = appendExpeditionLog(exp.ID, exp.CurrentDay, "narrative",
"expedition resumed", line)