#include "monster/monster-list.h"
#include "core/player-update-types.h"
#include "core/speed-table.h"
+#include "dungeon/dungeon-flag-types.h"
#include "dungeon/dungeon.h"
+#include "floor/cave.h"
#include "floor/floor-object.h"
#include "floor/wild.h"
#include "game-option/birth-options.h"
+#include "game-option/cheat-options.h"
#include "grid/grid.h"
#include "monster-floor/monster-summon.h"
#include "monster-race/monster-race.h"
#include "object/object-generator.h"
#include "pet/pet-fall-off.h"
#include "system/alloc-entries.h"
+#include "system/floor-type-definition.h"
#include "view/display-messages.h"
#include "world/world.h"
/*!
* @brief 生成モンスター種族を1種生成テーブルから選択する
* @param player_ptr プレーヤーへの参照ポインタ
- * @param level 生成階
+ * @param min_level 最小生成階
+ * @param max_level 最大生成階
* @return 選択されたモンスター生成種族
*/
-MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level, BIT_FLAGS option)
+MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH min_level, DEPTH max_level, BIT_FLAGS option)
{
int i, j, p;
int r_idx;
long value, total;
+ int mon_num = 0;
monster_race *r_ptr;
alloc_entry *table = alloc_race_table;
- int pls_kakuritu, pls_level, over_days;
- int delay = mysqrt(level * 10000L) + (level * 5);
+ int pls_kakuritu, pls_max_level, over_days;
+ int delay = mysqrt(max_level * 10000L) + (max_level * 5);
- /* town level : same delay as 10F, no nasty mons till day18 */
- if (!level)
+ /* town max_level : same delay as 10F, no nasty mons till day18 */
+ if (!max_level)
delay = 360;
- if (level > MAX_DEPTH - 1)
- level = MAX_DEPTH - 1;
+ if (max_level > MAX_DEPTH - 1)
+ max_level = MAX_DEPTH - 1;
/* +1 per day after the base date */
/* base dates : day5(1F), day18(10F,0F), day34(30F), day53(60F), day69(90F) */
over_days = MAX(0, current_world_ptr->dungeon_turn / (TURNS_PER_TICK * 10000L) - delay / 20);
- /* starts from 1/25, reaches 1/3 after 44days from a level dependent base date */
+ /* starts from 1/25, reaches 1/3 after 44days from a max_level dependent base date */
pls_kakuritu = MAX(NASTY_MON_MAX, NASTY_MON_BASE - over_days / 2);
- /* starts from 0, reaches +25lv after 75days from a level dependent base date */
- pls_level = MIN(NASTY_MON_PLUS_MAX, over_days / 3);
+ /* starts from 0, reaches +25lv after 75days from a max_level dependent base date */
+ pls_max_level = MIN(NASTY_MON_PLUS_MAX, over_days / 3);
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;
- pls_level += 2;
- level += 3;
+ pls_max_level += 2;
+ max_level += 3;
}
- /* Boost the level */
- if (!player_ptr->phase_out && !(d_info[player_ptr->dungeon_idx].flags1 & DF1_BEGINNER)) {
+ /* Boost the max_level */
+ if ((option & GMN_ARENA) || !(d_info[player_ptr->dungeon_idx].flags1 & DF1_BEGINNER)) {
/* Nightmare mode allows more out-of depth monsters */
if (ironman_nightmare && !randint0(pls_kakuritu)) {
/* What a bizarre calculation */
- level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
+ max_level = 1 + (max_level * MAX_DEPTH / randint1(MAX_DEPTH));
} else {
/* Occasional "nasty" monster */
if (!randint0(pls_kakuritu)) {
- /* Pick a level bonus */
- level += pls_level;
+ /* Pick a max_level bonus */
+ max_level += pls_max_level;
}
}
}
/* Process probabilities */
for (i = 0; i < alloc_race_size; i++) {
- if (table[i].level > level)
- break;
table[i].prob3 = 0;
+ if (table[i].level < min_level)
+ continue;
+ if (max_level < table[i].level)
+ break; // sorted by depth array,
r_idx = table[i].index;
r_ptr = &r_info[r_idx];
if (!(option & GMN_ARENA) && !chameleon_change_m_idx) {
}
}
+ mon_num++;
table[i].prob3 = table[i].prob2;
total += table[i].prob3;
}
+ if (cheat_hear) {
+ msg_format(_("モンスター第3次候補数:%d(%d-%dF)%d ", "monster third selection:%d(%d-%dF)%d "), mon_num, min_level, max_level, total);
+ }
+
if (total <= 0)
return 0;
if (d_info[player_ptr->dungeon_idx].flags1 & DF1_CHAMELEON)
level += 2 + randint1(3);
- r_idx = get_mon_num(player_ptr, level, 0);
+ r_idx = get_mon_num(player_ptr, 0, level, 0);
r_ptr = &r_info[r_idx];
chameleon_change_m_idx = 0;
msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
}
- m_ptr->mspeed = get_mspeed(player_ptr, r_ptr);
+ m_ptr->mspeed = get_mspeed(floor_ptr, r_ptr);
int oldmaxhp = m_ptr->max_maxhp;
if (r_ptr->flags1 & RF1_FORCE_MAXHP) {
}
/*!
- * todo ここには本来floor_type*を追加したいが、monster.hにfloor.hの参照を追加するとコンパイルエラーが出るので保留
* @brief モンスターの個体加速を設定する / Get initial monster speed
* @param r_ptr モンスター種族の参照ポインタ
* @return 加速値
*/
-SPEED get_mspeed(player_type *player_ptr, monster_race *r_ptr)
+SPEED get_mspeed(floor_type *floor_ptr, monster_race *r_ptr)
{
SPEED mspeed = r_ptr->speed;
- if (!(r_ptr->flags1 & RF1_UNIQUE) && !player_ptr->current_floor_ptr->inside_arena) {
+ if (!(r_ptr->flags1 & RF1_UNIQUE) && !floor_ptr->inside_arena) {
/* Allow some small variation per monster */
int i = SPEED_TO_ENERGY(r_ptr->speed) / (one_in_(4) ? 3 : 10);
if (i)
}
return count;
-}
+}
\ No newline at end of file