summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-17 20:52:54 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-17 20:52:54 +0000
commit4b806f77ff9f7da60fd0faf201b8ab83f76ce457 (patch)
treec0ea487b56eb55ac5f4bb3929f85ec1e5a961213 /crawl-ref/source/misc.cc
parent4280b1792236d066241fd6c6f36e4900f032180a (diff)
downloadcrawl-ref-4b806f77ff9f7da60fd0faf201b8ab83f76ce457.tar.gz
crawl-ref-4b806f77ff9f7da60fd0faf201b8ab83f76ce457.zip
A number of small bug fixes:
* 2811005: unknown mimics being stabbable * 2818709: restrict monsters picking up stuff to 2 items per turn * 2820097: reintroduce prompts for firing _in the direction_ of allies and fix message * 2821462: returning from tutorial screen swallowing a keypress * 2822771: fire elementals could be placed in shallow water Also, Azrael is no longer generated in the Shoals/Swamp Also, implement the second part of FR 2820876: Xom will no longer confuse the player if there's adjacent deep water or lava. This restriction doesn't apply if Xom is feeling nasty (penance or bored) and there's also no checks for water/lava further away. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10255 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc42
1 files changed, 32 insertions, 10 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index b33c0c0c93..90d89d074f 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -3039,7 +3039,7 @@ std::string your_hand(bool plural)
}
bool stop_attack_prompt(const monsters *mon, bool beam_attack,
- bool beam_target)
+ coord_def beam_target)
{
ASSERT(!crawl_state.arena);
@@ -3049,6 +3049,7 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack,
bool retval = false;
bool prompt = false;
+ const bool mon_target = (beam_target == mon->pos());
const bool inSanctuary = (is_sanctuary(you.pos())
|| is_sanctuary(mon->pos()));
const bool wontAttack = mons_wont_attack(mon);
@@ -3063,13 +3064,34 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack,
if (isFriendly)
{
// Listed in the form: "your rat", "Blork the orc".
- snprintf(info, INFO_SIZE, "Really %s %s%s?",
- (beam_attack) ? (beam_target) ? "fire at"
- : "fire through"
- : "attack",
- mon->name(DESC_NOCAP_THE).c_str(),
- (inSanctuary) ? ", despite your sanctuary"
- : "");
+ std::string verb = "";
+ bool need_mon_name = true;
+ if (beam_attack)
+ {
+ verb = "fire ";
+ if (mon_target)
+ verb += "at ";
+ else if (you.pos() < beam_target && beam_target < mon->pos()
+ || you.pos() > beam_target && beam_target > mon->pos())
+ {
+ verb += "in " + mon->name(DESC_NOCAP_THE) + "'s direction";
+ need_mon_name = false;
+ }
+ else
+ {
+ verb += "through ";
+ }
+ }
+ else
+ verb = "attack ";
+
+ if (need_mon_name)
+ verb += mon->name(DESC_NOCAP_THE);
+
+ snprintf(info, INFO_SIZE, "Really %s%s?",
+ verb.c_str(),
+ (inSanctuary) ? ", despite your sanctuary" : "");
+
prompt = true;
}
else if (inSanctuary || wontAttack
@@ -3079,8 +3101,8 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack,
&& !tso_unchivalric_attack_safe_monster(mon))
{
snprintf(info, INFO_SIZE, "Really %s the %s%s%s%s%s?",
- (beam_attack) ? (beam_target) ? "fire at"
- : "fire through"
+ (beam_attack) ? (mon_target) ? "fire at"
+ : "fire through"
: "attack",
(isUnchivalric) ? "helpless "
: "",