mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 00:52:40 +00:00
Adv 2.0 D&D layer: Phases 1-8 + Phase 9 SP1+SP2
Combines all uncommitted D&D work into one checkpoint: Phases 1-8 (per gogobee_dnd_session_summary.md): - Race/class/stats system, !setup flow, !sheet, !respec - d20-vs-AC combat with race/class passives, auto-migration - XP/level-up, skill checks, NPC refund hooks - Equipment slot mapping, rarity, !rest short/long - Pre-arm active abilities, resource pools - Bestiary, !roll/!stats/!level, onboarding DM - Audit fixes A-I, flavor wiring under internal/flavor/ - Phase 8 weapon dice + armor AC tables (gogobee_equipment_appendix) Phase 9 SP1 — spell system foundations: - 79 SpellDefinitions (76 in-scope + 3 reaction-deferred) - dnd_known_spells, dnd_spell_slots tables - pending_cast / concentration_* columns on dnd_character - Slot tables for Mage/Cleric/Ranger, DC + attack-bonus math - Long-rest refreshes slots; respec wipes spell state - Auto-grant default known list on !setup confirm and auto-migration Phase 9 SP2 — !cast / !spells / !prepare commands: - Out-of-combat HEAL and UTILITY resolve immediately - Damage/control/buff queue as pending_cast for next combat - Audit-style save-then-debit, slot refund on save failure - !cast --drop, concentration supersession, prep-cap enforcement - Reaction spells refused with Phase 11 note SP3 (combat-time resolution of pending_cast) and SP4 (full prep/learn tests) are next. Build clean, full test suite green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"gogobee/internal/db"
|
||||
"gogobee/internal/flavor"
|
||||
|
||||
"maunium.net/go/mautrix/id"
|
||||
)
|
||||
@@ -134,12 +135,15 @@ func (p *AdventurePlugin) npcFireEncounter(userID id.UserID, npc string) {
|
||||
case "misty":
|
||||
char.MistyLastSeen = &now
|
||||
char.MistyEncounterCount++
|
||||
opening = mistyOpenings[rand.IntN(len(mistyOpenings))]
|
||||
// Pool union: legacy mistyOpenings + D&D MistyGreeting flavor.
|
||||
mistyPool := dndMistyGreetingPool()
|
||||
opening = mistyPool[rand.IntN(len(mistyPool))]
|
||||
prompt = fmt.Sprintf("👤 A woman approaches you.\n\n_%s_\n\n"+
|
||||
"Reply `yes` to give €%d, or `no` to walk away.", opening, mistyCost)
|
||||
case "arina":
|
||||
char.ArinaLastSeen = &now
|
||||
opening = arinaOpenings[rand.IntN(len(arinaOpenings))]
|
||||
arinaPool := dndArinaGreetingPool()
|
||||
opening = arinaPool[rand.IntN(len(arinaPool))]
|
||||
prompt = fmt.Sprintf("💎 A woman in expensive clothing stops you.\n\n_%s_\n\n"+
|
||||
"Reply `yes` to pay €%d, or `no` to decline.", opening, arinaCost)
|
||||
}
|
||||
@@ -223,6 +227,9 @@ func (p *AdventurePlugin) resolveMisty(ctx MessageContext, char *AdventureCharac
|
||||
}
|
||||
return p.SendDM(ctx.Sender, "You reach for your gold but there isn't enough. She sees this. She doesn't say anything.\n\n_"+mistyDeclineLine+"_")
|
||||
}
|
||||
// D&D Insight check — passing refunds the donation. Renders flavor on
|
||||
// either outcome (success or fail) when a check was attempted.
|
||||
insightCheck := dndNPCInsightRefund(ctx.Sender, p.euro, mistyCost)
|
||||
char.MistyBuffExpires = expires
|
||||
char.MistyDonatedCount++
|
||||
|
||||
@@ -241,6 +248,20 @@ func (p *AdventurePlugin) resolveMisty(ctx MessageContext, char *AdventureCharac
|
||||
reply += "\n\n_" + hint + "_"
|
||||
}
|
||||
|
||||
// Flavor for the D&D check outcome (when applicable).
|
||||
if insightCheck.Attempted {
|
||||
if insightCheck.Succeeded {
|
||||
if line := flavor.Pick(flavor.MistyInsightSuccess); line != "" {
|
||||
reply += "\n\n_" + line + "_"
|
||||
}
|
||||
reply += "\n\n_(Insight DC 12 passed — donation refunded.)_"
|
||||
} else {
|
||||
if line := flavor.Pick(flavor.MistySkillFail); line != "" {
|
||||
reply += "\n\n_" + line + "_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return p.SendDM(ctx.Sender, fmt.Sprintf("_%s_", reply))
|
||||
}
|
||||
|
||||
@@ -264,13 +285,28 @@ func (p *AdventurePlugin) resolveArina(ctx MessageContext, char *AdventureCharac
|
||||
reply := arinaDeclineLines[rand.IntN(len(arinaDeclineLines))]
|
||||
return p.SendDM(ctx.Sender, fmt.Sprintf("You can't afford it. She noticed before you did.\n\n_%s_", reply))
|
||||
}
|
||||
// D&D Arcana check — flavor for either outcome when a check was attempted.
|
||||
arcanaCheck := dndNPCArcanaRefund(ctx.Sender, p.euro, arinaCost)
|
||||
char.ArinaBuffExpires = expires
|
||||
if err := saveAdvCharacter(char); err != nil {
|
||||
slog.Error("npc: failed to save arina buff", "user", ctx.Sender, "err", err)
|
||||
}
|
||||
extra := ""
|
||||
if arcanaCheck.Attempted {
|
||||
if arcanaCheck.Succeeded {
|
||||
if line := flavor.Pick(flavor.ArinaArcanaSuccess); line != "" {
|
||||
extra = "\n\n_" + line + "_"
|
||||
}
|
||||
extra += "\n\n_(Arcana DC 14 passed — investment refunded.)_"
|
||||
} else {
|
||||
if line := flavor.Pick(flavor.ArinaSkillFail); line != "" {
|
||||
extra = "\n\n_" + line + "_"
|
||||
}
|
||||
}
|
||||
}
|
||||
return p.SendDM(ctx.Sender, fmt.Sprintf(
|
||||
"_She snatches the money from you, almost rudely, then looks at you expectantly._\n\n\"%s\"\n\n_She walks away just as quickly as she came._",
|
||||
arinaAcceptLine))
|
||||
"_She snatches the money from you, almost rudely, then looks at you expectantly._\n\n\"%s\"\n\n_She walks away just as quickly as she came._%s",
|
||||
arinaAcceptLine, extra))
|
||||
}
|
||||
|
||||
// Declined — no mechanical effect, just insults
|
||||
|
||||
Reference in New Issue
Block a user