/* File: spells2.c */
-/* Purpose: Spell code (part 2) */
-
/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies. Other copyrights may also apply.
*/
+/* Purpose: Spell code (part 2) */
+
#include "angband.h"
+#include "grid.h"
/*
break;
case CLASS_BEASTMASTER:
#ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï1ɤ¤ÎÀ¸Ì¿¤Î¤¢¤ë¥â¥ó¥¹¥¿¡¼¤ò»ÙÇÛ¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£(¥ì¥Ù¥ë/4 MP)";
+info[i++] = "¤¢¤Ê¤¿¤Ï1ÂΤÎÀ¸Ì¿¤Î¤¢¤ë¥â¥ó¥¹¥¿¡¼¤ò»ÙÇÛ¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£(¥ì¥Ù¥ë/4 MP)";
#else
info[i++] = "You can dominate a monster (cost level/4).";
#endif
}
break;
case CLASS_BERSERKER:
- if (plev > 4)
- {
-#ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¼«Ê¬¤Ç¶õÊ¢¤òËþ¤¿¤¹¤³¤È¤¬¤Ç¤¤ë¡£";
-#else
- info[i++] = "You can satisfy hunger.";
-#endif
- }
if (plev > 9)
{
#ifdef JP
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÎÉð´ï¤Ï¹¶·â¤ò³°¤·¤ä¤¹¤¤¡£";
#else
- info[i++] = "Your weapon causes you miss blows.";
+ info[i++] = "Your weapon causes you to miss blows.";
#endif
}
#endif
}
- if (p_ptr->blessed)
+ if (IS_BLESSED())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï¸øÀµ¤µ¤ò´¶¤¸¤Æ¤¤¤ë¡£";
#endif
}
- if (p_ptr->hero)
+ if (IS_HERO())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï¥Ò¡¼¥í¡¼µ¤Ê¬¤À¡£";
#endif
}
- if (p_ptr->invuln)
+ if (IS_INVULN())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï¸½ºß½ý¤Ä¤«¤Ê¤¤¡£";
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤Ï²Ð±ê¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
#else
- info[i++] = "You can strike enemy with flame.";
+ info[i++] = "You can strike the enemy with flame.";
#endif
}
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÎ䵤¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
#else
- info[i++] = "You can strike enemy with cold.";
+ info[i++] = "You can strike the enemy with cold.";
#endif
}
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤Ï»À¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
#else
- info[i++] = "You can strike enemy with acid.";
+ info[i++] = "You can strike the enemy with acid.";
#endif
}
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
#else
- info[i++] = "You can strike enemy with electoric shock.";
+ info[i++] = "You can strike the enemy with electoric shock.";
#endif
}
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÆǤËʤ¤ï¤ì¤Æ¤¤¤ë¡£";
#else
- info[i++] = "You can strike enemy with poison.";
+ info[i++] = "You can strike the enemy with poison.";
#endif
}
#endif
}
+ if (p_ptr->alter_reality)
+ {
+#ifdef JP
+ info[i++] = "¤¢¤Ê¤¿¤Ï¤¹¤°¤Ë¤³¤ÎÀ¤³¦¤òÎ¥¤ì¤ë¤À¤í¤¦¡£";
+#else
+ info[i++] = "You will soon be altered.";
+#endif
+
+ }
if (p_ptr->see_infra)
{
#ifdef JP
#endif
}
- if (p_ptr->ffall)
+ if (p_ptr->levitation)
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÈô¤Ö¤³¤È¤¬¤Ç¤¤ë¡£";
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÎ䵤¤Î¥ª¡¼¥é¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£";
#else
- info[i++] = "You are surrounded with a coldly aura.";
+ info[i++] = "You are surrounded with an aura of coldness.";
#endif
}
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï¹ÔÆ°¤ÎÁ°¤Ë´í¸±¤ò»¡ÃΤ¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£";
#else
- info[i++] = "You will be warn before dangerous action.";
+ info[i++] = "You will be warned before dangerous actions.";
#endif
}
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï¾¯¤Ê¤¤¾ÃÈñËâÎϤÇËâË¡¤ò¾§¤¨¤ë¤³¤È¤¬¤Ç¤¤ë¡£";
#else
- info[i++] = "You can cast spell with fewer mana.";
+ info[i++] = "You can cast spells with fewer mana points.";
#endif
}
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï¹â¤¤¼ºÇÔΨ¤ÇËâË¡¤ò¾§¤¨¤Ê¤±¤ì¤Ð¤¤¤±¤Ê¤¤¡£";
#else
- info[i++] = "Fail rate of your magic is incresed.";
+ info[i++] = "Fail rate of your magic is increased.";
#endif
}
#endif
}
- else if ((p_ptr->resist_acid) && (p_ptr->oppose_acid))
+ else if (p_ptr->resist_acid && IS_OPPOSE_ACID())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï»À¤Ø¤Î¶¯ÎϤÊÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_acid) || (p_ptr->oppose_acid))
+ else if (p_ptr->resist_acid || IS_OPPOSE_ACID())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï»À¤Ø¤ÎÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_elec) && (p_ptr->oppose_elec))
+ else if (p_ptr->resist_elec && IS_OPPOSE_ELEC())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÅÅ·â¤Ø¤Î¶¯ÎϤÊÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_elec) || (p_ptr->oppose_elec))
+ else if (p_ptr->resist_elec || IS_OPPOSE_ELEC())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÅÅ·â¤Ø¤ÎÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_fire) && (p_ptr->oppose_fire))
+ else if (p_ptr->resist_fire && IS_OPPOSE_FIRE())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï²Ð¤Ø¤Î¶¯ÎϤÊÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_fire) || (p_ptr->oppose_fire))
+ else if (p_ptr->resist_fire || IS_OPPOSE_FIRE())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤Ï²Ð¤Ø¤ÎÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_cold) && (p_ptr->oppose_cold))
+ else if (p_ptr->resist_cold && IS_OPPOSE_COLD())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÎ䵤¤Ø¤Î¶¯ÎϤÊÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_cold) || (p_ptr->oppose_cold))
+ else if (p_ptr->resist_cold || IS_OPPOSE_COLD())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÎ䵤¤Ø¤ÎÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
}
- if ((p_ptr->resist_pois) && (p_ptr->oppose_pois))
+ if (p_ptr->resist_pois && IS_OPPOSE_POIS())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÆǤؤζ¯ÎϤÊÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
#endif
}
- else if ((p_ptr->resist_pois) || (p_ptr->oppose_pois))
+ else if (p_ptr->resist_pois || IS_OPPOSE_POIS())
{
#ifdef JP
info[i++] = "¤¢¤Ê¤¿¤ÏÆǤؤÎÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
{
info2[i] = report_magics_aux(p_ptr->word_recall);
#ifdef JP
-info[i++] = "¤³¤Î¸åµ¢´Ô¤Î¾Û¤òȯư¤¹¤ë¡£";
+ info[i++] = "¤³¤Î¸åµ¢´Ô¤Î¾Û¤òȯư¤¹¤ë¡£";
+#else
+ info[i++] = "You are waiting to be recalled";
+#endif
+
+ }
+ if (p_ptr->alter_reality)
+ {
+ info2[i] = report_magics_aux(p_ptr->alter_reality);
+#ifdef JP
+ info[i++] = "¤³¤Î¸å¸½¼ÂÊÑÍƤ¬È¯Æ°¤¹¤ë¡£";
#else
- info[i++] = "You waiting to be recalled";
+ info[i++] = "You waiting to be altered";
#endif
}
}
-/*
- * Detect all traps on current panel
- */
-bool detect_traps(int range)
+static bool detect_feat_flag(int range, int flag, bool known)
{
- int x, y;
- bool detect = FALSE;
- cave_type *c_ptr;
-
+ int x, y;
+ bool detect = FALSE;
+ cave_type *c_ptr;
if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
/* Access the grid */
c_ptr = &cave[y][x];
- /* Mark as detected */
- if (dist <= range)
+ /* Hack -- Safe */
+ if (flag == FF_TRAP)
{
- if (dist <= range - 1)
- c_ptr->info |= (CAVE_IN_DETECT);
-
- c_ptr->info &= ~(CAVE_UNSAFE);
+ /* Mark as detected */
+ if (dist <= range && known)
+ {
+ if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
- /* Redraw */
- lite_spot(y, x);
- }
+ c_ptr->info &= ~(CAVE_UNSAFE);
- /* Detect invisible traps */
- if (c_ptr->info & CAVE_TRAP)
- {
- /* Pick a trap */
- pick_trap(y, x);
+ /* Redraw */
+ lite_spot(y, x);
+ }
}
- /* Detect traps */
- if (is_trap(c_ptr->feat))
+ /* Detect flags */
+ if (cave_have_flag_grid(c_ptr, flag))
{
- if (c_ptr->feat == FEAT_INVIS)
- c_ptr->feat = FEAT_TRAP_OPEN;
+ /* Detect secrets */
+ disclose_grid(y, x);
/* Hack -- Memorize */
c_ptr->info |= (CAVE_MARK);
}
}
- p_ptr->dtrap = TRUE;
+ /* Result */
+ return detect;
+}
+
+
+/*
+ * Detect all traps on current panel
+ */
+bool detect_traps(int range, bool known)
+{
+ bool detect = detect_feat_flag(range, FF_TRAP, known);
+
+ if (known) p_ptr->dtrap = TRUE;
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 0) detect = FALSE;
/* Describe */
if (detect)
{
#ifdef JP
-msg_print("¥È¥é¥Ã¥×¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+ msg_print("¥È¥é¥Ã¥×¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
#else
msg_print("You sense the presence of traps!");
#endif
-
}
/* Result */
- return (detect);
+ return detect;
}
-
/*
* Detect all doors on current panel
*/
bool detect_doors(int range)
{
- int y, x;
-
- bool detect = FALSE;
-
- cave_type *c_ptr;
-
- if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
-
- /* Scan the panel */
- for (y = 1; y < cur_hgt - 1; y++)
- {
- for (x = 1; x < cur_wid - 1; x++)
- {
- if (distance(py, px, y, x) > range) continue;
-
- c_ptr = &cave[y][x];
+ bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
- /* Detect secret doors */
- if (c_ptr->feat == FEAT_SECRET)
- {
- /* Pick a door */
- place_closed_door(y, x);
- }
-
- /* Detect doors */
- if (((c_ptr->feat >= FEAT_DOOR_HEAD) &&
- (c_ptr->feat <= FEAT_DOOR_TAIL)) ||
- ((c_ptr->feat == FEAT_OPEN) ||
- (c_ptr->feat == FEAT_BROKEN)))
- {
- /* Hack -- Memorize */
- c_ptr->info |= (CAVE_MARK);
-
- /* Redraw */
- lite_spot(y, x);
-
- /* Obvious */
- detect = TRUE;
- }
- }
- }
-
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 0) detect = FALSE;
/* Describe */
if (detect)
{
#ifdef JP
-msg_print("¥É¥¢¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+ msg_print("¥É¥¢¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
#else
msg_print("You sense the presence of doors!");
#endif
-
}
/* Result */
- return (detect);
+ return detect;
}
*/
bool detect_stairs(int range)
{
- int y, x;
-
- bool detect = FALSE;
-
- cave_type *c_ptr;
-
- if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
-
- /* Scan the panel */
- for (y = 1; y < cur_hgt - 1; y++)
- {
- for (x = 1; x < cur_wid - 1; x++)
- {
- if (distance(py, px, y, x) > range) continue;
-
- c_ptr = &cave[y][x];
-
- /* Detect stairs */
- if ((c_ptr->feat == FEAT_LESS) ||
- (c_ptr->feat == FEAT_LESS_LESS) ||
- (c_ptr->feat == FEAT_MORE) ||
- (c_ptr->feat == FEAT_MORE_MORE) ||
- (c_ptr->feat == FEAT_ENTRANCE))
- {
- /* Hack -- Memorize */
- c_ptr->info |= (CAVE_MARK);
-
- /* Redraw */
- lite_spot(y, x);
-
- /* Obvious */
- detect = TRUE;
- }
- }
- }
+ bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 0) detect = FALSE;
/* Describe */
if (detect)
{
#ifdef JP
-msg_print("³¬Ãʤθºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+ msg_print("³¬Ãʤθºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
#else
msg_print("You sense the presence of stairs!");
#endif
-
}
/* Result */
- return (detect);
+ return detect;
}
*/
bool detect_treasure(int range)
{
- int y, x;
-
- bool detect = FALSE;
-
- cave_type *c_ptr;
-
- if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
-
- /* Scan the current panel */
- for (y = 1; y < cur_hgt; y++)
- {
- for (x = 1; x < cur_wid; x++)
- {
- if (distance(py, px, y, x) > range) continue;
-
- c_ptr = &cave[y][x];
-
- /* Notice embedded gold */
- if ((c_ptr->feat == FEAT_MAGMA_H) ||
- (c_ptr->feat == FEAT_QUARTZ_H))
- {
- /* Expose the gold */
- c_ptr->feat += 0x02;
- }
-
- /* Magma/Quartz + Known Gold */
- if ((c_ptr->feat == FEAT_MAGMA_K) ||
- (c_ptr->feat == FEAT_QUARTZ_K))
- {
- /* Hack -- Memorize */
- c_ptr->info |= (CAVE_MARK);
-
- /* Redraw */
- lite_spot(y, x);
-
- /* Detect */
- detect = TRUE;
- }
- }
- }
+ bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+6)) detect = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 6) detect = FALSE;
/* Describe */
if (detect)
{
#ifdef JP
-msg_print("Ë䢤µ¤ì¤¿ºâÊõ¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+ msg_print("Ë䢤µ¤ì¤¿ºâÊõ¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
#else
msg_print("You sense the presence of buried treasure!");
#endif
-
}
-
/* Result */
- return (detect);
+ return detect;
}
-
/*
* Detect all "gold" objects on the current panel
*/
if (o_ptr->tval == TV_GOLD)
{
/* Hack -- memorize it */
- o_ptr->marked = TRUE;
+ o_ptr->marked |= OM_FOUND;
/* Redraw */
lite_spot(y, x);
}
}
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+6)) detect = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 6) detect = FALSE;
/* Describe */
if (detect)
if (o_ptr->tval != TV_GOLD)
{
/* Hack -- memorize it */
- o_ptr->marked = TRUE;
+ o_ptr->marked |= OM_FOUND;
/* Redraw */
lite_spot(y, x);
}
}
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+6)) detect = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 6) detect = FALSE;
/* Describe */
if (detect)
tv = o_ptr->tval;
/* Artifacts, misc magic items, or enchanted wearables */
- if (artifact_p(o_ptr) ||
- ego_item_p(o_ptr) ||
- o_ptr->art_name ||
+ if (object_is_artifact(o_ptr) ||
+ object_is_ego(o_ptr) ||
(tv == TV_WHISTLE) ||
(tv == TV_AMULET) ||
(tv == TV_RING) ||
(tv == TV_DEATH_BOOK) ||
(tv == TV_TRUMP_BOOK) ||
(tv == TV_ARCANE_BOOK) ||
- (tv == TV_ENCHANT_BOOK) ||
+ (tv == TV_CRAFT_BOOK) ||
(tv == TV_DAEMON_BOOK) ||
(tv == TV_CRUSADE_BOOK) ||
(tv == TV_MUSIC_BOOK) ||
((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
{
/* Memorize the item */
- o_ptr->marked = TRUE;
+ o_ptr->marked |= OM_FOUND;
/* Redraw */
lite_spot(y, x);
if (distance(py, px, y, x) > range) continue;
/* Detect all non-invisible monsters */
- if ((!(r_ptr->flags2 & RF2_INVISIBLE)) ||
- p_ptr->see_inv || p_ptr->tim_invis)
+ if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
{
/* Repair visibility later */
repair_monsters = TRUE;
/* Hack -- Detect monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
/* Update the monster */
update_mon(i, FALSE);
}
}
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+3)) flag = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 3) flag = FALSE;
/* Describe */
if (flag)
repair_monsters = TRUE;
/* Hack -- Detect monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
/* Update the monster */
update_mon(i, FALSE);
}
}
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+3)) flag = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 3) flag = FALSE;
/* Describe */
if (flag)
/* Detect evil monsters */
if (r_ptr->flags3 & RF3_EVIL)
{
- /* Take note that they are evil */
- r_ptr->r_flags3 |= (RF3_EVIL);
-
- /* Update monster recall window */
- if (p_ptr->monster_race_idx == m_ptr->r_idx)
+ if (is_original_ap(m_ptr))
{
- /* Window stuff */
- p_ptr->window |= (PW_MONSTER);
+ /* Take note that they are evil */
+ r_ptr->r_flags3 |= (RF3_EVIL);
+
+ /* Update monster recall window */
+ if (p_ptr->monster_race_idx == m_ptr->r_idx)
+ {
+ /* Window stuff */
+ p_ptr->window |= (PW_MONSTER);
+ }
}
/* Repair visibility later */
repair_monsters = TRUE;
/* Hack -- Detect monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
/* Update the monster */
update_mon(i, FALSE);
repair_monsters = TRUE;
/* Hack -- Detect monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
/* Update the monster */
update_mon(i, FALSE);
repair_monsters = TRUE;
/* Hack -- Detect monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
/* Update the monster */
update_mon(i, FALSE);
if (distance(py, px, y, x) > range) continue;
/* Detect monsters with the same symbol */
- if (strchr(Match, r_ptr->d_char))
+ if (my_strchr(Match, r_ptr->d_char))
{
/* Update monster recall window */
if (p_ptr->monster_race_idx == m_ptr->r_idx)
repair_monsters = TRUE;
/* Hack -- Detect monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
/* Update the monster */
update_mon(i, FALSE);
}
}
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+3)) flag = FALSE;
+ if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 3) flag = FALSE;
/* Describe */
if (flag)
/* Detect evil monsters */
if (r_ptr->flags3 & (match_flag))
{
- /* Take note that they are something */
- r_ptr->r_flags3 |= (match_flag);
-
- /* Update monster recall window */
- if (p_ptr->monster_race_idx == m_ptr->r_idx)
+ if (is_original_ap(m_ptr))
{
- /* Window stuff */
- p_ptr->window |= (PW_MONSTER);
+ /* Take note that they are something */
+ r_ptr->r_flags3 |= (match_flag);
+
+ /* Update monster recall window */
+ if (p_ptr->monster_race_idx == m_ptr->r_idx)
+ {
+ /* Window stuff */
+ p_ptr->window |= (PW_MONSTER);
+ }
}
/* Repair visibility later */
repair_monsters = TRUE;
/* Hack -- Detect monster */
- m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
/* Update the monster */
update_mon(i, FALSE);
bool detect = FALSE;
/* Detect everything */
- if (detect_traps(range)) detect = TRUE;
+ if (detect_traps(range, TRUE)) detect = TRUE;
if (detect_doors(range)) detect = TRUE;
if (detect_stairs(range)) detect = TRUE;
- if (detect_treasure(range)) detect = TRUE;
+
+ /* There are too many hidden treasure. So... */
+ /* if (detect_treasure(range)) detect = TRUE; */
+
if (detect_objects_gold(range)) detect = TRUE;
if (detect_objects_normal(range)) detect = TRUE;
if (detect_monsters_invis(range)) detect = TRUE;
bool project_hack(int typ, int dam)
{
int i, x, y;
- int flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE | PROJECT_NO_REF;
+ int flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
bool obvious = FALSE;
x = m_ptr->fx;
/* Require line of sight */
- if (!player_has_los_bold(y, x)) continue;
+ if (!player_has_los_bold(y, x) || !projectable(py, px, y, x)) continue;
/* Mark the monster */
m_ptr->mflag |= (MFLAG_TEMP);
if (m_ptr->cdis < MAX_SIGHT * 2)
{
/* Wake up */
- if (m_ptr->csleep)
+ if (MON_CSLEEP(m_ptr))
{
- /* Wake up */
- m_ptr->csleep = 0;
+ (void)set_monster_csleep(i, 0);
sleep = TRUE;
}
- if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG_NOPET;
+ if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
}
/* Speed up monsters in line of sight */
{
if (!is_pet(m_ptr))
{
- m_ptr->fast = MIN(200, m_ptr->fast + 100);
+ (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
speed = TRUE;
}
}
/* Messages */
#ifdef JP
-if (speed) msg_print("ÉÕ¶á¤Ç²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤Ê´¶¤¸¤ò¼õ¤±¤¿¡ª");
-else if (sleep) msg_print("²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤ÊÁû¡¹¤·¤¤²»¤¬±ó¤¯¤Ëʹ¤³¤¨¤¿¡ª");
+ if (speed) msg_print("ÉÕ¶á¤Ç²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤Ê´¶¤¸¤ò¼õ¤±¤¿¡ª");
+ else if (sleep) msg_print("²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤ÊÁû¡¹¤·¤¤²»¤¬±ó¤¯¤Ëʹ¤³¤¨¤¿¡ª");
#else
if (speed) msg_print("You feel a sudden stirring nearby!");
else if (sleep) msg_print("You hear a sudden stirring in the distance!");
}
-
/*
- * Delete all non-unique/non-quest monsters of a given "type" from the level
+ * Delete a non-unique/non-quest monster
*/
-bool symbol_genocide(int power, int player_cast)
+bool genocide_aux(int m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
{
- int i;
- char typ;
- bool result = FALSE;
- int msec = delay_factor * delay_factor * delay_factor;
-
- /* Prevent genocide in quest levels */
- if (p_ptr->inside_quest && !random_quest_number(dun_level))
- {
- return (FALSE);
- }
-
- /* Mega-Hack -- Get a monster symbol */
-#ifdef JP
-while(!get_com("¤É¤Î¼ïÎà(ʸ»ú)¤Î¥â¥ó¥¹¥¿¡¼¤òËõ»¦¤·¤Þ¤¹¤«: ", &typ, FALSE));
-#else
- while(!get_com("Choose a monster race (by symbol) to genocide: ", &typ, FALSE));
-#endif
-
-
- /* Delete the monsters of that "type" */
- for (i = 1; i < m_max; i++)
- {
- monster_type *m_ptr = &m_list[i];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
- bool angry = FALSE;
- char m_name[80];
+ int msec = delay_factor * delay_factor * delay_factor;
+ monster_type *m_ptr = &m_list[m_idx];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
+ bool resist = FALSE;
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
-
- /* Skip "wrong" monsters */
- if (r_ptr->d_char != typ) continue;
+ if (is_pet(m_ptr) && !player_cast) return FALSE;
- if (is_pet(m_ptr) && !player_cast) continue;
+ /* Hack -- Skip Unique Monsters or Quest Monsters */
+ if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
- /* Hack -- Skip Unique Monsters */
- if (r_ptr->flags1 & (RF1_UNIQUE)) angry = TRUE;
+ else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
- /* Hack -- Skip Quest Monsters */
- else if (r_ptr->flags1 & RF1_QUESTOR) angry = TRUE;
+ else if (m_idx == p_ptr->riding) resist = TRUE;
- else if (r_ptr->flags7 & RF7_UNIQUE2) angry = TRUE;
+ else if (p_ptr->inside_quest || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
- else if (i == p_ptr->riding) angry = TRUE;
+ else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
- else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
+ else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
- else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
+ /* Delete the monster */
+ else delete_monster_idx(m_idx);
- /* Delete the monster */
- else delete_monster_idx(i);
+ if (resist && player_cast)
+ {
+ bool see_m = is_seen(m_ptr);
+ char m_name[80];
- if (angry && player_cast)
+ monster_desc(m_name, m_ptr, 0);
+ if (see_m)
{
- monster_desc(m_name, m_ptr, 0);
- if (m_ptr->ml && !p_ptr->blind)
- {
#ifdef JP
-msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
#else
- msg_format("%^s is unaffected.", m_name);
+ msg_format("%^s is unaffected.", m_name);
#endif
- }
- if (m_ptr->csleep)
+ }
+ if (MON_CSLEEP(m_ptr))
+ {
+ (void)set_monster_csleep(m_idx, 0);
+ if (see_m)
{
- m_ptr->csleep = 0;
- if (m_ptr->ml && !p_ptr->blind)
- {
#ifdef JP
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
+ msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
#else
- msg_format("%^s wakes up.", m_name);
+ msg_format("%^s wakes up.", m_name);
#endif
- }
}
- if (is_friendly(m_ptr) && !is_pet(m_ptr))
+ }
+ if (is_friendly(m_ptr) && !is_pet(m_ptr))
+ {
+ if (see_m)
{
- if (m_ptr->ml && !p_ptr->blind)
- {
#ifdef JP
- msg_format("%s¤ÏÅܤä¿¡ª", m_name);
+ msg_format("%s¤ÏÅܤä¿¡ª", m_name);
#else
- msg_format("%^s gets angry!", m_name);
+ msg_format("%^s gets angry!", m_name);
#endif
- }
- set_hostile(m_ptr);
}
- if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
+ set_hostile(m_ptr);
}
+ if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
+ }
- if (player_cast)
- {
- /* Take damage */
+ if (player_cast)
+ {
+ /* Take damage */
#ifdef JP
-take_hit(DAMAGE_GENO, randint1(4), "Ëõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+ take_hit(DAMAGE_GENO, randint1(dam_side), format("%^s¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", spell_name), -1);
#else
- take_hit(DAMAGE_GENO, randint1(4), "the strain of casting Genocide", -1);
+ take_hit(DAMAGE_GENO, randint1(dam_side), format("the strain of casting %^s", spell_name), -1);
#endif
+ }
- }
+ /* Visual feedback */
+ move_cursor_relative(py, px);
- /* Visual feedback */
- move_cursor_relative(py, px);
+ /* Redraw */
+ p_ptr->redraw |= (PR_HP);
- /* Redraw */
- p_ptr->redraw |= (PR_HP);
+ /* Window stuff */
+ p_ptr->window |= (PW_PLAYER);
- /* Window stuff */
- p_ptr->window |= (PW_PLAYER);
+ /* Handle */
+ handle_stuff();
+
+ /* Fresh */
+ Term_fresh();
+
+ /* Delay */
+ Term_xtra(TERM_XTRA_DELAY, msec);
+
+ return !resist;
+}
+
+
+/*
+ * Delete all non-unique/non-quest monsters of a given "type" from the level
+ */
+bool symbol_genocide(int power, bool player_cast)
+{
+ int i;
+ char typ;
+ bool result = FALSE;
+
+ /* Prevent genocide in quest levels */
+ if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+ {
+ return (FALSE);
+ }
- /* Handle */
- handle_stuff();
+ /* Mega-Hack -- Get a monster symbol */
+#ifdef JP
+ while (!get_com("¤É¤Î¼ïÎà(ʸ»ú)¤Î¥â¥ó¥¹¥¿¡¼¤òËõ»¦¤·¤Þ¤¹¤«: ", &typ, FALSE)) ;
+#else
+ while (!get_com("Choose a monster race (by symbol) to genocide: ", &typ, FALSE)) ;
+#endif
+
+ /* Delete the monsters of that "type" */
+ for (i = 1; i < m_max; i++)
+ {
+ monster_type *m_ptr = &m_list[i];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
- /* Fresh */
- Term_fresh();
+ /* Paranoia -- Skip dead monsters */
+ if (!m_ptr->r_idx) continue;
- /* Delay */
- Term_xtra(TERM_XTRA_DELAY, msec);
+ /* Skip "wrong" monsters */
+ if (r_ptr->d_char != typ) continue;
/* Take note */
- result = TRUE;
+#ifdef JP
+ result |= genocide_aux(i, power, player_cast, 4, "Ëõ»¦");
+#else
+ result |= genocide_aux(i, power, player_cast, 4, "Genocide");
+#endif
}
+
if (result)
{
chg_virtue(V_VITALITY, -2);
chg_virtue(V_CHANCE, -1);
}
- return (result);
+ return result;
}
/*
* Delete all nearby (non-unique) monsters
*/
-bool mass_genocide(int power, int player_cast)
+bool mass_genocide(int power, bool player_cast)
{
- int i;
- bool result = FALSE;
- int msec = delay_factor * delay_factor * delay_factor;
-
+ int i;
+ bool result = FALSE;
/* Prevent mass genocide in quest levels */
- if (p_ptr->inside_quest && !random_quest_number(dun_level))
+ if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
{
return (FALSE);
}
/* Delete the (nearby) monsters */
for (i = 1; i < m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
- bool angry = FALSE;
- char m_name[80];
+ monster_type *m_ptr = &m_list[i];
/* Paranoia -- Skip dead monsters */
if (!m_ptr->r_idx) continue;
/* Skip distant monsters */
if (m_ptr->cdis > MAX_SIGHT) continue;
- if (is_pet(m_ptr) && !player_cast) continue;
-
- /* Hack -- Skip unique monsters */
- if (r_ptr->flags1 & (RF1_UNIQUE)) angry = TRUE;
-
- /* Hack -- Skip Quest Monsters */
- else if (r_ptr->flags1 & RF1_QUESTOR) angry = TRUE;
-
- else if (r_ptr->flags7 & RF7_UNIQUE2) angry = TRUE;
-
- else if (i == p_ptr->riding) angry = TRUE;
-
- else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
-
- else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
-
- /* Delete the monster */
- else delete_monster_idx(i);
-
- if (angry && player_cast)
- {
- monster_desc(m_name, m_ptr, 0);
- if (m_ptr->ml && !p_ptr->blind)
- {
-#ifdef JP
-msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
-#else
- msg_format("%^s is unaffected.", m_name);
-#endif
- }
- if (m_ptr->csleep)
- {
- m_ptr->csleep = 0;
- if (m_ptr->ml && !p_ptr->blind)
- {
-#ifdef JP
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
-#else
- msg_format("%^s wakes up.", m_name);
-#endif
- }
- }
- if (is_friendly(m_ptr) && !is_pet(m_ptr))
- {
- if (m_ptr->ml && !p_ptr->blind)
- {
-#ifdef JP
- msg_format("%s¤ÏÅܤä¿¡ª", m_name);
-#else
- msg_format("%^s gets angry!", m_name);
-#endif
- }
- set_hostile(m_ptr);
- }
- if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
- }
-
- if (player_cast)
- {
- /* Hack -- visual feedback */
-#ifdef JP
-take_hit(DAMAGE_GENO, randint1(3), "¼þÊÕËõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
-#else
- take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
-#endif
-
- }
-
- move_cursor_relative(py, px);
-
- /* Redraw */
- p_ptr->redraw |= (PR_HP);
-
- /* Window stuff */
- p_ptr->window |= (PW_PLAYER);
-
- /* Handle */
- handle_stuff();
-
- /* Fresh */
- Term_fresh();
-
- /* Delay */
- Term_xtra(TERM_XTRA_DELAY, msec);
-
- /* Note effect */
- result = TRUE;
- }
+ /* Note effect */
+#ifdef JP
+ result |= genocide_aux(i, power, player_cast, 3, "¼þÊÕËõ»¦");
+#else
+ result |= genocide_aux(i, power, player_cast, 3, "Mass Genocide");
+#endif
+ }
if (result)
{
chg_virtue(V_CHANCE, -1);
}
- return (result);
+ return result;
}
/*
* Delete all nearby (non-unique) undead
*/
-bool mass_genocide_undead(int power, int player_cast)
+bool mass_genocide_undead(int power, bool player_cast)
{
- int i;
- bool result = FALSE;
- int msec = delay_factor * delay_factor * delay_factor;
-
+ int i;
+ bool result = FALSE;
/* Prevent mass genocide in quest levels */
- if (p_ptr->inside_quest && !random_quest_number(dun_level))
+ if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
{
return (FALSE);
}
/* Delete the (nearby) monsters */
for (i = 1; i < m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
- bool angry = FALSE;
- char m_name[80];
+ monster_type *m_ptr = &m_list[i];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Paranoia -- Skip dead monsters */
if (!m_ptr->r_idx) continue;
/* Skip distant monsters */
if (m_ptr->cdis > MAX_SIGHT) continue;
- if (is_pet(m_ptr) && !player_cast) continue;
-
- /* Hack -- Skip unique monsters */
- if (r_ptr->flags1 & (RF1_UNIQUE)) angry = TRUE;
-
- /* Hack -- Skip Quest Monsters */
- else if (r_ptr->flags1 & RF1_QUESTOR) angry = TRUE;
-
- else if (r_ptr->flags7 & RF7_UNIQUE2) angry = TRUE;
-
- else if (i == p_ptr->riding) angry = TRUE;
-
- else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
-
- else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
-
- /* Delete the monster */
- else delete_monster_idx(i);
-
- if (angry && player_cast)
- {
- monster_desc(m_name, m_ptr, 0);
- if (m_ptr->ml && !p_ptr->blind)
- {
-#ifdef JP
-msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
-#else
- msg_format("%^s is unaffected.", m_name);
-#endif
- }
- if (m_ptr->csleep)
- {
- m_ptr->csleep = 0;
- if (m_ptr->ml && !p_ptr->blind)
- {
-#ifdef JP
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
-#else
- msg_format("%^s wakes up.", m_name);
-#endif
- }
- }
- if (is_friendly(m_ptr) && !is_pet(m_ptr))
- {
- if (m_ptr->ml && !p_ptr->blind)
- {
-#ifdef JP
- msg_format("%s¤ÏÅܤä¿¡ª", m_name);
-#else
- msg_format("%^s gets angry!", m_name);
-#endif
- }
- set_hostile(m_ptr);
- }
- if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
- }
-
- if (player_cast)
- {
- /* Hack -- visual feedback */
+ /* Note effect */
#ifdef JP
-take_hit(DAMAGE_GENO, randint1(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+ result |= genocide_aux(i, power, player_cast, 3, "¥¢¥ó¥Ç¥Ã¥É¾ÃÌÇ");
#else
- take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
+ result |= genocide_aux(i, power, player_cast, 3, "Annihilate Undead");
#endif
-
- }
-
- move_cursor_relative(py, px);
-
- /* Redraw */
- p_ptr->redraw |= (PR_HP);
-
- /* Window stuff */
- p_ptr->window |= (PW_PLAYER);
-
- /* Handle */
- handle_stuff();
-
- /* Fresh */
- Term_fresh();
-
- /* Delay */
- Term_xtra(TERM_XTRA_DELAY, msec);
-
- /* Note effect */
- result = TRUE;
}
if (result)
chg_virtue(V_CHANCE, -1);
}
- return (result);
+ return result;
}
char m_name[80];
/* Start the message */
+ if (!probe)
+ {
#ifdef JP
- if (!probe) {msg_print("Ä´ººÃæ...");msg_print(NULL);}
+ msg_print("Ä´ººÃæ...");
#else
- if (!probe) {msg_print("Probing...");msg_print(NULL);}
+ msg_print("Probing...");
#endif
+ }
- if (m_ptr->ap_r_idx != m_ptr->r_idx)
+ msg_print(NULL);
+
+ if (!is_original_ap(m_ptr))
{
- if (m_ptr->mflag2 & MFLAG_KAGE)
- m_ptr->mflag2 &= ~(MFLAG_KAGE);
+ if (m_ptr->mflag2 & MFLAG2_KAGE)
+ m_ptr->mflag2 &= ~(MFLAG2_KAGE);
m_ptr->ap_r_idx = m_ptr->r_idx;
lite_spot(m_ptr->fy, m_ptr->fx);
}
/* Get "the monster" or "something" */
- monster_desc(m_name, m_ptr, 0x204);
+ monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
speed = m_ptr->mspeed - 110;
- if(m_ptr->fast) speed += 10;
- if(m_ptr->slow) speed -= 10;
+ if (MON_FAST(m_ptr)) speed += 10;
+ if (MON_SLOW(m_ptr)) speed -= 10;
/* Get the monster's alignment */
#ifdef JP
- if ((r_ptr->flags3 & RF3_EVIL) && (r_ptr->flags3 & RF3_GOOD)) align = "籡";
+ if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "籡";
else if (r_ptr->flags3 & RF3_EVIL) align = "¼Ù°";
else if (r_ptr->flags3 & RF3_GOOD) align = "Á±ÎÉ";
- else if ((m_ptr->sub_align & SUB_ALIGN_EVIL) && (m_ptr->sub_align & SUB_ALIGN_GOOD)) align = "ÃæΩ(Á±°)";
+ else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "ÃæΩ(Á±°)";
else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "ÃæΩ(¼Ù°)";
else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "ÃæΩ(Á±ÎÉ)";
else align = "ÃæΩ";
#else
- if ((r_ptr->flags3 & RF3_EVIL) && (r_ptr->flags3 & RF3_GOOD)) align = "good&evil";
+ if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "good&evil";
else if (r_ptr->flags3 & RF3_EVIL) align = "evil";
else if (r_ptr->flags3 & RF3_GOOD) align = "good";
- else if ((m_ptr->sub_align & SUB_ALIGN_EVIL) && (m_ptr->sub_align & SUB_ALIGN_GOOD)) align = "neutral(good&evil)";
+ else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "neutral(good&evil)";
else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "neutral(evil)";
else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "neutral(good)";
else align = "neutral";
}
#ifdef JP
- if (m_ptr->csleep) strcat(buf,"¿ç̲ ");
- if (m_ptr->stunned) strcat(buf,"ۯ۰ ");
- if (m_ptr->monfear) strcat(buf,"¶²ÉÝ ");
- if (m_ptr->confused) strcat(buf,"º®Íð ");
- if (m_ptr->invulner) strcat(buf,"̵Ũ ");
+ if (MON_CSLEEP(m_ptr)) strcat(buf,"¿ç̲ ");
+ if (MON_STUNNED(m_ptr)) strcat(buf,"ۯ۰ ");
+ if (MON_MONFEAR(m_ptr)) strcat(buf,"¶²ÉÝ ");
+ if (MON_CONFUSED(m_ptr)) strcat(buf,"º®Íð ");
+ if (MON_INVULNER(m_ptr)) strcat(buf,"̵Ũ ");
#else
- if (m_ptr->csleep) strcat(buf,"sleeping ");
- if (m_ptr->stunned) strcat(buf,"stunned ");
- if (m_ptr->monfear) strcat(buf,"scared ");
- if (m_ptr->confused) strcat(buf,"confused ");
- if (m_ptr->invulner) strcat(buf,"invulnerable ");
+ if (MON_CSLEEP(m_ptr)) strcat(buf,"sleeping ");
+ if (MON_STUNNED(m_ptr)) strcat(buf,"stunned ");
+ if (MON_MONFEAR(m_ptr)) strcat(buf,"scared ");
+ if (MON_CONFUSED(m_ptr)) strcat(buf,"confused ");
+ if (MON_INVULNER(m_ptr)) strcat(buf,"invulnerable ");
#endif
buf[strlen(buf)-1] = '\0';
prt(buf,0,0);
p_ptr->window |= (PW_MESSAGE);
window_stuff();
- /* Learn all of the non-spell, non-treasure flags */
- lore_do_probe(i);
-
if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
inkey();
Term_erase(0, 0, 255);
+ /* Learn everything about this monster */
+ if (lore_do_probe(m_ptr->r_idx))
+ {
+ char buf[80];
+
+ /* Get base name of monster */
+ strcpy(buf, (r_name + r_ptr->name));
+
+#ifdef JP
+ /* Note that we learnt some new flags -Mogami- */
+ msg_format("%s¤Ë¤Ä¤¤¤Æ¤µ¤é¤Ë¾Ü¤·¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", buf);
+#else
+ /* Pluralize it */
+ plural_aux(buf);
+
+ /* Note that we learnt some new flags -Mogami- */
+ msg_format("You now know more about %s.", buf);
+#endif
+ /* Clear -more- prompt */
+ msg_print(NULL);
+ }
+
/* Probe worked */
probe = TRUE;
}
* Later we may use one function for both "destruction" and
* "earthquake" by using the "full" to select "destruction".
*/
-bool destroy_area(int y1, int x1, int r, int full)
+bool destroy_area(int y1, int x1, int r, bool in_generate)
{
int y, x, k, t;
cave_type *c_ptr;
bool flag = FALSE;
-
/* Prevent destruction of quest levels and town */
- if ((p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || !dun_level)
+ if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
{
return (FALSE);
}
+ /* Lose monster light */
+ if (!in_generate) clear_mon_lite();
+
/* Big area of affect */
for (y = (y1 - r); y <= (y1 + r); y++)
{
for (x = (x1 - r); x <= (x1 + r); x++)
{
- monster_type *m_ptr;
- monster_race *r_ptr;
-
/* Skip illegal grids */
if (!in_bounds(y, x)) continue;
/* Access the grid */
c_ptr = &cave[y][x];
- m_ptr = &m_list[c_ptr->m_idx];
- r_ptr = &r_info[m_ptr->r_idx];
/* Lose room and vault */
- c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_TRAP | CAVE_UNSAFE | CAVE_IN_MIRROR);
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
/* Lose light and knowledge */
c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
- /* Hack -- Notice player affect */
- if ((x == px) && (y == py))
+ if (!in_generate) /* Normal */
{
- /* Hurt the player later */
- flag = TRUE;
+ /* Lose unsafety */
+ c_ptr->info &= ~(CAVE_UNSAFE);
+
+ /* Hack -- Notice player affect */
+ if (player_bold(y, x))
+ {
+ /* Hurt the player later */
+ flag = TRUE;
- /* Do not hurt this grid */
- continue;
+ /* Do not hurt this grid */
+ continue;
+ }
}
/* Hack -- Skip the epicenter */
if ((y == y1) && (x == x1)) continue;
-#if 0
- if ((r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->flags7 & RF7_GUARDIAN) || ((m_ptr->mflag2 & MFLAG_CHAMELEON) && (r_ptr->flags1 & RF1_UNIQUE)))
-#else
- if ((r_ptr->flags1 & RF1_QUESTOR))
-#endif
+ if (c_ptr->m_idx)
{
- /* Heal the monster */
- m_list[c_ptr->m_idx].hp = m_list[c_ptr->m_idx].maxhp;
+ monster_type *m_ptr = &m_list[c_ptr->m_idx];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
- /* Try to teleport away quest monsters */
- if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE)) continue;
- }
- else
- {
- if (c_ptr->m_idx)
+ if (in_generate) /* In generation */
+ {
+ /* Delete the monster (if any) */
+ delete_monster(y, x);
+ }
+ else if (r_ptr->flags1 & RF1_QUESTOR)
+ {
+ /* Heal the monster */
+ m_ptr->hp = m_ptr->maxhp;
+
+ /* Try to teleport away quest monsters */
+ if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
+ }
+ else
{
- if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
+ if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
{
char m_name[80];
- monster_desc(m_name, &m_list[c_ptr->m_idx], 0x08);
+ monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
do_cmd_write_nikki(NIKKI_NAMED_PET, 6, m_name);
}
+
+ /* Delete the monster (if any) */
+ delete_monster(y, x);
}
- /* Delete the monster (if any) */
- delete_monster(y, x);
}
- if (preserve_mode)
+ /* During generation, destroyed artifacts are "preserved" */
+ if (preserve_mode || in_generate)
{
s16b this_o_idx, next_o_idx = 0;
next_o_idx = o_ptr->next_o_idx;
/* Hack -- Preserve unknown artifacts */
- if (artifact_p(o_ptr) && !object_known_p(o_ptr))
+ if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
{
/* Mega-Hack -- Preserve the artifact */
a_info[o_ptr->name1].cur_num = 0;
+
+ if (in_generate && cheat_peek)
+ {
+ char o_name[MAX_NLEN];
+ object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
+#ifdef JP
+ msg_format("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à (%s) ¤ÏÀ¸À®Ãæ¤Ë*Ç˲õ*¤µ¤ì¤¿¡£", o_name);
+#else
+ msg_format("Artifact (%s) was *destroyed* during generation.", o_name);
+#endif
+ }
+ }
+ else if (in_generate && cheat_peek && o_ptr->art_name)
+ {
+#ifdef JP
+ msg_print("¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î1¤Ä¤ÏÀ¸À®Ãæ¤Ë*Ç˲õ*¤µ¤ì¤¿¡£");
+#else
+ msg_print("One of the random artifacts was *destroyed* during generation.");
+#endif
}
}
}
+
+ /* Delete objects */
delete_object(y, x);
- /* Destroy "valid" grids */
- if (!cave_perma_bold(y, x))
+ /* Destroy "non-permanent" grids */
+ if (!cave_perma_grid(c_ptr))
{
/* Wall (or floor) type */
t = randint0(200);
- /* Granite */
- if (t < 20)
+ if (!in_generate) /* Normal */
{
- /* Create granite wall */
- c_ptr->feat = FEAT_WALL_EXTRA;
+ if (t < 20)
+ {
+ /* Create granite wall */
+ cave_set_feat(y, x, feat_granite);
+ }
+ else if (t < 70)
+ {
+ /* Create quartz vein */
+ cave_set_feat(y, x, feat_quartz_vein);
+ }
+ else if (t < 100)
+ {
+ /* Create magma vein */
+ cave_set_feat(y, x, feat_magma_vein);
+ }
+ else
+ {
+ /* Create floor */
+ cave_set_feat(y, x, floor_type[randint0(100)]);
+ }
}
-
- /* Quartz */
- else if (t < 70)
+ else /* In generation */
{
- /* Create quartz vein */
- c_ptr->feat = FEAT_QUARTZ;
- }
+ if (t < 20)
+ {
+ /* Create granite wall */
+ place_extra_grid(c_ptr);
+ }
+ else if (t < 70)
+ {
+ /* Create quartz vein */
+ c_ptr->feat = feat_quartz_vein;
+ }
+ else if (t < 100)
+ {
+ /* Create magma vein */
+ c_ptr->feat = feat_magma_vein;
+ }
+ else
+ {
+ /* Create floor */
+ place_floor_grid(c_ptr);
+ }
- /* Magma */
- else if (t < 100)
- {
- /* Create magma vein */
- c_ptr->feat = FEAT_MAGMA;
+ /* Clear garbage of hidden trap or door */
+ c_ptr->mimic = 0;
}
+ }
+ }
+ }
- /* Floor */
- else
+ if (!in_generate)
+ {
+ /* Process "re-glowing" */
+ for (y = (y1 - r); y <= (y1 + r); y++)
+ {
+ for (x = (x1 - r); x <= (x1 + r); x++)
+ {
+ /* Skip illegal grids */
+ if (!in_bounds(y, x)) continue;
+
+ /* Extract the distance */
+ k = distance(y1, x1, y, x);
+
+ /* Stay in the circle of death */
+ if (k > r) continue;
+
+ /* Access the grid */
+ c_ptr = &cave[y][x];
+
+ if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+ else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
- /* Create floor */
- c_ptr->feat = floor_type[randint0(100)];
+ int i, yy, xx;
+ cave_type *cc_ptr;
+
+ for (i = 0; i < 9; i++)
+ {
+ yy = y + ddy_ddd[i];
+ xx = x + ddx_ddd[i];
+ if (!in_bounds2(yy, xx)) continue;
+ cc_ptr = &cave[yy][xx];
+ if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
+ {
+ c_ptr->info |= CAVE_GLOW;
+ break;
+ }
+ }
}
}
}
- }
-
- /* Hack -- Affect player */
- if (flag)
- {
- /* Message */
+ /* Hack -- Affect player */
+ if (flag)
+ {
+ /* Message */
#ifdef JP
-msg_print("dz¤¨¤ë¤è¤¦¤ÊÁ®¸÷¤¬È¯À¸¤·¤¿¡ª");
+ msg_print("dz¤¨¤ë¤è¤¦¤ÊÁ®¸÷¤¬È¯À¸¤·¤¿¡ª");
#else
- msg_print("There is a searing blast of light!");
+ msg_print("There is a searing blast of light!");
#endif
-
- /* Blind the player */
- if (!p_ptr->resist_blind && !p_ptr->resist_lite)
- {
- /* Become blind */
- (void)set_blind(p_ptr->blind + 10 + randint1(10));
+ /* Blind the player */
+ if (!p_ptr->resist_blind && !p_ptr->resist_lite)
+ {
+ /* Become blind */
+ (void)set_blind(p_ptr->blind + 10 + randint1(10));
+ }
}
- }
- forget_flow();
+ forget_flow();
- /* Mega-Hack -- Forget the view and lite */
- p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
+ /* Mega-Hack -- Forget the view and lite */
+ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+ /* Update stuff */
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
- /* Update the monsters */
- p_ptr->update |= (PU_MONSTERS);
+ /* Redraw map */
+ p_ptr->redraw |= (PR_MAP);
- /* Redraw map */
- p_ptr->redraw |= (PR_MAP);
+ /* Window stuff */
+ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+ if (p_ptr->special_defense & NINJA_S_STEALTH)
+ {
+ if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+ }
+ }
/* Success */
return (TRUE);
* for a single turn, unless that monster can pass_walls or kill_walls.
* This has allowed massive simplification of the "monster" code.
*/
-bool earthquake(int cy, int cx, int r)
+bool earthquake_aux(int cy, int cx, int r, int m_idx)
{
- int i, t, y, x, yy, xx, dy, dx, oy, ox;
+ int i, t, y, x, yy, xx, dy, dx;
int damage = 0;
int sn = 0, sy = 0, sx = 0;
bool hurt = FALSE;
/* Prevent destruction of quest levels and town */
- if ((p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || !dun_level)
+ if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
{
return (FALSE);
}
c_ptr = &cave[yy][xx];
/* Lose room and vault */
- c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_TRAP | CAVE_UNSAFE | CAVE_IN_MIRROR );
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
/* Lose light and knowledge */
c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
map[16+yy-cy][16+xx-cx] = TRUE;
/* Hack -- Take note of player damage */
- if ((yy == py) && (xx == px)) hurt = TRUE;
+ if (player_bold(yy, xx)) hurt = TRUE;
}
}
/* First, affect the player (if necessary) */
- if (hurt && !(p_ptr->prace == RACE_SPECTRE) && !(p_ptr->wraith_form) && !(p_ptr->kabenuke))
+ if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
{
/* Check around the player */
for (i = 0; i < 8; i++)
case 1:
{
#ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤ÎÊɤ¬Êø¤ì¤¿¡ª");
+ msg_print("¥À¥ó¥¸¥ç¥ó¤ÎÊɤ¬Êø¤ì¤¿¡ª");
#else
msg_print("The cave ceiling collapses!");
#endif
-
break;
}
case 2:
{
#ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤Î¾²¤¬ÉÔ¼«Á³¤Ë¤Í¤¸¶Ê¤¬¤Ã¤¿¡ª");
+ msg_print("¥À¥ó¥¸¥ç¥ó¤Î¾²¤¬ÉÔ¼«Á³¤Ë¤Í¤¸¶Ê¤¬¤Ã¤¿¡ª");
#else
msg_print("The cave floor twists in an unnatural way!");
#endif
-
break;
}
default:
{
#ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿¡ªÊø¤ì¤¿´ä¤¬Æ¬¤Ë¹ß¤Ã¤Æ¤¤¿¡ª");
+ msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿¡ªÊø¤ì¤¿´ä¤¬Æ¬¤Ë¹ß¤Ã¤Æ¤¤¿¡ª");
#else
msg_print("The cave quakes! You are pummeled with debris!");
#endif
-
break;
}
}
{
/* Message and damage */
#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¤Ò¤É¤¤²ø²æ¤òÉé¤Ã¤¿¡ª");
+ msg_print("¤¢¤Ê¤¿¤Ï¤Ò¤É¤¤²ø²æ¤òÉé¤Ã¤¿¡ª");
#else
msg_print("You are severely crushed!");
#endif
-
damage = 200;
}
case 1:
{
#ifdef JP
-msg_print("¹ß¤êÃí¤°´ä¤ò¤¦¤Þ¤¯Èò¤±¤¿¡ª");
+ msg_print("¹ß¤êÃí¤°´ä¤ò¤¦¤Þ¤¯Èò¤±¤¿¡ª");
#else
msg_print("You nimbly dodge the blast!");
#endif
-
damage = 0;
break;
}
case 2:
{
#ifdef JP
-msg_print("´äÀФ¬¤¢¤Ê¤¿¤Ëľ·â¤·¤¿!");
+ msg_print("´äÀФ¬¤¢¤Ê¤¿¤Ëľ·â¤·¤¿!");
#else
msg_print("You are bashed by rubble!");
#endif
-
damage = damroll(10, 4);
(void)set_stun(p_ptr->stun + randint1(50));
break;
case 3:
{
#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¾²¤ÈÊɤȤδ֤˶´¤Þ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
+ msg_print("¤¢¤Ê¤¿¤Ï¾²¤ÈÊɤȤδ֤˶´¤Þ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
#else
msg_print("You are crushed between the floor and ceiling!");
#endif
-
damage = damroll(10, 4);
(void)set_stun(p_ptr->stun + randint1(50));
break;
}
}
- /* Save the old location */
- oy = py;
- ox = px;
-
/* Move the player to the safe location */
- py = sy;
- px = sx;
-
- if (p_ptr->riding)
- {
- int tmp;
- tmp = cave[py][px].m_idx;
- cave[py][px].m_idx = cave[oy][ox].m_idx;
- cave[oy][ox].m_idx = tmp;
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- update_mon(cave[py][px].m_idx, TRUE);
- }
-
- /* Redraw the old spot */
- lite_spot(oy, ox);
-
- /* Redraw the new spot */
- lite_spot(py, px);
-
- /* Check for new panel */
- verify_panel();
+ (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
}
/* Important -- no wall on player */
map[16+py-cy][16+px-cx] = FALSE;
/* Take some damage */
+ if (damage)
+ {
+ char *killer;
+
+ if (m_idx)
+ {
+ char m_name[80];
+ monster_type *m_ptr = &m_list[m_idx];
+
+ /* Get the monster's real name */
+ monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
+
+#ifdef JP
+ killer = format("%s¤Îµ¯¤³¤·¤¿ÃÏ¿Ì", m_name);
+#else
+ killer = format("an earthquake caused by %s", m_name);
+#endif
+ }
+ else
+ {
#ifdef JP
-if (damage) take_hit(DAMAGE_ATTACK, damage, "ÃÏ¿Ì", -1);
+ killer = "ÃÏ¿Ì";
#else
- if (damage) take_hit(DAMAGE_ATTACK, damage, "an earthquake", -1);
+ killer = "an earthquake";
#endif
+ }
+ take_hit(DAMAGE_ATTACK, damage, killer, -1);
+ }
}
-
/* Examine the quaked region */
for (dy = -r; dy <= r; dy++)
{
if (!cave_empty_bold(y, x)) continue;
/* Hack -- no safety on glyph of warding */
- if (cave[y][x].feat == FEAT_GLYPH) continue;
- if (cave[y][x].feat == FEAT_MINOR_GLYPH) continue;
+ if (is_glyph_grid(&cave[y][x])) continue;
+ if (is_explosive_rune_grid(&cave[y][x])) continue;
/* ... nor on the Pattern */
- if ((cave[y][x].feat <= FEAT_PATTERN_XTRA2) &&
- (cave[y][x].feat >= FEAT_PATTERN_START))
- continue;
+ if (pattern_tile(y, x)) continue;
/* Important -- Skip "quake" grids */
if (map[16+y-cy][16+x-cx]) continue;
if (cave[y][x].m_idx) continue;
- if ((y == py) && (x == px)) continue;
+ if (player_bold(y, x)) continue;
/* Count "safe" grids */
sn++;
/* Scream in pain */
#ifdef JP
-msg_format("%^s¤Ï¶ìÄˤǵ㤤ï¤á¤¤¤¿¡ª", m_name);
+ if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s¤Ï¶ìÄˤǵ㤤ï¤á¤¤¤¿¡ª", m_name);
#else
- msg_format("%^s wails out in pain!", m_name);
+ if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s wails out in pain!", m_name);
#endif
-
/* Take damage from the quake */
damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
/* Monster is certainly awake */
- m_ptr->csleep = 0;
+ (void)set_monster_csleep(c_ptr->m_idx, 0);
/* Apply damage directly */
m_ptr->hp -= damage;
{
/* Message */
#ifdef JP
-msg_format("%^s¤Ï´äÀФËËä¤â¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
+ if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s¤Ï´äÀФËËä¤â¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
#else
- msg_format("%^s is embedded in the rock!", m_name);
+ if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s is embedded in the rock!", m_name);
#endif
if (c_ptr->m_idx)
{
char m2_name[80];
- monster_desc(m2_name, m_ptr, 0x08);
+ monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
do_cmd_write_nikki(NIKKI_NAMED_PET, 7, m2_name);
}
}
{
int m_idx = cave[yy][xx].m_idx;
- /* Update the new location */
- cave[sy][sx].m_idx = m_idx;
-
/* Update the old location */
cave[yy][xx].m_idx = 0;
+ /* Update the new location */
+ cave[sy][sx].m_idx = m_idx;
+
/* Move the monster */
m_ptr->fy = sy;
m_ptr->fx = sx;
}
}
+ /* Lose monster light */
+ clear_mon_lite();
/* Examine the quaked region */
for (dy = -r; dy <= r; dy++)
c_ptr = &cave[yy][xx];
/* Paranoia -- never affect player */
-/* if ((yy == py) && (xx == px)) continue; */
+/* if (player_bold(yy, xx)) continue; */
/* Destroy location (if valid) */
if (cave_valid_bold(yy, xx))
{
- bool floor = cave_floor_bold(yy, xx);
-
/* Delete objects */
delete_object(yy, xx);
/* Wall (or floor) type */
- t = (floor ? randint0(100) : 200);
+ t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
/* Granite */
if (t < 20)
{
/* Create granite wall */
- c_ptr->feat = FEAT_WALL_EXTRA;
+ cave_set_feat(yy, xx, feat_granite);
}
/* Quartz */
else if (t < 70)
{
/* Create quartz vein */
- c_ptr->feat = FEAT_QUARTZ;
+ cave_set_feat(yy, xx, feat_quartz_vein);
}
/* Magma */
else if (t < 100)
{
/* Create magma vein */
- c_ptr->feat = FEAT_MAGMA;
+ cave_set_feat(yy, xx, feat_magma_vein);
}
/* Floor */
else
{
/* Create floor */
- c_ptr->feat = floor_type[randint0(100)];
+ cave_set_feat(yy, xx, floor_type[randint0(100)]);
+ }
+ }
+ }
+ }
+
+
+ /* Process "re-glowing" */
+ for (dy = -r; dy <= r; dy++)
+ {
+ for (dx = -r; dx <= r; dx++)
+ {
+ /* Extract the location */
+ yy = cy + dy;
+ xx = cx + dx;
+
+ /* Skip illegal grids */
+ if (!in_bounds(yy, xx)) continue;
+
+ /* Skip distant grids */
+ if (distance(cy, cx, yy, xx) > r) continue;
+
+ /* Access the grid */
+ c_ptr = &cave[yy][xx];
+
+ if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+ else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+ {
+ int ii, yyy, xxx;
+ cave_type *cc_ptr;
+
+ for (ii = 0; ii < 9; ii++)
+ {
+ yyy = yy + ddy_ddd[ii];
+ xxx = xx + ddx_ddd[ii];
+ if (!in_bounds2(yyy, xxx)) continue;
+ cc_ptr = &cave[yyy][xxx];
+ if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
+ {
+ c_ptr->info |= CAVE_GLOW;
+ break;
+ }
}
}
}
p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
/* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
/* Update the health bar */
p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
/* Window stuff */
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+ if (p_ptr->special_defense & NINJA_S_STEALTH)
+ {
+ if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+ }
+
/* Success */
return (TRUE);
}
+bool earthquake(int cy, int cx, int r)
+{
+ return earthquake_aux(cy, cx, r, 0);
+}
+
void discharge_minion(void)
{
delete_monster_idx(i);
continue;
}
- dam = m_ptr->hp / 2;
+ dam = m_ptr->maxhp / 2;
if (dam > 100) dam = (dam-100)/2 + 100;
if (dam > 400) dam = (dam-400)/2 + 400;
if (dam > 800) dam = 800;
project(i, 2+(r_ptr->level/20), m_ptr->fy,
m_ptr->fx, dam, GF_PLASMA,
- PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_MONSTER, -1);
+ PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
delete_monster_idx(i);
}
}
if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
/* Sometimes monsters wake up */
- if (m_ptr->csleep && (randint0(100) < chance))
+ if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
{
/* Wake up! */
- m_ptr->csleep = 0;
+ (void)set_monster_csleep(c_ptr->m_idx, 0);
/* Notice the "waking up" */
- if (m_ptr->ml)
+ if (is_seen(m_ptr))
{
char m_name[80];
/* Dump a message */
#ifdef JP
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
+ msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
#else
msg_format("%^s wakes up.", m_name);
#endif
- /* Redraw the health bar */
- if (p_ptr->health_who == c_ptr->m_idx)
- p_ptr->redraw |= (PR_HEALTH);
-
}
}
}
/* Redraw */
lite_spot(y, x);
+
+ update_local_illumination(y, x);
}
/* None left */
{
int y = temp_y[i];
int x = temp_x[i];
+ int j;
cave_type *c_ptr = &cave[y][x];
+ bool do_dark = !is_mirror_grid(c_ptr);
/* No longer in the array */
c_ptr->info &= ~(CAVE_TEMP);
/* Darken the grid */
- if (!(c_ptr->info & CAVE_IN_MIRROR ))c_ptr->info &= ~(CAVE_GLOW);
-
- /* Hack -- Forget "boring" grids */
- if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
+ if (do_dark)
{
- /* Forget the grid */
- c_ptr->info &= ~(CAVE_MARK);
+ if (dun_level || !is_daytime())
+ {
+ for (j = 0; j < 9; j++)
+ {
+ int by = y + ddy_ddd[j];
+ int bx = x + ddx_ddd[j];
- /* Notice */
- note_spot(y, x);
- }
+ if (in_bounds2(by, bx))
+ {
+ cave_type *cc_ptr = &cave[by][bx];
- /* Process affected monsters */
- if (c_ptr->m_idx)
- {
- /* Update the monster */
- update_mon(c_ptr->m_idx, FALSE);
- }
+ if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
+ {
+ do_dark = FALSE;
+ break;
+ }
+ }
+ }
- /* Redraw */
- lite_spot(y, x);
+ if (!do_dark) continue;
+ }
+
+ c_ptr->info &= ~(CAVE_GLOW);
+
+ /* Hack -- Forget "boring" grids */
+ if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
+ {
+ /* Forget the grid */
+ if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
+
+ /* Notice */
+ note_spot(y, x);
+ }
+
+ /* Process affected monsters */
+ if (c_ptr->m_idx)
+ {
+ /* Update the monster */
+ update_mon(c_ptr->m_idx, FALSE);
+ }
+
+ /* Redraw */
+ lite_spot(y, x);
+
+ update_local_illumination(y, x);
+ }
}
/* None left */
}
-
/*
* Determine how much contiguous open space this grid is next to
*/
-static int next_to_open(int cy, int cx)
+static int next_to_open(int cy, int cx, bool (*pass_bold)(int, int))
{
int i;
x = cx + ddx_cdd[i % 8];
/* Found a wall, break the length */
- if (!cave_floor_bold(y, x))
+ if (!pass_bold(y, x))
{
/* Track best length */
if (len > blen)
}
-static int next_to_walls_adj(int cy, int cx)
+static int next_to_walls_adj(int cy, int cx, bool (*pass_bold)(int, int))
{
int i;
y = cy + ddy_ddd[i];
x = cx + ddx_ddd[i];
- if (!cave_floor_bold(y, x)) c++;
+ if (!pass_bold(y, x)) c++;
}
return c;
/*
* Aux function -- see below
*/
-static void cave_temp_room_aux(int y, int x, bool only_room)
+static void cave_temp_room_aux(int y, int x, bool only_room, bool (*pass_bold)(int, int))
{
cave_type *c_ptr;
if (only_room) return;
/* Verify */
- if (!in_bounds(y, x)) return;
-
- /* If a wall, exit */
- if (!cave_floor_bold(y, x)) return;
+ if (!in_bounds2(y, x)) return;
/* Do not exceed the maximum spell range */
if (distance(py, px, y, x) > MAX_RANGE) return;
* properly.
* This leaves only a check for 6 bounding walls!
*/
- if ((next_to_walls_adj(y, x) == 6) && (next_to_open(y, x) <= 1)) return;
+ if (in_bounds(y, x) && pass_bold(y, x) &&
+ (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
}
/* Paranoia -- verify space */
/*
* Aux function -- see below
*/
+static bool cave_pass_lite_bold(int y, int x)
+{
+ return cave_los_bold(y, x);
+}
+
+/*
+ * Aux function -- see below
+ */
static void cave_temp_lite_room_aux(int y, int x)
{
- cave_temp_room_aux(y, x, FALSE);
+ cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
+}
+
+/*
+ * Aux function -- see below
+ */
+static bool cave_pass_dark_bold(int y, int x)
+{
+ return cave_have_flag_bold(y, x, FF_PROJECT);
}
/*
*/
static void cave_temp_unlite_room_aux(int y, int x)
{
- cave_temp_room_aux(y, x, TRUE);
+ cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
}
x = temp_x[i], y = temp_y[i];
/* Walls get lit, but stop light */
- if (!cave_floor_bold(y, x)) continue;
+ if (!cave_pass_lite_bold(y, x)) continue;
/* Spread adjacent */
cave_temp_lite_room_aux(y + 1, x);
/* Now, lite them all up at once */
cave_temp_room_lite();
+
+ if (p_ptr->special_defense & NINJA_S_STEALTH)
+ {
+ if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+ }
}
x = temp_x[i], y = temp_y[i];
/* Walls get dark, but stop darkness */
- if (!cave_floor_bold(y, x)) continue;
+ if (!cave_pass_dark_bold(y, x)) continue;
/* Spread adjacent */
cave_temp_unlite_room_aux(y + 1, x);
/* Lite up the room */
lite_room(py, px);
- if (p_ptr->special_defense & NINJA_S_STEALTH)
- {
- set_superstealth(FALSE);
- }
-
/* Assume seen */
return (TRUE);
}
{
int tx, ty;
- int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_NO_REF;
+ int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
if (typ == GF_CONTROL_LIVING) flg|= PROJECT_HIDE;
/* Use the given direction */
{
int tx, ty;
- int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_NO_REF;
+ int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
/* Use the given direction */
tx = px + 99 * ddx[dir];
{
int tx, ty;
- int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_NO_REF | PROJECT_HIDE;
+ int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
/* Use the given direction */
tx = px + 99 * ddx[dir];
*/
bool fire_meteor(int who, int typ, int y, int x, int dam, int rad)
{
- int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_NO_REF;
+ int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
/* Analyze the "target" and the caster. */
return (project(who, rad, y, x, dam, typ, flg, -1));
int ty, tx, y, x;
int i;
- int flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
+ int flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
/* Assume okay */
bool result = TRUE;
}
/* Use an actual "target" */
- else if (dir == 5)
+ else /* if (dir == 5) */
{
tx = target_col;
ty = target_row;
m_ptr = &m_list[c_ptr->m_idx];
r_ptr = &r_info[m_ptr->r_idx];
- if (r_ptr->flags3 & RF3_RES_TELE)
+ (void)set_monster_csleep(c_ptr->m_idx, 0);
+
+ if (r_ptr->flagsr & RFR_RES_TELE)
{
#ifdef JP
-msg_print("¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤵¤ì¤¿¡ª");
+ msg_print("¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤵¤ì¤¿¡ª");
#else
msg_print("Your teleportation is blocked!");
#endif
- m_ptr->csleep = 0;
+ if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
+
/* Failure */
return FALSE;
}
sound(SOUND_TELEPORT);
- cave[py][px].m_idx = c_ptr->m_idx;
-
- /* Update the old location */
- c_ptr->m_idx = p_ptr->riding;
-
- /* Move the monster */
- m_ptr->fy = py;
- m_ptr->fx = px;
-
- /* Move the player */
- px = tx;
- py = ty;
-
- if (p_ptr->riding)
- {
- m_list[p_ptr->riding].fy = ty;
- m_list[p_ptr->riding].fx = tx;
-
- /* Update the monster (new location) */
- update_mon(cave[ty][tx].m_idx, TRUE);
- }
-
- tx = m_ptr->fx;
- ty = m_ptr->fy;
-
- m_ptr->csleep = 0;
-
- /* Update the monster (new location) */
- update_mon(cave[ty][tx].m_idx, TRUE);
-
- /* Redraw the old grid */
- lite_spot(ty, tx);
-
- /* Redraw the new grid */
- lite_spot(py, px);
-
- /* Check for new panel (redraw map) */
- verify_panel();
-
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
-
- /* Notice changes in view */
- if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2 | RF7_SELF_LITE_1 | RF7_SELF_LITE_2))
- {
- /* Update some things */
- p_ptr->update |= (PU_MON_LITE);
- }
-
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
-
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- /* Redraw the health bar */
- if (p_ptr->health_who == cave[ty][tx].m_idx)
- p_ptr->redraw |= (PR_HEALTH);
-
- /* Handle stuff XXX XXX XXX */
- handle_stuff();
+ /* Swap the player and monster */
+ (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
/* Success */
return TRUE;
/*
- * Cast a bolt spell
- * Stop if we hit a monster, as a "bolt"
- * Affect monsters (not grids or objects)
+ * Cast a bolt spell.
+ * Stop if we hit a monster, as a "bolt".
+ * Affect monsters and grids (not objects).
*/
bool fire_bolt(int typ, int dir, int dam)
{
- int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
return (project_hook(typ, dir, dam, flg));
}
/*
- * Cast a beam spell
- * Pass through monsters, as a "beam"
- * Affect monsters (not grids or objects)
+ * Cast a beam spell.
+ * Pass through monsters, as a "beam".
+ * Affect monsters, grids and objects.
*/
bool fire_beam(int typ, int dir, int dam)
{
bool drain_life(int dir, int dam)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_OLD_DRAIN, dir, dam, flg));
}
bool heal_monster(int dir, int dam)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_OLD_HEAL, dir, dam, flg));
}
bool speed_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_OLD_SPEED, dir, p_ptr->lev, flg));
}
bool slow_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_OLD_SLOW, dir, p_ptr->lev, flg));
}
bool sleep_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_OLD_SLEEP, dir, p_ptr->lev, flg));
}
bool confuse_monster(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_OLD_CONF, dir, plev, flg));
}
bool stun_monster(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_STUN, dir, plev, flg));
}
bool poly_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
bool tester = (project_hook(GF_OLD_POLY, dir, p_ptr->lev, flg));
if (tester)
chg_virtue(V_CHANCE, 1);
bool clone_monster(int dir)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_OLD_CLONE, dir, 0, flg));
}
bool fear_monster(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_TURN_ALL, dir, plev, flg));
}
bool death_ray(int dir, int plev)
{
- int flg = PROJECT_STOP | PROJECT_KILL;
+ int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
}
bool dummy = (project(0, 1, py, px, 0, GF_STONE_WALL, flg, -1));
/* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
-
- /* Update the monsters */
- p_ptr->update |= (PU_MONSTERS);
+ p_ptr->update |= (PU_FLOW);
/* Redraw map */
p_ptr->redraw |= (PR_MAP);
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
return dummy;
}
}
case 32: case 33:
if (!(*count))
- {
+ {
#ifdef JP
msg_print("¼þ°Ï¤Î¶õ´Ö¤¬ÏĤó¤À¡ª");
#else
msg_print("Space warps about you!");
#endif
- teleport_player(damroll(10, 10));
+ teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
if (randint0(13)) (*count) += activate_hi_summon(py, px, FALSE);
if (!one_in_(6)) break;
}
if (randint1(80 + p_ptr->lev) < 70)
{
- while(attempts--)
+ while (attempts--)
{
scatter(&y, &x, py, px, 4, 0);
- if (!cave_floor_bold(y, x)) continue;
+ if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
- if ((y != py) || (x != px)) break;
+ if (!player_bold(y, x)) break;
}
project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
for (i = 0; i < num; i++)
{
- while(1)
+ while (1)
{
scatter(&y, &x, py, px, 10, 0);
- if ((y != py) && (x != px)) break;
+ if (!player_bold(y, x)) break;
}
project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
}
-void kawarimi(bool success)
+bool kawarimi(bool success)
{
object_type forge;
object_type *q_ptr = &forge;
int y, x;
- if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return;
- if (randint0(200) < p_ptr->stun) return;
+ if (p_ptr->is_dead) return FALSE;
+ if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
+ if (randint0(200) < p_ptr->stun) return FALSE;
if (!success && one_in_(3))
{
#endif
p_ptr->special_defense &= ~(NINJA_KAWARIMI);
p_ptr->redraw |= (PR_STATUS);
- return;
+ return FALSE;
}
y = py;
x = px;
- teleport_player(10+randint1(90));
+ teleport_player(10 + randint1(90), 0L);
object_wipe(q_ptr);
p_ptr->special_defense &= ~(NINJA_KAWARIMI);
p_ptr->redraw |= (PR_STATUS);
+
+ /* Teleported */
+ return TRUE;
+}
+
+
+/*
+ * "Rush Attack" routine for Samurai or Ninja
+ * Return value is for checking "done"
+ */
+bool rush_attack(bool *mdeath)
+{
+ int dir;
+ int tx, ty;
+ int tm_idx = 0;
+ u16b path_g[32];
+ int path_n, i;
+ bool tmp_mdeath = FALSE;
+ bool moved = FALSE;
+
+ if (mdeath) *mdeath = FALSE;
+
+ project_length = 5;
+ if (!get_aim_dir(&dir)) return FALSE;
+
+ /* Use the given direction */
+ tx = px + project_length * ddx[dir];
+ ty = py + project_length * ddy[dir];
+
+ /* Hack -- Use an actual "target" */
+ if ((dir == 5) && target_okay())
+ {
+ tx = target_col;
+ ty = target_row;
+ }
+
+ if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
+
+ path_n = project_path(path_g, project_length, py, px, ty, tx, PROJECT_STOP | PROJECT_KILL);
+ project_length = 0;
+
+ /* No need to move */
+ if (!path_n) return TRUE;
+
+ /* Use ty and tx as to-move point */
+ ty = py;
+ tx = px;
+
+ /* Project along the path */
+ for (i = 0; i < path_n; i++)
+ {
+ monster_type *m_ptr;
+
+ int ny = GRID_Y(path_g[i]);
+ int nx = GRID_X(path_g[i]);
+
+ if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
+ {
+ ty = ny;
+ tx = nx;
+
+ /* Go to next grid */
+ continue;
+ }
+
+ if (!cave[ny][nx].m_idx)
+ {
+ if (tm_idx)
+ {
+#ifdef JP
+ msg_print("¼ºÇÔ¡ª");
+#else
+ msg_print("Failed!");
+#endif
+ }
+ else
+ {
+#ifdef JP
+ msg_print("¤³¤³¤Ë¤ÏÆþ¿È¤Ç¤ÏÆþ¤ì¤Ê¤¤¡£");
+#else
+ msg_print("You can't move to that place.");
+#endif
+ }
+
+ /* Exit loop */
+ break;
+ }
+
+ /* Move player before updating the monster */
+ if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+
+ /* Update the monster */
+ update_mon(cave[ny][nx].m_idx, TRUE);
+
+ /* Found a monster */
+ m_ptr = &m_list[cave[ny][nx].m_idx];
+
+ if (tm_idx != cave[ny][nx].m_idx)
+ {
+#ifdef JP
+ msg_format("%s%s¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª", tm_idx ? "Ê̤Î" : "",
+ m_ptr->ml ? "¥â¥ó¥¹¥¿¡¼" : "²¿¤«");
+#else
+ msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
+#endif
+ }
+ else if (!player_bold(ty, tx))
+ {
+ /* Hold the monster name */
+ char m_name[80];
+
+ /* Get the monster name (BEFORE polymorphing) */
+ monster_desc(m_name, m_ptr, 0);
+#ifdef JP
+ msg_format("ÁÇÁ᤯%s¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª", m_name);
+#else
+ msg_format("You quickly jump in and attack %s!", m_name);
+#endif
+ }
+
+ if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+ moved = TRUE;
+ tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
+
+ break;
+ }
+
+ if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+
+ if (mdeath) *mdeath = tmp_mdeath;
+ return TRUE;
+}
+
+
+/*
+ * Remove all mirrors in this floor
+ */
+void remove_all_mirrors(bool explode)
+{
+ int x, y;
+
+ for (x = 0; x < cur_wid; x++)
+ {
+ for (y = 0; y < cur_hgt; y++)
+ {
+ if (is_mirror_grid(&cave[y][x]))
+ {
+ remove_mirror(y, x);
+ if (explode)
+ project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
+ (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
+ }
+ }
+ }
}