7 #include "player/eldritch-horror.h"
8 #include "core/player-update-types.h"
9 #include "core/stuff-handler.h"
10 #include "monster-race/monster-race-hook.h"
11 #include "monster-race/monster-race.h"
12 #include "monster-race/race-flags1.h"
13 #include "monster-race/race-flags2.h"
14 #include "monster-race/race-flags3.h"
15 #include "monster/horror-descriptions.h"
16 #include "monster/monster-describer.h"
17 #include "monster/monster-info.h"
18 #include "monster/monster-list.h"
19 #include "monster/monster-util.h"
20 #include "monster/smart-learn-types.h"
21 #include "mutation/mutation-flag-types.h"
22 #include "player-base/player-race.h"
23 #include "player-info/mimic-info-table.h"
24 #include "player/player-status-flags.h"
25 #include "player/player-status.h"
26 #include "status/bad-status-setter.h"
27 #include "status/base-status.h"
28 #include "system/floor-type-definition.h"
29 #include "system/monster-race-definition.h"
30 #include "system/monster-type-definition.h"
31 #include "system/player-type-definition.h"
32 #include "view/display-messages.h"
33 #include "world/world.h"
36 #include "locale/english.h"
40 * @brief エルドリッチホラーの形容詞種別を決める
41 * @param r_ptr モンスター情報への参照ポインタ
44 static concptr decide_horror_message(monster_race *r_ptr)
46 int horror_num = randint0(MAX_SAN_HORROR_SUM);
47 if (horror_num < MAX_SAN_HORROR_COMMON) {
48 return horror_desc_common[horror_num];
51 if ((r_ptr->flags3 & RF3_EVIL) != 0) {
52 return horror_desc_evil[horror_num - MAX_SAN_HORROR_COMMON];
55 return horror_desc_neutral[horror_num - MAX_SAN_HORROR_COMMON];
59 * @brief エルドリッチホラー持ちのモンスターを見た時の反応 (モンスター名版)
60 * @param m_name モンスター名
61 * @param r_ptr モンスター情報への参照ポインタ
62 * @todo m_nameとdescで何が違うのかは良く分からない
64 static void see_eldritch_horror(GAME_TEXT *m_name, monster_race *r_ptr)
66 concptr horror_message = decide_horror_message(r_ptr);
67 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), horror_message, m_name);
68 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
72 * @brief エルドリッチホラー持ちのモンスターを見た時の反応 (モンスター名版)
73 * @param desc モンスター名 (エルドリッチホラー持ちの全モンスターからランダム…のはず)
74 * @param r_ptr モンスターへの参照ポインタ
76 static void feel_eldritch_horror(concptr desc, monster_race *r_ptr)
78 concptr horror_message = decide_horror_message(r_ptr);
79 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), horror_message, desc);
80 r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
84 * @brief ELDRITCH_HORRORによるプレイヤーの精神破壊処理
85 * @param m_ptr ELDRITCH_HORRORを引き起こしたモンスターの参照ポインタ。薬・罠・魔法の影響ならnullptr
86 * @param necro 暗黒領域魔法の詠唱失敗によるものならばTRUEを返す
88 void sanity_blast(player_type *player_ptr, monster_type *m_ptr, bool necro)
90 if (player_ptr->phase_out || !w_ptr->character_dungeon)
94 if (!necro && m_ptr) {
95 GAME_TEXT m_name[MAX_NLEN];
96 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
97 power = r_ptr->level / 2;
98 monster_desc(player_ptr, m_name, m_ptr, 0);
99 if (!(r_ptr->flags1 & RF1_UNIQUE)) {
100 if (r_ptr->flags1 & RF1_FRIENDS)
105 if (!w_ptr->is_loading_now)
111 if (!(r_ptr->flags2 & RF2_ELDRITCH_HORROR))
117 if (randint1(100) > power)
120 if (saving_throw(player_ptr->skill_sav - power))
123 if (player_ptr->hallucinated) {
124 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
126 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
127 BadStatusSetter(player_ptr).mod_hallucination(randint1(r_ptr->level));
133 see_eldritch_horror(m_name, r_ptr);
134 switch (PlayerRace(player_ptr).life()) {
135 case PlayerRaceLife::DEMON:
137 case PlayerRaceLife::UNDEAD:
138 if (saving_throw(25 + player_ptr->lev))
146 GAME_TEXT m_name[MAX_NLEN];
148 get_mon_num_prep(player_ptr, get_nightmare, nullptr);
149 r_ptr = &r_info[get_mon_num(player_ptr, 0, MAX_DEPTH, 0)];
150 power = r_ptr->level + 10;
151 desc = r_ptr->name.c_str();
152 get_mon_num_prep(player_ptr, nullptr, nullptr);
156 if (!(r_ptr->flags1 & RF1_UNIQUE))
157 sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
160 sprintf(m_name, "%s", desc);
162 if (!(r_ptr->flags1 & RF1_UNIQUE)) {
163 if (r_ptr->flags1 & RF1_FRIENDS)
168 if (saving_throw(player_ptr->skill_sav * 100 / power)) {
169 msg_format(_("夢の中で%sに追いかけられた。", "%^s chases you through your dreams."), m_name);
173 if (player_ptr->hallucinated) {
174 msg_format(_("%s%sの顔を見てしまった!", "You behold the %s visage of %s!"), funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
176 msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
177 BadStatusSetter(player_ptr).mod_hallucination(randint1(r_ptr->level));
183 feel_eldritch_horror(desc, r_ptr);
184 switch (PlayerRace(player_ptr).life()) {
185 case PlayerRaceLife::DEMON:
186 if (saving_throw(20 + player_ptr->lev))
189 case PlayerRaceLife::UNDEAD:
190 if (saving_throw(10 + player_ptr->lev))
197 msg_print(_("ネクロノミコンを読んで正気を失った!", "Your sanity is shaken by reading the Necronomicon!"));
200 /* 過去の効果無効率再現のため5回saving_throw 実行 */
201 if (saving_throw(player_ptr->skill_sav - power) && saving_throw(player_ptr->skill_sav - power) && saving_throw(player_ptr->skill_sav - power)
202 && saving_throw(player_ptr->skill_sav - power) && saving_throw(player_ptr->skill_sav - power)) {
206 switch (randint1(22)) {
208 if (player_ptr->muta.has_not(MUTA::MORONIC)) {
209 if ((player_ptr->stat_use[A_INT] < 4) && (player_ptr->stat_use[A_WIS] < 4)) {
210 msg_print(_("あなたは完璧な馬鹿になったような気がした。しかしそれは元々だった。", "You turn into an utter moron!"));
212 msg_print(_("あなたは完璧な馬鹿になった!", "You turn into an utter moron!"));
215 if (player_ptr->muta.has(MUTA::HYPER_INT)) {
216 msg_print(_("あなたの脳は生体コンピュータではなくなった。", "Your brain is no longer a living computer."));
217 player_ptr->muta.reset(MUTA::HYPER_INT);
220 player_ptr->muta.set(MUTA::MORONIC);
226 if (player_ptr->muta.has_not(MUTA::COWARDICE) && !has_resist_fear(player_ptr)) {
227 msg_print(_("あなたはパラノイアになった!", "You become paranoid!"));
228 if (player_ptr->muta.has(MUTA::FEARLESS)) {
229 msg_print(_("あなたはもう恐れ知らずではなくなった。", "You are no longer fearless."));
230 player_ptr->muta.reset(MUTA::FEARLESS);
233 player_ptr->muta.set(MUTA::COWARDICE);
239 if (player_ptr->muta.has_not(MUTA::HALLU) && !has_resist_chaos(player_ptr)) {
240 msg_print(_("幻覚をひき起こす精神錯乱に陥った!", "You are afflicted by a hallucinatory insanity!"));
241 player_ptr->muta.set(MUTA::HALLU);
247 if (player_ptr->muta.has_not(MUTA::BERS_RAGE) && !has_resist_conf(player_ptr)) {
248 msg_print(_("激烈な感情の発作におそわれるようになった!", "You become subject to fits of berserk rage!"));
249 player_ptr->muta.set(MUTA::BERS_RAGE);
262 BadStatusSetter bss(player_ptr);
263 if (!has_resist_conf(player_ptr)) {
264 (void)bss.mod_confusion(randint0(4) + 4);
267 if (!has_resist_chaos(player_ptr) && one_in_(3)) {
268 (void)bss.mod_hallucination(randint0(250) + 150);
271 /*!< @todo いつからかは不明だがreturnとbreakが同時に存在している。どちらがデッドコードか不明瞭なので保留 */
278 BadStatusSetter bss(player_ptr);
279 if (!has_resist_conf(player_ptr)) {
280 (void)bss.mod_confusion(randint0(4) + 4);
282 if (!player_ptr->free_act) {
283 (void)bss.mod_paralysis(randint0(4) + 4);
285 if (!has_resist_chaos(player_ptr)) {
286 (void)bss.mod_hallucination(randint0(250) + 150);
290 (void)do_dec_stat(player_ptr, A_INT);
291 } while (randint0(100) > player_ptr->skill_sav && one_in_(2));
294 (void)do_dec_stat(player_ptr, A_WIS);
295 } while (randint0(100) > player_ptr->skill_sav && one_in_(2));
301 if (lose_all_info(player_ptr))
302 msg_print(_("あまりの恐怖に全てのことを忘れてしまった!", "You forget everything in your utmost terror!"));
310 do_dec_stat(player_ptr, A_INT);
311 do_dec_stat(player_ptr, A_WIS);
318 player_ptr->update |= PU_BONUS;
319 handle_stuff(player_ptr);