Creature equipment: the forge makes iron, steel and rune gear for the strongest creatures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 00:26:59 +01:00
1 parent 82dd8c73e1
commit 4c440fb97f
25 files changed
+215 -4

No files matched your search

+17 -2
View File
@@ -305,6 +305,8 @@ pub struct Ent {
pub chained: bool, // a lone creature chained in a sealed cave: joins when the cave is claimed
#[serde(default)]
pub boss: u8, // a champion of the Order leading a wave (see bosses.rs), 0: none
#[serde(default)]
pub gear: u8, // equipment from the forge: 0 none, 1 iron, 2 steel, 3 rune (armory.rs)
#[serde(skip, default = "zero_f32")]
pub disp_x: f32, // smoothed screen position (not part of the saved or synced world state)
#[serde(skip, default = "zero_f32")]
@@ -381,6 +383,7 @@ impl Ent {
target: None,
chained: false,
boss: 0,
gear: 0,
disp_x: 0.0,
disp_y: 0.0,
}
@@ -389,7 +392,7 @@ impl Ent {
idx((self.x as i32).clamp(0, mw() as i32 - 1), (self.y as i32).clamp(0, mh() as i32 - 1))
}
pub fn atk(&self) -> f32 {
st(self.kind).atk * (1.0 + 0.12 * (self.level - 1) as f32)
st(self.kind).atk * (1.0 + 0.12 * (self.level - 1) as f32) * crate::armory::gear_factor(self.gear)
}
// the player's creatures (not imps, heroes or the rivals' units)
pub fn creature(&self) -> bool {
@@ -494,6 +497,8 @@ pub struct MasterState {
pub training_bill: f32,
pub counts: [usize; N_ROOMS],
pub room_level: Vec<u8>,
pub gear_stock: Vec<u16>,
pub gear_work: f32,
pub springs: usize,
pub known: Vec<bool>,
pub researchable: Vec<bool>,
@@ -531,6 +536,10 @@ pub struct Game {
#[serde(skip)]
pub counts: [usize; N_ROOMS], // room tiles per room kind (ROOM_KINDS order, recounted)
#[serde(default)]
pub gear_stock: Vec<u16>, // finished equipment waiting for a creature, per tier (armory.rs)
#[serde(default)]
pub gear_work: f32, // forge work on the next piece
#[serde(default)]
pub room_level: Vec<u8>, // level of every room kind (ROOM_KINDS order; 1 when missing), researched
pub gate_hp: f32,
pub gate_hit_t: f32,
@@ -893,6 +902,8 @@ impl Game {
hand: Vec::new(),
counts: [0; N_ROOMS],
room_level: Vec::new(),
gear_stock: Vec::new(),
gear_work: 0.0,
gate_hp: GATE_HP,
gate_hit_t: -100.0,
gate_stage: 0,
@@ -1463,6 +1474,8 @@ impl Game {
training_bill: self.training_bill,
counts: self.counts,
room_level: self.room_level.clone(),
gear_stock: self.gear_stock.clone(),
gear_work: self.gear_work,
springs: self.springs,
known: std::mem::take(&mut self.known),
researchable: std::mem::take(&mut self.researchable),
@@ -1494,6 +1507,8 @@ impl Game {
self.training_bill = m.training_bill;
self.counts = m.counts;
self.room_level = m.room_level;
self.gear_stock = m.gear_stock;
self.gear_work = m.gear_work;
self.springs = m.springs;
self.known = m.known;
self.researchable = m.researchable;
@@ -2374,7 +2389,7 @@ impl Game {
e.xp -= 100.0 * e.level as f32;
e.level += 1;
let old = e.max_hp;
e.max_hp = s.hp * (1.0 + 0.15 * (e.level - 1) as f32);
e.max_hp = s.hp * (1.0 + 0.15 * (e.level - 1) as f32) * crate::armory::gear_factor(e.gear);
e.hp += e.max_hp - old;
self.fx(7, e.x, e.y, 0.0, 0.0, 0.8, 0xff44ddff);
if !e.hero {