From: Deskull Date: Fri, 7 Sep 2018 12:18:18 +0000 (+0900) Subject: * [Refactor] #37353 プレイヤーの飲む処理を cmd-quaff.c/h に分離。 / Separate player's quaff command... X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=39193c7acb5b367066b877152621a3e75f8d5ca2 * [Refactor] #37353 プレイヤーの飲む処理を cmd-quaff.c/h に分離。 / Separate player's quaff command to cmd-quaff.c/h. --- diff --git a/Hengband_vcs2015/Hengband/Hengband.vcxproj b/Hengband_vcs2015/Hengband/Hengband.vcxproj index 0bae6d860..9fcdd4578 100644 --- a/Hengband_vcs2015/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2015/Hengband/Hengband.vcxproj @@ -139,6 +139,7 @@ + @@ -206,6 +207,7 @@ + diff --git a/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters index eba75ee2d..8f084b5de 100644 --- a/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters @@ -214,6 +214,9 @@ Source + + Source + @@ -291,6 +294,9 @@ Header + + Header + diff --git a/src/cmd-eat.c b/src/cmd-eat.c index 565b16140..590fc5ad0 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -1,7 +1,7 @@ /*! * @file cmd-eat.c - * @brief ƒvƒŒƒCƒ„[‚̐HŽ–‚ÉŠÖ‚·‚éƒRƒ}ƒ“ƒhŽÀ‘• - * @date 2014/01/27 + * @brief ƒvƒŒƒCƒ„[‚̐H‚ׂéƒRƒ}ƒ“ƒhŽÀ‘• + * @date 2018/09/07 * @details * cmd6.c‚æ‚蕪—£B */ diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c new file mode 100644 index 000000000..6f12e5dbc --- /dev/null +++ b/src/cmd-quaff.c @@ -0,0 +1,744 @@ +/*! + * @file cmd-quaff.c + * @brief ƒvƒŒƒCƒ„[‚̈ù‚ÞƒRƒ}ƒ“ƒhŽÀ‘• + * @date 2018/09/07 + * @details + * cmd6.c‚æ‚蕪—£B + */ + + +#include "angband.h" +#include "selfinfo.h" + +/*! + * @brief –ò‚ðˆù‚ÞƒRƒ}ƒ“ƒh‚̃Tƒuƒ‹[ƒ`ƒ“ / + * Quaff a potion (from the pack or the floor) + * @param item ˆù‚Þ–òƒIƒuƒWƒFƒNƒg‚̏ŠŽ•iID + * @return ‚È‚µ + */ +void do_cmd_quaff_potion_aux(int item) +{ + int ident, lev; + object_type *o_ptr; + object_type forge; + object_type *q_ptr; + + + /* Take a turn */ + p_ptr->energy_use = 100; + + if (world_player) + { + if (flush_failure) flush(); + msg_print(_("•r‚©‚琅‚ª—¬‚êo‚Ä‚±‚È‚¢I", "The potion doesn't flow out from a bottle.")); + + sound(SOUND_FAIL); + return; + } + + if (music_singing_any()) stop_singing(); + if (hex_spelling_any()) + { + if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all(); + } + + /* Get the item (in the pack) */ + if (item >= 0) + { + o_ptr = &inventory[item]; + } + + /* Get the item (on the floor) */ + else + { + o_ptr = &o_list[0 - item]; + } + + /* Get local object */ + q_ptr = &forge; + + /* Obtain a local object */ + object_copy(q_ptr, o_ptr); + + /* Single object */ + q_ptr->number = 1; + + /* Reduce and describe inventory */ + if (item >= 0) + { + inven_item_increase(item, -1); + inven_item_describe(item); + inven_item_optimize(item); + } + + /* Reduce and describe floor item */ + else + { + floor_item_increase(0 - item, -1); + floor_item_describe(0 - item); + floor_item_optimize(0 - item); + } + + /* Sound */ + sound(SOUND_QUAFF); + + + /* Not identified yet */ + ident = FALSE; + + /* Object level */ + lev = k_info[q_ptr->k_idx].level; + + /* Analyze the potion */ + if (q_ptr->tval == TV_POTION) + { + switch (q_ptr->sval) + { + /* ˆù‚Ý‚²‚½‚¦‚ðƒIƒŠƒWƒiƒ‹‚æ‚è×‚©‚­•\Œ» */ + case SV_POTION_WATER: + msg_print(_("Œû‚Ì’†‚ª‚³‚Á‚ς肵‚½B", "")); + msg_print(_("‚Ì‚Ç‚ÌŠ‰‚«‚ª­‚µ‚¨‚³‚Ü‚Á‚½B", "You feel less thirsty.")); + ident = TRUE; + break; + + case SV_POTION_APPLE_JUICE: + msg_print(_("ŠÃ‚­‚ăTƒbƒpƒŠ‚Æ‚µ‚Ä‚¢‚āA‚Æ‚Ä‚à‚¨‚¢‚µ‚¢B", "")); + msg_print(_("‚Ì‚Ç‚ÌŠ‰‚«‚ª­‚µ‚¨‚³‚Ü‚Á‚½B", "You feel less thirsty.")); + ident = TRUE; + break; + + case SV_POTION_SLIME_MOLD: + msg_print(_("‚È‚ñ‚Æ‚à•s‹C–¡‚È–¡‚¾B", "")); + msg_print(_("‚Ì‚Ç‚ÌŠ‰‚«‚ª­‚µ‚¨‚³‚Ü‚Á‚½B", "You feel less thirsty.")); + ident = TRUE; + break; + + case SV_POTION_SLOWNESS: + if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE; + break; + + case SV_POTION_SALT_WATER: + msg_print(_("‚¤‚¥IŽv‚킸“f‚¢‚Ä‚µ‚Ü‚Á‚½B", "The potion makes you vomit!")); + + if (!(prace_is_(RACE_GOLEM) || + prace_is_(RACE_ZOMBIE) || + prace_is_(RACE_DEMON) || + prace_is_(RACE_ANDROID) || + prace_is_(RACE_SPECTRE) || + (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))) + { + /* Only living creatures get thirsty */ + (void)set_food(PY_FOOD_STARVE - 1); + } + + (void)set_poisoned(0); + (void)set_paralyzed(p_ptr->paralyzed + 4); + ident = TRUE; + break; + + case SV_POTION_POISON: + if (!(p_ptr->resist_pois || IS_OPPOSE_POIS())) + { + if (set_poisoned(p_ptr->poisoned + randint0(15) + 10)) + { + ident = TRUE; + } + } + break; + + case SV_POTION_BLINDNESS: + if (!p_ptr->resist_blind) + { + if (set_blind(p_ptr->blind + randint0(100) + 100)) + { + ident = TRUE; + } + } + break; + + case SV_POTION_CONFUSION: /* Booze */ + if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1); + else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN; + if (!p_ptr->resist_conf) + { + if (set_confused(randint0(20) + 15)) + { + ident = TRUE; + } + } + + if (!p_ptr->resist_chaos) + { + if (one_in_(2)) + { + if (set_image(p_ptr->image + randint0(150) + 150)) + { + ident = TRUE; + } + } + if (one_in_(13) && (p_ptr->pclass != CLASS_MONK)) + { + ident = TRUE; + if (one_in_(3)) lose_all_info(); + else wiz_dark(); + (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + wiz_dark(); + msg_print(_("’m‚ç‚È‚¢êŠ‚Å–Ú‚ªÁ‚ß‚½B“ª’É‚ª‚·‚éB", "You wake up somewhere with a sore head...")); + msg_print(_("‰½‚àŽv‚¢o‚¹‚È‚¢B‚Ç‚¤‚â‚Á‚Ä‚±‚±‚Ö—ˆ‚½‚Ì‚©‚à•ª‚©‚ç‚È‚¢I", "You can't remember a thing, or how you got here!")); + } + } + break; + + case SV_POTION_SLEEP: + if (!p_ptr->free_act) + { + msg_print(_("‚ ‚È‚½‚Í–°‚Á‚Ä‚µ‚Ü‚Á‚½B", "You fall asleep.")); + + if (ironman_nightmare) + { + msg_print(_("‹°‚낵‚¢ŒõŒi‚ª“ª‚É•‚‚©‚ñ‚Å‚«‚½B", "A horrible vision enters your mind.")); + + /* Have some nightmares */ + sanity_blast(NULL, FALSE); + } + if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4)) + { + ident = TRUE; + } + } + break; + + case SV_POTION_LOSE_MEMORIES: + if (!p_ptr->hold_exp && (p_ptr->exp > 0)) + { + msg_print(_("‰ß‹Ž‚Ì‹L‰¯‚ª”–‚ê‚Ä‚¢‚­‹C‚ª‚·‚éB", "You feel your memories fade.")); + chg_virtue(V_KNOWLEDGE, -5); + + lose_exp(p_ptr->exp / 4); + ident = TRUE; + } + break; + + case SV_POTION_RUINATION: + msg_print(_("g‚àS‚àŽã‚Á‚Ä‚«‚āA¸‹C‚ª”²‚¯‚Ä‚¢‚­‚悤‚¾B", "Your nerves and muscles feel weak and lifeless!")); + take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("”j–Å‚Ì–ò", "a potion of Ruination"), -1); + + (void)dec_stat(A_DEX, 25, TRUE); + (void)dec_stat(A_WIS, 25, TRUE); + (void)dec_stat(A_CON, 25, TRUE); + (void)dec_stat(A_STR, 25, TRUE); + (void)dec_stat(A_CHR, 25, TRUE); + (void)dec_stat(A_INT, 25, TRUE); + ident = TRUE; + break; + + case SV_POTION_DEC_STR: + if (do_dec_stat(A_STR)) ident = TRUE; + break; + + case SV_POTION_DEC_INT: + if (do_dec_stat(A_INT)) ident = TRUE; + break; + + case SV_POTION_DEC_WIS: + if (do_dec_stat(A_WIS)) ident = TRUE; + break; + + case SV_POTION_DEC_DEX: + if (do_dec_stat(A_DEX)) ident = TRUE; + break; + + case SV_POTION_DEC_CON: + if (do_dec_stat(A_CON)) ident = TRUE; + break; + + case SV_POTION_DEC_CHR: + if (do_dec_stat(A_CHR)) ident = TRUE; + break; + + case SV_POTION_DETONATIONS: + msg_print(_("‘Ì‚Ì’†‚ÅŒƒ‚µ‚¢”š”­‚ª‹N‚«‚½I", "Massive explosions rupture your body!")); + take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("”š”­‚Ì–ò", "a potion of Detonation"), -1); + + (void)set_stun(p_ptr->stun + 75); + (void)set_cut(p_ptr->cut + 5000); + ident = TRUE; + break; + + case SV_POTION_DEATH: + chg_virtue(V_VITALITY, -1); + chg_virtue(V_UNLIFE, 5); + msg_print(_("Ž€‚Ì—\Š´‚ª‘Ì’†‚ð‹ì‚¯‚ß‚®‚Á‚½B", "A feeling of Death flows through your body.")); + take_hit(DAMAGE_LOSELIFE, 5000, _("Ž€‚Ì–ò", "a potion of Death"), -1); + ident = TRUE; + break; + + case SV_POTION_INFRAVISION: + if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE)) + { + ident = TRUE; + } + break; + + case SV_POTION_DETECT_INVIS: + if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE)) + { + ident = TRUE; + } + break; + + case SV_POTION_SLOW_POISON: + if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE; + break; + + case SV_POTION_CURE_POISON: + if (set_poisoned(0)) ident = TRUE; + break; + + case SV_POTION_BOLDNESS: + if (set_afraid(0)) ident = TRUE; + break; + + case SV_POTION_SPEED: + if (!p_ptr->fast) + { + if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE; + } + else + { + (void)set_fast(p_ptr->fast + 5, FALSE); + } + break; + + case SV_POTION_RESIST_HEAT: + if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE)) + { + ident = TRUE; + } + break; + + case SV_POTION_RESIST_COLD: + if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE)) + { + ident = TRUE; + } + break; + + case SV_POTION_HEROISM: + if (set_afraid(0)) ident = TRUE; + if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE; + if (hp_player(10)) ident = TRUE; + break; + + case SV_POTION_BESERK_STRENGTH: + if (set_afraid(0)) ident = TRUE; + if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE; + if (hp_player(30)) ident = TRUE; + break; + + case SV_POTION_CURE_LIGHT: + if (hp_player(damroll(2, 8))) ident = TRUE; + if (set_blind(0)) ident = TRUE; + if (set_cut(p_ptr->cut - 10)) ident = TRUE; + if (set_shero(0,TRUE)) ident = TRUE; + break; + + case SV_POTION_CURE_SERIOUS: + if (hp_player(damroll(4, 8))) ident = TRUE; + if (set_blind(0)) ident = TRUE; + if (set_confused(0)) ident = TRUE; + if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE; + if (set_shero(0,TRUE)) ident = TRUE; + break; + + case SV_POTION_CURE_CRITICAL: + if (hp_player(damroll(6, 8))) ident = TRUE; + if (set_blind(0)) ident = TRUE; + if (set_confused(0)) ident = TRUE; + if (set_poisoned(0)) ident = TRUE; + if (set_stun(0)) ident = TRUE; + if (set_cut(0)) ident = TRUE; + if (set_shero(0,TRUE)) ident = TRUE; + break; + + case SV_POTION_HEALING: + if (hp_player(300)) ident = TRUE; + if (set_blind(0)) ident = TRUE; + if (set_confused(0)) ident = TRUE; + if (set_poisoned(0)) ident = TRUE; + if (set_stun(0)) ident = TRUE; + if (set_cut(0)) ident = TRUE; + if (set_shero(0,TRUE)) ident = TRUE; + break; + + case SV_POTION_STAR_HEALING: + if (hp_player(1200)) ident = TRUE; + if (set_blind(0)) ident = TRUE; + if (set_confused(0)) ident = TRUE; + if (set_poisoned(0)) ident = TRUE; + if (set_stun(0)) ident = TRUE; + if (set_cut(0)) ident = TRUE; + if (set_shero(0,TRUE)) ident = TRUE; + break; + + case SV_POTION_LIFE: + chg_virtue(V_VITALITY, 1); + chg_virtue(V_UNLIFE, -5); + msg_print(_("‘Ì’†‚ɐ¶–½—Í‚ª–ž‚¿‚ ‚Ó‚ê‚Ä‚«‚½I", "You feel life flow through your body!")); + restore_level(); + (void)set_poisoned(0); + (void)set_blind(0); + (void)set_confused(0); + (void)set_image(0); + (void)set_stun(0); + (void)set_cut(0); + (void)do_res_stat(A_STR); + (void)do_res_stat(A_CON); + (void)do_res_stat(A_DEX); + (void)do_res_stat(A_WIS); + (void)do_res_stat(A_INT); + (void)do_res_stat(A_CHR); + (void)set_shero(0,TRUE); + update_stuff(); + hp_player(5000); + ident = TRUE; + break; + + case SV_POTION_RESTORE_MANA: + if (p_ptr->pclass == CLASS_MAGIC_EATER) + { + int i; + for (i = 0; i < EATER_EXT*2; i++) + { + p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3; + if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i]*EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE; + } + for (; i < EATER_EXT*3; i++) + { + KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2); + p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE*3 : p_ptr->magic_num2[i]*EATER_ROD_CHARGE/3)*k_info[k_idx].pval; + if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0; + } + msg_print(_("“ª‚ªƒnƒbƒLƒŠ‚Æ‚µ‚½B", "You feel your head clear.")); + p_ptr->window |= (PW_PLAYER); + ident = TRUE; + } + else if (p_ptr->csp < p_ptr->msp) + { + p_ptr->csp = p_ptr->msp; + p_ptr->csp_frac = 0; + msg_print(_("“ª‚ªƒnƒbƒLƒŠ‚Æ‚µ‚½B", "You feel your head clear.")); + + p_ptr->redraw |= (PR_MANA); + p_ptr->window |= (PW_PLAYER); + p_ptr->window |= (PW_SPELL); + ident = TRUE; + } + if (set_shero(0,TRUE)) ident = TRUE; + break; + + case SV_POTION_RESTORE_EXP: + if (restore_level()) ident = TRUE; + break; + + case SV_POTION_RES_STR: + if (do_res_stat(A_STR)) ident = TRUE; + break; + + case SV_POTION_RES_INT: + if (do_res_stat(A_INT)) ident = TRUE; + break; + + case SV_POTION_RES_WIS: + if (do_res_stat(A_WIS)) ident = TRUE; + break; + + case SV_POTION_RES_DEX: + if (do_res_stat(A_DEX)) ident = TRUE; + break; + + case SV_POTION_RES_CON: + if (do_res_stat(A_CON)) ident = TRUE; + break; + + case SV_POTION_RES_CHR: + if (do_res_stat(A_CHR)) ident = TRUE; + break; + + case SV_POTION_INC_STR: + if (do_inc_stat(A_STR)) ident = TRUE; + break; + + case SV_POTION_INC_INT: + if (do_inc_stat(A_INT)) ident = TRUE; + break; + + case SV_POTION_INC_WIS: + if (do_inc_stat(A_WIS)) ident = TRUE; + break; + + case SV_POTION_INC_DEX: + if (do_inc_stat(A_DEX)) ident = TRUE; + break; + + case SV_POTION_INC_CON: + if (do_inc_stat(A_CON)) ident = TRUE; + break; + + case SV_POTION_INC_CHR: + if (do_inc_stat(A_CHR)) ident = TRUE; + break; + + case SV_POTION_AUGMENTATION: + if (do_inc_stat(A_STR)) ident = TRUE; + if (do_inc_stat(A_INT)) ident = TRUE; + if (do_inc_stat(A_WIS)) ident = TRUE; + if (do_inc_stat(A_DEX)) ident = TRUE; + if (do_inc_stat(A_CON)) ident = TRUE; + if (do_inc_stat(A_CHR)) ident = TRUE; + break; + + case SV_POTION_ENLIGHTENMENT: + msg_print(_("Ž©•ª‚Ì’u‚©‚ê‚Ä‚¢‚éó‹µ‚ª”]— ‚É•‚‚©‚ñ‚Å‚«‚½...", "An image of your surroundings forms in your mind...")); + chg_virtue(V_KNOWLEDGE, 1); + chg_virtue(V_ENLIGHTEN, 1); + wiz_lite(FALSE); + ident = TRUE; + break; + + case SV_POTION_STAR_ENLIGHTENMENT: + msg_print(_("X‚È‚éŒ[–Ö‚ðŠ´‚¶‚½...", "You begin to feel more enlightened...")); + chg_virtue(V_KNOWLEDGE, 1); + chg_virtue(V_ENLIGHTEN, 2); + msg_print(NULL); + wiz_lite(FALSE); + (void)do_inc_stat(A_INT); + (void)do_inc_stat(A_WIS); + (void)detect_traps(DETECT_RAD_DEFAULT, TRUE); + (void)detect_doors(DETECT_RAD_DEFAULT); + (void)detect_stairs(DETECT_RAD_DEFAULT); + (void)detect_treasure(DETECT_RAD_DEFAULT); + (void)detect_objects_gold(DETECT_RAD_DEFAULT); + (void)detect_objects_normal(DETECT_RAD_DEFAULT); + identify_pack(); + self_knowledge(); + ident = TRUE; + break; + + case SV_POTION_SELF_KNOWLEDGE: + msg_print(_("Ž©•ªŽ©g‚Ì‚±‚Æ‚ª­‚µ‚Í•ª‚©‚Á‚½‹C‚ª‚·‚é...", "You begin to know yourself a little better...")); + msg_print(NULL); + self_knowledge(); + ident = TRUE; + break; + + case SV_POTION_EXPERIENCE: + if (p_ptr->prace == RACE_ANDROID) break; + chg_virtue(V_ENLIGHTEN, 1); + if (p_ptr->exp < PY_MAX_EXP) + { + s32b ee = (p_ptr->exp / 2) + 10; + if (ee > 100000L) ee = 100000L; + msg_print(_("X‚ÉŒoŒ±‚ðÏ‚ñ‚¾‚悤‚È‹C‚ª‚·‚éB", "You feel more experienced.")); + gain_exp(ee); + ident = TRUE; + } + break; + + case SV_POTION_RESISTANCE: + (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE); + (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE); + (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE); + (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE); + (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE); + ident = TRUE; + break; + + case SV_POTION_CURING: + if (hp_player(50)) ident = TRUE; + if (set_blind(0)) ident = TRUE; + if (set_poisoned(0)) ident = TRUE; + if (set_confused(0)) ident = TRUE; + if (set_stun(0)) ident = TRUE; + if (set_cut(0)) ident = TRUE; + if (set_image(0)) ident = TRUE; + break; + + case SV_POTION_INVULNERABILITY: + (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE); + ident = TRUE; + break; + + case SV_POTION_NEW_LIFE: + do_cmd_rerate(FALSE); + get_max_stats(); + p_ptr->update |= PU_BONUS; + lose_all_mutations(); + ident = TRUE; + break; + + case SV_POTION_NEO_TSUYOSHI: + (void)set_image(0); + (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE); + ident = TRUE; + break; + + case SV_POTION_TSUYOSHI: + msg_print(_("uƒIƒNƒŒŒZ‚³‚ñIv", "Brother OKURE!")); + msg_print(NULL); + p_ptr->tsuyoshi = 1; + (void)set_tsuyoshi(0, TRUE); + if (!p_ptr->resist_chaos) + { + (void)set_image(50 + randint1(50)); + } + ident = TRUE; + break; + + case SV_POTION_POLYMORPH: + if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23)) + { + lose_all_mutations(); + } + else + { + do + { + if (one_in_(2)) + { + if(gain_random_mutation(0)) ident = TRUE; + } + else if (lose_mutation(0)) ident = TRUE; + } while(!ident || one_in_(2)); + } + break; + } + } + + if (prace_is_(RACE_SKELETON)) + { + msg_print(_("‰t‘̂̈ꕔ‚Í‚ ‚È‚½‚̃AƒS‚ð‘f’ʂ肵‚Ä—Ž‚¿‚½I", "Some of the fluid falls through your jaws!")); + (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx); + } + + /* Combine / Reorder the pack (later) */ + p_ptr->notice |= (PN_COMBINE | PN_REORDER); + + if (!(object_is_aware(q_ptr))) + { + chg_virtue(V_PATIENCE, -1); + chg_virtue(V_CHANCE, 1); + chg_virtue(V_KNOWLEDGE, -1); + } + + /* The item has been tried */ + object_tried(q_ptr); + + /* An identification was made */ + if (ident && !object_is_aware(q_ptr)) + { + object_aware(q_ptr); + gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev); + } + + /* Window stuff */ + p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); + + /* Potions can feed the player */ + switch (p_ptr->mimic_form) + { + case MIMIC_NONE: + switch (p_ptr->prace) + { + case RACE_VAMPIRE: + (void)set_food(p_ptr->food + (q_ptr->pval / 10)); + break; + case RACE_SKELETON: + /* Do nothing */ + break; + case RACE_GOLEM: + case RACE_ZOMBIE: + case RACE_DEMON: + case RACE_SPECTRE: + set_food(p_ptr->food + ((q_ptr->pval) / 20)); + break; + case RACE_ANDROID: + if (q_ptr->tval == TV_FLASK) + { + msg_print(_("ƒIƒCƒ‹‚ð•â‹‹‚µ‚½B", "You replenish yourself with the oil.")); + set_food(p_ptr->food + 5000); + } + else + { + set_food(p_ptr->food + ((q_ptr->pval) / 20)); + } + break; + case RACE_ENT: + msg_print(_("…•ª‚ðŽæ‚荞‚ñ‚¾B", "You are moistened.")); + set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1)); + break; + default: + (void)set_food(p_ptr->food + q_ptr->pval); + break; + } + break; + case MIMIC_DEMON: + case MIMIC_DEMON_LORD: + set_food(p_ptr->food + ((q_ptr->pval) / 20)); + break; + case MIMIC_VAMPIRE: + (void)set_food(p_ptr->food + (q_ptr->pval / 10)); + break; + default: + (void)set_food(p_ptr->food + q_ptr->pval); + break; + } +} + + +/*! + * @brief ƒIƒuƒWƒFƒNƒg‚ðƒvƒŒƒCƒ„[‚ªˆù‚Þ‚±‚Æ‚ª‚Å‚«‚é‚©‚ð”»’è‚·‚é / + * Hook to determine if an object can be quaffed + * @param o_ptr ”»’肵‚½‚¢ƒIƒuƒWƒFƒNƒg‚̍\‘¢‘ÌŽQÆƒ|ƒCƒ“ƒ^ + * @return ˆù‚Þ‚±‚Æ‚ª‰Â”\‚È‚ç‚ÎTRUE‚ð•Ô‚· + */ +static bool item_tester_hook_quaff(object_type *o_ptr) +{ + if (o_ptr->tval == TV_POTION) return TRUE; + + if (prace_is_(RACE_ANDROID)) + { + if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL) + return TRUE; + } + return FALSE; +} + + +/*! + * @brief –ò‚ðˆù‚ÞƒRƒ}ƒ“ƒh‚̃ƒCƒ“ƒ‹[ƒ`ƒ“ / + * Quaff some potion (from the pack or floor) + * @return ‚È‚µ + */ +void do_cmd_quaff_potion(void) +{ + OBJECT_IDX item; + cptr q, s; + + if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN)) + { + set_action(ACTION_NONE); + } + + /* Restrict choices to potions */ + item_tester_hook = item_tester_hook_quaff; + + /* Get an item */ + q = _("‚Ç‚Ì–ò‚ðˆù‚Ý‚Ü‚·‚©? ", "Quaff which potion? "); + s = _("ˆù‚ß‚é–ò‚ª‚È‚¢B", "You have no potions to quaff."); + + if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; + + /* Quaff the potion */ + do_cmd_quaff_potion_aux(item); +} diff --git a/src/cmd-quaff.h b/src/cmd-quaff.h new file mode 100644 index 000000000..48a0b2632 --- /dev/null +++ b/src/cmd-quaff.h @@ -0,0 +1,4 @@ + +extern void do_cmd_quaff_potion(void); +extern void do_cmd_quaff_potion_aux(int item); + diff --git a/src/cmd6.c b/src/cmd6.c index c0441d811..9e13144ca 100644 --- a/src/cmd6.c +++ b/src/cmd6.c @@ -55,742 +55,10 @@ #include "angband.h" #include "selfinfo.h" #include "cmd-eat.h" +#include "cmd-quaff.h" -/*! - * @brief 薬を飲むコマンドのサブルーチン / - * Quaff a potion (from the pack or the floor) - * @param item 飲む薬オブジェクトの所持品ID - * @return なし - */ -static void do_cmd_quaff_potion_aux(int item) -{ - int ident, lev; - object_type *o_ptr; - object_type forge; - object_type *q_ptr; - - - /* Take a turn */ - p_ptr->energy_use = 100; - - if (world_player) - { - if (flush_failure) flush(); - msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from a bottle.")); - - sound(SOUND_FAIL); - return; - } - - if (music_singing_any()) stop_singing(); - if (hex_spelling_any()) - { - if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all(); - } - - /* Get the item (in the pack) */ - if (item >= 0) - { - o_ptr = &inventory[item]; - } - - /* Get the item (on the floor) */ - else - { - o_ptr = &o_list[0 - item]; - } - - /* Get local object */ - q_ptr = &forge; - - /* Obtain a local object */ - object_copy(q_ptr, o_ptr); - - /* Single object */ - q_ptr->number = 1; - - /* Reduce and describe inventory */ - if (item >= 0) - { - inven_item_increase(item, -1); - inven_item_describe(item); - inven_item_optimize(item); - } - - /* Reduce and describe floor item */ - else - { - floor_item_increase(0 - item, -1); - floor_item_describe(0 - item); - floor_item_optimize(0 - item); - } - - /* Sound */ - sound(SOUND_QUAFF); - - - /* Not identified yet */ - ident = FALSE; - - /* Object level */ - lev = k_info[q_ptr->k_idx].level; - - /* Analyze the potion */ - if (q_ptr->tval == TV_POTION) - { - switch (q_ptr->sval) - { - /* 飲みごたえをオリジナルより細かく表現 */ - case SV_POTION_WATER: - msg_print(_("口の中がさっぱりした。", "")); - msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty.")); - ident = TRUE; - break; - - case SV_POTION_APPLE_JUICE: - msg_print(_("甘くてサッパリとしていて、とてもおいしい。", "")); - msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty.")); - ident = TRUE; - break; - - case SV_POTION_SLIME_MOLD: - msg_print(_("なんとも不気味な味だ。", "")); - msg_print(_("のどの渇きが少しおさまった。", "You feel less thirsty.")); - ident = TRUE; - break; - - case SV_POTION_SLOWNESS: - if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE; - break; - - case SV_POTION_SALT_WATER: - msg_print(_("うぇ!思わず吐いてしまった。", "The potion makes you vomit!")); - - if (!(prace_is_(RACE_GOLEM) || - prace_is_(RACE_ZOMBIE) || - prace_is_(RACE_DEMON) || - prace_is_(RACE_ANDROID) || - prace_is_(RACE_SPECTRE) || - (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))) - { - /* Only living creatures get thirsty */ - (void)set_food(PY_FOOD_STARVE - 1); - } - - (void)set_poisoned(0); - (void)set_paralyzed(p_ptr->paralyzed + 4); - ident = TRUE; - break; - - case SV_POTION_POISON: - if (!(p_ptr->resist_pois || IS_OPPOSE_POIS())) - { - if (set_poisoned(p_ptr->poisoned + randint0(15) + 10)) - { - ident = TRUE; - } - } - break; - - case SV_POTION_BLINDNESS: - if (!p_ptr->resist_blind) - { - if (set_blind(p_ptr->blind + randint0(100) + 100)) - { - ident = TRUE; - } - } - break; - - case SV_POTION_CONFUSION: /* Booze */ - if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1); - else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN; - if (!p_ptr->resist_conf) - { - if (set_confused(randint0(20) + 15)) - { - ident = TRUE; - } - } - - if (!p_ptr->resist_chaos) - { - if (one_in_(2)) - { - if (set_image(p_ptr->image + randint0(150) + 150)) - { - ident = TRUE; - } - } - if (one_in_(13) && (p_ptr->pclass != CLASS_MONK)) - { - ident = TRUE; - if (one_in_(3)) lose_all_info(); - else wiz_dark(); - (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); - wiz_dark(); - msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head...")); - msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!")); - } - } - break; - - case SV_POTION_SLEEP: - if (!p_ptr->free_act) - { - msg_print(_("あなたは眠ってしまった。", "You fall asleep.")); - - if (ironman_nightmare) - { - msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind.")); - - /* Have some nightmares */ - sanity_blast(NULL, FALSE); - } - if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4)) - { - ident = TRUE; - } - } - break; - - case SV_POTION_LOSE_MEMORIES: - if (!p_ptr->hold_exp && (p_ptr->exp > 0)) - { - msg_print(_("過去の記憶が薄れていく気がする。", "You feel your memories fade.")); - chg_virtue(V_KNOWLEDGE, -5); - - lose_exp(p_ptr->exp / 4); - ident = TRUE; - } - break; - - case SV_POTION_RUINATION: - msg_print(_("身も心も弱ってきて、精気が抜けていくようだ。", "Your nerves and muscles feel weak and lifeless!")); - take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("破滅の薬", "a potion of Ruination"), -1); - - (void)dec_stat(A_DEX, 25, TRUE); - (void)dec_stat(A_WIS, 25, TRUE); - (void)dec_stat(A_CON, 25, TRUE); - (void)dec_stat(A_STR, 25, TRUE); - (void)dec_stat(A_CHR, 25, TRUE); - (void)dec_stat(A_INT, 25, TRUE); - ident = TRUE; - break; - - case SV_POTION_DEC_STR: - if (do_dec_stat(A_STR)) ident = TRUE; - break; - - case SV_POTION_DEC_INT: - if (do_dec_stat(A_INT)) ident = TRUE; - break; - - case SV_POTION_DEC_WIS: - if (do_dec_stat(A_WIS)) ident = TRUE; - break; - - case SV_POTION_DEC_DEX: - if (do_dec_stat(A_DEX)) ident = TRUE; - break; - - case SV_POTION_DEC_CON: - if (do_dec_stat(A_CON)) ident = TRUE; - break; - - case SV_POTION_DEC_CHR: - if (do_dec_stat(A_CHR)) ident = TRUE; - break; - - case SV_POTION_DETONATIONS: - msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!")); - take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1); - - (void)set_stun(p_ptr->stun + 75); - (void)set_cut(p_ptr->cut + 5000); - ident = TRUE; - break; - - case SV_POTION_DEATH: - chg_virtue(V_VITALITY, -1); - chg_virtue(V_UNLIFE, 5); - msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body.")); - take_hit(DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"), -1); - ident = TRUE; - break; - - case SV_POTION_INFRAVISION: - if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE)) - { - ident = TRUE; - } - break; - - case SV_POTION_DETECT_INVIS: - if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE)) - { - ident = TRUE; - } - break; - - case SV_POTION_SLOW_POISON: - if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE; - break; - - case SV_POTION_CURE_POISON: - if (set_poisoned(0)) ident = TRUE; - break; - - case SV_POTION_BOLDNESS: - if (set_afraid(0)) ident = TRUE; - break; - - case SV_POTION_SPEED: - if (!p_ptr->fast) - { - if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE; - } - else - { - (void)set_fast(p_ptr->fast + 5, FALSE); - } - break; - - case SV_POTION_RESIST_HEAT: - if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE)) - { - ident = TRUE; - } - break; - - case SV_POTION_RESIST_COLD: - if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE)) - { - ident = TRUE; - } - break; - - case SV_POTION_HEROISM: - if (set_afraid(0)) ident = TRUE; - if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE; - if (hp_player(10)) ident = TRUE; - break; - - case SV_POTION_BESERK_STRENGTH: - if (set_afraid(0)) ident = TRUE; - if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE; - if (hp_player(30)) ident = TRUE; - break; - - case SV_POTION_CURE_LIGHT: - if (hp_player(damroll(2, 8))) ident = TRUE; - if (set_blind(0)) ident = TRUE; - if (set_cut(p_ptr->cut - 10)) ident = TRUE; - if (set_shero(0,TRUE)) ident = TRUE; - break; - - case SV_POTION_CURE_SERIOUS: - if (hp_player(damroll(4, 8))) ident = TRUE; - if (set_blind(0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; - if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE; - if (set_shero(0,TRUE)) ident = TRUE; - break; - - case SV_POTION_CURE_CRITICAL: - if (hp_player(damroll(6, 8))) ident = TRUE; - if (set_blind(0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; - if (set_poisoned(0)) ident = TRUE; - if (set_stun(0)) ident = TRUE; - if (set_cut(0)) ident = TRUE; - if (set_shero(0,TRUE)) ident = TRUE; - break; - - case SV_POTION_HEALING: - if (hp_player(300)) ident = TRUE; - if (set_blind(0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; - if (set_poisoned(0)) ident = TRUE; - if (set_stun(0)) ident = TRUE; - if (set_cut(0)) ident = TRUE; - if (set_shero(0,TRUE)) ident = TRUE; - break; - - case SV_POTION_STAR_HEALING: - if (hp_player(1200)) ident = TRUE; - if (set_blind(0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; - if (set_poisoned(0)) ident = TRUE; - if (set_stun(0)) ident = TRUE; - if (set_cut(0)) ident = TRUE; - if (set_shero(0,TRUE)) ident = TRUE; - break; - - case SV_POTION_LIFE: - chg_virtue(V_VITALITY, 1); - chg_virtue(V_UNLIFE, -5); - msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!")); - restore_level(); - (void)set_poisoned(0); - (void)set_blind(0); - (void)set_confused(0); - (void)set_image(0); - (void)set_stun(0); - (void)set_cut(0); - (void)do_res_stat(A_STR); - (void)do_res_stat(A_CON); - (void)do_res_stat(A_DEX); - (void)do_res_stat(A_WIS); - (void)do_res_stat(A_INT); - (void)do_res_stat(A_CHR); - (void)set_shero(0,TRUE); - update_stuff(); - hp_player(5000); - ident = TRUE; - break; - - case SV_POTION_RESTORE_MANA: - if (p_ptr->pclass == CLASS_MAGIC_EATER) - { - int i; - for (i = 0; i < EATER_EXT*2; i++) - { - p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3; - if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i]*EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE; - } - for (; i < EATER_EXT*3; i++) - { - KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2); - p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE*3 : p_ptr->magic_num2[i]*EATER_ROD_CHARGE/3)*k_info[k_idx].pval; - if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0; - } - msg_print(_("頭がハッキリとした。", "You feel your head clear.")); - p_ptr->window |= (PW_PLAYER); - ident = TRUE; - } - else if (p_ptr->csp < p_ptr->msp) - { - p_ptr->csp = p_ptr->msp; - p_ptr->csp_frac = 0; - msg_print(_("頭がハッキリとした。", "You feel your head clear.")); - - p_ptr->redraw |= (PR_MANA); - p_ptr->window |= (PW_PLAYER); - p_ptr->window |= (PW_SPELL); - ident = TRUE; - } - if (set_shero(0,TRUE)) ident = TRUE; - break; - - case SV_POTION_RESTORE_EXP: - if (restore_level()) ident = TRUE; - break; - - case SV_POTION_RES_STR: - if (do_res_stat(A_STR)) ident = TRUE; - break; - - case SV_POTION_RES_INT: - if (do_res_stat(A_INT)) ident = TRUE; - break; - - case SV_POTION_RES_WIS: - if (do_res_stat(A_WIS)) ident = TRUE; - break; - - case SV_POTION_RES_DEX: - if (do_res_stat(A_DEX)) ident = TRUE; - break; - - case SV_POTION_RES_CON: - if (do_res_stat(A_CON)) ident = TRUE; - break; - - case SV_POTION_RES_CHR: - if (do_res_stat(A_CHR)) ident = TRUE; - break; - - case SV_POTION_INC_STR: - if (do_inc_stat(A_STR)) ident = TRUE; - break; - - case SV_POTION_INC_INT: - if (do_inc_stat(A_INT)) ident = TRUE; - break; - - case SV_POTION_INC_WIS: - if (do_inc_stat(A_WIS)) ident = TRUE; - break; - - case SV_POTION_INC_DEX: - if (do_inc_stat(A_DEX)) ident = TRUE; - break; - - case SV_POTION_INC_CON: - if (do_inc_stat(A_CON)) ident = TRUE; - break; - - case SV_POTION_INC_CHR: - if (do_inc_stat(A_CHR)) ident = TRUE; - break; - - case SV_POTION_AUGMENTATION: - if (do_inc_stat(A_STR)) ident = TRUE; - if (do_inc_stat(A_INT)) ident = TRUE; - if (do_inc_stat(A_WIS)) ident = TRUE; - if (do_inc_stat(A_DEX)) ident = TRUE; - if (do_inc_stat(A_CON)) ident = TRUE; - if (do_inc_stat(A_CHR)) ident = TRUE; - break; - - case SV_POTION_ENLIGHTENMENT: - msg_print(_("自分の置かれている状況が脳裏に浮かんできた...", "An image of your surroundings forms in your mind...")); - chg_virtue(V_KNOWLEDGE, 1); - chg_virtue(V_ENLIGHTEN, 1); - wiz_lite(FALSE); - ident = TRUE; - break; - - case SV_POTION_STAR_ENLIGHTENMENT: - msg_print(_("更なる啓蒙を感じた...", "You begin to feel more enlightened...")); - chg_virtue(V_KNOWLEDGE, 1); - chg_virtue(V_ENLIGHTEN, 2); - msg_print(NULL); - wiz_lite(FALSE); - (void)do_inc_stat(A_INT); - (void)do_inc_stat(A_WIS); - (void)detect_traps(DETECT_RAD_DEFAULT, TRUE); - (void)detect_doors(DETECT_RAD_DEFAULT); - (void)detect_stairs(DETECT_RAD_DEFAULT); - (void)detect_treasure(DETECT_RAD_DEFAULT); - (void)detect_objects_gold(DETECT_RAD_DEFAULT); - (void)detect_objects_normal(DETECT_RAD_DEFAULT); - identify_pack(); - self_knowledge(); - ident = TRUE; - break; - - case SV_POTION_SELF_KNOWLEDGE: - msg_print(_("自分自身のことが少しは分かった気がする...", "You begin to know yourself a little better...")); - msg_print(NULL); - self_knowledge(); - ident = TRUE; - break; - - case SV_POTION_EXPERIENCE: - if (p_ptr->prace == RACE_ANDROID) break; - chg_virtue(V_ENLIGHTEN, 1); - if (p_ptr->exp < PY_MAX_EXP) - { - s32b ee = (p_ptr->exp / 2) + 10; - if (ee > 100000L) ee = 100000L; - msg_print(_("更に経験を積んだような気がする。", "You feel more experienced.")); - gain_exp(ee); - ident = TRUE; - } - break; - - case SV_POTION_RESISTANCE: - (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE); - (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE); - (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE); - (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE); - (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE); - ident = TRUE; - break; - - case SV_POTION_CURING: - if (hp_player(50)) ident = TRUE; - if (set_blind(0)) ident = TRUE; - if (set_poisoned(0)) ident = TRUE; - if (set_confused(0)) ident = TRUE; - if (set_stun(0)) ident = TRUE; - if (set_cut(0)) ident = TRUE; - if (set_image(0)) ident = TRUE; - break; - - case SV_POTION_INVULNERABILITY: - (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE); - ident = TRUE; - break; - - case SV_POTION_NEW_LIFE: - do_cmd_rerate(FALSE); - get_max_stats(); - p_ptr->update |= PU_BONUS; - lose_all_mutations(); - ident = TRUE; - break; - - case SV_POTION_NEO_TSUYOSHI: - (void)set_image(0); - (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE); - ident = TRUE; - break; - - case SV_POTION_TSUYOSHI: - msg_print(_("「オクレ兄さん!」", "Brother OKURE!")); - msg_print(NULL); - p_ptr->tsuyoshi = 1; - (void)set_tsuyoshi(0, TRUE); - if (!p_ptr->resist_chaos) - { - (void)set_image(50 + randint1(50)); - } - ident = TRUE; - break; - - case SV_POTION_POLYMORPH: - if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23)) - { - lose_all_mutations(); - } - else - { - do - { - if (one_in_(2)) - { - if(gain_random_mutation(0)) ident = TRUE; - } - else if (lose_mutation(0)) ident = TRUE; - } while(!ident || one_in_(2)); - } - break; - } - } - - if (prace_is_(RACE_SKELETON)) - { - msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!")); - (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx); - } - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - if (!(object_is_aware(q_ptr))) - { - chg_virtue(V_PATIENCE, -1); - chg_virtue(V_CHANCE, 1); - chg_virtue(V_KNOWLEDGE, -1); - } - - /* The item has been tried */ - object_tried(q_ptr); - - /* An identification was made */ - if (ident && !object_is_aware(q_ptr)) - { - object_aware(q_ptr); - gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev); - } - - /* Window stuff */ - p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); - - /* Potions can feed the player */ - switch (p_ptr->mimic_form) - { - case MIMIC_NONE: - switch (p_ptr->prace) - { - case RACE_VAMPIRE: - (void)set_food(p_ptr->food + (q_ptr->pval / 10)); - break; - case RACE_SKELETON: - /* Do nothing */ - break; - case RACE_GOLEM: - case RACE_ZOMBIE: - case RACE_DEMON: - case RACE_SPECTRE: - set_food(p_ptr->food + ((q_ptr->pval) / 20)); - break; - case RACE_ANDROID: - if (q_ptr->tval == TV_FLASK) - { - msg_print(_("オイルを補給した。", "You replenish yourself with the oil.")); - set_food(p_ptr->food + 5000); - } - else - { - set_food(p_ptr->food + ((q_ptr->pval) / 20)); - } - break; - case RACE_ENT: - msg_print(_("水分を取り込んだ。", "You are moistened.")); - set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1)); - break; - default: - (void)set_food(p_ptr->food + q_ptr->pval); - break; - } - break; - case MIMIC_DEMON: - case MIMIC_DEMON_LORD: - set_food(p_ptr->food + ((q_ptr->pval) / 20)); - break; - case MIMIC_VAMPIRE: - (void)set_food(p_ptr->food + (q_ptr->pval / 10)); - break; - default: - (void)set_food(p_ptr->food + q_ptr->pval); - break; - } -} - - -/*! - * @brief オブジェクトをプレイヤーが飲むことができるかを判定する / - * Hook to determine if an object can be quaffed - * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ - * @return 飲むことが可能ならばTRUEを返す - */ -static bool item_tester_hook_quaff(object_type *o_ptr) -{ - if (o_ptr->tval == TV_POTION) return TRUE; - - if (prace_is_(RACE_ANDROID)) - { - if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL) - return TRUE; - } - return FALSE; -} - - -/*! - * @brief 薬を飲むコマンドのメインルーチン / - * Quaff some potion (from the pack or floor) - * @return なし - */ -void do_cmd_quaff_potion(void) -{ - OBJECT_IDX item; - cptr q, s; - - if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN)) - { - set_action(ACTION_NONE); - } - - /* Restrict choices to potions */ - item_tester_hook = item_tester_hook_quaff; - - /* Get an item */ - q = _("どの薬を飲みますか? ", "Quaff which potion? "); - s = _("飲める薬がない。", "You have no potions to quaff."); - - if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; - - /* Quaff the potion */ - do_cmd_quaff_potion_aux(item); -} - /*! * @brief 巻物を読むコマンドのサブルーチン diff --git a/src/externs.h b/src/externs.h index edc933677..15cf88423 100644 --- a/src/externs.h +++ b/src/externs.h @@ -804,7 +804,6 @@ extern void do_cmd_pet_dismiss(void); extern void do_cmd_pet(void); /* cmd6.c */ -extern void do_cmd_quaff_potion(void); extern void do_cmd_read_scroll(void); extern void do_cmd_aim_wand(void); extern void do_cmd_use_staff(void);