Skip to content

Commit 8cb1a8b

Browse files
Make closing attacks create gaps
Use up monster turns when they launch closing attacks. Basically ends up similar to old random energy, but with less waiting (on average) and slightly clearer/more explicit effects.
1 parent fbe7bd0 commit 8cb1a8b

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

crawl-ref/source/mon-act.cc

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,20 +3129,20 @@ static bool _monster_swaps_places(monster* mon, const coord_def& delta)
31293129
return false;
31303130
}
31313131

3132-
static bool _mons_closing_attack(monster& mons, coord_def delta)
3132+
static void _mons_closing_attack(monster& mons, coord_def delta)
31333133
{
31343134
// XXX: should check reach instead of a fixed distance 1?
31353135
if (mons.confused() || mons_is_batty(mons) || mons.foe_distance() > 1)
3136-
return false;
3136+
return;
31373137
if (!one_chance_in(6))
3138-
return false;
3138+
return;
31393139
actor* foe = mons.get_foe();
31403140
ASSERT(foe); // else, how is foe distance <= 0?
31413141
if (!mons.can_see(*foe))
3142-
return false;
3142+
return;
31433143
coord_def old_pos = mons.pos() - delta;
31443144
if (adjacent(old_pos, foe->pos()))
3145-
return false;
3145+
return;
31463146

31473147

31483148
const string name = foe->name(DESC_THE);
@@ -3152,26 +3152,14 @@ static bool _mons_closing_attack(monster& mons, coord_def delta)
31523152
mons.pronoun_plurality() ? "" : "s");
31533153
simple_monster_message(mons, msg.c_str());
31543154

3155-
const energy_use_type move_type = _get_swim_or_move(mons);
3156-
const int move_cost = mons.energy_cost(move_type);
3157-
3158-
const int old_speed = mons.speed_increment;
31593155
if (foe->is_player())
31603156
{
31613157
monster *ru_target = nullptr;
31623158
if (_handle_ru_melee_redirection(mons, &ru_target))
3163-
{
3164-
mons.speed_increment -= move_cost; // XXX: should be non_move_energy
3165-
return true;
3166-
}
3167-
3159+
return;
31683160
_melee_attack_player(mons, ru_target);
31693161
} else
31703162
fight_melee(&mons, foe);
3171-
3172-
const int speed_after_moving = old_speed - move_cost;
3173-
mons.speed_increment = min(mons.speed_increment, speed_after_moving);
3174-
return true;
31753163
}
31763164

31773165
static bool _do_move_monster(monster& mons, const coord_def& delta)
@@ -3299,8 +3287,8 @@ static bool _do_move_monster(monster& mons, const coord_def& delta)
32993287

33003288
_handle_manticore_barbs(mons);
33013289

3302-
if (!_mons_closing_attack(mons, delta))
3303-
_swim_or_move_energy(mons);
3290+
_swim_or_move_energy(mons);
3291+
_mons_closing_attack(mons, delta);
33043292

33053293
return true;
33063294
}

0 commit comments

Comments
 (0)