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-hook/hook-checker.h"
20 #include "object-hook/hook-enchant.h"
21 #include "object/lite-processor.h"
22 #include "player-info/equipment-info.h"
23 #include "player/digestion-processor.h"
24 #include "player/player-damage.h"
25 #include "player/player-status-flags.h"
26 #include "spell-kind/spells-floor.h"
27 #include "spell-kind/spells-launcher.h"
28 #include "spell-kind/spells-lite.h"
29 #include "spell-kind/spells-sight.h"
30 #include "spell-kind/spells-teleport.h"
31 #include "spell-kind/spells-world.h"
32 #include "spell-realm/spells-hex.h"
33 #include "spell-realm/spells-song.h"
34 #include "spell/spell-types.h"
35 #include "spell/summon-types.h"
36 #include "status/bad-status-setter.h"
37 #include "status/base-status.h"
38 #include "status/body-improvement.h"
39 #include "status/buff-setter.h"
40 #include "status/shape-changer.h"
41 #include "status/sight-setter.h"
42 #include "store/store-owners.h"
43 #include "store/store-util.h"
44 #include "store/store.h"
45 #include "system/floor-type-definition.h"
46 #include "system/monster-race-definition.h"
47 #include "system/monster-type-definition.h"
48 #include "system/object-type-definition.h"
49 #include "system/player-type-definition.h"
50 #include "target/target-checker.h"
51 #include "target/target-setter.h"
52 #include "target/target-types.h"
53 #include "term/screen-processor.h"
54 #include "view/display-messages.h"
56 static bool get_hack_dir(player_type *creature_ptr, DIRECTION *dp)
62 concptr p = target_okay(creature_ptr)
63 ? _("方向 ('5'でターゲットへ, '*'でターゲット再選択, ESCで中断)? ", "Direction ('5' for target, '*' to re-target, Escape to cancel)? ")
64 : _("方向 ('*'でターゲット選択, ESCで中断)? ", "Direction ('*' to choose a target, Escape to cancel)? ");
65 if (!get_com(p, &command, TRUE))
68 if (use_menu && (command == '\r'))
82 if (target_set(creature_ptr, TARGET_KILL))
87 dir = get_keymap_dir(command);
91 if ((dir == 5) && !target_okay(creature_ptr))
102 if (creature_ptr->confused)
103 dir = ddd[randint0(8)];
105 if (command_dir != dir)
106 msg_print(_("あなたは混乱している。", "You are confused."));
113 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
114 * / Handle mutation effects once every 10 game turns
116 void process_world_aux_mutation(player_type *creature_ptr)
118 if (creature_ptr->muta.none() || creature_ptr->phase_out || creature_ptr->wild_mode)
121 if (creature_ptr->muta.has(MUTA::BERS_RAGE) && one_in_(3000)) {
122 disturb(creature_ptr, FALSE, TRUE);
123 msg_print(_("ウガァァア!", "RAAAAGHH!"));
124 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
125 (void)set_shero(creature_ptr, 10 + randint1(creature_ptr->lev), FALSE);
126 (void)set_afraid(creature_ptr, 0);
129 if (creature_ptr->muta.has(MUTA::COWARDICE) && (randint1(3000) == 13)) {
130 if (!has_resist_fear(creature_ptr)) {
131 disturb(creature_ptr, FALSE, TRUE);
132 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
133 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
137 if (creature_ptr->muta.has(MUTA::RTELEPORT) && (randint1(5000) == 88)) {
138 if (!has_resist_nexus(creature_ptr) && creature_ptr->muta.has_not(MUTA::VTELEPORT) && !creature_ptr->anti_tele) {
139 disturb(creature_ptr, FALSE, TRUE);
140 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
142 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
146 if (creature_ptr->muta.has(MUTA::ALCOHOL) && (randint1(6400) == 321)) {
147 if (!has_resist_conf(creature_ptr) && !has_resist_chaos(creature_ptr)) {
148 disturb(creature_ptr, FALSE, TRUE);
149 creature_ptr->redraw |= PR_EXTRA;
150 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
153 if (!has_resist_conf(creature_ptr)) {
154 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(20) + 15);
157 if (!has_resist_chaos(creature_ptr)) {
161 lose_all_info(creature_ptr);
163 wiz_dark(creature_ptr);
164 (void)teleport_player_aux(creature_ptr, 100, FALSE, static_cast<teleport_flags>(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE));
165 wiz_dark(creature_ptr);
166 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
167 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing or how you got here!"));
170 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
171 (void)set_image(creature_ptr, creature_ptr->image + randint0(150) + 150);
177 if (creature_ptr->muta.has(MUTA::HALLU) && (randint1(6400) == 42)) {
178 if (!has_resist_chaos(creature_ptr)) {
179 disturb(creature_ptr, FALSE, TRUE);
180 creature_ptr->redraw |= PR_EXTRA;
181 (void)set_image(creature_ptr, creature_ptr->image + randint0(50) + 20);
185 if (creature_ptr->muta.has(MUTA::FLATULENT) && (randint1(3000) == 13)) {
186 disturb(creature_ptr, FALSE, TRUE);
187 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
189 fire_ball(creature_ptr, GF_POIS, 0, creature_ptr->lev, 3);
192 if (creature_ptr->muta.has(MUTA::PROD_MANA) && !creature_ptr->anti_magic && one_in_(9000)) {
194 disturb(creature_ptr, FALSE, TRUE);
195 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
196 "Magical energy flows through you! You must release it!"));
200 (void)get_hack_dir(creature_ptr, &dire);
201 fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
204 if (creature_ptr->muta.has(MUTA::ATT_DEMON) && !creature_ptr->anti_magic && (randint1(6666) == 666)) {
205 bool pet = one_in_(6);
206 BIT_FLAGS mode = PM_ALLOW_GROUP;
209 mode |= PM_FORCE_PET;
211 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
213 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode)) {
214 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
215 disturb(creature_ptr, FALSE, TRUE);
219 if (creature_ptr->muta.has(MUTA::SPEED_FLUX) && one_in_(6000)) {
220 disturb(creature_ptr, FALSE, TRUE);
222 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
224 if (creature_ptr->fast > 0) {
225 set_fast(creature_ptr, 0, TRUE);
227 set_slow(creature_ptr, randint1(30) + 10, FALSE);
230 msg_print(_("精力的になった気がする。", "You feel more energetic."));
232 if (creature_ptr->slow > 0) {
233 set_slow(creature_ptr, 0, TRUE);
235 set_fast(creature_ptr, randint1(30) + 10, FALSE);
242 if (creature_ptr->muta.has(MUTA::BANISH_ALL) && one_in_(9000)) {
243 disturb(creature_ptr, FALSE, TRUE);
244 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
246 banish_monsters(creature_ptr, 100);
247 if (!is_in_dungeon(creature_ptr) && creature_ptr->town_num) {
250 n = randint0(MAX_STORES);
251 } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
253 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
254 store_shuffle(creature_ptr, n);
259 if (creature_ptr->muta.has(MUTA::EAT_LIGHT) && one_in_(3000)) {
262 msg_print(_("影につつまれた。", "A shadow passes over you."));
265 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) {
266 hp_player(creature_ptr, 10);
269 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
271 if (o_ptr->tval == TV_LITE) {
272 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0)) {
273 hp_player(creature_ptr, o_ptr->xtra4 / 20);
275 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
276 notice_lite_change(creature_ptr, o_ptr);
281 * Unlite the area (radius 10) around player and
282 * do 50 points damage to every affected monster
284 unlite_area(creature_ptr, 50, 10);
287 if (creature_ptr->muta.has(MUTA::ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000)) {
288 bool pet = one_in_(3);
289 BIT_FLAGS mode = PM_ALLOW_GROUP;
292 mode |= PM_FORCE_PET;
294 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
296 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode)) {
297 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
298 disturb(creature_ptr, FALSE, TRUE);
302 if (creature_ptr->muta.has(MUTA::RAW_CHAOS) && !creature_ptr->anti_magic && one_in_(8000)) {
303 disturb(creature_ptr, FALSE, TRUE);
304 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
306 fire_ball(creature_ptr, GF_CHAOS, 0, creature_ptr->lev, 8);
309 if (creature_ptr->muta.has(MUTA::NORMALITY) && one_in_(5000)) {
310 if (!lose_mutation(creature_ptr, 0))
311 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
314 if (creature_ptr->muta.has(MUTA::WRAITH) && !creature_ptr->anti_magic && one_in_(3000)) {
315 disturb(creature_ptr, FALSE, TRUE);
316 msg_print(_("非物質化した!", "You feel insubstantial!"));
318 set_wraith_form(creature_ptr, randint1(creature_ptr->lev / 2) + (creature_ptr->lev / 2), FALSE);
321 if (creature_ptr->muta.has(MUTA::POLY_WOUND) && one_in_(3000))
322 do_poly_wounds(creature_ptr);
324 if (creature_ptr->muta.has(MUTA::WASTING) && one_in_(3000)) {
325 int which_stat = randint0(A_MAX);
326 int sustained = false;
328 switch (which_stat) {
330 if (has_sustain_str(creature_ptr))
334 if (has_sustain_int(creature_ptr))
338 if (has_sustain_wis(creature_ptr))
342 if (has_sustain_dex(creature_ptr))
346 if (has_sustain_con(creature_ptr))
350 if (has_sustain_chr(creature_ptr))
354 msg_print(_("不正な状態!", "Invalid stat chosen!"));
359 disturb(creature_ptr, FALSE, TRUE);
360 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
362 (void)dec_stat(creature_ptr, which_stat, randint1(6) + 6, one_in_(3));
366 if (creature_ptr->muta.has(MUTA::ATT_DRAGON) && !creature_ptr->anti_magic && one_in_(3000)) {
367 bool pet = one_in_(5);
368 BIT_FLAGS mode = PM_ALLOW_GROUP;
370 mode |= PM_FORCE_PET;
372 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
374 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode)) {
375 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
376 disturb(creature_ptr, FALSE, TRUE);
380 if (creature_ptr->muta.has(MUTA::WEIRD_MIND) && !creature_ptr->anti_magic && one_in_(3000)) {
381 if (creature_ptr->tim_esp > 0) {
382 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
383 set_tim_esp(creature_ptr, 0, TRUE);
385 msg_print(_("精神が広がった!", "Your mind expands!"));
386 set_tim_esp(creature_ptr, creature_ptr->lev, FALSE);
390 if (creature_ptr->muta.has(MUTA::NAUSEA) && !creature_ptr->slow_digest && one_in_(9000)) {
391 disturb(creature_ptr, FALSE, TRUE);
392 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
394 set_food(creature_ptr, PY_FOOD_WEAK);
395 if (music_singing_any(creature_ptr))
396 stop_singing(creature_ptr);
398 if (hex_spelling_any(creature_ptr))
399 stop_hex_spell_all(creature_ptr);
402 if (creature_ptr->muta.has(MUTA::WALK_SHAD) && !creature_ptr->anti_magic && one_in_(12000) && !creature_ptr->current_floor_ptr->inside_arena)
403 reserve_alter_reality(creature_ptr, randint0(21) + 15);
405 if (creature_ptr->muta.has(MUTA::WARNING) && one_in_(1000)) {
406 int danger_amount = 0;
407 for (MONSTER_IDX monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++) {
408 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[monster];
409 monster_race *r_ptr = &r_info[m_ptr->r_idx];
410 if (!monster_is_valid(m_ptr))
413 if (r_ptr->level >= creature_ptr->lev) {
414 danger_amount += r_ptr->level - creature_ptr->lev + 1;
418 if (danger_amount > 100)
419 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
420 else if (danger_amount > 50)
421 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
422 else if (danger_amount > 20)
423 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
424 else if (danger_amount > 10)
425 msg_print(_("心配な気がする!", "You feel paranoid!"));
426 else if (danger_amount > 5)
427 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
429 msg_print(_("寂しい気がする。", "You feel lonely."));
432 if (creature_ptr->muta.has(MUTA::INVULN) && !creature_ptr->anti_magic && one_in_(5000)) {
433 disturb(creature_ptr, FALSE, TRUE);
434 msg_print(_("無敵な気がする!", "You feel invincible!"));
436 (void)set_invuln(creature_ptr, randint1(8) + 8, FALSE);
439 if (creature_ptr->muta.has(MUTA::SP_TO_HP) && one_in_(2000)) {
440 MANA_POINT wounds = (MANA_POINT)(creature_ptr->mhp - creature_ptr->chp);
442 HIT_POINT healing = creature_ptr->csp;
443 if (healing > wounds)
446 hp_player(creature_ptr, healing);
447 creature_ptr->csp -= healing;
448 creature_ptr->redraw |= (PR_HP | PR_MANA);
452 if (creature_ptr->muta.has(MUTA::HP_TO_SP) && !creature_ptr->anti_magic && one_in_(4000)) {
453 HIT_POINT wounds = (HIT_POINT)(creature_ptr->msp - creature_ptr->csp);
455 HIT_POINT healing = creature_ptr->chp;
456 if (healing > wounds)
459 creature_ptr->csp += healing;
460 creature_ptr->redraw |= (PR_HP | PR_MANA);
461 take_hit(creature_ptr, DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"));
465 if (creature_ptr->muta.has(MUTA::DISARM) && one_in_(10000)) {
466 disturb(creature_ptr, FALSE, TRUE);
467 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
468 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"));
469 drop_weapons(creature_ptr);
473 bool drop_weapons(player_type *creature_ptr)
475 INVENTORY_IDX slot = 0;
476 object_type *o_ptr = NULL;
478 if (creature_ptr->wild_mode)
482 if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)) {
483 slot = INVEN_MAIN_HAND;
484 o_ptr = &creature_ptr->inventory_list[INVEN_MAIN_HAND];
486 if (has_melee_weapon(creature_ptr, INVEN_SUB_HAND) && one_in_(2)) {
487 o_ptr = &creature_ptr->inventory_list[INVEN_SUB_HAND];
488 slot = INVEN_SUB_HAND;
490 } else if (has_melee_weapon(creature_ptr, INVEN_SUB_HAND)) {
491 o_ptr = &creature_ptr->inventory_list[INVEN_SUB_HAND];
492 slot = INVEN_SUB_HAND;
495 if ((slot == 0) || object_is_cursed(o_ptr))
498 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
499 drop_from_inventory(creature_ptr, slot, 1);