summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/fight.cc6
-rw-r--r--crawl-ref/source/fight.h2
-rw-r--r--crawl-ref/source/monstuff.cc12
3 files changed, 13 insertions, 7 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 605f06012b..55b5d5a2c2 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -3613,15 +3613,17 @@ static void mons_lose_attack_energy(monsters *attacker, int wpn_speed,
}
}
-void monster_attack(int monster_attacking)
+bool monster_attack(int monster_attacking)
{
monsters *attacker = &menv[monster_attacking];
if (mons_friendly(attacker) && !mons_is_confused(attacker))
- return;
+ return false;
melee_attack attk(attacker, &you);
attk.attack();
+
+ return true;
} // end monster_attack()
bool monsters_fight(int monster_attacking, int monster_attacked)
diff --git a/crawl-ref/source/fight.h b/crawl-ref/source/fight.h
index bf44785488..03984b03b9 100644
--- a/crawl-ref/source/fight.h
+++ b/crawl-ref/source/fight.h
@@ -54,7 +54,7 @@ bool you_attack(int monster_attacked, bool unarmed_attacks);
/* ***********************************************************************
* called from: monstuff
* *********************************************************************** */
-void monster_attack(int monster_attacking);
+bool monster_attack(int monster_attacking);
// last updated: 08jun2000 {dlb}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index f46c35fed0..5c65fb0b62 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -4069,7 +4069,10 @@ static void handle_monster_move(int i, monsters *monster)
}
if (monster->speed >= 100)
+ {
+ monster->speed_increment -= non_move_energy;
continue;
+ }
if (monster->type == MONS_ZOMBIE_SMALL
|| monster->type == MONS_ZOMBIE_LARGE
@@ -5293,8 +5296,7 @@ forget_it:
if (monster->x + mmov_x == you.x_pos
&& monster->y + mmov_y == you.y_pos)
{
- monster_attack( monster_index(monster) );
- ret = true;
+ ret = monster_attack( monster_index(monster) );
mmov_x = 0;
mmov_y = 0;
}
@@ -5334,12 +5336,14 @@ forget_it:
if (targmon != NON_MONSTER)
{
if (mons_aligned(monster_index(monster), targmon))
- monster_swaps_places(monster, mmov_x, mmov_y);
+ ret = monster_swaps_places(monster, mmov_x, mmov_y);
else
+ {
monsters_fight(monster_index(monster), targmon);
+ ret = true;
+ }
// If the monster swapped places, the work's already done.
- ret = true;
mmov_x = 0;
mmov_y = 0;
}