OSDN Git Service

[Fix] #include / enum class 不足部を修正。
[hengbandforosx/hengbandosx.git] / src / melee / melee-util.cpp
1 #include "melee/melee-util.h"
2 #include "floor/geometry.h"
3 #include "grid/grid.h"
4 #include "melee/melee-switcher.h"
5 #include "monster-race/monster-race.h"
6 #include "system/floor-type-definition.h"
7 #include "system/monster-race-definition.h"
8 #include "system/monster-type-definition.h"
9 #include "system/player-type-definition.h"
10 #include "timed-effect/player-hallucination.h"
11 #include "timed-effect/timed-effects.h"
12
13 mam_type *initialize_mam_type(PlayerType *player_ptr, mam_type *mam_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
14 {
15     mam_ptr->attribute = BlowEffectType::NONE;
16     mam_ptr->m_idx = m_idx;
17     mam_ptr->t_idx = t_idx;
18     mam_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
19     mam_ptr->t_ptr = &player_ptr->current_floor_ptr->m_list[t_idx];
20     mam_ptr->damage = 0;
21     mam_ptr->see_m = is_seen(player_ptr, mam_ptr->m_ptr);
22     mam_ptr->see_t = is_seen(player_ptr, mam_ptr->t_ptr);
23     mam_ptr->see_either = mam_ptr->see_m || mam_ptr->see_t;
24     mam_ptr->y_saver = mam_ptr->t_ptr->fy;
25     mam_ptr->x_saver = mam_ptr->t_ptr->fx;
26     mam_ptr->explode = false;
27     mam_ptr->touched = false;
28
29     auto *r_ptr = &r_info[mam_ptr->m_ptr->r_idx];
30     monster_race *tr_ptr = &r_info[mam_ptr->t_ptr->r_idx];
31     mam_ptr->ac = tr_ptr->ac;
32     mam_ptr->rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
33     mam_ptr->blinked = false;
34     mam_ptr->do_silly_attack = (one_in_(2) && player_ptr->effects()->hallucination()->is_hallucinated());
35     mam_ptr->power = 0;
36     mam_ptr->obvious = false;
37     mam_ptr->known = (mam_ptr->m_ptr->cdis <= MAX_SIGHT) || (mam_ptr->t_ptr->cdis <= MAX_SIGHT);
38     mam_ptr->fear = false;
39     mam_ptr->dead = false;
40     return mam_ptr;
41 }