|
From: <gi...@cr...> - 2026-01-29 22:00:10
|
via 71f451d4b8f61c3cae9800c8544be2010965f3aa (commit)
via 128f4cd87f8ad0d85926ce7b5c5d3c3123bb6eb0 (commit)
from f2d9c54bfe284783b7c22debd09c1b833fd10851 (commit)
-----------------------------------------------------------------------
commit 71f451d4b8f61c3cae9800c8544be2010965f3aa
Author: DracoOmega <dra...@gm...>
Date: Thu Jan 29 18:26:46 2026 -0330
Make reactive eeljolt a fineff
The direct cause of the crash in the previous commit (though
future-proofing it at the same time didn't seem like a bad idea).
commit 128f4cd87f8ad0d85926ce7b5c5d3c3123bb6eb0
Author: DracoOmega <dra...@gm...>
Date: Thu Jan 29 18:26:03 2026 -0330
Fix a possible Landbreaker crash
If the caster died mid-spell, parts of the rubble placement that referred
to its position could return an out of bounds value, leading to an assert.
Instead, cache the origin pos at the start, just in case.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/fineff.cc | 22 ++++++++++++++++++++++
crawl-ref/source/fineff.h | 1 +
crawl-ref/source/mon-cast.cc | 6 ++++--
crawl-ref/source/ouch.cc | 2 +-
4 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/crawl-ref/source/fineff.cc b/crawl-ref/source/fineff.cc
index a9bc1b4433..343162552a 100644
--- a/crawl-ref/source/fineff.cc
+++ b/crawl-ref/source/fineff.cc
@@ -562,6 +562,18 @@ public:
}
};
+class eeljolt_fineff : public final_effect
+{
+public:
+ bool mergeable(const final_effect&) const override { return true; }
+ void fire() override;
+
+ eeljolt_fineff()
+ : final_effect(&you, nullptr, you.pos())
+ {
+ }
+};
+
// Things to happen when the current attack/etc finishes.
static vector<final_effect*> _final_effects;
@@ -780,6 +792,11 @@ void schedule_celebrant_bloodrite_fineff()
_schedule_final_effect(new celebrant_bloodrite_fineff());
}
+void schedule_eeljolt_fineff()
+{
+ _schedule_final_effect(new eeljolt_fineff());
+}
+
bool mirror_damage_fineff::mergeable(const final_effect &fe) const
{
const mirror_damage_fineff *o =
@@ -1790,6 +1807,11 @@ void celebrant_bloodrite_fineff::fire()
}
}
+void eeljolt_fineff::fire()
+{
+ do_eel_arcjolt();
+}
+
// Effects that occur after all other effects, even if the monster is dead.
// For example, explosions that would hit other creatures, but we want
// to deal with only one creature at a time, so that's handled last.
diff --git a/crawl-ref/source/fineff.h b/crawl-ref/source/fineff.h
index 99a2b07f77..6ab80a8d1f 100644
--- a/crawl-ref/source/fineff.h
+++ b/crawl-ref/source/fineff.h
@@ -83,6 +83,7 @@ void schedule_stardust_fineff(actor* agent, int power, int max_stars,
bool is_star_jelly = false);
void schedule_pyromania_fineff();
void schedule_celebrant_bloodrite_fineff();
+void schedule_eeljolt_fineff();
void fire_final_effects();
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 971b1ee12a..af1717949c 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1687,6 +1687,8 @@ static bool _cast_landbreaker(const monster& caster, bolt& beam, bool check_only
if (targs.empty())
return false;
+ // Just in case something kills in along the way.
+ const coord_def caster_pos = caster.pos();
const int pow = mons_spellpower(caster, SPELL_LANDBREAKER);
const unsigned int num_targs = 2 + div_rand_round((int)max(0, pow - 50), 40);
shuffle_array(targs);
@@ -1713,7 +1715,7 @@ static bool _cast_landbreaker(const monster& caster, bolt& beam, bool check_only
beam.fire();
// Place rubble 'behind' the target, relative to the caster.
- const coord_def aim((targs[i]->pos() - caster.pos()) + targs[i]->pos());
+ const coord_def aim((targs[i]->pos() - caster_pos) + targs[i]->pos());
vector<coord_def> spots = get_wall_ring_spots(targs[i]->pos(), aim, random_range(3, 5));
for (coord_def& spot : spots)
{
@@ -1729,7 +1731,7 @@ static bool _cast_landbreaker(const monster& caster, bolt& beam, bool check_only
// Place some additional rumble at random locations.
const int bonus_rubble = max(0, 8 - rubble_made);
- rubble.pos = caster.pos();
+ rubble.pos = caster_pos;
rubble.set_range(4, 7, 1);
for (int i = 0; i < bonus_rubble; ++i)
{
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 3459ba1c40..f84c1f4d55 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -990,7 +990,7 @@ static void _maybe_eeljolt()
return;
}
- do_eel_arcjolt();
+ schedule_eeljolt_fineff();
you.duration[DUR_EELJOLT_COOLDOWN] = 1;
}
--
Dungeon Crawl Stone Soup
|