Hall of the fallen: kills and causes of death, in the game and over all games in the profile

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 13:48:06 +01:00
1 parent 065fe80218
commit c52fc4c4ae
28 files changed
+534 -5

No files matched your search

+25
View File
@@ -303,6 +303,10 @@ pub struct Ent {
#[serde(default)]
pub name: u32, // seed of the creature's name (names.rs), 0: none (heroes, siege engines)
#[serde(default)]
pub kills: u32, // heroes this creature has slain (names.rs: the hall of the fallen)
#[serde(default)]
pub bane: u8, // what hurt it last: sprite index + 1 of a unit kind, or names::BANE_*
#[serde(default)]
pub ab_cd: f32, // cooldown of the learned ability
#[serde(default)]
pub mood_t: f32, // seconds until the next mood check (likes and hatreds)
@@ -393,6 +397,8 @@ impl Ent {
invis: 0.0,
plague: 0.0,
name: 0,
kills: 0,
bane: 0,
ab_cd: 0.0,
mood_t: 0.0,
guard: false,
@@ -652,6 +658,8 @@ pub struct Game {
#[serde(default)]
pub memorials: Vec<crate::names::Memorial>, // stones for fallen creatures (names.rs)
#[serde(default)]
pub hall: Vec<crate::names::Fallen>, // the local master's fallen of this game (names.rs)
#[serde(default)]
pub trading: crate::traders::Trading, // the visiting trader (traders.rs)
#[serde(default)]
pub happenings: Option<crate::events::Events>, // random events (free games and versus), see events.rs
@@ -1009,6 +1017,7 @@ impl Game {
bridgework: Default::default(),
weather: Default::default(),
memorials: Vec::new(),
hall: Vec::new(),
trading: Default::default(),
happenings: None,
snares: Vec::new(),
@@ -2791,6 +2800,11 @@ impl Game {
true
}
#[cfg(test)]
pub(crate) fn hit_for_test(&mut self, e: &mut Ent, j: usize) {
self.hit(e, j);
}
fn hit(&mut self, e: &mut Ent, j: usize) {
// the Warlord talent of the attacker's master
let boost = if !e.hero && Owner::MASTER_SIDES.contains(&e.side) { self.talents_of(e.side).damage() } else { 1.0 };
@@ -2910,6 +2924,10 @@ impl Game {
let t = &mut self.ents[j];
t.hp -= if t.shield > 0.0 { dmg * 0.5 } else { dmg } * armour;
t.flash = 0.15;
t.bane = crate::gfx::sprite_index(e.kind) as u8 + 1;
if t.hp <= 0.0 && t.hero && t.captive == 0 {
e.kills += 1;
}
if t.creature() && !matches!(t.job, Job::Attack(_)) {
t.job = Job::Attack(my_id);
t.path.clear();
@@ -3025,6 +3043,13 @@ impl Game {
}
self.release_all(id);
self.hand.retain(|&h| h != id);
// a named creature lost in lava or water is remembered too
if !hero {
let mut dead = self.ents[j].clone();
let lava = self.map.get(x as i32, y as i32).map_or(false, |t| t.river() == Some(Kind::Lava));
dead.bane = if lava { crate::names::BANE_LAVA } else { crate::names::BANE_WATER };
self.raise_memorial(&dead);
}
self.fx(3, x, y, 0.0, 0.0, 1.0, 0xff2060ff);
self.fx(2, x, y, 0.0, 0.0, 0.5, 0xff30a0ff);
self.sfx(Sfx::Death, x, y);