summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-21 04:30:40 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-21 04:30:40 +0000
commit069ab225fe3710059d8087049253e2f1c6ab80a5 (patch)
treeec17c5c75774da5eb00c1b9a3413c766ae7f9d72 /crawl-ref/source/spl-cast.cc
parent3bc5803595bf91439ca4805cec5f7f2bed0de72a (diff)
downloadcrawl-ref-069ab225fe3710059d8087049253e2f1c6ab80a5.tar.gz
crawl-ref-069ab225fe3710059d8087049253e2f1c6ab80a5.zip
[2496621] Disallowing detect spells in non-magic-mappable levels.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8642 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 45fe5cb012..4e26e41b5e 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -988,6 +988,15 @@ int _setup_evaporate_cast()
return rc;
}
+static bool _can_cast_detect()
+{
+ if (!testbits(env.level_flags, LFLAG_NO_MAGIC_MAP))
+ return true;
+
+ mprf("You feel disoriented.");
+ return false;
+}
+
// Returns SPRET_SUCCESS if spell is successfully cast for purposes of
// exercising, SPRET_FAIL otherwise, or SPRET_ABORT if the player canceled
// the casting.
@@ -2019,21 +2028,27 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
break;
case SPELL_DETECT_SECRET_DOORS:
- cast_detect_secret_doors(powc);
+ if (_can_cast_detect())
+ cast_detect_secret_doors(powc);
break;
case SPELL_DETECT_TRAPS:
- mprf("You detect %s", (detect_traps(powc) > 0) ? "traps!"
- : "nothing.");
+ if (_can_cast_detect())
+ mprf("You detect %s", (detect_traps(powc) > 0) ? "traps!"
+ : "nothing.");
break;
case SPELL_DETECT_ITEMS:
- mprf("You detect %s", (detect_items(powc) > 0) ? "items!"
- : "nothing.");
+ if (_can_cast_detect())
+ mprf("You detect %s", (detect_items(powc) > 0) ? "items!"
+ : "nothing.");
break;
case SPELL_DETECT_CREATURES:
{
+ if (!_can_cast_detect())
+ break;
+
const int prev_detected = count_detected_mons();
const int num_creatures = detect_creatures(powc);