OSDN Git Service

[Fix] #41316 賞金首生成時に判明したget_mon_num_prep(), get_mon_num()のバグ修正 / Fix get_mon_num_prep...
authordeskull <deskull@users.sourceforge.jp>
Tue, 26 Jan 2021 13:36:09 +0000 (22:36 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 26 Jan 2021 13:36:09 +0000 (22:36 +0900)
 * get_mon_num_prep()時、条件を通った後ダンジョンごとのMONSTER_DIV修正でprop値が0になる部分を最低1保証.
 * 最低階層処理をget_mon_num()に回したことに伴う、prep値とtotal値の食い違いを修正.

src/market/bounty.c
src/monster/monster-list.c
src/monster/monster-util.c

index 876ac79..7fda5f5 100644 (file)
@@ -289,7 +289,7 @@ void determine_daily_bounty(player_type *player_ptr, bool conv_old)
         r_ptr = &r_info[today_mon];
 
         if (cheat_hear) {
-            msg_format("日替わり: %s ", r_ptr->name + r_name);
+            msg_format("日替わり候補: %s ", r_ptr->name + r_name);
         }
 
         if (r_ptr->flags1 & RF1_UNIQUE)
index 612390d..d8f67c6 100644 (file)
@@ -134,9 +134,11 @@ MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH min_level, DEPTH max_leve
 
     /* Process probabilities */
     for (i = 0; i < alloc_race_size; i++) {
-        if (table[i].level < min_level) continue; 
-        if (max_level < table[i].level) break; // sorted by depth array,
         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) {
@@ -162,7 +164,7 @@ MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH min_level, DEPTH max_leve
     }
 
     if (cheat_hear) {
-        msg_format(_("モンスター第3次候補数:%d(%d-%dF) ", "monster third selection:%d(%d-%dF) "), mon_num, min_level, max_level);
+        msg_format(_("モンスター第3次候補数:%d(%d-%dF)%d ", "monster third selection:%d(%d-%dF)%d "), mon_num, min_level, max_level, total);
     }
 
     if (total <= 0)
index 7ec7850..bdc2366 100644 (file)
@@ -326,6 +326,7 @@ errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hoo
     int mon_num = 0;
     DEPTH lev_min = 127;
     DEPTH lev_max = 0;
+    int total = 0;
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     for (int i = 0; i < alloc_race_size; i++) {
         alloc_entry *entry = &alloc_race_table[i];
@@ -346,12 +347,16 @@ errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hoo
                 continue;
         }
 
+        if (entry->prob1 <= 0)
+            continue;
+
         mon_num++;
         if (lev_min > entry->level)
             lev_min = entry->level;
         if (lev_max < entry->level)
             lev_max = entry->level;
 
+
         entry->prob2 = entry->prob1;
         if (floor_ptr->dun_level && (!floor_ptr->inside_quest || is_fixed_quest_idx(floor_ptr->inside_quest))
             && !restrict_monster_to_dungeon(player_ptr, entry->index) && !player_ptr->phase_out) {
@@ -359,10 +364,15 @@ errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hoo
             entry->prob2 = hoge / 64;
             if (randint0(64) < (hoge & 0x3f))
                 entry->prob2++;
+            if (entry->prob2 <= 0)
+                entry->prob2 = 1;
         }
+
+        total += entry->prob2; 
+
     }
     if (cheat_hear) {
-        msg_format(_("モンスター第2次候補数:%d(%d-%dF) ", "monster second selection:%d(%d-%dF) "), mon_num, lev_min, lev_max);
+        msg_format(_("モンスター第2次候補数:%d(%d-%dF)%d ", "monster second selection:%d(%d-%dF)&d "), mon_num, lev_min, lev_max, total);
     }
     return 0;
 }