Expedition-aware continue hints; boss win reads as expedition complete

On an expedition the autopilot drives the walk, so the manual Elite/Boss
fight close-outs and per-room next-room lines pointed players at the wrong
surface (`!zone advance` instead of `!expedition run`). Route every
"keep moving" prompt through continueHint(), which picks the verb by mode.
Special-case the boss victory to read as the expedition win.

(cherry picked from commit 30b51b91445f3bb9680cd252df6c761e3ce61d0a)
This commit is contained in:
prosolis
2026-05-19 22:27:20 -07:00
parent 5d7c76fb20
commit 28a90292f0
3 changed files with 35 additions and 6 deletions

View File

@@ -52,7 +52,7 @@ func (p *AdventurePlugin) handleFightCmd(ctx MessageContext) error {
case CombatStatusActive: case CombatStatusActive:
return p.SendDM(ctx.Sender, "You're already in this fight — `!attack` or `!flee`.") return p.SendDM(ctx.Sender, "You're already in this fight — `!attack` or `!flee`.")
case CombatStatusWon: case CombatStatusWon:
return p.SendDM(ctx.Sender, "You've already cleared this room. `!zone advance` to move on.") return p.SendDM(ctx.Sender, "You've already cleared this room. "+continueHint(ctx.Sender))
default: default:
return p.SendDM(ctx.Sender, "This fight is already over. `!zone status` for where you stand.") return p.SendDM(ctx.Sender, "This fight is already over. `!zone status` for where you stand.")
} }
@@ -204,6 +204,18 @@ func combatTurnPrompt(sess *CombatSession) string {
// ── close-out ─────────────────────────────────────────────────────────────── // ── close-out ───────────────────────────────────────────────────────────────
// continueHint returns the verb the player uses to keep moving after a
// manual Elite/Boss fight, phrased for their current mode. On an
// expedition the autopilot drives the walk, so `!zone advance` is the
// wrong surface — point them at `!expedition run` instead. Standalone
// zone runs still advance with `!zone advance`.
func continueHint(userID id.UserID) string {
if exp, err := getActiveExpedition(userID); err == nil && exp != nil {
return "`!expedition run` to keep going."
}
return "`!zone advance` to move on."
}
// finishCombatSession runs the post-fight side effects once a CombatSession // finishCombatSession runs the post-fight side effects once a CombatSession
// has reached a terminal status, and returns the player-facing outcome block. // has reached a terminal status, and returns the player-facing outcome block.
// The graph is NOT advanced here: the terminal session row is the record that // The graph is NOT advanced here: the terminal session row is the record that
@@ -241,11 +253,13 @@ func (p *AdventurePlugin) finishCombatSession(userID id.UserID, sess *CombatSess
slog.Error("combat: grantDnDXP turn-based", "user", userID, "err", err) slog.Error("combat: grantDnDXP turn-based", "user", userID, "err", err)
} }
} }
bossOnExpedition := false
if !elite { if !elite {
// §8.1 — zone boss defeat drops expedition threat. Silent no-op // §8.1 — zone boss defeat drops expedition threat. Silent no-op
// for standalone zone runs (no active expedition). // for standalone zone runs (no active expedition).
if exp, eerr := getActiveExpedition(userID); eerr == nil && exp != nil { if exp, eerr := getActiveExpedition(userID); eerr == nil && exp != nil {
_ = applyBossDefeatThreat(exp.ID) _ = applyBossDefeatThreat(exp.ID)
bossOnExpedition = true
} }
} }
if line := twinBeeLine(zone.ID, DMCombatEnd, sess.RunID, cadence); line != "" { if line := twinBeeLine(zone.ID, DMCombatEnd, sess.RunID, cadence); line != "" {
@@ -260,7 +274,15 @@ func (p *AdventurePlugin) finishCombatSession(userID id.UserID, sess *CombatSess
if drop := p.dropZoneLoot(userID, zone.ID, monster, !elite); drop != "" { if drop := p.dropZoneLoot(userID, zone.ID, monster, !elite); drop != "" {
b.WriteString(drop + "\n") b.WriteString(drop + "\n")
} }
b.WriteString("`!zone advance` to move on.") if bossOnExpedition {
// The boss is the expedition's climax. Frame the close-out as
// the win rather than a "keep walking" nudge. One more
// `!expedition run` walks out the cleared room and triggers
// finalizeExpeditionOnZoneClear (rewards + status flip).
b.WriteString("🎉 **Zone cleared — the expedition is won.** `!expedition run` to march out and claim your spoils.")
} else {
b.WriteString(continueHint(userID))
}
case CombatStatusLost: case CombatStatusLost:
if run != nil { if run != nil {

View File

@@ -753,7 +753,7 @@ func (p *AdventurePlugin) formatNextRoomMessage(run *DungeonRun, zone ZoneDefini
case RoomElite: case RoomElite:
b.WriteString("`!fight` when ready.") b.WriteString("`!fight` when ready.")
default: default:
b.WriteString("`!zone advance` to continue.") b.WriteString(continueHint(id.UserID(run.UserID)))
} }
return b.String() return b.String()
} }

View File

@@ -169,7 +169,7 @@ func (p *AdventurePlugin) zoneCmdGo(ctx MessageContext, rest string) error {
return p.SendDM(ctx.Sender, "Couldn't decode pending fork: "+derr.Error()) return p.SendDM(ctx.Sender, "Couldn't decode pending fork: "+derr.Error())
} }
if pf == nil { if pf == nil {
return p.SendDM(ctx.Sender, "No fork pending. Use `!zone advance` to continue.") return p.SendDM(ctx.Sender, "No fork pending. Use "+continueHint(ctx.Sender))
} }
rest = strings.TrimSpace(rest) rest = strings.TrimSpace(rest)
if rest == "" { if rest == "" {
@@ -207,7 +207,14 @@ func (p *AdventurePlugin) zoneCmdGo(ctx MessageContext, rest string) error {
b.WriteString("\n\n") b.WriteString("\n\n")
} }
} }
b.WriteString(fmt.Sprintf("**Room %d/%d — %s.** `!zone advance` to continue.", b.WriteString(fmt.Sprintf("**Room %d/%d — %s.** ", nextIdx+1, run.TotalRooms, prettyRoomType(nextRoom)))
nextIdx+1, run.TotalRooms, prettyRoomType(nextRoom))) switch nextRoom {
case RoomBoss:
b.WriteString("`!fight` when you're ready for the boss.")
case RoomElite:
b.WriteString("`!fight` when ready.")
default:
b.WriteString(continueHint(ctx.Sender))
}
return p.SendDM(ctx.Sender, b.String()) return p.SendDM(ctx.Sender, b.String())
} }