From 28eac52953bdf61c70798fd4a20f78a7b4f5308c Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Fri, 6 Nov 2026 15:34:03 +0100 Subject: [PATCH] Memorial stones only for level 10 creatures, at most 30 per map Co-Authored-By: Claude Opus 5.5 --- docs/ROADMAP.md | 4 ++-- src/names.rs | 26 +++++++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index c3b76c0..ca8d40f 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -140,8 +140,8 @@ grid), guard and attack markers (shields and swords), savegames with the game st or trees with lightning every 6-20 s. Dimmed daylight, rain streaks, fog veils, flashes; a HUD label. 6. **Named creatures** (done, v202611-00068, names.rs) - every creature gets a name from its kind's list in the language files (20 per kind, per language), a humorous epithet from level 5 and a grand one from level 8; - names in the hover info, the creature overview and the messages. A creature of level 3+ that falls leaves a - memorial stone on its master's ground (hover: who lies there; at most 24). + names in the hover info, the creature overview and the messages. A creature of level 10 that falls leaves a + memorial stone on its master's ground (hover: who lies there; at most 30 per map). 7. **Hall of the fallen** (done, v202611-00073) - every named creature of level 3+ that falls is remembered with its level, heroes slain and how it fell (slain by a kind, lava, water, snare, lightning): in the game (creature overview "Fallen", or a click with the hand on a memorial stone) and over all games on the diff --git a/src/names.rs b/src/names.rs index c0c1fb2..65c7ab0 100644 --- a/src/names.rs +++ b/src/names.rs @@ -8,9 +8,11 @@ use crate::i18n::{tr, trf}; use crate::map::*; use serde::{Deserialize, Serialize}; -// the fallen get a stone from this level on; at most MAX_MEMORIALS stones (the oldest go) -pub const MEMORIAL_LEVEL: u32 = 3; -pub const MAX_MEMORIALS: usize = 24; +// the fallen are remembered in the hall from HALL_LEVEL on; only the greatest (MEMORIAL_LEVEL) +// get a stone on the map, at most MAX_MEMORIALS of them (the oldest go) +pub const HALL_LEVEL: u32 = 3; +pub const MEMORIAL_LEVEL: u32 = 10; +pub const MAX_MEMORIALS: usize = 30; // what killed a creature besides another unit (Ent::bane) pub const BANE_SNARE: u8 = 250; @@ -134,13 +136,17 @@ impl Game { // a named creature of some standing fell: a stone with its name on its master's ground, as // near to where it fell as there is plain floor pub(crate) fn raise_memorial(&mut self, e: &Ent) -> bool { - if e.hero || e.name == 0 || e.level < MEMORIAL_LEVEL || !Owner::MASTER_SIDES.contains(&e.side) { + if e.hero || e.name == 0 || e.level < HALL_LEVEL || !Owner::MASTER_SIDES.contains(&e.side) { return false; } // the hall of the fallen keeps the local master's (also without room for a stone) if e.side == self.local_side { self.hall.push(Fallen { kind: e.kind, name: e.name, level: e.level, kills: e.kills, bane: e.bane, time: self.time, when: 0 }); } + // a stone only for the greatest + if e.level < MEMORIAL_LEVEL { + return false; // the usual message tells of it + } let owner = Owner::of_side(e.side); let (x, y) = (e.x as i32, e.y as i32); let taken: Vec = self.memorials.iter().map(|m| m.tile).collect(); @@ -261,12 +267,18 @@ mod tests { t.owner = Owner::Player; } } - let id = g.spawn(EK::Ogre, false, cx as f32 + 1.5, cy as f32 + 5.5, 4); + let id = g.spawn(EK::Ogre, false, cx as f32 + 1.5, cy as f32 + 5.5, 10); let j = g.ents.iter().position(|e| e.id == id).unwrap(); g.kill(j); assert_eq!(g.memorials.len(), 1); - let m = &g.memorials[0]; - assert_eq!((m.kind, m.level), (EK::Ogre, 4)); + let m = g.memorials[0].clone(); + assert_eq!((m.kind, m.level), (EK::Ogre, 10)); + // level 4: in the hall, but no stone on the map + let o4 = g.spawn(EK::Ogre, false, cx as f32 + 3.5, cy as f32 + 5.5, 4); + let j = g.ents.iter().position(|e| e.id == o4).unwrap(); + g.kill(j); + assert_eq!(g.memorials.len(), 1); + assert_eq!(g.hall.len(), 2); assert!(g.memorial_at(m.tile).is_some()); // a level 1 kobold is not remembered let k = g.spawn(EK::Kobold, false, cx as f32 + 2.5, cy as f32 + 5.5, 1);