From 35129e9e324fd6464cb8799edfca960881a0dd09 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 24 Oct 2007 13:19:24 +0000 Subject: [1757174] Disallow mapping in labyrinths. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2536 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 5 +++-- crawl-ref/source/it_use3.cc | 7 +++++-- crawl-ref/source/spl-book.cc | 13 +++++++++---- crawl-ref/source/spl-cast.cc | 17 ++++++++++++++--- crawl-ref/source/spl-cast.h | 3 ++- crawl-ref/source/spl-data.h | 8 ++++---- 6 files changed, 37 insertions(+), 16 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 6610746402..7dce230919 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1030,8 +1030,9 @@ static bool do_ability(const ability_def& abil) case ABIL_EVOKE_MAPPING: // randarts case ABIL_MAPPING: // Gnome + sense surrounds mut - if (abil.ability == ABIL_MAPPING && you.mutation[MUT_MAPPING] < 3 && - you.level_type == LEVEL_PANDEMONIUM) + if (abil.ability == ABIL_MAPPING && you.mutation[MUT_MAPPING] < 3 + && (you.level_type == LEVEL_PANDEMONIUM + || you.level_type == LEVEL_LABYRINTH)) { mpr("You feel momentarily disoriented."); return (false); diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 829c967ef9..6379dc4773 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -719,7 +719,8 @@ static bool ball_of_seeing(void) mpr("You gaze into the crystal ball."); - use = ((!you.duration[DUR_CONF]) ? random2(you.skills[SK_EVOCATIONS] * 6) : random2(5)); + use = ((!you.duration[DUR_CONF]) ? + random2(you.skills[SK_EVOCATIONS] * 6) : random2(5)); if (use < 2) { @@ -730,8 +731,10 @@ static bool ball_of_seeing(void) mpr("You feel power drain from you!"); set_mp(0, false); } - else if (use < 10) + else if (use < 10 || you.level_type == LEVEL_LABYRINTH) { + if (you.level_type == LEVEL_LABYRINTH) + mpr("You see a maze of twisty little passages, all alike."); confuse_player( 10 + random2(10), false ); } else if (use < 15 || coinflip()) diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 70b194e551..3e4383ce88 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -1499,17 +1499,22 @@ int staff_spell( int staff ) return (-1); } - // All checks passed, we can cast the spell - if (your_spells(spell, powc, false) == SPRET_ABORT) + const int flags = get_spell_flags(spell); + // Labyrinths block divinations. + if (you.level_type == LEVEL_LABYRINTH + && testbits(flags, SPFLAG_MAPPING)) + { + mpr("Something interferes with your magic!"); + } + // All checks passed, we can cast the spell + else if (your_spells(spell, powc, false) == SPRET_ABORT) { crawl_state.zero_turns_taken(); return (-1); } make_hungry( food, true ); - istaff.plus -= mana; - you.wield_change = true; you.turn_is_over = true; diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index e665d1d4d1..335aa9003e 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -944,7 +944,18 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) dec_penance(GOD_SIF_MUNA, 1); } - if (spfl < spell_fail(spell)) + const int spfail_chance = spell_fail(spell); + // Divination mappings backfire in Labyrinths. + if (you.level_type == LEVEL_LABYRINTH + && testbits(flags, SPFLAG_MAPPING)) + { + mprf(MSGCH_WARN, + "The warped magic of this place twists your " + "spell in on itself!"); + spfl = spfail_chance / 2 - 1; + } + + if (spfl < spfail_chance) { spellcasting_side_effects(spell, true); @@ -972,14 +983,14 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) // spells can be quite nasty: 9 * 9 * 90 / 500 = 15 // points of contamination! int nastiness = spell_mana(spell) * spell_mana(spell) - * (spell_fail(spell) - spfl) + 250; + * (spfail_chance - spfl) + 250; const int cont_points = div_rand_round(nastiness, 500); contaminate_player( cont_points ); miscast_effect( sptype, spell_mana(spell), - spell_fail(spell) - spfl, 100 ); + spfail_chance - spfl, 100 ); return (SPRET_FAIL); } diff --git a/crawl-ref/source/spl-cast.h b/crawl-ref/source/spl-cast.h index 350a07d6da..75f50d82ae 100644 --- a/crawl-ref/source/spl-cast.h +++ b/crawl-ref/source/spl-cast.h @@ -26,7 +26,8 @@ enum spflag_type SPFLAG_TARGETING_MASK = 0x000f, // used to test for targeting SPFLAG_HELPFUL = 0x0010, // TARG_FRIENDS used SPFLAG_NOT_SELF = 0x0020, // aborts on isMe - SPFLAG_UNHOLY = 0x0040 // counts at "unholy" + SPFLAG_UNHOLY = 0x0040, // counts at "unholy" + SPFLAG_MAPPING = 0x0080 // a mapping spell of some kind }; enum spret_type diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h index 812ba85aae..c50c5e40da 100644 --- a/crawl-ref/source/spl-data.h +++ b/crawl-ref/source/spl-data.h @@ -715,7 +715,7 @@ { SPELL_DETECT_TRAPS, "Detect Traps", SPTYP_DIVINATION, - SPFLAG_NONE, + SPFLAG_MAPPING, 2, 50, NULL, @@ -782,7 +782,7 @@ { SPELL_MAGIC_MAPPING, "Magic Mapping", SPTYP_DIVINATION | SPTYP_EARTH, - SPFLAG_NONE, + SPFLAG_MAPPING, 4, 45, NULL, @@ -879,7 +879,7 @@ { SPELL_DETECT_ITEMS, "Detect Items", SPTYP_DIVINATION, - SPFLAG_NONE, + SPFLAG_MAPPING, 2, 50, NULL, @@ -1385,7 +1385,7 @@ { SPELL_DETECT_CREATURES, "Detect Creatures", SPTYP_DIVINATION, - SPFLAG_NONE, + SPFLAG_MAPPING, 2, 60, // not 50, note the fuzz NULL, -- cgit v1.2.3-54-g00ecf