1 #include "mutation/mutation-processor.h"
2 #include "core/asking-player.h"
3 #include "core/disturbance.h"
4 #include "core/player-redraw-types.h"
5 #include "dungeon/dungeon.h"
6 #include "floor/geometry.h"
8 #include "hpmp/hp-mp-processor.h"
9 #include "inventory/inventory-object.h"
10 #include "inventory/inventory-slot-types.h"
11 #include "io/input-key-requester.h"
12 #include "main/sound-of-music.h"
13 #include "monster-floor/monster-summon.h"
14 #include "monster-floor/place-monster-types.h"
15 #include "monster-race/monster-race.h"
16 #include "monster/monster-status.h"
17 #include "mutation/mutation-flag-types.h"
18 #include "mutation/mutation-investor-remover.h"
19 #include "object/lite-processor.h"
20 #include "player-info/equipment-info.h"
21 #include "player/digestion-processor.h"
22 #include "player/player-damage.h"
23 #include "player/player-status-flags.h"
24 #include "spell-kind/spells-floor.h"
25 #include "spell-kind/spells-launcher.h"
26 #include "spell-kind/spells-lite.h"
27 #include "spell-kind/spells-sight.h"
28 #include "spell-kind/spells-teleport.h"
29 #include "spell-kind/spells-world.h"
30 #include "spell-realm/spells-hex.h"
31 #include "spell-realm/spells-song.h"
32 #include "spell/spell-types.h"
33 #include "spell/summon-types.h"
34 #include "status/bad-status-setter.h"
35 #include "status/base-status.h"
36 #include "status/body-improvement.h"
37 #include "status/buff-setter.h"
38 #include "status/shape-changer.h"
39 #include "status/sight-setter.h"
40 #include "store/store-owners.h"
41 #include "store/store-util.h"
42 #include "store/store.h"
43 #include "system/floor-type-definition.h"
44 #include "system/grid-type-definition.h"
45 #include "system/monster-race-definition.h"
46 #include "system/monster-type-definition.h"
47 #include "system/object-type-definition.h"
48 #include "system/player-type-definition.h"
49 #include "target/target-checker.h"
50 #include "target/target-setter.h"
51 #include "target/target-types.h"
52 #include "term/screen-processor.h"
53 #include "view/display-messages.h"
55 static bool get_hack_dir(player_type *player_ptr, DIRECTION *dp)
61 concptr p = target_okay(player_ptr)
62 ? _("方向 ('5'でターゲットへ, '*'でターゲット再選択, ESCで中断)? ", "Direction ('5' for target, '*' to re-target, Escape to cancel)? ")
63 : _("方向 ('*'でターゲット選択, ESCで中断)? ", "Direction ('*' to choose a target, Escape to cancel)? ");
64 if (!get_com(p, &command, true))
67 if (use_menu && (command == '\r'))
81 if (target_set(player_ptr, TARGET_KILL))
86 dir = get_keymap_dir(command);
90 if ((dir == 5) && !target_okay(player_ptr))
101 if (player_ptr->confused)
102 dir = ddd[randint0(8)];
104 if (command_dir != dir)
105 msg_print(_("あなたは混乱している。", "You are confused."));
112 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
113 * / Handle mutation effects once every 10 game turns
115 void process_world_aux_mutation(player_type *player_ptr)
117 if (player_ptr->muta.none() || player_ptr->phase_out || player_ptr->wild_mode) {
121 BadStatusSetter bss(player_ptr);
122 if (player_ptr->muta.has(MUTA::BERS_RAGE) && one_in_(3000)) {
123 disturb(player_ptr, false, true);
124 msg_print(_("ウガァァア!", "RAAAAGHH!"));
125 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
126 (void)set_shero(player_ptr, 10 + randint1(player_ptr->lev), false);
127 (void)bss.afraidness(0);
130 if (player_ptr->muta.has(MUTA::COWARDICE) && (randint1(3000) == 13)) {
131 if (!has_resist_fear(player_ptr)) {
132 disturb(player_ptr, false, true);
133 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
134 (void)bss.afraidness(player_ptr->afraid + 13 + randint1(26));
138 if (player_ptr->muta.has(MUTA::RTELEPORT) && (randint1(5000) == 88)) {
139 if (!has_resist_nexus(player_ptr) && player_ptr->muta.has_not(MUTA::VTELEPORT) && !player_ptr->anti_tele) {
140 disturb(player_ptr, false, true);
141 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
143 teleport_player(player_ptr, 40, TELEPORT_PASSIVE);
147 if (player_ptr->muta.has(MUTA::ALCOHOL) && (randint1(6400) == 321)) {
148 if (!has_resist_conf(player_ptr) && !has_resist_chaos(player_ptr)) {
149 disturb(player_ptr, false, true);
150 player_ptr->redraw |= PR_EXTRA;
151 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
154 if (!has_resist_conf(player_ptr)) {
155 (void)bss.confusion(player_ptr->confused + randint0(20) + 15);
158 if (!has_resist_chaos(player_ptr)) {
162 lose_all_info(player_ptr);
164 wiz_dark(player_ptr);
165 (void)teleport_player_aux(player_ptr, 100, false, i2enum<teleport_flags>(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE));
166 wiz_dark(player_ptr);
167 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
168 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing or how you got here!"));
171 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
172 (void)set_image(player_ptr, player_ptr->image + randint0(150) + 150);
178 if (player_ptr->muta.has(MUTA::HALLU) && (randint1(6400) == 42)) {
179 if (!has_resist_chaos(player_ptr)) {
180 disturb(player_ptr, false, true);
181 player_ptr->redraw |= PR_EXTRA;
182 (void)set_image(player_ptr, player_ptr->image + randint0(50) + 20);
186 if (player_ptr->muta.has(MUTA::FLATULENT) && (randint1(3000) == 13)) {
187 disturb(player_ptr, false, true);
188 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
190 fire_ball(player_ptr, GF_POIS, 0, player_ptr->lev, 3);
193 if (player_ptr->muta.has(MUTA::PROD_MANA) && !player_ptr->anti_magic && one_in_(9000)) {
195 disturb(player_ptr, false, true);
196 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
197 "Magical energy flows through you! You must release it!"));
201 (void)get_hack_dir(player_ptr, &dire);
202 fire_ball(player_ptr, GF_MANA, dire, player_ptr->lev * 2, 3);
205 if (player_ptr->muta.has(MUTA::ATT_DEMON) && !player_ptr->anti_magic && (randint1(6666) == 666)) {
206 bool pet = one_in_(6);
207 BIT_FLAGS mode = PM_ALLOW_GROUP;
210 mode |= PM_FORCE_PET;
212 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
214 if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, player_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode)) {
215 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
216 disturb(player_ptr, false, true);
220 if (player_ptr->muta.has(MUTA::SPEED_FLUX) && one_in_(6000)) {
221 disturb(player_ptr, false, true);
223 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
225 if (player_ptr->fast > 0) {
226 set_fast(player_ptr, 0, true);
228 set_slow(player_ptr, randint1(30) + 10, false);
231 msg_print(_("精力的になった気がする。", "You feel more energetic."));
233 if (player_ptr->slow > 0) {
234 set_slow(player_ptr, 0, true);
236 set_fast(player_ptr, randint1(30) + 10, false);
243 if (player_ptr->muta.has(MUTA::BANISH_ALL) && one_in_(9000)) {
244 disturb(player_ptr, false, true);
245 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
247 banish_monsters(player_ptr, 100);
248 if (!is_in_dungeon(player_ptr) && player_ptr->town_num) {
251 n = randint0(MAX_STORES);
252 } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
254 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
255 store_shuffle(player_ptr, n);
260 if (player_ptr->muta.has(MUTA::EAT_LIGHT) && one_in_(3000)) {
263 msg_print(_("影につつまれた。", "A shadow passes over you."));
266 if ((player_ptr->current_floor_ptr->grid_array[player_ptr->y][player_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) {
267 hp_player(player_ptr, 10);
270 o_ptr = &player_ptr->inventory_list[INVEN_LITE];
272 if (o_ptr->tval == TV_LITE) {
273 if (!o_ptr->is_fixed_artifact() && (o_ptr->xtra4 > 0)) {
274 hp_player(player_ptr, o_ptr->xtra4 / 20);
276 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
277 notice_lite_change(player_ptr, o_ptr);
282 * Unlite the area (radius 10) around player and
283 * do 50 points damage to every affected monster
285 unlite_area(player_ptr, 50, 10);
288 if (player_ptr->muta.has(MUTA::ATT_ANIMAL) && !player_ptr->anti_magic && one_in_(7000)) {
289 bool pet = one_in_(3);
290 BIT_FLAGS mode = PM_ALLOW_GROUP;
293 mode |= PM_FORCE_PET;
295 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
297 if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, player_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode)) {
298 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
299 disturb(player_ptr, false, true);
303 if (player_ptr->muta.has(MUTA::RAW_CHAOS) && !player_ptr->anti_magic && one_in_(8000)) {
304 disturb(player_ptr, false, true);
305 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
307 fire_ball(player_ptr, GF_CHAOS, 0, player_ptr->lev, 8);
310 if (player_ptr->muta.has(MUTA::NORMALITY) && one_in_(5000)) {
311 if (!lose_mutation(player_ptr, 0))
312 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
315 if (player_ptr->muta.has(MUTA::WRAITH) && !player_ptr->anti_magic && one_in_(3000)) {
316 disturb(player_ptr, false, true);
317 msg_print(_("非物質化した!", "You feel insubstantial!"));
319 set_wraith_form(player_ptr, randint1(player_ptr->lev / 2) + (player_ptr->lev / 2), false);
322 if (player_ptr->muta.has(MUTA::POLY_WOUND) && one_in_(3000))
323 do_poly_wounds(player_ptr);
325 if (player_ptr->muta.has(MUTA::WASTING) && one_in_(3000)) {
326 int which_stat = randint0(A_MAX);
327 int sustained = false;
329 switch (which_stat) {
331 if (has_sustain_str(player_ptr))
335 if (has_sustain_int(player_ptr))
339 if (has_sustain_wis(player_ptr))
343 if (has_sustain_dex(player_ptr))
347 if (has_sustain_con(player_ptr))
351 if (has_sustain_chr(player_ptr))
355 msg_print(_("不正な状態!", "Invalid stat chosen!"));
360 disturb(player_ptr, false, true);
361 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
363 (void)dec_stat(player_ptr, which_stat, randint1(6) + 6, one_in_(3));
367 if (player_ptr->muta.has(MUTA::ATT_DRAGON) && !player_ptr->anti_magic && one_in_(3000)) {
368 bool pet = one_in_(5);
369 BIT_FLAGS mode = PM_ALLOW_GROUP;
371 mode |= PM_FORCE_PET;
373 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
375 if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, player_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode)) {
376 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
377 disturb(player_ptr, false, true);
381 if (player_ptr->muta.has(MUTA::WEIRD_MIND) && !player_ptr->anti_magic && one_in_(3000)) {
382 if (player_ptr->tim_esp > 0) {
383 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
384 set_tim_esp(player_ptr, 0, true);
386 msg_print(_("精神が広がった!", "Your mind expands!"));
387 set_tim_esp(player_ptr, player_ptr->lev, false);
391 if (player_ptr->muta.has(MUTA::NAUSEA) && !player_ptr->slow_digest && one_in_(9000)) {
392 disturb(player_ptr, false, true);
393 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
395 set_food(player_ptr, PY_FOOD_WEAK);
396 if (music_singing_any(player_ptr))
397 stop_singing(player_ptr);
399 SpellHex spell_hex(player_ptr);
400 if (spell_hex.is_spelling_any()) {
401 (void)spell_hex.stop_all_spells();
405 if (player_ptr->muta.has(MUTA::WALK_SHAD) && !player_ptr->anti_magic && one_in_(12000) && !player_ptr->current_floor_ptr->inside_arena)
406 reserve_alter_reality(player_ptr, randint0(21) + 15);
408 if (player_ptr->muta.has(MUTA::WARNING) && one_in_(1000)) {
409 int danger_amount = 0;
410 for (MONSTER_IDX monster = 0; monster < player_ptr->current_floor_ptr->m_max; monster++) {
411 monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[monster];
412 monster_race *r_ptr = &r_info[m_ptr->r_idx];
413 if (!monster_is_valid(m_ptr))
416 if (r_ptr->level >= player_ptr->lev) {
417 danger_amount += r_ptr->level - player_ptr->lev + 1;
421 if (danger_amount > 100)
422 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
423 else if (danger_amount > 50)
424 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
425 else if (danger_amount > 20)
426 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
427 else if (danger_amount > 10)
428 msg_print(_("心配な気がする!", "You feel paranoid!"));
429 else if (danger_amount > 5)
430 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
432 msg_print(_("寂しい気がする。", "You feel lonely."));
435 if (player_ptr->muta.has(MUTA::INVULN) && !player_ptr->anti_magic && one_in_(5000)) {
436 disturb(player_ptr, false, true);
437 msg_print(_("無敵な気がする!", "You feel invincible!"));
439 (void)set_invuln(player_ptr, randint1(8) + 8, false);
442 if (player_ptr->muta.has(MUTA::SP_TO_HP) && one_in_(2000)) {
443 MANA_POINT wounds = (MANA_POINT)(player_ptr->mhp - player_ptr->chp);
445 HIT_POINT healing = player_ptr->csp;
446 if (healing > wounds)
449 hp_player(player_ptr, healing);
450 player_ptr->csp -= healing;
451 player_ptr->redraw |= (PR_HP | PR_MANA);
455 if (player_ptr->muta.has(MUTA::HP_TO_SP) && !player_ptr->anti_magic && one_in_(4000)) {
456 HIT_POINT wounds = (HIT_POINT)(player_ptr->msp - player_ptr->csp);
458 HIT_POINT healing = player_ptr->chp;
459 if (healing > wounds)
462 player_ptr->csp += healing;
463 player_ptr->redraw |= (PR_HP | PR_MANA);
464 take_hit(player_ptr, DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"));
468 if (player_ptr->muta.has(MUTA::DISARM) && one_in_(10000)) {
469 disturb(player_ptr, false, true);
470 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
471 take_hit(player_ptr, DAMAGE_NOESCAPE, randint1(player_ptr->wt / 6), _("転倒", "tripping"));
472 drop_weapons(player_ptr);
476 bool drop_weapons(player_type *player_ptr)
478 INVENTORY_IDX slot = 0;
479 object_type *o_ptr = nullptr;
481 if (player_ptr->wild_mode)
485 if (has_melee_weapon(player_ptr, INVEN_MAIN_HAND)) {
486 slot = INVEN_MAIN_HAND;
487 o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND];
489 if (has_melee_weapon(player_ptr, INVEN_SUB_HAND) && one_in_(2)) {
490 o_ptr = &player_ptr->inventory_list[INVEN_SUB_HAND];
491 slot = INVEN_SUB_HAND;
493 } else if (has_melee_weapon(player_ptr, INVEN_SUB_HAND)) {
494 o_ptr = &player_ptr->inventory_list[INVEN_SUB_HAND];
495 slot = INVEN_SUB_HAND;
498 if ((slot == 0) || o_ptr->is_cursed())
501 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
502 drop_from_inventory(player_ptr, slot, 1);