OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Fix-Dungeon-Quest-BGM' into...
[hengband/hengband.git] / src / mspell / smart-mspell-util.c
1 #include "mspell/smart-mspell-util.h"
2 #include "monster-race/monster-race.h"
3 #include "monster-race/race-flags2.h"
4 #include "system/floor-type-definition.h"
5 #include "system/monster-type-definition.h"
6
7 msr_type *initialize_msr_type(player_type *target_ptr, msr_type *msr_ptr, MONSTER_IDX m_idx, const u32b f4p, const u32b f5p, const u32b f6p)
8 {
9     monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
10     msr_ptr->r_ptr = &r_info[m_ptr->r_idx];
11     msr_ptr->f4 = f4p;
12     msr_ptr->f5 = f5p;
13     msr_ptr->f6 = f6p;
14     msr_ptr->smart = 0L;
15     return msr_ptr;
16 }
17
18 /*!
19  * @brief モンスターがプレイヤーの弱点をついた選択を取るかどうかの判定 /
20  * Internal probability routine
21  * @param r_ptr モンスター種族の構造体参照ポインタ
22  * @param prob 基本確率(%)
23  * @return 適した選択を取るならばTRUEを返す。
24  */
25 bool int_outof(monster_race *r_ptr, PERCENTAGE prob)
26 {
27     if (!(r_ptr->flags2 & RF2_SMART))
28         prob = prob / 2;
29
30     return (randint0(100) < prob);
31 }