#include "angband.h"
+#include "core.h"
+#include "util.h"
+
+#include "creature.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 "player-personality.h"
+#include "view-mainwindow.h"
+#include "world.h"
+#include "report.h"
+#include "melee.h"
+/*!
+* @brief モンスターIDからPOWERFULフラグの有無を取得する /
+* @param floor_ptr 現在フロアへの参照ポインタ
+* @param m_idx モンスターID
+* @return POWERFULフラグがあればTRUE、なければFALSEを返す。
+*/
+bool monster_is_powerful(floor_type *floor_ptr, MONSTER_IDX m_idx)
+{
+ monster_type *m_ptr = &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(floor_type *floor_ptr, MONSTER_IDX m_idx)
+{
+ monster_type *m_ptr = &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 モンスターに与えたダメージの修正処理 /
* Modify the physical damage done to the monster.
+ * @param target_ptr プレーヤーへの参照ポインタ
* @param m_ptr ダメージを受けるモンスターの構造体参照ポインタ
* @param dam ダメージ基本値
* @param is_psy_spear 攻撃手段が光の剣ならばTRUE
* "type" is not yet used and should be 0.
* </pre>
*/
-HIT_POINT mon_damage_mod(monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear)
+HIT_POINT mon_damage_mod(player_type *target_ptr, monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
{
if (is_psy_spear)
{
- if (!p_ptr->blind && is_seen(m_ptr))
+ if (!target_ptr->blind && is_seen(m_ptr))
{
msg_print(_("バリアを切り裂いた!", "The barrier is penetrated!"));
}
}
else if (!one_in_(PENETRATE_INVULNERABILITY))
{
- return (0);
+ return 0;
}
}
- return (dam);
-}
+ return dam;
+}
/*!
* experience point of a monster later.
* </pre>
*/
-static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr)
+static void get_exp_from_mon(player_type *target_ptr, HIT_POINT dam, monster_type *m_ptr)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
+ if (!monster_is_valid(m_ptr)) return;
+ if (is_pet(m_ptr) || target_ptr->phase_out) return;
+
+ /*!
+ * todo 変数宣言と代入を同時に実行するとコンパイル警告が出る
+ * ここの整形は実施せず保留
+ */
s32b new_exp;
u32b new_exp_frac;
s32b div_h;
u32b div_l;
- if (!m_ptr->r_idx) return;
- if (is_pet(m_ptr) || p_ptr->inside_battle) return;
-
/*
* - Ratio of monster's level to player's level effects
* - Varying speed effects
new_exp = r_ptr->level * SPEED_TO_ENERGY(m_ptr->mspeed) * dam;
new_exp_frac = 0;
div_h = 0L;
- div_l = (p_ptr->max_plv + 2) * SPEED_TO_ENERGY(r_ptr->speed);
+ div_l = (target_ptr->max_plv + 2) * SPEED_TO_ENERGY(r_ptr->speed);
/* Use (average maxhp * 2) as a denominator */
if (!(r_ptr->flags1 & RF1_FORCE_MAXHP))
s64b_mul(&div_h, &div_l, 0, r_ptr->hdice * (ironman_nightmare ? 2 : 1) * r_ptr->hside * 2);
/* Special penalty in the wilderness */
- if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
+ if (!target_ptr->current_floor_ptr->dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE)))
s64b_mul(&div_h, &div_l, 0, 5);
/* Do division first to prevent overflaw */
}
}
- /* Finally multiply base experience point of the monster */
s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
-
- /* Gain experience */
- gain_exp_64(new_exp, new_exp_frac);
+ gain_exp_64(target_ptr, new_exp, new_exp_frac);
}
-
/*!
* @brief モンスターの時限ステータスを取得する
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return m_idx モンスターの参照ID
* @return mproc_type モンスターの時限ステータスID
* @return 残りターン値
*/
-int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
+int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
{
- s16b *cur_mproc_list = mproc_list[mproc_type];
- int i;
-
- for (i = mproc_max[mproc_type] - 1; i >= 0; i--)
+ s16b *cur_mproc_list = floor_ptr->mproc_list[mproc_type];
+ for (int i = floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
{
if (cur_mproc_list[i] == m_idx) return i;
}
return -1;
}
+
/*!
* @brief モンスターの時限ステータスリストを追加する
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return m_idx モンスターの参照ID
* @return mproc_type 追加したいモンスターの時限ステータスID
* @return なし
*/
-static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
+static void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
{
- if (mproc_max[mproc_type] < max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = (s16b)m_idx;
+ if (floor_ptr->mproc_max[mproc_type] < current_world_ptr->max_m_idx)
+ {
+ floor_ptr->mproc_list[mproc_type][floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
+ }
}
/*!
* @brief モンスターの時限ステータスリストを削除
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return m_idx モンスターの参照ID
* @return mproc_type 削除したいモンスターの時限ステータスID
* @return なし
*/
-static void mproc_remove(MONSTER_IDX m_idx, int mproc_type)
+static void mproc_remove(floor_type *floor_ptr, 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]];
+ int mproc_idx = get_mproc_idx(floor_ptr, m_idx, mproc_type);
+ if (mproc_idx >= 0)
+ {
+ floor_ptr->mproc_list[mproc_type][mproc_idx] = floor_ptr->mproc_list[mproc_type][--floor_ptr->mproc_max[mproc_type]];
+ }
}
/*!
* @brief モンスターの時限ステータスリストを初期化する / Initialize monster process
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return なし
*/
-void mproc_init(void)
+void mproc_init(floor_type *floor_ptr)
{
- monster_type *m_ptr;
- MONSTER_IDX i;
- int cmi;
-
- /* Reset "mproc_max[]" */
- for (cmi = 0; cmi < MAX_MTIMED; cmi++) mproc_max[cmi] = 0;
+ /* Reset "target_ptr->current_floor_ptr->mproc_max[]" */
+ for (int i = 0; i < MAX_MTIMED; i++)
+ {
+ floor_ptr->mproc_max[i] = 0;
+ }
/* Process the monsters (backwards) */
- for (i = m_max - 1; i >= 1; i--)
+ for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--)
{
- /* Access the monster */
- m_ptr = &m_list[i];
+ monster_type *m_ptr;
+ m_ptr = &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++)
+ for (int cmi = 0; cmi < MAX_MTIMED; cmi++)
{
- if (m_ptr->mtimed[cmi]) mproc_add(i, cmi);
+ if (m_ptr->mtimed[cmi]) mproc_add(floor_ptr, i, cmi);
}
}
}
/*!
-* @brief モンスターの睡眠状態値をセットする /
+* @brief モンスターの睡眠状態値をセットする。0で起きる。 /
* Set "m_ptr->mtimed[MTIMED_CSLEEP]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_csleep(MONSTER_IDX m_idx, int v)
+bool set_monster_csleep(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
-
- /* Hack -- Force good values */
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
- /* Open */
if (v)
{
if (!MON_CSLEEP(m_ptr))
{
- mproc_add(m_idx, MTIMED_CSLEEP);
+ mproc_add(floor_ptr, m_idx, MTIMED_CSLEEP);
notice = TRUE;
}
}
- /* Shut */
else
{
if (MON_CSLEEP(m_ptr))
{
- mproc_remove(m_idx, MTIMED_CSLEEP);
+ mproc_remove(floor_ptr, m_idx, MTIMED_CSLEEP);
notice = TRUE;
}
}
if (m_ptr->ml)
{
/* Update health bar as needed */
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+ if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
}
- if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+ if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) target_ptr->update |= (PU_MON_LITE);
return TRUE;
}
/*!
* @brief モンスターの加速状態値をセット /
* Set "m_ptr->mtimed[MTIMED_FAST]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_fast(MONSTER_IDX m_idx, int v)
+bool set_monster_fast(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
-
- /* Hack -- Force good values */
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
- /* Open */
if (v)
{
if (!MON_FAST(m_ptr))
{
- mproc_add(m_idx, MTIMED_FAST);
+ mproc_add(floor_ptr, m_idx, MTIMED_FAST);
notice = TRUE;
}
}
- /* Shut */
else
{
if (MON_FAST(m_ptr))
{
- mproc_remove(m_idx, MTIMED_FAST);
+ mproc_remove(floor_ptr, m_idx, MTIMED_FAST);
notice = TRUE;
}
}
if (!notice) return FALSE;
- if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+ if ((target_ptr->riding == m_idx) && !target_ptr->leaving) target_ptr->update |= (PU_BONUS);
return TRUE;
}
/*
* Set "m_ptr->mtimed[MTIMED_SLOW]", notice observable changes
*/
-bool set_monster_slow(MONSTER_IDX m_idx, int v)
+bool set_monster_slow(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
-
- /* Hack -- Force good values */
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
- /* Open */
if (v)
{
if (!MON_SLOW(m_ptr))
{
- mproc_add(m_idx, MTIMED_SLOW);
+ mproc_add(floor_ptr, m_idx, MTIMED_SLOW);
notice = TRUE;
}
}
- /* Shut */
else
{
if (MON_SLOW(m_ptr))
{
- mproc_remove(m_idx, MTIMED_SLOW);
+ mproc_remove(floor_ptr, m_idx, MTIMED_SLOW);
notice = TRUE;
}
}
if (!notice) return FALSE;
- if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+ if ((target_ptr->riding == m_idx) && !target_ptr->leaving) target_ptr->update |= (PU_BONUS);
return TRUE;
}
/*!
* @brief モンスターの朦朧状態値をセット /
* Set "m_ptr->mtimed[MTIMED_STUNNED]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_stunned(MONSTER_IDX m_idx, int v)
+bool set_monster_stunned(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
-
- /* Hack -- Force good values */
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
- /* Open */
if (v)
{
if (!MON_STUNNED(m_ptr))
{
- mproc_add(m_idx, MTIMED_STUNNED);
+ mproc_add(floor_ptr, m_idx, MTIMED_STUNNED);
notice = TRUE;
}
}
- /* Shut */
else
{
if (MON_STUNNED(m_ptr))
{
- mproc_remove(m_idx, MTIMED_STUNNED);
+ mproc_remove(floor_ptr, m_idx, MTIMED_STUNNED);
notice = TRUE;
}
}
/*!
* @brief モンスターの混乱状態値をセット /
* Set "m_ptr->mtimed[MTIMED_CONFUSED]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_confused(MONSTER_IDX m_idx, int v)
+bool set_monster_confused(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
-
- /* Hack -- Force good values */
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
- /* Open */
if (v)
{
if (!MON_CONFUSED(m_ptr))
{
- mproc_add(m_idx, MTIMED_CONFUSED);
+ mproc_add(floor_ptr, m_idx, MTIMED_CONFUSED);
notice = TRUE;
}
}
- /* Shut */
else
{
if (MON_CONFUSED(m_ptr))
{
- mproc_remove(m_idx, MTIMED_CONFUSED);
+ mproc_remove(floor_ptr, m_idx, MTIMED_CONFUSED);
notice = TRUE;
}
}
/*!
* @brief モンスターの恐慌状態値をセット /
* Set "m_ptr->mtimed[MTIMED_MONFEAR]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_monfear(MONSTER_IDX m_idx, int v)
+bool set_monster_monfear(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
-
- /* Hack -- Force good values */
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
- /* Open */
if (v)
{
if (!MON_MONFEAR(m_ptr))
{
- mproc_add(m_idx, MTIMED_MONFEAR);
+ mproc_add(floor_ptr, m_idx, MTIMED_MONFEAR);
notice = TRUE;
}
}
- /* Shut */
else
{
if (MON_MONFEAR(m_ptr))
{
- mproc_remove(m_idx, MTIMED_MONFEAR);
+ mproc_remove(floor_ptr, m_idx, MTIMED_MONFEAR);
notice = TRUE;
}
}
if (m_ptr->ml)
{
/* Update health bar as needed */
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+ if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
}
return TRUE;
/*!
* @brief モンスターの無敵状態値をセット /
* Set "m_ptr->mtimed[MTIMED_INVULNER]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @param energy_need TRUEならば無敵解除時に行動ターン消費を行う
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need)
+bool set_monster_invulner(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need)
{
- monster_type *m_ptr = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
-
- /* Hack -- Force good values */
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
- /* Open */
if (v)
{
if (!MON_INVULNER(m_ptr))
{
- mproc_add(m_idx, MTIMED_INVULNER);
+ mproc_add(floor_ptr, m_idx, MTIMED_INVULNER);
notice = TRUE;
}
}
- /* Shut */
else
{
if (MON_INVULNER(m_ptr))
{
- mproc_remove(m_idx, MTIMED_INVULNER);
- if (energy_need && !p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
+ mproc_remove(floor_ptr, m_idx, MTIMED_INVULNER);
+ if (energy_need && !target_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
notice = TRUE;
}
}
if (m_ptr->ml)
{
/* Update health bar as needed */
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+ if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
}
return TRUE;
/*!
* @brief モンスターの各種状態値を時間経過により更新するサブルーチン
+* @param floor_ptr 現在フロアへの参照ポインタ
* @param m_idx モンスター参照ID
* @param mtimed_idx 更新するモンスターの時限ステータスID
* @return なし
*/
-static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
+static void process_monsters_mtimed_aux(player_type *target_ptr, MONSTER_IDX m_idx, int mtimed_idx)
{
- monster_type *m_ptr = &m_list[m_idx];
+ monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
switch (mtimed_idx)
{
}
/* Handle "sight" and "aggravation" */
- else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
+ else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx)))
{
/* We may wake up */
test = TRUE;
}
}
- if (test)
- {
- u32b notice = randint0(1024);
+ if (!test) break;
- /* Nightmare monsters are more alert */
- if (ironman_nightmare) notice /= 2;
+ u32b notice = randint0(1024);
- /* Hack -- See if monster "notices" player */
- if ((notice * notice * notice) <= csleep_noise)
- {
- /* Hack -- amount of "waking" */
- /* Wake up faster near the player */
- int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
+ /* Nightmare monsters are more alert */
+ if (ironman_nightmare) notice /= 2;
- /* Hack -- amount of "waking" is affected by speed of player */
- d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
- if (d < 0) d = 1;
+ /* Hack -- See if monster "notices" player */
+ if ((notice * notice * notice) > csleep_noise) break;
- /* Monster wakes up "a little bit" */
+ /* Hack -- amount of "waking" */
+ /* Wake up faster near the player */
+ int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
- /* Still asleep */
- if (!set_monster_csleep(m_idx, MON_CSLEEP(m_ptr) - d))
- {
- /* Notice the "not waking up" */
- if (is_original_ap_and_seen(m_ptr))
- {
- /* Hack -- Count the ignores */
- if (r_ptr->r_ignore < MAX_UCHAR) r_ptr->r_ignore++;
- }
- }
+ /* Hack -- amount of "waking" is affected by speed of player */
+ d = (d * SPEED_TO_ENERGY(target_ptr->pspeed)) / 10;
+ if (d < 0) d = 1;
- /* Just woke up */
- else
- {
- /* Notice the "waking up" */
- if (m_ptr->ml)
- {
- GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
- msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
- }
-
- if (is_original_ap_and_seen(m_ptr))
- {
- /* Hack -- Count the wakings */
- if (r_ptr->r_wake < MAX_UCHAR) r_ptr->r_wake++;
- }
- }
+ /* Monster wakes up "a little bit" */
+
+ /* Still asleep */
+ if (!set_monster_csleep(target_ptr, m_idx, MON_CSLEEP(m_ptr) - d))
+ {
+ /* Notice the "not waking up" */
+ if (is_original_ap_and_seen(target_ptr, m_ptr))
+ {
+ /* Hack -- Count the ignores */
+ if (r_ptr->r_ignore < MAX_UCHAR) r_ptr->r_ignore++;
}
+
+ break;
}
+
+ /* Notice the "waking up" */
+ if (m_ptr->ml)
+ {
+ GAME_TEXT m_name[MAX_NLEN];
+ monster_desc(target_ptr, m_name, m_ptr, 0);
+ msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
+ }
+
+ if (is_original_ap_and_seen(target_ptr, m_ptr))
+ {
+ /* Hack -- Count the wakings */
+ if (r_ptr->r_wake < MAX_UCHAR) r_ptr->r_wake++;
+ }
+
break;
}
case MTIMED_FAST:
/* Reduce by one, note if expires */
- if (set_monster_fast(m_idx, MON_FAST(m_ptr) - 1))
+ if (set_monster_fast(target_ptr, m_idx, MON_FAST(m_ptr) - 1))
{
if (is_seen(m_ptr))
{
GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
+ monster_desc(target_ptr, m_name, m_ptr, 0);
msg_format(_("%^sはもう加速されていない。", "%^s is no longer fast."), m_name);
}
}
+
break;
case MTIMED_SLOW:
/* Reduce by one, note if expires */
- if (set_monster_slow(m_idx, MON_SLOW(m_ptr) - 1))
+ if (set_monster_slow(target_ptr, m_idx, MON_SLOW(m_ptr) - 1))
{
if (is_seen(m_ptr))
{
GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
+ monster_desc(target_ptr, m_name, m_ptr, 0);
msg_format(_("%^sはもう減速されていない。", "%^s is no longer slow."), m_name);
}
}
+
break;
case MTIMED_STUNNED:
int rlev = r_info[m_ptr->r_idx].level;
/* Recover from stun */
- if (set_monster_stunned(m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (MON_STUNNED(m_ptr) - 1)))
+ if (set_monster_stunned(target_ptr, m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (MON_STUNNED(m_ptr) - 1)))
{
/* Message if visible */
if (is_seen(m_ptr))
{
GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
+ monster_desc(target_ptr, m_name, m_ptr, 0);
msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
}
}
+
break;
}
case MTIMED_CONFUSED:
+ {
/* Reduce the confusion */
- if (set_monster_confused(m_idx, MON_CONFUSED(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+ if (!set_monster_confused(target_ptr, m_idx, MON_CONFUSED(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+ break;
+ /* Message if visible */
+ if (is_seen(m_ptr))
{
- /* Message if visible */
- if (is_seen(m_ptr))
- {
- GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
- msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
- }
+ GAME_TEXT m_name[MAX_NLEN];
+ monster_desc(target_ptr, m_name, m_ptr, 0);
+ msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
}
+
break;
+ }
case MTIMED_MONFEAR:
+ {
/* Reduce the fear */
- if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+ if (!set_monster_monfear(target_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+ break;
+
+ /* Visual note */
+ if (is_seen(m_ptr))
{
- /* Visual note */
- if (is_seen(m_ptr))
- {
- GAME_TEXT m_name[MAX_NLEN];
+ GAME_TEXT m_name[MAX_NLEN];
#ifndef JP
- char m_poss[80];
+ char m_poss[80];
- /* Acquire the monster possessive */
- monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
+ /* Acquire the monster possessive */
+ monster_desc(target_ptr, m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
#endif
- monster_desc(m_name, m_ptr, 0);
+ monster_desc(target_ptr, m_name, m_ptr, 0);
#ifdef JP
- msg_format("%^sは勇気を取り戻した。", m_name);
+ msg_format("%^sは勇気を取り戻した。", m_name);
#else
- msg_format("%^s recovers %s courage.", m_name, m_poss);
+ msg_format("%^s recovers %s courage.", m_name, m_poss);
#endif
- }
}
+
break;
+ }
case MTIMED_INVULNER:
+ {
/* Reduce by one, note if expires */
- if (set_monster_invulner(m_idx, MON_INVULNER(m_ptr) - 1, TRUE))
+ if (!set_monster_invulner(target_ptr, m_idx, MON_INVULNER(m_ptr) - 1, TRUE))
+ break;
+
+ if (is_seen(m_ptr))
{
- if (is_seen(m_ptr))
- {
- GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
- msg_format(_("%^sはもう無敵でない。", "%^s is no longer invulnerable."), m_name);
- }
+ GAME_TEXT m_name[MAX_NLEN];
+ monster_desc(target_ptr, m_name, m_ptr, 0);
+ msg_format(_("%^sはもう無敵でない。", "%^s is no longer invulnerable."), m_name);
}
+
break;
}
+ }
}
/*!
* @brief 全モンスターの各種状態値を時間経過により更新するメインルーチン
* @param mtimed_idx 更新するモンスターの時限ステータスID
+* @param target_ptr プレーヤーへの参照ポインタ
* @return なし
* @details
* Process the counters of monsters (once per 10 game turns)\n
* These functions are to process monsters' counters same as player's.
*/
-void process_monsters_mtimed(int mtimed_idx)
+void process_monsters_mtimed(player_type *target_ptr, int mtimed_idx)
{
- int i;
- s16b *cur_mproc_list = mproc_list[mtimed_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ s16b *cur_mproc_list = floor_ptr->mproc_list[mtimed_idx];
/* Hack -- calculate the "player noise" */
- if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl));
+ if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - target_ptr->skill_stl));
/* Process the monsters (backwards) */
- for (i = mproc_max[mtimed_idx] - 1; i >= 0; i--)
+ for (int i = floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
{
- /* Access the monster */
- process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx);
+ process_monsters_mtimed_aux(target_ptr, cur_mproc_list[i], mtimed_idx);
}
}
+
/*!
* @brief モンスターへの魔力消去処理
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx 魔力消去を受けるモンスターの参照ID
* @return なし
*/
-void dispel_monster_status(MONSTER_IDX m_idx)
+void dispel_monster_status(player_type *target_ptr, MONSTER_IDX m_idx)
{
- monster_type *m_ptr = &m_list[m_idx];
+ monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
- if (set_monster_invulner(m_idx, 0, TRUE))
+ monster_desc(target_ptr, m_name, m_ptr, 0);
+ if (set_monster_invulner(target_ptr, m_idx, 0, TRUE))
{
if (m_ptr->ml) msg_format(_("%sはもう無敵ではない。", "%^s is no longer invulnerable."), m_name);
}
- if (set_monster_fast(m_idx, 0))
+
+ if (set_monster_fast(target_ptr, m_idx, 0))
{
if (m_ptr->ml) msg_format(_("%sはもう加速されていない。", "%^s is no longer fast."), m_name);
}
- if (set_monster_slow(m_idx, 0))
+
+ if (set_monster_slow(target_ptr, m_idx, 0))
{
if (m_ptr->ml) msg_format(_("%sはもう減速されていない。", "%^s is no longer slow."), m_name);
}
}
+
/*!
* @brief モンスターの時間停止処理
+* @param target_ptr プレーヤーへの参照ポインタ
* @param num 時間停止を行った敵が行動できる回数
* @param who 時間停止処理の主体ID
* @param vs_player TRUEならば時間停止開始処理を行う
* @return 時間停止が行われている状態ならばTRUEを返す
*/
-bool process_the_world(int num, MONSTER_IDX who, bool vs_player)
+bool set_monster_timewalk(player_type *target_ptr, int num, MONSTER_IDX who, bool vs_player)
{
- monster_type *m_ptr = &m_list[hack_m_idx]; /* the world monster */
+ monster_type *m_ptr = &target_ptr->current_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)
{
GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, m_ptr, 0);
+ monster_desc(target_ptr, m_name, m_ptr, 0);
if (who == 1)
msg_format(_("「『ザ・ワールド』!時は止まった!」", "%s yells 'The World! Time has stopped!'"), m_name);
}
/* This monster cast spells */
- world_monster = hack_m_idx;
+ current_world_ptr->timewalk_m_idx = hack_m_idx;
- if (vs_player) do_cmd_redraw();
+ if (vs_player) do_cmd_redraw(target_ptr);
while (num--)
{
- if (!m_ptr->r_idx) break;
- process_monster(world_monster);
+ if (!monster_is_valid(m_ptr)) break;
+ process_monster(target_ptr, current_world_ptr->timewalk_m_idx);
reset_target(m_ptr);
- handle_stuff();
+ handle_stuff(target_ptr);
if (vs_player) Term_xtra(TERM_XTRA_DELAY, 500);
}
- p_ptr->redraw |= (PR_MAP);
- p_ptr->update |= (PU_MONSTERS);
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+ target_ptr->redraw |= (PR_MAP);
+ target_ptr->update |= (PU_MONSTERS);
+ target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
- world_monster = 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)))
+ current_world_ptr->timewalk_m_idx = 0;
+ if (vs_player || (player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx) && projectable(target_ptr, target_ptr->y, target_ptr->x, m_ptr->fy, m_ptr->fx)))
{
msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
msg_print(NULL);
}
- handle_stuff();
- return (TRUE);
+ handle_stuff(target_ptr);
+ return TRUE;
}
/*!
* @brief モンスターの経験値取得処理
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx 経験値を得るモンスターの参照ID
* @param s_idx 撃破されたモンスター種族の参照ID
* @return なし
*/
-void monster_gain_exp(MONSTER_IDX m_idx, IDX s_idx)
+void monster_gain_exp(player_type *target_ptr, 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 = &m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ m_ptr = &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];
- if (p_ptr->inside_battle) return;
+ if (target_ptr->phase_out) return;
if (!r_ptr->next_exp) return;
- new_exp = s_ptr->mexp * s_ptr->level / (r_ptr->level + 2);
- if (m_idx == p_ptr->riding) new_exp = (new_exp + 1) / 2;
- if (!dun_level) new_exp /= 5;
+ int new_exp = s_ptr->mexp * s_ptr->level / (r_ptr->level + 2);
+ if (m_idx == target_ptr->riding) new_exp = (new_exp + 1) / 2;
+ if (!floor_ptr->dun_level) new_exp /= 5;
m_ptr->exp += new_exp;
if (m_ptr->mflag2 & MFLAG2_CHAMELEON) return;
- if (m_ptr->exp >= r_ptr->next_exp)
+ if (m_ptr->exp < r_ptr->next_exp)
{
- GAME_TEXT m_name[MAX_NLEN];
- int old_hp = m_ptr->hp;
- int old_maxhp = m_ptr->max_maxhp;
- int old_r_idx = m_ptr->r_idx;
- byte old_sub_align = m_ptr->sub_align;
+ if (m_idx == target_ptr->riding) target_ptr->update |= PU_BONUS;
+ return;
+ }
- /* Hack -- Reduce the racial counter of previous monster */
- real_r_ptr(m_ptr)->cur_num--;
+ GAME_TEXT m_name[MAX_NLEN];
+ int old_hp = m_ptr->hp;
+ int old_maxhp = m_ptr->max_maxhp;
+ int old_r_idx = m_ptr->r_idx;
+ byte old_sub_align = m_ptr->sub_align;
- monster_desc(m_name, m_ptr, 0);
- m_ptr->r_idx = r_ptr->next_r_idx;
+ /* Hack -- Reduce the racial counter of previous monster */
+ real_r_ptr(m_ptr)->cur_num--;
- /* Count the monsters on the level */
- real_r_ptr(m_ptr)->cur_num++;
+ monster_desc(target_ptr, m_name, m_ptr, 0);
+ m_ptr->r_idx = r_ptr->next_r_idx;
- m_ptr->ap_r_idx = m_ptr->r_idx;
- r_ptr = &r_info[m_ptr->r_idx];
+ /* Count the monsters on the level */
+ real_r_ptr(m_ptr)->cur_num++;
- if (r_ptr->flags1 & RF1_FORCE_MAXHP)
- {
- m_ptr->max_maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
- }
- else
- {
- m_ptr->max_maxhp = damroll(r_ptr->hdice, r_ptr->hside);
- }
- if (ironman_nightmare)
- {
- HIT_POINT hp = m_ptr->max_maxhp * 2L;
- m_ptr->max_maxhp = MIN(30000, hp);
- }
- m_ptr->maxhp = m_ptr->max_maxhp;
- m_ptr->hp = old_hp * m_ptr->maxhp / old_maxhp;
+ m_ptr->ap_r_idx = m_ptr->r_idx;
+ r_ptr = &r_info[m_ptr->r_idx];
- /* dealt damage is 0 at initial*/
- m_ptr->dealt_damage = 0;
+ if (r_ptr->flags1 & RF1_FORCE_MAXHP)
+ {
+ m_ptr->max_maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
+ }
+ else
+ {
+ m_ptr->max_maxhp = damroll(r_ptr->hdice, r_ptr->hside);
+ }
+ if (ironman_nightmare)
+ {
+ HIT_POINT hp = m_ptr->max_maxhp * 2L;
+ m_ptr->max_maxhp = MIN(30000, hp);
+ }
- /* Extract the monster base speed */
- m_ptr->mspeed = get_mspeed(r_ptr);
+ m_ptr->maxhp = m_ptr->max_maxhp;
+ m_ptr->hp = old_hp * m_ptr->maxhp / old_maxhp;
- /* Sub-alignment of a monster */
- if (!is_pet(m_ptr) && !(r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)))
- m_ptr->sub_align = old_sub_align;
- else
- {
- m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
- if (r_ptr->flags3 & RF3_EVIL) m_ptr->sub_align |= SUB_ALIGN_EVIL;
- if (r_ptr->flags3 & RF3_GOOD) m_ptr->sub_align |= SUB_ALIGN_GOOD;
- }
+ /* dealt damage is 0 at initial*/
+ m_ptr->dealt_damage = 0;
- m_ptr->exp = 0;
+ /* Extract the monster base speed */
+ m_ptr->mspeed = get_mspeed(target_ptr, r_ptr);
- if (is_pet(m_ptr) || m_ptr->ml)
+ /* Sub-alignment of a monster */
+ if (!is_pet(m_ptr) && !(r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)))
+ m_ptr->sub_align = old_sub_align;
+ else
+ {
+ m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
+ if (r_ptr->flags3 & RF3_EVIL) m_ptr->sub_align |= SUB_ALIGN_EVIL;
+ if (r_ptr->flags3 & RF3_GOOD) m_ptr->sub_align |= SUB_ALIGN_GOOD;
+ }
+
+ m_ptr->exp = 0;
+
+ if (is_pet(m_ptr) || m_ptr->ml)
+ {
+ if (!ignore_unview || player_can_see_bold(target_ptr, m_ptr->fy, m_ptr->fx))
{
- if (!ignore_unview || player_can_see_bold(m_ptr->fy, m_ptr->fx))
+ if (target_ptr->image)
{
- if (p_ptr->image)
- {
- monster_race *hallu_race;
+ monster_race *hallu_race;
- do
- {
- hallu_race = &r_info[randint1(max_r_idx - 1)];
- } while (!hallu_race->name || (hallu_race->flags1 & RF1_UNIQUE));
- msg_format(_("%sは%sに進化した。", "%^s evolved into %s."), m_name, r_name + hallu_race->name);
- }
- else
+ do
{
- msg_format(_("%sは%sに進化した。", "%^s evolved into %s."), m_name, r_name + r_ptr->name);
- }
+ hallu_race = &r_info[randint1(max_r_idx - 1)];
+ } while (!hallu_race->name || (hallu_race->flags1 & RF1_UNIQUE));
+ msg_format(_("%sは%sに進化した。", "%^s evolved into %s."), m_name, r_name + hallu_race->name);
+ }
+ else
+ {
+ msg_format(_("%sは%sに進化した。", "%^s evolved into %s."), m_name, r_name + r_ptr->name);
}
+ }
- if (!p_ptr->image) r_info[old_r_idx].r_xtra1 |= MR1_SINKA;
+ if (!target_ptr->image) r_info[old_r_idx].r_xtra1 |= MR1_SINKA;
- /* Now you feel very close to this pet. */
- m_ptr->parent_m_idx = 0;
- }
- update_monster(m_idx, FALSE);
- lite_spot(m_ptr->fy, m_ptr->fx);
+ /* Now you feel very close to this pet. */
+ m_ptr->parent_m_idx = 0;
}
- if (m_idx == p_ptr->riding) p_ptr->update |= PU_BONUS;
+
+ update_monster(target_ptr, m_idx, FALSE);
+ lite_spot(target_ptr, m_ptr->fy, m_ptr->fx);
+
+ if (m_idx == target_ptr->riding) target_ptr->update |= PU_BONUS;
}
/*!
* to induce changes in the monster recall code.
* </pre>
*/
-bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note)
+bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note)
{
- monster_type *m_ptr = &m_list[m_idx];
+ monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
monster_type exp_mon;
expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
- get_exp_from_mon(expdam, &exp_mon);
+ get_exp_from_mon(target_ptr, 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 (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+ if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
- (void)set_monster_csleep(m_idx, 0);
+ (void)set_monster_csleep(target_ptr, m_idx, 0);
/* Hack - Cancel any special player stealth magics. -LM- */
- if (p_ptr->special_defense & NINJA_S_STEALTH)
+ if (target_ptr->special_defense & NINJA_S_STEALTH)
{
- set_superstealth(FALSE);
+ set_superstealth(target_ptr, FALSE);
}
/* Genocided by chaos patron */
if (m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
- if (p_ptr->wizard)
+ if (current_world_ptr->wizard)
{
msg_format(_("合計%d/%dのダメージを与えた。", "You do %d (out of %d) damage."), m_ptr->dealt_damage, m_ptr->maxhp);
}
if (r_ptr->r_akills < MAX_SHORT) r_ptr->r_akills++;
/* Recall even invisible uniques or winners */
- if ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
+ if ((m_ptr->ml && !target_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE))
{
/* Count kills this life */
if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
/* Hack -- Auto-recall */
- monster_race_track(m_ptr->ap_r_idx);
+ monster_race_track(target_ptr, m_ptr->ap_r_idx);
}
- /* Extract monster name */
- monster_desc(m_name, m_ptr, MD_TRUE_NAME);
+ monster_desc(target_ptr, m_name, m_ptr, MD_TRUE_NAME);
/* Don't kill Amberites */
if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
int count = 0;
msg_format(_("%^sは恐ろしい血の呪いをあなたにかけた!", "%^s puts a terrible blood curse on you!"), m_name);
- curse_equipment(100, 50);
+ curse_equipment(target_ptr, 100, 50);
do
{
- stop_ty = activate_ty_curse(stop_ty, &count);
+ stop_ty = activate_ty_curse(target_ptr, stop_ty, &count);
} while (--curses);
}
#ifdef WORLD_SCORE
if (m_ptr->r_idx == MON_SERPENT)
{
- screen_dump = make_screen_dump();
+ screen_dump = make_screen_dump(target_ptr);
}
#endif
}
- if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
+ if (!(d_info[target_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
{
- if (!dun_level && !ambush_flag && !p_ptr->inside_arena)
+ if (!target_ptr->current_floor_ptr->dun_level && !target_ptr->ambush_flag && !target_ptr->current_floor_ptr->inside_arena)
{
- chg_virtue(V_VALOUR, -1);
+ chg_virtue(target_ptr, V_VALOUR, -1);
}
- else if (r_ptr->level > dun_level)
+ else if (r_ptr->level > target_ptr->current_floor_ptr->dun_level)
{
- if (randint1(10) <= (r_ptr->level - dun_level))
- chg_virtue(V_VALOUR, 1);
+ if (randint1(10) <= (r_ptr->level - target_ptr->current_floor_ptr->dun_level))
+ chg_virtue(target_ptr, V_VALOUR, 1);
}
if (r_ptr->level > 60)
{
- chg_virtue(V_VALOUR, 1);
+ chg_virtue(target_ptr, V_VALOUR, 1);
}
- if (r_ptr->level >= 2 * (p_ptr->lev + 1))
- chg_virtue(V_VALOUR, 2);
+ if (r_ptr->level >= 2 * (target_ptr->lev + 1))
+ chg_virtue(target_ptr, V_VALOUR, 2);
}
if (r_ptr->flags1 & RF1_UNIQUE)
{
- if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(V_HARMONY, 2);
+ if (r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) chg_virtue(target_ptr, V_HARMONY, 2);
if (r_ptr->flags3 & RF3_GOOD)
{
- chg_virtue(V_UNLIFE, 2);
- chg_virtue(V_VITALITY, -2);
+ chg_virtue(target_ptr, V_UNLIFE, 2);
+ chg_virtue(target_ptr, V_VITALITY, -2);
}
- if (one_in_(3)) chg_virtue(V_INDIVIDUALISM, -1);
+ if (one_in_(3)) chg_virtue(target_ptr, V_INDIVIDUALISM, -1);
}
if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
{
- chg_virtue(V_COMPASSION, -1);
+ chg_virtue(target_ptr, V_COMPASSION, -1);
}
- if ((r_ptr->flags3 & RF3_GOOD) && ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
- chg_virtue(V_UNLIFE, 1);
+ if ((r_ptr->flags3 & RF3_GOOD) && ((r_ptr->level) / 10 + (3 * target_ptr->current_floor_ptr->dun_level) >= randint1(100)))
+ chg_virtue(target_ptr, V_UNLIFE, 1);
if (r_ptr->d_char == 'A')
{
if (r_ptr->flags1 & RF1_UNIQUE)
- chg_virtue(V_FAITH, -2);
- else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
+ chg_virtue(target_ptr, V_FAITH, -2);
+ else if ((r_ptr->level) / 10 + (3 * target_ptr->current_floor_ptr->dun_level) >= randint1(100))
{
- if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
- else chg_virtue(V_FAITH, 1);
+ if (r_ptr->flags3 & RF3_GOOD) chg_virtue(target_ptr, V_FAITH, -1);
+ else chg_virtue(target_ptr, V_FAITH, 1);
}
}
else if (r_ptr->flags3 & RF3_DEMON)
{
if (r_ptr->flags1 & RF1_UNIQUE)
- chg_virtue(V_FAITH, 2);
- else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
- chg_virtue(V_FAITH, 1);
+ chg_virtue(target_ptr, V_FAITH, 2);
+ else if ((r_ptr->level) / 10 + (3 * target_ptr->current_floor_ptr->dun_level) >= randint1(100))
+ chg_virtue(target_ptr, V_FAITH, 1);
}
if ((r_ptr->flags3 & RF3_UNDEAD) && (r_ptr->flags1 & RF1_UNIQUE))
- chg_virtue(V_VITALITY, 2);
+ chg_virtue(target_ptr, V_VITALITY, 2);
if (r_ptr->r_deaths)
{
if (r_ptr->flags1 & RF1_UNIQUE)
{
- chg_virtue(V_HONOUR, 10);
+ chg_virtue(target_ptr, V_HONOUR, 10);
}
- else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
+ else if ((r_ptr->level) / 10 + (2 * target_ptr->current_floor_ptr->dun_level) >= randint1(100))
{
- chg_virtue(V_HONOUR, 1);
+ chg_virtue(target_ptr, V_HONOUR, 1);
}
}
if ((r_ptr->flags2 & RF2_MULTIPLY) && (r_ptr->r_akills > 1000) && one_in_(10))
{
- chg_virtue(V_VALOUR, -1);
+ chg_virtue(target_ptr, V_VALOUR, -1);
}
for (i = 0; i < 4; i++)
if (thief)
{
if (r_ptr->flags1 & RF1_UNIQUE)
- chg_virtue(V_JUSTICE, 3);
- else if (1 + ((r_ptr->level) / 10 + (2 * dun_level)) >= randint1(100))
- chg_virtue(V_JUSTICE, 1);
+ chg_virtue(target_ptr, V_JUSTICE, 3);
+ else if (1 + ((r_ptr->level) / 10 + (2 * target_ptr->current_floor_ptr->dun_level)) >= randint1(100))
+ chg_virtue(target_ptr, V_JUSTICE, 1);
}
else if (innocent)
{
- chg_virtue(V_JUSTICE, -1);
+ chg_virtue(target_ptr, V_JUSTICE, -1);
}
if ((r_ptr->flags3 & RF3_ANIMAL) && !(r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) && !(r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) && !(r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
{
- if (one_in_(4)) chg_virtue(V_NATURE, -1);
+ if (one_in_(4)) chg_virtue(target_ptr, V_NATURE, -1);
}
if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
{
char note_buf[160];
sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? _("(クローン)", "(Clone)") : "");
- do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf);
+ exe_write_diary(target_ptr, DIARY_UNIQUE, 0, note_buf);
}
/* Make a sound */
else if (!m_ptr->ml)
{
#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((target_ptr->pseikaku == SEIKAKU_COMBAT) || (target_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 ((target_ptr->pseikaku == SEIKAKU_COMBAT) || (target_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 ((target_ptr->pseikaku == SEIKAKU_COMBAT) || (target_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_format("せっかくだから%sを葬り去った。", m_name);
else
msg_format("%sを葬り去った。", m_name);
}
if ((r_ptr->flags1 & RF1_UNIQUE) && !(m_ptr->smart & SM_CLONED) && !vanilla_town)
{
- for (i = 0; i < MAX_KUBI; i++)
+ for (i = 0; i < MAX_BOUNTY; 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;
}
/* Generate treasure */
- monster_death(m_idx, TRUE);
+ monster_death(target_ptr, m_idx, TRUE);
/* Mega hack : replace IKETA to BIKETAL */
- if ((m_ptr->r_idx == MON_IKETA) && !(p_ptr->inside_arena || p_ptr->inside_battle))
+ if ((m_ptr->r_idx == MON_IKETA) && !(target_ptr->current_floor_ptr->inside_arena || target_ptr->phase_out))
{
POSITION dummy_y = m_ptr->fy;
POSITION dummy_x = m_ptr->fx;
BIT_FLAGS mode = 0L;
if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
- delete_monster_idx(m_idx);
- if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
+ delete_monster_idx(target_ptr, m_idx);
+ if (summon_named_creature(target_ptr, 0, dummy_y, dummy_x, MON_BIKETAL, mode))
{
msg_print(_("「ハァッハッハッハ!!私がバイケタルだ!!」", "Uwa-hahaha! *I* am Biketal!"));
}
}
else
{
- delete_monster_idx(m_idx);
+ delete_monster_idx(target_ptr, m_idx);
}
- get_exp_from_mon((long)exp_mon.max_maxhp * 2, &exp_mon);
+ get_exp_from_mon(target_ptr, (long)exp_mon.max_maxhp * 2, &exp_mon);
/* Not afraid */
(*fear) = FALSE;
/* Monster is dead */
- return (TRUE);
+ return TRUE;
}
-
-#ifdef ALLOW_FEAR
-
/* Mega-Hack -- Pain cancels fear */
if (MON_MONFEAR(m_ptr) && (dam > 0))
{
/* Cure fear */
- if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
+ if (set_monster_monfear(target_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
{
/* No more fear */
(*fear) = FALSE;
(*fear) = TRUE;
/* Hack -- Add some timed fear */
- (void)set_monster_monfear(m_idx, (randint1(10) +
+ (void)set_monster_monfear(target_ptr, m_idx, (randint1(10) +
(((dam >= m_ptr->hp) && (percentage > 7)) ?
20 : ((11 - percentage) * 5))));
}
}
-#endif
-
/* Not dead yet */
- return (FALSE);
+ return FALSE;
}
+
+bool monster_is_valid(monster_type *m_ptr)
+{
+ return (m_ptr->r_idx != 0);
+}