summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/it_use2.cc29
-rw-r--r--crawl-ref/source/item_use.cc43
-rw-r--r--crawl-ref/source/player.cc6
3 files changed, 69 insertions, 9 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index d8df5b0b79..4184cc0df0 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -296,9 +296,32 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known)
break;
case POT_INVISIBILITY:
- mpr(!you.duration[DUR_INVIS] ? "You fade into invisibility!"
- : "You fade further into invisibility.",
+ if (you.haloed())
+ {
+ // You can't turn invisible while haloed, but identify the
+ // effect anyways.
+ mpr("You briefly turn translucent.");
+
+ // And also cancel backlight (for whatever good that will
+ // do).
+ you.duration[DUR_BACKLIGHT] = 0;
+ return (true);
+ }
+
+ if (get_contamination_level() > 0)
+ {
+ mprf(MSGCH_DURATION,
+ "You become %stransparent, but the glow from your "
+ "magical contamination prevents you from becoming "
+ "completely invisible.",
+ you.duration[DUR_INVIS] ? "further " : "");
+ }
+ else
+ {
+ mpr(!you.duration[DUR_INVIS] ? "You fade into invisibility!"
+ : "You fade further into invisibility.",
MSGCH_DURATION);
+ }
// Invisibility cancels backlight.
you.duration[DUR_BACKLIGHT] = 0;
@@ -311,8 +334,6 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known)
if (you.duration[DUR_INVIS] > 100)
you.duration[DUR_INVIS] = 100;
-
- you.duration[DUR_BACKLIGHT] = 0;
break;
case POT_PORRIDGE: // oatmeal - always gluggy white/grey?
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index a1e1f49fa2..21aa961a73 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3850,6 +3850,26 @@ int _max_wand_range()
return (8);
}
+static bool _dont_use_invis()
+{
+ if (!you.backlit())
+ return (false);
+
+ if (you.haloed())
+ {
+ mpr("You can't turn invisible.");
+ return (true);
+ }
+ else if (get_contamination_level() > 0
+ && !yesno("Invisibility will do you no good right now; "
+ "use anyways?"))
+ {
+ return (true);
+ }
+
+ return (false);
+}
+
void zap_wand(int slot)
{
if (player_in_bat_form())
@@ -3964,12 +3984,19 @@ void zap_wand(int slot)
return;
}
- if (alreadyknown && wand.sub_type == WAND_TELEPORTATION
- && zap_wand.target == you.pos()
- && scan_artefacts(ARTP_PREVENT_TELEPORTATION, false))
+ if (alreadyknown && zap_wand.target == you.pos())
{
- mpr("You cannot teleport right now.");
- return;
+ if (wand.sub_type == WAND_TELEPORTATION
+ && scan_artefacts(ARTP_PREVENT_TELEPORTATION, false))
+ {
+ mpr("You cannot teleport right now.");
+ return;
+ }
+ else if (wand.sub_type == WAND_INVISIBILITY
+ && _dont_use_invis())
+ {
+ return;
+ }
}
if (!has_charges)
@@ -4157,6 +4184,12 @@ void drink(int slot)
return;
}
+ if (alreadyknown && potion.sub_type == POT_INVISIBILITY
+ && _dont_use_invis())
+ {
+ return;
+ }
+
if (alreadyknown && potion.sub_type == POT_BERSERK_RAGE
&& !berserk_check_wielded_weapon())
{
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 148af8e8f3..3f196501c7 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5179,6 +5179,12 @@ void contaminate_player(int change, bool controlled, bool status_only)
if (change > 0)
xom_is_stimulated(new_level * 32);
+
+ if (new_level == 0 && you.duration[DUR_INVIS] && !you.backlit())
+ {
+ mpr("You fade completely from view now that you are no longer "
+ "glowing from magical contamination.");
+ }
}
else if (old_level == 0 && old_amount > 0 && you.magic_contamination == 0)
mpr("Your magical contamination has completely faded away.");