summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-13 10:25:22 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-13 10:25:22 +0000
commit2de657642dded89bf7f04024b5e7f6eb4a00a18a (patch)
treecfd04b8277b524ab8ed1c4fc8ba5635a7ba05983 /crawl-ref/source
parent3f3afe7a266723d33b84c19b09b45854dee24ebd (diff)
downloadcrawl-ref-2de657642dded89bf7f04024b5e7f6eb4a00a18a.tar.gz
crawl-ref-2de657642dded89bf7f04024b5e7f6eb4a00a18a.zip
FR 2819565: Abort when trying to read a known ?blinking or ?teleportation
or when zapping a known /teleportation at yourself if you know you have a -TELE artefact equipped. In the same situation, prompt when trying to evoke Blink or cast one of the teleportation spells, in case the player insists on training Evoc/Spellcasting/Translocations that way. Also, automatically update the autoinscriptions when tweaking artefact properties in wizard mode. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10532 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc8
-rw-r--r--crawl-ref/source/debug.cc8
-rw-r--r--crawl-ref/source/item_use.cc23
-rw-r--r--crawl-ref/source/spl-cast.cc19
4 files changed, 50 insertions, 8 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index aa6d1604eb..36435d4207 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1086,6 +1086,14 @@ static bool _check_ability_possible(const ability_def& abil,
}
return (true);
+ case ABIL_EVOKE_BLINK:
+ if (scan_artefacts(ARTP_PREVENT_TELEPORTATION, false))
+ {
+ return (yesno("You cannot teleport right now. Try anyway?",
+ true, 'n'));
+ }
+ return (true);
+
case ABIL_EVOKE_BERSERK:
case ABIL_TROG_BERSERK:
if (you.hunger_state < HS_SATIATED)
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index e9712ea131..2c2d6488fb 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1816,6 +1816,9 @@ static void _tweak_randart(item_def &item)
val);
break;
}
+
+ if (Options.autoinscribe_artefacts)
+ item.inscription = artefact_auto_inscription(item);
}
void wizard_tweak_object(void)
@@ -2077,10 +2080,7 @@ void wizard_make_object_randart()
}
if (Options.autoinscribe_artefacts)
- {
- add_autoinscription(item,
- artefact_auto_inscription(you.inv[i]));
- }
+ add_autoinscription(item, artefact_auto_inscription(you.inv[i]));
// If equipped, apply new randart benefits.
if (item_is_equipped(item))
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 6f9739d703..ab92e696e2 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3932,7 +3932,7 @@ void zap_wand(int slot)
}
int tracer_range = (alreadyknown && wand.sub_type != WAND_RANDOM_EFFECTS) ?
- _wand_range(type_zapped) : _max_wand_range();
+ _wand_range(type_zapped) : _max_wand_range();
message_current_target();
direction(zap_wand, DIR_NONE, targ_mode, tracer_range);
@@ -3943,6 +3943,14 @@ void zap_wand(int slot)
return;
}
+ if (alreadyknown && wand.sub_type == WAND_TELEPORTATION
+ && zap_wand.target == you.pos()
+ && scan_artefacts(ARTP_PREVENT_TELEPORTATION, false))
+ {
+ mpr("You cannot teleport right now.");
+ return;
+ }
+
if (!has_charges)
{
canned_msg(MSG_NOTHING_HAPPENS);
@@ -4838,6 +4846,16 @@ void read_scroll(int slot)
// Decrement and handle inventory if any scroll other than paper {dlb}:
const scroll_type which_scroll = static_cast<scroll_type>(scroll.sub_type);
+ const bool alreadyknown = item_type_known(scroll);
+
+ if (alreadyknown
+ && (which_scroll == SCR_BLINKING || which_scroll == SCR_TELEPORTATION)
+ && scan_artefacts(ARTP_PREVENT_TELEPORTATION, false))
+ {
+ mpr("You cannot teleport right now.");
+ return;
+ }
+
if (which_scroll != SCR_PAPER
&& (which_scroll != SCR_IMMOLATION || you.confused()))
{
@@ -4845,8 +4863,7 @@ void read_scroll(int slot)
// Actual removal of scroll done afterwards. -- bwr
}
- const bool alreadyknown = item_type_known(scroll);
- const bool dangerous = player_in_a_dangerous_place();
+ const bool dangerous = player_in_a_dangerous_place();
// Scrolls of paper are also exempted from this handling {dlb}:
if (which_scroll != SCR_PAPER)
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 0d6b7ed2b1..f549179ac8 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -279,7 +279,16 @@ int list_spells(bool toggle_with_I, bool viewing, int minRange)
{
const char letter = index_to_letter(i);
const spell_type spell = get_spell_by_letter(letter);
- if (!viewing)
+
+ // If an equipped artefact prevents teleportation, the following spells
+ // cannot be cast.
+ if ((spell == SPELL_BLINK || spell == SPELL_CONTROLLED_BLINK
+ || spell == SPELL_TELEPORT_SELF)
+ && scan_artefacts(ARTP_PREVENT_TELEPORTATION, false))
+ {
+ grey = true;
+ }
+ else if (!viewing)
{
if (spell_mana(spell) > you.magic_points
|| _spell_no_hostile_in_range(spell, minRange))
@@ -1128,6 +1137,14 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
if (!wiz_cast && _spell_is_uncastable(spell))
return (SPRET_ABORT);
+ if ((spell == SPELL_BLINK || spell == SPELL_CONTROLLED_BLINK
+ || spell == SPELL_TELEPORT_SELF)
+ && scan_artefacts(ARTP_PREVENT_TELEPORTATION, false)
+ && !yesno("You cannot teleport right now. Cast anyway?", true, 'n'))
+ {
+ return (SPRET_ABORT);
+ }
+
const unsigned int flags = get_spell_flags(spell);
ASSERT(wiz_cast || !(flags & SPFLAG_TESTING));