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 "player-inventory.h"
24 #include "realm-hex.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 creature_ptr プレーヤーへの参照ポインタ
37 * @param item 飲む薬オブジェクトの所持品ID
40 void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
48 take_turn(creature_ptr, 100);
50 if (creature_ptr->timewalk)
52 if (flush_failure) flush();
53 msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from the bottle."));
59 if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
60 if (hex_spelling_any(creature_ptr))
62 if (!hex_spelling(creature_ptr, HEX_INHAIL)) stop_hex_spell_all(creature_ptr);
65 o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
67 object_copy(q_ptr, o_ptr);
72 vary_item(creature_ptr, item, -1);
76 /* Not identified yet */
80 lev = k_info[q_ptr->k_idx].level;
82 /* Analyze the potion */
83 if (q_ptr->tval == TV_POTION)
87 /* 飲みごたえをオリジナルより細かく表現 */
89 msg_print(_("口の中がさっぱりした。", ""));
90 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
94 case SV_POTION_APPLE_JUICE:
95 msg_print(_("甘くてサッパリとしていて、とてもおいしい。", ""));
96 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
100 case SV_POTION_SLIME_MOLD:
101 msg_print(_("なんとも不気味な味だ。", ""));
102 msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty."));
106 case SV_POTION_SLOWNESS:
107 if (set_slow(creature_ptr, randint1(25) + 15, FALSE)) ident = TRUE;
110 case SV_POTION_SALT_WATER:
111 msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!"));
113 if (!(PRACE_IS_(creature_ptr, RACE_GOLEM) ||
114 PRACE_IS_(creature_ptr, RACE_ZOMBIE) ||
115 PRACE_IS_(creature_ptr, RACE_DEMON) ||
116 PRACE_IS_(creature_ptr, RACE_ANDROID) ||
117 PRACE_IS_(creature_ptr, RACE_SPECTRE) ||
118 (mimic_info[creature_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
120 /* Only living creatures get thirsty */
121 (void)set_food(creature_ptr, PY_FOOD_STARVE - 1);
124 (void)set_poisoned(creature_ptr, 0);
125 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 4);
129 case SV_POTION_POISON:
130 if (!(creature_ptr->resist_pois || is_oppose_pois(creature_ptr)))
132 if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(15) + 10))
139 case SV_POTION_BLINDNESS:
140 if (!creature_ptr->resist_blind)
142 if (set_blind(creature_ptr, creature_ptr->blind + randint0(100) + 100))
149 case SV_POTION_BOOZE:
150 ident = booze(creature_ptr);
153 case SV_POTION_SLEEP:
154 if (!creature_ptr->free_act)
156 msg_print(_("あなたは眠ってしまった。", "You fall asleep."));
158 if (ironman_nightmare)
160 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
162 /* Have some nightmares */
163 sanity_blast(creature_ptr, NULL, FALSE);
165 if (set_paralyzed(creature_ptr, creature_ptr->paralyzed + randint0(4) + 4))
172 case SV_POTION_LOSE_MEMORIES:
173 if (!creature_ptr->hold_exp && (creature_ptr->exp > 0))
175 msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade."));
176 chg_virtue(creature_ptr, V_KNOWLEDGE, -5);
178 lose_exp(creature_ptr, creature_ptr->exp / 4);
183 case SV_POTION_RUINATION:
184 msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!"));
185 take_hit(creature_ptr, DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1);
187 (void)dec_stat(creature_ptr, A_DEX, 25, TRUE);
188 (void)dec_stat(creature_ptr, A_WIS, 25, TRUE);
189 (void)dec_stat(creature_ptr, A_CON, 25, TRUE);
190 (void)dec_stat(creature_ptr, A_STR, 25, TRUE);
191 (void)dec_stat(creature_ptr, A_CHR, 25, TRUE);
192 (void)dec_stat(creature_ptr, A_INT, 25, TRUE);
196 case SV_POTION_DEC_STR:
197 if (do_dec_stat(creature_ptr, A_STR)) ident = TRUE;
200 case SV_POTION_DEC_INT:
201 if (do_dec_stat(creature_ptr, A_INT)) ident = TRUE;
204 case SV_POTION_DEC_WIS:
205 if (do_dec_stat(creature_ptr, A_WIS)) ident = TRUE;
208 case SV_POTION_DEC_DEX:
209 if (do_dec_stat(creature_ptr, A_DEX)) ident = TRUE;
212 case SV_POTION_DEC_CON:
213 if (do_dec_stat(creature_ptr, A_CON)) ident = TRUE;
216 case SV_POTION_DEC_CHR:
217 if (do_dec_stat(creature_ptr, A_CHR)) ident = TRUE;
220 case SV_POTION_DETONATIONS:
221 ident = detonation(creature_ptr);
224 case SV_POTION_DEATH:
225 chg_virtue(creature_ptr, V_VITALITY, -1);
226 chg_virtue(creature_ptr, V_UNLIFE, 5);
227 msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
228 take_hit(creature_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1);
232 case SV_POTION_INFRAVISION:
233 if (set_tim_infra(creature_ptr, creature_ptr->tim_infra + 100 + randint1(100), FALSE))
239 case SV_POTION_DETECT_INVIS:
240 if (set_tim_invis(creature_ptr, creature_ptr->tim_invis + 12 + randint1(12), FALSE))
246 case SV_POTION_SLOW_POISON:
247 if (set_poisoned(creature_ptr, creature_ptr->poisoned / 2)) ident = TRUE;
250 case SV_POTION_CURE_POISON:
251 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
254 case SV_POTION_BOLDNESS:
255 if (set_afraid(creature_ptr, 0)) ident = TRUE;
258 case SV_POTION_SPEED:
259 if (!creature_ptr->fast)
261 if (set_fast(creature_ptr, randint1(25) + 15, FALSE)) ident = TRUE;
265 (void)set_fast(creature_ptr, creature_ptr->fast + 5, FALSE);
269 case SV_POTION_RESIST_HEAT:
270 if (set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(10) + 10, FALSE))
276 case SV_POTION_RESIST_COLD:
277 if (set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(10) + 10, FALSE))
283 case SV_POTION_HEROISM:
284 ident = heroism(creature_ptr, 25);
287 case SV_POTION_BESERK_STRENGTH:
288 ident = berserk(creature_ptr, randint1(25) + 25);
291 case SV_POTION_CURE_LIGHT:
292 ident = cure_light_wounds(creature_ptr, 2, 8);
295 case SV_POTION_CURE_SERIOUS:
296 ident = cure_serious_wounds(creature_ptr, 4, 8);
299 case SV_POTION_CURE_CRITICAL:
300 ident = cure_critical_wounds(creature_ptr, damroll(6, 8));
303 case SV_POTION_HEALING:
304 ident = cure_critical_wounds(creature_ptr, 300);
307 case SV_POTION_STAR_HEALING:
308 ident = cure_critical_wounds(creature_ptr, 1200);
312 ident = life_stream(creature_ptr, TRUE, TRUE);
315 case SV_POTION_RESTORE_MANA:
316 ident = restore_mana(creature_ptr, TRUE);
319 case SV_POTION_RESTORE_EXP:
320 if (restore_level(creature_ptr)) ident = TRUE;
323 case SV_POTION_RES_STR:
324 if (do_res_stat(creature_ptr, A_STR)) ident = TRUE;
327 case SV_POTION_RES_INT:
328 if (do_res_stat(creature_ptr, A_INT)) ident = TRUE;
331 case SV_POTION_RES_WIS:
332 if (do_res_stat(creature_ptr, A_WIS)) ident = TRUE;
335 case SV_POTION_RES_DEX:
336 if (do_res_stat(creature_ptr, A_DEX)) ident = TRUE;
339 case SV_POTION_RES_CON:
340 if (do_res_stat(creature_ptr, A_CON)) ident = TRUE;
343 case SV_POTION_RES_CHR:
344 if (do_res_stat(creature_ptr, A_CHR)) ident = TRUE;
347 case SV_POTION_INC_STR:
348 if (do_inc_stat(creature_ptr, A_STR)) ident = TRUE;
351 case SV_POTION_INC_INT:
352 if (do_inc_stat(creature_ptr, A_INT)) ident = TRUE;
355 case SV_POTION_INC_WIS:
356 if (do_inc_stat(creature_ptr, A_WIS)) ident = TRUE;
359 case SV_POTION_INC_DEX:
360 if (do_inc_stat(creature_ptr, A_DEX)) ident = TRUE;
363 case SV_POTION_INC_CON:
364 if (do_inc_stat(creature_ptr, A_CON)) ident = TRUE;
367 case SV_POTION_INC_CHR:
368 if (do_inc_stat(creature_ptr, A_CHR)) ident = TRUE;
371 case SV_POTION_AUGMENTATION:
372 if (do_inc_stat(creature_ptr, A_STR)) ident = TRUE;
373 if (do_inc_stat(creature_ptr, A_INT)) ident = TRUE;
374 if (do_inc_stat(creature_ptr, A_WIS)) ident = TRUE;
375 if (do_inc_stat(creature_ptr, A_DEX)) ident = TRUE;
376 if (do_inc_stat(creature_ptr, A_CON)) ident = TRUE;
377 if (do_inc_stat(creature_ptr, A_CHR)) ident = TRUE;
380 case SV_POTION_ENLIGHTENMENT:
381 msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind..."));
382 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
383 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
384 wiz_lite(creature_ptr, FALSE);
388 case SV_POTION_STAR_ENLIGHTENMENT:
389 msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened..."));
390 chg_virtue(creature_ptr, V_KNOWLEDGE, 1);
391 chg_virtue(creature_ptr, V_ENLIGHTEN, 2);
393 wiz_lite(creature_ptr, FALSE);
394 (void)do_inc_stat(creature_ptr, A_INT);
395 (void)do_inc_stat(creature_ptr, A_WIS);
396 (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
397 (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
398 (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
399 (void)detect_treasure(creature_ptr, DETECT_RAD_DEFAULT);
400 (void)detect_objects_gold(creature_ptr, DETECT_RAD_DEFAULT);
401 (void)detect_objects_normal(creature_ptr, DETECT_RAD_DEFAULT);
402 identify_pack(creature_ptr);
403 self_knowledge(creature_ptr);
407 case SV_POTION_SELF_KNOWLEDGE:
408 msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better..."));
410 self_knowledge(creature_ptr);
414 case SV_POTION_EXPERIENCE:
415 if (creature_ptr->prace == RACE_ANDROID) break;
416 chg_virtue(creature_ptr, V_ENLIGHTEN, 1);
417 if (creature_ptr->exp < PY_MAX_EXP)
419 EXP ee = (creature_ptr->exp / 2) + 10;
420 if (ee > 100000L) ee = 100000L;
421 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
422 gain_exp(creature_ptr, ee);
427 case SV_POTION_RESISTANCE:
428 (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid + randint1(20) + 20, FALSE);
429 (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec + randint1(20) + 20, FALSE);
430 (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire + randint1(20) + 20, FALSE);
431 (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold + randint1(20) + 20, FALSE);
432 (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois + randint1(20) + 20, FALSE);
436 case SV_POTION_CURING:
437 if (true_healing(creature_ptr, 50)) ident = TRUE;
440 case SV_POTION_INVULNERABILITY:
441 (void)set_invuln(creature_ptr, creature_ptr->invuln + randint1(4) + 4, FALSE);
445 case SV_POTION_NEW_LIFE:
446 roll_hitdice(creature_ptr, 0L);
447 get_max_stats(creature_ptr);
448 creature_ptr->update |= PU_BONUS;
449 lose_all_mutations(creature_ptr);
453 case SV_POTION_NEO_TSUYOSHI:
454 (void)set_image(creature_ptr, 0);
455 (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi + randint1(100) + 100, FALSE);
459 case SV_POTION_TSUYOSHI:
460 msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
462 creature_ptr->tsuyoshi = 1;
463 (void)set_tsuyoshi(creature_ptr, 0, TRUE);
464 if (!creature_ptr->resist_chaos)
466 (void)set_image(creature_ptr, 50 + randint1(50));
471 case SV_POTION_POLYMORPH:
472 if ((creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) && one_in_(23))
474 lose_all_mutations(creature_ptr);
482 if(gain_mutation(creature_ptr, 0)) ident = TRUE;
484 else if (lose_mutation(creature_ptr, 0)) ident = TRUE;
485 } while(!ident || one_in_(2));
491 if (PRACE_IS_(creature_ptr, RACE_SKELETON))
493 msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
494 (void)potion_smash_effect(creature_ptr, 0, creature_ptr->y, creature_ptr->x, q_ptr->k_idx);
496 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
498 if (!(object_is_aware(q_ptr)))
500 chg_virtue(creature_ptr, V_PATIENCE, -1);
501 chg_virtue(creature_ptr, V_CHANCE, 1);
502 chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
505 /* The item has been tried */
508 /* An identification was made */
509 if (ident && !object_is_aware(q_ptr))
511 object_aware(creature_ptr, q_ptr);
512 gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
515 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
517 /* Potions can feed the player */
518 switch (creature_ptr->mimic_form)
521 switch (creature_ptr->prace)
524 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
533 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
536 if (q_ptr->tval == TV_FLASK)
538 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
539 set_food(creature_ptr, creature_ptr->food + 5000);
543 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
547 msg_print(_("水分を取り込んだ。", "You are moistened."));
548 set_food(creature_ptr, MIN(creature_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
551 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);
556 case MIMIC_DEMON_LORD:
557 set_food(creature_ptr, creature_ptr->food + ((q_ptr->pval) / 20));
560 (void)set_food(creature_ptr, creature_ptr->food + (q_ptr->pval / 10));
563 (void)set_food(creature_ptr, creature_ptr->food + q_ptr->pval);
571 * @brief 薬を飲むコマンドのメインルーチン /
572 * Quaff some potion (from the pack or floor)
575 void do_cmd_quaff_potion(player_type *creature_ptr)
580 if (creature_ptr->wild_mode)
585 if (cmd_limit_arena(creature_ptr)) return;
587 if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
589 set_action(creature_ptr, ACTION_NONE);
592 /* Restrict choices to potions */
593 item_tester_hook = item_tester_hook_quaff;
595 q = _("どの薬を飲みますか? ", "Quaff which potion? ");
596 s = _("飲める薬がない。", "You have no potions to quaff.");
598 if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0)) return;
600 /* Quaff the potion */
601 exe_quaff_potion(creature_ptr, item);