OSDN Git Service

[Refactor] #40498 Separated player-update-types.h from player-status.h
[hengband/hengband.git] / src / mspell / mspell-dispel.c
1 #include "mspell/mspell-dispel.h"
2 #include "core/player-update-types.h"
3 #include "core/speed-table.h"
4 #include "mind/mind-force-trainer.h"
5 #include "mind/mind-magic-resistance.h"
6 #include "mind/mind-mirror-master.h"
7 #include "monster/monster-info.h"
8 #include "monster/monster-status.h"
9 #include "mspell/mspell-type.h"
10 #include "mspell/mspell-util.h"
11 #include "mspell/mspells3.h"
12 #include "player/attack-defense-types.h"
13 #include "realm/realm-song-numbers.h"
14 #include "spell-realm/spells-craft.h"
15 #include "spell-realm/spells-crusade.h"
16 #include "spell-realm/spells-demon.h"
17 #include "spell-realm/spells-hex.h"
18 #include "spell-realm/spells-song.h"
19 #include "status/bad-status-setter.h"
20 #include "status/body-improvement.h"
21 #include "status/buff-setter.h"
22 #include "status/element-resistance.h"
23 #include "status/form-changer.h"
24 #include "status/sight-setter.h"
25 #include "status/temporary-resistance.h"
26 #include "view/display-messages.h"
27
28 /*!
29  * @brief プレイヤーに魔力消去効果を与える。
30  * @return なし
31  */
32 static void dispel_player(player_type *creature_ptr)
33 {
34     (void)set_fast(creature_ptr, 0, TRUE);
35     set_lightspeed(creature_ptr, 0, TRUE);
36     (void)set_slow(creature_ptr, 0, TRUE);
37     (void)set_shield(creature_ptr, 0, TRUE);
38     (void)set_blessed(creature_ptr, 0, TRUE);
39     (void)set_tsuyoshi(creature_ptr, 0, TRUE);
40     (void)set_hero(creature_ptr, 0, TRUE);
41     (void)set_shero(creature_ptr, 0, TRUE);
42     (void)set_protevil(creature_ptr, 0, TRUE);
43     (void)set_invuln(creature_ptr, 0, TRUE);
44     (void)set_wraith_form(creature_ptr, 0, TRUE);
45     (void)set_pass_wall(creature_ptr, 0, TRUE);
46     (void)set_tim_res_nether(creature_ptr, 0, TRUE);
47     (void)set_tim_res_time(creature_ptr, 0, TRUE);
48     (void)set_tim_reflect(creature_ptr, 0, TRUE);
49     (void)set_multishadow(creature_ptr, 0, TRUE);
50     (void)set_dustrobe(creature_ptr, 0, TRUE);
51
52     (void)set_tim_invis(creature_ptr, 0, TRUE);
53     (void)set_tim_infra(creature_ptr, 0, TRUE);
54     (void)set_tim_esp(creature_ptr, 0, TRUE);
55     (void)set_tim_regen(creature_ptr, 0, TRUE);
56     (void)set_tim_stealth(creature_ptr, 0, TRUE);
57     (void)set_tim_levitation(creature_ptr, 0, TRUE);
58     (void)set_tim_sh_force(creature_ptr, 0, TRUE);
59     (void)set_tim_sh_fire(creature_ptr, 0, TRUE);
60     (void)set_tim_sh_holy(creature_ptr, 0, TRUE);
61     (void)set_tim_eyeeye(creature_ptr, 0, TRUE);
62     (void)set_magicdef(creature_ptr, 0, TRUE);
63     (void)set_resist_magic(creature_ptr, 0, TRUE);
64     (void)set_oppose_acid(creature_ptr, 0, TRUE);
65     (void)set_oppose_elec(creature_ptr, 0, TRUE);
66     (void)set_oppose_fire(creature_ptr, 0, TRUE);
67     (void)set_oppose_cold(creature_ptr, 0, TRUE);
68     (void)set_oppose_pois(creature_ptr, 0, TRUE);
69     (void)set_ultimate_res(creature_ptr, 0, TRUE);
70     (void)set_mimic(creature_ptr, 0, 0, TRUE);
71     (void)set_ele_attack(creature_ptr, 0, 0);
72     (void)set_ele_immune(creature_ptr, 0, 0);
73
74     if (creature_ptr->special_attack & ATTACK_CONFUSE) {
75         creature_ptr->special_attack &= ~(ATTACK_CONFUSE);
76         msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
77     }
78
79     if (music_singing_any(creature_ptr) || hex_spelling_any(creature_ptr)) {
80         concptr str = (music_singing_any(creature_ptr)) ? _("歌", "singing") : _("呪文", "casting");
81         INTERUPTING_SONG_EFFECT(creature_ptr) = SINGING_SONG_EFFECT(creature_ptr);
82         SINGING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
83         msg_format(_("%sが途切れた。", "Your %s is interrupted."), str);
84
85         creature_ptr->action = ACTION_NONE;
86         creature_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
87         creature_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
88         creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
89         creature_ptr->energy_need += ENERGY_NEED();
90     }
91 }
92
93 /*!
94  * @brief RF4_DISPELの処理。魔力消去。 /
95  * @param m_idx 呪文を唱えるモンスターID
96  * @param target_ptr プレーヤーへの参照ポインタ
97  * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
98  * @param TARGET_TYPE プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
99  */
100 void spell_RF4_DISPEL(MONSTER_IDX m_idx, player_type *target_ptr, MONSTER_IDX t_idx, int TARGET_TYPE)
101 {
102     GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN];
103     monster_name(target_ptr, m_idx, m_name);
104     monster_name(target_ptr, t_idx, t_name);
105
106     monspell_message(target_ptr, m_idx, t_idx, _("%^sが何かを力強くつぶやいた。", "%^s mumbles powerfully."),
107         _("%^sが魔力消去の呪文を念じた。", "%^s invokes a dispel magic."), _("%^sが%sに対して魔力消去の呪文を念じた。", "%^s invokes a dispel magic at %s."),
108         TARGET_TYPE);
109
110     if (TARGET_TYPE == MONSTER_TO_PLAYER) {
111         dispel_player(target_ptr);
112         if (target_ptr->riding)
113             dispel_monster_status(target_ptr, target_ptr->riding);
114
115         if (is_echizen(target_ptr))
116             msg_print(_("やりやがったな!", ""));
117         else if ((target_ptr->pseikaku == PERSONALITY_CHARGEMAN)) {
118             if (randint0(2) == 0)
119                 msg_print(_("ジュラル星人め!", ""));
120             else
121                 msg_print(_("弱い者いじめは止めるんだ!", ""));
122         }
123
124         learn_spell(target_ptr, MS_DISPEL);
125         return;
126     }
127
128     if (TARGET_TYPE == MONSTER_TO_MONSTER) {
129         if (t_idx == target_ptr->riding)
130             dispel_player(target_ptr);
131
132         dispel_monster_status(target_ptr, t_idx);
133     }
134 }