OSDN Git Service

* [Refactor] #37353 プレイヤーの飲む処理を cmd-quaff.c/h に分離。 / Separate player's quaff command...
authorDeskull <deskull@users.sourceforge.jp>
Fri, 7 Sep 2018 12:18:18 +0000 (21:18 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Fri, 7 Sep 2018 12:18:18 +0000 (21:18 +0900)
Hengband_vcs2015/Hengband/Hengband.vcxproj
Hengband_vcs2015/Hengband/Hengband.vcxproj.filters
src/cmd-eat.c
src/cmd-quaff.c [new file with mode: 0644]
src/cmd-quaff.h [new file with mode: 0644]
src/cmd6.c
src/externs.h

index 0bae6d8..9fcdd45 100644 (file)
     <ClCompile Include="..\..\src\cave.c" />\r
     <ClCompile Include="..\..\src\chuukei.c" />\r
     <ClCompile Include="..\..\src\cmd-eat.c" />\r
+    <ClCompile Include="..\..\src\cmd-quaff.c" />\r
     <ClCompile Include="..\..\src\cmd1.c" />\r
     <ClCompile Include="..\..\src\cmd2.c" />\r
     <ClCompile Include="..\..\src\cmd3.c" />\r
   <ItemGroup>\r
     <ClInclude Include="..\..\src\angband.h" />\r
     <ClInclude Include="..\..\src\cmd-eat.h" />\r
+    <ClInclude Include="..\..\src\cmd-quaff.h" />\r
     <ClInclude Include="..\..\src\defines.h" />\r
     <ClInclude Include="..\..\src\externs.h" />\r
     <ClInclude Include="..\..\src\generate.h" />\r
index eba75ee..8f084b5 100644 (file)
     <ClCompile Include="..\..\src\cmd-eat.c">\r
       <Filter>Source</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\src\cmd-quaff.c">\r
+      <Filter>Source</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\src\angband.h">\r
     <ClInclude Include="..\..\src\cmd-eat.h">\r
       <Filter>Header</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\src\cmd-quaff.h">\r
+      <Filter>Header</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="..\..\src\angband.rc" />\r
index 565b161..590fc5a 100644 (file)
@@ -1,7 +1,7 @@
 /*!\r
  * @file cmd-eat.c\r
- * @brief \83v\83\8c\83C\83\84\81[\82Ì\90H\8e\96\82É\8aÖ\82·\82é\83R\83}\83\93\83h\8eÀ\91\95\r
- * @date 2014/01/27\r
+ * @brief \83v\83\8c\83C\83\84\81[\82Ì\90H\82×\82é\83R\83}\83\93\83h\8eÀ\91\95\r
+ * @date 2018/09/07\r
  * @details\r
  * cmd6.c\82æ\82è\95ª\97£\81B\r
  */\r
diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c
new file mode 100644 (file)
index 0000000..6f12e5d
--- /dev/null
@@ -0,0 +1,744 @@
+/*!\r
+ * @file cmd-quaff.c\r
+ * @brief \83v\83\8c\83C\83\84\81[\82Ì\88ù\82Þ\83R\83}\83\93\83h\8eÀ\91\95\r
+ * @date 2018/09/07\r
+ * @details\r
+ * cmd6.c\82æ\82è\95ª\97£\81B\r
+ */\r
+\r
+\r
+#include "angband.h"\r
+#include "selfinfo.h"\r
+\r
+/*!\r
+ * @brief \96ò\82ð\88ù\82Þ\83R\83}\83\93\83h\82Ì\83T\83u\83\8b\81[\83`\83\93 /\r
+ * Quaff a potion (from the pack or the floor)\r
+ * @param item \88ù\82Þ\96ò\83I\83u\83W\83F\83N\83g\82Ì\8f\8a\8e\9d\95iID\r
+ * @return \82È\82µ\r
+ */\r
+void do_cmd_quaff_potion_aux(int item)\r
+{\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
+\r
+       if (world_player)\r
+       {\r
+               if (flush_failure) flush();\r
+               msg_print(_("\95r\82©\82ç\90\85\82ª\97¬\82ê\8fo\82Ä\82±\82È\82¢\81I", "The potion doesn't flow out from a bottle."));\r
+\r
+               sound(SOUND_FAIL);\r
+               return;\r
+       }\r
+\r
+       if (music_singing_any()) stop_singing();\r
+       if (hex_spelling_any())\r
+       {\r
+               if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();\r
+       }\r
+\r
+       /* Get the item (in the pack) */\r
+       if (item >= 0)\r
+       {\r
+               o_ptr = &inventory[item];\r
+       }\r
+\r
+       /* Get the item (on the floor) */\r
+       else\r
+       {\r
+               o_ptr = &o_list[0 - item];\r
+       }\r
+\r
+       /* Get local object */\r
+       q_ptr = &forge;\r
+\r
+       /* Obtain a local object */\r
+       object_copy(q_ptr, o_ptr);\r
+\r
+       /* Single object */\r
+       q_ptr->number = 1;\r
+\r
+       /* Reduce and describe inventory */\r
+       if (item >= 0)\r
+       {\r
+               inven_item_increase(item, -1);\r
+               inven_item_describe(item);\r
+               inven_item_optimize(item);\r
+       }\r
+\r
+       /* Reduce and describe floor item */\r
+       else\r
+       {\r
+               floor_item_increase(0 - item, -1);\r
+               floor_item_describe(0 - item);\r
+               floor_item_optimize(0 - item);\r
+       }\r
+\r
+       /* Sound */\r
+       sound(SOUND_QUAFF);\r
+\r
+\r
+       /* Not identified yet */\r
+       ident = FALSE;\r
+\r
+       /* Object level */\r
+       lev = k_info[q_ptr->k_idx].level;\r
+\r
+       /* Analyze the potion */\r
+       if (q_ptr->tval == TV_POTION)\r
+       {\r
+               switch (q_ptr->sval)\r
+               {\r
+                       /* \88ù\82Ý\82²\82½\82¦\82ð\83I\83\8a\83W\83i\83\8b\82æ\82è\8d×\82©\82­\95\\8c» */\r
+               case SV_POTION_WATER:\r
+                       msg_print(_("\8cû\82Ì\92\86\82ª\82³\82Á\82Ï\82è\82µ\82½\81B", ""));\r
+                       msg_print(_("\82Ì\82Ç\82Ì\8a\89\82«\82ª\8f­\82µ\82¨\82³\82Ü\82Á\82½\81B", "You feel less thirsty."));\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_APPLE_JUICE:\r
+                       msg_print(_("\8aÃ\82­\82Ä\83T\83b\83p\83\8a\82Æ\82µ\82Ä\82¢\82Ä\81A\82Æ\82Ä\82à\82¨\82¢\82µ\82¢\81B", ""));\r
+                       msg_print(_("\82Ì\82Ç\82Ì\8a\89\82«\82ª\8f­\82µ\82¨\82³\82Ü\82Á\82½\81B", "You feel less thirsty."));\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_SLIME_MOLD:\r
+                       msg_print(_("\82È\82ñ\82Æ\82à\95s\8bC\96¡\82È\96¡\82¾\81B", ""));\r
+                       msg_print(_("\82Ì\82Ç\82Ì\8a\89\82«\82ª\8f­\82µ\82¨\82³\82Ü\82Á\82½\81B", "You feel less thirsty."));\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_SLOWNESS:\r
+                       if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_SALT_WATER:\r
+                       msg_print(_("\82¤\82¥\81I\8ev\82í\82¸\93f\82¢\82Ä\82µ\82Ü\82Á\82½\81B", "The potion makes you vomit!"));\r
+\r
+                       if (!(prace_is_(RACE_GOLEM) ||\r
+                             prace_is_(RACE_ZOMBIE) ||\r
+                             prace_is_(RACE_DEMON) ||\r
+                             prace_is_(RACE_ANDROID) ||\r
+                             prace_is_(RACE_SPECTRE) ||\r
+                             (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))\r
+                       {\r
+                               /* Only living creatures get thirsty */\r
+                               (void)set_food(PY_FOOD_STARVE - 1);\r
+                       }\r
+\r
+                       (void)set_poisoned(0);\r
+                       (void)set_paralyzed(p_ptr->paralyzed + 4);\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_POISON:\r
+                       if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))\r
+                       {\r
+                               if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))\r
+                               {\r
+                                       ident = TRUE;\r
+                               }\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_BLINDNESS:\r
+                       if (!p_ptr->resist_blind)\r
+                       {\r
+                               if (set_blind(p_ptr->blind + randint0(100) + 100))\r
+                               {\r
+                                       ident = TRUE;\r
+                               }\r
+                       }\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(_("\92m\82ç\82È\82¢\8fê\8f\8a\82Å\96Ú\82ª\90Á\82ß\82½\81B\93ª\92É\82ª\82·\82é\81B", "You wake up somewhere with a sore head..."));\r
+                                       msg_print(_("\89½\82à\8ev\82¢\8fo\82¹\82È\82¢\81B\82Ç\82¤\82â\82Á\82Ä\82±\82±\82Ö\97\88\82½\82Ì\82©\82à\95ª\82©\82ç\82È\82¢\81I", "You can't remember a thing, or how you got here!"));\r
+                               }\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_SLEEP:\r
+                       if (!p_ptr->free_act)\r
+                       {\r
+                               msg_print(_("\82 \82È\82½\82Í\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81B", "You fall asleep."));\r
+\r
+                               if (ironman_nightmare)\r
+                               {\r
+                                       msg_print(_("\8b°\82ë\82µ\82¢\8cõ\8ci\82ª\93ª\82É\95\82\82©\82ñ\82Å\82«\82½\81B", "A horrible vision enters your mind."));\r
+\r
+                                       /* Have some nightmares */\r
+                                       sanity_blast(NULL, FALSE);\r
+                               }\r
+                               if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))\r
+                               {\r
+                                       ident = TRUE;\r
+                               }\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_LOSE_MEMORIES:\r
+                       if (!p_ptr->hold_exp && (p_ptr->exp > 0))\r
+                       {\r
+                               msg_print(_("\89ß\8b\8e\82Ì\8bL\89¯\82ª\94\96\82ê\82Ä\82¢\82­\8bC\82ª\82·\82é\81B", "You feel your memories fade."));\r
+                               chg_virtue(V_KNOWLEDGE, -5);\r
+\r
+                               lose_exp(p_ptr->exp / 4);\r
+                               ident = TRUE;\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_RUINATION:\r
+                       msg_print(_("\90g\82à\90S\82à\8eã\82Á\82Ä\82«\82Ä\81A\90¸\8bC\82ª\94²\82¯\82Ä\82¢\82­\82æ\82¤\82¾\81B", "Your nerves and muscles feel weak and lifeless!"));\r
+                       take_hit(DAMAGE_LOSELIFE, damroll(10, 10), _("\94j\96Å\82Ì\96ò", "a potion of Ruination"), -1);\r
+\r
+                       (void)dec_stat(A_DEX, 25, TRUE);\r
+                       (void)dec_stat(A_WIS, 25, TRUE);\r
+                       (void)dec_stat(A_CON, 25, TRUE);\r
+                       (void)dec_stat(A_STR, 25, TRUE);\r
+                       (void)dec_stat(A_CHR, 25, TRUE);\r
+                       (void)dec_stat(A_INT, 25, TRUE);\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_DEC_STR:\r
+                       if (do_dec_stat(A_STR)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_DEC_INT:\r
+                       if (do_dec_stat(A_INT)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_DEC_WIS:\r
+                       if (do_dec_stat(A_WIS)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_DEC_DEX:\r
+                       if (do_dec_stat(A_DEX)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_DEC_CON:\r
+                       if (do_dec_stat(A_CON)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_DEC_CHR:\r
+                       if (do_dec_stat(A_CHR)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_DETONATIONS:\r
+                       msg_print(_("\91Ì\82Ì\92\86\82Å\8c\83\82µ\82¢\94\9a\94­\82ª\8bN\82«\82½\81I", "Massive explosions rupture your body!"));\r
+                       take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("\94\9a\94­\82Ì\96ò", "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
+                       break;\r
+\r
+               case SV_POTION_DEATH:\r
+                       chg_virtue(V_VITALITY, -1);\r
+                       chg_virtue(V_UNLIFE, 5);\r
+                       msg_print(_("\8e\80\82Ì\97\\8a´\82ª\91Ì\92\86\82ð\8bì\82¯\82ß\82®\82Á\82½\81B", "A feeling of Death flows through your body."));\r
+                       take_hit(DAMAGE_LOSELIFE, 5000, _("\8e\80\82Ì\96ò", "a potion of Death"), -1);\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_INFRAVISION:\r
+                       if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))\r
+                       {\r
+                               ident = TRUE;\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_DETECT_INVIS:\r
+                       if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))\r
+                       {\r
+                               ident = TRUE;\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_SLOW_POISON:\r
+                       if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_CURE_POISON:\r
+                       if (set_poisoned(0)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_BOLDNESS:\r
+                       if (set_afraid(0)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_SPEED:\r
+                       if (!p_ptr->fast)\r
+                       {\r
+                               if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;\r
+                       }\r
+                       else\r
+                       {\r
+                               (void)set_fast(p_ptr->fast + 5, FALSE);\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_RESIST_HEAT:\r
+                       if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))\r
+                       {\r
+                               ident = TRUE;\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_RESIST_COLD:\r
+                       if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))\r
+                       {\r
+                               ident = TRUE;\r
+                       }\r
+                       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
+                       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
+                       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
+                       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
+                       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
+                       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
+                       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
+                       break;\r
+\r
+               case SV_POTION_LIFE:\r
+                       chg_virtue(V_VITALITY, 1);\r
+                       chg_virtue(V_UNLIFE, -5);\r
+                       msg_print(_("\91Ì\92\86\82É\90\96½\97Í\82ª\96\9e\82¿\82 \82Ó\82ê\82Ä\82«\82½\81I", "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
+                       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(_("\93ª\82ª\83n\83b\83L\83\8a\82Æ\82µ\82½\81B", "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(_("\93ª\82ª\83n\83b\83L\83\8a\82Æ\82µ\82½\81B", "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
+                       break;\r
+\r
+               case SV_POTION_RESTORE_EXP:\r
+                       if (restore_level()) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_RES_STR:\r
+                       if (do_res_stat(A_STR)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_RES_INT:\r
+                       if (do_res_stat(A_INT)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_RES_WIS:\r
+                       if (do_res_stat(A_WIS)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_RES_DEX:\r
+                       if (do_res_stat(A_DEX)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_RES_CON:\r
+                       if (do_res_stat(A_CON)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_RES_CHR:\r
+                       if (do_res_stat(A_CHR)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_INC_STR:\r
+                       if (do_inc_stat(A_STR)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_INC_INT:\r
+                       if (do_inc_stat(A_INT)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_INC_WIS:\r
+                       if (do_inc_stat(A_WIS)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_INC_DEX:\r
+                       if (do_inc_stat(A_DEX)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_INC_CON:\r
+                       if (do_inc_stat(A_CON)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_INC_CHR:\r
+                       if (do_inc_stat(A_CHR)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_AUGMENTATION:\r
+                       if (do_inc_stat(A_STR)) ident = TRUE;\r
+                       if (do_inc_stat(A_INT)) ident = TRUE;\r
+                       if (do_inc_stat(A_WIS)) ident = TRUE;\r
+                       if (do_inc_stat(A_DEX)) ident = TRUE;\r
+                       if (do_inc_stat(A_CON)) ident = TRUE;\r
+                       if (do_inc_stat(A_CHR)) ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_ENLIGHTENMENT:\r
+                       msg_print(_("\8e©\95ª\82Ì\92u\82©\82ê\82Ä\82¢\82é\8fó\8bµ\82ª\94]\97 \82É\95\82\82©\82ñ\82Å\82«\82½...", "An image of your surroundings forms in your mind..."));\r
+                       chg_virtue(V_KNOWLEDGE, 1);\r
+                       chg_virtue(V_ENLIGHTEN, 1);\r
+                       wiz_lite(FALSE);\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_STAR_ENLIGHTENMENT:\r
+                       msg_print(_("\8dX\82È\82é\8c[\96Ö\82ð\8a´\82\82½...", "You begin to feel more enlightened..."));\r
+                       chg_virtue(V_KNOWLEDGE, 1);\r
+                       chg_virtue(V_ENLIGHTEN, 2);\r
+                       msg_print(NULL);\r
+                       wiz_lite(FALSE);\r
+                       (void)do_inc_stat(A_INT);\r
+                       (void)do_inc_stat(A_WIS);\r
+                       (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);\r
+                       (void)detect_doors(DETECT_RAD_DEFAULT);\r
+                       (void)detect_stairs(DETECT_RAD_DEFAULT);\r
+                       (void)detect_treasure(DETECT_RAD_DEFAULT);\r
+                       (void)detect_objects_gold(DETECT_RAD_DEFAULT);\r
+                       (void)detect_objects_normal(DETECT_RAD_DEFAULT);\r
+                       identify_pack();\r
+                       self_knowledge();\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_SELF_KNOWLEDGE:\r
+                       msg_print(_("\8e©\95ª\8e©\90g\82Ì\82±\82Æ\82ª\8f­\82µ\82Í\95ª\82©\82Á\82½\8bC\82ª\82·\82é...", "You begin to know yourself a little better..."));\r
+                       msg_print(NULL);\r
+                       self_knowledge();\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_EXPERIENCE:\r
+                       if (p_ptr->prace == RACE_ANDROID) break;\r
+                       chg_virtue(V_ENLIGHTEN, 1);\r
+                       if (p_ptr->exp < PY_MAX_EXP)\r
+                       {\r
+                               s32b ee = (p_ptr->exp / 2) + 10;\r
+                               if (ee > 100000L) ee = 100000L;\r
+                               msg_print(_("\8dX\82É\8co\8c±\82ð\90Ï\82ñ\82¾\82æ\82¤\82È\8bC\82ª\82·\82é\81B", "You feel more experienced."));\r
+                               gain_exp(ee);\r
+                               ident = TRUE;\r
+                       }\r
+                       break;\r
+\r
+               case SV_POTION_RESISTANCE:\r
+                       (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);\r
+                       (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);\r
+                       (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);\r
+                       (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);\r
+                       (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);\r
+                       ident = TRUE;\r
+                       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
+                       break;\r
+\r
+               case SV_POTION_INVULNERABILITY:\r
+                       (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_NEW_LIFE:\r
+                       do_cmd_rerate(FALSE);\r
+                       get_max_stats();\r
+                       p_ptr->update |= PU_BONUS;\r
+                       lose_all_mutations();\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_NEO_TSUYOSHI:\r
+                       (void)set_image(0);\r
+                       (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);\r
+                       ident = TRUE;\r
+                       break;\r
+\r
+               case SV_POTION_TSUYOSHI:\r
+                       msg_print(_("\81u\83I\83N\83\8c\8cZ\82³\82ñ\81I\81v", "Brother OKURE!"));\r
+                       msg_print(NULL);\r
+                       p_ptr->tsuyoshi = 1;\r
+                       (void)set_tsuyoshi(0, TRUE);\r
+                       if (!p_ptr->resist_chaos)\r
+                       {\r
+                               (void)set_image(50 + randint1(50));\r
+                       }\r
+                       ident = TRUE;\r
+                       break;\r
+               \r
+               case SV_POTION_POLYMORPH:\r
+                       if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))\r
+                       {\r
+                               lose_all_mutations();\r
+                       }\r
+                       else\r
+                       {\r
+                               do\r
+                               {\r
+                                       if (one_in_(2))\r
+                                       {\r
+                                               if(gain_random_mutation(0)) ident = TRUE;\r
+                                       }\r
+                                       else if (lose_mutation(0)) ident = TRUE;\r
+                               } while(!ident || one_in_(2));\r
+                       }\r
+                       break;\r
+               }\r
+       }\r
+\r
+       if (prace_is_(RACE_SKELETON))\r
+       {\r
+               msg_print(_("\89t\91Ì\82Ì\88ê\95\94\82Í\82 \82È\82½\82Ì\83A\83S\82ð\91f\92Ê\82è\82µ\82Ä\97\8e\82¿\82½\81I", "Some of the fluid falls through your jaws!"));\r
+               (void)potion_smash_effect(0, p_ptr->y, p_ptr->x, q_ptr->k_idx);\r
+       }\r
+\r
+       /* Combine / Reorder the pack (later) */\r
+       p_ptr->notice |= (PN_COMBINE | PN_REORDER);\r
+\r
+       if (!(object_is_aware(q_ptr)))\r
+       {\r
+               chg_virtue(V_PATIENCE, -1);\r
+               chg_virtue(V_CHANCE, 1);\r
+               chg_virtue(V_KNOWLEDGE, -1);\r
+       }\r
+\r
+       /* The item has been tried */\r
+       object_tried(q_ptr);\r
+\r
+       /* An identification was made */\r
+       if (ident && !object_is_aware(q_ptr))\r
+       {\r
+               object_aware(q_ptr);\r
+               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
+       switch (p_ptr->mimic_form)\r
+       {\r
+       case MIMIC_NONE:\r
+               switch (p_ptr->prace)\r
+               {\r
+                       case RACE_VAMPIRE:\r
+                               (void)set_food(p_ptr->food + (q_ptr->pval / 10));\r
+                               break;\r
+                       case RACE_SKELETON:\r
+                               /* Do nothing */\r
+                               break;\r
+                       case RACE_GOLEM:\r
+                       case RACE_ZOMBIE:\r
+                       case RACE_DEMON:\r
+                       case RACE_SPECTRE:\r
+                               set_food(p_ptr->food + ((q_ptr->pval) / 20));\r
+                               break;\r
+                       case RACE_ANDROID:\r
+                               if (q_ptr->tval == TV_FLASK)\r
+                               {\r
+                                       msg_print(_("\83I\83C\83\8b\82ð\95â\8b\8b\82µ\82½\81B", "You replenish yourself with the oil."));\r
+                                       set_food(p_ptr->food + 5000);\r
+                               }\r
+                               else\r
+                               {\r
+                                       set_food(p_ptr->food + ((q_ptr->pval) / 20));\r
+                               }\r
+                               break;\r
+                       case RACE_ENT:\r
+                               msg_print(_("\90\85\95ª\82ð\8eæ\82è\8d\9e\82ñ\82¾\81B", "You are moistened."));\r
+                               set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));\r
+                               break;\r
+                       default:\r
+                               (void)set_food(p_ptr->food + q_ptr->pval);\r
+                               break;\r
+               }\r
+               break;\r
+       case MIMIC_DEMON:\r
+       case MIMIC_DEMON_LORD:\r
+               set_food(p_ptr->food + ((q_ptr->pval) / 20));\r
+               break;\r
+       case MIMIC_VAMPIRE:\r
+               (void)set_food(p_ptr->food + (q_ptr->pval / 10));\r
+               break;\r
+       default:\r
+               (void)set_food(p_ptr->food + q_ptr->pval);\r
+               break;\r
+       }\r
+}\r
+\r
+\r
+/*!\r
+ * @brief \83I\83u\83W\83F\83N\83g\82ð\83v\83\8c\83C\83\84\81[\82ª\88ù\82Þ\82±\82Æ\82ª\82Å\82«\82é\82©\82ð\94»\92è\82·\82é /\r
+ * Hook to determine if an object can be quaffed\r
+ * @param o_ptr \94»\92è\82µ\82½\82¢\83I\83u\83W\83F\83N\83g\82Ì\8d\\91¢\91Ì\8eQ\8fÆ\83|\83C\83\93\83^\r
+ * @return \88ù\82Þ\82±\82Æ\82ª\89Â\94\\82È\82ç\82ÎTRUE\82ð\95Ô\82·\r
+ */\r
+static bool item_tester_hook_quaff(object_type *o_ptr)\r
+{\r
+       if (o_ptr->tval == TV_POTION) return TRUE;\r
+\r
+       if (prace_is_(RACE_ANDROID))\r
+       {\r
+               if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)\r
+                       return TRUE;\r
+       }\r
+       return FALSE;\r
+}\r
+\r
+\r
+/*!\r
+ * @brief \96ò\82ð\88ù\82Þ\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93 /\r
+ * Quaff some potion (from the pack or floor)\r
+ * @return \82È\82µ\r
+ */\r
+void do_cmd_quaff_potion(void)\r
+{\r
+       OBJECT_IDX item;\r
+       cptr q, s;\r
+\r
+       if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))\r
+       {\r
+               set_action(ACTION_NONE);\r
+       }\r
+\r
+       /* Restrict choices to potions */\r
+       item_tester_hook = item_tester_hook_quaff;\r
+\r
+       /* Get an item */\r
+       q = _("\82Ç\82Ì\96ò\82ð\88ù\82Ý\82Ü\82·\82©? ", "Quaff which potion? ");\r
+       s = _("\88ù\82ß\82é\96ò\82ª\82È\82¢\81B", "You have no potions to quaff.");\r
+\r
+       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;\r
+\r
+       /* Quaff the potion */\r
+       do_cmd_quaff_potion_aux(item);\r
+}\r
diff --git a/src/cmd-quaff.h b/src/cmd-quaff.h
new file mode 100644 (file)
index 0000000..48a0b26
--- /dev/null
@@ -0,0 +1,4 @@
+\r
+extern void do_cmd_quaff_potion(void);\r
+extern void do_cmd_quaff_potion_aux(int item);\r
+\r
index c0441d8..9e13144 100644 (file)
 #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 巻物を読むコマンドのサブルーチン
index edc9336..15cf884 100644 (file)
@@ -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);