OSDN Git Service

Merge pull request #3505 from habu1010/feature/fix-omission-pr3479
[hengbandforosx/hengbandosx.git] / src / blue-magic / blue-magic-util.cpp
1 /*!
2  * @file blue-magic-util.cpp
3  * @brief 青魔法の構造体、初期化処理定義
4  */
5
6 #include "blue-magic/blue-magic-util.h"
7 #include "monster-floor/place-monster-types.h"
8 #include "system/player-type-definition.h"
9
10 bmc_type *initialize_blue_magic_type(
11     PlayerType *player_ptr, bmc_type *bmc_ptr, const bool success, get_pseudo_monstetr_level_pf get_pseudo_monstetr_level)
12 {
13     bmc_ptr->plev = (*get_pseudo_monstetr_level)(player_ptr);
14     bmc_ptr->summon_lev = player_ptr->lev * 2 / 3 + randint1(player_ptr->lev / 2);
15     bmc_ptr->damage = 0;
16     bmc_ptr->pet = success; // read-only.
17     bmc_ptr->no_trump = false;
18     bmc_ptr->p_mode = bmc_ptr->pet ? PM_FORCE_PET : PM_NO_PET;
19     bmc_ptr->u_mode = 0L;
20     bmc_ptr->g_mode = bmc_ptr->pet ? 0 : PM_ALLOW_GROUP;
21     if (!success || (randint1(50 + bmc_ptr->plev) < bmc_ptr->plev / 10)) {
22         bmc_ptr->u_mode = PM_ALLOW_UNIQUE;
23     }
24
25     return bmc_ptr;
26 }