OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Relocate-score-server' into...
[hengband/hengband.git] / src / effect / effect-monster-util.c
1 /*!
2  * @brief effect_monster_type構造体の初期化処理
3  * @date 2020/04/29
4  * @author Hourier
5  */
6
7 #include "effect/effect-monster-util.h"
8 #include "monster-floor/monster-death.h"
9 #include "monster-race/monster-race.h"
10 #include "monster/monster-info.h"
11 #include "monster/monster-status.h"
12 #include "system/floor-type-definition.h"
13
14 /*!
15  * @brief affect_monster() に亘ってきた引数をeffect_monster_type構造体に代入する
16  * @param em_ptr モンスター効果構造体への参照ポインタ
17  * @param who 魔法を発動したモンスター (0ならばプレーヤー)
18  * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
19  * @param y 目標y座標 / Target y location (or location to travel "towards")
20  * @param x 目標x座標 / Target x location (or location to travel "towards")
21  * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
22  * @param effect_type 効果属性 / Type of damage to apply to monsters (and objects)
23  * @param flag 効果フラグ
24  * @param see_s_msg TRUEならばメッセージを表示する
25  * @return なし
26  */
27 static void substitute_effect_monster(effect_monster_type *em_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID effect_type, BIT_FLAGS flag, bool see_s_msg)
28 {
29         em_ptr->who = who;
30         em_ptr->r = r;
31         em_ptr->y = y;
32         em_ptr->x = x;
33         em_ptr->dam = dam;
34         em_ptr->effect_type = effect_type;
35         em_ptr->flag = flag;
36         em_ptr->see_s_msg = see_s_msg;
37 }
38
39
40 /*!
41  * @brief effect_monster_type構造体を初期化する
42  * @param caster_ptr プレーヤーへの参照ポインタ
43  * @param em_ptr モンスター効果構造体への参照ポインタ
44  * @param who 魔法を発動したモンスター (0ならばプレーヤー)
45  * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
46  * @param y 目標y座標 / Target y location (or location to travel "towards")
47  * @param x 目標x座標 / Target x location (or location to travel "towards")
48  * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
49  * @param effect_type 効果属性 / Type of damage to apply to monsters (and objects)
50  * @param flag 効果フラグ
51  * @param see_s_msg TRUEならばメッセージを表示する
52  * @return なし
53  */
54 effect_monster_type *initialize_effect_monster(player_type *caster_ptr, effect_monster_type *em_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID effect_type, BIT_FLAGS flag, bool see_s_msg)
55 {
56         substitute_effect_monster(em_ptr, who, r, y, x, dam, effect_type, flag, see_s_msg);
57
58         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
59         em_ptr->g_ptr = &floor_ptr->grid_array[em_ptr->y][em_ptr->x];
60         em_ptr->m_ptr = &floor_ptr->m_list[em_ptr->g_ptr->m_idx];
61         em_ptr->m_caster_ptr = (em_ptr->who > 0) ? &floor_ptr->m_list[em_ptr->who] : NULL;
62         em_ptr->r_ptr = &r_info[em_ptr->m_ptr->r_idx];
63         em_ptr->seen = em_ptr->m_ptr->ml;
64         em_ptr->seen_msg = is_seen(caster_ptr, em_ptr->m_ptr);
65         em_ptr->slept = (bool)monster_csleep_remaining(em_ptr->m_ptr);
66         em_ptr->obvious = FALSE;
67         em_ptr->known = ((em_ptr->m_ptr->cdis <= MAX_SIGHT) || caster_ptr->phase_out);
68         em_ptr->skipped = FALSE;
69         em_ptr->get_angry = FALSE;
70         em_ptr->do_polymorph = FALSE;
71         em_ptr->do_dist = 0;
72         em_ptr->do_conf = 0;
73         em_ptr->do_stun = 0;
74         em_ptr->do_sleep = 0;
75         em_ptr->do_fear = 0;
76         em_ptr->do_time = 0;
77         em_ptr->heal_leper = FALSE;
78         em_ptr->photo = 0;
79         em_ptr->note = NULL;
80         em_ptr->note_dies = extract_note_dies(real_r_idx(em_ptr->m_ptr));
81         em_ptr->caster_lev = (em_ptr->who > 0) ? r_info[em_ptr->m_caster_ptr->r_idx].level : (caster_ptr->lev * 2);
82         return em_ptr;
83 }