Named creatures: names per kind and language, epithets at higher levels, memorial stones for the fallen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 12:40:22 +01:00
1 parent 189da6f408
commit ad5ceb8c13
26 files changed
+685 -6

No files matched your search

+14 -2
View File
@@ -1402,8 +1402,9 @@ impl Ui {
for e in group {
let w = (st(e.kind).wage as f32 * (1.0 + 0.1 * (e.level - 1) as f32)) as i32;
let happy = (e.happy.clamp(0.0, 1.0) * 100.0) as i32;
let job: String = tr(job_name(e)).chars().take(16).collect();
let line = format!(" {:>2} {:>3}% {:>4}g {:<16}", e.level, happy, w, job);
let job: String = tr(job_name(e)).chars().take(12).collect();
let name: String = crate::names::display_name(e).chars().take(18).collect();
let line = format!(" {:>2} {:<18} {:>3}% {:>4}g {:<12}", e.level, name, happy, w, job);
let col = if e.happy > 0.6 { TXT } else if e.happy > 0.25 { GOLD } else { RED };
lines.push((line, col, Some(e.id), e.hp / e.max_hp));
}
@@ -1778,6 +1779,10 @@ pub fn hover_info(g: &Game, ent: Option<usize>, tile: Option<(i32, i32)>) -> Vec
out.push((trf("trader.left", &[(left.ceil() as i32).to_string()]), DIM));
return out;
}
// a named creature: its name is the title
if e.name != 0 {
out.push((crate::names::display_name(e), GOLD));
}
out.push((trf("info.level", &[tr(s.name), e.level.to_string()]), if e.hero { BLUE } else { FRAME_HI }));
out.push((trf("info.rank", &[tr(&format!("rank.{}", e.level.clamp(1, 10)))]), GOLD));
out.push((trf("info.hp", &[(e.hp.max(0.0) as i32).to_string(), (e.max_hp as i32).to_string()]), GREEN));
@@ -1840,6 +1845,13 @@ pub fn hover_info(g: &Game, ent: Option<usize>, tile: Option<(i32, i32)>) -> Vec
}
let Some(t) = g.map.get(x, y) else { return out };
let i = idx(x, y);
// a memorial stone: who lies here
if let Some(m) = g.memorial_at(i) {
let name = crate::names::full_name(m.kind, m.name, m.level);
out.push((tr("tile.memorial"), DIM));
out.push((trf("tile.memorial_info", &[name, tr(st(m.kind).name), m.level.to_string()]), TXT));
return out;
}
let owner = match t.owner {
Owner::Player => "owner.player",
Owner::Hero => "owner.hero",