OSDN Git Service

[Refactor] #38862 Moved object*.c/h to object/
[hengband/hengband.git] / src / cmd / cmd-zaprod.c
index 3bcf7a8..2379df6 100644 (file)
@@ -1,23 +1,27 @@
 #include "angband.h"
 #include "util.h"
+#include "main/sound-definitions-table.h"
 
 #include "avatar.h"
 #include "player-status.h"
 #include "player-effects.h"
 #include "player-class.h"
 #include "player-inventory.h"
-#include "objectkind.h"
-#include "object-hook.h"
-#include "spells.h"
+#include "object/object-kind.h"
+#include "object/object-hook.h"
+#include "spell/spells-type.h"
 #include "spells-status.h"
 #include "spells-floor.h"
 #include "cmd-basic.h"
-#include "floor.h"
+#include "floor/floor.h"
 #include "targeting.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
+#include "spell/spells2.h"
+#include "spell/spells3.h"
 
 /*!
  * @brief ロッドの効果を発動する
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param sval オブジェクトのsval
  * @param dir 発動目標の方向ID
  * @param use_charge チャージを消費したかどうかを返す参照ポインタ
@@ -46,18 +50,18 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
 
        case SV_ROD_DETECT_DOOR:
        {
-               if (detect_doors(detect_rad)) ident = TRUE;
-               if (detect_stairs(detect_rad)) ident = TRUE;
+               if (detect_doors(creature_ptr, detect_rad)) ident = TRUE;
+               if (detect_stairs(creature_ptr, detect_rad)) ident = TRUE;
                break;
        }
 
        case SV_ROD_IDENTIFY:
        {
                if (powerful) {
-                       if (!identify_fully(FALSE)) *use_charge = FALSE;
+                       if (!identify_fully(creature_ptr, FALSE, 0)) *use_charge = FALSE;
                }
                else {
-                       if (!ident_spell(creature_ptr, FALSE)) *use_charge = FALSE;
+                       if (!ident_spell(creature_ptr, FALSE, 0)) *use_charge = FALSE;
                }
                ident = TRUE;
                break;
@@ -72,7 +76,7 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
 
        case SV_ROD_ILLUMINATION:
        {
-               if (lite_area(damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
+               if (lite_area(creature_ptr, damroll(2, 8), (powerful ? 4 : 2))) ident = TRUE;
                break;
        }
 
@@ -85,14 +89,14 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
 
        case SV_ROD_DETECTION:
        {
-               detect_all(detect_rad);
+               detect_all(creature_ptr, detect_rad);
                ident = TRUE;
                break;
        }
 
        case SV_ROD_PROBING:
        {
-               probing();
+               probing(creature_ptr);
                ident = TRUE;
                break;
        }
@@ -125,21 +129,21 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
 
        case SV_ROD_PESTICIDE:
        {
-               if (dispel_monsters(powerful ? 8 : 4)) ident = TRUE;
+               if (dispel_monsters(creature_ptr, powerful ? 8 : 4)) ident = TRUE;
                break;
        }
 
        case SV_ROD_TELEPORT_AWAY:
        {
                int distance = MAX_SIGHT * (powerful ? 8 : 5);
-               if (teleport_monster(dir, distance)) ident = TRUE;
+               if (teleport_monster(creature_ptr, dir, distance)) ident = TRUE;
                break;
        }
 
        case SV_ROD_DISARMING:
        {
-               if (disarm_trap(dir)) ident = TRUE;
-               if (powerful && disarm_traps_touch()) ident = TRUE;
+               if (disarm_trap(creature_ptr, dir)) ident = TRUE;
+               if (powerful && disarm_traps_touch(creature_ptr)) ident = TRUE;
                break;
        }
 
@@ -147,59 +151,59 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
        {
                HIT_POINT dam = damroll((powerful ? 12 : 6), 8);
                msg_print(_("青く輝く光線が放たれた。", "A line of blue shimmering light appears."));
-               (void)lite_line(dir, dam);
+               (void)lite_line(creature_ptr, dir, dam);
                ident = TRUE;
                break;
        }
 
        case SV_ROD_SLEEP_MONSTER:
        {
-               if (sleep_monster(dir, lev)) ident = TRUE;
+               if (sleep_monster(creature_ptr, dir, lev)) ident = TRUE;
                break;
        }
 
        case SV_ROD_SLOW_MONSTER:
        {
-               if (slow_monster(dir, lev)) ident = TRUE;
+               if (slow_monster(creature_ptr, dir, lev)) ident = TRUE;
                break;
        }
 
        case SV_ROD_HYPODYNAMIA:
        {
-               if (hypodynamic_bolt(dir, 70 + 3 * lev / 2)) ident = TRUE;
+               if (hypodynamic_bolt(creature_ptr, dir, 70 + 3 * lev / 2)) ident = TRUE;
                break;
        }
 
        case SV_ROD_POLYMORPH:
        {
-               if (poly_monster(dir, lev)) ident = TRUE;
+               if (poly_monster(creature_ptr, dir, lev)) ident = TRUE;
                break;
        }
 
        case SV_ROD_ACID_BOLT:
        {
-               fire_bolt_or_beam(10, GF_ACID, dir, damroll(6 + lev / 7, 8));
+               fire_bolt_or_beam(creature_ptr, 10, GF_ACID, dir, damroll(6 + lev / 7, 8));
                ident = TRUE;
                break;
        }
 
        case SV_ROD_ELEC_BOLT:
        {
-               fire_bolt_or_beam(10, GF_ELEC, dir, damroll(4 + lev / 9, 8));
+               fire_bolt_or_beam(creature_ptr, 10, GF_ELEC, dir, damroll(4 + lev / 9, 8));
                ident = TRUE;
                break;
        }
 
        case SV_ROD_FIRE_BOLT:
        {
-               fire_bolt_or_beam(10, GF_FIRE, dir, damroll(7 + lev / 6, 8));
+               fire_bolt_or_beam(creature_ptr, 10, GF_FIRE, dir, damroll(7 + lev / 6, 8));
                ident = TRUE;
                break;
        }
 
        case SV_ROD_COLD_BOLT:
        {
-               fire_bolt_or_beam(10, GF_COLD, dir, damroll(5 + lev / 8, 8));
+               fire_bolt_or_beam(creature_ptr, 10, GF_COLD, dir, damroll(5 + lev / 8, 8));
                ident = TRUE;
                break;
        }
@@ -242,13 +246,13 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
        case SV_ROD_STONE_TO_MUD:
        {
                HIT_POINT dam = powerful ? 40 + randint1(60) : 20 + randint1(30);
-               if (wall_to_mud(dir, dam)) ident = TRUE;
+               if (wall_to_mud(creature_ptr, dir, dam)) ident = TRUE;
                break;
        }
 
        case SV_ROD_AGGRAVATE:
        {
-               aggravate_monsters(0);
+               aggravate_monsters(creature_ptr, 0);
                ident = TRUE;
                break;
        }
@@ -256,9 +260,11 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d
        return ident;
 }
 
+
 /*!
 * @brief ロッドを使うコマンドのサブルーチン /
 * Activate (zap) a Rod
+* @param creature_ptr プレーヤーへの参照ポインタ
 * @param item 使うオブジェクトの所持品ID
 * @return なし
 * @details
@@ -281,7 +287,7 @@ void exe_zap_rod(player_type *creature_ptr, INVENTORY_IDX item)
 
        object_kind *k_ptr;
 
-       o_ptr = REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item);
+       o_ptr = REF_ITEM(creature_ptr, creature_ptr->current_floor_ptr, item);
 
        /* Mega-Hack -- refuse to zap a pile from the ground */
        if ((item < 0) && (o_ptr->number > 1))
