summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-11 16:13:36 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-11 16:13:36 +0530
commit89b4e230ad3bdc806ae058722c70441d49f5d9fe (patch)
treefef3ab5111d75ce5869881542267c9f848e1fe33 /crawl-ref/source/item_use.cc
parent5871154a2e85ccd38874e88dea22083ced372141 (diff)
downloadcrawl-ref-89b4e230ad3bdc806ae058722c70441d49f5d9fe.tar.gz
crawl-ref-89b4e230ad3bdc806ae058722c70441d49f5d9fe.zip
Amulet of stasis, first cut.
Amulets of stasis blocks: - Teleport self - Blink in all forms - Slowing - Hasting - Paralysis - Petrify - Berserker rage The amulet auto-ids the first time it triggers. The amulet does not affect existing conditions (such as an existing Haste spell or an existing post-berserk Slow).
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index ea2dd24dc7..542ed56a20 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -5856,6 +5856,49 @@ bool wearing_slot(int inv_slot)
return (false);
}
+bool item_blocks_teleport(bool permit_id)
+{
+ return (scan_artefacts(ARTP_PREVENT_TELEPORTATION)
+ || stasis_blocks_effect(permit_id, NULL));
+}
+
+bool stasis_blocks_effect(bool identify,
+ const char *msg, int noise,
+ const char *silenced_msg)
+{
+ if (wearing_amulet(AMU_STASIS))
+ {
+ item_def *amulet = you.slot_item(EQ_AMULET);
+
+ if (msg)
+ {
+ const std::string name(amulet? amulet->name(DESC_CAP_YOUR) :
+ "Something");
+ const std::string message =
+ make_stringf(msg, name.c_str());
+
+ if (noise)
+ {
+ if (!noisy(noise, you.pos(), message.c_str())
+ && silenced_msg)
+ {
+ mprf(silenced_msg, name.c_str());
+ }
+ }
+ else
+ {
+ mpr(message.c_str());
+ }
+ }
+
+ // In all cases, the amulet auto-ids if requested.
+ if (amulet && identify)
+ set_ident_type(*amulet, ID_KNOWN_TYPE);
+ return (true);
+ }
+ return (false);
+}
+
#ifdef USE_TILE
// Interactive menu for item drop/use.