Skip to content

Commit e438bbe

Browse files
committed
The return of randomized energy (when pursuing the player).
Randomized energy (essentially monsters having a random choice between 0.9/1.0/1.1 move delay) was removed in c209556. It had two main problems - the first was that it felt surprising and 'unfair' when an ogre two steps away suddenly moved and hit the player on the same turn, and the second was that it incentivized running away from an adjacent monster until random energy made a space between the two of you (usually only taking 0-2 hits in the process). This commit re-implements randomized energy, but only when the monster is pursuing the player (replacing the experimental swiftness on pursuit). This hopefully addresses the first issue with randomized energy, since an ogre will only be able to move + attack if the player was adjacent to it and just moved away - essentially an attack of opportunity. The second issue will be addressed by bringing back attacks of opportunity in a separate commit, making running away from an adjacent monster far more deadly. The hope is that randomized energy will help smooth out some of the sharp edges on attacks of opportunity - we'll try it out.
1 parent 967258e commit e438bbe

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

crawl-ref/source/mon-act.cc

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,21 +3025,20 @@ static bool _monster_swaps_places(monster* mon, const coord_def& delta)
30253025
return false;
30263026
}
30273027

3028-
static void _maybe_pursue_quickly(monster &mons, coord_def orig_pos)
3028+
static void _maybe_randomize_energy(monster &mons, coord_def orig_pos)
30293029
{
30303030
if (!mons.alive() // barbs!
30313031
|| !crawl_state.potential_pursuers.count(&mons)
30323032
|| mons.wont_attack()
30333033
|| mons_is_confused(mons, true)
30343034
|| mons_is_fleeing(mons)
3035-
|| !mons.can_see(you)
3036-
|| mons.has_ench(ENCH_PURSUING))
3035+
|| !mons.can_see(you))
30373036
{
30383037
return;
30393038
}
30403039

30413040

3042-
// Only trigger swiftness for monsters moving toward you, not doing tricky
3041+
// Only randomize energy for monsters moving toward you, not doing tricky
30433042
// M_MAINTAIN_RANGE nonsense or wandering around a lake or what have you.
30443043
if (grid_distance(mons.pos(), you.pos()) > grid_distance(orig_pos, you.pos()))
30453044
return;
@@ -3049,15 +3048,8 @@ static void _maybe_pursue_quickly(monster &mons, coord_def orig_pos)
30493048
if (!foe || !foe->is_player())
30503049
return;
30513050

3052-
if (you.can_see(mons))
3053-
{
3054-
const string msg = make_stringf(
3055-
" puts on a burst of speed as %s %s you!",
3056-
mons.pronoun(PRONOUN_SUBJECTIVE).c_str(),
3057-
conjugate_verb("pursue", mons.pronoun_plurality()).c_str());
3058-
simple_monster_message(mons, msg.c_str());
3059-
}
3060-
mons.add_ench(ENCH_PURSUING);
3051+
// Randomize energy.
3052+
mons.speed_increment += random2(3) - 1;
30613053
}
30623054

30633055
static bool _do_move_monster(monster& mons, const coord_def& delta)
@@ -3186,11 +3178,11 @@ static bool _do_move_monster(monster& mons, const coord_def& delta)
31863178

31873179
_handle_manticore_barbs(mons);
31883180

3189-
// Turn on the gas before we use up move energy, so that pillar-dancing
3190-
// players can maybe get bapped if they get unlucky.
3191-
_maybe_pursue_quickly(mons, orig_pos);
31923181
_swim_or_move_energy(mons);
31933182

3183+
// Randomize move energy for monsters pursuing the player.
3184+
_maybe_randomize_energy(mons, orig_pos);
3185+
31943186
return true;
31953187
}
31963188

crawl-ref/source/movement.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ static void _mark_potential_pursuers(coord_def new_pos)
227227
const coord_def orig_pos = you.pos();
228228
for (radius_iterator ri(you.pos(), LOS_NO_TRANS); ri; ++ri)
229229
{
230-
if (!one_chance_in(10))
231-
continue;
232-
// Only trigger swiftness for monsters you're moving away from.
230+
// Only randomize energy for monsters you're moving away from.
233231
if (grid_distance(new_pos, *ri) <= grid_distance(orig_pos, *ri))
234232
continue;
235233
monster* mon = monster_at(*ri);

0 commit comments

Comments
 (0)