summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-08-03 00:00:13 -0400
committerJesse Luehrs <doy@tozt.net>2014-08-03 00:02:37 -0400
commit9c2101feaf70c73fa1af6fd4a4c1680a560cccb1 (patch)
tree4052e59b30a60a39ae8e6a9dcea27b2f1f6a971d
parent3bfcae4341b28a616fad02823f0487faa81e450c (diff)
downloadcrawl-ref-9c2101feaf70c73fa1af6fd4a4c1680a560cccb1.tar.gz
crawl-ref-9c2101feaf70c73fa1af6fd4a4c1680a560cccb1.zip
prompt for stasis in between swapping amulets too (8708)
-rw-r--r--crawl-ref/source/delay.cc23
-rw-r--r--crawl-ref/source/invent.cc6
-rw-r--r--crawl-ref/source/invent.h1
3 files changed, 27 insertions, 3 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index a6a10ccaf8..2cfe33d0f0 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -864,8 +864,31 @@ static void _finish_delay(const delay_queue_item &delay)
break;
case DELAY_JEWELLERY_ON:
+ {
+ const item_def &item = you.inv[delay.parm1];
+
+ // recheck stasis here, since our condition may have changed since
+ // starting the amulet swap process
+ // just breaking here is okay because swapping jewellery is a one-turn
+ // action, so conceptually there is nothing to interrupt - in other
+ // words, this is equivalent to if the user took off the previous
+ // amulet and was slowed before putting the amulet of stasis on as a
+ // separate action on the next turn
+ if (nasty_stasis(item, OPER_PUTON))
+ {
+ string prompt = "Really put on ";
+ prompt += item.name(DESC_INVENTORY);
+ prompt += string(" while ")
+ + (you.duration[DUR_TELEPORT] ? "about to teleport" :
+ you.duration[DUR_SLOW] ? "slowed" : "hasted");
+ prompt += "?";
+ if (!yesno(prompt.c_str(), false, 'n'))
+ break;
+ }
+
puton_ring(delay.parm1, false);
break;
+ }
case DELAY_ARMOUR_ON:
_armour_wear_effects(delay.parm1);
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index b23998f894..f5101404ac 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -1683,7 +1683,7 @@ static bool _is_known_no_tele_item(const item_def &item)
return false;
}
-static bool _nasty_stasis(const item_def &item, operation_types oper)
+bool nasty_stasis(const item_def &item, operation_types oper)
{
return (oper == OPER_PUTON
&& (item.base_type == OBJ_JEWELLERY
@@ -1721,7 +1721,7 @@ bool needs_handle_warning(const item_def &item, operation_types oper)
return true;
}
- if (_nasty_stasis(item, oper))
+ if (nasty_stasis(item, oper))
return true;
if (oper == OPER_WIELD // unwielding uses OPER_WIELD too
@@ -1825,7 +1825,7 @@ bool check_warning_inscriptions(const item_def& item,
string prompt = "Really " + _operation_verb(oper) + " ";
prompt += (in_inventory(item) ? item.name(DESC_INVENTORY)
: item.name(DESC_A));
- if (_nasty_stasis(item, oper))
+ if (nasty_stasis(item, oper))
{
prompt += string(" while ")
+ (you.duration[DUR_TELEPORT] ? "about to teleport" :
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index 621986e878..8840e04d6a 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -229,5 +229,6 @@ bool item_is_wieldable(const item_def &item);
bool item_is_evokable(const item_def &item, bool reach = true,
bool known = false, bool all_wands = false,
bool msg = false, bool equip = true);
+bool nasty_stasis(const item_def &item, operation_types oper);
bool needs_handle_warning(const item_def &item, operation_types oper);
#endif