summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-25 17:33:38 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-25 17:33:38 +0000
commit63e4083df060b3cdd0ce18d04949dd7831cc10d4 (patch)
tree67311940576728ec6be2d310256d1727b9a77d5a /crawl-ref/source/fight.cc
parent0eceb6ff8b8501d07c94e2e5d46aca19121b205e (diff)
downloadcrawl-ref-63e4083df060b3cdd0ce18d04949dd7831cc10d4.tar.gz
crawl-ref-63e4083df060b3cdd0ce18d04949dd7831cc10d4.zip
Consolidate the attack warning prompts for both melee and beams, and use
the prompts properly with Burn/Freeze, Smite, and Airstrike. Also, move the now-single function for this into misc.cc, since I can't think of a better location right now. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5235 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc44
1 files changed, 1 insertions, 43 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 5b326ddc20..f890bac0ef 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -606,49 +606,7 @@ bool melee_attack::attack()
conduct.enabled = false;
if (attacker->atype() == ACT_PLAYER)
- {
- const bool inSanctuary = (is_sanctuary(you.x_pos, you.y_pos)
- || is_sanctuary(def->x, def->y));
- const bool wontAttack = mons_wont_attack(def);
- const bool isFriendly = mons_friendly(def);
- const bool isNeutral = mons_neutral(def);
- const bool isUnchivalric = is_unchivalric_attack(&you, def, def);
- const bool isHoly = mons_is_holy(def);
-
- if (inSanctuary || wontAttack
- || (is_good_god(you.religion) && (isNeutral || isHoly))
- || (you.religion == GOD_SHINING_ONE && isUnchivalric))
- {
- snprintf(info, INFO_SIZE, "Really attack the %s%s%s%s%s?",
- (isUnchivalric) ? "helpless "
- : "",
- (isFriendly) ? "friendly " :
- (wontAttack) ? "non-hostile " :
- (isNeutral) ? "neutral "
- : "",
- (isHoly) ? "holy "
- : "",
- def->name(DESC_PLAIN).c_str(),
- (inSanctuary) ? ", despite your sanctuary"
- : "");
-
- if (you.confused() || yesno(info, false, 'n'))
- {
- if (isFriendly)
- conduct.set(DID_ATTACK_FRIEND, 5, true, def);
- else if (isNeutral)
- conduct.set(DID_ATTACK_NEUTRAL, 5, true, def);
-
- if (isUnchivalric)
- conduct.set(DID_UNCHIVALRIC_ATTACK, 4, true, def);
-
- if (isHoly)
- conduct.set(DID_ATTACK_HOLY, def->hit_dice, true, def);
- }
- else
- cancel_attack = true;
- }
- }
+ cancel_attack = stop_attack_prompt(def, false, false, &conduct);
// Trying to stay general beyond this point is a recipe for insanity.
// Maybe when Stone Soup hits 1.0... :-)