OSDN Git Service

Reworded English message for a monk's successful MA_SLOW attack.
[hengband/hengband.git] / src / mspell / improper-mspell-remover.c
1 #include "mspell/improper-mspell-remover.h"
2 #include "game-option/birth-options.h"
3 #include "monster-race/monster-race.h"
4 #include "monster-race/race-flags2.h"
5 #include "monster/smart-learn-types.h"
6 #include "mspell/element-resistance-checker.h"
7 #include "mspell/high-resistance-checker.h"
8 #include "mspell/smart-mspell-util.h"
9 #include "system/floor-type-definition.h"
10 #include "system/monster-type-definition.h"
11
12 static void add_cheat_remove_flags(player_type *target_ptr, msr_type *msr_ptr)
13 {
14     if (!smart_cheat)
15         return;
16
17     add_cheat_remove_flags_element(target_ptr, msr_ptr);
18     add_cheat_remove_flags_others(target_ptr, msr_ptr);
19 }
20
21 /*!
22  * @brief モンスターの魔法一覧から戦術的に適さない魔法を除外する /
23  * Remove the "bad" spells from a spell list
24  * @param m_idx モンスターの構造体参照ポインタ
25  * @param f4p モンスター魔法のフラグリスト1
26  * @param f5p モンスター魔法のフラグリスト2
27  * @param f6p モンスター魔法のフラグリスト3
28  * @return なし
29  */
30 void remove_bad_spells(MONSTER_IDX m_idx, player_type *target_ptr, u32b *f4p, u32b *f5p, u32b *f6p)
31 {
32     msr_type tmp_msr;
33     msr_type *msr_ptr = initialize_msr_type(target_ptr, &tmp_msr, m_idx, *f4p, *f5p, *f6p);
34     if (msr_ptr->r_ptr->flags2 & RF2_STUPID)
35         return;
36
37     if (!smart_cheat && !smart_learn)
38         return;
39
40     monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
41     if (smart_learn) {
42         if (m_ptr->smart && (randint0(100) < 1))
43             m_ptr->smart &= SM_FRIENDLY | SM_PET | SM_CLONED;
44
45         msr_ptr->smart = m_ptr->smart;
46     }
47
48     add_cheat_remove_flags(target_ptr, msr_ptr);
49     if (!msr_ptr->smart)
50         return;
51
52     check_element_resistance(msr_ptr);
53     check_high_resistances(target_ptr, msr_ptr);
54     *f4p = msr_ptr->f4;
55     *f5p = msr_ptr->f5;
56     *f6p = msr_ptr->f6;
57 }