OSDN Git Service

[Refactor] #37353 爆発の薬の効果を detonation() に分離。 / Separate implementation of 'potion...
[hengband/hengband.git] / src / cmd-quaff.c
index 5ace44e..4d93aa0 100644 (file)
@@ -9,6 +9,7 @@
 #include "angband.h"\r
 #include "selfinfo.h"\r
 #include "object-hook.h"\r
+#include "mutation.h"\r
 \r
 /*!\r
  * @brief 薬を飲むコマンドのサブルーチン /\r
@@ -151,37 +152,8 @@ void do_cmd_quaff_potion_aux(INVENTORY_IDX item)
                        }\r
                        break;\r
 \r
-               case SV_POTION_CONFUSION: /* Booze */\r
-                       if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);\r
-                       else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;\r
-                       if (!p_ptr->resist_conf)\r
-                       {\r
-                               if (set_confused(randint0(20) + 15))\r
-                               {\r
-                                       ident = TRUE;\r
-                               }\r
-                       }\r
-\r
-                       if (!p_ptr->resist_chaos)\r
-                       {\r
-                               if (one_in_(2))\r
-                               {\r
-                                       if (set_image(p_ptr->image + randint0(150) + 150))\r
-                                       {\r
-                                               ident = TRUE;\r
-                                       }\r
-                               }\r
-                               if (one_in_(13) && (p_ptr->pclass != CLASS_MONK))\r
-                               {\r
-                                       ident = TRUE;\r
-                                       if (one_in_(3)) lose_all_info();\r
-                                       else wiz_dark();\r
-                                       (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);\r
-                                       wiz_dark();\r
-                                       msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));\r
-                                       msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!"));\r
-                               }\r
-                       }\r
+               case SV_POTION_BOOZE:\r
+                       ident = booze(p_ptr);\r
                        break;\r
 \r
                case SV_POTION_SLEEP:\r
@@ -252,12 +224,7 @@ void do_cmd_quaff_potion_aux(INVENTORY_IDX item)
                        break;\r
 \r
                case SV_POTION_DETONATIONS:\r
-                       msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));\r
-                       take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);\r
-\r
-                       (void)set_stun(p_ptr->stun + 75);\r
-                       (void)set_cut(p_ptr->cut + 5000);\r
-                       ident = TRUE;\r
+                       ident = detonation(p_ptr);\r
                        break;\r
 \r
                case SV_POTION_DEATH:\r
@@ -616,7 +583,19 @@ void do_cmd_quaff_potion_aux(INVENTORY_IDX item)
 void do_cmd_quaff_potion(void)\r
 {\r
        OBJECT_IDX item;\r
-       cptr q, s;\r
+       concptr q, s;\r
+\r
+       if (p_ptr->wild_mode)\r
+       {\r
+               return;\r
+       }\r
+\r
+       if (p_ptr->inside_arena)\r
+       {\r
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));\r
+               msg_print(NULL);\r
+               return;\r
+       }\r
 \r
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))\r
        {\r
@@ -629,7 +608,7 @@ void do_cmd_quaff_potion(void)
        q = _("どの薬を飲みますか? ", "Quaff which potion? ");\r
        s = _("飲める薬がない。", "You have no potions to quaff.");\r
 \r
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
+       if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
 \r
        /* Quaff the potion */\r
        do_cmd_quaff_potion_aux(item);\r