summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-24 20:50:10 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-24 20:50:10 +0000
commitb3f9dc0237ef7b87dffd6867b4ffeace74e28851 (patch)
tree6aaada2799fe53ede3042bf9371d926543d094e5 /crawl-ref/source/fight.cc
parentf94892e5a68c91cfa0a6e46273d61594b2691aef (diff)
downloadcrawl-ref-b3f9dc0237ef7b87dffd6867b4ffeace74e28851.tar.gz
crawl-ref-b3f9dc0237ef7b87dffd6867b4ffeace74e28851.zip
And put it in the right place again.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5222 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc26
1 files changed, 7 insertions, 19 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 2c43f2ed25..4c84221a77 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -517,23 +517,6 @@ void melee_attack::identify_mimic(monsters *mon)
bool melee_attack::attack()
{
- if (attacker->atype() == ACT_PLAYER && defender->atype() == ACT_MONSTER)
- {
- if (is_sanctuary(you.x_pos, you.y_pos)
- || is_sanctuary(def->x, def->y))
- {
- snprintf(info, INFO_SIZE,
- "Really attack %s, despite your sanctuary?",
- def->name(DESC_NOCAP_THE).c_str());
-
- if (!yesno(info, true, 'n'))
- {
- cancel_attack = true;
- return (false);
- }
- }
- }
-
// If a mimic is attacking or defending, it is thereafter known.
identify_mimic(atk);
identify_mimic(def);
@@ -624,17 +607,19 @@ bool melee_attack::attack()
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 (wontAttack
+ if (inSanctuary || wontAttack
|| (is_good_god(you.religion) && (isNeutral || isHoly))
|| (you.religion == GOD_SHINING_ONE && isUnchivalric))
{
- snprintf(info, INFO_SIZE, "Really attack this %s%s%screature?",
+ snprintf(info, INFO_SIZE, "Really attack the %s%s%s%s%s?",
(isUnchivalric) ? "helpless "
: "",
(isFriendly) ? "friendly " :
@@ -642,6 +627,9 @@ bool melee_attack::attack()
(isNeutral) ? "neutral "
: "",
(isHoly) ? "holy "
+ : "",
+ def->name(DESC_PLAIN).c_str(),
+ (inSanctuary) ? ", despite your sanctuary"
: "");
if (you.confused() || yesno(info, false, 'n'))