extern bool place_monster_aux(int who, int y, int x, int r_idx, u32b mode);
extern bool place_monster(int y, int x, u32b mode);
extern bool alloc_horde(int y, int x);
+extern bool alloc_guardian(void);
extern bool alloc_monster(int dis, u32b mode);
extern bool summon_specific(int who, int y1, int x1, int lev, int type, u32b mode);
extern bool summon_named_creature (int who, int oy, int ox, int r_idx, u32b mode);
alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_GOLD, randnor(DUN_AMT_GOLD, 3));
}
- /* Put an Artifact and Artifact Guardian is requested */
- if (d_info[dungeon_type].final_guardian && (d_info[dungeon_type].maxdepth == dun_level))
- {
- int oy;
- int ox;
- int try = 4000;
-
- /* Find a good position */
- while(try)
- {
- /* Get a random spot */
- oy = randint1(cur_hgt - 4) + 2;
- ox = randint1(cur_wid - 4) + 2;
-
- /* Is it a good spot ? */
- if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[d_info[dungeon_type].final_guardian]))
- {
- /* Place the guardian */
- if (place_monster_aux(0, oy, ox, d_info[dungeon_type].final_guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) break;
- }
- /* One less try */
- try--;
- }
- }
+ /* Put the Guardian */
+ (void)alloc_guardian();
if (empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
#endif /* MONSTER_HORDES */
-
/*
- * Attempt to allocate a random monster in the dungeon.
- *
- * Place the monster at least "dis" distance from the player.
- *
- * Use "slp" to choose the initial "sleep" status
- *
- * Use "monster_level" for the monster level
+ * Put the Guardian
*/
-bool alloc_monster(int dis, u32b mode)
+bool alloc_guardian(void)
{
- int y = 0, x = 0;
- int attempts_left = 10000;
int guardian = d_info[dungeon_type].final_guardian;
- /* Put an Guardian */
- if(guardian && d_info[dungeon_type].maxdepth == dun_level && r_info[guardian].cur_num < r_info[guardian].max_num )
+ if (guardian && (d_info[dungeon_type].maxdepth == dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num))
{
int oy;
int ox;
int try = 4000;
/* Find a good position */
- while(try)
+ while (try)
{
/* Get a random spot */
oy = randint1(cur_hgt - 4) + 2;
if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian]))
{
/* Place the guardian */
- if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) break;
+ if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) return TRUE;
}
+
/* One less try */
try--;
}
}
+ return FALSE;
+}
+
+
+/*
+ * Attempt to allocate a random monster in the dungeon.
+ *
+ * Place the monster at least "dis" distance from the player.
+ *
+ * Use "slp" to choose the initial "sleep" status
+ *
+ * Use "monster_level" for the monster level
+ */
+bool alloc_monster(int dis, u32b mode)
+{
+ int y = 0, x = 0;
+ int attempts_left = 10000;
+
+ /* Put the Guardian */
+ if (alloc_guardian()) return TRUE;
/* Find a legal, distant, unoccupied, space */
while (attempts_left--)