diff options
author | DracoOmega <draco_omega@live.com> | 2014-02-18 14:37:19 -0330 |
---|---|---|
committer | DracoOmega <draco_omega@live.com> | 2014-02-18 14:37:19 -0330 |
commit | ad7cece1c59deb97fd816d919baaf33ed630eeee (patch) | |
tree | d3640cef5eae61f597093555f29ab973518c2422 /crawl-ref/source/invent.cc | |
parent | 97ceb79f85d8a80c7aa045c3d1935548926396f6 (diff) | |
download | crawl-ref-ad7cece1c59deb97fd816d919baaf33ed630eeee.tar.gz crawl-ref-ad7cece1c59deb97fd816d919baaf33ed630eeee.zip |
Prompt when equipping a known -TELE item while currently teleporting
As opposed to only giving this warning for actual amulets of stasis.
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r-- | crawl-ref/source/invent.cc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index fc180ef66f..4b10fdb9cf 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -1668,21 +1668,38 @@ static string _operation_verb(operation_types oper) } } -static bool _nasty_stasis(const item_def &item, operation_types oper) -{ - return oper == OPER_PUTON - && item.base_type == OBJ_JEWELLERY - && item.sub_type == AMU_STASIS - && (you.duration[DUR_HASTE] || you.duration[DUR_SLOW] - || you.duration[DUR_TELEPORT] || you.duration[DUR_FINESSE]); -} - static bool _is_wielded(const item_def &item) { int equip = you.equip[EQ_WEAPON]; return equip != -1 && item.link == equip; } +static bool _is_known_no_tele_item(const item_def &item) +{ + if (!is_artefact(item)) + return false; + + bool known; + int val = artefact_wpn_property(item, ARTP_PREVENT_TELEPORTATION, known); + + if (known && val) + return true; + else + return false; +} + +static bool _nasty_stasis(const item_def &item, operation_types oper) +{ + return (oper == OPER_PUTON + && (item.base_type == OBJ_JEWELLERY + && item.sub_type == AMU_STASIS + && (you.duration[DUR_HASTE] || you.duration[DUR_SLOW] + || you.duration[DUR_TELEPORT] || you.duration[DUR_FINESSE]))) + || (oper == OPER_PUTON || oper == OPER_WEAR + || oper == OPER_WIELD && !_is_wielded(item)) + && (_is_known_no_tele_item(item) && you.duration[DUR_TELEPORT]); +} + bool needs_handle_warning(const item_def &item, operation_types oper) { if (_has_warning_inscription(item, oper)) |