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/digestion-processor.h"
27 #include "player/eldritch-horror.h"
28 #include "player/mimic-info-table.h"
29 #include "player/player-damage.h"
30 #include "realm/realm-hex-numbers.h"
31 #include "spell-kind/spells-detection.h"
32 #include "spell-kind/spells-floor.h"
33 #include "spell-kind/spells-perception.h"
34 #include "spell-kind/spells-teleport.h"
35 #include "spell-realm/spells-hex.h"
36 #include "spell/spells-status.h"
37 #include "status/bad-status-setter.h"
38 #include "status/base-status.h"
39 #include "status/body-improvement.h"
40 #include "status/buff-setter.h"
41 #include "status/element-resistance.h"
42 #include "status/experience.h"
43 #include "status/shape-changer.h"
44 #include "status/sight-setter.h"
45 #include "sv-definition/sv-potion-types.h"
46 #include "system/object-type-definition.h"
47 #include "term/screen-processor.h"
48 #include "view/display-messages.h"
52 * @param creature_ptr プレーヤーへの参照ポインタ
53 * @return カオス耐性があるかその他の一部確率でFALSE、それ以外はTRUE
55 static bool booze(player_type *creature_ptr)
58 if (creature_ptr->pclass != CLASS_MONK)
59 chg_virtue(creature_ptr, V_HARMONY, -1);
60 else if (!creature_ptr->resist_conf)
61 creature_ptr->special_attack |= ATTACK_SUIKEN;
63 if (!creature_ptr->resist_conf && set_confused(creature_ptr, randint0(20) + 15)) {
67 if (creature_ptr->resist_chaos) {
71 if (one_in_(2) && set_image(creature_ptr, creature_ptr->image + randint0(150) + 150)) {
75 if (one_in_(13) && (creature_ptr->pclass != CLASS_MONK)) {
78 lose_all_info(creature_ptr);
80 wiz_dark(creature_ptr);
82 (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
83 wiz_dark(creature_ptr);
84 msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
85 msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing or how you got here!"));
92 * @brief 爆発の薬の効果処理 / Fumble ramble
93 * @param creature_ptr プレーヤーへの参照ポインタ
96 static bool detonation(player_type *creature_ptr)
98 msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
99 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
100 (void)set_stun(creature_ptr, creature_ptr->stun + 75);
101 (void)set_cut(creature_ptr, creature_ptr->cut + 5000);
106 * @brief 薬を飲むコマンドのサブルーチン /
107 * Quaff a potion (from the pack or the floor)
108 * @param creature_ptr プレーヤーへの参照ポインタ
109 * @param item 飲む薬オブジェクトの所持品ID
112 void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
118 take_turn(creature_ptr, 100);
120 if (creature_ptr->timewalk) {
124 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from the bottle."));
129 if (music_singing_any(creature_ptr))
130 stop_singing(creature_ptr);
132 if (hex_spelling_any(creature_ptr) && !hex_spelling(creature_ptr, HEX_INHAIL))
133 stop_hex_spell_all(creature_ptr);
135 o_ptr = ref_item(creature_ptr, item);
137 object_copy(q_ptr, o_ptr);
139 vary_item(creature_ptr, item, -1);
142 DEPTH lev = k_info[q_ptr->k_idx].level;
143 if (q_ptr->tval == TV_POTION) {
144 switch (q_ptr->sval) {
145 /* 飲みごたえをオリジナルより細かく表現 */
146 case SV_POTION_WATER:
147 msg_print(_("口の中がさっぱりした。", ""));
148 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
152 case SV_POTION_APPLE_JUICE:
153 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", ""));
154 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
158 case SV_POTION_SLIME_MOLD:
159 msg_print(_("なんとも不気味な味だ。", ""));
160 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
164 case SV_POTION_SLOWNESS:
165 if (set_slow(creature_ptr, randint1(25) + 15, FALSE))
169 case SV_POTION_SALT_WATER:
170 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
172 if (!(is_specific_player_race(creature_ptr, RACE_GOLEM) || is_specific_player_race(creature_ptr, RACE_ZOMBIE)
173 || is_specific_player_race(creature_ptr, RACE_BALROG) || is_specific_player_race(creature_ptr, RACE_ANDROID)
174 || is_specific_player_race(creature_ptr, RACE_SPECTRE) || (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))) {
175 /* Only living creatures get thirsty */
176 (void)set_food(creature_ptr, PY_FOOD_STARVE - 1);
179 (void)set_poisoned(creature_ptr, 0);
180 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 4);
184 case SV_POTION_POISON:
185 if (!(creature_ptr->resist_pois || is_oppose_pois(creature_ptr))) {
186 if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(15) + 10)) {
192 case SV_POTION_BLINDNESS:
193 if (!creature_ptr->resist_blind) {
194 if (set_blind(creature_ptr, creature_ptr->blind + randint0(100) + 100)) {
200 case SV_POTION_BOOZE:
201 ident = booze(creature_ptr);
204 case SV_POTION_SLEEP:
205 if (!creature_ptr->free_act) {
206 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
208 if (ironman_nightmare) {
209 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
211 /* Have some nightmares */
212 sanity_blast(creature_ptr, NULL, FALSE);
214 if (set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4)) {
220 case SV_POTION_LOSE_MEMORIES:
221 if (!creature_ptr->hold_exp && (creature_ptr->exp > 0)) {
222 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
223 chg_virtue(creature_ptr, V_KNOWLEDGE, -5);
225 lose_exp(creature_ptr, creature_ptr->exp / 4);
230 case SV_POTION_RUINATION:
231 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
232 take_hit(creature_ptr, DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
234 (void)dec_stat(creature_ptr, A_DEX, 25, TRUE);
235 (void)dec_stat(creature_ptr, A_WIS, 25, TRUE);
236 (void)dec_stat(creature_ptr, A_CON, 25, TRUE);
237 (void)dec_stat(creature_ptr, A_STR, 25, TRUE);
238 (void)dec_stat(creature_ptr, A_CHR, 25, TRUE);
239 (void)dec_stat(creature_ptr, A_INT, 25, TRUE);
243 case SV_POTION_DEC_STR:
244 if (do_dec_stat(creature_ptr, A_STR))
248 case SV_POTION_DEC_INT:
249 if (do_dec_stat(creature_ptr, A_INT))
253 case SV_POTION_DEC_WIS:
254 if (do_dec_stat(creature_ptr, A_WIS))
258 case SV_POTION_DEC_DEX:
259 if (do_dec_stat(creature_ptr, A_DEX))
263 case SV_POTION_DEC_CON:
264 if (do_dec_stat(creature_ptr, A_CON))
268 case SV_POTION_DEC_CHR:
269 if (do_dec_stat(creature_ptr, A_CHR))
273 case SV_POTION_DETONATIONS:
274 ident = detonation(creature_ptr);
277 case SV_POTION_DEATH:
278 chg_virtue(creature_ptr, V_VITALITY, -1);
279 chg_virtue(creature_ptr, V_UNLIFE, 5);
280 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
281 take_hit(creature_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
285 case SV_POTION_INFRAVISION:
286 if (set_tim_infra(creature_ptr, creature_ptr->tim_infra + 100 + randint1(100), FALSE)) {
291 case SV_POTION_DETECT_INVIS:
292 if (set_tim_invis(creature_ptr, creature_ptr->tim_invis + 12 + randint1(12), FALSE)) {
297 case SV_POTION_SLOW_POISON:
298 if (set_poisoned(creature_ptr, creature_ptr->poisoned / 2))
302 case SV_POTION_CURE_POISON:
303 if (set_poisoned(creature_ptr, 0))
307 case SV_POTION_BOLDNESS:
308 if (set_afraid(creature_ptr, 0))
312 case SV_POTION_SPEED:
313 if (!creature_ptr->fast) {
314 if (set_fast(creature_ptr, randint1(25) + 15, FALSE))
317 (void)set_fast(creature_ptr, creature_ptr->fast + 5, FALSE);
321 case SV_POTION_RESIST_HEAT:
322 if (set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(10) + 10, FALSE)) {
327 case SV_POTION_RESIST_COLD:
328 if (set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(10) + 10, FALSE)) {
333 case SV_POTION_HEROISM:
334 ident = heroism(creature_ptr, 25);
337 case SV_POTION_BESERK_STRENGTH:
338 ident = berserk(creature_ptr, randint1(25) + 25);
341 case SV_POTION_CURE_LIGHT:
342 ident = cure_light_wounds(creature_ptr, 2, 8);
345 case SV_POTION_CURE_SERIOUS:
346 ident = cure_serious_wounds(creature_ptr, 4, 8);
349 case SV_POTION_CURE_CRITICAL:
350 ident = cure_critical_wounds(creature_ptr, damroll(6, 8));
353 case SV_POTION_HEALING:
354 ident = cure_critical_wounds(creature_ptr, 300);
357 case SV_POTION_STAR_HEALING:
358 ident = cure_critical_wounds(creature_ptr, 1200);
362 ident = life_stream(creature_ptr, TRUE, TRUE);
365 case SV_POTION_RESTORE_MANA:
366 ident = restore_mana(creature_ptr, TRUE);
369 case SV_POTION_RESTORE_EXP:
370 if (restore_level(creature_ptr))
374 case SV_POTION_RES_STR:
375 if (do_res_stat(creature_ptr, A_STR))
379 case SV_POTION_RES_INT:
380 if (do_res_stat(creature_ptr, A_INT))
384 case SV_POTION_RES_WIS:
385 if (do_res_stat(creature_ptr, A_WIS))
389 case SV_POTION_RES_DEX:
390 if (do_res_stat(creature_ptr, A_DEX))
394 case SV_POTION_RES_CON:
395 if (do_res_stat(creature_ptr, A_CON))
399 case SV_POTION_RES_CHR:
400 if (do_res_stat(creature_ptr, A_CHR))
404 case SV_POTION_INC_STR:
405 if (do_inc_stat(creature_ptr, A_STR))
409 case SV_POTION_INC_INT:
410 if (do_inc_stat(creature_ptr, A_INT))
414 case SV_POTION_INC_WIS:
415 if (do_inc_stat(creature_ptr, A_WIS))
419 case SV_POTION_INC_DEX:
420 if (do_inc_stat(creature_ptr, A_DEX))
424 case SV_POTION_INC_CON:
425 if (do_inc_stat(creature_ptr, A_CON))
429 case SV_POTION_INC_CHR:
430 if (do_inc_stat(creature_ptr, A_CHR))
434 case SV_POTION_AUGMENTATION:
435 if (do_inc_stat(creature_ptr, A_STR))
437 if (do_inc_stat(creature_ptr, A_INT))
439 if (do_inc_stat(creature_ptr, A_WIS))
441 if (do_inc_stat(creature_ptr, A_DEX))
443 if (do_inc_stat(creature_ptr, A_CON))
445 if (do_inc_stat(creature_ptr, A_CHR))
449 case SV_POTION_ENLIGHTENMENT:
450 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
451 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
452 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
453 wiz_lite(creature_ptr, FALSE);
457 case SV_POTION_STAR_ENLIGHTENMENT:
458 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
459 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
460 chg_virtue(creature_ptr, V_ENLIGHTEN, 2);
462 wiz_lite(creature_ptr, FALSE);
463 (void)do_inc_stat(creature_ptr, A_INT);
464 (void)do_inc_stat(creature_ptr, A_WIS);
465 (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
466 (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
467 (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
468 (void)detect_treasure(creature_ptr, DETECT_RAD_DEFAULT);
469 (void)detect_objects_gold(creature_ptr, DETECT_RAD_DEFAULT);
470 (void)detect_objects_normal(creature_ptr, DETECT_RAD_DEFAULT);
471 identify_pack(creature_ptr);
472 self_knowledge(creature_ptr);
476 case SV_POTION_SELF_KNOWLEDGE:
477 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
479 self_knowledge(creature_ptr);
483 case SV_POTION_EXPERIENCE:
484 if (creature_ptr->prace == RACE_ANDROID)
486 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
487 if (creature_ptr->exp < PY_MAX_EXP) {
488 EXP ee = (creature_ptr->exp / 2) + 10;
491 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
492 gain_exp(creature_ptr, ee);
497 case SV_POTION_RESISTANCE:
498 (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid + randint1(20) + 20, FALSE);
499 (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec + randint1(20) + 20, FALSE);
500 (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(20) + 20, FALSE);
501 (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(20) + 20, FALSE);
502 (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois + randint1(20) + 20, FALSE);
506 case SV_POTION_CURING:
507 if (true_healing(creature_ptr, 50))
511 case SV_POTION_INVULNERABILITY:
512 (void)set_invuln(creature_ptr, creature_ptr->invuln + randint1(4) + 4, FALSE);
516 case SV_POTION_NEW_LIFE:
517 roll_hitdice(creature_ptr, 0L);
518 get_max_stats(creature_ptr);
519 creature_ptr->update |= PU_BONUS;
520 lose_all_mutations(creature_ptr);
524 case SV_POTION_NEO_TSUYOSHI:
525 (void)set_image(creature_ptr, 0);
526 (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi + randint1(100) + 100, FALSE);
530 case SV_POTION_TSUYOSHI:
531 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
533 creature_ptr->tsuyoshi = 1;
534 (void)set_tsuyoshi(creature_ptr, 0, TRUE);
535 if (!creature_ptr->resist_chaos) {
536 (void)set_image(creature_ptr, 50 + randint1(50));
541 case SV_POTION_POLYMORPH:
542 if ((creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) && one_in_(23)) {
543 lose_all_mutations(creature_ptr);
547 if (gain_mutation(creature_ptr, 0))
549 } else if (lose_mutation(creature_ptr, 0))
551 } while (!ident || one_in_(2));
557 if (is_specific_player_race(creature_ptr, RACE_SKELETON)) {
558 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
559 (void)potion_smash_effect(creature_ptr, 0, creature_ptr->y, creature_ptr->x, q_ptr->k_idx);
561 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
563 if (!(object_is_aware(q_ptr))) {
564 chg_virtue(creature_ptr, V_PATIENCE, -1);
565 chg_virtue(creature_ptr, V_CHANCE, 1);
566 chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
569 /* The item has been tried */
572 /* An identification was made */
573 if (ident && !object_is_aware(q_ptr)) {
574 object_aware(creature_ptr, q_ptr);
575 gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
578 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
580 /* Potions can feed the player */
581 switch (creature_ptr->mimic_form) {
583 switch (creature_ptr->prace) {
585 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
594 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
597 if (q_ptr->tval == TV_FLASK) {
598 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
599 set_food(creature_ptr, creature_ptr->food + 5000);
601 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
605 msg_print(_("水分を取り込んだ。", "You are moistened."));
606 set_food(creature_ptr, MIN(creature_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
609 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);
614 case MIMIC_DEMON_LORD:
615 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
618 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
621 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);