7 #include "player/eldritch-horror.h"
8 #include "core/stuff-handler.h"
9 #include "floor/floor.h"
10 #include "monster-race/monster-race-hook.h"
11 #include "monster/horror-descriptions.h"
12 #include "monster/smart-learn-types.h"
13 #include "player/player-effects.h"
14 #include "player/player-status.h"
15 #include "player/mimic-info-table.h"
16 #include "world/world.h"
19 * @brief エルドリッチホラーの形容詞種別を決める
20 * @param r_ptr モンスター情報への参照ポインタ
23 static concptr decide_horror_message(monster_race *r_ptr)
25 int horror_num = randint0(MAX_SAN_HORROR_SUM);
26 if (horror_num < MAX_SAN_HORROR_COMMON) {
27 return horror_desc_common[horror_num];
30 if ((r_ptr->flags3 & RF3_EVIL) != 0) {
31 return horror_desc_evil[horror_num - MAX_SAN_HORROR_COMMON];
34 return horror_desc_neutral[horror_num - MAX_SAN_HORROR_COMMON];
38 * todo m_nameとdescで何が違うのかは良く分からない
39 * @brief エルドリッチホラー持ちのモンスターを見た時の反応 (モンスター名版)
40 * @param m_name モンスター名
41 * @param r_ptr モンスター情報への参照ポインタ
44 static void see_eldritch_horror(GAME_TEXT *m_name, monster_race *r_ptr)
46 concptr horror_message = decide_horror_message(r_ptr);
47 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), horror_message, m_name);
48 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
52 * @brief エルドリッチホラー持ちのモンスターを見た時の反応 (モンスター名版)
53 * @param desc モンスター名 (エルドリッチホラー持ちの全モンスターからランダム…のはず)
54 * @param r_ptr モンスターへの参照ポインタ
57 static void feel_eldritch_horror(concptr desc, monster_race *r_ptr)
59 concptr horror_message = decide_horror_message(r_ptr);
60 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), horror_message, desc);
61 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
65 * @brief ELDRITCH_HORRORによるプレイヤーの精神破壊処理
66 * @param m_ptr ELDRITCH_HORRORを引き起こしたモンスターの参照ポインタ。薬・罠・魔法の影響ならNULL
67 * @param necro 暗黒領域魔法の詠唱失敗によるものならばTRUEを返す
70 void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
72 if (creature_ptr->phase_out || !current_world_ptr->character_dungeon)
76 if (!necro && m_ptr) {
77 GAME_TEXT m_name[MAX_NLEN];
78 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
79 power = r_ptr->level / 2;
80 monster_desc(creature_ptr, m_name, m_ptr, 0);
81 if (!(r_ptr->flags1 & RF1_UNIQUE)) {
82 if (r_ptr->flags1 & RF1_FRIENDS)
87 if (!current_world_ptr->is_loading_now)
93 if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR))
99 if (randint1(100) > power)
102 if (saving_throw(creature_ptr->skill_sav - power))
105 if (creature_ptr->image) {
106 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
109 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
110 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
116 see_eldritch_horror(m_name, r_ptr);
117 if (PRACE_IS_(creature_ptr, RACE_IMP) || PRACE_IS_(creature_ptr, RACE_BALROG) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)
118 || current_world_ptr->wizard)
121 if (PRACE_IS_(creature_ptr, RACE_SKELETON) || PRACE_IS_(creature_ptr, RACE_ZOMBIE) || PRACE_IS_(creature_ptr, RACE_VAMPIRE)
122 || PRACE_IS_(creature_ptr, RACE_SPECTRE) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)) {
123 if (saving_throw(25 + creature_ptr->lev))
128 GAME_TEXT m_name[MAX_NLEN];
130 get_mon_num_prep(creature_ptr, get_nightmare, NULL);
131 r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH, 0)];
132 power = r_ptr->level + 10;
133 desc = r_name + r_ptr->name;
134 get_mon_num_prep(creature_ptr, NULL, NULL);
138 if (!(r_ptr->flags1 & RF1_UNIQUE))
139 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
142 sprintf(m_name, "%s", desc);
144 if (!(r_ptr->flags1 & RF1_UNIQUE)) {
145 if (r_ptr->flags1 & RF1_FRIENDS)
150 if (saving_throw(creature_ptr->skill_sav * 100 / power)) {
151 msg_format(_("夢の中で%sに追いかけられた。", "%^s chases you through your dreams."), m_name);
155 if (creature_ptr->image) {
156 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
159 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
160 creature_ptr->image = creature_ptr->image + randint1(r_ptr->level);
166 feel_eldritch_horror(desc, r_ptr);
167 if (!creature_ptr->mimic_form) {
168 switch (creature_ptr->prace) {
171 if (saving_throw(20 + creature_ptr->lev))
178 if (saving_throw(10 + creature_ptr->lev))
183 if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON) {
184 if (saving_throw(20 + creature_ptr->lev))
186 } else if (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD) {
187 if (saving_throw(10 + creature_ptr->lev))
192 msg_print(_("ネクロノミコンを読んで正気を失った!", "Your sanity is shaken by reading the Necronomicon!"));
195 /* 過去の効果無効率再現のため5回saving_throw 実行 */
196 if (saving_throw(creature_ptr->skill_sav - power) && saving_throw(creature_ptr->skill_sav - power) && saving_throw(creature_ptr->skill_sav - power)
197 && saving_throw(creature_ptr->skill_sav - power) && saving_throw(creature_ptr->skill_sav - power)) {
201 switch (randint1(22)) {
203 if (!(creature_ptr->muta3 & MUT3_MORONIC)) {
204 if ((creature_ptr->stat_use[A_INT] < 4) && (creature_ptr->stat_use[A_WIS] < 4)) {
205 msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
207 msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
210 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
211 msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
212 creature_ptr->muta3 &= ~(MUT3_HYPER_INT);
215 creature_ptr->muta3 |= MUT3_MORONIC;
221 if (!(creature_ptr->muta2 & MUT2_COWARDICE) && !creature_ptr->resist_fear) {
222 msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
223 if (creature_ptr->muta3 & MUT3_FEARLESS) {
224 msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
225 creature_ptr->muta3 &= ~(MUT3_FEARLESS);
228 creature_ptr->muta2 |= MUT2_COWARDICE;
234 if (!(creature_ptr->muta2 & MUT2_HALLU) && !creature_ptr->resist_chaos) {
235 msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
236 creature_ptr->muta2 |= MUT2_HALLU;
242 if (!(creature_ptr->muta2 & MUT2_BERS_RAGE) && !creature_ptr->resist_conf) {
243 msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
244 creature_ptr->muta2 |= MUT2_BERS_RAGE;
257 if (!creature_ptr->resist_conf) {
258 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
261 if (!creature_ptr->resist_chaos && one_in_(3)) {
262 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
265 /* todo いつからかは不明だがreturnとbreakが同時に存在している。どちらがデッドコードか不明瞭なので保留 */
272 if (!creature_ptr->resist_conf) {
273 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(4) + 4);
275 if (!creature_ptr->free_act) {
276 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4);
278 if (!creature_ptr->resist_chaos) {
279 (void)set_image(creature_ptr, creature_ptr->image + randint0(250) + 150);
283 (void)do_dec_stat(creature_ptr, A_INT);
284 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
287 (void)do_dec_stat(creature_ptr, A_WIS);
288 } while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
294 if (lose_all_info(creature_ptr))
295 msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
303 do_dec_stat(creature_ptr, A_INT);
304 do_dec_stat(creature_ptr, A_WIS);
311 creature_ptr->update |= PU_BONUS;
312 handle_stuff(creature_ptr);