1 #include "mspell/mspell-dispel.h"
2 #include "blue-magic/blue-magic-checker.h"
3 #include "core/player-redraw-types.h"
4 #include "core/speed-table.h"
5 #include "core/window-redrawer.h"
6 #include "mind/mind-force-trainer.h"
7 #include "mind/mind-magic-resistance.h"
8 #include "mind/mind-mirror-master.h"
9 #include "monster/monster-info.h"
10 #include "monster/monster-status-setter.h"
11 #include "monster/monster-status.h"
12 #include "mspell/mspell-result.h"
13 #include "mspell/mspell-util.h"
14 #include "player-info/race-info.h"
15 #include "player/attack-defense-types.h"
16 #include "player/player-status.h"
17 #include "realm/realm-song-numbers.h"
18 #include "spell-realm/spells-craft.h"
19 #include "spell-realm/spells-crusade.h"
20 #include "spell-realm/spells-demon.h"
21 #include "spell-realm/spells-hex.h"
22 #include "spell-realm/spells-song.h"
23 #include "status/bad-status-setter.h"
24 #include "status/body-improvement.h"
25 #include "status/buff-setter.h"
26 #include "status/element-resistance.h"
27 #include "status/shape-changer.h"
28 #include "status/sight-setter.h"
29 #include "status/temporary-resistance.h"
30 #include "system/player-type-definition.h"
31 #include "system/redrawing-flags-updater.h"
32 #include "view/display-messages.h"
35 * @brief プレイヤーに魔力消去効果を与える。
37 static void dispel_player(PlayerType *player_ptr)
39 (void)set_acceleration(player_ptr, 0, true);
40 set_lightspeed(player_ptr, 0, true);
41 (void)BadStatusSetter(player_ptr).set_deceleration(0, true);
42 (void)set_shield(player_ptr, 0, true);
43 (void)set_blessed(player_ptr, 0, true);
44 (void)set_tsuyoshi(player_ptr, 0, true);
45 (void)set_hero(player_ptr, 0, true);
46 (void)set_shero(player_ptr, 0, true);
47 (void)set_protevil(player_ptr, 0, true);
48 (void)set_invuln(player_ptr, 0, true);
49 (void)set_wraith_form(player_ptr, 0, true);
50 (void)set_pass_wall(player_ptr, 0, true);
51 (void)set_tim_res_nether(player_ptr, 0, true);
52 (void)set_tim_res_time(player_ptr, 0, true);
53 (void)set_tim_reflect(player_ptr, 0, true);
54 (void)set_multishadow(player_ptr, 0, true);
55 (void)set_dustrobe(player_ptr, 0, true);
57 (void)set_tim_invis(player_ptr, 0, true);
58 (void)set_tim_infra(player_ptr, 0, true);
59 (void)set_tim_esp(player_ptr, 0, true);
60 (void)set_tim_regen(player_ptr, 0, true);
61 (void)set_tim_stealth(player_ptr, 0, true);
62 (void)set_tim_levitation(player_ptr, 0, true);
63 (void)set_tim_sh_force(player_ptr, 0, true);
64 (void)set_tim_sh_fire(player_ptr, 0, true);
65 (void)set_tim_sh_holy(player_ptr, 0, true);
66 (void)set_tim_eyeeye(player_ptr, 0, true);
67 (void)set_magicdef(player_ptr, 0, true);
68 (void)set_resist_magic(player_ptr, 0, true);
69 (void)set_oppose_acid(player_ptr, 0, true);
70 (void)set_oppose_elec(player_ptr, 0, true);
71 (void)set_oppose_fire(player_ptr, 0, true);
72 (void)set_oppose_cold(player_ptr, 0, true);
73 (void)set_oppose_pois(player_ptr, 0, true);
74 (void)set_ultimate_res(player_ptr, 0, true);
75 (void)set_mimic(player_ptr, 0, MimicKindType::NONE, true);
76 (void)set_ele_attack(player_ptr, 0, 0);
77 (void)set_ele_immune(player_ptr, 0, 0);
79 if (player_ptr->special_attack & ATTACK_CONFUSE) {
80 player_ptr->special_attack &= ~(ATTACK_CONFUSE);
81 msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
84 auto song_interruption = music_singing_any(player_ptr);
85 auto spellhex_interruption = SpellHex(player_ptr).is_spelling_any();
87 if (song_interruption || spellhex_interruption) {
88 if (song_interruption) {
89 set_interrupting_song_effect(player_ptr, get_singing_song_effect(player_ptr));
90 set_singing_song_effect(player_ptr, MUSIC_NONE);
91 msg_print(_("歌が途切れた。", "Your singing is interrupted."));
93 if (spellhex_interruption) {
94 SpellHex(player_ptr).interrupt_spelling();
95 msg_print(_("呪文が途切れた。", "Your casting is interrupted."));
98 player_ptr->action = ACTION_NONE;
99 auto &rfu = RedrawingFlagsUpdater::get_instance();
100 const auto flags_srf = {
101 StatusRedrawingFlag::BONUS,
102 StatusRedrawingFlag::HP,
103 StatusRedrawingFlag::MONSTER_STATUSES,
105 rfu.set_flags(flags_srf);
106 const auto flags_mwrf = {
107 MainWindowRedrawingFlag::MAP,
108 MainWindowRedrawingFlag::TIMED_EFFECT,
109 MainWindowRedrawingFlag::ACTION,
111 rfu.set_flags(flags_mwrf);
112 player_ptr->window_flags |= (PW_OVERHEAD | PW_DUNGEON);
113 player_ptr->energy_need += ENERGY_NEED();
118 * @brief RF4_DISPELの処理。魔力消去。 /
119 * @param m_idx 呪文を唱えるモンスターID
120 * @param player_ptr プレイヤーへの参照ポインタ
121 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
122 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
126 MonsterSpellResult spell_RF4_DISPEL(MONSTER_IDX m_idx, PlayerType *player_ptr, MONSTER_IDX t_idx, int target_type)
128 auto res = MonsterSpellResult::make_valid();
129 res.learnable = target_type == MONSTER_TO_PLAYER;
131 mspell_cast_msg_blind msg(_("%s^が何かを力強くつぶやいた。", "%s^ mumbles powerfully."),
132 _("%s^が魔力消去の呪文を念じた。", "%s^ invokes a dispel magic."), _("%s^が%sに対して魔力消去の呪文を念じた。", "%s^ invokes a dispel magic at %s."));
134 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
136 if (target_type == MONSTER_TO_PLAYER) {
137 dispel_player(player_ptr);
138 if (player_ptr->riding) {
139 dispel_monster_status(player_ptr, player_ptr->riding);
142 if (is_echizen(player_ptr)) {
143 msg_print(_("やりやがったな!", ""));
144 } else if (is_chargeman(player_ptr)) {
145 if (randint0(2) == 0) {
146 msg_print(_("ジュラル星人め!", ""));
148 msg_print(_("弱い者いじめは止めるんだ!", ""));
155 if (target_type == MONSTER_TO_MONSTER) {
156 if (t_idx == player_ptr->riding) {
157 dispel_player(player_ptr);
160 dispel_monster_status(player_ptr, t_idx);