summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 18:14:37 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 18:14:37 +0000
commit9a21a52ed2311e7c93ee5129414867acc4661389 (patch)
treea106af0f6fefbc9cc06a9c50ff78f92411a244ac
parenta5cc86cbd8bbfd53f3ce5321784e64d37fdc8cac (diff)
downloadcrawl-ref-9a21a52ed2311e7c93ee5129414867acc4661389.tar.gz
crawl-ref-9a21a52ed2311e7c93ee5129414867acc4661389.zip
Import 4.1 TSO stab warning.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1019 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/fight.cc13
-rw-r--r--crawl-ref/source/fight.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 889bbe7552..4edc91c03f 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -343,6 +343,7 @@ melee_attack::melee_attack(actor *attk, actor *defn,
bool allow_unarmed, int which_attack)
: attacker(attk), defender(defn),
atk(NULL), def(NULL),
+ cancel_attack(false),
did_hit(false), perceived_attack(false),
needs_message(false), attacker_visible(false), defender_visible(false),
unarmed_ok(allow_unarmed),
@@ -491,6 +492,9 @@ bool melee_attack::player_attack()
player_apply_attack_delay();
player_stab_check();
+ if (cancel_attack)
+ return (false);
+
if (player_hits_monster())
{
did_hit = true;
@@ -2119,6 +2123,15 @@ void melee_attack::player_stab_check()
if (stab_attempt && roll_needed)
stab_attempt = (random2(200) <= you.skills[SK_STABBING] + you.dex);
+ if (stab_attempt && you.religion == GOD_SHINING_ONE)
+ {
+ if (!yesno("Really attack this helpless creature?", false, 'n'))
+ {
+ stab_attempt = false;
+ cancel_attack = true;
+ }
+ }
+
// check for invisibility - no stabs on invisible monsters.
if (!player_monster_visible( def ))
{
diff --git a/crawl-ref/source/fight.h b/crawl-ref/source/fight.h
index 2d1d6d6260..ed22a29180 100644
--- a/crawl-ref/source/fight.h
+++ b/crawl-ref/source/fight.h
@@ -64,6 +64,7 @@ public:
// If attacker and/or defender are monsters, these are set.
monsters *atk, *def;
+ bool cancel_attack;
bool did_hit, perceived_attack;
// If all or part of the action is visible to the player, we need a message.