summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-15 10:32:44 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-15 10:32:44 +0000
commitf1e3ca24060130e0c9205de20e367bcf814896d1 (patch)
tree5a900298361fcf5aa201d39d5b898ab6167072a9 /crawl-ref/source
parent2b0fe052f4617b1b52fd952a35bfbc4f273dac81 (diff)
downloadcrawl-ref-f1e3ca24060130e0c9205de20e367bcf814896d1.tar.gz
crawl-ref-f1e3ca24060130e0c9205de20e367bcf814896d1.zip
Fix problem of friendly monsters not using any energy when there's
nothing around to fight and they're right next to the player. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2467 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-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;
}