5 * @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/avatar.h"
24 #include "player-info/self-info.h"
25 #include "player-status/player-energy.h"
26 #include "player/attack-defense-types.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 "player/player-status-flags.h"
32 #include "realm/realm-hex-numbers.h"
33 #include "spell-kind/spells-detection.h"
34 #include "spell-kind/spells-floor.h"
35 #include "spell-kind/spells-perception.h"
36 #include "spell-kind/spells-teleport.h"
37 #include "spell-realm/spells-hex.h"
38 #include "spell-realm/spells-song.h"
39 #include "spell/spells-status.h"
40 #include "status/bad-status-setter.h"
41 #include "status/base-status.h"
42 #include "status/body-improvement.h"
43 #include "status/buff-setter.h"
44 #include "status/element-resistance.h"
45 #include "status/experience.h"
46 #include "status/shape-changer.h"
47 #include "status/sight-setter.h"
48 #include "sv-definition/sv-potion-types.h"
49 #include "system/object-type-definition.h"
50 #include "system/player-type-definition.h"
51 #include "term/screen-processor.h"
52 #include "view/display-messages.h"
56 * @param creature_ptr プレーヤーへの参照ポインタ
57 * @return カオス耐性があるかその他の一部確率でFALSE、それ以外はTRUE
59 static bool booze(player_type *creature_ptr)
62 if (creature_ptr->pclass != CLASS_MONK)
63 chg_virtue(creature_ptr, V_HARMONY, -1);
64 else if (!has_resist_conf(creature_ptr))
65 creature_ptr->special_attack |= ATTACK_SUIKEN;
67 if (!has_resist_conf(creature_ptr) && set_confused(creature_ptr, randint0(20) + 15)) {
71 if (has_resist_chaos(creature_ptr)) {
75 if (one_in_(2) && set_image(creature_ptr, creature_ptr->image + randint0(150) + 150)) {
79 if (one_in_(13) && (creature_ptr->pclass != CLASS_MONK)) {
82 lose_all_info(creature_ptr);
84 wiz_dark(creature_ptr);
86 (void)teleport_player_aux(creature_ptr, 100, false, static_cast<teleport_flags>(TELEPORT_NONMAGICAL | TELEPORT_PASSIVE));
87 wiz_dark(creature_ptr);
88 msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
89 msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing or how you got here!"));
96 * @brief 爆発の薬の効果処理 / Fumble ramble
97 * @param creature_ptr プレーヤーへの参照ポインタ
100 static bool detonation(player_type *creature_ptr)
102 msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
103 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"));
104 (void)set_stun(creature_ptr, creature_ptr->stun + 75);
105 (void)set_cut(creature_ptr, creature_ptr->cut + 5000);
110 * @brief 薬を飲むコマンドのサブルーチン /
111 * Quaff a potion (from the pack or the floor)
112 * @param creature_ptr プレーヤーへの参照ポインタ
113 * @param item 飲む薬オブジェクトの所持品ID
116 void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
122 PlayerEnergy(creature_ptr).set_player_turn_energy(100);
124 if (creature_ptr->timewalk) {
128 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from the bottle."));
133 if (music_singing_any(creature_ptr))
134 stop_singing(creature_ptr);
136 if (hex_spelling_any(creature_ptr) && !hex_spelling(creature_ptr, HEX_INHAIL))
137 stop_hex_spell_all(creature_ptr);
139 o_ptr = ref_item(creature_ptr, item);
141 object_copy(q_ptr, o_ptr);
143 vary_item(creature_ptr, item, -1);
146 DEPTH lev = k_info[q_ptr->k_idx].level;
147 if (q_ptr->tval == TV_POTION) {
148 switch (q_ptr->sval) {
149 /* 飲みごたえをオリジナルより細かく表現 */
150 case SV_POTION_WATER:
151 msg_print(_("口の中がさっぱりした。", "That was refreshing."));
152 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
156 case SV_POTION_APPLE_JUICE:
157 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", "It's sweet, refreshing and very tasty."));
158 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
162 case SV_POTION_SLIME_MOLD:
163 msg_print(_("なんとも不気味な味だ。", "That was strange."));
164 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
168 case SV_POTION_SLOWNESS:
169 if (set_slow(creature_ptr, randint1(25) + 15, false))
173 case SV_POTION_SALT_WATER:
174 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
176 if (!(is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ZOMBIE)
177 || is_specific_player_race(creature_ptr, RACE_BALROG) || is_specific_player_race(creature_ptr, RACE_ANDROID)
178 || is_specific_player_race(creature_ptr, RACE_SPECTRE) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))) {
179 /* Only living creatures get thirsty */
180 (void)set_food(creature_ptr, PY_FOOD_STARVE - 1);
183 (void)set_poisoned(creature_ptr, 0);
184 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 4);
188 case SV_POTION_POISON:
189 if (!(has_resist_pois(creature_ptr) || is_oppose_pois(creature_ptr))) {
190 if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(15) + 10)) {
196 case SV_POTION_BLINDNESS:
197 if (!has_resist_blind(creature_ptr)) {
198 if (set_blind(creature_ptr, creature_ptr->blind + randint0(100) + 100)) {
204 case SV_POTION_BOOZE:
205 ident = booze(creature_ptr);
208 case SV_POTION_SLEEP:
209 if (!creature_ptr->free_act) {
210 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
212 if (ironman_nightmare) {
213 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
215 /* Have some nightmares */
216 sanity_blast(creature_ptr, NULL, false);
218 if (set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4)) {
224 case SV_POTION_LOSE_MEMORIES:
225 if (!creature_ptr->hold_exp && (creature_ptr->exp > 0)) {
226 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
227 chg_virtue(creature_ptr, V_KNOWLEDGE, -5);
229 lose_exp(creature_ptr, creature_ptr->exp / 4);
234 case SV_POTION_RUINATION:
235 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
236 take_hit(creature_ptr, DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"));
238 (void)dec_stat(creature_ptr, A_DEX, 25, TRUE);
239 (void)dec_stat(creature_ptr, A_WIS, 25, TRUE);
240 (void)dec_stat(creature_ptr, A_CON, 25, TRUE);
241 (void)dec_stat(creature_ptr, A_STR, 25, TRUE);
242 (void)dec_stat(creature_ptr, A_CHR, 25, TRUE);
243 (void)dec_stat(creature_ptr, A_INT, 25, TRUE);
247 case SV_POTION_DEC_STR:
248 if (do_dec_stat(creature_ptr, A_STR))
252 case SV_POTION_DEC_INT:
253 if (do_dec_stat(creature_ptr, A_INT))
257 case SV_POTION_DEC_WIS:
258 if (do_dec_stat(creature_ptr, A_WIS))
262 case SV_POTION_DEC_DEX:
263 if (do_dec_stat(creature_ptr, A_DEX))
267 case SV_POTION_DEC_CON:
268 if (do_dec_stat(creature_ptr, A_CON))
272 case SV_POTION_DEC_CHR:
273 if (do_dec_stat(creature_ptr, A_CHR))
277 case SV_POTION_DETONATIONS:
278 ident = detonation(creature_ptr);
281 case SV_POTION_DEATH:
282 chg_virtue(creature_ptr, V_VITALITY, -1);
283 chg_virtue(creature_ptr, V_UNLIFE, 5);
284 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
285 take_hit(creature_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"));
289 case SV_POTION_INFRAVISION:
290 if (set_tim_infra(creature_ptr, creature_ptr->tim_infra + 100 + randint1(100), false)) {
295 case SV_POTION_DETECT_INVIS:
296 if (set_tim_invis(creature_ptr, creature_ptr->tim_invis + 12 + randint1(12), false)) {
301 case SV_POTION_SLOW_POISON:
302 if (set_poisoned(creature_ptr, creature_ptr->poisoned / 2))
306 case SV_POTION_CURE_POISON:
307 if (set_poisoned(creature_ptr, 0))
311 case SV_POTION_BOLDNESS:
312 if (set_afraid(creature_ptr, 0))
316 case SV_POTION_SPEED:
317 if (!creature_ptr->fast) {
318 if (set_fast(creature_ptr, randint1(25) + 15, false))
321 (void)set_fast(creature_ptr, creature_ptr->fast + 5, false);
325 case SV_POTION_RESIST_HEAT:
326 if (set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(10) + 10, false)) {
331 case SV_POTION_RESIST_COLD:
332 if (set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(10) + 10, false)) {
337 case SV_POTION_HEROISM:
338 ident = heroism(creature_ptr, 25);
341 case SV_POTION_BESERK_STRENGTH:
342 ident = berserk(creature_ptr, randint1(25) + 25);
345 case SV_POTION_CURE_LIGHT:
346 ident = cure_light_wounds(creature_ptr, 2, 8);
349 case SV_POTION_CURE_SERIOUS:
350 ident = cure_serious_wounds(creature_ptr, 4, 8);
353 case SV_POTION_CURE_CRITICAL:
354 ident = cure_critical_wounds(creature_ptr, damroll(6, 8));
357 case SV_POTION_HEALING:
358 ident = cure_critical_wounds(creature_ptr, 300);
361 case SV_POTION_STAR_HEALING:
362 ident = cure_critical_wounds(creature_ptr, 1200);
366 ident = life_stream(creature_ptr, TRUE, TRUE);
369 case SV_POTION_RESTORE_MANA:
370 ident = restore_mana(creature_ptr, TRUE);
373 case SV_POTION_RESTORE_EXP:
374 if (restore_level(creature_ptr))
378 case SV_POTION_RES_STR:
379 if (do_res_stat(creature_ptr, A_STR))
383 case SV_POTION_RES_INT:
384 if (do_res_stat(creature_ptr, A_INT))
388 case SV_POTION_RES_WIS:
389 if (do_res_stat(creature_ptr, A_WIS))
393 case SV_POTION_RES_DEX:
394 if (do_res_stat(creature_ptr, A_DEX))
398 case SV_POTION_RES_CON:
399 if (do_res_stat(creature_ptr, A_CON))
403 case SV_POTION_RES_CHR:
404 if (do_res_stat(creature_ptr, A_CHR))
408 case SV_POTION_INC_STR:
409 if (do_inc_stat(creature_ptr, A_STR))
413 case SV_POTION_INC_INT:
414 if (do_inc_stat(creature_ptr, A_INT))
418 case SV_POTION_INC_WIS:
419 if (do_inc_stat(creature_ptr, A_WIS))
423 case SV_POTION_INC_DEX:
424 if (do_inc_stat(creature_ptr, A_DEX))
428 case SV_POTION_INC_CON:
429 if (do_inc_stat(creature_ptr, A_CON))
433 case SV_POTION_INC_CHR:
434 if (do_inc_stat(creature_ptr, A_CHR))
438 case SV_POTION_POLY_SELF:
439 do_poly_self(creature_ptr);
443 case SV_POTION_AUGMENTATION:
444 if (do_inc_stat(creature_ptr, A_STR))
446 if (do_inc_stat(creature_ptr, A_INT))
448 if (do_inc_stat(creature_ptr, A_WIS))
450 if (do_inc_stat(creature_ptr, A_DEX))
452 if (do_inc_stat(creature_ptr, A_CON))
454 if (do_inc_stat(creature_ptr, A_CHR))
458 case SV_POTION_ENLIGHTENMENT:
459 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
460 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
461 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
462 wiz_lite(creature_ptr, false);
466 case SV_POTION_STAR_ENLIGHTENMENT:
467 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
468 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
469 chg_virtue(creature_ptr, V_ENLIGHTEN, 2);
471 wiz_lite(creature_ptr, false);
472 (void)do_inc_stat(creature_ptr, A_INT);
473 (void)do_inc_stat(creature_ptr, A_WIS);
474 (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
475 (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
476 (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
477 (void)detect_treasure(creature_ptr, DETECT_RAD_DEFAULT);
478 (void)detect_objects_gold(creature_ptr, DETECT_RAD_DEFAULT);
479 (void)detect_objects_normal(creature_ptr, DETECT_RAD_DEFAULT);
480 identify_pack(creature_ptr);
481 self_knowledge(creature_ptr);
485 case SV_POTION_SELF_KNOWLEDGE:
486 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
488 self_knowledge(creature_ptr);
492 case SV_POTION_EXPERIENCE:
493 if (creature_ptr->prace == RACE_ANDROID)
495 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
496 if (creature_ptr->exp < PY_MAX_EXP) {
497 EXP ee = (creature_ptr->exp / 2) + 10;
500 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
501 gain_exp(creature_ptr, ee);
506 case SV_POTION_RESISTANCE:
507 (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid + randint1(20) + 20, false);
508 (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec + randint1(20) + 20, false);
509 (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(20) + 20, false);
510 (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(20) + 20, false);
511 (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois + randint1(20) + 20, false);
515 case SV_POTION_CURING:
516 if (true_healing(creature_ptr, 50))
520 case SV_POTION_INVULNERABILITY:
521 (void)set_invuln(creature_ptr, creature_ptr->invuln + randint1(4) + 4, false);
525 case SV_POTION_NEW_LIFE:
526 roll_hitdice(creature_ptr, SPOP_NONE);
527 get_max_stats(creature_ptr);
528 creature_ptr->update |= PU_BONUS;
529 lose_all_mutations(creature_ptr);
533 case SV_POTION_NEO_TSUYOSHI:
534 (void)set_image(creature_ptr, 0);
535 (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi + randint1(100) + 100, false);
539 case SV_POTION_TSUYOSHI:
540 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
542 creature_ptr->tsuyoshi = 1;
543 (void)set_tsuyoshi(creature_ptr, 0, TRUE);
544 if (!has_resist_chaos(creature_ptr)) {
545 (void)set_image(creature_ptr, 50 + randint1(50));
550 case SV_POTION_POLYMORPH:
551 if (creature_ptr->muta.any() && one_in_(23)) {
552 lose_all_mutations(creature_ptr);
556 if (gain_mutation(creature_ptr, 0))
558 } else if (lose_mutation(creature_ptr, 0))
560 } while (!ident || one_in_(2));
566 if (is_specific_player_race(creature_ptr, RACE_SKELETON)) {
567 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
568 (void)potion_smash_effect(creature_ptr, 0, creature_ptr->y, creature_ptr->x, q_ptr->k_idx);
570 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
572 if (!(object_is_aware(q_ptr))) {
573 chg_virtue(creature_ptr, V_PATIENCE, -1);
574 chg_virtue(creature_ptr, V_CHANCE, 1);
575 chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
578 /* The item has been tried */
581 /* An identification was made */
582 if (ident && !object_is_aware(q_ptr)) {
583 object_aware(creature_ptr, q_ptr);
584 gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
587 creature_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
589 /* Potions can feed the player */
590 switch (creature_ptr->mimic_form) {
592 switch (creature_ptr->prace) {
594 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
603 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
606 if (q_ptr->tval == TV_FLASK) {
607 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
608 set_food(creature_ptr, creature_ptr->food + 5000);
610 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
614 msg_print(_("水分を取り込んだ。", "You are moistened."));
615 set_food(creature_ptr, MIN(creature_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
618 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);
623 case MIMIC_DEMON_LORD:
624 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
627 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
630 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);