3 * @brief プレイヤーの飲むコマンド実装
14 #include "object-hook.h"
18 #include "spells-status.h"
19 #include "player-effects.h"
20 #include "player-status.h"
21 #include "player-damage.h"
22 #include "player-race.h"
23 #include "realm-hex.h"
24 #include "realm-song.h"
25 #include "spells-floor.h"
26 #include "object-broken.h"
27 #include "cmd-basic.h"
29 #include "objectkind.h"
30 #include "view-mainwindow.h"
31 #include "player-class.h"
34 * @brief 薬を飲むコマンドのサブルーチン /
35 * Quaff a potion (from the pack or the floor)
36 * @param item 飲む薬オブジェクトの所持品ID
39 void exe_quaff_potion(INVENTORY_IDX item)
47 take_turn(p_ptr, 100);
51 if (flush_failure) flush();
52 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from a bottle."));
58 if (music_singing_any(p_ptr)) stop_singing(p_ptr);
59 if (hex_spelling_any(p_ptr))
61 if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
64 o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
66 object_copy(q_ptr, o_ptr);
71 /* Reduce and describe p_ptr->inventory_list */
74 inven_item_increase(item, -1);
75 inven_item_describe(item);
76 inven_item_optimize(item);
79 /* Reduce and describe floor item */
82 floor_item_increase(0 - item, -1);
83 floor_item_describe(0 - item);
84 floor_item_optimize(0 - item);
90 /* Not identified yet */
94 lev = k_info[q_ptr->k_idx].level;
96 /* Analyze the potion */
97 if (q_ptr->tval == TV_POTION)
101 /* 飲みごたえをオリジナルより細かく表現 */
102 case SV_POTION_WATER:
103 msg_print(_("口の中がさっぱりした。", ""));
104 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
108 case SV_POTION_APPLE_JUICE:
109 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", ""));
110 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
114 case SV_POTION_SLIME_MOLD:
115 msg_print(_("なんとも不気味な味だ。", ""));
116 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
120 case SV_POTION_SLOWNESS:
121 if (set_slow(p_ptr, randint1(25) + 15, FALSE)) ident = TRUE;
124 case SV_POTION_SALT_WATER:
125 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
127 if (!(PRACE_IS_(p_ptr, RACE_GOLEM) ||
128 PRACE_IS_(p_ptr, RACE_ZOMBIE) ||
129 PRACE_IS_(p_ptr, RACE_DEMON) ||
130 PRACE_IS_(p_ptr, RACE_ANDROID) ||
131 PRACE_IS_(p_ptr, RACE_SPECTRE) ||
132 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
134 /* Only living creatures get thirsty */
135 (void)set_food(p_ptr, PY_FOOD_STARVE - 1);
138 (void)set_poisoned(p_ptr, 0);
139 (void)set_paralyzed(p_ptr, p_ptr->paralyzed + 4);
143 case SV_POTION_POISON:
144 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
146 if (set_poisoned(p_ptr, p_ptr->poisoned + randint0(15) + 10))
153 case SV_POTION_BLINDNESS:
154 if (!p_ptr->resist_blind)
156 if (set_blind(p_ptr, p_ptr->blind + randint0(100) + 100))
163 case SV_POTION_BOOZE:
164 ident = booze(p_ptr);
167 case SV_POTION_SLEEP:
168 if (!p_ptr->free_act)
170 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
172 if (ironman_nightmare)
174 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
176 /* Have some nightmares */
177 sanity_blast(p_ptr, NULL, FALSE);
179 if (set_paralyzed(p_ptr, p_ptr->paralyzed + randint0(4) + 4))
186 case SV_POTION_LOSE_MEMORIES:
187 if (!p_ptr->hold_exp && (p_ptr->exp > 0))
189 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
190 chg_virtue(p_ptr, V_KNOWLEDGE, -5);
192 lose_exp(p_ptr, p_ptr->exp / 4);
197 case SV_POTION_RUINATION:
198 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
199 take_hit(p_ptr, DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
201 (void)dec_stat(p_ptr, A_DEX, 25, TRUE);
202 (void)dec_stat(p_ptr, A_WIS, 25, TRUE);
203 (void)dec_stat(p_ptr, A_CON, 25, TRUE);
204 (void)dec_stat(p_ptr, A_STR, 25, TRUE);
205 (void)dec_stat(p_ptr, A_CHR, 25, TRUE);
206 (void)dec_stat(p_ptr, A_INT, 25, TRUE);
210 case SV_POTION_DEC_STR:
211 if (do_dec_stat(p_ptr, A_STR)) ident = TRUE;
214 case SV_POTION_DEC_INT:
215 if (do_dec_stat(p_ptr, A_INT)) ident = TRUE;
218 case SV_POTION_DEC_WIS:
219 if (do_dec_stat(p_ptr, A_WIS)) ident = TRUE;
222 case SV_POTION_DEC_DEX:
223 if (do_dec_stat(p_ptr, A_DEX)) ident = TRUE;
226 case SV_POTION_DEC_CON:
227 if (do_dec_stat(p_ptr, A_CON)) ident = TRUE;
230 case SV_POTION_DEC_CHR:
231 if (do_dec_stat(p_ptr, A_CHR)) ident = TRUE;
234 case SV_POTION_DETONATIONS:
235 ident = detonation(p_ptr);
238 case SV_POTION_DEATH:
239 chg_virtue(p_ptr, V_VITALITY, -1);
240 chg_virtue(p_ptr, V_UNLIFE, 5);
241 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
242 take_hit(p_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
246 case SV_POTION_INFRAVISION:
247 if (set_tim_infra(p_ptr, p_ptr->tim_infra + 100 + randint1(100), FALSE))
253 case SV_POTION_DETECT_INVIS:
254 if (set_tim_invis(p_ptr, p_ptr->tim_invis + 12 + randint1(12), FALSE))
260 case SV_POTION_SLOW_POISON:
261 if (set_poisoned(p_ptr, p_ptr->poisoned / 2)) ident = TRUE;
264 case SV_POTION_CURE_POISON:
265 if (set_poisoned(p_ptr, 0)) ident = TRUE;
268 case SV_POTION_BOLDNESS:
269 if (set_afraid(p_ptr, 0)) ident = TRUE;
272 case SV_POTION_SPEED:
275 if (set_fast(p_ptr, randint1(25) + 15, FALSE)) ident = TRUE;
279 (void)set_fast(p_ptr, p_ptr->fast + 5, FALSE);
283 case SV_POTION_RESIST_HEAT:
284 if (set_oppose_fire(p_ptr, p_ptr->oppose_fire + randint1(10) + 10, FALSE))
290 case SV_POTION_RESIST_COLD:
291 if (set_oppose_cold(p_ptr, p_ptr->oppose_cold + randint1(10) + 10, FALSE))
297 case SV_POTION_HEROISM:
301 case SV_POTION_BESERK_STRENGTH:
302 ident = berserk(randint1(25) + 25);
305 case SV_POTION_CURE_LIGHT:
306 ident = cure_light_wounds(2, 8);
309 case SV_POTION_CURE_SERIOUS:
310 ident = cure_serious_wounds(4, 8);
313 case SV_POTION_CURE_CRITICAL:
314 ident = cure_critical_wounds(damroll(6, 8));
317 case SV_POTION_HEALING:
318 ident = cure_critical_wounds(300);
321 case SV_POTION_STAR_HEALING:
322 ident = cure_critical_wounds(1200);
326 ident = life_stream(TRUE, TRUE);
329 case SV_POTION_RESTORE_MANA:
330 ident = restore_mana(TRUE);
333 case SV_POTION_RESTORE_EXP:
334 if (restore_level(p_ptr)) ident = TRUE;
337 case SV_POTION_RES_STR:
338 if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
341 case SV_POTION_RES_INT:
342 if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
345 case SV_POTION_RES_WIS:
346 if (do_res_stat(p_ptr, A_WIS)) ident = TRUE;
349 case SV_POTION_RES_DEX:
350 if (do_res_stat(p_ptr, A_DEX)) ident = TRUE;
353 case SV_POTION_RES_CON:
354 if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
357 case SV_POTION_RES_CHR:
358 if (do_res_stat(p_ptr, A_CHR)) ident = TRUE;
361 case SV_POTION_INC_STR:
362 if (do_inc_stat(p_ptr, A_STR)) ident = TRUE;
365 case SV_POTION_INC_INT:
366 if (do_inc_stat(p_ptr, A_INT)) ident = TRUE;
369 case SV_POTION_INC_WIS:
370 if (do_inc_stat(p_ptr, A_WIS)) ident = TRUE;
373 case SV_POTION_INC_DEX:
374 if (do_inc_stat(p_ptr, A_DEX)) ident = TRUE;
377 case SV_POTION_INC_CON:
378 if (do_inc_stat(p_ptr, A_CON)) ident = TRUE;
381 case SV_POTION_INC_CHR:
382 if (do_inc_stat(p_ptr, A_CHR)) ident = TRUE;
385 case SV_POTION_AUGMENTATION:
386 if (do_inc_stat(p_ptr, A_STR)) ident = TRUE;
387 if (do_inc_stat(p_ptr, A_INT)) ident = TRUE;
388 if (do_inc_stat(p_ptr, A_WIS)) ident = TRUE;
389 if (do_inc_stat(p_ptr, A_DEX)) ident = TRUE;
390 if (do_inc_stat(p_ptr, A_CON)) ident = TRUE;
391 if (do_inc_stat(p_ptr, A_CHR)) ident = TRUE;
394 case SV_POTION_ENLIGHTENMENT:
395 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
396 chg_virtue(p_ptr, V_KNOWLEDGE, 1);
397 chg_virtue(p_ptr, V_ENLIGHTEN, 1);
402 case SV_POTION_STAR_ENLIGHTENMENT:
403 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
404 chg_virtue(p_ptr, V_KNOWLEDGE, 1);
405 chg_virtue(p_ptr, V_ENLIGHTEN, 2);
408 (void)do_inc_stat(p_ptr, A_INT);
409 (void)do_inc_stat(p_ptr, A_WIS);
410 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
411 (void)detect_doors(DETECT_RAD_DEFAULT);
412 (void)detect_stairs(DETECT_RAD_DEFAULT);
413 (void)detect_treasure(DETECT_RAD_DEFAULT);
414 (void)detect_objects_gold(DETECT_RAD_DEFAULT);
415 (void)detect_objects_normal(DETECT_RAD_DEFAULT);
421 case SV_POTION_SELF_KNOWLEDGE:
422 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
428 case SV_POTION_EXPERIENCE:
429 if (p_ptr->prace == RACE_ANDROID) break;
430 chg_virtue(p_ptr, V_ENLIGHTEN, 1);
431 if (p_ptr->exp < PY_MAX_EXP)
433 EXP ee = (p_ptr->exp / 2) + 10;
434 if (ee > 100000L) ee = 100000L;
435 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
441 case SV_POTION_RESISTANCE:
442 (void)set_oppose_acid(p_ptr, p_ptr->oppose_acid + randint1(20) + 20, FALSE);
443 (void)set_oppose_elec(p_ptr, p_ptr->oppose_elec + randint1(20) + 20, FALSE);
444 (void)set_oppose_fire(p_ptr, p_ptr->oppose_fire + randint1(20) + 20, FALSE);
445 (void)set_oppose_cold(p_ptr, p_ptr->oppose_cold + randint1(20) + 20, FALSE);
446 (void)set_oppose_pois(p_ptr, p_ptr->oppose_pois + randint1(20) + 20, FALSE);
450 case SV_POTION_CURING:
451 if (true_healing(50)) ident = TRUE;
454 case SV_POTION_INVULNERABILITY:
455 (void)set_invuln(p_ptr, p_ptr->invuln + randint1(4) + 4, FALSE);
459 case SV_POTION_NEW_LIFE:
460 roll_hitdice(p_ptr, 0L);
461 get_max_stats(p_ptr);
462 p_ptr->update |= PU_BONUS;
463 lose_all_mutations(p_ptr);
467 case SV_POTION_NEO_TSUYOSHI:
468 (void)set_image(p_ptr, 0);
469 (void)set_tsuyoshi(p_ptr, p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
473 case SV_POTION_TSUYOSHI:
474 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
477 (void)set_tsuyoshi(p_ptr, 0, TRUE);
478 if (!p_ptr->resist_chaos)
480 (void)set_image(p_ptr, 50 + randint1(50));
485 case SV_POTION_POLYMORPH:
486 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
488 lose_all_mutations(p_ptr);
496 if(gain_mutation(p_ptr, 0)) ident = TRUE;
498 else if (lose_mutation(p_ptr, 0)) ident = TRUE;
499 } while(!ident || one_in_(2));
505 if (PRACE_IS_(p_ptr, RACE_SKELETON))
507 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
508 (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx);
510 p_ptr->update |= (PU_COMBINE | PU_REORDER);
512 if (!(object_is_aware(q_ptr)))
514 chg_virtue(p_ptr, V_PATIENCE, -1);
515 chg_virtue(p_ptr, V_CHANCE, 1);
516 chg_virtue(p_ptr, V_KNOWLEDGE, -1);
519 /* The item has been tried */
522 /* An identification was made */
523 if (ident && !object_is_aware(q_ptr))
526 gain_exp(p_ptr, (lev + (p_ptr->lev >> 1)) / p_ptr->lev);
529 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
531 /* Potions can feed the player */
532 switch (p_ptr->mimic_form)
535 switch (p_ptr->prace)
538 (void)set_food(p_ptr, p_ptr->food + (q_ptr->pval / 10));
547 set_food(p_ptr, p_ptr->food + ((q_ptr->pval) / 20));
550 if (q_ptr->tval == TV_FLASK)
552 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
553 set_food(p_ptr, p_ptr->food + 5000);
557 set_food(p_ptr, p_ptr->food + ((q_ptr->pval) / 20));
561 msg_print(_("水分を取り込んだ。", "You are moistened."));
562 set_food(p_ptr, MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
565 (void)set_food(p_ptr, p_ptr->food + q_ptr->pval);
570 case MIMIC_DEMON_LORD:
571 set_food(p_ptr, p_ptr->food + ((q_ptr->pval) / 20));
574 (void)set_food(p_ptr, p_ptr->food + (q_ptr->pval / 10));
577 (void)set_food(p_ptr, p_ptr->food + q_ptr->pval);
585 * @brief 薬を飲むコマンドのメインルーチン /
586 * Quaff some potion (from the pack or floor)
589 void do_cmd_quaff_potion(void)
594 if (p_ptr->wild_mode)
599 if (cmd_limit_arena(p_ptr)) return;
601 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
603 set_action(p_ptr, ACTION_NONE);
606 /* Restrict choices to potions */
607 item_tester_hook = item_tester_hook_quaff;
609 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
610 s = _("飲める薬がない。", "You have no potions to quaff.");
612 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0)) return;
614 /* Quaff the potion */
615 exe_quaff_potion(item);