OSDN Git Service

[Refactor] #37287 #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / cmd-quaff.c
index ed60311..57f6c1c 100644 (file)
  */\r
 void do_cmd_quaff_potion_aux(int item)\r
 {\r
-       int         ident, lev;\r
+       int ident, 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
+       p_ptr->energy_use = 100; /* Take a turn */\r
 \r
        if (world_player)\r
        {\r
@@ -325,116 +323,39 @@ void do_cmd_quaff_potion_aux(int item)
                        break;\r
 \r
                case SV_POTION_HEROISM:\r
-                       if (set_afraid(0)) ident = TRUE;\r
-                       if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;\r
-                       if (hp_player(10)) ident = TRUE;\r
+                       ident = heroism(25);\r
                        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
-                       if (hp_player(damroll(2, 8))) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_cut(p_ptr->cut - 10)) ident = TRUE;\r
-                       if (set_shero(0,TRUE)) ident = TRUE;\r
+                       ident = cure_light_wounds(2, 8);\r
                        break;\r
 \r
                case SV_POTION_CURE_SERIOUS:\r
-                       if (hp_player(damroll(4, 8))) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_confused(0)) ident = TRUE;\r
-                       if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;\r
-                       if (set_shero(0,TRUE)) ident = TRUE;\r
+                       ident = cure_serious_wounds(4, 8);\r
                        break;\r
 \r
                case SV_POTION_CURE_CRITICAL:\r
-                       if (hp_player(damroll(6, 8))) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_confused(0)) ident = TRUE;\r
-                       if (set_poisoned(0)) ident = TRUE;\r
-                       if (set_stun(0)) ident = TRUE;\r
-                       if (set_cut(0)) ident = TRUE;\r
-                       if (set_shero(0,TRUE)) ident = TRUE;\r
+                       ident = cure_critical_wounds(damroll(6, 8));\r
                        break;\r
 \r
                case SV_POTION_HEALING:\r
-                       if (hp_player(300)) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_confused(0)) ident = TRUE;\r
-                       if (set_poisoned(0)) ident = TRUE;\r
-                       if (set_stun(0)) ident = TRUE;\r
-                       if (set_cut(0)) ident = TRUE;\r
-                       if (set_shero(0,TRUE)) ident = TRUE;\r
+                       ident = cure_critical_wounds(300);\r
                        break;\r
 \r
                case SV_POTION_STAR_HEALING:\r
-                       if (hp_player(1200)) ident = TRUE;\r
-                       if (set_blind(0)) ident = TRUE;\r
-                       if (set_confused(0)) ident = TRUE;\r
-                       if (set_poisoned(0)) ident = TRUE;\r
-                       if (set_stun(0)) ident = TRUE;\r
-                       if (set_cut(0)) ident = TRUE;\r
-                       if (set_shero(0,TRUE)) ident = TRUE;\r
+                       ident = cure_critical_wounds(1200);\r
                        break;\r
 \r
                case SV_POTION_LIFE:\r
-                       chg_virtue(V_VITALITY, 1);\r
-                       chg_virtue(V_UNLIFE, -5);\r
-                       msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));\r
-                       restore_level();\r
-                       (void)set_poisoned(0);\r
-                       (void)set_blind(0);\r
-                       (void)set_confused(0);\r
-                       (void)set_image(0);\r
-                       (void)set_stun(0);\r
-                       (void)set_cut(0);\r
-                       (void)do_res_stat(A_STR);\r
-                       (void)do_res_stat(A_CON);\r
-                       (void)do_res_stat(A_DEX);\r
-                       (void)do_res_stat(A_WIS);\r
-                       (void)do_res_stat(A_INT);\r
-                       (void)do_res_stat(A_CHR);\r
-                       (void)set_shero(0,TRUE);\r
-                       update_stuff();\r
-                       hp_player(5000);\r
-                       ident = TRUE;\r
+                       ident = life_stream(TRUE, TRUE);\r
                        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
@@ -555,13 +476,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