@@ -296,7 +302,7 @@ void exe_zap_rod(player_type *creature_ptr, INVENTORY_IDX item)
                !object_is_aware(o_ptr))
        {
                /* Get a direction, allow cancel */
-               if (!get_aim_dir(&dir)) return;
+               if (!get_aim_dir(creature_ptr, &dir)) return;
        }
 
 
@@ -377,15 +383,17 @@ void exe_zap_rod(player_type *creature_ptr, INVENTORY_IDX item)
        /* Successfully determined the object function */
        if (ident && !object_is_aware(o_ptr))
        {
-               object_aware(o_ptr);
+               object_aware(creature_ptr, o_ptr);
                gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
        }
 
        creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 }
 
+
 /*!
 * @brief ロッドを使うコマンドのメインルーチン /
+* @param creature_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
 void do_cmd_zap_rod(player_type *creature_ptr)
@@ -408,7 +416,7 @@ void do_cmd_zap_rod(player_type *creature_ptr)
        q = _("どのロッドを振りますか? ", "Zap which rod? ");
        s = _("使えるロッドがない。", "You have no rod to zap.");
 
-       if (!choose_object(p_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_ROD)) return;
+       if (!choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_ROD)) return;
 
        /* Zap the rod */
        exe_zap_rod(creature_ptr, item);