diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-24 00:50:41 -0700 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-24 00:50:41 -0700 |
commit | a698d535913e0e222aa1635805a193cfdc5a592c (patch) | |
tree | cf1ab93915faff4003109d1483a8daf7a98c36dd /crawl-ref/source/item_use.cc | |
parent | 9c08ad575dfa4fbfcbdff5280a582a7846094f60 (diff) | |
download | crawl-ref-a698d535913e0e222aa1635805a193cfdc5a592c.tar.gz crawl-ref-a698d535913e0e222aa1635805a193cfdc5a592c.zip |
Don't use invisibility items when pointless
Since the game won't let you waste (known) scrolls or wand charges of
teleportation if it's known that you can't teleport (you're wearing an
identified artefact which prevents teleportation) do something similar
for invisiblity: if you're haloed because of worshipping TSO then
refuse to use known wands or potions of invisibility, and if you're
glowing from magical contamination then prompt before usage (since the
glow *might* wear off before the invisibility).
Also: 1) add some informational messages about the interaction of
invisibility and being backlit, 2) if you use-identify invisibility
while haloed then just print a message, but don't actually get the
invisibility duration.
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r-- | crawl-ref/source/item_use.cc | 43 |
1 files changed, 38 insertions, 5 deletions
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()) { |