for (i = rand_range(3, 4); i > 0; i--)
{
object_prep(q_ptr, lookup_kind(TV_CORPSE, SV_CORPSE));
- q_ptr->pval = get_mon_num(2);
+ q_ptr->pval = get_mon_num(creature_ptr, 2);
if (q_ptr->pval)
{
q_ptr->number = 1;
{
get_mon_num_prep(player_ptr, monster_can_entry_arena, NULL);
player_ptr->phase_out = TRUE;
- r_idx = get_mon_num(mon_level);
+ r_idx = get_mon_num(player_ptr, mon_level);
player_ptr->phase_out = old_inside_battle;
if (!r_idx) continue;
if (q_ptr->r_idx == 0)
{
/* Random monster at least 5 - 10 levels out of deep */
- q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
+ q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6));
}
monster_race *r_ptr;
while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
{
- q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
+ q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level) + 4 + randint1(6);
r_ptr = &r_info[q_ptr->r_idx];
}
while (TRUE)
{
- today_mon = get_mon_num(max_dl);
+ today_mon = get_mon_num(player_ptr, max_dl);
monster_race *r_ptr;
r_ptr = &r_info[today_mon];
{
while (TRUE)
{
- current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
+ current_world_ptr->bounty_r_idx[i] = get_mon_num(player_ptr, MAX_DEPTH - 1);
monster_race *r_ptr;
r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
MONRACE_IDX r_idx;
bool success = FALSE;
get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
- r_idx = get_mon_num(creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
+ r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
msg_print(NULL);
if (r_idx && one_in_(2))
{
extern void wipe_monsters_list(player_type *player_ptr);
extern MONSTER_IDX m_pop(player_type *player_ptr);
extern errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2);
-extern MONRACE_IDX get_mon_num(DEPTH level);
+extern MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level);
extern int lore_do_probe(MONRACE_IDX r_idx);
extern void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold);
extern void update_monster(player_type *subject_ptr, MONSTER_IDX m_idx, bool full);
/*!
* @brief 生成モンスター種族を1種生成テーブルから選択する
+ * @param player_ptr プレーヤーへの参照ポインタ
* @param level 生成階
* @return 選択されたモンスター生成種族
* @details
* Note that if no monsters are "appropriate", then this function will
* fail, and return zero, but this should *almost* never happen.
*/
-MONRACE_IDX get_mon_num(DEPTH level)
+MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level)
{
int i, j, p;
MONRACE_IDX r_idx;
pls_kakuritu = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 5000L) - delay / 10)));
pls_level = MIN(NASTY_MON_PLUS_MAX, 3 + current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 40000L) - delay / 40 + MIN(5, level / 10));
- if (d_info[p_ptr->dungeon_idx].flags1 & DF1_MAZE)
+ if (d_info[player_ptr->dungeon_idx].flags1 & DF1_MAZE)
{
pls_kakuritu = MIN(pls_kakuritu / 2, pls_kakuritu - 10);
if (pls_kakuritu < 2) pls_kakuritu = 2;
}
/* Boost the level */
- if (!p_ptr->phase_out && !(d_info[p_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
+ if (!player_ptr->phase_out && !(d_info[player_ptr->dungeon_idx].flags1 & DF1_BEGINNER))
{
/* Nightmare mode allows more out-of depth monsters */
if (ironman_nightmare && !randint0(pls_kakuritu))
/* Access the actual race */
r_ptr = &r_info[r_idx];
- if (!p_ptr->phase_out && !chameleon_change_m_idx)
+ if (!player_ptr->phase_out && !chameleon_change_m_idx)
{
/* Hack -- "unique" monsters must be "unique" */
if (((r_ptr->flags1 & (RF1_UNIQUE)) ||
if (d_info[player_ptr->dungeon_idx].flags1 & DF1_CHAMELEON) level += 2 + randint1(3);
- r_idx = get_mon_num(level);
+ r_idx = get_mon_num(player_ptr, level);
r_ptr = &r_info[r_idx];
chameleon_change_m_idx = 0;
while (--attempts)
{
- ap_r_idx = get_mon_num(floor_ptr->base_level + 10);
+ ap_r_idx = get_mon_num(player_ptr, floor_ptr->base_level + 10);
if (r_info[ap_r_idx].level >= min) return ap_r_idx;
}
get_mon_num_prep(player_ptr, place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
/* Pick a random race */
- z = get_mon_num(r_ptr->level);
+ z = get_mon_num(player_ptr, r_ptr->level);
/* Handle failure */
if (!z) break;
get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
/* Pick a monster */
- r_idx = get_mon_num(player_ptr->current_floor_ptr->monster_level);
+ r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->monster_level);
/* Handle failure */
if (!r_idx) return FALSE;
while (--attempts)
{
/* Pick a monster */
- r_idx = get_mon_num(floor_ptr->monster_level);
+ r_idx = get_mon_num(player_ptr, floor_ptr->monster_level);
/* Handle failure */
if (!r_idx) return FALSE;
get_mon_num_prep(player_ptr, summon_specific_okay, get_monster_hook2(player_ptr, y, x));
/* Pick a monster, using the level calculation */
- r_idx = get_mon_num((floor_ptr->dun_level + lev) / 2 + 5);
+ r_idx = get_mon_num(player_ptr, (floor_ptr->dun_level + lev) / 2 + 5);
/* Handle failure */
if (!r_idx)
get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
/* Pick a race to clone */
- vault_aux_race = get_mon_num(p_ptr->current_floor_ptr->dun_level + 10);
+ vault_aux_race = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10);
/* Remove the monster restriction */
get_mon_num_prep(player_ptr, NULL, NULL);
get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
/* Pick a race to clone */
- r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level + 10);
+ r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10);
/* Remove the monster restriction */
get_mon_num_prep(player_ptr, NULL, NULL);
/* Pick a random non-unique monster race */
while (TRUE)
{
- i = get_mon_num(floor_ptr->dun_level);
+ i = get_mon_num(owner_ptr, floor_ptr->dun_level);
r_ptr = &r_info[i];
get_mon_num_prep(creature_ptr, get_nightmare, NULL);
- r_ptr = &r_info[get_mon_num(MAX_DEPTH)];
+ r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH)];
power = r_ptr->level + 10;
desc = r_name + r_ptr->name;
* Random monster 5 - 10 levels out of depth
* (depending on level)
*/
- r_idx = get_mon_num(q_ptr->level + 5 + randint1(q_ptr->level / 10));
+ r_idx = get_mon_num(player_ptr, q_ptr->level + 5 + randint1(q_ptr->level / 10));
monster_race *r_ptr;
r_ptr = &r_info[r_idx];
while (attempts--)
{
/* Get a (hard) monster type */
- r_idx = get_mon_num(floor_ptr->dun_level + 11);
+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
while (attempts--)
{
/* Get a (hard) monster type */
- r_idx = get_mon_num(floor_ptr->dun_level + 11);
+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11);
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
while (attempts--)
{
/* Get a (hard) monster type */
- r_idx = get_mon_num(floor_ptr->dun_level + 0);
+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 0);
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
/* Place fixed lite berathers */
for (dir1 = 4; dir1 < 8; dir1++)
{
- MONRACE_IDX r_idx = get_mon_num(floor_ptr->dun_level);
+ MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level);
y = yval + 2 * ddy_ddd[dir1];
x = xval + 2 * ddx_ddd[dir1];
g_ptr->feat = feat_glass_wall;
get_mon_num_prep(player_ptr, vault_aux_lite, NULL);
- r_idx = get_mon_num(floor_ptr->dun_level);
+ r_idx = get_mon_num(player_ptr, floor_ptr->dun_level);
if (r_idx) place_monster_aux(player_ptr, 0, yval, xval, r_idx, 0L);
/* Walls around the breather */
/* Place shard berathers */
for (dir1 = 4; dir1 < 8; dir1++)
{
- MONRACE_IDX r_idx = get_mon_num(floor_ptr->dun_level);
+ MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level);
y = yval + ddy_ddd[dir1];
x = xval + ddx_ddd[dir1];
for (int i = 0; i < 1000; i++)
{
/* Pick a new race, using a level calculation */
- r = get_mon_num((caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
+ r = get_mon_num(caster_ptr, (caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
/* Handle failure */
if (!r) break;