diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-24 20:40:51 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-24 20:40:51 +0000 |
commit | f94892e5a68c91cfa0a6e46273d61594b2691aef (patch) | |
tree | 149de2b013197e1eaa2cf43cd65b9b7b3ec38f82 /crawl-ref/source/fight.cc | |
parent | b8850fdc437f685e22adcebf5a81ed5d5e3f05c4 (diff) | |
download | crawl-ref-f94892e5a68c91cfa0a6e46273d61594b2691aef.tar.gz crawl-ref-f94892e5a68c91cfa0a6e46273d61594b2691aef.zip |
Handle the warning prompt for melee attacks while in a sanctuary in
melee_attack::attack() instead of _move_player(), so that melee attacks
made using Ctrl-key sequences also show it.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5221 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 02b9016458..2c43f2ed25 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -517,6 +517,23 @@ 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); |