if (!m_idx) break;
if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
- dispel_monster_status(m_idx);
+ dispel_monster_status(caster_ptr, m_idx);
break;
}
{
GAME_TEXT m_name[MAX_NLEN];
monster_desc(m_name, m_ptr, 0);
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
msg_format(_("%sを起こした。", "You have woken %s up."), m_name);
}
}
/* Disturb the monster */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(attacker_ptr, g_ptr->m_idx, 0);
monster_desc(m_name, m_ptr, 0);
{
if (attacker_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
{
- if (set_monster_stunned(g_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
+ if (set_monster_stunned(attacker_ptr, g_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
{
msg_format(_("%^sはフラフラになった。", "%^s is stunned."), m_name);
}
}
/* Apply stun */
- (void)set_monster_stunned(g_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
+ (void)set_monster_stunned(attacker_ptr, g_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
}
else
{
else
{
msg_format(_("%^sは混乱したようだ。", "%^s appears confused."), m_name);
- (void)set_monster_confused(g_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(attacker_ptr->lev) / 5);
+ (void)set_monster_confused(attacker_ptr, g_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(attacker_ptr->lev) / 5);
}
}
msg_format(_("そっちには何か恐いものがいる!", "There is something scary in your way!"));
/* Disturb the monster */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(attacker_ptr, g_ptr->m_idx, 0);
return FALSE;
}
/* Monster hits */
if (!effect || check_hit2(power, rlev, ac, MON_STUNNED(m_ptr)))
{
- (void)set_monster_csleep(t_idx, 0);
+ (void)set_monster_csleep(subject_ptr, t_idx, 0);
if (t_ptr->ml)
{
case RBM_ENGULF:
case RBM_CHARGE:
{
- (void)set_monster_csleep(t_idx, 0);
+ (void)set_monster_csleep(subject_ptr, t_idx, 0);
/* Visible monsters */
if (see_m)
sound(SOUND_EXPLODE);
/* Cancel Invulnerability */
- (void)set_monster_invulner(m_idx, 0, FALSE);
+ (void)set_monster_invulner(subject_ptr, m_idx, 0, FALSE);
mon_take_hit_mon(subject_ptr, m_idx, m_ptr->hp + 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
blinked = FALSE;
}
if (player_ptr->riding == m_idx) player_ptr->redraw |= (PR_UHEALTH);
}
- (void)set_monster_csleep(m_idx, 0);
+ (void)set_monster_csleep(player_ptr, m_idx, 0);
if (player_ptr->riding && (m_idx == player_ptr->riding)) disturb(player_ptr, TRUE, TRUE);
if (MON_MONFEAR(m_ptr) && (dam > 0))
{
/* Cure fear */
- if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
+ if (set_monster_monfear(player_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
{
/* No more fear */
(*fear) = FALSE;
(*fear) = TRUE;
/* Hack -- Add some timed fear */
- (void)set_monster_monfear(m_idx, (randint1(10) +
+ (void)set_monster_monfear(player_ptr, m_idx, (randint1(10) +
(((dam >= m_ptr->hp) && (percentage > 7)) ?
20 : ((11 - percentage) * 5))));
}
update_dungeon_feeling(player_ptr);
/* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (ironman_downward && (player_ptr->dungeon_idx != DUNGEON_ANGBAND && player_ptr->dungeon_idx != 0))
{
- player_ptr->current_floor_ptr->dun_level = 0;
+ floor_ptr->dun_level = 0;
player_ptr->dungeon_idx = 0;
prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR | CFM_RAND_PLACE);
- player_ptr->current_floor_ptr->inside_arena = FALSE;
+ floor_ptr->inside_arena = FALSE;
player_ptr->wild_mode = FALSE;
player_ptr->leaving = TRUE;
}
int number_mon = 0;
/* Count all hostile monsters */
- for (i2 = 0; i2 < player_ptr->current_floor_ptr->width; ++i2)
- for (j2 = 0; j2 < player_ptr->current_floor_ptr->height; j2++)
+ for (i2 = 0; i2 < floor_ptr->width; ++i2)
+ for (j2 = 0; j2 < floor_ptr->height; j2++)
{
- grid_type *g_ptr = &player_ptr->current_floor_ptr->grid_array[j2][i2];
+ grid_type *g_ptr = &floor_ptr->grid_array[j2][i2];
if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != player_ptr->riding))
{
GAME_TEXT m_name[MAX_NLEN];
monster_type *wm_ptr;
- wm_ptr = &player_ptr->current_floor_ptr->m_list[win_m_idx];
+ wm_ptr = &floor_ptr->m_list[win_m_idx];
monster_desc(m_name, wm_ptr, 0);
msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
player_ptr->energy_need = 0;
update_gambling_monsters(player_ptr);
}
- else if (current_world_ptr->game_turn - player_ptr->current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
+ else if (current_world_ptr->game_turn - floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
{
msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
player_ptr->au += kakekin;
do_cmd_save_game(player_ptr, TRUE);
}
- if (player_ptr->current_floor_ptr->monster_noise && !ignore_unview)
+ if (floor_ptr->monster_noise && !ignore_unview)
{
msg_print(_("何かが聞こえた。", "You hear noise."));
}
/*** Handle the wilderness/town (sunshine) ***/
/* While in town/wilderness */
- if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest && !player_ptr->phase_out && !player_ptr->current_floor_ptr->inside_arena)
+ if (!floor_ptr->dun_level && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)
{
/* Hack -- Daybreak/Nighfall in town */
if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
}
/* While in the dungeon (vanilla_town or lite_town mode only) */
- else if ((vanilla_town || (lite_town && !player_ptr->current_floor_ptr->inside_quest && !player_ptr->phase_out && !player_ptr->current_floor_ptr->inside_arena)) && player_ptr->current_floor_ptr->dun_level)
+ else if ((vanilla_town || (lite_town && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)) && floor_ptr->dun_level)
{
/*** Shuffle the Storekeepers ***/
/* Check for creature generation. */
if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) &&
- !player_ptr->current_floor_ptr->inside_arena && !player_ptr->current_floor_ptr->inside_quest && !player_ptr->phase_out)
+ !floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out)
{
/* Make a new monster */
(void)alloc_monster(MAX_SIGHT + 5, 0);
/* Hack -- Process the counters of monsters if needed */
for (i = 0; i < MAX_MTIMED; i++)
{
- if (player_ptr->current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
+ if (floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(player_ptr, i);
}
}
GAME_TEXT m_name[MAX_NLEN];
/* Recover fully */
- (void)set_monster_csleep(creature_ptr->riding, 0);
+ (void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
monster_desc(m_name, m_ptr, 0);
msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
}
if (MON_STUNNED(m_ptr))
{
/* Hack -- Recover from stun */
- if (set_monster_stunned(creature_ptr->riding,
+ if (set_monster_stunned(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
{
GAME_TEXT m_name[MAX_NLEN];
if (MON_CONFUSED(m_ptr))
{
/* Hack -- Recover from confusion */
- if (set_monster_confused(creature_ptr->riding,
+ if (set_monster_confused(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
{
GAME_TEXT m_name[MAX_NLEN];
if (MON_MONFEAR(m_ptr))
{
/* Hack -- Recover from fear */
- if(set_monster_monfear(creature_ptr->riding,
+ if(set_monster_monfear(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
{
GAME_TEXT m_name[MAX_NLEN];
int quest_num = 0;
/* Set the base level */
- player_ptr->current_floor_ptr->base_level = player_ptr->current_floor_ptr->dun_level;
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ floor_ptr->base_level = floor_ptr->dun_level;
/* Reset various flags */
current_world_ptr->is_loading_now = FALSE;
disturb(player_ptr, TRUE, TRUE);
/* Get index of current quest (if any) */
- quest_num = quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level);
+ quest_num = quest_number(player_ptr, floor_ptr->dun_level);
/* Inside a quest? */
if (quest_num)
/* Track maximum dungeon level (if not in quest -KMW-) */
- if ((max_dlv[player_ptr->dungeon_idx] < player_ptr->current_floor_ptr->dun_level) && !player_ptr->current_floor_ptr->inside_quest)
+ if ((max_dlv[player_ptr->dungeon_idx] < floor_ptr->dun_level) && !floor_ptr->inside_quest)
{
- max_dlv[player_ptr->dungeon_idx] = player_ptr->current_floor_ptr->dun_level;
- if (record_maxdepth) exe_write_diary(player_ptr, NIKKI_MAXDEAPTH, player_ptr->current_floor_ptr->dun_level, NULL);
+ max_dlv[player_ptr->dungeon_idx] = floor_ptr->dun_level;
+ if (record_maxdepth) exe_write_diary(player_ptr, NIKKI_MAXDEAPTH, floor_ptr->dun_level, NULL);
}
(void)calculate_upkeep(player_ptr);
if (!player_ptr->playing || player_ptr->is_dead) return;
/* Print quest message if appropriate */
- if (!player_ptr->current_floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
+ if (!floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
{
- quest_discovery(random_quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level));
- player_ptr->current_floor_ptr->inside_quest = random_quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level);
+ quest_discovery(random_quest_number(player_ptr, floor_ptr->dun_level));
+ floor_ptr->inside_quest = random_quest_number(player_ptr, floor_ptr->dun_level);
}
- if ((player_ptr->current_floor_ptr->dun_level == d_info[player_ptr->dungeon_idx].maxdepth) && d_info[player_ptr->dungeon_idx].final_guardian)
+ if ((floor_ptr->dun_level == d_info[player_ptr->dungeon_idx].maxdepth) && d_info[player_ptr->dungeon_idx].final_guardian)
{
if (r_info[d_info[player_ptr->dungeon_idx].final_guardian].max_num)
#ifdef JP
/*** Process this dungeon level ***/
/* Reset the monster generation level */
- player_ptr->current_floor_ptr->monster_level = player_ptr->current_floor_ptr->base_level;
+ floor_ptr->monster_level = floor_ptr->base_level;
/* Reset the object generation level */
- player_ptr->current_floor_ptr->object_level = player_ptr->current_floor_ptr->base_level;
+ floor_ptr->object_level = floor_ptr->base_level;
current_world_ptr->is_loading_now = TRUE;
if (player_ptr->energy_need > 0 && !player_ptr->phase_out &&
- (player_ptr->current_floor_ptr->dun_level || player_ptr->leaving_dungeon || player_ptr->current_floor_ptr->inside_arena))
+ (floor_ptr->dun_level || player_ptr->leaving_dungeon || floor_ptr->inside_arena))
player_ptr->energy_need = 0;
/* Not leaving dungeon */
player_ptr->leaving_dungeon = FALSE;
/* Initialize monster process */
- mproc_init();
+ mproc_init(floor_ptr);
/* Main loop */
while (TRUE)
{
/* Hack -- Compact the monster list occasionally */
- if ((player_ptr->current_floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out) compact_monsters(64);
+ if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out) compact_monsters(64);
/* Hack -- Compress the monster list occasionally */
- if ((player_ptr->current_floor_ptr->m_cnt + 32 < player_ptr->current_floor_ptr->m_max) && !player_ptr->phase_out) compact_monsters(0);
+ if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out) compact_monsters(0);
/* Hack -- Compact the object list occasionally */
- if (player_ptr->current_floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr, 64);
+ if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr, 64);
/* Hack -- Compress the object list occasionally */
- if (player_ptr->current_floor_ptr->o_cnt + 32 < player_ptr->current_floor_ptr->o_max) compact_objects(player_ptr, 0);
+ if (floor_ptr->o_cnt + 32 < floor_ptr->o_max) compact_objects(player_ptr, 0);
/* Process the player */
process_player(player_ptr);
}
/* Roll new character */
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (new_game)
{
/* The dungeon is not ready */
current_world_ptr->character_dungeon = FALSE;
/* Start in town */
- player_ptr->current_floor_ptr->dun_level = 0;
- player_ptr->current_floor_ptr->inside_quest = 0;
- player_ptr->current_floor_ptr->inside_arena = FALSE;
+ floor_ptr->dun_level = 0;
+ floor_ptr->inside_quest = 0;
+ floor_ptr->inside_arena = FALSE;
player_ptr->phase_out = FALSE;
write_level = TRUE;
determine_daily_bounty(player_ptr, FALSE);
/* Initialize object array */
- wipe_o_list(player_ptr->current_floor_ptr);
+ wipe_o_list(floor_ptr);
}
else
{
if (player_ptr->riding == -1)
{
player_ptr->riding = 0;
- for (i = player_ptr->current_floor_ptr->m_max; i > 0; i--)
+ for (i = floor_ptr->m_max; i > 0; i--)
{
- if (player_bold(player_ptr, player_ptr->current_floor_ptr->m_list[i].fy, player_ptr->current_floor_ptr->m_list[i].fx))
+ if (player_bold(player_ptr, floor_ptr->m_list[i].fy, floor_ptr->m_list[i].fx))
{
player_ptr->riding = i;
break;
record_o_name[0] = '\0';
/* Reset map panel */
- panel_row_min = player_ptr->current_floor_ptr->height;
- panel_col_min = player_ptr->current_floor_ptr->width;
+ panel_row_min = floor_ptr->height;
+ panel_col_min = floor_ptr->width;
/* Sexy gal gets bonus to maximum weapon skill of whip */
if (player_ptr->pseikaku == SEIKAKU_SEXY)
init_saved_floors(player_ptr, TRUE);
/* Avoid crash */
- player_ptr->current_floor_ptr->inside_quest = 0;
+ floor_ptr->inside_quest = 0;
/* Avoid crash in update_view() */
player_ptr->y = player_ptr->x = 10;
}
/* Initialize the town-buildings if necessary */
- if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest)
+ if (!floor_ptr->dun_level && !floor_ptr->inside_quest)
{
process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
init_flags = INIT_ONLY_BUILDINGS;
monster_race *r_ptr = &r_info[pet_r_idx];
place_monster_aux(0, player_ptr->y, player_ptr->x - 1, pet_r_idx,
(PM_FORCE_PET | PM_NO_KAGE));
- m_ptr = &player_ptr->current_floor_ptr->m_list[hack_m_idx_ii];
+ m_ptr = &floor_ptr->m_list[hack_m_idx_ii];
m_ptr->mspeed = r_ptr->speed;
m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
m_ptr->max_maxhp = m_ptr->maxhp;
health_track(player_ptr, 0);
- forget_lite(player_ptr->current_floor_ptr);
- forget_view(player_ptr->current_floor_ptr);
- clear_mon_lite(player_ptr->current_floor_ptr);
+ forget_lite(floor_ptr);
+ forget_view(floor_ptr);
+ clear_mon_lite(floor_ptr);
/* Handle "quit and save" */
if (!player_ptr->playing && !player_ptr->is_dead) break;
- wipe_o_list(player_ptr->current_floor_ptr);
+ wipe_o_list(floor_ptr);
if (!player_ptr->is_dead) wipe_m_list();
/* Accidental Death */
if (player_ptr->playing && player_ptr->is_dead)
{
- if (player_ptr->current_floor_ptr->inside_arena)
+ if (floor_ptr->inside_arena)
{
- player_ptr->current_floor_ptr->inside_arena = FALSE;
+ floor_ptr->inside_arena = FALSE;
if (player_ptr->arena_number > MAX_ARENA_MONS)
player_ptr->arena_number++;
else
update_creature(creature_ptr);
/* Initialize monster process */
- mproc_init();
+ mproc_init(creature_ptr->current_floor_ptr);
/* HACK -- reset the hackish flag */
current_world_ptr->is_loading_now = TRUE;
m_ptr->hp = m_ptr->maxhp = m_ptr->max_maxhp;
/* Remove timed status (except MTIMED_CSLEEP) */
- (void)set_monster_fast(i, 0);
- (void)set_monster_slow(i, 0);
- (void)set_monster_stunned(i, 0);
- (void)set_monster_confused(i, 0);
- (void)set_monster_monfear(i, 0);
- (void)set_monster_invulner(i, 0, FALSE);
+ (void)set_monster_fast(creature_ptr, i, 0);
+ (void)set_monster_slow(creature_ptr, i, 0);
+ (void)set_monster_stunned(creature_ptr, i, 0);
+ (void)set_monster_confused(creature_ptr, i, 0);
+ (void)set_monster_monfear(creature_ptr, i, 0);
+ (void)set_monster_invulner(creature_ptr, i, 0, FALSE);
}
/* Extract real monster race */
if (!m_idx) break;
if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
- dispel_monster_status(m_idx);
+ dispel_monster_status(caster_ptr, m_idx);
break;
}
case 10:
m_ptr->fx = tx;
/* Wake the monster up */
- (void)set_monster_csleep(m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, m_idx, 0);
update_monster(caster_ptr, m_idx, TRUE);
lite_spot(target_row, target_col);
/* Handle non-aggravation - Still sleeping */
if (!(target_ptr->cursed & TRC_AGGRAVATE)) return;
- (void)set_monster_csleep(m_idx, 0);
+ (void)set_monster_csleep(target_ptr, m_idx, 0);
/* Notice the "waking up" */
if (m_ptr->ml)
did_move_body = TRUE;
/* Wake up the moved monster */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(target_ptr, g_ptr->m_idx, 0);
/* Message */
}
if (!is_battle_determined) return;
/* No longer afraid */
- (void)set_monster_monfear(m_idx, 0);
+ (void)set_monster_monfear(target_ptr, m_idx, 0);
/* Message if seen */
if (see_m)
/* monster-process.c */
extern void process_monsters(player_type *target_ptr);
extern void process_monster(player_type *target_ptr, MONSTER_IDX m_idx);
-extern int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type);
-extern void mproc_init(void);
-extern void process_monsters_mtimed(int mtimed_idx);
/*!
* @brief モンスターの時限ステータスを取得する
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return m_idx モンスターの参照ID
* @return mproc_type モンスターの時限ステータスID
* @return 残りターン値
*/
-int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
+int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
{
- s16b *cur_mproc_list = p_ptr->current_floor_ptr->mproc_list[mproc_type];
+ s16b *cur_mproc_list = floor_ptr->mproc_list[mproc_type];
int i;
- for (i = p_ptr->current_floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
+ for (i = floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
{
if (cur_mproc_list[i] == m_idx) return i;
}
/*!
* @brief モンスターの時限ステータスリストを追加する
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return m_idx モンスターの参照ID
* @return mproc_type 追加したいモンスターの時限ステータスID
* @return なし
*/
-static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
+static void mproc_add(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
{
- if (p_ptr->current_floor_ptr->mproc_max[mproc_type] < current_world_ptr->max_m_idx) p_ptr->current_floor_ptr->mproc_list[mproc_type][p_ptr->current_floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
+ if (floor_ptr->mproc_max[mproc_type] < current_world_ptr->max_m_idx) floor_ptr->mproc_list[mproc_type][floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
}
/*!
* @brief モンスターの時限ステータスリストを削除
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return m_idx モンスターの参照ID
* @return mproc_type 削除したいモンスターの時限ステータスID
* @return なし
*/
-static void mproc_remove(MONSTER_IDX m_idx, int mproc_type)
+static void mproc_remove(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type)
{
- int mproc_idx = get_mproc_idx(m_idx, mproc_type);
- if (mproc_idx >= 0) p_ptr->current_floor_ptr->mproc_list[mproc_type][mproc_idx] = p_ptr->current_floor_ptr->mproc_list[mproc_type][--p_ptr->current_floor_ptr->mproc_max[mproc_type]];
+ int mproc_idx = get_mproc_idx(floor_ptr, m_idx, mproc_type);
+ if (mproc_idx >= 0) floor_ptr->mproc_list[mproc_type][mproc_idx] = floor_ptr->mproc_list[mproc_type][--floor_ptr->mproc_max[mproc_type]];
}
/*!
* @brief モンスターの時限ステータスリストを初期化する / Initialize monster process
+* @param floor_ptr 現在フロアへの参照ポインタ
* @return なし
*/
-void mproc_init(void)
+void mproc_init(floor_type *floor_ptr)
{
monster_type *m_ptr;
MONSTER_IDX i;
int cmi;
/* Reset "p_ptr->current_floor_ptr->mproc_max[]" */
- for (cmi = 0; cmi < MAX_MTIMED; cmi++) p_ptr->current_floor_ptr->mproc_max[cmi] = 0;
+ for (cmi = 0; cmi < MAX_MTIMED; cmi++) floor_ptr->mproc_max[cmi] = 0;
/* Process the monsters (backwards) */
- for (i = p_ptr->current_floor_ptr->m_max - 1; i >= 1; i--)
+ for (i = floor_ptr->m_max - 1; i >= 1; i--)
{
- m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+ m_ptr = &floor_ptr->m_list[i];
/* Ignore "dead" monsters */
if (!monster_is_valid(m_ptr)) continue;
for (cmi = 0; cmi < MAX_MTIMED; cmi++)
{
- if (m_ptr->mtimed[cmi]) mproc_add(i, cmi);
+ if (m_ptr->mtimed[cmi]) mproc_add(floor_ptr, i, cmi);
}
}
}
/*!
* @brief モンスターの睡眠状態値をセットする。0で起きる。 /
* Set "m_ptr->mtimed[MTIMED_CSLEEP]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_csleep(MONSTER_IDX m_idx, int v)
+bool set_monster_csleep(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
{
if (!MON_CSLEEP(m_ptr))
{
- mproc_add(m_idx, MTIMED_CSLEEP);
+ mproc_add(floor_ptr, m_idx, MTIMED_CSLEEP);
notice = TRUE;
}
}
{
if (MON_CSLEEP(m_ptr))
{
- mproc_remove(m_idx, MTIMED_CSLEEP);
+ mproc_remove(floor_ptr, m_idx, MTIMED_CSLEEP);
notice = TRUE;
}
}
if (m_ptr->ml)
{
/* Update health bar as needed */
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+ if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
}
- if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+ if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) target_ptr->update |= (PU_MON_LITE);
return TRUE;
}
/*!
* @brief モンスターの加速状態値をセット /
* Set "m_ptr->mtimed[MTIMED_FAST]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_fast(MONSTER_IDX m_idx, int v)
+bool set_monster_fast(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
{
if (!MON_FAST(m_ptr))
{
- mproc_add(m_idx, MTIMED_FAST);
+ mproc_add(floor_ptr, m_idx, MTIMED_FAST);
notice = TRUE;
}
}
{
if (MON_FAST(m_ptr))
{
- mproc_remove(m_idx, MTIMED_FAST);
+ mproc_remove(floor_ptr, m_idx, MTIMED_FAST);
notice = TRUE;
}
}
if (!notice) return FALSE;
- if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+ if ((target_ptr->riding == m_idx) && !p_ptr->leaving) target_ptr->update |= (PU_BONUS);
return TRUE;
}
/*
* Set "m_ptr->mtimed[MTIMED_SLOW]", notice observable changes
*/
-bool set_monster_slow(MONSTER_IDX m_idx, int v)
+bool set_monster_slow(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
{
if (!MON_SLOW(m_ptr))
{
- mproc_add(m_idx, MTIMED_SLOW);
+ mproc_add(floor_ptr, m_idx, MTIMED_SLOW);
notice = TRUE;
}
}
{
if (MON_SLOW(m_ptr))
{
- mproc_remove(m_idx, MTIMED_SLOW);
+ mproc_remove(floor_ptr, m_idx, MTIMED_SLOW);
notice = TRUE;
}
}
if (!notice) return FALSE;
- if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+ if ((target_ptr->riding == m_idx) && !target_ptr->leaving) target_ptr->update |= (PU_BONUS);
return TRUE;
}
/*!
* @brief モンスターの朦朧状態値をセット /
* Set "m_ptr->mtimed[MTIMED_STUNNED]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_stunned(MONSTER_IDX m_idx, int v)
+bool set_monster_stunned(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
{
if (!MON_STUNNED(m_ptr))
{
- mproc_add(m_idx, MTIMED_STUNNED);
+ mproc_add(floor_ptr, m_idx, MTIMED_STUNNED);
notice = TRUE;
}
}
{
if (MON_STUNNED(m_ptr))
{
- mproc_remove(m_idx, MTIMED_STUNNED);
+ mproc_remove(floor_ptr, m_idx, MTIMED_STUNNED);
notice = TRUE;
}
}
/*!
* @brief モンスターの混乱状態値をセット /
* Set "m_ptr->mtimed[MTIMED_CONFUSED]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_confused(MONSTER_IDX m_idx, int v)
+bool set_monster_confused(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
{
if (!MON_CONFUSED(m_ptr))
{
- mproc_add(m_idx, MTIMED_CONFUSED);
+ mproc_add(floor_ptr, m_idx, MTIMED_CONFUSED);
notice = TRUE;
}
}
{
if (MON_CONFUSED(m_ptr))
{
- mproc_remove(m_idx, MTIMED_CONFUSED);
+ mproc_remove(floor_ptr, m_idx, MTIMED_CONFUSED);
notice = TRUE;
}
}
/*!
* @brief モンスターの恐慌状態値をセット /
* Set "m_ptr->mtimed[MTIMED_MONFEAR]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_monfear(MONSTER_IDX m_idx, int v)
+bool set_monster_monfear(player_type *target_ptr, MONSTER_IDX m_idx, int v)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
{
if (!MON_MONFEAR(m_ptr))
{
- mproc_add(m_idx, MTIMED_MONFEAR);
+ mproc_add(floor_ptr, m_idx, MTIMED_MONFEAR);
notice = TRUE;
}
}
{
if (MON_MONFEAR(m_ptr))
{
- mproc_remove(m_idx, MTIMED_MONFEAR);
+ mproc_remove(floor_ptr, m_idx, MTIMED_MONFEAR);
notice = TRUE;
}
}
if (m_ptr->ml)
{
/* Update health bar as needed */
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+ if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
}
return TRUE;
/*!
* @brief モンスターの無敵状態値をセット /
* Set "m_ptr->mtimed[MTIMED_INVULNER]", notice observable changes
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx モンスター参照ID
* @param v セットする値
* @param energy_need TRUEならば無敵解除時に行動ターン消費を行う
* @return 別途更新処理が必要な場合TRUEを返す
*/
-bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need)
+bool set_monster_invulner(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ monster_type *m_ptr = &floor_ptr->m_list[m_idx];
bool notice = FALSE;
v = (v > 200) ? 200 : (v < 0) ? 0 : v;
{
if (!MON_INVULNER(m_ptr))
{
- mproc_add(m_idx, MTIMED_INVULNER);
+ mproc_add(floor_ptr, m_idx, MTIMED_INVULNER);
notice = TRUE;
}
}
{
if (MON_INVULNER(m_ptr))
{
- mproc_remove(m_idx, MTIMED_INVULNER);
- if (energy_need && !p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
+ mproc_remove(floor_ptr, m_idx, MTIMED_INVULNER);
+ if (energy_need && !target_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
notice = TRUE;
}
}
if (m_ptr->ml)
{
/* Update health bar as needed */
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
+ if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
}
return TRUE;
/*!
* @brief モンスターの各種状態値を時間経過により更新するサブルーチン
+* @param floor_ptr 現在フロアへの参照ポインタ
* @param m_idx モンスター参照ID
* @param mtimed_idx 更新するモンスターの時限ステータスID
* @return なし
*/
-static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
+static void process_monsters_mtimed_aux(player_type *target_ptr, MONSTER_IDX m_idx, int mtimed_idx)
{
monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
/* Monster wakes up "a little bit" */
/* Still asleep */
- if (!set_monster_csleep(m_idx, MON_CSLEEP(m_ptr) - d))
+ if (!set_monster_csleep(target_ptr, m_idx, MON_CSLEEP(m_ptr) - d))
{
/* Notice the "not waking up" */
if (is_original_ap_and_seen(m_ptr))
case MTIMED_FAST:
/* Reduce by one, note if expires */
- if (set_monster_fast(m_idx, MON_FAST(m_ptr) - 1))
+ if (set_monster_fast(target_ptr, m_idx, MON_FAST(m_ptr) - 1))
{
if (is_seen(m_ptr))
{
case MTIMED_SLOW:
/* Reduce by one, note if expires */
- if (set_monster_slow(m_idx, MON_SLOW(m_ptr) - 1))
+ if (set_monster_slow(target_ptr, m_idx, MON_SLOW(m_ptr) - 1))
{
if (is_seen(m_ptr))
{
int rlev = r_info[m_ptr->r_idx].level;
/* Recover from stun */
- if (set_monster_stunned(m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (MON_STUNNED(m_ptr) - 1)))
+ if (set_monster_stunned(target_ptr, m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (MON_STUNNED(m_ptr) - 1)))
{
/* Message if visible */
if (is_seen(m_ptr))
case MTIMED_CONFUSED:
/* Reduce the confusion */
- if (set_monster_confused(m_idx, MON_CONFUSED(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+ if (set_monster_confused(target_ptr, m_idx, MON_CONFUSED(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
{
/* Message if visible */
if (is_seen(m_ptr))
case MTIMED_MONFEAR:
/* Reduce the fear */
- if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+ if (set_monster_monfear(target_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
{
/* Visual note */
if (is_seen(m_ptr))
case MTIMED_INVULNER:
/* Reduce by one, note if expires */
- if (set_monster_invulner(m_idx, MON_INVULNER(m_ptr) - 1, TRUE))
+ if (set_monster_invulner(target_ptr, m_idx, MON_INVULNER(m_ptr) - 1, TRUE))
{
if (is_seen(m_ptr))
{
/*!
* @brief 全モンスターの各種状態値を時間経過により更新するメインルーチン
* @param mtimed_idx 更新するモンスターの時限ステータスID
+* @param target_ptr プレーヤーへの参照ポインタ
* @return なし
* @details
* Process the counters of monsters (once per 10 game turns)\n
* These functions are to process monsters' counters same as player's.
*/
-void process_monsters_mtimed(int mtimed_idx)
+void process_monsters_mtimed(player_type *target_ptr, int mtimed_idx)
{
int i;
- s16b *cur_mproc_list = p_ptr->current_floor_ptr->mproc_list[mtimed_idx];
+ floor_type *floor_ptr = target_ptr->current_floor_ptr;
+ s16b *cur_mproc_list = floor_ptr->mproc_list[mtimed_idx];
/* Hack -- calculate the "player noise" */
if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl));
/* Process the monsters (backwards) */
- for (i = p_ptr->current_floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
+ for (i = floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
{
- process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx);
+ process_monsters_mtimed_aux(target_ptr, cur_mproc_list[i], mtimed_idx);
}
}
+
/*!
* @brief モンスターへの魔力消去処理
+* @param target_ptr プレーヤーへの参照ポインタ
* @param m_idx 魔力消去を受けるモンスターの参照ID
* @return なし
*/
-void dispel_monster_status(MONSTER_IDX m_idx)
+void dispel_monster_status(player_type *target_ptr, MONSTER_IDX m_idx)
{
monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
GAME_TEXT m_name[MAX_NLEN];
monster_desc(m_name, m_ptr, 0);
- if (set_monster_invulner(m_idx, 0, TRUE))
+ if (set_monster_invulner(target_ptr, m_idx, 0, TRUE))
{
if (m_ptr->ml) msg_format(_("%sはもう無敵ではない。", "%^s is no longer invulnerable."), m_name);
}
- if (set_monster_fast(m_idx, 0))
+ if (set_monster_fast(target_ptr, m_idx, 0))
{
if (m_ptr->ml) msg_format(_("%sはもう加速されていない。", "%^s is no longer fast."), m_name);
}
- if (set_monster_slow(m_idx, 0))
+ if (set_monster_slow(target_ptr, m_idx, 0))
{
if (m_ptr->ml) msg_format(_("%sはもう減速されていない。", "%^s is no longer slow."), m_name);
}
if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
- (void)set_monster_csleep(m_idx, 0);
+ (void)set_monster_csleep(target_ptr, m_idx, 0);
/* Hack - Cancel any special player stealth magics. -LM- */
if (target_ptr->special_defense & NINJA_S_STEALTH)
if (MON_MONFEAR(m_ptr) && (dam > 0))
{
/* Cure fear */
- if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
+ if (set_monster_monfear(target_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(dam)))
{
/* No more fear */
(*fear) = FALSE;
(*fear) = TRUE;
/* Hack -- Add some timed fear */
- (void)set_monster_monfear(m_idx, (randint1(10) +
+ (void)set_monster_monfear(target_ptr, m_idx, (randint1(10) +
(((dam >= m_ptr->hp) && (percentage > 7)) ?
20 : ((11 - percentage) * 5))));
}
extern HIT_POINT mon_damage_mod(player_type *target_ptr, monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear);
extern bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, concptr note);
-extern int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type);
+extern int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type);
extern bool monster_is_valid(monster_type *m_ptr);
-extern bool set_monster_csleep(MONSTER_IDX m_idx, int v);
-extern bool set_monster_fast(MONSTER_IDX m_idx, int v);
-extern bool set_monster_slow(MONSTER_IDX m_idx, int v);
-extern bool set_monster_stunned(MONSTER_IDX m_idx, int v);
-extern bool set_monster_confused(MONSTER_IDX m_idx, int v);
-extern bool set_monster_monfear(MONSTER_IDX m_idx, int v);
-extern bool set_monster_invulner(MONSTER_IDX m_idx, int v, bool energy_need);
+extern bool set_monster_csleep(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_fast(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_slow(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_stunned(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_confused(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_monfear(player_type *target_ptr, MONSTER_IDX m_idx, int v);
+extern bool set_monster_invulner(player_type *target_ptr, MONSTER_IDX m_idx, int v, bool energy_need);
extern bool set_monster_timewalk(player_type *target_ptr, int num, MONSTER_IDX who, bool vs_player);
-extern void dispel_monster_status(MONSTER_IDX m_idx);
+extern void dispel_monster_status(player_type *target_ptr, MONSTER_IDX m_idx);
extern void monster_gain_exp(MONSTER_IDX m_idx, MONRACE_IDX s_idx);
+
+extern int get_mproc_idx(floor_type *floor_ptr, MONSTER_IDX m_idx, int mproc_type);
+extern void mproc_init(floor_type *floor_ptr);
+extern void process_monsters_mtimed(player_type *target_ptr, int mtimed_idx);
/* Hack -- count the number of "reproducers" */
if (r_ptr->flags2 & (RF2_MULTIPLY)) p_ptr->current_floor_ptr->num_repro--;
- if (MON_CSLEEP(m_ptr)) (void)set_monster_csleep(i, 0);
- if (MON_FAST(m_ptr)) (void)set_monster_fast(i, 0);
- if (MON_SLOW(m_ptr)) (void)set_monster_slow(i, 0);
- if (MON_STUNNED(m_ptr)) (void)set_monster_stunned(i, 0);
- if (MON_CONFUSED(m_ptr)) (void)set_monster_confused(i, 0);
- if (MON_MONFEAR(m_ptr)) (void)set_monster_monfear(i, 0);
- if (MON_INVULNER(m_ptr)) (void)set_monster_invulner(i, 0, FALSE);
+ if (MON_CSLEEP(m_ptr)) (void)set_monster_csleep(p_ptr, i, 0);
+ if (MON_FAST(m_ptr)) (void)set_monster_fast(p_ptr, i, 0);
+ if (MON_SLOW(m_ptr)) (void)set_monster_slow(p_ptr, i, 0);
+ if (MON_STUNNED(m_ptr)) (void)set_monster_stunned(p_ptr, i, 0);
+ if (MON_CONFUSED(m_ptr)) (void)set_monster_confused(p_ptr, i, 0);
+ if (MON_MONFEAR(m_ptr)) (void)set_monster_monfear(p_ptr, i, 0);
+ if (MON_INVULNER(m_ptr)) (void)set_monster_invulner(p_ptr, i, 0, FALSE);
/* Hack -- remove target monster */
if (i == target_who) target_who = 0;
if (i1 == i2) return;
/* Old monster */
- m_ptr = &p_ptr->current_floor_ptr->m_list[i1];
+ floor_type *floor_ptr = p_ptr->current_floor_ptr;
+ m_ptr = &floor_ptr->m_list[i1];
y = m_ptr->fy;
x = m_ptr->fx;
/* Cave grid */
- g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+ g_ptr = &floor_ptr->grid_array[y][x];
g_ptr->m_idx = i2;
for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
- o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
+ o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
/* Reset monster pointer */
/* Hack -- Update parent index */
if (is_pet(m_ptr))
{
- for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+ for (i = 1; i < floor_ptr->m_max; i++)
{
- monster_type *m2_ptr = &p_ptr->current_floor_ptr->m_list[i];
+ monster_type *m2_ptr = &floor_ptr->m_list[i];
if (m2_ptr->parent_m_idx == i1)
m2_ptr->parent_m_idx = i2;
}
/* Structure copy */
- (void)COPY(&p_ptr->current_floor_ptr->m_list[i2], &p_ptr->current_floor_ptr->m_list[i1], monster_type);
+ (void)COPY(&floor_ptr->m_list[i2], &floor_ptr->m_list[i1], monster_type);
/* Wipe the hole */
- (void)WIPE(&p_ptr->current_floor_ptr->m_list[i1], monster_type);
+ (void)WIPE(&floor_ptr->m_list[i1], monster_type);
for (i = 0; i < MAX_MTIMED; i++)
{
- int mproc_idx = get_mproc_idx(i1, i);
- if (mproc_idx >= 0) p_ptr->current_floor_ptr->mproc_list[i][mproc_idx] = i2;
+ int mproc_idx = get_mproc_idx(floor_ptr, i1, i);
+ if (mproc_idx >= 0) floor_ptr->mproc_list[i][mproc_idx] = i2;
}
}
if ((mode & PM_ALLOW_SLEEP) && r_ptr->sleep && !ironman_nightmare)
{
int val = r_ptr->sleep;
- (void)set_monster_csleep(g_ptr->m_idx, (val * 2) + randint1(val * 10));
+ (void)set_monster_csleep(p_ptr, g_ptr->m_idx, (val * 2) + randint1(val * 10));
}
/* Assign maximal hitpoints */
/* Extract the monster base speed */
m_ptr->mspeed = get_mspeed(r_ptr);
- if (mode & PM_HASTE) (void)set_monster_fast(g_ptr->m_idx, 100);
-
+ if (mode & PM_HASTE) (void)set_monster_fast(p_ptr, g_ptr->m_idx, 100);
+
/* Give a random starting energy */
if (!ironman_nightmare)
{
if (!m_idx) break;
if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
- dispel_monster_status(m_idx);
+ dispel_monster_status(caster_ptr, m_idx);
break;
}
case MS_ROCKET:
if (TARGET_TYPE == MONSTER_TO_MONSTER)
{
- set_monster_csleep(t_idx, 0);
+ set_monster_csleep(target_ptr, t_idx, 0);
}
}
if (TARGET_TYPE == MONSTER_TO_PLAYER)
{
dispel_player(target_ptr);
- if (target_ptr->riding) dispel_monster_status(target_ptr->riding);
+ if (target_ptr->riding) dispel_monster_status(target_ptr, target_ptr->riding);
if ((target_ptr->pseikaku == SEIKAKU_COMBAT) || (target_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
msg_print(_("やりやがったな!", ""));
if (TARGET_TYPE == MONSTER_TO_MONSTER)
{
if (t_idx == target_ptr->riding) dispel_player(target_ptr);
- dispel_monster_status(t_idx);
+ dispel_monster_status(target_ptr, t_idx);
}
}
if (see_t) msg_format(msg4, t_name);
}
- set_monster_csleep(t_idx, 0);
+ set_monster_csleep(target_ptr, t_idx, 0);
}
if (!resist && !saving_throw)
{
- set_monster_monfear(t_idx, MON_MONFEAR(t_ptr) + randint0(4) + 4);
+ set_monster_monfear(target_ptr, t_idx, MON_MONFEAR(t_ptr) + randint0(4) + 4);
}
}
if (!resist && !saving_throw)
{
- (void)set_monster_confused(t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
+ (void)set_monster_confused(target_ptr, t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
}
}
if (!resist && !saving_throw)
{
- (void)set_monster_confused(t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
+ (void)set_monster_confused(target_ptr, t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
}
}
if (!resist && !saving_throw)
{
- set_monster_slow(t_idx, MON_SLOW(t_ptr) + 50);
+ set_monster_slow(target_ptr, t_idx, MON_SLOW(t_ptr) + 50);
}
}
if (!resist && !saving_throw)
{
- (void)set_monster_stunned(t_idx, MON_STUNNED(t_ptr) + randint1(4) + 4);
+ (void)set_monster_stunned(target_ptr, t_idx, MON_STUNNED(t_ptr) + randint1(4) + 4);
}
}
target_ptr->blind > 0, TARGET_TYPE);
/* Allow quick speed increases to base+10 */
- if (set_monster_fast(m_idx, MON_FAST(m_ptr) + 100))
+ if (set_monster_fast(target_ptr, m_idx, MON_FAST(m_ptr) + 100))
{
if (TARGET_TYPE == MONSTER_TO_PLAYER ||
(TARGET_TYPE == MONSTER_TO_MONSTER && see_m))
if (!MON_MONFEAR(m_ptr)) return;
/* Cancel fear */
- (void)set_monster_monfear(m_idx, 0);
+ (void)set_monster_monfear(target_ptr, m_idx, 0);
if (see_monster(floor_ptr, m_idx))
msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
_("%sは無傷の球の呪文を唱えた。", "%^s casts a Globe of Invulnerability."),
!seen, TARGET_TYPE);
- if (!MON_INVULNER(m_ptr)) (void)set_monster_invulner(m_idx, randint1(4) + 4, FALSE);
+ if (!MON_INVULNER(m_ptr)) (void)set_monster_invulner(target_ptr, m_idx, randint1(4) + 4, FALSE);
}
if (resists_tele)
{
- set_monster_csleep(t_idx, 0);
+ set_monster_csleep(target_ptr, t_idx, 0);
return;
}
teleport_player_to(target_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
else
teleport_monster_to(target_ptr, t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_PASSIVE);
- set_monster_csleep(t_idx, 0);
+ set_monster_csleep(target_ptr, t_idx, 0);
}
if (resists_tele)
{
- set_monster_csleep(t_idx, 0);
+ set_monster_csleep(target_ptr, t_idx, 0);
return;
}
teleport_player_away(m_idx, target_ptr, MAX_SIGHT * 2 + 5);
else
teleport_away(target_ptr, t_idx, MAX_SIGHT * 2 + 5, TELEPORT_PASSIVE);
- set_monster_csleep(t_idx, 0);
+ set_monster_csleep(target_ptr, t_idx, 0);
}
if (creature_ptr->riding)
{
- (void)set_monster_fast(creature_ptr->riding, 0);
- (void)set_monster_slow(creature_ptr->riding, 0);
- (void)set_monster_invulner(creature_ptr->riding, 0, FALSE);
+ (void)set_monster_fast(creature_ptr, creature_ptr->riding, 0);
+ (void)set_monster_slow(creature_ptr, creature_ptr->riding, 0);
+ (void)set_monster_invulner(creature_ptr, creature_ptr->riding, 0, FALSE);
}
if (creature_ptr->pclass == CLASS_BARD)
pattern_seq(creature_ptr, creature_ptr->y, creature_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
{
/* Disturb the monster */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
monster_desc(m_name, m_ptr, 0);
damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
/* Monster is certainly awake */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
/* Apply damage directly */
m_ptr->hp -= damage;
/* Normal monsters slow down */
else
{
- if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+ if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
{
note = _("の動きが遅くなった。", " starts moving slower.");
}
/* Normal monsters slow down */
else
{
- if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+ if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
{
note = _("の動きが遅くなった。", " starts moving slower.");
}
if (seen) obvious = TRUE;
/* Wake up */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
if (m_ptr->maxhp < m_ptr->max_maxhp)
{
if (seen) obvious = TRUE;
/* Wake up */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
if (MON_STUNNED(m_ptr))
{
if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
- (void)set_monster_stunned(g_ptr->m_idx, 0);
+ (void)set_monster_stunned(caster_ptr, g_ptr->m_idx, 0);
}
if (MON_CONFUSED(m_ptr))
{
if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
- (void)set_monster_confused(g_ptr->m_idx, 0);
+ (void)set_monster_confused(caster_ptr, g_ptr->m_idx, 0);
}
if (MON_MONFEAR(m_ptr))
{
if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
- (void)set_monster_monfear(g_ptr->m_idx, 0);
+ (void)set_monster_monfear(caster_ptr, g_ptr->m_idx, 0);
}
/* Heal */
if (seen) obvious = TRUE;
/* Speed up */
- if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
+ if (set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100))
{
note = _("の動きが速くなった。", " starts moving faster.");
}
/* Normal monsters slow down */
else
{
- if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+ if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
{
note = _("の動きが遅くなった。", " starts moving slower.");
}
do_conf = randint0(8) + 8;
do_stun = randint0(8) + 8;
}
- (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
+ (void)set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
}
break;
}
/* Normal monsters slow down */
else
{
- if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
+ if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
{
note = _("の動きが遅くなった。", " starts moving slower.");
}
if (is_pet(m_ptr))
{
note = _("の動きが速くなった。", " starts moving faster.");
- (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
+ (void)set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100);
success = TRUE;
}
{
note = _("を支配した。", " is tamed!");
set_pet(m_ptr);
- (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
+ (void)set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100);
/* Learn about type */
if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
}
/* Apply stun */
- (void)set_monster_stunned(g_ptr->m_idx, tmp);
+ (void)set_monster_stunned(caster_ptr, g_ptr->m_idx, tmp);
/* Get angry */
get_angry = TRUE;
}
/* Apply confusion */
- (void)set_monster_confused(g_ptr->m_idx, tmp);
+ (void)set_monster_confused(caster_ptr, g_ptr->m_idx, tmp);
/* Get angry */
get_angry = TRUE;
if (do_fear)
{
/* Set fear */
- (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
+ (void)set_monster_monfear(caster_ptr, g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
/* Get angry */
get_angry = TRUE;
if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
/* Wake the monster up */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
/* Hurt the monster */
m_ptr->hp -= dam;
}
/* Hack -- handle sleep */
- if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
+ if (do_sleep) (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, do_sleep);
}
}
}
/* Hack -- handle sleep */
- if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
+ if (do_sleep) (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, do_sleep);
}
}
/* Wake up */
if (MON_CSLEEP(m_ptr))
{
- (void)set_monster_csleep(i, 0);
+ (void)set_monster_csleep(caster_ptr, i, 0);
sleep = TRUE;
}
if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
{
if (!is_pet(m_ptr))
{
- (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
+ (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
speed = TRUE;
}
}
if (MON_CSLEEP(m_ptr))
{
- (void)set_monster_csleep(m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, m_idx, 0);
if (m_ptr->ml)
{
msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
{
/* Wake up! */
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
/* Notice the "waking up" */
if (m_ptr->ml)
m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
r_ptr = &r_info[m_ptr->r_idx];
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
if (r_ptr->flagsr & RFR_RES_TELE)
{
/* Awake monster */
if (g_ptr->m_idx && MON_CSLEEP(m_ptr))
{
- (void)set_monster_csleep(g_ptr->m_idx, 0);
+ (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
/* Notice the "waking up" */
if (m_ptr->ml)
floor_ptr->m_list[hack_m_idx_ii] = back_m;
/* Re-initialize monster process */
- mproc_init();
+ mproc_init(floor_ptr);
}
else preserve_hold_objects = FALSE;
}