#include "angband.h"
+#include "util.h"
+
+#include "cmd-dump.h"
+#include "dungeon.h"
+#include "floor.h"
+#include "grid.h"
#include "monster.h"
#include "monster-status.h"
+#include "monster-spell.h"
+#include "monster-process.h"
+#include "spells.h"
#include "spells-summon.h"
#include "monsterrace-hook.h"
#include "object-curse.h"
#include "artifact.h"
#include "avatar.h"
+#include "files.h"
+#include "player-effects.h"
+#include "view-mainwindow.h"
+#include "world.h"
+
+/*!
+* @brief モンスターIDからPOWERFULフラグの有無を取得する /
+* @param m_idx モンスターID
+* @return POWERFULフラグがあればTRUE、なければFALSEを返す。
+*/
+bool monster_is_powerful(MONSTER_IDX m_idx)
+{
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
+ bool powerful = r_ptr->flags2 & RF2_POWERFUL ? TRUE : FALSE;
+ return powerful;
+}
+/*!
+* @brief モンスターIDからモンスターのレベルを取得する(ただし最低1を保証する) /
+* @param m_idx モンスターID
+* @return モンスターのレベル
+*/
+DEPTH monster_level_idx(MONSTER_IDX m_idx)
+{
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
+ DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
+ return rlev;
+}
/*!
* @brief モンスターに与えたダメージの修正処理 /
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;
/*
*/
int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
{
- s16b *cur_mproc_list = mproc_list[mproc_type];
+ s16b *cur_mproc_list = current_floor_ptr->mproc_list[mproc_type];
int i;
- for (i = mproc_max[mproc_type] - 1; i >= 0; i--)
+ for (i = current_floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
{
if (cur_mproc_list[i] == m_idx) return i;
}
*/
static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
{
- if (mproc_max[mproc_type] < current_floor_ptr->max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = (s16b)m_idx;
+ if (current_floor_ptr->mproc_max[mproc_type] < current_floor_ptr->max_m_idx) current_floor_ptr->mproc_list[mproc_type][current_floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
}
static void mproc_remove(MONSTER_IDX m_idx, int mproc_type)
{
int mproc_idx = get_mproc_idx(m_idx, mproc_type);
- if (mproc_idx >= 0) mproc_list[mproc_type][mproc_idx] = mproc_list[mproc_type][--mproc_max[mproc_type]];
+ if (mproc_idx >= 0) current_floor_ptr->mproc_list[mproc_type][mproc_idx] = current_floor_ptr->mproc_list[mproc_type][--current_floor_ptr->mproc_max[mproc_type]];
}
MONSTER_IDX i;
int cmi;
- /* Reset "mproc_max[]" */
- for (cmi = 0; cmi < MAX_MTIMED; cmi++) mproc_max[cmi] = 0;
+ /* Reset "current_floor_ptr->mproc_max[]" */
+ for (cmi = 0; cmi < MAX_MTIMED; cmi++) current_floor_ptr->mproc_max[cmi] = 0;
/* Process the monsters (backwards) */
- for (i = m_max - 1; i >= 1; i--)
+ for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
{
/* Access the monster */
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++)
{
/*!
-* @brief モンスターの睡眠状態値をセットする /
+* @brief モンスターの睡眠状態値をセットする。0で起きる。 /
* Set "m_ptr->mtimed[MTIMED_CSLEEP]", notice observable changes
* @param m_idx モンスター参照ID
* @param v セットする値
void process_monsters_mtimed(int mtimed_idx)
{
int i;
- s16b *cur_mproc_list = mproc_list[mtimed_idx];
+ s16b *cur_mproc_list = current_floor_ptr->mproc_list[mtimed_idx];
/* Hack -- calculate the "player noise" */
if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl));
/* Process the monsters (backwards) */
- for (i = mproc_max[mtimed_idx] - 1; i >= 0; i--)
+ for (i = current_floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
{
/* Access the monster */
process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx);
* @param vs_player TRUEならば時間停止開始処理を行う
* @return 時間停止が行われている状態ならばTRUEを返す
*/
-bool process_the_world(int num, MONSTER_IDX who, bool vs_player)
+bool set_monster_timewalk(int num, MONSTER_IDX who, bool vs_player)
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[hack_m_idx]; /* the world monster */
- if (world_monster) return (FALSE);
+ if (current_world_ptr->timewalk_m_idx) return (FALSE);
if (vs_player)
{
}
/* This monster cast spells */
- world_monster = hack_m_idx;
+ current_world_ptr->timewalk_m_idx = hack_m_idx;
if (vs_player) do_cmd_redraw();
while (num--)
{
- if (!m_ptr->r_idx) break;
- process_monster(world_monster);
+ if (!monster_is_valid(m_ptr)) break;
+ process_monster(current_world_ptr->timewalk_m_idx);
reset_target(m_ptr);
handle_stuff();
p_ptr->update |= (PU_MONSTERS);
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
- world_monster = 0;
+ current_world_ptr->timewalk_m_idx = 0;
if (vs_player || (player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)))
{
msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
* @param s_idx 撃破されたモンスター種族の参照ID
* @return なし
*/
-void monster_gain_exp(MONSTER_IDX m_idx, IDX s_idx)
+void monster_gain_exp(MONSTER_IDX m_idx, MONRACE_IDX s_idx)
{
monster_type *m_ptr;
monster_race *r_ptr;
monster_race *s_ptr;
int new_exp;
-
- /* Paranoia */
if (m_idx <= 0 || s_idx <= 0) return;
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);
if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
{
- if (!current_floor_ptr->dun_level && !ambush_flag && !p_ptr->inside_arena)
+ if (!current_floor_ptr->dun_level && !p_ptr->ambush_flag && !p_ptr->inside_arena)
{
chg_virtue(V_VALOUR, -1);
}
else if (!m_ptr->ml)
{
#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_format("せっかくだから%sを殺した。", m_name);
else
msg_format("%sを殺した。", m_name);
else
{
#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_format("せっかくだから%sを倒した。", m_name);
else
msg_format("%sを倒した。", m_name);
else
{
#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_format("せっかくだから%sを葬り去った。", m_name);
else
msg_format("%sを葬り去った。", m_name);
{
for (i = 0; i < MAX_KUBI; i++)
{
- if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
+ if ((current_world_ptr->bounty_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
{
msg_format(_("%sの首には賞金がかかっている。", "There is a price on %s's head."), m_name);
break;
return (FALSE);
}
+bool monster_is_valid(monster_type *m_ptr)
+{
+ return (m_ptr->r_idx != 0);
+}
\ No newline at end of file