OSDN Git Service

[Refactor] #2141 floor_type *floor_ptrの宣言をautoに差し替えた
[hengbandforosx/hengbandosx.git] / src / melee / melee-spell-util.cpp
1 #include "melee/melee-spell-util.h"
2 #include "dungeon/dungeon-flag-types.h"
3 #include "dungeon/dungeon.h"
4 #include "dungeon/quest.h"
5 #include "floor/cave.h"
6 #include "floor/geometry.h"
7 #include "monster-race/monster-race.h"
8 #include "monster/monster-info.h"
9 #include "system/floor-type-definition.h"
10 #include "system/monster-race-definition.h"
11 #include "system/monster-type-definition.h"
12 #include "system/player-type-definition.h"
13
14 melee_spell_type *initialize_melee_spell_type(PlayerType *player_ptr, melee_spell_type *ms_ptr, MONSTER_IDX m_idx)
15 {
16     ms_ptr->m_idx = m_idx;
17     ms_ptr->y = 0;
18     ms_ptr->x = 0;
19     ms_ptr->target_idx = 0;
20     ms_ptr->thrown_spell = MonsterAbilityType::MAX;
21     ms_ptr->dam = 0;
22     auto *floor_ptr = player_ptr->current_floor_ptr;
23     ms_ptr->m_ptr = &floor_ptr->m_list[m_idx];
24     ms_ptr->t_ptr = nullptr;
25     ms_ptr->r_ptr = &r_info[ms_ptr->m_ptr->r_idx];
26     ms_ptr->see_m = is_seen(player_ptr, ms_ptr->m_ptr);
27     ms_ptr->maneable = player_has_los_bold(player_ptr, ms_ptr->m_ptr->fy, ms_ptr->m_ptr->fx);
28     ms_ptr->pet = is_pet(ms_ptr->m_ptr);
29     ms_ptr->in_no_magic_dungeon = d_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MAGIC) && floor_ptr->dun_level && (!inside_quest(floor_ptr->quest_number) || quest_type::is_fixed(floor_ptr->quest_number));
30     return ms_ptr;
31 }