3 * @brief プレイヤーの飲むコマンド実装
14 #include "object-hook.h"
18 #include "spells-status.h"
19 #include "player-status.h"
20 #include "player-effects.h"
21 #include "player-race.h"
22 #include "realm-hex.h"
23 #include "realm-song.h"
24 #include "spells-floor.h"
25 #include "object-broken.h"
26 #include "cmd-basic.h"
28 #include "objectkind.h"
29 #include "view-mainwindow.h"
30 #include "player-class.h"
33 * @brief 薬を飲むコマンドのサブルーチン /
34 * Quaff a potion (from the pack or the floor)
35 * @param item 飲む薬オブジェクトの所持品ID
38 void do_cmd_quaff_potion_aux(INVENTORY_IDX item)
46 take_turn(p_ptr, 100);
50 if (flush_failure) flush();
51 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from a bottle."));
57 if (music_singing_any()) stop_singing(p_ptr);
58 if (hex_spelling_any())
60 if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
63 /* Get the item (in the pack) */
66 o_ptr = &p_ptr->inventory_list[item];
69 /* Get the item (on the floor) */
72 o_ptr = ¤t_floor_ptr->o_list[0 - item];
76 /* Obtain a local object */
77 object_copy(q_ptr, o_ptr);
82 /* Reduce and describe p_ptr->inventory_list */
85 inven_item_increase(item, -1);
86 inven_item_describe(item);
87 inven_item_optimize(item);
90 /* Reduce and describe floor item */
93 floor_item_increase(0 - item, -1);
94 floor_item_describe(0 - item);
95 floor_item_optimize(0 - item);
101 /* Not identified yet */
105 lev = k_info[q_ptr->k_idx].level;
107 /* Analyze the potion */
108 if (q_ptr->tval == TV_POTION)
112 /* 飲みごたえをオリジナルより細かく表現 */
113 case SV_POTION_WATER:
114 msg_print(_("口の中がさっぱりした。", ""));
115 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
119 case SV_POTION_APPLE_JUICE:
120 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", ""));
121 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
125 case SV_POTION_SLIME_MOLD:
126 msg_print(_("なんとも不気味な味だ。", ""));
127 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
131 case SV_POTION_SLOWNESS:
132 if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
135 case SV_POTION_SALT_WATER:
136 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
138 if (!(prace_is_(RACE_GOLEM) ||
139 prace_is_(RACE_ZOMBIE) ||
140 prace_is_(RACE_DEMON) ||
141 prace_is_(RACE_ANDROID) ||
142 prace_is_(RACE_SPECTRE) ||
143 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
145 /* Only living creatures get thirsty */
146 (void)set_food(PY_FOOD_STARVE - 1);
149 (void)set_poisoned(0);
150 (void)set_paralyzed(p_ptr->paralyzed + 4);
154 case SV_POTION_POISON:
155 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
157 if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
164 case SV_POTION_BLINDNESS:
165 if (!p_ptr->resist_blind)
167 if (set_blind(p_ptr->blind + randint0(100) + 100))
174 case SV_POTION_BOOZE:
175 ident = booze(p_ptr);
178 case SV_POTION_SLEEP:
179 if (!p_ptr->free_act)
181 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
183 if (ironman_nightmare)
185 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
187 /* Have some nightmares */
188 sanity_blast(NULL, FALSE);
190 if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
197 case SV_POTION_LOSE_MEMORIES:
198 if (!p_ptr->hold_exp && (p_ptr->exp > 0))
200 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
201 chg_virtue(V_KNOWLEDGE, -5);
203 lose_exp(p_ptr->exp / 4);
208 case SV_POTION_RUINATION:
209 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
210 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
212 (void)dec_stat(A_DEX, 25, TRUE);
213 (void)dec_stat(A_WIS, 25, TRUE);
214 (void)dec_stat(A_CON, 25, TRUE);
215 (void)dec_stat(A_STR, 25, TRUE);
216 (void)dec_stat(A_CHR, 25, TRUE);
217 (void)dec_stat(A_INT, 25, TRUE);
221 case SV_POTION_DEC_STR:
222 if (do_dec_stat(A_STR)) ident = TRUE;
225 case SV_POTION_DEC_INT:
226 if (do_dec_stat(A_INT)) ident = TRUE;
229 case SV_POTION_DEC_WIS:
230 if (do_dec_stat(A_WIS)) ident = TRUE;
233 case SV_POTION_DEC_DEX:
234 if (do_dec_stat(A_DEX)) ident = TRUE;
237 case SV_POTION_DEC_CON:
238 if (do_dec_stat(A_CON)) ident = TRUE;
241 case SV_POTION_DEC_CHR:
242 if (do_dec_stat(A_CHR)) ident = TRUE;
245 case SV_POTION_DETONATIONS:
246 ident = detonation(p_ptr);
249 case SV_POTION_DEATH:
250 chg_virtue(V_VITALITY, -1);
251 chg_virtue(V_UNLIFE, 5);
252 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
253 take_hit(DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
257 case SV_POTION_INFRAVISION:
258 if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
264 case SV_POTION_DETECT_INVIS:
265 if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
271 case SV_POTION_SLOW_POISON:
272 if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
275 case SV_POTION_CURE_POISON:
276 if (set_poisoned(0)) ident = TRUE;
279 case SV_POTION_BOLDNESS:
280 if (set_afraid(0)) ident = TRUE;
283 case SV_POTION_SPEED:
286 if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
290 (void)set_fast(p_ptr->fast + 5, FALSE);
294 case SV_POTION_RESIST_HEAT:
295 if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
301 case SV_POTION_RESIST_COLD:
302 if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
308 case SV_POTION_HEROISM:
312 case SV_POTION_BESERK_STRENGTH:
313 ident = berserk(randint1(25) + 25);
316 case SV_POTION_CURE_LIGHT:
317 ident = cure_light_wounds(2, 8);
320 case SV_POTION_CURE_SERIOUS:
321 ident = cure_serious_wounds(4, 8);
324 case SV_POTION_CURE_CRITICAL:
325 ident = cure_critical_wounds(damroll(6, 8));
328 case SV_POTION_HEALING:
329 ident = cure_critical_wounds(300);
332 case SV_POTION_STAR_HEALING:
333 ident = cure_critical_wounds(1200);
337 ident = life_stream(TRUE, TRUE);
340 case SV_POTION_RESTORE_MANA:
341 ident = restore_mana(TRUE);
344 case SV_POTION_RESTORE_EXP:
345 if (restore_level()) ident = TRUE;
348 case SV_POTION_RES_STR:
349 if (do_res_stat(A_STR)) ident = TRUE;
352 case SV_POTION_RES_INT:
353 if (do_res_stat(A_INT)) ident = TRUE;
356 case SV_POTION_RES_WIS:
357 if (do_res_stat(A_WIS)) ident = TRUE;
360 case SV_POTION_RES_DEX:
361 if (do_res_stat(A_DEX)) ident = TRUE;
364 case SV_POTION_RES_CON:
365 if (do_res_stat(A_CON)) ident = TRUE;
368 case SV_POTION_RES_CHR:
369 if (do_res_stat(A_CHR)) ident = TRUE;
372 case SV_POTION_INC_STR:
373 if (do_inc_stat(A_STR)) ident = TRUE;
376 case SV_POTION_INC_INT:
377 if (do_inc_stat(A_INT)) ident = TRUE;
380 case SV_POTION_INC_WIS:
381 if (do_inc_stat(A_WIS)) ident = TRUE;
384 case SV_POTION_INC_DEX:
385 if (do_inc_stat(A_DEX)) ident = TRUE;
388 case SV_POTION_INC_CON:
389 if (do_inc_stat(A_CON)) ident = TRUE;
392 case SV_POTION_INC_CHR:
393 if (do_inc_stat(A_CHR)) ident = TRUE;
396 case SV_POTION_AUGMENTATION:
397 if (do_inc_stat(A_STR)) ident = TRUE;
398 if (do_inc_stat(A_INT)) ident = TRUE;
399 if (do_inc_stat(A_WIS)) ident = TRUE;
400 if (do_inc_stat(A_DEX)) ident = TRUE;
401 if (do_inc_stat(A_CON)) ident = TRUE;
402 if (do_inc_stat(A_CHR)) ident = TRUE;
405 case SV_POTION_ENLIGHTENMENT:
406 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
407 chg_virtue(V_KNOWLEDGE, 1);
408 chg_virtue(V_ENLIGHTEN, 1);
413 case SV_POTION_STAR_ENLIGHTENMENT:
414 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
415 chg_virtue(V_KNOWLEDGE, 1);
416 chg_virtue(V_ENLIGHTEN, 2);
419 (void)do_inc_stat(A_INT);
420 (void)do_inc_stat(A_WIS);
421 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
422 (void)detect_doors(DETECT_RAD_DEFAULT);
423 (void)detect_stairs(DETECT_RAD_DEFAULT);
424 (void)detect_treasure(DETECT_RAD_DEFAULT);
425 (void)detect_objects_gold(DETECT_RAD_DEFAULT);
426 (void)detect_objects_normal(DETECT_RAD_DEFAULT);
432 case SV_POTION_SELF_KNOWLEDGE:
433 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
439 case SV_POTION_EXPERIENCE:
440 if (p_ptr->prace == RACE_ANDROID) break;
441 chg_virtue(V_ENLIGHTEN, 1);
442 if (p_ptr->exp < PY_MAX_EXP)
444 EXP ee = (p_ptr->exp / 2) + 10;
445 if (ee > 100000L) ee = 100000L;
446 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
452 case SV_POTION_RESISTANCE:
453 (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
454 (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
455 (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
456 (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
457 (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
461 case SV_POTION_CURING:
462 if (true_healing(50)) ident = TRUE;
465 case SV_POTION_INVULNERABILITY:
466 (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
470 case SV_POTION_NEW_LIFE:
471 roll_hitdice(p_ptr, 0L);
473 p_ptr->update |= PU_BONUS;
474 lose_all_mutations();
478 case SV_POTION_NEO_TSUYOSHI:
480 (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
484 case SV_POTION_TSUYOSHI:
485 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
488 (void)set_tsuyoshi(0, TRUE);
489 if (!p_ptr->resist_chaos)
491 (void)set_image(50 + randint1(50));
496 case SV_POTION_POLYMORPH:
497 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
499 lose_all_mutations();
507 if(gain_mutation(p_ptr, 0)) ident = TRUE;
509 else if (lose_mutation(0)) ident = TRUE;
510 } while(!ident || one_in_(2));
516 if (prace_is_(RACE_SKELETON))
518 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
519 (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx);
521 p_ptr->update |= (PU_COMBINE | PU_REORDER);
523 if (!(object_is_aware(q_ptr)))
525 chg_virtue(V_PATIENCE, -1);
526 chg_virtue(V_CHANCE, 1);
527 chg_virtue(V_KNOWLEDGE, -1);
530 /* The item has been tried */
533 /* An identification was made */
534 if (ident && !object_is_aware(q_ptr))
537 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
540 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
542 /* Potions can feed the player */
543 switch (p_ptr->mimic_form)
546 switch (p_ptr->prace)
549 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
558 set_food(p_ptr->food + ((q_ptr->pval) / 20));
561 if (q_ptr->tval == TV_FLASK)
563 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
564 set_food(p_ptr->food + 5000);
568 set_food(p_ptr->food + ((q_ptr->pval) / 20));
572 msg_print(_("水分を取り込んだ。", "You are moistened."));
573 set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
576 (void)set_food(p_ptr->food + q_ptr->pval);
581 case MIMIC_DEMON_LORD:
582 set_food(p_ptr->food + ((q_ptr->pval) / 20));
585 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
588 (void)set_food(p_ptr->food + q_ptr->pval);
596 * @brief 薬を飲むコマンドのメインルーチン /
597 * Quaff some potion (from the pack or floor)
600 void do_cmd_quaff_potion(void)
605 if (p_ptr->wild_mode)
610 if (cmd_limit_arena(p_ptr)) return;
612 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
614 set_action(ACTION_NONE);
617 /* Restrict choices to potions */
618 item_tester_hook = item_tester_hook_quaff;
620 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
621 s = _("飲める薬がない。", "You have no potions to quaff.");
623 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
625 /* Quaff the potion */
626 do_cmd_quaff_potion_aux(item);