#include "spells-floor.h"
#include "realm-hex.h"
#include "player-status.h"
+#include "monster-status.h"
/*!
* @brief アイテムの発動効果テーブル /
m_ptr = ¤t_floor_ptr->m_list[i];
/* Ignore "dead" monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
r_ptr = &r_info[m_ptr->r_idx];
#include "sort.h"
#include "player-status.h"
#include "object-hook.h"
+#include "monster-status.h"
/*!
* @brief プレイヤーの騎乗/下馬処理判定
monster_race *r_ptr;
m_ptr = ¤t_floor_ptr->m_list[m_idx];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
r_ptr = &r_info[m_ptr->r_idx];
if (is_pet(m_ptr))
#include "artifact.h"
#include "avatar.h"
#include "object-hook.h"
+#include "monster-status.h"
/*
m_ptr = ¤t_floor_ptr->m_list[i];
/* Ignore "dead" monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Calculate "upkeep" for pets */
if (is_pet(m_ptr))
#include "realm-hex.h"
#include "object-hook.h"
#include "wild.h"
+#include "monster-status.h"
static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Allow regeneration (if needed) */
if (m_ptr->hp < m_ptr->maxhp)
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (r_ptr->level >= p_ptr->lev)
{
int delta = 0;
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Ignore pet */
if (is_pet(m_ptr)) continue;
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(m_idx, FALSE);
m_ptr = ¤t_floor_ptr->m_list[m_idx];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip unseen monsters */
if (!m_ptr->ml) continue;
m_ptr = ¤t_floor_ptr->m_list[m_idx];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Nice monsters get mean */
if (m_ptr->mflag & MFLAG_NICE)
#include "shoot.h"
#include "player-move.h"
#include "patron.h"
+#include "monster-status.h"
/*
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (!is_pet(m_ptr)) continue;
pet_settings = TRUE;
if (!m_ptr->nickname && (p_ptr->riding != i)) continue;
#include "quest.h"
#include "player-status.h"
#include "wild.h"
+#include "monster-status.h"
int dun_tun_rnd;
int dun_tun_chg;
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
update_monster(i, FALSE);
#include "quest.h"
#include "wild.h"
#include "spells-floor.h"
+#include "monster-status.h"
static FLOOR_IDX new_floor_id; /*!<次のフロアのID / floor_id of the destination */
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (!is_pet(m_ptr)) continue;
if (i == p_ptr->riding) continue;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
GAME_TEXT m_name[MAX_NLEN];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (!is_pet(m_ptr)) continue;
if (!m_ptr->nickname) continue;
if (p_ptr->riding == i) continue;
m_ptr = &party_mon[i];
/* Skip empty monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Hack -- Increase the racial counter */
real_r_ptr(m_ptr)->cur_num++;
monster_race *r_ptr;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Extract real monster race */
r_ptr = real_r_ptr(m_ptr);
monster_race *r_ptr;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Only maintain quest monsters */
if (quest_r_idx != m_ptr->r_idx) continue;
monster_race *r_ptr;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (!is_pet(m_ptr))
{
#include "monster.h"
#include "quest.h"
#include "feature.h"
+#include "monster-status.h"
static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
static int match_autopick;
r_ptr = &r_info[m_ptr->r_idx];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Is it too far away? */
if (m_ptr->cdis > dis_lim) continue;
int d_dice = r_ptr->blow[ap_cnt].d_dice;
int d_side = r_ptr->blow[ap_cnt].d_side;
-
- if (!m_ptr->r_idx) break;
+ if (!monster_is_valid(m_ptr)) break;
/* Hack -- no more attacks */
if (!method) break;
#include "feature.h"
#include "grid.h"
#include "player-move.h"
+#include "monster-status.h"
/*!
/* The monster itself isn't a target */
if (t_ptr == m_ptr) continue;
- /* Paranoia -- Skip dead monsters */
- if (!t_ptr->r_idx) continue;
+ if (!monster_is_valid(t_ptr)) continue;
if (is_pet(m_ptr))
{
int d_dice = r_ptr->blow[ap_cnt].d_dice;
int d_side = r_ptr->blow[ap_cnt].d_side;
- if (!m_ptr->r_idx) break;
+ if (!monster_is_valid(m_ptr)) break;
/* Stop attacking if the target dies! */
if (t_ptr->fx != x_saver || t_ptr->fy != y_saver)
{
cave_alter_feat(ny, nx, FF_BASH);
- if (!m_ptr->r_idx) /* Killed by shards of glass, etc. */
+ if (!monster_is_valid(m_ptr)) /* Killed by shards of glass, etc. */
{
/* Update some things */
p_ptr->update |= (PU_FLOW);
note_spot(ny, nx);
lite_spot(ny, nx);
- if (!m_ptr->r_idx) return;
+ if (!monster_is_valid(m_ptr)) return;
/* Allow movement */
do_move = TRUE;
}
cave_alter_feat(ny, nx, FF_HURT_DISI);
- if (!m_ptr->r_idx) /* Killed by shards of glass, etc. */
+ if (!monster_is_valid(m_ptr)) /* Killed by shards of glass, etc. */
{
/* Update some things */
p_ptr->update |= (PU_FLOW);
if (p_ptr->leaving) break;
/* Ignore "dead" monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (p_ptr->wild_mode) continue;
s32b div_h;
u32b div_l;
- if (!m_ptr->r_idx) return;
+ if (!monster_is_valid(m_ptr)) return;
if (is_pet(m_ptr) || p_ptr->inside_battle) return;
/*
m_ptr = ¤t_floor_ptr->m_list[i];
/* Ignore "dead" monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
for (cmi = 0; cmi < MAX_MTIMED; cmi++)
{
while (num--)
{
- if (!m_ptr->r_idx) break;
+ if (!monster_is_valid(m_ptr)) break;
process_monster(current_world_ptr->timewalk_m_idx);
reset_target(m_ptr);
handle_stuff();
m_ptr = ¤t_floor_ptr->m_list[m_idx];
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) return;
+ if (!monster_is_valid(m_ptr)) return;
r_ptr = &r_info[m_ptr->r_idx];
s_ptr = &r_info[s_idx];
get_exp_from_mon(expdam, &exp_mon);
/* Genocided by chaos patron */
- if (!m_ptr->r_idx) m_idx = 0;
+ if (!monster_is_valid(m_ptr)) m_idx = 0;
/* Redraw (later) if needed */
if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
return (FALSE);
}
+bool monster_is_valid(monster_type *m_ptr)
+{
+ return (!m_ptr->r_idx);
+}
\ No newline at end of file
extern HIT_POINT mon_damage_mod(monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear);
extern bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note);
extern int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type);
+extern bool monster_is_valid(monster_type *m_ptr);
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Paranoia -- skip "dead" monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Hack -- High level monsters start out "immune" */
if (r_ptr->level > cur_lev) continue;
for (i = m_max - 1; i >= 1; i--)
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Monster is gone */
current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].m_idx = 0;
for (i = 1; i < m_max; i++)
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
update_monster(i, full);
}
}
#include "quest.h"
#include "realm-hex.h"
#include "player-move.h"
+#include "monster-status.h"
/*!
* @brief モンスターが敵対モンスターにビームを当てること可能かを判定する /
target_idx = dummy;
t_ptr = ¤t_floor_ptr->m_list[target_idx];
- /* Skip dead monsters */
- if (!t_ptr->r_idx) continue;
+ if (!monster_is_valid(t_ptr)) continue;
/* Monster must be 'an enemy' */
if ((m_idx == target_idx) || !are_enemies(m_ptr, t_ptr)) continue;
#include "angband.h"
#include "spells-summon.h"
+#include "monster-status.h"
/*!
* @brief トランプ魔法独自の召喚処理を行う / Handle summoning and failure of trump spells
for (i = m_max - 1; i > 0; i--)
{
m_ptr = ¤t_floor_ptr->m_list[i];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
#include "spells-floor.h"
#include "realm-hex.h"
#include "object-hook.h"
+#include "monster-status.h"
/*!
* @brief プレイヤー周辺の地形を感知する
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip aggravating monster (or player) */
if (i == who) continue;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip "wrong" monsters */
if (r_ptr->d_char != typ) continue;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip distant monsters */
if (m_ptr->cdis > MAX_SIGHT) continue;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Require line of sight */
if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
#include "artifact.h"
#include "avatar.h"
#include "spells-floor.h"
+#include "monster-status.h"
/*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
/* Paranoia */
- if (!m_ptr->r_idx) return (FALSE);
+ if (!monster_is_valid(m_ptr)) return (FALSE);
oy = m_ptr->fy;
ox = m_ptr->fx;
struct monster_type
{
- MONRACE_IDX r_idx; /* Monster race index */
+ MONRACE_IDX r_idx; /* Monster race index 0 = dead. */
MONRACE_IDX ap_r_idx; /* Monster race appearance index */
byte sub_align; /* Sub-alignment for a neutral monster */
#include "realm-hex.h"
#include "player-status.h"
#include "grid.h"
+#include "monster-status.h"
/*
* Wilderness
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (is_pet(m_ptr) && i != p_ptr->riding) have_pet = TRUE;
if (MON_CSLEEP(m_ptr)) continue;
if (m_ptr->cdis > MAX_SIGHT) continue;
#include "spells-floor.h"
#include "object-hook.h"
+#include "monster-status.h"
#ifdef ALLOW_WIZARD
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip the mount */
if (i == p_ptr->riding) continue;
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip the mount */
if (i == p_ptr->riding) continue;
#include "mutation.h"
#include "floor-events.h"
#include "player-move.h"
+#include "monster-status.h"
#define REWARD_CHANCE 10
monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
/* Monster must be alive */
- if (!m_ptr->r_idx) return (FALSE);
+ if (!monster_is_valid(m_ptr)) return (FALSE);
/* Hack -- no targeting hallucinations */
if (p_ptr->image) return (FALSE);