summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-13 08:30:23 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-13 08:30:23 +0000
commitb2785dc1f36e4f1dae161a3207ac25e083ba68b1 (patch)
treedc3acd27d0c2890534899f01115247839b4147ca /crawl-ref
parentf2903290696c79d076a099db8b0eba67793ddbb9 (diff)
downloadcrawl-ref-b2785dc1f36e4f1dae161a3207ac25e083ba68b1.tar.gz
crawl-ref-b2785dc1f36e4f1dae161a3207ac25e083ba68b1.zip
Cleaned up magic mapping: the test regarding whether you can magic map
is done inside magic_mapping(), which now returns a bool success value. Functionally: this means that the randart magic mapping power can no longer map the Abyss or labyrinths, ditto Map card. We can change this part back if we want. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1851 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/abl-show.cc9
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/decks.cc3
-rw-r--r--crawl-ref/source/it_use3.cc12
-rw-r--r--crawl-ref/source/item_use.cc15
-rw-r--r--crawl-ref/source/spl-cast.cc13
-rw-r--r--crawl-ref/source/view.cc11
-rw-r--r--crawl-ref/source/view.h6
8 files changed, 37 insertions, 34 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index a3d18c9dae..c19f33abb7 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -955,10 +955,11 @@ static bool do_ability(const ability_def& abil)
break;
case ABIL_EVOKE_MAPPING: // randarts
- mpr("You sense your surroundings.");
-
- magic_mapping( 3 + roll_dice( 2, you.skills[SK_EVOCATIONS] ),
- 40 + roll_dice( 2, you.skills[SK_EVOCATIONS] ) );
+ 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
+ mpr("You feel momentarily disoriented.");
exercise( SK_EVOCATIONS, 1 );
break;
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 8b518d2eff..ab0a4594db 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -717,7 +717,7 @@ static void handle_wizard_command( void )
break;
case '{':
- magic_mapping(1000, 100);
+ magic_mapping(1000, 100, true);
break;
case '@':
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index e35dfa1eef..2bf1bda9db 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1187,7 +1187,8 @@ void card_effect(card_type which_card, deck_rarity_type rarity)
break;
case CARD_MAP:
- magic_mapping( random2(power/10) + 15, random2(power) );
+ if (!magic_mapping( random2(power/10) + 15, random2(power) ))
+ mpr("The map is blank.");
break;
case CARD_BANSHEE: mass_enchantment(ENCH_FEAR, power, MHITYOU); break;
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 52cd5065ad..15296e5a3e 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -697,19 +697,19 @@ static bool ball_of_seeing(void)
{
confuse_player( 10 + random2(10), false );
}
- else if (use < 15
- || (you.level_type == LEVEL_LABYRINTH &&
- you.species != SP_MINOTAUR)
- || you.level_type == LEVEL_ABYSS || coinflip())
+ else if (use < 15 || coinflip())
{
mpr("You see nothing.");
}
- else
+ else if (magic_mapping( 15, 50 + random2( you.skills[SK_EVOCATIONS])))
{
mpr("You see a map of your surroundings!");
- magic_mapping( 15, 50 + random2( you.skills[SK_EVOCATIONS] ) );
ret = true;
}
+ else
+ {
+ mpr("You see nothing.");
+ }
return (ret);
} // end ball_of_seeing()
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 43ae1f47d4..183c7d3d14 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3399,17 +3399,12 @@ void read_scroll(void)
break;
case SCR_MAGIC_MAPPING:
- if ( (you.level_type == LEVEL_LABYRINTH && you.species != SP_MINOTAUR)
- || you.level_type == LEVEL_ABYSS)
- {
- mpr("You feel momentarily disoriented.");
- id_the_scroll = false;
- }
- else
- {
+ id_the_scroll = magic_mapping(50, 90 + random2(11));
+
+ if ( id_the_scroll )
mpr("You feel aware of your surroundings.");
- magic_mapping(50, 90 + random2(11));
- }
+ else
+ mpr("You feel momentarily disoriented.");
break;
case SCR_TORMENT:
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index ab2d4d648f..9f62c54a46 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1242,16 +1242,17 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_MAGIC_MAPPING:
- if ( (you.level_type == LEVEL_LABYRINTH && you.species != SP_MINOTAUR)
- || you.level_type == LEVEL_ABYSS)
- mpr("You feel momentarily disoriented.");
- else if (you.level_type == LEVEL_PANDEMONIUM)
+ if (you.level_type == LEVEL_PANDEMONIUM)
+ {
mpr("Your Earth magic cannot map Pandemonium.");
+ }
else
{
- mpr( "You feel aware of your surroundings." );
powc = stepdown_value( powc, 10, 10, 40, 45 );
- magic_mapping( 5 + powc, 50 + random2avg( powc * 2, 2 ) );
+ if ( magic_mapping( 5 + powc, 50 + random2avg( powc * 2, 2 ) ) )
+ mpr( "You feel aware of your surroundings." );
+ else
+ mpr("You feel momentarily disoriented.");
}
break;
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index bd31e5be63..a1f462e987 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -2976,8 +2976,16 @@ void show_map( FixedVector<int, 2> &spec_place, bool travel_mode )
} // end show_map()
-void magic_mapping(int map_radius, int proportion)
+// Returns true if succeeded
+bool magic_mapping(int map_radius, int proportion, bool force)
{
+ if (!force &&
+ ((you.level_type == LEVEL_ABYSS) ||
+ (you.level_type == LEVEL_LABYRINTH && you.species != SP_MINOTAUR)))
+ {
+ return false;
+ }
+
int i, j, k, l, empty_count;
if (map_radius > 50 && map_radius != 1000)
@@ -3060,6 +3068,7 @@ void magic_mapping(int map_radius, int proportion)
}
}
}
+ return true;
} // end magic_mapping()
// realize that this is simply a repackaged version of
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index b48cef660b..eae097e772 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -61,11 +61,7 @@ void losight(FixedArray<unsigned int, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER>& sh,
int x_p, int y_p);
-// last updated 12may2000 {dlb}
-/* ***********************************************************************
- * called from: ability - acr - it_use3 - item_use - spell
- * *********************************************************************** */
-void magic_mapping(int map_radius, int proportion);
+bool magic_mapping(int map_radius, int proportion, bool force = false);
// last updated 12may2000 {dlb}