OSDN Git Service

Merge branch 'feature/Fix-Potion-Shatter' into develop
authordis- <dis.rogue@gmail.com>
Tue, 26 Jan 2021 14:12:55 +0000 (23:12 +0900)
committerdis- <dis.rogue@gmail.com>
Tue, 26 Jan 2021 14:12:55 +0000 (23:12 +0900)
18 files changed:
src/birth/inventory-initializer.c
src/core/player-processor.c
src/dungeon/quest.c
src/market/arena.c
src/market/bounty.c
src/market/building-quest.c
src/monster-floor/monster-generator.c
src/monster-floor/monster-summon.c
src/monster-floor/one-monster-placer.c
src/monster-race/monster-race-hook.c
src/monster/monster-list.c
src/monster/monster-list.h
src/monster/monster-util.c
src/object-enchant/apply-magic-others.c
src/player/eldritch-horror.c
src/room/rooms-pit-nest.c
src/room/rooms-special.c
src/spell-kind/spells-polymorph.c

index 65aedcf..49f83be 100644 (file)
@@ -96,7 +96,7 @@ static void decide_initial_items(player_type *creature_ptr, object_type *q_ptr)
         get_mon_num_prep(creature_ptr, monster_hook_human, NULL);
         for (int i = rand_range(3, 4); i > 0; i--) {
             object_prep(creature_ptr, q_ptr, lookup_kind(TV_CORPSE, SV_CORPSE));
-            q_ptr->pval = get_mon_num(creature_ptr, 2, 0);
+            q_ptr->pval = get_mon_num(creature_ptr, 0, 2, 0);
             if (q_ptr->pval) {
                 q_ptr->number = 1;
                 add_outfit(creature_ptr, q_ptr);
index c1be1d5..c38bb69 100644 (file)
@@ -56,7 +56,7 @@ static void process_fishing(player_type *creature_ptr)
         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,
+        r_idx = get_mon_num(creature_ptr, 0,
             creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level
                                                        : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level,
             0);
index 834b970..de13844 100644 (file)
@@ -67,7 +67,7 @@ void determine_random_questor(player_type *player_ptr, quest_type *q_ptr)
          * Random monster 5 - 10 levels out of depth
          * (depending on level)
          */
-        r_idx = get_mon_num(player_ptr, q_ptr->level + 5 + randint1(q_ptr->level / 10), GMN_ARENA);
+        r_idx = get_mon_num(player_ptr, 0, q_ptr->level + 5 + randint1(q_ptr->level / 10), GMN_ARENA);
         monster_race *r_ptr;
         r_ptr = &r_info[r_idx];
 
index 4daa4bf..16ef04c 100644 (file)
@@ -197,7 +197,7 @@ void update_gambling_monsters(player_type *player_ptr)
             int j;
             while (TRUE) {
                 get_mon_num_prep(player_ptr, monster_can_entry_arena, NULL);
-                r_idx = get_mon_num(player_ptr, mon_level, GMN_ARENA);
+                r_idx = get_mon_num(player_ptr, 0, mon_level, GMN_ARENA);
                 if (!r_idx)
                     continue;
 
index 31f58c7..7fda5f5 100644 (file)
@@ -6,6 +6,7 @@
 #include "core/stuff-handler.h"
 #include "dungeon/dungeon.h"
 #include "flavor/flavor-describer.h"
+#include "game-option/cheat-options.h"
 #include "inventory/inventory-object.h"
 #include "inventory/inventory-slot-types.h"
 #include "io/input-key-acceptor.h"
@@ -283,10 +284,14 @@ void determine_daily_bounty(player_type *player_ptr, bool conv_old)
     get_mon_num_prep(player_ptr, NULL, NULL);
 
     while (TRUE) {
-        today_mon = get_mon_num(player_ptr, max_dl, GMN_ARENA);
+        today_mon = get_mon_num(player_ptr, MIN(max_dl / 2, 40), max_dl, GMN_ARENA);
         monster_race *r_ptr;
         r_ptr = &r_info[today_mon];
 
+        if (cheat_hear) {
+            msg_format("日替わり候補: %s ", r_ptr->name + r_name);
+        }
+
         if (r_ptr->flags1 & RF1_UNIQUE)
             continue;
         if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2))
@@ -295,8 +300,6 @@ void determine_daily_bounty(player_type *player_ptr, bool conv_old)
             continue;
         if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON))
             continue;
