Permalink
Browse files

Make *enlightenment* potion reveal all monsters on the level

(cherry picked from commit 20132c15d2cadc1220df1666b8a02bd3d9218d08)
  • Loading branch information...
1 parent 63a8c83 commit 2174294518469d5dd6ed1bfeb95f95adadf8c9de Fizzix committed with magnate May 19, 2012
Showing with 34 additions and 29 deletions.
  1. +1 −0 src/effects.c
  2. +1 −0 src/spells.h
  3. +31 −0 src/spells2.c
  4. +1 −29 src/wizard.c
View
@@ -643,6 +643,7 @@ bool effect_do(effect_type effect, bool *ident, bool aware, int dir, int beam,
(void)detect_traps(TRUE);
(void)detect_doorstairs(TRUE);
(void)detect_treasure(TRUE, TRUE);
+ (void)detect_monsters_entire_level();
identify_pack();
*ident = TRUE;
return TRUE;
View
@@ -134,6 +134,7 @@ extern bool detect_close_buried_treasure(void);
extern bool detect_monsters_normal(bool aware);
extern bool detect_monsters_invis(bool aware);
extern bool detect_monsters_evil(bool aware);
+extern bool detect_monsters_entire_level(void);
extern bool detect_all(bool aware);
extern void stair_creation(void);
extern bool enchant(object_type *o_ptr, int n, int eflag);
View
@@ -1070,8 +1070,39 @@ bool detect_monsters_evil(bool aware)
return flag;
}
+/*
+ * Detect all monsters on the level (used for *enlightenment* only)
+ */
+bool detect_monsters_entire_level(void)
+{
+ int i;
+ bool detect = FALSE;
+
+ for (i = 1; i < cave_monster_max(cave); i++)
+ {
+ monster_type *m_ptr = cave_monster(cave, i);
+
+ /* Skip dead monsters */
+ if (!m_ptr->r_idx) continue;
+ /* Detect the monster */
+ m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ /* Update the monster */
+ update_mon(i, FALSE);
+
+ detect = TRUE;
+ }
+
+ if (detect)
+ msg("An image of all nearby life-forms appears in your mind");
+ else
+ /* Let's see who the first person is to ever see this message! */
+ msg("The level is devoid of life");
+
+ return detect;
+}
+
/*
* Detect everything
*/
View
@@ -1427,33 +1427,6 @@ static void do_cmd_wiz_zap(int d)
/*
- * Un-hide all monsters
- */
-static void do_cmd_wiz_unhide(int d)
-{
- int i;
-
- /* Process monsters */
- for (i = 1; i < cave_monster_max(cave); i++)
- {
- monster_type *m_ptr = cave_monster(cave, i);
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
-
- /* Skip distant monsters */
- if (m_ptr->cdis > d) continue;
-
- /* Detect the monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
-
- /* Update the monster */
- update_mon(i, FALSE);
- }
-}
-
-
-/*
* Query the dungeon
*/
static void do_cmd_wiz_query(void)
@@ -1994,8 +1967,7 @@ void do_cmd_debug(void)
/* Un-hide all monsters */
case 'u':
{
- if (p_ptr->command_arg <= 0) p_ptr->command_arg = 255;
- do_cmd_wiz_unhide(p_ptr->command_arg);
+ detect_monsters_entire_level();
break;
}

0 comments on commit 2174294

Please sign in to comment.