New heroes: thief steals gold, monk ignores spells, ranger lays snares, inquisitor turns weak 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 11:02:50 +01:00
1 parent a1a8f9d71d
commit ff48a69571
29 files changed
+724 -12

No files matched your search

+28 -3
View File
@@ -132,6 +132,11 @@ pub enum EK {
CaveBear, // strong and shaggy, likes the mushroom garden
Beetle, // a giant armoured beetle, likes the lair
Trader, // a merchant visiting through the portal (traders.rs)
// heroes of the later waves (rogues.rs)
Thief, // fast, sneaks to a treasury, steals gold and runs off with it
Monk, // fists and faith: spells do not touch him
Ranger, // a bow from afar, lays snares in the dungeon's corridors
Inquisitor, // fragile; now and then turns one of the weakest creatures to the heroes' side
}
pub struct St {
@@ -179,6 +184,10 @@ pub fn st(k: EK) -> St {
EK::CaveBear => s("unit.cavebear", 420.0, 24.0, 1.0, 1.9, 1.4, 110, 0),
EK::Beetle => s("unit.beetle", 300.0, 13.0, 1.0, 1.7, 1.1, 70, 0),
EK::Trader => s("unit.trader", 200.0, 1.0, 1.0, 1.5, 2.0, 0, 0),
EK::Thief => s("unit.thief", 60.0, 6.0, 1.0, 3.1, 0.9, 50, 120),
EK::Monk => s("unit.monk", 150.0, 12.0, 1.0, 2.3, 0.7, 80, 180),
EK::Ranger => s("unit.ranger", 90.0, 11.0, 5.0, 2.2, 1.4, 80, 160),
EK::Inquisitor => s("unit.inquisitor", 70.0, 7.0, 3.5, 1.8, 1.6, 90, 250),
}
}
@@ -629,6 +638,8 @@ pub struct Game {
#[serde(default)]
pub happenings: Option<crate::events::Events>, // random events (free games and versus), see events.rs
#[serde(default)]
pub snares: Vec<usize>, // tiles with a ranger's snare (rogues.rs)
#[serde(default)]
pub guard_marks: Vec<usize>, // guard markers (shields) of the master being processed (orders.rs)
#[serde(default)]
pub attack_marks: Vec<usize>, // attack markers (swords)
@@ -978,6 +989,7 @@ impl Game {
bridgework: Default::default(),
trading: Default::default(),
happenings: None,
snares: Vec::new(),
guard_marks: Vec::new(),
attack_marks: Vec::new(),
marks_t: 0.0,
@@ -1778,6 +1790,7 @@ impl Game {
self.update_contested();
self.update_units(dt);
self.switch_to(first); // update_units worked master by master
self.update_snares();
self.update_towers(dt);
self.update_reveals(dt);
self.update_graves(dt);
@@ -2263,6 +2276,12 @@ impl Game {
if w >= 6 {
pool.push((Giant, 1));
}
// the rogues of the later waves (in the campaign only from the later missions on)
for (k, from_wave, from_mission) in crate::rogues::ROGUES {
if w >= from_wave && self.mission.as_ref().map_or(true, |m| m.index >= from_mission) {
pool.push((k, 1));
}
}
// siege engines for the dungeon's doors, walls and towers
if w >= 4 && self.traps.iter().any(|t| t.kind.door()) {
pool.push((Ram, 1));
@@ -2754,6 +2773,7 @@ impl Game {
EK::Priestess => 0xff3080ff,
EK::Owl => 0xffffa060,
EK::Wyrm => 0xff2080ff,
EK::Inquisitor => 0xff40d0ff,
_ => 0xff70b0d0,
};
// flyers shoot from the air
@@ -2762,7 +2782,8 @@ impl Game {
self.grow_last_fx(lv);
use crate::particles::*;
self.style_last_fx(match e.kind {
EK::Archer => ST_ARROW,
EK::Archer | EK::Ranger => ST_ARROW,
EK::Inquisitor => ST_HOLY,
EK::Mage => ST_SHADOW,
EK::Priest => ST_HOLY,
EK::Priestess | EK::Wyrm | EK::BattleMage => ST_FIRE,
@@ -2924,7 +2945,7 @@ impl Game {
self.switch_to(me);
}
if hero {
let b = s.bounty as f32;
let b = s.bounty as f32 + if kind == EK::Thief { self.thief_loot(id) } else { 0.0 };
let got = self.add_gold(b);
self.fx(5, x, y, 0.0, 0.0, 1.0, 0xff30d0ff);
self.sfx(Sfx::HeroDeath, x, y);
@@ -4631,6 +4652,10 @@ impl Game {
if e.boss > 0 {
self.boss_ability(e, dt);
}
// the rogues' tricks: a thief who is busy stealing or running does nothing else
if self.rogue_ai(e, dt) {
return;
}
if e.kind == EK::Fairy {
// fairy dust: the heroes around are healed a little all the time
for o in self.ents.iter_mut() {
@@ -5681,7 +5706,7 @@ impl Game {
self.ignite_at(wx, wy);
let mut kills = Vec::new();
for (j, e) in self.ents.iter_mut().enumerate() {
if e.alive && !e.held && e.active_hero() && (e.x - wx).powi(2) + (e.y - wy).powi(2) < 2.6 {
if e.alive && !e.held && e.active_hero() && !crate::rogues::spell_proof(e) && (e.x - wx).powi(2) + (e.y - wy).powi(2) < 2.6 {
e.hp -= 55.0;
e.flash = 0.2;
if e.hp <= 0.0 {