#include "angband.h"
#include "util.h"
+#include "core.h"
+#include "term.h"
#include "cmd-dump.h"
#include "chest.h"
#include "avatar.h"
#include "player-status.h"
#include "realm-hex.h"
+#include "realm-song.h"
#include "geometry.h"
#include "wild.h"
#include "grid.h"
#include "feature.h"
#include "player-move.h"
#include "player-effects.h"
+#include "player-class.h"
+#include "player-personality.h"
#include "objectkind.h"
#include "object-broken.h"
#include "object-flavor.h"
#include "shoot.h"
+#include "snipe.h"
#include "cmd-basic.h"
+#include "cmd-item.h"
#include "floor-save.h"
#include "dungeon-file.h"
#include "files.h"
* @param down_stair TRUEならば階段を降りる処理、FALSEなら階段を昇る処理による内容
* @return フロア移動を実際に行うならTRUE、キャンセルする場合はFALSE
*/
-static bool confirm_leave_level(bool down_stair)
+static bool confirm_leave_level(player_type *creature_ptr, bool down_stair)
{
- quest_type *q_ptr = &quest[p_ptr->inside_quest];
+ quest_type *q_ptr = &quest[creature_ptr->inside_quest];
/* Confirm leaving from once only quest */
- if (confirm_quest && p_ptr->inside_quest &&
+ if (confirm_quest && creature_ptr->inside_quest &&
(q_ptr->type == QUEST_TYPE_RANDOM ||
(q_ptr->flags & QUEST_FLAG_ONCE &&
q_ptr->status != QUEST_STATUS_COMPLETED) ||
}
if (no_lite())
{
- msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
+ msg_print(_("明かりがないので見えない。", "You have no light."));
return TRUE;
}
return FALSE;
* @brief 階段を使って階層を昇る処理 / Go up one level
* @return なし
*/
-void do_cmd_go_up(void)
+void do_cmd_go_up(player_type *creature_ptr)
{
bool go_up = FALSE;
/* Player grid */
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+ grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
feature_type *f_ptr = &f_info[g_ptr->feat];
int up_num = 0;
- if (p_ptr->special_defense & KATA_MUSOU)
+ if (creature_ptr->special_defense & KATA_MUSOU)
{
set_action(ACTION_NONE);
}
/* Quest up stairs */
if (have_flag(f_ptr->flags, FF_QUEST))
{
- /* Cancel the command */
- if (!confirm_leave_level(FALSE)) return;
+ if (!confirm_leave_level(creature_ptr, FALSE)) return;
-
/* Success */
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
else
msg_print(_("上の階に登った。", "You enter the up staircase."));
leave_quest_check();
- p_ptr->inside_quest = g_ptr->special;
+ creature_ptr->inside_quest = g_ptr->special;
/* Activate the quest */
- if (!quest[p_ptr->inside_quest].status)
+ if (!quest[creature_ptr->inside_quest].status)
{
- if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
+ if (quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
{
init_flags = INIT_ASSIGN;
process_dungeon_file("q_info.txt", 0, 0, 0, 0);
}
- quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
+ quest[creature_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
}
/* Leaving a quest */
- if (!p_ptr->inside_quest)
+ if (!creature_ptr->inside_quest)
{
current_floor_ptr->dun_level = 0;
}
- p_ptr->leaving = TRUE;
+ creature_ptr->leaving = TRUE;
- p_ptr->oldpx = 0;
- p_ptr->oldpy = 0;
+ creature_ptr->oldpx = 0;
+ creature_ptr->oldpy = 0;
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
/* End the command */
return;
}
else
{
- go_up = confirm_leave_level(FALSE);
+ go_up = confirm_leave_level(creature_ptr, FALSE);
}
- /* Cancel the command */
if (!go_up) return;
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
if (autosave_l) do_cmd_save_game(TRUE);
/* For a random quest */
- if (p_ptr->inside_quest &&
- quest[p_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
+ if (creature_ptr->inside_quest &&
+ quest[creature_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
{
leave_quest_check();
- p_ptr->inside_quest = 0;
+ creature_ptr->inside_quest = 0;
}
/* For a fixed quest */
- if (p_ptr->inside_quest &&
- quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
+ if (creature_ptr->inside_quest &&
+ quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
{
leave_quest_check();
- p_ptr->inside_quest = g_ptr->special;
+ creature_ptr->inside_quest = g_ptr->special;
current_floor_ptr->dun_level = 0;
up_num = 0;
}
}
/* Get out from current dungeon */
- if (current_floor_ptr->dun_level - up_num < d_info[p_ptr->dungeon_idx].mindepth)
+ if (current_floor_ptr->dun_level - up_num < d_info[creature_ptr->dungeon_idx].mindepth)
up_num = current_floor_ptr->dun_level;
}
if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
/* Success */
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
else if (up_num == current_floor_ptr->dun_level)
msg_print(_("地上に戻った。", "You go back to the surface."));
else
msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
- p_ptr->leaving = TRUE;
+ creature_ptr->leaving = TRUE;
}
* @brief 階段を使って階層を降りる処理 / Go down one level
* @return なし
*/
-void do_cmd_go_down(void)
+void do_cmd_go_down(player_type *creature_ptr)
{
/* Player grid */
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+ grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
feature_type *f_ptr = &f_info[g_ptr->feat];
bool fall_trap = FALSE;
int down_num = 0;
- if (p_ptr->special_defense & KATA_MUSOU)
+ if (creature_ptr->special_defense & KATA_MUSOU)
{
set_action(ACTION_NONE);
}
else if (have_flag(f_ptr->flags, FF_QUEST))
{
/* Confirm Leaving */
- if(!confirm_leave_level(TRUE)) return;
+ if(!confirm_leave_level(creature_ptr, TRUE)) return;
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
else
msg_print(_("下の階に降りた。", "You enter the down staircase."));
leave_quest_check();
leave_tower_check();
- p_ptr->inside_quest = g_ptr->special;
+ creature_ptr->inside_quest = g_ptr->special;
/* Activate the quest */
- if (!quest[p_ptr->inside_quest].status)
+ if (!quest[creature_ptr->inside_quest].status)
{
- if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
+ if (quest[creature_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
{
init_flags = INIT_ASSIGN;
process_dungeon_file("q_info.txt", 0, 0, 0, 0);
}
- quest[p_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
+ quest[creature_ptr->inside_quest].status = QUEST_STATUS_TAKEN;
}
/* Leaving a quest */
- if (!p_ptr->inside_quest)
+ if (!creature_ptr->inside_quest)
{
current_floor_ptr->dun_level = 0;
}
- p_ptr->leaving = TRUE;
- p_ptr->oldpx = 0;
- p_ptr->oldpy = 0;
+ creature_ptr->leaving = TRUE;
+ creature_ptr->oldpx = 0;
+ creature_ptr->oldpy = 0;
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
}
else
}
/* Save old player position */
- p_ptr->oldpx = p_ptr->x;
- p_ptr->oldpy = p_ptr->y;
- p_ptr->dungeon_idx = target_dungeon;
+ creature_ptr->oldpx = creature_ptr->x;
+ creature_ptr->oldpy = creature_ptr->y;
+ creature_ptr->dungeon_idx = target_dungeon;
/*
* Clear all saved floors
prepare_change_floor_mode(CFM_FIRST_FLOOR);
}
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
if (autosave_l) do_cmd_save_game(TRUE);
if (!current_floor_ptr->dun_level)
{
/* Enter the dungeon just now */
- p_ptr->enter_dungeon = TRUE;
- down_num = d_info[p_ptr->dungeon_idx].mindepth;
+ creature_ptr->enter_dungeon = TRUE;
+ down_num = d_info[creature_ptr->dungeon_idx].mindepth;
}
if (record_stair)
/* Success */
if (target_dungeon)
{
- msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[p_ptr->dungeon_idx].text);
+ msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[creature_ptr->dungeon_idx].text);
}
else
{
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+ if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
else
msg_print(_("階段を下りて新たなる迷宮へと足を踏み入れた。", "You enter a maze of down staircases."));
}
}
- p_ptr->leaving = TRUE;
+ creature_ptr->leaving = TRUE;
if (fall_trap)
{
* @brief 探索コマンドのメインルーチン / Simple command to "search" for one current_world_ptr->game_turn
* @return なし
*/
-void do_cmd_search(void)
+void do_cmd_search(player_type * creature_ptr)
{
/* Allow repeated command */
if (command_arg)
{
/* Set repeat count */
command_rep = command_arg - 1;
- p_ptr->redraw |= (PR_STATE);
+ creature_ptr->redraw |= (PR_STATE);
/* Cancel the arg */
command_arg = 0;
}
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
- /* Search */
- search();
+ search(creature_ptr);
}
}
/*!
- * @brief 箱を開けるコマンドのメインルーチン /
+ * @brief 箱を開ける実行処理 /
* Attempt to open the given chest at the given location
* @param y 箱の存在するマスのY座標
* @param x 箱の存在するマスのX座標
* @details
* Assume there is no monster blocking the destination
*/
-static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
+static bool exe_open_chest(player_type *creature_ptr, POSITION y, POSITION x, OBJECT_IDX o_idx)
{
int i, j;
bool flag = TRUE;
bool more = FALSE;
object_type *o_ptr = ¤t_floor_ptr->o_list[o_idx];
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
/* Attempt to unlock it */
if (o_ptr->pval > 0)
flag = FALSE;
/* Get the "disarm" factor */
- i = p_ptr->skill_dis;
+ i = creature_ptr->skill_dis;
/* Penalize some conditions */
- if (p_ptr->blind || no_lite()) i = i / 10;
- if (p_ptr->confused || p_ptr->image) i = i / 10;
+ if (creature_ptr->blind || no_lite()) i = i / 10;
+ if (creature_ptr->confused || creature_ptr->image) i = i / 10;
/* Extract the difficulty */
j = i - o_ptr->pval;
if (randint0(100) < j)
{
msg_print(_("鍵をはずした。", "You have picked the lock."));
- gain_exp(1);
+ gain_exp(p_ptr, 1);
flag = TRUE;
}
* @details
* If requested, count only trapped chests.
*/
-static int count_chests(POSITION *y, POSITION *x, bool trapped)
+static int count_chests(player_type *creature_ptr, POSITION *y, POSITION *x, bool trapped)
{
DIRECTION d;
int count;
for (d = 0; d < 9; d++)
{
/* Extract adjacent (legal) location */
- POSITION yy = p_ptr->y + ddy_ddd[d];
- POSITION xx = p_ptr->x + ddx_ddd[d];
+ POSITION yy = creature_ptr->y + ddy_ddd[d];
+ POSITION xx = creature_ptr->x + ddx_ddd[d];
/* No (visible) chest is there */
if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
sound(SOUND_OPENDOOR);
/* Experience */
- gain_exp(1);
+ gain_exp(p_ptr, 1);
}
/* Failure */
* @details
* Unlocking a locked door/chest is worth one experience point.
*/
-void do_cmd_open(void)
+void do_cmd_open(player_type *creature_ptr)
{
POSITION y, x;
DIRECTION dir;
bool more = FALSE;
- if (p_ptr->wild_mode) return;
+ if (creature_ptr->wild_mode) return;
- if (p_ptr->special_defense & KATA_MUSOU)
+ if (creature_ptr->special_defense & KATA_MUSOU)
{
set_action(ACTION_NONE);
}
{
int num_doors, num_chests;
- /* Count closed doors (locked or jammed) */
num_doors = count_dt(&y, &x, is_closed_door, FALSE);
-
- /* Count chests (locked) */
- num_chests = count_chests(&y, &x, FALSE);
-
- /* See if only one target */
+ num_chests = count_chests(creature_ptr, &y, &x, FALSE);
if (num_doors || num_chests)
{
bool too_many = (num_doors && num_chests) || (num_doors > 1) ||
{
/* Set repeat count */
command_rep = command_arg - 1;
- p_ptr->redraw |= (PR_STATE);
+ creature_ptr->redraw |= (PR_STATE);
/* Cancel the arg */
command_arg = 0;
grid_type *g_ptr;
/* Get requested location */
- y = p_ptr->y + ddy[dir];
- x = p_ptr->x + ddx[dir];
+ y = creature_ptr->y + ddy[dir];
+ x = creature_ptr->x + ddx[dir];
/* Get requested grid */
g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Check for chest */
o_idx = chest_check(y, x, FALSE);
- /* Nothing useful */
if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
{
msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
}
-
- /* Monster in the way */
- else if (g_ptr->m_idx && p_ptr->riding != g_ptr->m_idx)
+ else if (g_ptr->m_idx && creature_ptr->riding != g_ptr->m_idx)
{
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
py_attack(y, x, 0);
}
-
- /* Handle chests */
else if (o_idx)
{
- /* Open the chest */
- more = do_cmd_open_chest(y, x, o_idx);
+ more = exe_open_chest(creature_ptr, y, x, o_idx);
}
-
- /* Handle doors */
else
{
- /* Open the door */
more = do_cmd_open_aux(y, x);
}
}
/* We may continue chopping */
msg_format(_("%sを切っている。", "You chop away at the %s."), name);
/* Occasional Search XXX XXX */
- if (randint0(100) < 25) search();
+ if (randint0(100) < 25) search(p_ptr);
}
else
{
if (is_hidden_door(g_ptr))
{
/* Occasional Search XXX XXX */
- if (randint0(100) < 25) search();
+ if (randint0(100) < 25) search(p_ptr);
}
return more;
}
sound(SOUND_OPENDOOR);
/* Experience */
- gain_exp(1);
+ gain_exp(p_ptr, 1);
}
/* Failure */
else if (randint0(100) < j)
{
msg_print(_("箱に仕掛けられていたトラップを解除した。", "You have disarmed the chest."));
- gain_exp(o_ptr->pval);
+ gain_exp(p_ptr, o_ptr->pval);
o_ptr->pval = (0 - o_ptr->pval);
}
msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
/* Reward */
- gain_exp(power);
+ gain_exp(p_ptr, power);
/* Remove the trap */
cave_alter_feat(y, x, FF_DISARM);
num_traps = count_dt(&y, &x, is_trap, TRUE);
/* Count chests (trapped) */
- num_chests = count_chests(&y, &x, TRUE);
+ num_chests = count_chests(p_ptr, &y, &x, TRUE);
/* See if only one target */
if (num_traps || num_chests)
msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
/* Hack -- Lose balance ala paralysis */
- (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
+ (void)set_paralyzed(p_ptr, p_ptr->paralyzed + 2 + randint0(2));
}
return (more);
}
/* Go into large wilderness view */
p_ptr->oldpy = randint1(MAX_HGT-2);
p_ptr->oldpx = randint1(MAX_WID-2);
- change_wild_mode();
+ change_wild_mode(TRUE);
/* Give first move to monsters */
take_turn(p_ptr, 100);
- /* HACk -- set the encouter flag for the wilderness generation */
- generate_encounter = TRUE;
}
}
if (get_rep_dir(&dir,FALSE))
{
/* Hack -- Set the run counter */
- running = (command_arg ? command_arg : 1000);
+ p_ptr->running = (command_arg ? command_arg : 1000);
/* First step */
run_step(dir);
if (command_arg > 9999) command_arg = 9999;
- if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
+ if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(p_ptr, FALSE);
/* Take a current_world_ptr->game_turn (?) */
take_turn(p_ptr, 100);
if(p_ptr->wild_mode) return;
- is_fired = FALSE; /* not fired yet */
+ p_ptr->is_fired = FALSE; /* not fired yet */
/* Get the "bow" (if any) */
j_ptr = &p_ptr->inventory_list[INVEN_BOW];
set_action(ACTION_NONE);
}
- /* Require proper missile */
- item_tester_tval = p_ptr->tval_ammo;
-
q = _("どれを撃ちますか? ", "Fire which item? ");
s = _("発射されるアイテムがありません。", "You have nothing to fire.");
-
- ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+ ammo_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), p_ptr->tval_ammo);
if (!ammo_ptr)
{
flush();
/* Fire the item */
exe_fire(item, j_ptr, snipe_type);
- if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return;
+ if (!p_ptr->is_fired || p_ptr->pclass != CLASS_SNIPER) return;
/* Sniper actions after some shootings */
if (snipe_type == SP_AWAY)
if (snipe_type == SP_FINAL)
{
msg_print(_("射撃の反動が体を襲った。", "A reactionary of shooting attacked you. "));
- (void)set_slow(p_ptr->slow + randint0(7) + 7, FALSE);
- (void)set_stun(p_ptr->stun + randint1(25));
+ (void)set_slow(p_ptr, p_ptr->slow + randint0(7) + 7, FALSE);
+ (void)set_stun(p_ptr, p_ptr->stun + randint1(25));
}
}
item_tester_hook = item_tester_hook_boomerang;
q = _("どの武器を投げますか? ", "Throw which item? ");
s = _("投げる武器がない。", "You have nothing to throw.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP));
+ o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0);
if (!o_ptr)
{
flush();
{
q = _("どのアイテムを投げますか? ", "Throw which item? ");
s = _("投げるアイテムがない。", "You have nothing to throw.");
- o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP));
+ o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP), 0);
if (!o_ptr)
{
flush();
}
q_ptr = &forge;
-
- /* Obtain a local object */
object_copy(q_ptr, o_ptr);
/* Extract the thrown object's flags. */
else if (equiped_item)
{
kamaenaoshi(item);
- calc_android_exp();
+ calc_android_exp(p_ptr);
}
if (do_drop)