From 9a21a52ed2311e7c93ee5129414867acc4661389 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 11 Mar 2007 18:14:37 +0000 Subject: 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 --- crawl-ref/source/fight.cc | 13 +++++++++++++ crawl-ref/source/fight.h | 1 + 2 files changed, 14 insertions(+) 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. -- cgit v1.2.3-54-g00ecf