OSDN Git Service
(root)
/
hengband
/
hengband.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Refactor] #38997 choose_object() に player_type * 引数を追加し宣言を player-inventory.h に移動.
[hengband/hengband.git]
/
src
/
cmd-zaprod.c
diff --git
a/src/cmd-zaprod.c
b/src/cmd-zaprod.c
index
595747a
..
f8fc2a3
100644
(file)
--- a/
src/cmd-zaprod.c
+++ b/
src/cmd-zaprod.c
@@
-1,8
+1,20
@@
#include "angband.h"
#include "angband.h"
+#include "util.h"
+
#include "avatar.h"
#include "avatar.h"
-#include "spells-status.h"
#include "player-status.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 "object-hook.h"
+#include "spells.h"
+#include "spells-status.h"
+#include "spells-floor.h"
+#include "cmd-basic.h"
+#include "floor.h"
+#include "targeting.h"
+#include "view-mainwindow.h"
/*!
* @brief ロッドの効果を発動する
/*!
* @brief ロッドの効果を発動する
@@
-13,10
+25,10
@@
* @param magic 魔道具術上の処理ならばTRUE
* @return 発動により効果内容が確定したならばTRUEを返す
*/
* @param magic 魔道具術上の処理ならばTRUE
* @return 発動により効果内容が確定したならばTRUEを返す
*/
-int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool powerful, bool magic)
+int rod_effect(
player_type *creature_ptr,
OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool powerful, bool magic)
{
int ident = FALSE;
{
int ident = FALSE;
- PLAYER_LEVEL lev = powerful ?
p_ptr->lev * 2 : p
_ptr->lev;
+ PLAYER_LEVEL lev = powerful ?
creature_ptr->lev * 2 : creature
_ptr->lev;
POSITION detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
POSITION rad = powerful ? 3 : 2;
POSITION detect_rad = powerful ? DETECT_RAD_DEFAULT * 3 / 2 : DETECT_RAD_DEFAULT;
POSITION rad = powerful ? 3 : 2;
@@
-53,7
+65,7
@@
int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool
case SV_ROD_RECALL:
{
case SV_ROD_RECALL:
{
- if (!recall_player(
p
_ptr, randint0(21) + 15)) *use_charge = FALSE;
+ if (!recall_player(
creature
_ptr, randint0(21) + 15)) *use_charge = FALSE;
ident = TRUE;
break;
}
ident = TRUE;
break;
}
@@
-88,7
+100,7
@@
int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool
case SV_ROD_CURING:
{
if (true_healing(0)) ident = TRUE;
case SV_ROD_CURING:
{
if (true_healing(0)) ident = TRUE;
- if (set_shero(0, TRUE)) ident = TRUE;
+ if (set_shero(
creature_ptr,
0, TRUE)) ident = TRUE;
break;
}
break;
}
@@
-100,14
+112,14
@@
int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool
case SV_ROD_RESTORATION:
{
case SV_ROD_RESTORATION:
{
- if(restore_level()) ident = TRUE;
+ if(restore_level(
creature_ptr
)) ident = TRUE;
if(restore_all_status()) ident = TRUE;
break;
}
case SV_ROD_SPEED:
{
if(restore_all_status()) ident = TRUE;
break;
}
case SV_ROD_SPEED:
{
- if (set_fast(randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
+ if (set_fast(
creature_ptr,
randint1(30) + (powerful ? 30 : 15), FALSE)) ident = TRUE;
break;
}
break;
}
@@
-257,7
+269,7
@@
int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool
* pvals are defined for each rod in k_info. -LM-
* </pre>
*/
* pvals are defined for each rod in k_info. -LM-
* </pre>
*/
-void
do_cmd_zap_rod_aux(
INVENTORY_IDX item)
+void
exe_zap_rod(player_type *creature_ptr,
INVENTORY_IDX item)
{
int ident, chance, lev, fail;
DIRECTION dir = 0;
{
int ident, chance, lev, fail;
DIRECTION dir = 0;
@@
-269,18
+281,7
@@
void do_cmd_zap_rod_aux(INVENTORY_IDX item)
object_kind *k_ptr;
object_kind *k_ptr;
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &inventory[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = ¤t_floor_ptr->o_list[0 - item];
- }
-
+ o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item);
/* Mega-Hack -- refuse to zap a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
/* Mega-Hack -- refuse to zap a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
@@
-299,16
+300,15
@@
void do_cmd_zap_rod_aux(INVENTORY_IDX item)
}
}
- take_turn(
p
_ptr, 100);
+ take_turn(
creature
_ptr, 100);
- /* Extract the item level */
lev = k_info[o_ptr->k_idx].level;
/* Base chance of success */
lev = k_info[o_ptr->k_idx].level;
/* Base chance of success */
- chance =
p
_ptr->skill_dev;
+ chance =
creature
_ptr->skill_dev;
/* Confusion hurts skill */
/* Confusion hurts skill */
- if (
p
_ptr->confused) chance = chance / 2;
+ if (
creature
_ptr->confused) chance = chance / 2;
fail = lev + 5;
if (chance > fail) fail -= (chance - fail) * 2;
fail = lev + 5;
if (chance > fail) fail -= (chance - fail) * 2;
@@
-316,9
+316,9
@@
void do_cmd_zap_rod_aux(INVENTORY_IDX item)
if (fail < USE_DEVICE) fail = USE_DEVICE;
if (chance < USE_DEVICE) chance = USE_DEVICE;
if (fail < USE_DEVICE) fail = USE_DEVICE;
if (chance < USE_DEVICE) chance = USE_DEVICE;
- if (cmd_limit_time_walk(
p
_ptr)) return;
+ if (cmd_limit_time_walk(
creature
_ptr)) return;
- if (
p
_ptr->pclass == CLASS_BERSERKER) success = FALSE;
+ if (
creature
_ptr->pclass == CLASS_BERSERKER) success = FALSE;
else if (chance > fail)
{
if (randint0(chance * 2) < fail) success = FALSE;
else if (chance > fail)
{
if (randint0(chance * 2) < fail) success = FALSE;
@@
-358,17
+358,17
@@
void do_cmd_zap_rod_aux(INVENTORY_IDX item)
sound(SOUND_ZAP);
sound(SOUND_ZAP);
- ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE, FALSE);
+ ident = rod_effect(
creature_ptr,
o_ptr->sval, dir, &use_charge, FALSE, FALSE);
/* Increase the timeout by the rod kind's pval. -LM- */
if (use_charge) o_ptr->timeout += k_ptr->pval;
/* Increase the timeout by the rod kind's pval. -LM- */
if (use_charge) o_ptr->timeout += k_ptr->pval;
-
p
_ptr->update |= (PU_COMBINE | PU_REORDER);
+
creature
_ptr->update |= (PU_COMBINE | PU_REORDER);
if (!(object_is_aware(o_ptr)))
{
if (!(object_is_aware(o_ptr)))
{
- chg_virtue(V_PATIENCE, -1);
- chg_virtue(V_CHANCE, 1);
- chg_virtue(V_KNOWLEDGE, -1);
+ chg_virtue(
creature_ptr,
V_PATIENCE, -1);
+ chg_virtue(
creature_ptr,
V_CHANCE, 1);
+ chg_virtue(
creature_ptr,
V_KNOWLEDGE, -1);
}
/* Tried the object */
}
/* Tried the object */
@@
-378,41
+378,38
@@
void do_cmd_zap_rod_aux(INVENTORY_IDX item)
if (ident && !object_is_aware(o_ptr))
{
object_aware(o_ptr);
if (ident && !object_is_aware(o_ptr))
{
object_aware(o_ptr);
- gain_exp(
(lev + (p_ptr->lev >> 1)) / p
_ptr->lev);
+ gain_exp(
creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature
_ptr->lev);
}
}
-
p
_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+
creature
_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
}
/*!
* @brief ロッドを使うコマンドのメインルーチン /
* @return なし
*/
}
/*!
* @brief ロッドを使うコマンドのメインルーチン /
* @return なし
*/
-void do_cmd_zap_rod(
void
)
+void do_cmd_zap_rod(
player_type *creature_ptr
)
{
OBJECT_IDX item;
concptr q, s;
{
OBJECT_IDX item;
concptr q, s;
- if (
p
_ptr->wild_mode)
+ if (
creature
_ptr->wild_mode)
{
return;
}
{
return;
}
- if (cmd_limit_arena(
p
_ptr)) return;
+ if (cmd_limit_arena(
creature
_ptr)) return;
- if (
p
_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
+ if (
creature
_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
{
{
- set_action(ACTION_NONE);
+ set_action(
creature_ptr,
ACTION_NONE);
}
}
- /* Restrict choices to rods */
- item_tester_tval = TV_ROD;
-
q = _("どのロッドを振りますか? ", "Zap which rod? ");
s = _("使えるロッドがない。", "You have no rod to zap.");
q = _("どのロッドを振りますか? ", "Zap which rod? ");
s = _("使えるロッドがない。", "You have no rod to zap.");
- if (!choose_object(
&item, q, s, (USE_INVEN | USE_FLOOR)
)) return;
+ if (!choose_object(
p_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), TV_ROD
)) return;
/* Zap the rod */
/* Zap the rod */
-
do_cmd_zap_rod_aux(
item);
+
exe_zap_rod(creature_ptr,
item);
}
}