OSDN Git Service

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