1 #include "mutation/mutation-processor.h"
2 #include "core/disturbance.h"
3 #include "core/hp-mp-processor.h"
4 #include "core/player-redraw-types.h"
6 #include "inventory/inventory-object.h"
7 #include "inventory/inventory-slot-types.h"
8 #include "io/targeting.h"
9 #include "monster-floor/monster-summon.h"
10 #include "monster-floor/place-monster-types.h"
11 #include "monster-race/monster-race.h"
12 #include "monster/monster-status.h"
13 #include "mutation/mutation-flag-types.h"
14 #include "mutation/mutation.h"
15 #include "object-hook/hook-checker.h"
16 #include "object-hook/hook-enchant.h"
17 #include "object/lite-processor.h"
18 #include "player/digestion-processor.h"
19 #include "player/player-damage.h"
20 #include "spell-kind/spells-floor.h"
21 #include "spell-kind/spells-launcher.h"
22 #include "spell-kind/spells-lite.h"
23 #include "spell-kind/spells-sight.h"
24 #include "spell-kind/spells-teleport.h"
25 #include "spell-kind/spells-world.h"
26 #include "spell-realm/spells-hex.h"
27 #include "spell/spell-types.h"
28 #include "spell/spells-summon.h"
29 #include "status/bad-status-setter.h"
30 #include "status/base-status.h"
31 #include "status/body-improvement.h"
32 #include "status/buff-setter.h"
33 #include "status/shape-changer.h"
34 #include "status/sight-setter.h"
35 #include "store/store-owners.h"
36 #include "store/store-util.h"
37 #include "store/store.h"
38 #include "system/floor-type-definition.h"
39 #include "term/screen-processor.h"
40 #include "view/display-messages.h"
43 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
44 * / Handle mutation effects once every 10 game turns
47 void process_world_aux_mutation(player_type *creature_ptr)
49 if (!creature_ptr->muta2 || creature_ptr->phase_out || creature_ptr->wild_mode)
52 if ((creature_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000)) {
53 disturb(creature_ptr, FALSE, TRUE);
54 msg_print(_("ウガァァア!", "RAAAAGHH!"));
55 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
56 (void)set_shero(creature_ptr, 10 + randint1(creature_ptr->lev), FALSE);
57 (void)set_afraid(creature_ptr, 0);
60 if ((creature_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13)) {
61 if (!creature_ptr->resist_fear) {
62 disturb(creature_ptr, FALSE, TRUE);
63 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
64 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
68 if ((creature_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88)) {
69 if (!creature_ptr->resist_nexus && !(creature_ptr->muta1 & MUT1_VTELEPORT) && !creature_ptr->anti_tele) {
70 disturb(creature_ptr, FALSE, TRUE);
71 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
73 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
77 if ((creature_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321)) {
78 if (!creature_ptr->resist_conf && !creature_ptr->resist_chaos) {
79 disturb(creature_ptr, FALSE, TRUE);
80 creature_ptr->redraw |= PR_EXTRA;
81 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
84 if (!creature_ptr->resist_conf) {
85 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(20) + 15);
88 if (!creature_ptr->resist_chaos) {
92 lose_all_info(creature_ptr);
94 wiz_dark(creature_ptr);
95 (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
96 wiz_dark(creature_ptr);
97 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
98 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing or how you got here!"));
101 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
102 (void)set_image(creature_ptr, creature_ptr->image + randint0(150) + 150);
108 if ((creature_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42)) {
109 if (!creature_ptr->resist_chaos) {
110 disturb(creature_ptr, FALSE, TRUE);
111 creature_ptr->redraw |= PR_EXTRA;
112 (void)set_image(creature_ptr, creature_ptr->image + randint0(50) + 20);
116 if ((creature_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13)) {
117 disturb(creature_ptr, FALSE, TRUE);
118 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
120 fire_ball(creature_ptr, GF_POIS, 0, creature_ptr->lev, 3);
123 if ((creature_ptr->muta2 & MUT2_PROD_MANA) && !creature_ptr->anti_magic && one_in_(9000)) {
125 disturb(creature_ptr, FALSE, TRUE);
126 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
127 "Magical energy flows through you! You must release it!"));
131 (void)get_hack_dir(creature_ptr, &dire);
132 fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
135 if ((creature_ptr->muta2 & MUT2_ATT_DEMON) && !creature_ptr->anti_magic && (randint1(6666) == 666)) {
136 bool pet = one_in_(6);
137 BIT_FLAGS mode = PM_ALLOW_GROUP;
140 mode |= PM_FORCE_PET;
142 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
144 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode)) {
145 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
146 disturb(creature_ptr, FALSE, TRUE);
150 if ((creature_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000)) {
151 disturb(creature_ptr, FALSE, TRUE);
153 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
155 if (creature_ptr->fast > 0) {
156 set_fast(creature_ptr, 0, TRUE);
158 set_slow(creature_ptr, randint1(30) + 10, FALSE);
161 msg_print(_("精力的になった気がする。", "You feel more energetic."));
163 if (creature_ptr->slow > 0) {
164 set_slow(creature_ptr, 0, TRUE);
166 set_fast(creature_ptr, randint1(30) + 10, FALSE);
171 if ((creature_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000)) {
172 disturb(creature_ptr, FALSE, TRUE);
173 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
175 banish_monsters(creature_ptr, 100);
176 if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num) {
179 n = randint0(MAX_STORES);
180 } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
182 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
183 store_shuffle(creature_ptr, n);
188 if ((creature_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000)) {
191 msg_print(_("影につつまれた。", "A shadow passes over you."));
194 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) {
195 hp_player(creature_ptr, 10);
198 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
200 if (o_ptr->tval == TV_LITE) {
201 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0)) {
202 hp_player(creature_ptr, o_ptr->xtra4 / 20);
204 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
205 notice_lite_change(creature_ptr, o_ptr);
210 * Unlite the area (radius 10) around player and
211 * do 50 points damage to every affected monster
213 unlite_area(creature_ptr, 50, 10);
216 if ((creature_ptr->muta2 & MUT2_ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000)) {
217 bool pet = one_in_(3);
218 BIT_FLAGS mode = PM_ALLOW_GROUP;
221 mode |= PM_FORCE_PET;
223 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
225 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode)) {
226 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
227 disturb(creature_ptr, FALSE, TRUE);
231 if ((creature_ptr->muta2 & MUT2_RAW_CHAOS) && !creature_ptr->anti_magic && one_in_(8000)) {
232 disturb(creature_ptr, FALSE, TRUE);
233 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
236 fire_ball(creature_ptr, GF_CHAOS, 0, creature_ptr->lev, 8);
239 if ((creature_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000)) {
240 if (!lose_mutation(creature_ptr, 0))
241 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
244 if ((creature_ptr->muta2 & MUT2_WRAITH) && !creature_ptr->anti_magic && one_in_(3000)) {
245 disturb(creature_ptr, FALSE, TRUE);
246 msg_print(_("非物質化した!", "You feel insubstantial!"));
249 set_wraith_form(creature_ptr, randint1(creature_ptr->lev / 2) + (creature_ptr->lev / 2), FALSE);
252 if ((creature_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000)) {
253 do_poly_wounds(creature_ptr);
256 if ((creature_ptr->muta2 & MUT2_WASTING) && one_in_(3000)) {
257 int which_stat = randint0(A_MAX);
258 int sustained = FALSE;
260 switch (which_stat) {
262 if (creature_ptr->sustain_str)
266 if (creature_ptr->sustain_int)
270 if (creature_ptr->sustain_wis)
274 if (creature_ptr->sustain_dex)
278 if (creature_ptr->sustain_con)
282 if (creature_ptr->sustain_chr)
286 msg_print(_("不正な状態!", "Invalid stat chosen!"));
291 disturb(creature_ptr, FALSE, TRUE);
292 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
294 (void)dec_stat(creature_ptr, which_stat, randint1(6) + 6, one_in_(3));
298 if ((creature_ptr->muta2 & MUT2_ATT_DRAGON) && !creature_ptr->anti_magic && one_in_(3000)) {
299 bool pet = one_in_(5);
300 BIT_FLAGS mode = PM_ALLOW_GROUP;
303 mode |= PM_FORCE_PET;
305 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
307 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode)) {
308 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
309 disturb(creature_ptr, FALSE, TRUE);
313 if ((creature_ptr->muta2 & MUT2_WEIRD_MIND) && !creature_ptr->anti_magic && one_in_(3000)) {
314 if (creature_ptr->tim_esp > 0) {
315 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
316 set_tim_esp(creature_ptr, 0, TRUE);
318 msg_print(_("精神が広がった!", "Your mind expands!"));
319 set_tim_esp(creature_ptr, creature_ptr->lev, FALSE);
323 if ((creature_ptr->muta2 & MUT2_NAUSEA) && !creature_ptr->slow_digest && one_in_(9000)) {
324 disturb(creature_ptr, FALSE, TRUE);
325 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
327 set_food(creature_ptr, PY_FOOD_WEAK);
328 if (music_singing_any(creature_ptr))
329 stop_singing(creature_ptr);
330 if (hex_spelling_any(creature_ptr))
331 stop_hex_spell_all(creature_ptr);
334 if ((creature_ptr->muta2 & MUT2_WALK_SHAD) && !creature_ptr->anti_magic && one_in_(12000) && !creature_ptr->current_floor_ptr->inside_arena) {
335 reserve_alter_reality(creature_ptr);
338 if ((creature_ptr->muta2 & MUT2_WARNING) && one_in_(1000)) {
339 int danger_amount = 0;
340 for (MONSTER_IDX monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++) {
341 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[monster];
342 monster_race *r_ptr = &r_info[m_ptr->r_idx];
343 if (!monster_is_valid(m_ptr))
346 if (r_ptr->level >= creature_ptr->lev) {
347 danger_amount += r_ptr->level - creature_ptr->lev + 1;
351 if (danger_amount > 100)
352 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
353 else if (danger_amount > 50)
354 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
355 else if (danger_amount > 20)
356 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
357 else if (danger_amount > 10)
358 msg_print(_("心配な気がする!", "You feel paranoid!"));
359 else if (danger_amount > 5)
360 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
362 msg_print(_("寂しい気がする。", "You feel lonely."));
365 if ((creature_ptr->muta2 & MUT2_INVULN) && !creature_ptr->anti_magic && one_in_(5000)) {
366 disturb(creature_ptr, FALSE, TRUE);
367 msg_print(_("無敵な気がする!", "You feel invincible!"));
369 (void)set_invuln(creature_ptr, randint1(8) + 8, FALSE);
372 if ((creature_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000)) {
373 MANA_POINT wounds = (MANA_POINT)(creature_ptr->mhp - creature_ptr->chp);
376 HIT_POINT healing = creature_ptr->csp;
377 if (healing > wounds)
380 hp_player(creature_ptr, healing);
381 creature_ptr->csp -= healing;
382 creature_ptr->redraw |= (PR_HP | PR_MANA);
386 if ((creature_ptr->muta2 & MUT2_HP_TO_SP) && !creature_ptr->anti_magic && one_in_(4000)) {
387 HIT_POINT wounds = (HIT_POINT)(creature_ptr->msp - creature_ptr->csp);
390 HIT_POINT healing = creature_ptr->chp;
391 if (healing > wounds)
394 creature_ptr->csp += healing;
395 creature_ptr->redraw |= (PR_HP | PR_MANA);
396 take_hit(creature_ptr, DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
400 if ((creature_ptr->muta2 & MUT2_DISARM) && one_in_(10000)) {
401 disturb(creature_ptr, FALSE, TRUE);
402 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
403 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"), -1);
404 drop_weapons(creature_ptr);
408 bool drop_weapons(player_type *creature_ptr)
410 INVENTORY_IDX slot = 0;
411 object_type *o_ptr = NULL;
413 if (creature_ptr->wild_mode)
417 if (has_melee_weapon(creature_ptr, INVEN_RARM)) {
419 o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
421 if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2)) {
422 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
425 } else if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
426 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
430 if (slot && !object_is_cursed(o_ptr)) {
431 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
432 drop_from_inventory(creature_ptr, slot, 1);