OSDN Git Service

[Refactor] #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / cmd-quaff.c
index 8aa25cb..b25e23e 100644 (file)
  * @param item 飲む薬オブジェクトの所持品ID\r
  * @return なし\r
  */\r
-void do_cmd_quaff_potion_aux(int item)\r
+void do_cmd_quaff_potion_aux(INVENTORY_IDX item)\r
 {\r
-       int         ident, lev;\r
+       bool ident;\r
+       DEPTH lev;\r
        object_type *o_ptr;\r
        object_type forge;\r
        object_type *q_ptr;\r
 \r
 \r
-       /* Take a turn */\r
-       p_ptr->energy_use = 100;\r
-\r
        if (world_player)\r
        {\r
                if (flush_failure) flush();\r
@@ -79,7 +77,6 @@ void do_cmd_quaff_potion_aux(int item)
                floor_item_optimize(0 - item);\r
        }\r
 \r
-       /* Sound */\r
        sound(SOUND_QUAFF);\r
 \r
 \r
@@ -329,9 +326,7 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_BESERK_STRENGTH:\r
-                       if (set_afraid(0)) ident = TRUE;\r
-                       if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;\r
-                       if (hp_player(30)) ident = TRUE;\r
+                       ident = berserk(randint1(25) + 25);\r
                        break;\r
 \r
                case SV_POTION_CURE_LIGHT:\r
@@ -343,15 +338,15 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_CURE_CRITICAL:\r
-                       ident = cure_serious_wounds(6, 8);\r
+                       ident = cure_critical_wounds(damroll(6, 8));\r
                        break;\r
 \r
                case SV_POTION_HEALING:\r
-                       ident = greater_healing(300);\r
+                       ident = cure_critical_wounds(300);\r
                        break;\r
 \r
                case SV_POTION_STAR_HEALING:\r
-                       ident = greater_healing(1200);\r
+                       ident = cure_critical_wounds(1200);\r
                        break;\r
 \r
                case SV_POTION_LIFE:\r
@@ -359,36 +354,7 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_RESTORE_MANA:\r
-                       if (p_ptr->pclass == CLASS_MAGIC_EATER)\r
-                       {\r
-                               int i;\r
-                               for (i = 0; i < EATER_EXT*2; i++)\r
-                               {\r
-                                       p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;\r
-                                       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;\r
-                               }\r
-                               for (; i < EATER_EXT*3; i++)\r
-                               {\r
-                                       KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);\r
-                                       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;\r
-                                       if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;\r
-                               }\r
-                               msg_print(_("頭がハッキリとした。", "You feel your head clear."));\r
-                               p_ptr->window |= (PW_PLAYER);\r
-                               ident = TRUE;\r
-                       }\r
-                       else if (p_ptr->csp < p_ptr->msp)\r
-                       {\r
-                               p_ptr->csp = p_ptr->msp;\r
-                               p_ptr->csp_frac = 0;\r
-                               msg_print(_("頭がハッキリとした。", "You feel your head clear."));\r
-\r
-                               p_ptr->redraw |= (PR_MANA);\r
-                               p_ptr->window |= (PW_PLAYER);\r
-                               p_ptr->window |= (PW_SPELL);\r
-                               ident = TRUE;\r
-                       }\r
-                       if (set_shero(0,TRUE)) ident = TRUE;\r
+                       ident = restore_mana(TRUE);\r
                        break;\r
 \r
                case SV_POTION_RESTORE_EXP:\r
@@ -509,13 +475,7 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_CURING:\r
-                       if (hp_player(50)) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_poisoned(0)) ident = TRUE;\r
-                       if (set_confused(0)) ident = TRUE;\r
-                       if (set_stun(0)) ident = TRUE;\r
-                       if (set_cut(0)) ident = TRUE;\r
-                       if (set_image(0)) ident = TRUE;\r
+                       if (true_healing(50)) ident = TRUE;\r
                        break;\r
 \r
                case SV_POTION_INVULNERABILITY:\r
@@ -595,7 +555,6 @@ void do_cmd_quaff_potion_aux(int item)
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);\r
        }\r
 \r
-       /* Window stuff */\r
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);\r
 \r
        /* Potions can feed the player */\r
@@ -669,7 +628,6 @@ void do_cmd_quaff_potion(void)
        /* Restrict choices to potions */\r
        item_tester_hook = item_tester_hook_quaff;\r
 \r
-       /* Get an item */\r
        q = _("どの薬を飲みますか? ", "Quaff which potion? ");\r
        s = _("飲める薬がない。", "You have no potions to quaff.");\r
 \r