mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
UX S4: magic-item polish — slot fixes, swap-back, shop & sheet truth-up
B4: Slot classifier no longer treats "Springing" / "Snaring" / "Devouring"
as ring matches; tokenises by word boundary instead of raw substring.
Adds DnDSlotCloak so cloaks/capes/mantles/wings stop evicting body armor
from the chest slot. Regenerated magic_items_srd_data.go: boots_of_*,
gloves_of_missile_snaring, bag_of_devouring, talismans, and 6 cloaks all
land in the right slot.
R4: equipMagicItem swap-back returns the prior occupant at full Value
instead of half — swapping a curio shouldn't tax it.
R5: Attunement count is recomputed *after* the swap-back so freeing the
prior occupant's bond opens the slot for the incoming item.
R1: Inventory tags magic_item rows with 🔮 + rarity label and prints a
single equip-magic footer when any are present.
R6: Sheet's Magic Items block marks unbonded items as **(inactive)**
with the reason (cap full vs unbonded), so over-cap items aren't silent.
R7: New activeMagicItemsLine surfaces a one-shot "your curios stir: …"
at combat-start in both the dungeon path and !fight, mirroring the way
class passives are surfaced.
R8/R9: dropMagicItemLoot pretty-prints rarity, drops "wondrous", calls
attunement "needs bonding", appends "auto-uses in combat" for
potions/scrolls, and routes persistence errors to slog instead of
leaking %v into chat.
R2/R3: Curios shelf now shows "Very Rare" not "very_rare", drops the
bare "wondrous" word (the effect line carries it), renders the codified
magicItemEffectSummary above the SRD desc, and ends with a one-line
plain-language "what is bonding" footnote.
R10: Curios stock day flips at 06:00 UTC instead of midnight so EU
players don't see a fresh shelf at 1 a.m. mid-session.
R11: Curios buy resolver disambiguates fuzzy matches — typing "ring"
when several rings are on the shelf lists candidates instead of
silently selling the first.
P1: Greeting grid pairs Curios with an Exit chip so the 2-column
emoji layout doesn't dangle.
P2: Equip-magic empty state trimmed to one line.
P4 (back-from-curios reprompt) deferred — the existing back-flow is
correct, just verbose; not worth the surface-area expansion this
session.
Tests: word-boundary classifier, cloak/chest coexistence, full-value
swap-back. go test ./... + go vet clean.
This commit is contained in:
@@ -223,7 +223,14 @@ func inferSlot(kind, name string) string {
|
||||
return ""
|
||||
}
|
||||
// Wondrous item: sniff the name for a wearable noun.
|
||||
//
|
||||
// Match on word *prefix*, not raw substring — naive Contains() lights up
|
||||
// "ring" inside "Springing" / "Snaring" / "Devouring" and dumps boots,
|
||||
// gloves, and bags into the ring slot.
|
||||
low := strings.ToLower(name)
|
||||
tokens := strings.FieldsFunc(low, func(r rune) bool {
|
||||
return !(r >= 'a' && r <= 'z')
|
||||
})
|
||||
for _, m := range []struct {
|
||||
kw string
|
||||
slot string
|
||||
@@ -231,20 +238,26 @@ func inferSlot(kind, name string) string {
|
||||
{"amulet", "DnDSlotAmulet"}, {"necklace", "DnDSlotAmulet"},
|
||||
{"medallion", "DnDSlotAmulet"}, {"periapt", "DnDSlotAmulet"},
|
||||
{"brooch", "DnDSlotAmulet"}, {"pendant", "DnDSlotAmulet"},
|
||||
{"talisman", "DnDSlotAmulet"}, {"scarab", "DnDSlotAmulet"},
|
||||
{"ring", "DnDSlotRing1"},
|
||||
{"cloak", "DnDSlotChest"}, {"cape", "DnDSlotChest"},
|
||||
{"mantle", "DnDSlotChest"}, {"robe", "DnDSlotChest"},
|
||||
{"armor", "DnDSlotChest"}, {"vestments", "DnDSlotChest"},
|
||||
// Cloaks/capes/mantles get their own slot so they don't evict body
|
||||
// armor. Robes/vestments are body armor and stay on Chest.
|
||||
{"cloak", "DnDSlotCloak"}, {"cape", "DnDSlotCloak"},
|
||||
{"mantle", "DnDSlotCloak"}, {"wings", "DnDSlotCloak"},
|
||||
{"robe", "DnDSlotChest"}, {"vestments", "DnDSlotChest"},
|
||||
{"armor", "DnDSlotChest"},
|
||||
{"boots", "DnDSlotFeet"}, {"slippers", "DnDSlotFeet"},
|
||||
{"gauntlet", "DnDSlotHands"}, {"gloves", "DnDSlotHands"},
|
||||
{"bracers", "DnDSlotHands"},
|
||||
{"gauntlet", "DnDSlotHands"}, {"gauntlets", "DnDSlotHands"},
|
||||
{"gloves", "DnDSlotHands"}, {"bracers", "DnDSlotHands"},
|
||||
{"helm", "DnDSlotHead"}, {"hat", "DnDSlotHead"},
|
||||
{"crown", "DnDSlotHead"}, {"circlet", "DnDSlotHead"},
|
||||
{"goggles", "DnDSlotHead"}, {"eyes", "DnDSlotHead"},
|
||||
{"headband", "DnDSlotHead"},
|
||||
} {
|
||||
if strings.Contains(low, m.kw) {
|
||||
return m.slot
|
||||
for _, t := range tokens {
|
||||
if strings.HasPrefix(t, m.kw) {
|
||||
return m.slot
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user