OSDN Git Service

[Refactor] #38862 Moved angband.h, h-*.h and system-variables.c/h
[hengband/hengband.git] / src / cmd / cmd-quaff.c
index 96dc9ee..0b2e22c 100644 (file)
@@ -6,34 +6,36 @@
  * cmd6.cより分離。
  */
 
-#include "angband.h"
+#include "system/angband.h"
 #include "util.h"
+#include "main/sound-definitions-table.h"
 
-#include "birth.h"
+#include "birth/birth.h"
 #include "selfinfo.h"
-#include "object-hook.h"
-#include "mutation.h"
+#include "object/object-hook.h"
+#include "mutation/mutation.h"
 #include "avatar.h"
-#include "spells.h"
+#include "spell/spells2.h"
+#include "spell/spells3.h"
 #include "spells-status.h"
-#include "player-effects.h"
-#include "player-status.h"
-#include "player-damage.h"
-#include "player-race.h"
+#include "player/player-effects.h"
+#include "player/player-status.h"
+#include "player/player-damage.h"
+#include "player/mimic-info-table.h"
 #include "player-inventory.h"
-#include "realm-hex.h"
-#include "realm-song.h"
+#include "realm/realm-hex.h"
 #include "spells-floor.h"
-#include "object-broken.h"
+#include "object/object-broken.h"
 #include "cmd-basic.h"
-#include "floor.h"
-#include "objectkind.h"
-#include "view-mainwindow.h"
-#include "player-class.h"
+#include "floor/floor.h"
+#include "object/object-kind.h"
+#include "view/display-main-window.h"
+#include "player/player-class.h"
 
 /*!
  * @brief 薬を飲むコマンドのサブルーチン /
  * Quaff a potion (from the pack or the floor)
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param item 飲む薬オブジェクトの所持品ID
  * @return なし
  */
@@ -50,7 +52,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
        if (creature_ptr->timewalk)
        {
                if (flush_failure) flush();
-               msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from a bottle."));
+               msg_print(_("瓶から水が流れ出てこない!", "The potion doesn't flow out from the bottle."));
 
                sound(SOUND_FAIL);
                return;
@@ -59,32 +61,17 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
        if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
        if (hex_spelling_any(creature_ptr))
        {
-               if (!hex_spelling(HEX_INHAIL)) stop_hex_spell_all();
+               if (!hex_spelling(creature_ptr, HEX_INHAIL)) stop_hex_spell_all(creature_ptr);
        }
 
-       o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item);
+       o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
        q_ptr = &forge;
        object_copy(q_ptr, o_ptr);
 
        /* Single object */
        q_ptr->number = 1;
 
-       /* Reduce and describe creature_ptr->inventory_list */
-       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);
-       }
-
+       vary_item(creature_ptr, item, -1);
        sound(SOUND_QUAFF);
 
 
@@ -142,7 +129,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
                        break;
 
                case SV_POTION_POISON:
-                       if (!(creature_ptr->resist_pois || IS_OPPOSE_POIS()))
+                       if (!(creature_ptr->resist_pois || is_oppose_pois(creature_ptr)))
                        {
                                if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(15) + 10))
                                {
@@ -296,15 +283,15 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
                        break;
 
                case SV_POTION_HEROISM:
-                       ident = heroism(p_ptr, 25);
+                       ident = heroism(creature_ptr, 25);
                        break;
 
                case SV_POTION_BESERK_STRENGTH:
-                       ident = berserk(p_ptr, randint1(25) + 25);
+                       ident = berserk(creature_ptr, randint1(25) + 25);
                        break;
 
                case SV_POTION_CURE_LIGHT:
-                       ident = cure_light_wounds(p_ptr, 2, 8);
+                       ident = cure_light_wounds(creature_ptr, 2, 8);
                        break;
 
                case SV_POTION_CURE_SERIOUS:
@@ -312,15 +299,15 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
                        break;
 
                case SV_POTION_CURE_CRITICAL:
-                       ident = cure_critical_wounds(damroll(6, 8));
+                       ident = cure_critical_wounds(creature_ptr, damroll(6, 8));
                        break;
 
                case SV_POTION_HEALING:
-                       ident = cure_critical_wounds(300);
+                       ident = cure_critical_wounds(creature_ptr, 300);
                        break;
 
                case SV_POTION_STAR_HEALING:
-                       ident = cure_critical_wounds(1200);
+                       ident = cure_critical_wounds(creature_ptr, 1200);
                        break;
 
                case SV_POTION_LIFE:
@@ -408,13 +395,13 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
                        wiz_lite(creature_ptr, FALSE);
                        (void)do_inc_stat(creature_ptr, A_INT);
                        (void)do_inc_stat(creature_ptr, 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();
+                       (void)detect_traps(creature_ptr, DETECT_RAD_DEFAULT, TRUE);
+                       (void)detect_doors(creature_ptr, DETECT_RAD_DEFAULT);
+                       (void)detect_stairs(creature_ptr, DETECT_RAD_DEFAULT);
+                       (void)detect_treasure(creature_ptr, DETECT_RAD_DEFAULT);
+                       (void)detect_objects_gold(creature_ptr, DETECT_RAD_DEFAULT);
+                       (void)detect_objects_normal(creature_ptr, DETECT_RAD_DEFAULT);
+                       identify_pack(creature_ptr);
                        self_knowledge(creature_ptr);
                        ident = TRUE;
                        break;
@@ -506,7 +493,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
        if (PRACE_IS_(creature_ptr, RACE_SKELETON))
        {
                msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
-               (void)potion_smash_effect(0, creature_ptr->y, creature_ptr->x, q_ptr->k_idx);
+               (void)potion_smash_effect(creature_ptr, 0, creature_ptr->y, creature_ptr->x, q_ptr->k_idx);
        }
        creature_ptr->update |= (PU_COMBINE | PU_REORDER);
 
@@ -523,7 +510,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
        /* An identification was made */
        if (ident && !object_is_aware(q_ptr))
        {
-               object_aware(q_ptr);
+               object_aware(creature_ptr, q_ptr);
                gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
        }