diff options
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() |