-        if (r_ptr->level < MIN(max_dl / 2, 40))
-            continue;
         if (r_ptr->rarity > 10)
             continue;
         break;
@@ -313,7 +316,7 @@ void determine_bounty_uniques(player_type *player_ptr)
     get_mon_num_prep(player_ptr, NULL, NULL);
     for (int i = 0; i < MAX_BOUNTY; i++) {
         while (TRUE) {
-            current_world_ptr->bounty_r_idx[i] = get_mon_num(player_ptr, MAX_DEPTH - 1, GMN_ARENA);
+            current_world_ptr->bounty_r_idx[i] = get_mon_num(player_ptr, 0, MAX_DEPTH - 1, GMN_ARENA);
             monster_race *r_ptr;
             r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
 
index 72c9d87..744a0fd 100644 (file)
@@ -98,13 +98,13 @@ void castle_quest(player_type *player_ptr)
     }
 
     if (q_ptr->r_idx == 0) {
-        q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6), 0);
+        q_ptr->r_idx = get_mon_num(player_ptr, 0, q_ptr->level + 4 + randint1(6), 0);
     }
 
     monster_race *r_ptr;
     r_ptr = &r_info[q_ptr->r_idx];
     while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1)) {
-        q_ptr->r_idx = get_mon_num(player_ptr, q_ptr->level + 4 + randint1(6), 0);
+        q_ptr->r_idx = get_mon_num(player_ptr, 0, q_ptr->level + 4 + randint1(6), 0);
         r_ptr = &r_info[q_ptr->r_idx];
     }
 
index 3b04cd1..5021a2f 100644 (file)
@@ -298,7 +298,7 @@ bool place_monster_aux(player_type *player_ptr, MONSTER_IDX who, POSITION y, POS
             continue;
 
         get_mon_num_prep(player_ptr, place_monster_can_escort, get_monster_hook2(player_ptr, ny, nx));
-        z = get_mon_num(player_ptr, r_ptr->level, 0);
+        z = get_mon_num(player_ptr, 0, r_ptr->level, 0);
         if (!z)
             break;
 
@@ -322,7 +322,7 @@ bool place_monster_aux(player_type *player_ptr, MONSTER_IDX who, POSITION y, POS
 bool place_monster(player_type *player_ptr, POSITION y, POSITION x, BIT_FLAGS mode)
 {
     get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), get_monster_hook2(player_ptr, y, x));
-    MONRACE_IDX r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->monster_level, 0);
+    MONRACE_IDX r_idx = get_mon_num(player_ptr, 0, player_ptr->current_floor_ptr->monster_level, 0);
     if (r_idx == 0)
         return FALSE;
 
