diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-05 14:04:39 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-05 14:04:39 +0000 |
commit | a57d484bd70f19a06271202fd5e5a9d0be914d18 (patch) | |
tree | 2d4e1edd7666c7c3f07164104d3753a477af5b5b /crawl-ref/source/it_use3.cc | |
parent | 70e12c754c318dc3e7b513d45c9cca91c94147ca (diff) | |
download | crawl-ref-a57d484bd70f19a06271202fd5e5a9d0be914d18.tar.gz crawl-ref-a57d484bd70f19a06271202fd5e5a9d0be914d18.zip |
Fix mimics not teleporting when attacked by reaching or airstrike, and a
few (really) minor adjustments on monster pathfinding.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5487 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/it_use3.cc')
-rw-r--r-- | crawl-ref/source/it_use3.cc | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 8207395be4..28598708e0 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -288,13 +288,12 @@ static bool reaching_weapon_attack(const item_def& wpn) // here to prevent scumming...but that would just encourage // finding popcorn monsters. mpr("You attack empty space."); - return true; + return (true); } - /* BCR - Added a check for monsters in the way. Only checks cardinal - * directions. Knight moves are ignored. Assume the weapon - * slips between the squares. - */ + // BCR - Added a check for monsters in the way. Only checks cardinal + // directions. Knight moves are ignored. Assume the weapon + // slips between the squares. // If we're attacking more than a space away... if (x_distance > 1 || y_distance > 1) @@ -302,6 +301,7 @@ static bool reaching_weapon_attack(const item_def& wpn) const int x_middle = MAX(beam.tx, you.x_pos) - (x_distance / 2); const int y_middle = MAX(beam.ty, you.y_pos) - (y_distance / 2); + bool success = false; // If either the x or the y is the same, we should check for // a monster: if ((beam.tx == you.x_pos || beam.ty == you.y_pos) @@ -312,24 +312,34 @@ static bool reaching_weapon_attack(const item_def& wpn) if ((5 + (3 * skill)) > random2(40)) { mpr("You reach to attack!"); - you_attack(mgrd[beam.tx][beam.ty], false); + success = you_attack(mgrd[beam.tx][beam.ty], false); } else { mpr("You could not reach far enough!"); - return true; + return (true); } } else { mpr("You reach to attack!"); - you_attack(mgrd[beam.tx][beam.ty], false); + success = you_attack(mgrd[beam.tx][beam.ty], false); + } + if (success) + { + int mid = mgrd[beam.tx][beam.ty]; + if (mid != NON_MONSTER) + { + monsters *mon = &menv[mgrd[beam.tx][beam.ty]]; + if (mons_is_mimic( mon->type )) + mimic_alert(mon); + } } } else you_attack(mgrd[beam.tx][beam.ty], false); - return true; + return (true); } // end reaching_weapon_attack() static bool evoke_horn_of_geryon() |