Memorial stones only for level 10 creatures, at most 30 per map
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
66eaedf016
commit
28eac52953
2 files changed
+21
-9
No files matched your search
+2
-2
@@ -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.
|
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
|
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;
|
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
|
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 24).
|
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
|
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
|
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
|
(creature overview "Fallen", or a click with the hand on a memorial stone) and over all games on the
|
||||||
|
|||||||
+19
-7
@@ -8,9 +8,11 @@ use crate::i18n::{tr, trf};
|
|||||||
use crate::map::*;
|
use crate::map::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
// the fallen get a stone from this level on; at most MAX_MEMORIALS stones (the oldest go)
|
// the fallen are remembered in the hall from HALL_LEVEL on; only the greatest (MEMORIAL_LEVEL)
|
||||||
pub const MEMORIAL_LEVEL: u32 = 3;
|
// get a stone on the map, at most MAX_MEMORIALS of them (the oldest go)
|
||||||
pub const MAX_MEMORIALS: usize = 24;
|
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)
|
// what killed a creature besides another unit (Ent::bane)
|
||||||
pub const BANE_SNARE: u8 = 250;
|
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
|
// 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
|
// near to where it fell as there is plain floor
|
||||||
pub(crate) fn raise_memorial(&mut self, e: &Ent) -> bool {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
// the hall of the fallen keeps the local master's (also without room for a stone)
|
// the hall of the fallen keeps the local master's (also without room for a stone)
|
||||||
if e.side == self.local_side {
|
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 });
|
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 owner = Owner::of_side(e.side);
|
||||||
let (x, y) = (e.x as i32, e.y as i32);
|
let (x, y) = (e.x as i32, e.y as i32);
|
||||||
let taken: Vec<usize> = self.memorials.iter().map(|m| m.tile).collect();
|
let taken: Vec<usize> = self.memorials.iter().map(|m| m.tile).collect();
|
||||||
@@ -261,12 +267,18 @@ mod tests {
|
|||||||
t.owner = Owner::Player;
|
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();
|
let j = g.ents.iter().position(|e| e.id == id).unwrap();
|
||||||
g.kill(j);
|
g.kill(j);
|
||||||
assert_eq!(g.memorials.len(), 1);
|
assert_eq!(g.memorials.len(), 1);
|
||||||
let m = &g.memorials[0];
|
let m = g.memorials[0].clone();
|
||||||
assert_eq!((m.kind, m.level), (EK::Ogre, 4));
|
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());
|
assert!(g.memorial_at(m.tile).is_some());
|
||||||
// a level 1 kobold is not remembered
|
// 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);
|
let k = g.spawn(EK::Kobold, false, cx as f32 + 2.5, cy as f32 + 5.5, 1);
|
||||||
|
|||||||
Reference in new issue
Block a user