if (p_ptr->riding && (m_list[p_ptr->riding].mspeed < 135))
{
- if (m_list[p_ptr->riding].fast) return (TRUE);
+ if (MON_FAST(&m_list[p_ptr->riding])) return (TRUE);
}
/* No need to cast dispel spell */
}
/* Hurt badly or afraid, attempt to flee */
- if (((m_ptr->hp < m_ptr->maxhp / 3) || m_ptr->monfear) && one_in_(2))
+ if (((m_ptr->hp < m_ptr->maxhp / 3) || MON_MONFEAR(m_ptr)) && one_in_(2))
{
/* Choose escape spell if possible */
if (escape_num) return (escape[randint0(escape_num)]);
}
/* Cast globe of invulnerability if not already in effect */
- if (invul_num && !(m_ptr->invulner) && (randint0(100) < 50))
+ if (invul_num && !m_ptr->mtimed[MTIMED_INVULNER] && (randint0(100) < 50))
{
/* Choose Globe of Invulnerability */
return (invul[randint0(invul_num)]);
}
/* Haste self if we aren't already somewhat hasted (rarely) */
- if (haste_num && (randint0(100) < 20) && !(m_ptr->fast))
+ if (haste_num && (randint0(100) < 20) && !MON_FAST(m_ptr))
{
/* Choose haste spell */
return (haste[randint0(haste_num)]);
bool in_no_magic_dungeon = (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && dun_level
&& (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest));
+ bool can_use_lite_area = FALSE;
+
+ bool can_remember;
+
/* Cannot cast spells when confused */
- if (m_ptr->confused)
+ if (MON_CONFUSED(m_ptr))
{
reset_target(m_ptr);
return (FALSE);
c_ptr = &cave[next_y][next_x];
/* Skip door, rubble, wall, tree, mountain, etc. */
- if (!have_flag(f_flags_grid(c_ptr), FF_PROJECT)) continue;
+ if (!cave_have_flag_grid(c_ptr, FF_PROJECT)) continue;
if (projectable(m_ptr->fy, m_ptr->fx, next_y, next_x))
{
f6 &= ~(RF6_NOMAGIC_MASK);
}
- if (!p_ptr->csp)
+ if (f6 & RF6_DARKNESS)
{
- f5 &= ~(RF5_DRAIN_MANA);
- }
+ if ((p_ptr->pclass == CLASS_NINJA) &&
+ !(r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) &&
+ !(r_ptr->flags7 & RF7_DARK_MASK))
+ can_use_lite_area = TRUE;
- if ((p_ptr->pclass == CLASS_NINJA) &&
- ((r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) ||
- (r_ptr->flags7 & RF7_DARK_MASK)))
- {
- f6 &= ~(RF6_DARKNESS);
+ if (!(r_ptr->flags2 & RF2_STUPID))
+ {
+ if (d_info[dungeon_type].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
+ else if ((p_ptr->pclass == CLASS_NINJA) && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
+ }
}
if (in_no_magic_dungeon && !(r_ptr->flags2 & RF2_STUPID))
if (!(r_ptr->flags2 & RF2_STUPID))
{
+ if (!p_ptr->csp) f5 &= ~(RF5_DRAIN_MANA);
+
/* Check for a clean bolt shot */
if (((f4 & RF4_BOLT_MASK) ||
(f5 & RF5_BOLT_MASK) ||
/* Check for spell failure (inate attacks never fail) */
if (!spell_is_inate(thrown_spell)
- && (in_no_magic_dungeon || (m_ptr->stunned && one_in_(2)) || (randint0(100) < failrate)))
+ && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2)) || (randint0(100) < failrate)))
{
disturb(1, 0);
/* Message */
/* Projectable? */
direct = player_bold(y, x);
+ can_remember = is_original_ap_and_seen(m_ptr);
+
/* Cast the spell. */
switch (thrown_spell)
{
#else
msg_print("Your hands stop glowing.");
#endif
-
}
- if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0]))
+ if (music_singing_any())
{
p_ptr->magic_num1[1] = p_ptr->magic_num1[0];
p_ptr->magic_num1[0] = 0;
p_ptr->energy_need += ENERGY_NEED();
}
- if (p_ptr->riding)
- {
- monster_type *riding_ptr = &m_list[p_ptr->riding];
- if (riding_ptr->invulner)
- {
- riding_ptr->invulner = 0;
- riding_ptr->energy_need += ENERGY_NEED();
- }
- riding_ptr->fast = 0;
- riding_ptr->slow = 0;
- p_ptr->update |= PU_BONUS;
- if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= PR_HEALTH;
- p_ptr->redraw |= (PR_UHEALTH);
- }
+ if (p_ptr->riding) dispel_monster_status(p_ptr->riding);
#ifdef JP
if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
}
/* Allow quick speed increases to base+10 */
- if (!m_ptr->fast)
+ if (set_monster_fast(m_idx, MON_FAST(m_ptr) + 100))
{
#ifdef JP
-msg_format("%^s¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£", m_name);
+ msg_format("%^s¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£", m_name);
#else
msg_format("%^s starts moving faster.", m_name);
#endif
}
- m_ptr->fast = MIN(200, m_ptr->fast + 100);
- if (p_ptr->riding == m_idx) p_ptr->update |= PU_BONUS;
break;
}
if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
/* Cancel fear */
- if (m_ptr->monfear)
+ if (MON_MONFEAR(m_ptr))
{
/* Cancel fear */
- m_ptr->monfear = 0;
+ (void)set_monster_monfear(m_idx, 0);
/* Message */
#ifdef JP
-msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
+ msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
#else
msg_format("%^s recovers %s courage.", m_name, m_poss);
#endif
-
}
break;
}
}
- if (!(m_ptr->invulner))
- m_ptr->invulner = randint1(4) + 4;
-
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (!MON_INVULNER(m_ptr)) (void)set_monster_invulner(m_idx, randint1(4) + 4, FALSE);
break;
}
/* RF6_TPORT */
case 160+5:
{
- int i, oldfy, oldfx;
- u32b flgs[TR_FLAG_SIZE];
- object_type *o_ptr;
-
- oldfy = m_ptr->fy;
- oldfx = m_ptr->fx;
-
disturb(1, 0);
#ifdef JP
-msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
+ msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
#else
msg_format("%^s teleports away.", m_name);
#endif
- teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE, FALSE);
-
- if (los(py, px, oldfy, oldfx) && !world_monster)
- {
- for (i=INVEN_RARM;i<INVEN_TOTAL;i++)
- {
- o_ptr = &inventory[i];
- if (!object_is_cursed(o_ptr))
- {
- object_flags(o_ptr, flgs);
-
- if ((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
- {
-#ifdef JP
- if (get_check_strict("¤Ä¤¤¤Æ¤¤¤¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
-#else
- if (get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
-#endif
- {
- if (one_in_(3))
- {
- teleport_player(200, TRUE);
-#ifdef JP
- msg_print("¼ºÇÔ¡ª");
-#else
- msg_print("Failed!");
-#endif
- }
- else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, FALSE);
- p_ptr->energy_need += ENERGY_NEED();
- }
- break;
- }
- }
- }
- }
+ teleport_away_followable(m_idx);
break;
}
#endif
learn_spell(MS_TELE_AWAY);
- teleport_player(100, TRUE);
+ teleport_player_away(m_idx, 100);
break;
}
if (!direct) return (FALSE);
disturb(1, 0);
#ifdef JP
-if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
+ if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
#else
if (blind) msg_format("%^s mumbles.", m_name);
#endif
#ifdef JP
-else if (p_ptr->pclass == CLASS_NINJA) msg_format("%^s¤¬ÊÕ¤ê¤òÌÀ¤ë¤¯¾È¤é¤·¤¿¡£", m_name);
-else msg_format("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", m_name);
+ else if (can_use_lite_area) msg_format("%^s¤¬ÊÕ¤ê¤òÌÀ¤ë¤¯¾È¤é¤·¤¿¡£", m_name);
+ else msg_format("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", m_name);
#else
- else if (p_ptr->pclass == CLASS_NINJA)
- msg_format("%^s cast a spell to light up.", m_name);
+ else if (can_use_lite_area) msg_format("%^s cast a spell to light up.", m_name);
else msg_format("%^s gestures in shadow.", m_name);
#endif
- learn_spell(MS_DARKNESS);
- if (p_ptr->pclass == CLASS_NINJA)
- (void)lite_area(0, 3);
+ if (can_use_lite_area) (void)lite_area(0, 3);
else
+ {
+ learn_spell(MS_DARKNESS);
(void)unlite_area(0, 3);
+ }
break;
}
}
/* Remember what the monster did to us */
- if (seen && is_original_ap(m_ptr))
+ if (can_remember)
{
/* Inate spell */
if (thrown_spell < 32 * 4)