Drawbridges (down, up, automatic), frost spell and obsidian over cooled lava

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 21:52:12 +01:00
1 parent 76c23a06f0
commit 34b4640d85
32 files changed
+869 -31

No files matched your search

+30 -1
View File
@@ -16,9 +16,18 @@ pub enum Spell {
Invisible,
Plague,
Quake,
Freeze, // frost: cools lava into obsidian, chills enemies
}
pub const SPELLS: [Spell; 8] = [Spell::Eye, Spell::CaveIn, Spell::Haste, Spell::Stoneskin, Spell::GoldRain, Spell::Invisible, Spell::Plague, Spell::Quake];
pub const SPELLS: [Spell; 9] = [Spell::Eye, Spell::CaveIn, Spell::Haste, Spell::Stoneskin, Spell::GoldRain, Spell::Invisible, Spell::Plague, Spell::Quake, Spell::Freeze];
// the icon of a spell (the first eight share one row of the atlas)
pub fn spell_icon(sp: Spell) -> u32 {
match SPELLS.iter().position(|&t| t == sp).unwrap_or(0) {
k if k < 8 => crate::gfx::I_SPELLS + k as u32,
_ => crate::gfx::I_FREEZE,
}
}
pub const EYE_TIME: f32 = 20.0;
pub const EYE_RADIUS: f32 = 8.0;
@@ -34,6 +43,7 @@ impl Spell {
Spell::Invisible => 50.0,
Spell::Plague => 80.0,
Spell::Quake => 90.0,
Spell::Freeze => 80.0,
}
}
// radius shown under the pointer
@@ -43,6 +53,7 @@ impl Spell {
Spell::CaveIn => 1.5,
Spell::Plague => 2.0,
Spell::Quake => 3.0,
Spell::Freeze => 2.5,
Spell::GoldRain => 0.0,
_ => 1.6,
}
@@ -57,6 +68,7 @@ impl Spell {
Spell::Invisible => "invisible",
Spell::Plague => "plague",
Spell::Quake => "quake",
Spell::Freeze => "freeze",
}
}
}
@@ -232,6 +244,23 @@ impl Game {
}
self.sfx(Sfx::Cannon, wx, wy);
}
Spell::Freeze => {
// lava turns to obsidian for a while; enemies are chilled and slowed
self.cool_lava_around(wx, wy, 2.5, crate::bridges::FREEZE_TIME);
let hit: Vec<usize> = (0..self.ents.len()).filter(|&j| foe(&self.ents[j]) && near(&self.ents[j])).collect();
for j in hit {
let e = &mut self.ents[j];
e.hp -= 20.0;
e.slow = e.slow.max(4.0);
e.flash = 0.15;
if e.hp <= 0.0 {
self.kill(j);
}
}
self.part(RING, (wx, wy, 0.05), (0.0, 0.0, 0.0), 0.6, abgr(170, 230, 255), 2.5);
self.sparkle(wx, wy, 24, abgr(200, 240, 255));
self.sfx(Sfx::Magic, wx, wy);
}
}
self.mana -= cost;
}