2 * todo 少し長い。switch/case文と効果処理を分離してもいいかも
8 #include "object-use/quaff-execution.h"
9 #include "birth/birth-stat.h"
10 #include "core/player-update-types.h"
11 #include "core/window-redrawer.h"
12 #include "game-option/birth-options.h"
13 #include "game-option/disturbance-options.h"
14 #include "inventory/inventory-object.h"
15 #include "main/sound-definitions-table.h"
16 #include "main/sound-of-music.h"
17 #include "mutation/mutation-investor-remover.h"
18 #include "object/object-broken.h"
19 #include "object/object-generator.h"
20 #include "object/object-info.h"
21 #include "object/object-kind.h"
22 #include "perception/object-perception.h"
23 #include "player-info/self-info.h"
24 #include "player/attack-defense-types.h"
25 #include "player-info/avatar.h"
26 #include "player/player-status-flags.h"
27 #include "player/digestion-processor.h"
28 #include "player/eldritch-horror.h"
29 #include "player/mimic-info-table.h"
30 #include "player/player-damage.h"
31 #include "realm/realm-hex-numbers.h"
32 #include "spell-kind/spells-detection.h"
33 #include "spell-kind/spells-floor.h"
34 #include "spell-kind/spells-perception.h"
35 #include "spell-kind/spells-teleport.h"
36 #include "spell-realm/spells-hex.h"
37 #include "spell/spells-status.h"
38 #include "status/bad-status-setter.h"
39 #include "status/base-status.h"
40 #include "status/body-improvement.h"
41 #include "status/buff-setter.h"
42 #include "status/element-resistance.h"
43 #include "status/experience.h"
44 #include "status/shape-changer.h"
45 #include "status/sight-setter.h"
46 #include "sv-definition/sv-potion-types.h"
47 #include "system/object-type-definition.h"
48 #include "term/screen-processor.h"
49 #include "view/display-messages.h"
53 * @param creature_ptr プレーヤーへの参照ポインタ
54 * @return カオス耐性があるかその他の一部確率でFALSE、それ以外はTRUE
56 static bool booze(player_type *creature_ptr)
59 if (creature_ptr->pclass != CLASS_MONK)
60 chg_virtue(creature_ptr, V_HARMONY, -1);
61 else if (!has_resist_conf(creature_ptr))
62 creature_ptr->special_attack |= ATTACK_SUIKEN;
64 if (!has_resist_conf(creature_ptr) && set_confused(creature_ptr, randint0(20) + 15)) {
68 if (has_resist_chaos(creature_ptr)) {
72 if (one_in_(2) && set_image(creature_ptr, creature_ptr->image + randint0(150) + 150)) {
76 if (one_in_(13) && (creature_ptr->pclass != CLASS_MONK)) {
79 lose_all_info(creature_ptr);
81 wiz_dark(creature_ptr);
83 (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
84 wiz_dark(creature_ptr);
85 msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
86 msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing or how you got here!"));
93 * @brief 爆発の薬の効果処理 / Fumble ramble
94 * @param creature_ptr プレーヤーへの参照ポインタ
97 static bool detonation(player_type *creature_ptr)
99 msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
100 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
101 (void)set_stun(creature_ptr, creature_ptr->stun + 75);
102 (void)set_cut(creature_ptr, creature_ptr->cut + 5000);
107 * @brief 薬を飲むコマンドのサブルーチン /
108 * Quaff a potion (from the pack or the floor)
109 * @param creature_ptr プレーヤーへの参照ポインタ
110 * @param item 飲む薬オブジェクトの所持品ID
113 void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
119 take_turn(creature_ptr, 100);
121 if (creature_ptr->timewalk) {
125 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from the bottle."));
130 if (music_singing_any(creature_ptr))
131 stop_singing(creature_ptr);
133 if (hex_spelling_any(creature_ptr) && !hex_spelling(creature_ptr, HEX_INHAIL))
134 stop_hex_spell_all(creature_ptr);
136 o_ptr = ref_item(creature_ptr, item);
138 object_copy(q_ptr, o_ptr);
140 vary_item(creature_ptr, item, -1);
143 DEPTH lev = k_info[q_ptr->k_idx].level;
144 if (q_ptr->tval == TV_POTION) {
145 switch (q_ptr->sval) {
146 /* 飲みごたえをオリジナルより細かく表現 */
147 case SV_POTION_WATER:
148 msg_print(_("口の中がさっぱりした。", "That was refreshing."));
149 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
153 case SV_POTION_APPLE_JUICE:
154 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", "It's sweet, refreshing and very tasty."));
155 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
159 case SV_POTION_SLIME_MOLD:
160 msg_print(_("なんとも不気味な味だ。", "That was strange."));
161 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
165 case SV_POTION_SLOWNESS:
166 if (set_slow(creature_ptr, randint1(25) + 15, FALSE))
170 case SV_POTION_SALT_WATER:
171 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
173 if (!(is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ZOMBIE)
174 || is_specific_player_race(creature_ptr, RACE_BALROG) || is_specific_player_race(creature_ptr, RACE_ANDROID)
175 || is_specific_player_race(creature_ptr, RACE_SPECTRE) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))) {
176 /* Only living creatures get thirsty */
177 (void)set_food(creature_ptr, PY_FOOD_STARVE - 1);
180 (void)set_poisoned(creature_ptr, 0);
181 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 4);
185 case SV_POTION_POISON:
186 if (!(has_resist_pois(creature_ptr) || is_oppose_pois(creature_ptr))) {
187 if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(15) + 10)) {
193 case SV_POTION_BLINDNESS:
194 if (!has_resist_blind(creature_ptr)) {
195 if (set_blind(creature_ptr, creature_ptr->blind + randint0(100) + 100)) {
201 case SV_POTION_BOOZE:
202 ident = booze(creature_ptr);
205 case SV_POTION_SLEEP:
206 if (!creature_ptr->free_act) {
207 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
209 if (ironman_nightmare) {
210 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
212 /* Have some nightmares */
213 sanity_blast(creature_ptr, NULL, FALSE);
215 if (set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4)) {
221 case SV_POTION_LOSE_MEMORIES:
222 if (!creature_ptr->hold_exp && (creature_ptr->exp > 0)) {
223 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
224 chg_virtue(creature_ptr, V_KNOWLEDGE, -5);
226 lose_exp(creature_ptr, creature_ptr->exp / 4);
231 case SV_POTION_RUINATION:
232 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
233 take_hit(creature_ptr, DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
235 (void)dec_stat(creature_ptr, A_DEX, 25, TRUE);
236 (void)dec_stat(creature_ptr, A_WIS, 25, TRUE);
237 (void)dec_stat(creature_ptr, A_CON, 25, TRUE);
238 (void)dec_stat(creature_ptr, A_STR, 25, TRUE);
239 (void)dec_stat(creature_ptr, A_CHR, 25, TRUE);
240 (void)dec_stat(creature_ptr, A_INT, 25, TRUE);
244 case SV_POTION_DEC_STR:
245 if (do_dec_stat(creature_ptr, A_STR))
249 case SV_POTION_DEC_INT:
250 if (do_dec_stat(creature_ptr, A_INT))
254 case SV_POTION_DEC_WIS:
255 if (do_dec_stat(creature_ptr, A_WIS))
259 case SV_POTION_DEC_DEX:
260 if (do_dec_stat(creature_ptr, A_DEX))
264 case SV_POTION_DEC_CON:
265 if (do_dec_stat(creature_ptr, A_CON))
269 case SV_POTION_DEC_CHR:
270 if (do_dec_stat(creature_ptr, A_CHR))
274 case SV_POTION_DETONATIONS:
275 ident = detonation(creature_ptr);
278 case SV_POTION_DEATH:
279 chg_virtue(creature_ptr, V_VITALITY, -1);
280 chg_virtue(creature_ptr, V_UNLIFE, 5);
281 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
282 take_hit(creature_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
286 case SV_POTION_INFRAVISION:
287 if (set_tim_infra(creature_ptr, creature_ptr->tim_infra + 100 + randint1(100), FALSE)) {
292 case SV_POTION_DETECT_INVIS:
293 if (set_tim_invis(creature_ptr, creature_ptr->tim_invis + 12 + randint1(12), FALSE)) {
298 case SV_POTION_SLOW_POISON:
299 if (set_poisoned(creature_ptr, creature_ptr->poisoned / 2))
303 case SV_POTION_CURE_POISON:
304 if (set_poisoned(creature_ptr, 0))
308 case SV_POTION_BOLDNESS:
309 if (set_afraid(creature_ptr, 0))
313 case SV_POTION_SPEED:
314 if (!creature_ptr->fast) {
315 if (set_fast(creature_ptr, randint1(25) + 15, FALSE))
318 (void)set_fast(creature_ptr, creature_ptr->fast + 5, FALSE);
322 case SV_POTION_RESIST_HEAT:
323 if (set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(10) + 10, FALSE)) {
328 case SV_POTION_RESIST_COLD:
329 if (set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(10) + 10, FALSE)) {
334 case SV_POTION_HEROISM:
335 ident = heroism(creature_ptr, 25);
338 case SV_POTION_BESERK_STRENGTH:
339 ident = berserk(creature_ptr, randint1(25) + 25);
342 case SV_POTION_CURE_LIGHT:
343 ident = cure_light_wounds(creature_ptr, 2, 8);
346 case SV_POTION_CURE_SERIOUS:
347 ident = cure_serious_wounds(creature_ptr, 4, 8);
350 case SV_POTION_CURE_CRITICAL:
351 ident = cure_critical_wounds(creature_ptr, damroll(6, 8));
354 case SV_POTION_HEALING:
355 ident = cure_critical_wounds(creature_ptr, 300);
358 case SV_POTION_STAR_HEALING:
359 ident = cure_critical_wounds(creature_ptr, 1200);
363 ident = life_stream(creature_ptr, TRUE, TRUE);
366 case SV_POTION_RESTORE_MANA:
367 ident = restore_mana(creature_ptr, TRUE);
370 case SV_POTION_RESTORE_EXP:
371 if (restore_level(creature_ptr))
375 case SV_POTION_RES_STR:
376 if (do_res_stat(creature_ptr, A_STR))
380 case SV_POTION_RES_INT:
381 if (do_res_stat(creature_ptr, A_INT))
385 case SV_POTION_RES_WIS:
386 if (do_res_stat(creature_ptr, A_WIS))
390 case SV_POTION_RES_DEX:
391 if (do_res_stat(creature_ptr, A_DEX))
395 case SV_POTION_RES_CON:
396 if (do_res_stat(creature_ptr, A_CON))
400 case SV_POTION_RES_CHR:
401 if (do_res_stat(creature_ptr, A_CHR))
405 case SV_POTION_INC_STR:
406 if (do_inc_stat(creature_ptr, A_STR))
410 case SV_POTION_INC_INT:
411 if (do_inc_stat(creature_ptr, A_INT))
415 case SV_POTION_INC_WIS:
416 if (do_inc_stat(creature_ptr, A_WIS))
420 case SV_POTION_INC_DEX:
421 if (do_inc_stat(creature_ptr, A_DEX))
425 case SV_POTION_INC_CON:
426 if (do_inc_stat(creature_ptr, A_CON))
430 case SV_POTION_INC_CHR:
431 if (do_inc_stat(creature_ptr, A_CHR))
435 case SV_POTION_AUGMENTATION:
436 if (do_inc_stat(creature_ptr, A_STR))
438 if (do_inc_stat(creature_ptr, A_INT))
440 if (do_inc_stat(creature_ptr, A_WIS))
442 if (do_inc_stat(creature_ptr, A_DEX))
444 if (do_inc_stat(creature_ptr, A_CON))
446 if (do_inc_stat(creature_ptr, A_CHR))
450 case SV_POTION_ENLIGHTENMENT:
451 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
452 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
453 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
454 wiz_lite(creature_ptr, FALSE);
458 case SV_POTION_STAR_ENLIGHTENMENT:
459 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
460 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
461 chg_virtue(creature_ptr, V_ENLIGHTEN, 2);
463 wiz_lite(creature_ptr, FALSE);
464 (void)do_inc_stat(creature_ptr, A_INT);
465 (void)do_inc_stat(creature_ptr, A_WIS);
466 (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
467 (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
468 (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
469 (void)detect_treasure(creature_ptr, DETECT_RAD_DEFAULT);
470 (void)detect_objects_gold(creature_ptr, DETECT_RAD_DEFAULT);
471 (void)detect_objects_normal(creature_ptr, DETECT_RAD_DEFAULT);
472 identify_pack(creature_ptr);
473 self_knowledge(creature_ptr);
477 case SV_POTION_SELF_KNOWLEDGE:
478 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
480 self_knowledge(creature_ptr);
484 case SV_POTION_EXPERIENCE:
485 if (creature_ptr->prace == RACE_ANDROID)
487 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
488 if (creature_ptr->exp < PY_MAX_EXP) {
489 EXP ee = (creature_ptr->exp / 2) + 10;
492 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
493 gain_exp(creature_ptr, ee);
498 case SV_POTION_RESISTANCE:
499 (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid + randint1(20) + 20, FALSE);
500 (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec + randint1(20) + 20, FALSE);
501 (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(20) + 20, FALSE);
502 (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(20) + 20, FALSE);
503 (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois + randint1(20) + 20, FALSE);
507 case SV_POTION_CURING:
508 if (true_healing(creature_ptr, 50))
512 case SV_POTION_INVULNERABILITY:
513 (void)set_invuln(creature_ptr, creature_ptr->invuln + randint1(4) + 4, FALSE);
517 case SV_POTION_NEW_LIFE:
518 roll_hitdice(creature_ptr, 0L);
519 get_max_stats(creature_ptr);
520 creature_ptr->update |= PU_BONUS;
521 lose_all_mutations(creature_ptr);
525 case SV_POTION_NEO_TSUYOSHI:
526 (void)set_image(creature_ptr, 0);
527 (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi + randint1(100) + 100, FALSE);
531 case SV_POTION_TSUYOSHI:
532 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
534 creature_ptr->tsuyoshi = 1;
535 (void)set_tsuyoshi(creature_ptr, 0, TRUE);
536 if (!has_resist_chaos(creature_ptr)) {
537 (void)set_image(creature_ptr, 50 + randint1(50));
542 case SV_POTION_POLYMORPH:
543 if ((creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) && one_in_(23)) {
544 lose_all_mutations(creature_ptr);
548 if (gain_mutation(creature_ptr, 0))
550 } else if (lose_mutation(creature_ptr, 0))
552 } while (!ident || one_in_(2));
558 if (is_specific_player_race(creature_ptr, RACE_SKELETON)) {
559 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
560 (void)potion_smash_effect(creature_ptr, 0, creature_ptr->y, creature_ptr->x, q_ptr->k_idx);
562 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
564 if (!(object_is_aware(q_ptr))) {
565 chg_virtue(creature_ptr, V_PATIENCE, -1);
566 chg_virtue(creature_ptr, V_CHANCE, 1);
567 chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
570 /* The item has been tried */
573 /* An identification was made */
574 if (ident && !object_is_aware(q_ptr)) {
575 object_aware(creature_ptr, q_ptr);
576 gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
579 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
581 /* Potions can feed the player */
582 switch (creature_ptr->mimic_form) {
584 switch (creature_ptr->prace) {
586 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
595 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
598 if (q_ptr->tval == TV_FLASK) {
599 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
600 set_food(creature_ptr, creature_ptr->food + 5000);
602 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
606 msg_print(_("水分を取り込んだ。", "You are moistened."));
607 set_food(creature_ptr, MIN(creature_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
610 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);
615 case MIMIC_DEMON_LORD:
616 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
619 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
622 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);