From 301467e67872d61744d38419c23d0485206f1129 Mon Sep 17 00:00:00 2001 From: Hourier Date: Wed, 12 Aug 2020 19:45:14 +0900 Subject: [PATCH] [Refactor] #40624 Moved set_monster_*() from monster-status.c/h to monster-status-setter.c/h --- src/action/movement-execution.c | 1 + src/cmd-action/cmd-pet.c | 1 + src/core/player-processor.c | 1 + src/core/status-reseter.c | 2 +- src/effect/effect-monster-oldies.c | 1 + src/effect/effect-monster-resist-hurt.c | 1 + src/effect/effect-monster-spirit.c | 1 + src/effect/effect-monster-switcher.c | 1 + src/floor/floor-save.c | 1 + src/melee/melee-postprocess.c | 1 + src/melee/melee-switcher.c | 2 +- src/melee/monster-attack-monster.c | 1 + src/mind/monk-attack.c | 1 + src/monster-attack/monster-attack-processor.c | 198 +++++++------- src/monster-floor/monster-remover.c | 1 + src/monster/monster-status-setter.c | 347 +++++++++++++++++++++++- src/monster/monster-status-setter.h | 8 + src/monster/monster-status.c | 375 +------------------------- src/monster/monster-status.h | 16 +- src/mspell/mspell-floor.c | 1 + src/mspell/mspell-status.c | 1 + src/player-attack/attack-chaos-effect.c | 1 + src/spell-kind/earthquake.c | 2 +- src/spell-kind/spells-fetcher.c | 2 +- src/spell-kind/spells-lite.c | 1 + src/spell-kind/spells-sight.c | 1 + src/spell-kind/spells-teleport.c | 1 + src/spell-realm/spells-chaos.c | 1 + 28 files changed, 479 insertions(+), 492 deletions(-) diff --git a/src/action/movement-execution.c b/src/action/movement-execution.c index c4267dd3b..8e7ce33c0 100644 --- a/src/action/movement-execution.c +++ b/src/action/movement-execution.c @@ -21,6 +21,7 @@ #include "monster-race/race-flags8.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "mutation/mutation-flag-types.h" #include "object/warning.h" diff --git a/src/cmd-action/cmd-pet.c b/src/cmd-action/cmd-pet.c index c52d747dc..78206b23b 100644 --- a/src/cmd-action/cmd-pet.c +++ b/src/cmd-action/cmd-pet.c @@ -29,6 +29,7 @@ #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/smart-learn-types.h" #include "object-hook/hook-weapon.h" diff --git a/src/core/player-processor.c b/src/core/player-processor.c index a6aabdd0a..6b8d3b6ae 100644 --- a/src/core/player-processor.c +++ b/src/core/player-processor.c @@ -29,6 +29,7 @@ #include "monster/monster-describer.h" #include "monster/monster-flag-types.h" #include "monster/monster-list.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-update.h" #include "monster/monster-util.h" diff --git a/src/core/status-reseter.c b/src/core/status-reseter.c index 4bc161164..a86162730 100644 --- a/src/core/status-reseter.c +++ b/src/core/status-reseter.c @@ -1,6 +1,6 @@ #include "core/status-reseter.h" #include "core/speed-table.h" -#include "monster/monster-status.h" +#include "monster/monster-status-setter.h" #include "player/attack-defense-types.h" #include "player/player-race.h" diff --git a/src/effect/effect-monster-oldies.c b/src/effect/effect-monster-oldies.c index 2ad8e7725..4c9e8b16f 100644 --- a/src/effect/effect-monster-oldies.c +++ b/src/effect/effect-monster-oldies.c @@ -6,6 +6,7 @@ #include "monster-race/race-flags3.h" #include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster-floor/monster-generator.h" #include "monster/monster-info.h" diff --git a/src/effect/effect-monster-resist-hurt.c b/src/effect/effect-monster-resist-hurt.c index b5dc4c3c7..fc8c245fb 100644 --- a/src/effect/effect-monster-resist-hurt.c +++ b/src/effect/effect-monster-resist-hurt.c @@ -5,6 +5,7 @@ #include "monster-race/race-flags1.h" #include "monster-race/race-flags3.h" #include "monster-race/race-indice-types.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-info.h" diff --git a/src/effect/effect-monster-spirit.c b/src/effect/effect-monster-spirit.c index 48e85751f..beac8e1b3 100644 --- a/src/effect/effect-monster-spirit.c +++ b/src/effect/effect-monster-spirit.c @@ -10,6 +10,7 @@ #include "monster-race/race-flags-ability1.h" #include "monster-race/race-flags-ability2.h" #include "monster/monster-describer.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-info.h" #include "mspell/mspell-mask-definitions.h" diff --git a/src/effect/effect-monster-switcher.c b/src/effect/effect-monster-switcher.c index 60d7138e8..fc2f9773f 100644 --- a/src/effect/effect-monster-switcher.c +++ b/src/effect/effect-monster-switcher.c @@ -23,6 +23,7 @@ #include "monster-race/race-flags3.h" #include "monster-race/monster-race-hook.h" #include "monster-floor/monster-death.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-info.h" #include "player/avatar.h" diff --git a/src/floor/floor-save.c b/src/floor/floor-save.c index e914c1c10..4e1c2b9a9 100644 --- a/src/floor/floor-save.c +++ b/src/floor/floor-save.c @@ -49,6 +49,7 @@ #include "monster/monster-flag-types.h" #include "monster/monster-info.h" #include "monster/monster-list.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-update.h" #include "monster/smart-learn-types.h" diff --git a/src/melee/melee-postprocess.c b/src/melee/melee-postprocess.c index 6ed289103..c6d12168e 100644 --- a/src/melee/melee-postprocess.c +++ b/src/melee/melee-postprocess.c @@ -30,6 +30,7 @@ #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "pet/pet-fall-off.h" #include "player/player-class.h" diff --git a/src/melee/melee-switcher.c b/src/melee/melee-switcher.c index 33d8657ea..601a6d42e 100644 --- a/src/melee/melee-switcher.c +++ b/src/melee/melee-switcher.c @@ -7,7 +7,7 @@ #include "melee/melee-switcher.h" #include "core/disturbance.h" #include "monster-attack/monster-attack-effect.h" -#include "monster/monster-status.h" +#include "monster/monster-status-setter.h" #include "spell-kind/earthquake.h" #include "view/display-messages.h" diff --git a/src/melee/monster-attack-monster.c b/src/melee/monster-attack-monster.c index 895b98951..fd268a552 100644 --- a/src/melee/monster-attack-monster.c +++ b/src/melee/monster-attack-monster.c @@ -25,6 +25,7 @@ #include "monster-race/race-flags3.h" #include "monster-race/monster-race-hook.h" #include "monster/monster-describer.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-info.h" #include "spell-kind/spells-teleport.h" diff --git a/src/mind/monk-attack.c b/src/mind/monk-attack.c index a0a5bb739..daaa3db95 100644 --- a/src/mind/monk-attack.c +++ b/src/mind/monk-attack.c @@ -17,6 +17,7 @@ #include "monster-race/monster-race.h" #include "monster-race/race-flags1.h" #include "monster-race/race-flags3.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "player/attack-defense-types.h" #include "player/special-defense-types.h" diff --git a/src/monster-attack/monster-attack-processor.c b/src/monster-attack/monster-attack-processor.c index ebcbe19ec..97aa7a0db 100644 --- a/src/monster-attack/monster-attack-processor.c +++ b/src/monster-attack/monster-attack-processor.c @@ -6,62 +6,60 @@ #include "monster-attack/monster-attack-processor.h" #include "dungeon/dungeon-flag-types.h" -#include "floor/cave.h" -#include "monster/monster-status.h" #include "dungeon/dungeon.h" +#include "floor/cave.h" +#include "melee/monster-attack-monster.h" #include "monster-attack/monster-attack-player.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags1.h" #include "monster-race/race-flags2.h" #include "monster/monster-info.h" -#include "melee/monster-attack-monster.h" +#include "monster/monster-status-setter.h" +#include "monster/monster-status.h" #include "system/floor-type-definition.h" - /*! - * @brief モンスターが移動した結果、そこにプレーヤーがいたら直接攻撃を行う - * @param target_ptr プレーヤーへの参照ポインタ - * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ - * @param m_idx モンスターID - * @param ny 移動後の、モンスターのY座標 - * @param nx 移動後の、モンスターのX座標 - * @return なし - * @details - * 反攻撃の洞窟など、直接攻撃ができない場所では処理をスキップする - */ +/*! + * @brief モンスターが移動した結果、そこにプレーヤーがいたら直接攻撃を行う + * @param target_ptr プレーヤーへの参照ポインタ + * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ + * @param m_idx モンスターID + * @param ny 移動後の、モンスターのY座標 + * @param nx 移動後の、モンスターのX座標 + * @return なし + * @details + * 反攻撃の洞窟など、直接攻撃ができない場所では処理をスキップする + */ void exe_monster_attack_to_player(player_type *target_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, POSITION ny, POSITION nx) { - monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; - if (!turn_flags_ptr->do_move || !player_bold(target_ptr, ny, nx)) - return; - - if (r_ptr->flags1 & RF1_NEVER_BLOW) - { - if (is_original_ap_and_seen(target_ptr, m_ptr)) - r_ptr->r_flags1 |= (RF1_NEVER_BLOW); - - turn_flags_ptr->do_move = FALSE; - } - - if (turn_flags_ptr->do_move && ((d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) != 0) && !monster_confused_remaining(m_ptr)) - { - if (!(r_ptr->flags2 & RF2_STUPID)) - turn_flags_ptr->do_move = FALSE; - else if (is_original_ap_and_seen(target_ptr, m_ptr)) - r_ptr->r_flags2 |= (RF2_STUPID); - } - - if (!turn_flags_ptr->do_move) return; - - if (!target_ptr->riding || one_in_(2)) - { - (void)make_attack_normal(target_ptr, m_idx); - turn_flags_ptr->do_move = FALSE; - turn_flags_ptr->do_turn = TRUE; - } + monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx]; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; + if (!turn_flags_ptr->do_move || !player_bold(target_ptr, ny, nx)) + return; + + if (r_ptr->flags1 & RF1_NEVER_BLOW) { + if (is_original_ap_and_seen(target_ptr, m_ptr)) + r_ptr->r_flags1 |= (RF1_NEVER_BLOW); + + turn_flags_ptr->do_move = FALSE; + } + + if (turn_flags_ptr->do_move && ((d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) != 0) && !monster_confused_remaining(m_ptr)) { + if (!(r_ptr->flags2 & RF2_STUPID)) + turn_flags_ptr->do_move = FALSE; + else if (is_original_ap_and_seen(target_ptr, m_ptr)) + r_ptr->r_flags2 |= (RF2_STUPID); + } + + if (!turn_flags_ptr->do_move) + return; + + if (!target_ptr->riding || one_in_(2)) { + (void)make_attack_normal(target_ptr, m_idx); + turn_flags_ptr->do_move = FALSE; + turn_flags_ptr->do_turn = TRUE; + } } - /*! * @brief モンスターからモンスターへの直接攻撃を実行する * @param target_ptr プレーヤーへの参照ポインタ @@ -70,64 +68,66 @@ void exe_monster_attack_to_player(player_type *target_ptr, turn_flags *turn_flag */ static bool exe_monster_attack_to_monster(player_type *target_ptr, MONSTER_IDX m_idx, grid_type *g_ptr) { - 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 *y_ptr; - y_ptr = &target_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; - if ((r_ptr->flags1 & RF1_NEVER_BLOW) != 0) return FALSE; - - if (((r_ptr->flags2 & RF2_KILL_BODY) == 0) && is_original_ap_and_seen(target_ptr, m_ptr)) - r_ptr->r_flags2 |= (RF2_KILL_BODY); - - if ((y_ptr->r_idx == 0) || (y_ptr->hp < 0)) return FALSE; - if (monst_attack_monst(target_ptr, m_idx, g_ptr->m_idx)) return TRUE; - if ((d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) == 0) return FALSE; - if (monster_confused_remaining(m_ptr)) return TRUE; - if ((r_ptr->flags2 & RF2_STUPID) == 0) return FALSE; - - if (is_original_ap_and_seen(target_ptr, m_ptr)) - r_ptr->r_flags2 |= (RF2_STUPID); - - return TRUE; + 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 *y_ptr; + y_ptr = &target_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; + if ((r_ptr->flags1 & RF1_NEVER_BLOW) != 0) + return FALSE; + + if (((r_ptr->flags2 & RF2_KILL_BODY) == 0) && is_original_ap_and_seen(target_ptr, m_ptr)) + r_ptr->r_flags2 |= (RF2_KILL_BODY); + + if ((y_ptr->r_idx == 0) || (y_ptr->hp < 0)) + return FALSE; + if (monst_attack_monst(target_ptr, m_idx, g_ptr->m_idx)) + return TRUE; + if ((d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) == 0) + return FALSE; + if (monster_confused_remaining(m_ptr)) + return TRUE; + if ((r_ptr->flags2 & RF2_STUPID) == 0) + return FALSE; + + if (is_original_ap_and_seen(target_ptr, m_ptr)) + r_ptr->r_flags2 |= (RF2_STUPID); + + return TRUE; } - /*! - * @brief モンスターからモンスターへの攻撃処理 - * @param target_ptr プレーヤーへの参照ポインタ - * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ - * @param m_idx モンスターID - * @param g_ptr グリッドへの参照ポインタ - * @param can_cross モンスターが地形を踏破できるならばTRUE - * @return ターン消費が発生したらTRUE - */ + * @brief モンスターからモンスターへの攻撃処理 + * @param target_ptr プレーヤーへの参照ポインタ + * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ + * @param m_idx モンスターID + * @param g_ptr グリッドへの参照ポインタ + * @param can_cross モンスターが地形を踏破できるならばTRUE + * @return ターン消費が発生したらTRUE + */ bool process_monster_attack_to_monster(player_type *target_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, grid_type *g_ptr, bool can_cross) { - 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 *y_ptr; - y_ptr = &target_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; - if (!turn_flags_ptr->do_move || (g_ptr->m_idx == 0)) return FALSE; - - monster_race *z_ptr = &r_info[y_ptr->r_idx]; - turn_flags_ptr->do_move = FALSE; - if ((((r_ptr->flags2 & RF2_KILL_BODY) != 0) && ((r_ptr->flags1 & RF1_NEVER_BLOW) == 0) && - (r_ptr->mexp * r_ptr->level > z_ptr->mexp * z_ptr->level) && - can_cross && (g_ptr->m_idx != target_ptr->riding)) || - are_enemies(target_ptr, m_ptr, y_ptr) || monster_confused_remaining(m_ptr)) - { - return exe_monster_attack_to_monster(target_ptr, m_idx, g_ptr); - } - - if (((r_ptr->flags2 & RF2_MOVE_BODY) != 0) && ((r_ptr->flags1 & RF1_NEVER_MOVE) == 0) && - (r_ptr->mexp > z_ptr->mexp) && - can_cross && (g_ptr->m_idx != target_ptr->riding) && - monster_can_cross_terrain(target_ptr, target_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0)) - { - turn_flags_ptr->do_move = TRUE; - turn_flags_ptr->did_move_body = TRUE; - (void)set_monster_csleep(target_ptr, g_ptr->m_idx, 0); - } - - return FALSE; + 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 *y_ptr; + y_ptr = &target_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; + if (!turn_flags_ptr->do_move || (g_ptr->m_idx == 0)) + return FALSE; + + monster_race *z_ptr = &r_info[y_ptr->r_idx]; + turn_flags_ptr->do_move = FALSE; + if ((((r_ptr->flags2 & RF2_KILL_BODY) != 0) && ((r_ptr->flags1 & RF1_NEVER_BLOW) == 0) && (r_ptr->mexp * r_ptr->level > z_ptr->mexp * z_ptr->level) + && can_cross && (g_ptr->m_idx != target_ptr->riding)) + || are_enemies(target_ptr, m_ptr, y_ptr) || monster_confused_remaining(m_ptr)) { + return exe_monster_attack_to_monster(target_ptr, m_idx, g_ptr); + } + + if (((r_ptr->flags2 & RF2_MOVE_BODY) != 0) && ((r_ptr->flags1 & RF1_NEVER_MOVE) == 0) && (r_ptr->mexp > z_ptr->mexp) && can_cross + && (g_ptr->m_idx != target_ptr->riding) + && monster_can_cross_terrain(target_ptr, target_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0)) { + turn_flags_ptr->do_move = TRUE; + turn_flags_ptr->did_move_body = TRUE; + (void)set_monster_csleep(target_ptr, g_ptr->m_idx, 0); + } + + return FALSE; } diff --git a/src/monster-floor/monster-remover.c b/src/monster-floor/monster-remover.c index 5b64bfa86..d7599f853 100644 --- a/src/monster-floor/monster-remover.c +++ b/src/monster-floor/monster-remover.c @@ -8,6 +8,7 @@ #include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "system/floor-type-definition.h" #include "system/monster-type-definition.h" diff --git a/src/monster/monster-status-setter.c b/src/monster/monster-status-setter.c index 8e085ce4d..55d7f2ae4 100644 --- a/src/monster/monster-status-setter.c +++ b/src/monster/monster-status-setter.c @@ -1,13 +1,28 @@ #include "monster/monster-status-setter.h" +#include "cmd-visual/cmd-draw.h" +#include "core/player-update-types.h" +#include "core/player-redraw-types.h" +#include "core/speed-table.h" +#include "core/stuff-handler.h" +#include "core/window-redrawer.h" #include "dungeon/quest-completion-checker.h" +#include "floor/cave.h" +#include "floor/floor.h" +#include "monster-floor/monster-move.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags3.h" +#include "monster-race/race-flags7.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" +#include "monster/monster-processor.h" +#include "monster/monster-status.h" // todo 相互依存. 後で何とかする. +#include "monster/monster-util.h" #include "monster/smart-learn-types.h" #include "player/avatar.h" +#include "system/floor-type-definition.h" #include "system/monster-type-definition.h" #include "view/display-messages.h" +#include "world/world.h" /*! * @brief モンスターをペットにする @@ -46,13 +61,10 @@ void set_hostile(player_type *player_ptr, monster_type *m_ptr) */ void anger_monster(player_type *player_ptr, monster_type *m_ptr) { - if (player_ptr->phase_out) - return; - if (!is_friendly(m_ptr)) + if (player_ptr->phase_out || !is_friendly(m_ptr)) return; GAME_TEXT m_name[MAX_NLEN]; - monster_desc(player_ptr, m_name, m_ptr, 0); msg_format(_("%^sは怒った!", "%^s gets angry!"), m_name); set_hostile(player_ptr, m_ptr); @@ -61,3 +73,330 @@ void anger_monster(player_type *player_ptr, monster_type *m_ptr) chg_virtue(player_ptr, V_JUSTICE, -1); chg_virtue(player_ptr, V_COMPASSION, -1); } + +/*! + * @brief モンスターの時限ステータスリストを削除 + * @param floor_ptr 現在フロアへの参照ポインタ + * @return m_idx モンスターの参照ID + * @return mproc_type 削除したいモンスターの時限ステータスID + * @return なし + */ +static void mproc_remove(floor_type *floor_ptr, MONSTER_IDX m_idx, int 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 モンスターの睡眠状態値をセットする。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(player_type *target_ptr, MONSTER_IDX m_idx, int v) +{ + floor_type *floor_ptr = target_ptr->current_floor_ptr; + monster_type *m_ptr = &floor_ptr->m_list[m_idx]; + bool notice = FALSE; + v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; + if (v) { + if (!monster_csleep_remaining(m_ptr)) { + mproc_add(floor_ptr, m_idx, MTIMED_CSLEEP); + notice = TRUE; + } + } else { + if (monster_csleep_remaining(m_ptr)) { + mproc_remove(floor_ptr, m_idx, MTIMED_CSLEEP); + notice = TRUE; + } + } + + m_ptr->mtimed[MTIMED_CSLEEP] = (s16b)v; + if (!notice) + return FALSE; + + if (m_ptr->ml) { + 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) + 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(player_type *target_ptr, MONSTER_IDX m_idx, int v) +{ + floor_type *floor_ptr = target_ptr->current_floor_ptr; + monster_type *m_ptr = &floor_ptr->m_list[m_idx]; + bool notice = FALSE; + v = (v > 200) ? 200 : (v < 0) ? 0 : v; + if (v) { + if (!monster_fast_remaining(m_ptr)) { + mproc_add(floor_ptr, m_idx, MTIMED_FAST); + notice = TRUE; + } + } else { + if (monster_fast_remaining(m_ptr)) { + mproc_remove(floor_ptr, m_idx, MTIMED_FAST); + notice = TRUE; + } + } + + m_ptr->mtimed[MTIMED_FAST] = (s16b)v; + if (!notice) + return FALSE; + + 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(player_type *target_ptr, MONSTER_IDX m_idx, int v) +{ + floor_type *floor_ptr = target_ptr->current_floor_ptr; + monster_type *m_ptr = &floor_ptr->m_list[m_idx]; + bool notice = FALSE; + v = (v > 200) ? 200 : (v < 0) ? 0 : v; + if (v) { + if (!monster_slow_remaining(m_ptr)) { + mproc_add(floor_ptr, m_idx, MTIMED_SLOW); + notice = TRUE; + } + } else { + if (monster_slow_remaining(m_ptr)) { + mproc_remove(floor_ptr, m_idx, MTIMED_SLOW); + notice = TRUE; + } + } + + m_ptr->mtimed[MTIMED_SLOW] = (s16b)v; + if (!notice) + return FALSE; + + 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(player_type *target_ptr, MONSTER_IDX m_idx, int v) +{ + floor_type *floor_ptr = target_ptr->current_floor_ptr; + monster_type *m_ptr = &floor_ptr->m_list[m_idx]; + bool notice = FALSE; + v = (v > 200) ? 200 : (v < 0) ? 0 : v; + if (v) { + if (!monster_stunned_remaining(m_ptr)) { + mproc_add(floor_ptr, m_idx, MTIMED_STUNNED); + notice = TRUE; + } + } else { + if (monster_stunned_remaining(m_ptr)) { + mproc_remove(floor_ptr, m_idx, MTIMED_STUNNED); + notice = TRUE; + } + } + + m_ptr->mtimed[MTIMED_STUNNED] = (s16b)v; + return notice; +} + +/*! + * @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(player_type *target_ptr, MONSTER_IDX m_idx, int v) +{ + floor_type *floor_ptr = target_ptr->current_floor_ptr; + monster_type *m_ptr = &floor_ptr->m_list[m_idx]; + bool notice = FALSE; + v = (v > 200) ? 200 : (v < 0) ? 0 : v; + if (v) { + if (!monster_confused_remaining(m_ptr)) { + mproc_add(floor_ptr, m_idx, MTIMED_CONFUSED); + notice = TRUE; + } + } else { + if (monster_confused_remaining(m_ptr)) { + mproc_remove(floor_ptr, m_idx, MTIMED_CONFUSED); + notice = TRUE; + } + } + + m_ptr->mtimed[MTIMED_CONFUSED] = (s16b)v; + return notice; +} + +/*! + * @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(player_type *target_ptr, MONSTER_IDX m_idx, int v) +{ + floor_type *floor_ptr = target_ptr->current_floor_ptr; + monster_type *m_ptr = &floor_ptr->m_list[m_idx]; + bool notice = FALSE; + v = (v > 200) ? 200 : (v < 0) ? 0 : v; + if (v) { + if (!monster_fear_remaining(m_ptr)) { + mproc_add(floor_ptr, m_idx, MTIMED_MONFEAR); + notice = TRUE; + } + } else { + if (monster_fear_remaining(m_ptr)) { + mproc_remove(floor_ptr, m_idx, MTIMED_MONFEAR); + notice = TRUE; + } + } + + m_ptr->mtimed[MTIMED_MONFEAR] = (s16b)v; + + if (!notice) + return FALSE; + + if (m_ptr->ml) { + 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(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need) +{ + floor_type *floor_ptr = target_ptr->current_floor_ptr; + monster_type *m_ptr = &floor_ptr->m_list[m_idx]; + bool notice = FALSE; + v = (v > 200) ? 200 : (v < 0) ? 0 : v; + if (v) { + if (!monster_invulner_remaining(m_ptr)) { + mproc_add(floor_ptr, m_idx, MTIMED_INVULNER); + notice = TRUE; + } + } else { + if (monster_invulner_remaining(m_ptr)) { + mproc_remove(floor_ptr, m_idx, MTIMED_INVULNER); + if (energy_need && !target_ptr->wild_mode) + m_ptr->energy_need += ENERGY_NEED(); + notice = TRUE; + } + } + + m_ptr->mtimed[MTIMED_INVULNER] = (s16b)v; + if (!notice) + return FALSE; + + if (m_ptr->ml) { + 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 target_ptr プレーヤーへの参照ポインタ + * @param num 時間停止を行った敵が行動できる回数 + * @param who 時間停止処理の主体ID + * @param vs_player TRUEならば時間停止開始処理を行う + * @return 時間停止が行われている状態ならばTRUEを返す + */ +bool set_monster_timewalk(player_type *target_ptr, int num, MONSTER_IDX who, bool vs_player) +{ + monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[hack_m_idx]; + if (current_world_ptr->timewalk_m_idx) + return FALSE; + + if (vs_player) { + GAME_TEXT m_name[MAX_NLEN]; + monster_desc(target_ptr, m_name, m_ptr, 0); + + if (who == 1) + msg_format(_("「『ザ・ワールド』!時は止まった!」", "%s yells 'The World! Time has stopped!'"), m_name); + else if (who == 3) + msg_format(_("「時よ!」", "%s yells 'Time!'"), m_name); + else + msg_print("hek!"); + + msg_print(NULL); + } + + current_world_ptr->timewalk_m_idx = hack_m_idx; + if (vs_player) + do_cmd_redraw(target_ptr); + + while (num--) { + if (!monster_is_valid(m_ptr)) + break; + + process_monster(target_ptr, current_world_ptr->timewalk_m_idx); + reset_target(m_ptr); + handle_stuff(target_ptr); + if (vs_player) + term_xtra(TERM_XTRA_DELAY, 500); + } + + target_ptr->redraw |= PR_MAP; + target_ptr->update |= PU_MONSTERS; + target_ptr->window |= PW_OVERHEAD | PW_DUNGEON; + 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(target_ptr); + return TRUE; +} diff --git a/src/monster/monster-status-setter.h b/src/monster/monster-status-setter.h index 4156a1e40..27c684fb3 100644 --- a/src/monster/monster-status-setter.h +++ b/src/monster/monster-status-setter.h @@ -7,3 +7,11 @@ void set_friendly(monster_type *m_ptr); void set_pet(player_type *player_ptr, monster_type *m_ptr); void set_hostile(player_type *player_ptr, monster_type *m_ptr); void anger_monster(player_type *player_ptr, monster_type *m_ptr); +bool set_monster_csleep(player_type *target_ptr, MONSTER_IDX m_idx, int v); +bool set_monster_fast(player_type *target_ptr, MONSTER_IDX m_idx, int v); +bool set_monster_slow(player_type *target_ptr, MONSTER_IDX m_idx, int v); +bool set_monster_stunned(player_type *target_ptr, MONSTER_IDX m_idx, int v); +bool set_monster_confused(player_type *target_ptr, MONSTER_IDX m_idx, int v); +bool set_monster_monfear(player_type *target_ptr, MONSTER_IDX m_idx, int v); +bool set_monster_invulner(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need); +bool set_monster_timewalk(player_type *target_ptr, int num, MONSTER_IDX who, bool vs_player); diff --git a/src/monster/monster-status.c b/src/monster/monster-status.c index 1ae87eae0..8a918968e 100644 --- a/src/monster/monster-status.c +++ b/src/monster/monster-status.c @@ -1,16 +1,13 @@ #include "monster/monster-status.h" #include "autopick/autopick-pref-processor.h" #include "cmd-io/cmd-dump.h" -#include "cmd-visual/cmd-draw.h" #include "core/player-redraw-types.h" #include "core/player-update-types.h" #include "core/speed-table.h" #include "core/stuff-handler.h" -#include "core/window-redrawer.h" #include "dungeon/dungeon-flag-types.h" #include "dungeon/dungeon.h" #include "floor/cave.h" -#include "floor/floor.h" #include "game-option/birth-options.h" #include "game-option/play-record-options.h" #include "game-option/text-display-options.h" @@ -24,7 +21,6 @@ #include "monster-attack/monster-attack-effect.h" #include "monster-attack/monster-attack-types.h" #include "monster-floor/monster-death.h" -#include "monster-floor/monster-move.h" #include "monster-floor/monster-remover.h" #include "monster-floor/monster-summon.h" #include "monster-floor/place-monster-types.h" @@ -44,9 +40,8 @@ #include "monster/monster-flag-types.h" #include "monster/monster-info.h" #include "monster/monster-list.h" -#include "monster/monster-processor.h" +#include "monster/monster-status-setter.h" // todo 相互依存. 後で何とかする. #include "monster/monster-update.h" -#include "monster/monster-util.h" #include "monster/smart-learn-types.h" #include "mspell/mspell-mask-definitions.h" #include "object-enchant/object-curse.h" @@ -235,7 +230,7 @@ int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type) * @return mproc_type 追加したいモンスターの時限ステータスID * @return なし */ -static void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type) +void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type) { 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; @@ -243,21 +238,6 @@ static void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type) } /*! - * @brief モンスターの時限ステータスリストを削除 - * @param floor_ptr 現在フロアへの参照ポインタ - * @return m_idx モンスターの参照ID - * @return mproc_type 削除したいモンスターの時限ステータスID - * @return なし - */ -static void mproc_remove(floor_type *floor_ptr, MONSTER_IDX m_idx, int 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 なし @@ -285,297 +265,6 @@ void mproc_init(floor_type *floor_ptr) } } -/*! - * @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(player_type *target_ptr, MONSTER_IDX m_idx, int v) -{ - floor_type *floor_ptr = target_ptr->current_floor_ptr; - monster_type *m_ptr = &floor_ptr->m_list[m_idx]; - bool notice = FALSE; - v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - - if (v) { - if (!monster_csleep_remaining(m_ptr)) { - mproc_add(floor_ptr, m_idx, MTIMED_CSLEEP); - notice = TRUE; - } - } - - else { - if (monster_csleep_remaining(m_ptr)) { - mproc_remove(floor_ptr, m_idx, MTIMED_CSLEEP); - notice = TRUE; - } - } - - /* Use the value */ - m_ptr->mtimed[MTIMED_CSLEEP] = (s16b)v; - - if (!notice) - return FALSE; - - if (m_ptr->ml) { - /* Update health bar as needed */ - 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) - 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(player_type *target_ptr, MONSTER_IDX m_idx, int v) -{ - floor_type *floor_ptr = target_ptr->current_floor_ptr; - monster_type *m_ptr = &floor_ptr->m_list[m_idx]; - bool notice = FALSE; - v = (v > 200) ? 200 : (v < 0) ? 0 : v; - - if (v) { - if (!monster_fast_remaining(m_ptr)) { - mproc_add(floor_ptr, m_idx, MTIMED_FAST); - notice = TRUE; - } - } - - else { - if (monster_fast_remaining(m_ptr)) { - mproc_remove(floor_ptr, m_idx, MTIMED_FAST); - notice = TRUE; - } - } - - /* Use the value */ - m_ptr->mtimed[MTIMED_FAST] = (s16b)v; - - if (!notice) - return FALSE; - - 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(player_type *target_ptr, MONSTER_IDX m_idx, int v) -{ - floor_type *floor_ptr = target_ptr->current_floor_ptr; - monster_type *m_ptr = &floor_ptr->m_list[m_idx]; - bool notice = FALSE; - v = (v > 200) ? 200 : (v < 0) ? 0 : v; - - if (v) { - if (!monster_slow_remaining(m_ptr)) { - mproc_add(floor_ptr, m_idx, MTIMED_SLOW); - notice = TRUE; - } - } - - else { - if (monster_slow_remaining(m_ptr)) { - mproc_remove(floor_ptr, m_idx, MTIMED_SLOW); - notice = TRUE; - } - } - - /* Use the value */ - m_ptr->mtimed[MTIMED_SLOW] = (s16b)v; - - if (!notice) - return FALSE; - - 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(player_type *target_ptr, MONSTER_IDX m_idx, int v) -{ - floor_type *floor_ptr = target_ptr->current_floor_ptr; - monster_type *m_ptr = &floor_ptr->m_list[m_idx]; - bool notice = FALSE; - v = (v > 200) ? 200 : (v < 0) ? 0 : v; - - if (v) { - if (!monster_stunned_remaining(m_ptr)) { - mproc_add(floor_ptr, m_idx, MTIMED_STUNNED); - notice = TRUE; - } - } - - else { - if (monster_stunned_remaining(m_ptr)) { - mproc_remove(floor_ptr, m_idx, MTIMED_STUNNED); - notice = TRUE; - } - } - - /* Use the value */ - m_ptr->mtimed[MTIMED_STUNNED] = (s16b)v; - - return notice; -} - -/*! - * @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(player_type *target_ptr, MONSTER_IDX m_idx, int v) -{ - floor_type *floor_ptr = target_ptr->current_floor_ptr; - monster_type *m_ptr = &floor_ptr->m_list[m_idx]; - bool notice = FALSE; - v = (v > 200) ? 200 : (v < 0) ? 0 : v; - - if (v) { - if (!monster_confused_remaining(m_ptr)) { - mproc_add(floor_ptr, m_idx, MTIMED_CONFUSED); - notice = TRUE; - } - } - - else { - if (monster_confused_remaining(m_ptr)) { - mproc_remove(floor_ptr, m_idx, MTIMED_CONFUSED); - notice = TRUE; - } - } - - /* Use the value */ - m_ptr->mtimed[MTIMED_CONFUSED] = (s16b)v; - - return notice; -} - -/*! - * @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(player_type *target_ptr, MONSTER_IDX m_idx, int v) -{ - floor_type *floor_ptr = target_ptr->current_floor_ptr; - monster_type *m_ptr = &floor_ptr->m_list[m_idx]; - bool notice = FALSE; - v = (v > 200) ? 200 : (v < 0) ? 0 : v; - - if (v) { - if (!monster_fear_remaining(m_ptr)) { - mproc_add(floor_ptr, m_idx, MTIMED_MONFEAR); - notice = TRUE; - } - } - - else { - if (monster_fear_remaining(m_ptr)) { - mproc_remove(floor_ptr, m_idx, MTIMED_MONFEAR); - notice = TRUE; - } - } - - /* Use the value */ - m_ptr->mtimed[MTIMED_MONFEAR] = (s16b)v; - - if (!notice) - return FALSE; - - if (m_ptr->ml) { - /* Update health bar as needed */ - 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(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need) -{ - floor_type *floor_ptr = target_ptr->current_floor_ptr; - monster_type *m_ptr = &floor_ptr->m_list[m_idx]; - bool notice = FALSE; - v = (v > 200) ? 200 : (v < 0) ? 0 : v; - - if (v) { - if (!monster_invulner_remaining(m_ptr)) { - mproc_add(floor_ptr, m_idx, MTIMED_INVULNER); - notice = TRUE; - } - } - - else { - if (monster_invulner_remaining(m_ptr)) { - mproc_remove(floor_ptr, m_idx, MTIMED_INVULNER); - if (energy_need && !target_ptr->wild_mode) - m_ptr->energy_need += ENERGY_NEED(); - notice = TRUE; - } - } - - /* Use the value */ - m_ptr->mtimed[MTIMED_INVULNER] = (s16b)v; - - if (!notice) - return FALSE; - - if (m_ptr->ml) { - /* Update health bar as needed */ - 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; -} - static u32b csleep_noise; /*! @@ -812,66 +501,6 @@ void dispel_monster_status(player_type *target_ptr, MONSTER_IDX m_idx) } /*! - * @brief モンスターの時間停止処理 - * @param target_ptr プレーヤーへの参照ポインタ - * @param num 時間停止を行った敵が行動できる回数 - * @param who 時間停止処理の主体ID - * @param vs_player TRUEならば時間停止開始処理を行う - * @return 時間停止が行われている状態ならばTRUEを返す - */ -bool set_monster_timewalk(player_type *target_ptr, int num, MONSTER_IDX who, bool vs_player) -{ - monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[hack_m_idx]; /* the world monster */ - - if (current_world_ptr->timewalk_m_idx) - return FALSE; - - if (vs_player) { - GAME_TEXT m_name[MAX_NLEN]; - monster_desc(target_ptr, m_name, m_ptr, 0); - - if (who == 1) - msg_format(_("「『ザ・ワールド』!時は止まった!」", "%s yells 'The World! Time has stopped!'"), m_name); - else if (who == 3) - msg_format(_("「時よ!」", "%s yells 'Time!'"), m_name); - else - msg_print("hek!"); - - msg_print(NULL); - } - - /* This monster cast spells */ - current_world_ptr->timewalk_m_idx = hack_m_idx; - - if (vs_player) - do_cmd_redraw(target_ptr); - - while (num--) { - if (!monster_is_valid(m_ptr)) - break; - process_monster(target_ptr, current_world_ptr->timewalk_m_idx); - reset_target(m_ptr); - handle_stuff(target_ptr); - - if (vs_player) - term_xtra(TERM_XTRA_DELAY, 500); - } - - target_ptr->redraw |= (PR_MAP); - target_ptr->update |= (PU_MONSTERS); - target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - - 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(target_ptr); - return TRUE; -} - -/*! * @brief モンスターの経験値取得処理 * @param target_ptr プレーヤーへの参照ポインタ * @param m_idx 経験値を得るモンスターの参照ID diff --git a/src/monster/monster-status.h b/src/monster/monster-status.h index 652b20d72..53743f73b 100644 --- a/src/monster/monster-status.h +++ b/src/monster/monster-status.h @@ -8,23 +8,11 @@ DEPTH monster_level_idx(floor_type *floor_ptr, MONSTER_IDX m_idx); HIT_POINT mon_damage_mod(player_type *target_ptr, monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear); bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note); -int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type); bool monster_is_valid(monster_type *m_ptr); -bool set_monster_csleep(player_type *target_ptr, MONSTER_IDX m_idx, int v); -bool set_monster_fast(player_type *target_ptr, MONSTER_IDX m_idx, int v); -bool set_monster_slow(player_type *target_ptr, MONSTER_IDX m_idx, int v); -bool set_monster_stunned(player_type *target_ptr, MONSTER_IDX m_idx, int v); -bool set_monster_confused(player_type *target_ptr, MONSTER_IDX m_idx, int v); -bool set_monster_monfear(player_type *target_ptr, MONSTER_IDX m_idx, int v); -bool set_monster_invulner(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need); -bool set_monster_timewalk(player_type *target_ptr, int num, MONSTER_IDX who, bool vs_player); - void dispel_monster_status(player_type *target_ptr, MONSTER_IDX m_idx); void monster_gain_exp(player_type *target_ptr, MONSTER_IDX m_idx, MONRACE_IDX s_idx); -int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type); -void mproc_init(floor_type *floor_ptr); void process_monsters_mtimed(player_type *target_ptr, int mtimed_idx); TIME_EFFECT monster_csleep_remaining(monster_type *m_ptr); @@ -34,3 +22,7 @@ TIME_EFFECT monster_stunned_remaining(monster_type *m_ptr); TIME_EFFECT monster_confused_remaining(monster_type *m_ptr); TIME_EFFECT monster_fear_remaining(monster_type *m_ptr); TIME_EFFECT monster_invulner_remaining(monster_type *m_ptr); + +int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type); +void mproc_init(floor_type *floor_ptr); +void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type); diff --git a/src/mspell/mspell-floor.c b/src/mspell/mspell-floor.c index e33c3ab54..1fef34f33 100644 --- a/src/mspell/mspell-floor.c +++ b/src/mspell/mspell-floor.c @@ -17,6 +17,7 @@ #include "monster-race/race-flags7.h" #include "monster-race/race-indice-types.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-update.h" #include "mspell/mspell-status.h" diff --git a/src/mspell/mspell-status.c b/src/mspell/mspell-status.c index 6085dbb53..7877f76cb 100644 --- a/src/mspell/mspell-status.c +++ b/src/mspell/mspell-status.c @@ -16,6 +16,7 @@ #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-update.h" #include "mspell/mspell-checker.h" diff --git a/src/player-attack/attack-chaos-effect.c b/src/player-attack/attack-chaos-effect.c index 3cc2c24a9..1e281ed11 100644 --- a/src/player-attack/attack-chaos-effect.c +++ b/src/player-attack/attack-chaos-effect.c @@ -18,6 +18,7 @@ #include "monster-race/race-flags3.h" #include "monster/monster-describer.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "object/object-mark-types.h" #include "player/attack-defense-types.h" diff --git a/src/spell-kind/earthquake.c b/src/spell-kind/earthquake.c index 643d30068..bc0457c58 100644 --- a/src/spell-kind/earthquake.c +++ b/src/spell-kind/earthquake.c @@ -20,7 +20,7 @@ #include "monster/monster-describer.h" #include "monster/monster-description-types.h" #include "monster/monster-info.h" -#include "monster/monster-status.h" +#include "monster/monster-status-setter.h" #include "monster/monster-update.h" #include "monster/smart-learn-types.h" #include "status/bad-status-setter.h" diff --git a/src/spell-kind/spells-fetcher.c b/src/spell-kind/spells-fetcher.c index 810d444df..faef529d5 100644 --- a/src/spell-kind/spells-fetcher.c +++ b/src/spell-kind/spells-fetcher.c @@ -11,7 +11,7 @@ #include "monster-race/monster-race.h" #include "monster-race/race-flags7.h" #include "monster/monster-describer.h" -#include "monster/monster-status.h" +#include "monster/monster-status-setter.h" #include "monster/monster-update.h" #include "system/floor-type-definition.h" #include "system/object-type-definition.h" diff --git a/src/spell-kind/spells-lite.c b/src/spell-kind/spells-lite.c index cf558f45d..3df476a4e 100644 --- a/src/spell-kind/spells-lite.c +++ b/src/spell-kind/spells-lite.c @@ -10,6 +10,7 @@ #include "monster-race/monster-race.h" #include "monster-race/race-flags2.h" #include "monster/monster-describer.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-update.h" #include "player/special-defense-types.h" diff --git a/src/spell-kind/spells-sight.c b/src/spell-kind/spells-sight.c index ed328180b..941e2e157 100644 --- a/src/spell-kind/spells-sight.c +++ b/src/spell-kind/spells-sight.c @@ -17,6 +17,7 @@ #include "monster/monster-description-types.h" #include "monster/monster-flag-types.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/smart-learn-types.h" #include "player/avatar.h" diff --git a/src/spell-kind/spells-teleport.c b/src/spell-kind/spells-teleport.c index c09abd0d4..0138fa8bf 100644 --- a/src/spell-kind/spells-teleport.c +++ b/src/spell-kind/spells-teleport.c @@ -21,6 +21,7 @@ #include "monster-race/race-flags-resistance.h" #include "monster-race/race-flags7.h" #include "monster/monster-info.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "monster/monster-update.h" #include "mutation/mutation-flag-types.h" diff --git a/src/spell-realm/spells-chaos.c b/src/spell-realm/spells-chaos.c index 14ee0b1be..ed8b272ff 100644 --- a/src/spell-realm/spells-chaos.c +++ b/src/spell-realm/spells-chaos.c @@ -9,6 +9,7 @@ #include "grid/feature.h" #include "grid/grid.h" #include "monster/monster-describer.h" +#include "monster/monster-status-setter.h" #include "monster/monster-status.h" #include "player/player-damage.h" #include "player/player-class.h" -- 2.11.0