1 #include "effect/effect-monster-spirit.h"
2 #include "core/player-redraw-types.h"
3 #include "effect/effect-monster-util.h"
5 #include "hpmp/hp-mp-processor.h"
6 #include "monster-race/monster-race.h"
7 #include "monster-race/race-ability-mask.h"
8 #include "monster-race/race-flags1.h"
9 #include "monster-race/race-flags2.h"
10 #include "monster-race/race-flags3.h"
11 #include "monster/monster-describer.h"
12 #include "monster/monster-info.h"
13 #include "monster/monster-status-setter.h"
14 #include "monster/monster-status.h"
15 #include "system/monster-race-definition.h"
16 #include "system/monster-type-definition.h"
17 #include "system/player-type-definition.h"
18 #include "view/display-messages.h"
20 process_result effect_monster_drain_mana(player_type *caster_ptr, effect_monster_type *em_ptr)
23 em_ptr->obvious = TRUE;
24 auto ability_flags = em_ptr->r_ptr->ability_flags;
25 bool has_mana = ability_flags.reset(RF_ABILITY_NOMAGIC_MASK).any();
27 if (em_ptr->see_s_msg)
28 msg_format(_("%sには効果がなかった。", "%s is unaffected."), em_ptr->m_name);
31 return PROCESS_CONTINUE;
34 if (em_ptr->who <= 0) {
35 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), em_ptr->m_name);
36 (void)hp_player(caster_ptr, em_ptr->dam);
38 return PROCESS_CONTINUE;
41 if (em_ptr->m_caster_ptr->hp >= em_ptr->m_caster_ptr->maxhp) {
43 return PROCESS_CONTINUE;
46 em_ptr->m_caster_ptr->hp += em_ptr->dam;
47 if (em_ptr->m_caster_ptr->hp > em_ptr->m_caster_ptr->maxhp)
48 em_ptr->m_caster_ptr->hp = em_ptr->m_caster_ptr->maxhp;
50 if (caster_ptr->health_who == em_ptr->who)
51 caster_ptr->redraw |= (PR_HEALTH);
53 if (caster_ptr->riding == em_ptr->who)
54 caster_ptr->redraw |= (PR_UHEALTH);
56 if (em_ptr->see_s_msg) {
57 monster_desc(caster_ptr, em_ptr->killer, em_ptr->m_caster_ptr, 0);
58 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), em_ptr->killer);
62 return PROCESS_CONTINUE;
65 process_result effect_monster_mind_blast(player_type *caster_ptr, effect_monster_type *em_ptr)
68 em_ptr->obvious = TRUE;
70 msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name);
72 if ((em_ptr->r_ptr->flags1 & RF1_UNIQUE) || (em_ptr->r_ptr->flags3 & RF3_NO_CONF)
73 || (em_ptr->r_ptr->level > randint1((em_ptr->caster_lev - 10) < 1 ? 1 : (em_ptr->caster_lev - 10)) + 10)) {
74 if (em_ptr->r_ptr->flags3 & (RF3_NO_CONF)) {
75 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
76 em_ptr->r_ptr->r_flags3 |= (RF3_NO_CONF);
79 em_ptr->note = _("には効果がなかった。", " is unaffected.");
81 } else if (em_ptr->r_ptr->flags2 & RF2_EMPTY_MIND) {
82 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
83 em_ptr->r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
84 em_ptr->note = _("には完全な耐性がある!", " is immune.");
86 } else if (em_ptr->r_ptr->flags2 & RF2_WEIRD_MIND) {
87 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
88 em_ptr->r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
89 em_ptr->note = _("には耐性がある。", " resists.");
92 em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
93 em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
96 em_ptr->do_conf = randint0(4) + 4;
98 em_ptr->do_conf = randint0(8) + 8;
101 return PROCESS_CONTINUE;
104 process_result effect_monster_brain_smash(player_type *caster_ptr, effect_monster_type *em_ptr)
107 em_ptr->obvious = TRUE;
109 msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name);
111 if ((em_ptr->r_ptr->flags1 & RF1_UNIQUE) || (em_ptr->r_ptr->flags3 & RF3_NO_CONF)
112 || (em_ptr->r_ptr->level > randint1((em_ptr->caster_lev - 10) < 1 ? 1 : (em_ptr->caster_lev - 10)) + 10)) {
113 if (em_ptr->r_ptr->flags3 & (RF3_NO_CONF)) {
114 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
115 em_ptr->r_ptr->r_flags3 |= (RF3_NO_CONF);
118 em_ptr->note = _("には効果がなかった。", " is unaffected.");
120 } else if (em_ptr->r_ptr->flags2 & RF2_EMPTY_MIND) {
121 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
122 em_ptr->r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
124 em_ptr->note = _("には完全な耐性がある!", " is immune.");
126 } else if (em_ptr->r_ptr->flags2 & RF2_WEIRD_MIND) {
127 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
128 em_ptr->r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
130 em_ptr->note = _("には耐性がある!", " resists!");
133 em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
134 em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
135 if (em_ptr->who > 0) {
136 em_ptr->do_conf = randint0(4) + 4;
137 em_ptr->do_stun = randint0(4) + 4;
139 em_ptr->do_conf = randint0(8) + 8;
140 em_ptr->do_stun = randint0(8) + 8;
143 (void)set_monster_slow(caster_ptr, em_ptr->g_ptr->m_idx, monster_slow_remaining(em_ptr->m_ptr) + 10);
146 return PROCESS_CONTINUE;