@@ -350,7 +350,7 @@ bool alloc_horde(player_type *player_ptr, POSITION y, POSITION x, summon_specifi
     int attempts = 1000;
     monster_race *r_ptr = NULL;
     while (--attempts) {
-        r_idx = get_mon_num(player_ptr, floor_ptr->monster_level, 0);
+        r_idx = get_mon_num(player_ptr, 0, floor_ptr->monster_level, 0);
         if (!r_idx)
             return FALSE;
 
index d33afac..06eb662 100644 (file)
@@ -106,7 +106,7 @@ bool summon_specific(player_type *player_ptr, MONSTER_IDX who, POSITION y1, POSI
     summon_unique_okay = (mode & PM_ALLOW_UNIQUE) != 0;
     get_mon_num_prep(player_ptr, summon_specific_okay, get_monster_hook2(player_ptr, y, x));
 
-    MONRACE_IDX r_idx = get_mon_num(player_ptr, (floor_ptr->dun_level + lev) / 2 + 5, 0);
+    MONRACE_IDX r_idx = get_mon_num(player_ptr, 0, (floor_ptr->dun_level + lev) / 2 + 5, 0);
     if (!r_idx) {
         summon_specific_type = 0;
         return FALSE;
index ddf4a7f..11c2638 100644 (file)
@@ -85,7 +85,7 @@ static MONRACE_IDX initial_r_appearance(player_type *player_ptr, MONRACE_IDX r_i
     int attempts = 1000;
     DEPTH min = MIN(floor_ptr->base_level - 5, 50);
     while (--attempts) {
-        MONRACE_IDX ap_r_idx = get_mon_num(player_ptr, floor_ptr->base_level + 10, 0);
+        MONRACE_IDX ap_r_idx = get_mon_num(player_ptr, 0, floor_ptr->base_level + 10, 0);
         if (r_info[ap_r_idx].level >= min)
             return ap_r_idx;
     }
index 9148c24..16d552b 100644 (file)
@@ -36,7 +36,7 @@ BIT_FLAGS vault_aux_dragon_mask4;
 void vault_prep_clone(player_type *player_ptr)
 {
     get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
-    vault_aux_race = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10, 0);
+    vault_aux_race = get_mon_num(player_ptr, 0, player_ptr->current_floor_ptr->dun_level + 10, 0);
     get_mon_num_prep(player_ptr, NULL, NULL);
 }
 
@@ -48,7 +48,7 @@ void vault_prep_clone(player_type *player_ptr)
 void vault_prep_symbol(player_type *player_ptr)
 {
     get_mon_num_prep(player_ptr, vault_aux_simple, NULL);
-    MONRACE_IDX r_idx = get_mon_num(player_ptr, player_ptr->current_floor_ptr->dun_level + 10, 0);
+    MONRACE_IDX r_idx = get_mon_num(player_ptr, 0, player_ptr->current_floor_ptr->dun_level + 10, 0);
     get_mon_num_prep(player_ptr, NULL, NULL);
     vault_aux_char = r_info[r_idx].d_char;
 }
index 60ce8c2..d8f67c6 100644 (file)
@@ -36,6 +36,7 @@
 #include "system/floor-type-definition.h"
 #include "view/display-messages.h"
 #include "world/world.h"
+#include "game-option/cheat-options.h"
 
 #define HORDE_NOGOOD 0x01 /*!< (未実装フラグ)HORDE生成でGOODなモンスターの生成を禁止する? */
 #define HORDE_NOEVIL 0x02 /*!< (未実装フラグ)HORDE生成でEVILなモンスターの生成を禁止する? */
@@ -74,55 +75,57 @@ MONSTER_IDX m_pop(floor_type *floor_ptr)
 /*!
  * @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;
             }
         }
     }
@@ -131,9 +134,11 @@ MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level, BIT_FLAGS option)
 
     /* 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) {
@@ -153,10 +158,15 @@ MONRACE_IDX get_mon_num(player_type *player_ptr, DEPTH level, BIT_FLAGS option)
             }
         }
 
+        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;
 
@@ -328,7 +338,7 @@ void choose_new_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool born, M
         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;
index 1cbc0b1..00f9e0c 100644 (file)
@@ -6,7 +6,7 @@
 MONSTER_IDX m_pop(floor_type *floor_ptr);
 
 #define GMN_ARENA 0x00000001 //!< 賭け闘技場向け生成
-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);
 void choose_new_monster(player_type *player_ptr, MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx);
 SPEED get_mspeed(floor_type *player_ptr, monster_race *r_ptr);
 int get_monster_crowd_number(floor_type *floor_ptr, MONSTER_IDX m_idx);
index ef618e5..bdc2366 100644 (file)
@@ -17,6 +17,8 @@
 #include "system/alloc-entries.h"
 #include "system/floor-type-definition.h"
 #include "util/bit-flags-calculator.h"
+#include "game-option/cheat-options.h"
+#include "view/display-messages.h"
 
 typedef enum dungeon_mode_type {
     DUNGEON_MODE_AND = 1,
@@ -321,6 +323,10 @@ monsterrace_hook_type get_monster_hook2(player_type *player_ptr, POSITION y, POS
  */
 errr get_mon_num_prep(player_type *player_ptr, monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2)
 {
+    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];
@@ -341,6 +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) {
@@ -348,8 +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)%d ", "monster second selection:%d(%d-%dF)&d "), mon_num, lev_min, lev_max, total);
+    }
     return 0;
 }
index c0d8dbb..057d946 100644 (file)
@@ -163,7 +163,7 @@ void apply_magic_others(player_type *owner_ptr, object_type *o_ptr, int power)
 
         get_mon_num_prep(owner_ptr, item_monster_okay, NULL);
         while (TRUE) {
-            i = get_mon_num(owner_ptr, floor_ptr->dun_level, 0);
+            i = get_mon_num(owner_ptr, 0, floor_ptr->dun_level, 0);
             r_ptr = &r_info[i];
             check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
             if (!r_ptr->rarity)
index 6d497fa..cf97f23 100644 (file)
@@ -145,7 +145,7 @@ void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
         GAME_TEXT m_name[MAX_NLEN];
         concptr desc;
         get_mon_num_prep(creature_ptr, get_nightmare, NULL);
-        r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH, 0)];
+        r_ptr = &r_info[get_mon_num(creature_ptr, 0, MAX_DEPTH, 0)];
         power = r_ptr->level + 10;
         desc = r_name + r_ptr->name;
         get_mon_num_prep(creature_ptr, NULL, NULL);
