summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc54
1 files changed, 2 insertions, 52 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 9fc6b6350a..e61a9ba80b 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -4175,56 +4175,6 @@ static bool _beam_is_harmless(bolt &beam, monsters *mon)
}
}
-static bool _stop_unchivalric_attack(monsters *mon, bool target)
-{
- const bool inSanctuary = (is_sanctuary(you.x_pos, you.y_pos)
- || is_sanctuary(mon->x, mon->y));
- const bool wontAttack = mons_wont_attack(mon);
- const bool isFriendly = mons_friendly(mon);
- const bool isNeutral = mons_neutral(mon);
- const bool isUnchivalric = is_unchivalric_attack(&you, mon, mon);
- const bool isHoly = mons_is_holy(mon);
-
- if (isFriendly)
- {
- // listed in the form: "your rat", "Blork"
- snprintf(info, INFO_SIZE, "Really fire %s %s%s?",
- (target) ? "at"
- : "through",
- mon->name(DESC_NOCAP_THE).c_str(),
- (inSanctuary) ? ", despite your sanctuary"
- : "");
-
- if (!yesno(info, true, 'n'))
- return (true);
- }
- else if (inSanctuary || wontAttack
- || is_good_god(you.religion) && (isNeutral || isHoly)
- || you.religion == GOD_SHINING_ONE && isUnchivalric)
- {
- // "Really fire through the helpless neutral holy Daeva?"
- // was: "Really fire through this helpless neutral holy creature?"
- snprintf(info, INFO_SIZE, "Really fire %s the %s%s%s%s%s?",
- (target) ? "at"
- : "through",
- (isUnchivalric) ? "helpless "
- : "",
- (isFriendly) ? "friendly " :
- (wontAttack) ? "non-hostile " :
- (isNeutral) ? "neutral "
- : "",
- (isHoly) ? "holy "
- : "",
- mon->name(DESC_PLAIN).c_str(),
- (inSanctuary) ? ", despite your sanctuary"
- : "");
-
- if (!yesno(info, true, 'n'))
- return (true);
- }
- return (false);
-}
-
// return amount of range used up by affectation of this monster
static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
{
@@ -4296,7 +4246,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
const bool target = (beam.target_x == mon->x
&& beam.target_y == mon->y);
- if (_stop_unchivalric_attack(mon, target))
+ if (stop_attack_prompt(mon, true, target))
{
beam.fr_count = 1;
return (BEAM_STOP);
@@ -4475,7 +4425,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
const bool target = (beam.target_x == mon->x
&& beam.target_y == mon->y);
- if (_stop_unchivalric_attack(mon, target))
+ if (stop_attack_prompt(mon, true, target))
{
beam.fr_count = 1;
return (BEAM_STOP);