From bdf7790e177b672f18af015211f2f69e84c6c1cb Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 13 Sep 2007 11:20:50 +0000 Subject: Cleaning up magic mapping. Patch by dolorous. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2078 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 35 ++++++++++++++++++++--------------- crawl-ref/source/acr.cc | 2 +- crawl-ref/source/decks.cc | 2 +- crawl-ref/source/it_use3.cc | 2 +- crawl-ref/source/item_use.cc | 16 +++++++++++----- crawl-ref/source/spl-cast.cc | 5 +---- crawl-ref/source/view.cc | 8 +++++++- crawl-ref/source/view.h | 3 ++- 8 files changed, 44 insertions(+), 29 deletions(-) diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 9fb84288f2..a36ec6d9f4 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -979,21 +979,29 @@ static bool do_ability(const ability_def& abil) break; case ABIL_EVOKE_MAPPING: // randarts - if ( magic_mapping( 3 + roll_dice( 2, you.skills[SK_EVOCATIONS]), - 40 + roll_dice( 2, you.skills[SK_EVOCATIONS]))) - mpr("You sense your surroundings."); - else + case ABIL_MAPPING: // Gnome + sense surrounds mut + if (abil.ability == ABIL_MAPPING && you.mutation[MUT_MAPPING] < 3 && + you.level_type == LEVEL_PANDEMONIUM) + { mpr("You feel momentarily disoriented."); + return (false); + } - exercise( SK_EVOCATIONS, 1 ); - break; + power = (abil.ability == ABIL_EVOKE_MAPPING) ? + you.skills[SK_EVOCATIONS] : you.experience_level; - case ABIL_MAPPING: // Gnome + sense surrounds mut - mpr("You sense your surroundings."); + if ( magic_mapping( 3 + roll_dice( 2, + (abil.ability == ABIL_EVOKE_MAPPING) ? power : + power + you.mutation[MUT_MAPPING] * 10), + 40 + roll_dice( 2, power), true) ) + { + mpr("You sense your surroundings."); + } + else + mpr("You feel momentarily disoriented."); - magic_mapping( 3 + roll_dice( 2, you.experience_level ) - + you.mutation[MUT_MAPPING] * 10, - 40 + roll_dice( 2, you.experience_level ) ); + if (abil.ability == ABIL_EVOKE_MAPPING) + exercise( SK_EVOCATIONS, 1 ); break; case ABIL_EVOKE_TELEPORTATION: // ring of teleportation @@ -1911,11 +1919,8 @@ std::vector your_talents( bool check_confused ) } // Mutations - if ((you.level_type == LEVEL_DUNGEON && you.mutation[MUT_MAPPING]) || - (you.level_type == LEVEL_PANDEMONIUM && you.mutation[MUT_MAPPING]==3)) - { + if (you.mutation[MUT_MAPPING]) add_talent(talents, ABIL_MAPPING, check_confused ); - } if (you.mutation[MUT_SUMMON_MINOR_DEMONS]) add_talent(talents, ABIL_SUMMON_MINOR_DEMON, check_confused ); diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 98a3697da4..f22d2fbf48 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -789,7 +789,7 @@ static void handle_wizard_command( void ) break; case '{': - magic_mapping(1000, 100, true); + magic_mapping(1000, 100, true, true); break; case '@': diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 950b5b93a1..1f58a6a8c3 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1309,7 +1309,7 @@ void card_effect(card_type which_card, deck_rarity_type rarity) break; case CARD_MAP: - if (!magic_mapping( random2(power/10) + 15, random2(power) )) + if (!magic_mapping( random2(power/10) + 15, random2(power), true)) mpr("The map is blank."); break; diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 38b54860be..306a9f0fe8 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -707,7 +707,7 @@ static bool ball_of_seeing(void) { mpr("You see nothing."); } - else if (magic_mapping( 15, 50 + random2( you.skills[SK_EVOCATIONS]))) + else if (magic_mapping( 15, 50 + random2( you.skills[SK_EVOCATIONS]), true)) { mpr("You see a map of your surroundings!"); ret = true; diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 7b92068049..aad322f3c9 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3640,12 +3640,18 @@ void read_scroll(void) break; case SCR_MAGIC_MAPPING: - id_the_scroll = magic_mapping(50, 90 + random2(11)); - - if ( id_the_scroll ) - mpr("You feel aware of your surroundings."); + if (you.level_type == LEVEL_PANDEMONIUM) + { + if (!item_type_known(scroll)) + { + mpr("You feel momentarily disoriented."); + id_the_scroll = false; + } + else + mpr("Your Earth magic cannot map Pandemonium."); + } else - mpr("You feel momentarily disoriented."); + id_the_scroll = magic_mapping(50, 90 + random2(11), false); break; case SCR_TORMENT: diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 5030564ed4..dbbc362fae 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1258,10 +1258,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) else { powc = stepdown_value( powc, 10, 10, 40, 45 ); - if ( magic_mapping( 5 + powc, 50 + random2avg( powc * 2, 2 ) ) ) - mpr( "You feel aware of your surroundings." ); - else - mpr("You feel momentarily disoriented."); + magic_mapping( 5 + powc, 50 + random2avg( powc * 2, 2 ), false ); } break; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index e29439e195..6a22de3464 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -3159,15 +3159,21 @@ void show_map( FixedVector &spec_place, bool travel_mode ) // Returns true if succeeded -bool magic_mapping(int map_radius, int proportion, bool force) +bool magic_mapping(int map_radius, int proportion, bool suppress_msg, + bool force) { if (!force && ((you.level_type == LEVEL_ABYSS) || (you.level_type == LEVEL_LABYRINTH && you.species != SP_MINOTAUR))) { + if (!suppress_msg) + mpr("You feel momentarily disoriented."); return false; } + if (!suppress_msg) + mpr( "You feel aware of your surroundings." ); + int i, j, k, l, empty_count; if (map_radius > 50 && map_radius != 1000) diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index ad1d962911..a595da556e 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -55,7 +55,8 @@ void losight(FixedArray& sh, int x_p, int y_p); -bool magic_mapping(int map_radius, int proportion, bool force = false); +bool magic_mapping(int map_radius, int proportion, bool suppress_msg, + bool force = false); // last updated 12may2000 {dlb} -- cgit v1.2.3-54-g00ecf