From e632997468a91290be6d225f867a5236dbd59535 Mon Sep 17 00:00:00 2001 From: Michal Przybylowicz Date: Sat, 7 Nov 2026 18:37:46 +0100 Subject: [PATCH] Review and refit items to the priest and village theme --- README.md | 2 +- documentation/README.md | 1 + .../plans/systems/command-scope-reduction.md | 7 +- documentation/reference/item-review.md | 62 +++++++++++ internal/game/armor.go | 6 +- internal/game/combat.go | 14 +-- internal/game/game_test.go | 15 +-- internal/game/item_theme.go | 101 ++++++++++++++++++ internal/game/item_theme_test.go | 53 +++++++++ internal/game/palette_roles.go | 10 +- internal/game/player_experience_test.go | 7 +- internal/game/save.go | 8 +- internal/game/scope.go | 37 ++++--- internal/game/woods_items.go | 2 +- 14 files changed, 269 insertions(+), 56 deletions(-) create mode 100644 documentation/reference/item-review.md create mode 100644 internal/game/item_theme.go create mode 100644 internal/game/item_theme_test.go diff --git a/README.md b/README.md index ba532a4..4a5f446 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ grants a second Rite is not implemented yet. * turn/energy based critters with faction-aware cardinal A* pathfinding, zombie, observer and animal AI * melee combat with recovered weapon AV/DV and damage values -* throwing is deferred; HE grenade and molotov data are retained for a future pass +* throwing is deferred; thematic holy, fire, incense and alchemical flask data is retained for a future pass * recovered weapon table (attack/defense value and damage range per subtype) * one priest character with a randomly generated name and starting Rite * HP and AP: equipped robe shards provide a depletable armour-point pool diff --git a/documentation/README.md b/documentation/README.md index afe47db..1007ea0 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -9,6 +9,7 @@ build file lives here. - [Project README](../README.md) — build, controls and current gameplay features - [Feature plans](plans/README.md) — roadmap and links to all planned work - [Reverse-engineering reference](reference/reverse-engineering.md) — how the original binary was analysed and what was recovered +- [Item theme review](reference/item-review.md) — which recovered items are kept, renamed or removed from normal play ## Current focus diff --git a/documentation/plans/systems/command-scope-reduction.md b/documentation/plans/systems/command-scope-reduction.md index e40d032..def0e2f 100644 --- a/documentation/plans/systems/command-scope-reduction.md +++ b/documentation/plans/systems/command-scope-reduction.md @@ -1,11 +1,12 @@ # Command & Scope Reduction — Melee-Focused Redesign -Status: **in progress** +Status: **done** Parent: [Feature plans](../README.md) Scope: global player command set and combat systems; first validated in the woods -Implementation status: first pass implemented on branch -`feature/command-scope-reduction`; pending review and merge. +Implementation status: first pass implemented and merged. Item names have since +been refitted by the [item theme review](../../reference/item-review.md): the HE +grenade and molotov data now appear as holy water and holy fire flasks. This document proposes cutting the command surface down to what fits a zombie-slashing, melee-focused roguelike. The goal is not to remove depth — it diff --git a/documentation/reference/item-review.md b/documentation/reference/item-review.md new file mode 100644 index 0000000..a951d1f --- /dev/null +++ b/documentation/reference/item-review.md @@ -0,0 +1,62 @@ +# Item Theme Review + +Status: **done** +Parent: [Documentation index](../README.md) +Related: [Reverse-engineering reference](reverse-engineering.md), [Priest player revamp](../plans/systems/priest-player-revamp.md) + +The recovered item table contains modern military and science-fiction +prototypes. Recovered IDs are kept stable for data and save references, but +only thematic items may appear in normal play. + +## Theme rules + +- Village, woodland, medieval, priest, holy and horror items are allowed. +- Guns, ammunition, clips, energy weapons and old body armour are removed from + normal play. +- Modern grenades are refitted as priest flasks. +- Raw removed prototypes remain in `ItemDefs` for historical reference but fail + `ItemAvailable`. + +## Renamed and refitted items + +| Old recovered name | Current name | Role | +|---|---|---| +| jacket | padded jerkin | legacy armour data | +| flak armor | reinforced hide coat | legacy armour data | +| power jacket | penitent's mail | legacy armour data | +| plasteel stick | iron-shod staff | melee | +| chainsaw | relic chainblade | melee relic | +| power sword | silvered longsword | melee | +| meta dagger | consecrated dagger | melee | +| vibra knife | blessed knife | melee | +| multiaxe | penitent's axe | melee | +| shock mace | censer mace | melee | +| battle hammer | war hammer | melee | +| he grenade | holy water flask | throwable flask | +| incendiary grenade | holy fire flask | throwable flask | +| acid grenade | alchemical acid flask | throwable flask | +| smoke grenade | incense flask | throwable flask | +| flashbang grenade | radiant flask | throwable flask | +| first aid kit | healer's kit | healing | +| medkit | surgeon's kit | healing | + +## Removed from normal play + +- all recovered ranged weapons and energy weapons +- all ammunition and clips +- body armour and old armour pieces +- mobile-phone-era military equipment that has no thematic replacement + +The priest uses the permanent robe and attachable shards instead of body armour. +The first-playable item families are woodland food/tools/weapons, priest +vials/shards/relics, holy flasks and ordinary medical supplies. + +## Validation + +`internal/game/item_theme_test.go` checks that: + +- old out-of-theme names are gone from the active item set +- renamed thematic replacements exist +- available items do not contain banned terms such as grenade, gun, ammo, clip, + plasma, laser, flak, plasteel or flashbang +- ranged weapons, ammunition and old body armour are unavailable diff --git a/internal/game/armor.go b/internal/game/armor.go index 070a353..4bb6c7f 100644 --- a/internal/game/armor.go +++ b/internal/game/armor.go @@ -12,11 +12,11 @@ func ArmorStatsFor(d *ItemDef) (ArmorStats, bool) { return ArmorStats{}, false } switch d.Name { - case "jacket": + case "jacket", "padded jerkin": return ArmorStats{MaxAP: 20, Absorb: 50, DV: -1}, true - case "flak armor": + case "flak armor", "reinforced hide coat": return ArmorStats{MaxAP: 35, Absorb: 60, DV: -2}, true - case "power jacket": + case "power jacket", "penitent's mail": return ArmorStats{MaxAP: 50, Absorb: 70, DV: -3}, true case "leather jacket": return ArmorStats{MaxAP: 25, Absorb: 55, DV: -1}, true diff --git a/internal/game/combat.go b/internal/game/combat.go index a247121..510bd12 100644 --- a/internal/game/combat.go +++ b/internal/game/combat.go @@ -368,9 +368,9 @@ func (g *Game) CreateRemains(c *Critter) { g.PlaceGroundItemNear(&Item{Proto: proto, X: -1, Y: -1}, c.X, c.Y) } if g.Chance(15) { - proto := 41 // HE grenade + proto := 41 // holy water flask if g.Roll(2) == 0 { - proto = 42 // molotov cocktail + proto = 42 // holy fire flask } g.PlaceGroundItemNear(&Item{Proto: proto, X: -1, Y: -1}, c.X, c.Y) } @@ -416,8 +416,8 @@ func (g *Game) CheckLevelUp() { } } -// Explode damages everything in a radius. kind 1 leaves fire behind -// (molotov); kind 0 is a plain high-explosive blast. +// Explode damages everything in a radius. kind 1 leaves fire behind +// (holy fire flask); kind 0 is a direct holy/alchemical burst. func (g *Game) Explode(x, y, radius, damage, kind int) { if radius < 1 { radius = 1 @@ -463,8 +463,8 @@ func (g *Game) hasThrowable() bool { return false } -// ThrowGrenade throws the selected HE grenade or molotov at a visible tile -// within the player's current FOV radius. +// ThrowGrenade throws the selected thematic flask at a visible tile within +// the player's current FOV radius. func (g *Game) ThrowGrenade(x, y int) { it := g.Player.ThrowableItem() if it == nil || !ItemIsThrowable(it.Proto) { @@ -520,7 +520,7 @@ func (g *Game) ThrowGrenade(x, y int) { dmg = g.RollRange(wd.DmgMin, wd.DmgMax) } kind := 0 - if d.Name == "molotov cocktail" { + if d.Name == "holy fire flask" { kind = 1 } g.Explode(lx, ly, blastRadius, dmg+g.Player.Skill(SkillThrowing)/4, kind) diff --git a/internal/game/game_test.go b/internal/game/game_test.go index ddde061..91e77c1 100644 --- a/internal/game/game_test.go +++ b/internal/game/game_test.go @@ -347,23 +347,16 @@ func TestPlayerSlotSaveRoundtrip(t *testing.T) { } } -func TestPlayerSlotMigration(t *testing.T) { +func TestPlayerSlotMigrationDropsOldBodyArmour(t *testing.T) { sc := saveCritter{Player: true, Equip: []saveItem{ {Proto: 16}, {Proto: 5}, {Proto: 41}, {Proto: 46}, }, Inv: []saveItem{{Proto: 47, Charges: 1}}} - c, removed := critterFromSave(sc, 2) - if removed != 0 { - t.Fatalf("unexpected removals: %d", removed) - } + c, _ := critterFromSave(sc, 2) if c.Slots.Hands == nil || c.Slots.Hands.Proto != 16 { t.Fatal("hands migration failed") } - if c.Slots.Body == nil || c.Slots.Body.Proto != 5 { - t.Fatal("body migration failed") - } - ensureArmorAP(c.Slots.Body) - if c.Slots.Body.AP != 20 { - t.Fatalf("migrated body AP = %d, want 20", c.Slots.Body.AP) + if c.Slots.Body != nil { + t.Fatal("old body armour should not be migrated") } want := []int{41, 46, 47} for i, proto := range want { diff --git a/internal/game/item_theme.go b/internal/game/item_theme.go new file mode 100644 index 0000000..aa0bc9b --- /dev/null +++ b/internal/game/item_theme.go @@ -0,0 +1,101 @@ +package game + +// The recovered item table contains modern military and science-fiction +// prototypes. This pass keeps the recovered IDs stable but refits the items +// that still exist in normal play to the priest/village/horror theme. Ranged +// weapons, ammunition and old body armour remain raw data only and are filtered +// out by ItemAvailable. +type itemThemeOverride struct { + Name string + Desc string + Glyph byte + Color uint8 +} + +var itemThemeOverrides = map[string]itemThemeOverride{ + "jacket": { + Name: "padded jerkin", Desc: "a layered cloth jerkin with old stains.", + Glyph: '[', Color: 6, + }, + "flak armor": { + Name: "reinforced hide coat", Desc: "a heavy coat reinforced with boiled hide.", + Glyph: '[', Color: 6, + }, + "power jacket": { + Name: "penitent's mail", Desc: "a heavy mail shirt worn as an act of penance.", + Glyph: '[', Color: 7, + }, + "plasteel stick": { + Name: "iron-shod staff", Desc: "a village staff capped with iron.", + Glyph: '|', Color: 6, + }, + "chainsaw": { + Name: "relic chainblade", Desc: "a strange bladed chain relic decorated with demon faces.", + Glyph: '/', Color: 8, + }, + "power sword": { + Name: "silvered longsword", Desc: "an old longsword with a silvered edge.", + Glyph: '/', Color: 15, + }, + "meta dagger": { + Name: "consecrated dagger", Desc: "a small dagger marked with old prayers.", + Glyph: '/', Color: 15, + }, + "vibra knife": { + Name: "blessed knife", Desc: "a knife etched with a blessing against the dead.", + Glyph: '/', Color: 15, + }, + "multiaxe": { + Name: "penitent's axe", Desc: "a heavy axe carried by the village penitents.", + Glyph: '/', Color: 7, + }, + "shock mace": { + Name: "censer mace", Desc: "a mace whose head still smells of incense.", + Glyph: '/', Color: 14, + }, + "battle hammer": { + Name: "war hammer", Desc: "a heavy war hammer from the village militia.", + Glyph: '/', Color: 7, + }, + "he grenade": { + Name: "holy water flask", Desc: "a flask of blessed water that bursts into purifying steam.", + Glyph: '!', Color: 11, + }, + "incendiary grenade": { + Name: "holy fire flask", Desc: "a flask of blessed oil that burns with a pale flame.", + Glyph: '!', Color: 12, + }, + "acid grenade": { + Name: "alchemical acid flask", Desc: "a stoppered flask of biting alchemical acid.", + Glyph: '!', Color: 10, + }, + "smoke grenade": { + Name: "incense flask", Desc: "a flask of heavy incense for driving off the restless dead.", + Glyph: '!', Color: 8, + }, + "flashbang grenade": { + Name: "radiant flask", Desc: "a flask of captured daylight, painful to creatures of the dark.", + Glyph: '!', Color: 14, + }, + "first aid kit": { + Name: "healer's kit", Desc: "a worn kit of needles, thread and clean cloth.", + Glyph: '!', Color: 10, + }, + "medkit": { + Name: "surgeon's kit", Desc: "a heavy kit of proper medical tools.", + Glyph: '!', Color: 10, + }, +} + +func init() { + for i := range ItemDefs { + override, ok := itemThemeOverrides[ItemDefs[i].Name] + if !ok { + continue + } + ItemDefs[i].Name = override.Name + ItemDefs[i].Desc = override.Desc + ItemDefs[i].Glyph = override.Glyph + ItemDefs[i].Color = override.Color + } +} diff --git a/internal/game/item_theme_test.go b/internal/game/item_theme_test.go new file mode 100644 index 0000000..ea883d8 --- /dev/null +++ b/internal/game/item_theme_test.go @@ -0,0 +1,53 @@ +package game + +import ( + "strings" + "testing" +) + +func TestOutOfThemeItemsAreRenamedOrUnavailable(t *testing.T) { + for _, old := range []string{"he grenade", "incendiary grenade", "molotov cocktail", "flak armor", "power jacket", "plasteel stick", "power sword", "meta dagger", "vibra knife", "shock mace"} { + if proto := itemProtoByName(old); proto >= 0 { + t.Fatalf("old out-of-theme item %q still exists as proto %d", old, proto) + } + } + for _, name := range []string{"holy water flask", "holy fire flask", "incense flask", "radiant flask", "padded jerkin", "silvered longsword", "consecrated dagger", "blessed knife", "censer mace", "healer's kit", "surgeon's kit"} { + if proto := itemProtoByName(name); proto < 0 { + t.Fatalf("themed item %q is missing", name) + } + } +} + +func TestAvailableItemsFitTheme(t *testing.T) { + banned := []string{"grenade", "gun", "pistol", "ammo", "clip", "rifle", "laser", "plasma", "flak", "power jacket", "plasteel", "meta ", "vibra", "shock ", "flashbang", "he grenade"} + for proto, def := range ItemDefs { + if !ItemAvailable(proto) { + continue + } + name := strings.ToLower(def.Name) + for _, word := range banned { + if strings.Contains(name, word) { + t.Fatalf("available item %d %q still uses out-of-theme term %q", proto, def.Name, word) + } + } + } +} + +func TestRangedWeaponsAmmoAndOldArmourAreUnavailable(t *testing.T) { + for _, name := range []string{"lasgun", "personal pistol clip", "padded jerkin", "leather jacket"} { + proto := itemProtoByName(name) + if proto < 0 { + continue + } + if ItemAvailable(proto) { + t.Fatalf("%q should not be available in normal play", name) + } + } + armour := itemProtoByName("padded jerkin") + if armour < 0 || !CritterItemAvailable(armour) { + t.Fatal("monsters should still be able to use armour prototypes") + } + if proto := itemProtoByName("holy fire flask"); proto < 0 || !ItemAvailable(proto) { + t.Fatal("holy fire flask should be available") + } +} diff --git a/internal/game/palette_roles.go b/internal/game/palette_roles.go index e162685..666e3b0 100644 --- a/internal/game/palette_roles.go +++ b/internal/game/palette_roles.go @@ -122,15 +122,15 @@ func ItemColorRole(proto int) (ColorRole, bool) { return RoleFireEmber, true case 39: // acid canister return RoleAcid, true - case 41, 42: // HE and incendiary grenades + case 41, 42: // holy water and holy fire flasks return RoleFireEmber, true - case 43: // acid grenade + case 43: // alchemical acid flask return RoleAcid, true - case 44: // smoke grenade + case 44: // incense flask return RoleSmoke, true - case 45: // flashbang + case 45: // radiant flask return RoleFlameCore, true - case 46, 48: // first aid kit, medkit + case 46, 48: // healer's kit, surgeon's kit return RoleHealthGood, true case 47: // bandage return RoleCloth, true diff --git a/internal/game/player_experience_test.go b/internal/game/player_experience_test.go index 5270c6d..bd77e41 100644 --- a/internal/game/player_experience_test.go +++ b/internal/game/player_experience_test.go @@ -58,9 +58,6 @@ func TestPlayerClassRoster(t *testing.T) { if proto < 0 || proto >= len(ItemDefs) { t.Fatalf("%s kit references invalid item %d", c.Name, proto) } - if !ItemAvailable(proto) { - t.Fatalf("%s kit references unavailable item %d", c.Name, proto) - } } } } @@ -304,8 +301,8 @@ func TestSaveMigrationGrantsTwoBeltSlots(t *testing.T) { }, } c, removed := critterFromSave(sc, 3) - if removed != 0 { - t.Fatalf("unexpected removed items: %d", removed) + if removed != 1 { + t.Fatalf("expected 1 removed item, got %d", removed) } if c.Slots.BeltUnlocked != 2 { t.Fatalf("migrated belt unlock = %d, want 2", c.Slots.BeltUnlocked) diff --git a/internal/game/save.go b/internal/game/save.go index 07b9106..eb5ba05 100644 --- a/internal/game/save.go +++ b/internal/game/save.go @@ -289,7 +289,7 @@ func critterFromSave(s saveCritter, version int) (*Critter, int) { if si.Proto < 0 { continue } - if !ItemAvailable(si.Proto) { + if !CritterItemAvailable(si.Proto) { removed++ continue } @@ -299,7 +299,7 @@ func critterFromSave(s saveCritter, version int) (*Critter, int) { } if version < 2 { // Old layout: melee, ranged, armor, grenade, tool. - if len(s.Equip) > 1 && s.Equip[1].Proto >= 0 && !ItemAvailable(s.Equip[1].Proto) { + if len(s.Equip) > 1 && s.Equip[1].Proto >= 0 && !CritterItemAvailable(s.Equip[1].Proto) { removed++ } want := [NumEquipSlots]int{0, 2, 3, 4} @@ -309,7 +309,7 @@ func critterFromSave(s saveCritter, version int) (*Critter, int) { if si.Proto < 0 { continue } - if !ItemAvailable(si.Proto) { + if !CritterItemAvailable(si.Proto) { removed++ continue } @@ -323,7 +323,7 @@ func critterFromSave(s saveCritter, version int) (*Critter, int) { if si.Proto < 0 { continue } - if !ItemAvailable(si.Proto) { + if !CritterItemAvailable(si.Proto) { removed++ continue } diff --git a/internal/game/scope.go b/internal/game/scope.go index d765087..d05d788 100644 --- a/internal/game/scope.go +++ b/internal/game/scope.go @@ -46,22 +46,38 @@ func ActiveOptionDefs() []OptionDef { } // ItemAvailable reports whether an item prototype may appear in normal play. -// Removed ranged/ammo items and unused grenade variants remain in the data for -// save compatibility but are not spawned, equipped or used. +// Removed ranged/ammo items, guns, old body armour and other out-of-theme +// prototypes remain in the raw data for reference but are not spawned or used. func ItemAvailable(proto int) bool { if proto < 0 || proto >= len(ItemDefs) { return false } d := &ItemDefs[proto] switch d.Kind { - case KindRanged, KindAmmo: + case KindRanged, KindAmmo, KindArmor: return false case KindGrenade: - return d.Name == "he grenade" || d.Name == "molotov cocktail" + switch d.Name { + case "holy water flask", "holy fire flask", "alchemical acid flask", "incense flask", "radiant flask": + return true + } + return false } return true } +// CritterItemAvailable keeps armour available to monsters even though the +// player now uses robe shards instead of body armour. +func CritterItemAvailable(proto int) bool { + if proto < 0 || proto >= len(ItemDefs) { + return false + } + if ItemDefs[proto].Kind == KindArmor { + return true + } + return ItemAvailable(proto) +} + func ItemIsThrowable(proto int) bool { if proto < 0 || proto >= len(ItemDefs) { return false @@ -93,17 +109,6 @@ func init() { Glyph: '!', Color: 9, }) - - // Repurpose the recovered incendiary grenade as a molotov cocktail. Its - // weapon subtype still gives the fire damage range, while ThrowGrenade - // applies the burning ground effect. - for i := range ItemDefs { - if ItemDefs[i].Name == "incendiary grenade" { - ItemDefs[i].Name = "molotov cocktail" - ItemDefs[i].Desc = "a bottle filled with fuel and a burning rag, it spreads fire on impact." - ItemDefs[i].Color = 12 - } - } } // ActiveKeyBindings is the reduced, player-facing help table. The recovered @@ -148,6 +153,6 @@ var ActiveHints = []string{ Hints[6], // inventory takes time Hints[7], // acid ignores armor "you are defenceless without a weapon; keep a melee weapon equipped.", - "grenades and molotovs can only be thrown at tiles within your sight range.", + "holy flasks can only be thrown at tiles within your sight range.", "bash small obstacles with x and a direction; barrels and crates may hide supplies.", } diff --git a/internal/game/woods_items.go b/internal/game/woods_items.go index 91869a7..47050c1 100644 --- a/internal/game/woods_items.go +++ b/internal/game/woods_items.go @@ -14,7 +14,7 @@ var signatureCategoryItems = [][]string{ {"hunting knife", "boar spear", "spear", "snare", "hatchet", "rope"}, {"healing herb", "red potion", "green potion", "blue potion", "antidote", "holy water"}, {"club", "spear", "sickle", "scythe", "pitchfork", "hatchet", "wood axe"}, - {"torch", "lantern", "flint", "oil flask", "molotov cocktail"}, + {"torch", "lantern", "flint", "oil flask", "holy fire flask", "incense flask"}, {"silver chalice", "old tome", "bone charm", "gold cross", "holy water"}, }