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"
31 * @brief 薬を飲むコマンドのサブルーチン /
32 * Quaff a potion (from the pack or the floor)
33 * @param item 飲む薬オブジェクトの所持品ID
36 void do_cmd_quaff_potion_aux(INVENTORY_IDX item)
44 take_turn(p_ptr, 100);
48 if (flush_failure) flush();
49 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from a bottle."));
55 if (music_singing_any()) stop_singing(p_ptr);
56 if (hex_spelling_any())
58 if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
61 /* Get the item (in the pack) */
64 o_ptr = &p_ptr->inventory_list[item];
67 /* Get the item (on the floor) */
70 o_ptr = ¤t_floor_ptr->o_list[0 - item];
74 /* Obtain a local object */
75 object_copy(q_ptr, o_ptr);
80 /* Reduce and describe p_ptr->inventory_list */
83 inven_item_increase(item, -1);
84 inven_item_describe(item);
85 inven_item_optimize(item);
88 /* Reduce and describe floor item */
91 floor_item_increase(0 - item, -1);
92 floor_item_describe(0 - item);
93 floor_item_optimize(0 - item);
99 /* Not identified yet */
103 lev = k_info[q_ptr->k_idx].level;
105 /* Analyze the potion */
106 if (q_ptr->tval == TV_POTION)
110 /* 飲みごたえをオリジナルより細かく表現 */
111 case SV_POTION_WATER:
112 msg_print(_("口の中がさっぱりした。", ""));
113 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
117 case SV_POTION_APPLE_JUICE:
118 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", ""));
119 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
123 case SV_POTION_SLIME_MOLD:
124 msg_print(_("なんとも不気味な味だ。", ""));
125 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
129 case SV_POTION_SLOWNESS:
130 if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
133 case SV_POTION_SALT_WATER:
134 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
136 if (!(prace_is_(RACE_GOLEM) ||
137 prace_is_(RACE_ZOMBIE) ||
138 prace_is_(RACE_DEMON) ||
139 prace_is_(RACE_ANDROID) ||
140 prace_is_(RACE_SPECTRE) ||
141 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
143 /* Only living creatures get thirsty */
144 (void)set_food(PY_FOOD_STARVE - 1);
147 (void)set_poisoned(0);
148 (void)set_paralyzed(p_ptr->paralyzed + 4);
152 case SV_POTION_POISON:
153 if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
155 if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
162 case SV_POTION_BLINDNESS:
163 if (!p_ptr->resist_blind)
165 if (set_blind(p_ptr->blind + randint0(100) + 100))
172 case SV_POTION_BOOZE:
173 ident = booze(p_ptr);
176 case SV_POTION_SLEEP:
177 if (!p_ptr->free_act)
179 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
181 if (ironman_nightmare)
183 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
185 /* Have some nightmares */
186 sanity_blast(NULL, FALSE);
188 if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
195 case SV_POTION_LOSE_MEMORIES:
196 if (!p_ptr->hold_exp && (p_ptr->exp > 0))
198 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
199 chg_virtue(V_KNOWLEDGE, -5);
201 lose_exp(p_ptr->exp / 4);
206 case SV_POTION_RUINATION:
207 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
208 take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
210 (void)dec_stat(A_DEX, 25, TRUE);
211 (void)dec_stat(A_WIS, 25, TRUE);
212 (void)dec_stat(A_CON, 25, TRUE);
213 (void)dec_stat(A_STR, 25, TRUE);
214 (void)dec_stat(A_CHR, 25, TRUE);
215 (void)dec_stat(A_INT, 25, TRUE);
219 case SV_POTION_DEC_STR:
220 if (do_dec_stat(A_STR)) ident = TRUE;
223 case SV_POTION_DEC_INT:
224 if (do_dec_stat(A_INT)) ident = TRUE;
227 case SV_POTION_DEC_WIS:
228 if (do_dec_stat(A_WIS)) ident = TRUE;
231 case SV_POTION_DEC_DEX:
232 if (do_dec_stat(A_DEX)) ident = TRUE;
235 case SV_POTION_DEC_CON:
236 if (do_dec_stat(A_CON)) ident = TRUE;
239 case SV_POTION_DEC_CHR:
240 if (do_dec_stat(A_CHR)) ident = TRUE;
243 case SV_POTION_DETONATIONS:
244 ident = detonation(p_ptr);
247 case SV_POTION_DEATH:
248 chg_virtue(V_VITALITY, -1);
249 chg_virtue(V_UNLIFE, 5);
250 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
251 take_hit(DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
255 case SV_POTION_INFRAVISION:
256 if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
262 case SV_POTION_DETECT_INVIS:
263 if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
269 case SV_POTION_SLOW_POISON:
270 if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
273 case SV_POTION_CURE_POISON:
274 if (set_poisoned(0)) ident = TRUE;
277 case SV_POTION_BOLDNESS:
278 if (set_afraid(0)) ident = TRUE;
281 case SV_POTION_SPEED:
284 if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
288 (void)set_fast(p_ptr->fast + 5, FALSE);
292 case SV_POTION_RESIST_HEAT:
293 if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
299 case SV_POTION_RESIST_COLD:
300 if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
306 case SV_POTION_HEROISM:
310 case SV_POTION_BESERK_STRENGTH:
311 ident = berserk(randint1(25) + 25);
314 case SV_POTION_CURE_LIGHT:
315 ident = cure_light_wounds(2, 8);
318 case SV_POTION_CURE_SERIOUS:
319 ident = cure_serious_wounds(4, 8);
322 case SV_POTION_CURE_CRITICAL:
323 ident = cure_critical_wounds(damroll(6, 8));
326 case SV_POTION_HEALING:
327 ident = cure_critical_wounds(300);
330 case SV_POTION_STAR_HEALING:
331 ident = cure_critical_wounds(1200);
335 ident = life_stream(TRUE, TRUE);
338 case SV_POTION_RESTORE_MANA:
339 ident = restore_mana(TRUE);
342 case SV_POTION_RESTORE_EXP:
343 if (restore_level()) ident = TRUE;
346 case SV_POTION_RES_STR:
347 if (do_res_stat(A_STR)) ident = TRUE;
350 case SV_POTION_RES_INT:
351 if (do_res_stat(A_INT)) ident = TRUE;
354 case SV_POTION_RES_WIS:
355 if (do_res_stat(A_WIS)) ident = TRUE;
358 case SV_POTION_RES_DEX:
359 if (do_res_stat(A_DEX)) ident = TRUE;
362 case SV_POTION_RES_CON:
363 if (do_res_stat(A_CON)) ident = TRUE;
366 case SV_POTION_RES_CHR:
367 if (do_res_stat(A_CHR)) ident = TRUE;
370 case SV_POTION_INC_STR:
371 if (do_inc_stat(A_STR)) ident = TRUE;
374 case SV_POTION_INC_INT:
375 if (do_inc_stat(A_INT)) ident = TRUE;
378 case SV_POTION_INC_WIS:
379 if (do_inc_stat(A_WIS)) ident = TRUE;
382 case SV_POTION_INC_DEX:
383 if (do_inc_stat(A_DEX)) ident = TRUE;
386 case SV_POTION_INC_CON:
387 if (do_inc_stat(A_CON)) ident = TRUE;
390 case SV_POTION_INC_CHR:
391 if (do_inc_stat(A_CHR)) ident = TRUE;
394 case SV_POTION_AUGMENTATION:
395 if (do_inc_stat(A_STR)) ident = TRUE;
396 if (do_inc_stat(A_INT)) ident = TRUE;
397 if (do_inc_stat(A_WIS)) ident = TRUE;
398 if (do_inc_stat(A_DEX)) ident = TRUE;
399 if (do_inc_stat(A_CON)) ident = TRUE;
400 if (do_inc_stat(A_CHR)) ident = TRUE;
403 case SV_POTION_ENLIGHTENMENT:
404 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
405 chg_virtue(V_KNOWLEDGE, 1);
406 chg_virtue(V_ENLIGHTEN, 1);
411 case SV_POTION_STAR_ENLIGHTENMENT:
412 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
413 chg_virtue(V_KNOWLEDGE, 1);
414 chg_virtue(V_ENLIGHTEN, 2);
417 (void)do_inc_stat(A_INT);
418 (void)do_inc_stat(A_WIS);
419 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
420 (void)detect_doors(DETECT_RAD_DEFAULT);
421 (void)detect_stairs(DETECT_RAD_DEFAULT);
422 (void)detect_treasure(DETECT_RAD_DEFAULT);
423 (void)detect_objects_gold(DETECT_RAD_DEFAULT);
424 (void)detect_objects_normal(DETECT_RAD_DEFAULT);
430 case SV_POTION_SELF_KNOWLEDGE:
431 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
437 case SV_POTION_EXPERIENCE:
438 if (p_ptr->prace == RACE_ANDROID) break;
439 chg_virtue(V_ENLIGHTEN, 1);
440 if (p_ptr->exp < PY_MAX_EXP)
442 EXP ee = (p_ptr->exp / 2) + 10;
443 if (ee > 100000L) ee = 100000L;
444 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
450 case SV_POTION_RESISTANCE:
451 (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
452 (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
453 (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
454 (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
455 (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
459 case SV_POTION_CURING:
460 if (true_healing(50)) ident = TRUE;
463 case SV_POTION_INVULNERABILITY:
464 (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
468 case SV_POTION_NEW_LIFE:
469 roll_hitdice(p_ptr, 0L);
471 p_ptr->update |= PU_BONUS;
472 lose_all_mutations();
476 case SV_POTION_NEO_TSUYOSHI:
478 (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
482 case SV_POTION_TSUYOSHI:
483 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
486 (void)set_tsuyoshi(0, TRUE);
487 if (!p_ptr->resist_chaos)
489 (void)set_image(50 + randint1(50));
494 case SV_POTION_POLYMORPH:
495 if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
497 lose_all_mutations();
505 if(gain_mutation(p_ptr, 0)) ident = TRUE;
507 else if (lose_mutation(0)) ident = TRUE;
508 } while(!ident || one_in_(2));
514 if (prace_is_(RACE_SKELETON))
516 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
517 (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx);
519 p_ptr->update |= (PU_COMBINE | PU_REORDER);
521 if (!(object_is_aware(q_ptr)))
523 chg_virtue(V_PATIENCE, -1);
524 chg_virtue(V_CHANCE, 1);
525 chg_virtue(V_KNOWLEDGE, -1);
528 /* The item has been tried */
531 /* An identification was made */
532 if (ident && !object_is_aware(q_ptr))
535 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
538 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
540 /* Potions can feed the player */
541 switch (p_ptr->mimic_form)
544 switch (p_ptr->prace)
547 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
556 set_food(p_ptr->food + ((q_ptr->pval) / 20));
559 if (q_ptr->tval == TV_FLASK)
561 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
562 set_food(p_ptr->food + 5000);
566 set_food(p_ptr->food + ((q_ptr->pval) / 20));
570 msg_print(_("水分を取り込んだ。", "You are moistened."));
571 set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
574 (void)set_food(p_ptr->food + q_ptr->pval);
579 case MIMIC_DEMON_LORD:
580 set_food(p_ptr->food + ((q_ptr->pval) / 20));
583 (void)set_food(p_ptr->food + (q_ptr->pval / 10));
586 (void)set_food(p_ptr->food + q_ptr->pval);
594 * @brief 薬を飲むコマンドのメインルーチン /
595 * Quaff some potion (from the pack or floor)
598 void do_cmd_quaff_potion(void)
603 if (p_ptr->wild_mode)
608 if (cmd_limit_arena(p_ptr)) return;
610 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
612 set_action(ACTION_NONE);
615 /* Restrict choices to potions */
616 item_tester_hook = item_tester_hook_quaff;
618 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
619 s = _("飲める薬がない。", "You have no potions to quaff.");
621 if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
623 /* Quaff the potion */
624 do_cmd_quaff_potion_aux(item);