index 7b679c4..e1a293a 100644 (file)
@@ -250,7 +250,7 @@ bool build_type5(player_type *player_ptr, dun_data_type *dd_ptr)
 
         while (attempts--) {
             /* Get a (hard) monster type */
-            r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11, 0);
+            r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level + 11, 0);
             r_ptr = &r_info[r_idx];
 
             /* Decline incorrect alignment */
@@ -462,7 +462,7 @@ bool build_type6(player_type *player_ptr, dun_data_type *dd_ptr)
 
         while (attempts--) {
             /* Get a (hard) monster type */
-            r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 11, 0);
+            r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level + 11, 0);
             r_ptr = &r_info[r_idx];
 
             /* Decline incorrect alignment */
@@ -743,7 +743,7 @@ bool build_type13(player_type *player_ptr, dun_data_type *dd_ptr)
 
         while (attempts--) {
             /* Get a (hard) monster type */
-            r_idx = get_mon_num(player_ptr, floor_ptr->dun_level + 0, 0);
+            r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level + 0, 0);
             r_ptr = &r_info[r_idx];
 
             /* Decline incorrect alignment */
index 2cebfc5..c9b1d73 100644 (file)
@@ -93,7 +93,7 @@ bool build_type15(player_type *player_ptr, dun_data_type *dd_ptr)
                /* Place fixed lite berathers */
                for (dir1 = 4; dir1 < 8; dir1++)
                {
-                       MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
+                       MONRACE_IDX r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level, 0);
 
                        y = yval + 2 * ddy_ddd[dir1];
                        x = xval + 2 * ddx_ddd[dir1];
@@ -157,7 +157,7 @@ bool build_type15(player_type *player_ptr, dun_data_type *dd_ptr)
                g_ptr->feat = feat_glass_wall;
                get_mon_num_prep(player_ptr, vault_aux_lite, NULL);
 
-               r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
+               r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level, 0);
                if (r_idx) place_monster_aux(player_ptr, 0, yval, xval, r_idx, 0L);
 
                /* Walls around the breather */
@@ -224,7 +224,7 @@ bool build_type15(player_type *player_ptr, dun_data_type *dd_ptr)
                /* Place shard berathers */
                for (dir1 = 4; dir1 < 8; dir1++)
                {
-                       MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
+                       MONRACE_IDX r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level, 0);
 
                        y = yval + ddy_ddd[dir1];
                        x = xval + ddx_ddd[dir1];
index 0f87b22..a3b6d43 100644 (file)
@@ -35,7 +35,7 @@ static MONRACE_IDX poly_r_idx(player_type *caster_ptr, MONRACE_IDX r_idx)
     DEPTH lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
     MONRACE_IDX r;
     for (int i = 0; i < 1000; i++) {
-        r = get_mon_num(caster_ptr, (caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5, 0);
+        r = get_mon_num(caster_ptr, 0, (caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5, 0);
         if (!r)
             break;