summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monplace.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 08:42:03 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 08:42:03 +0000
commit0bd8f00f48363b713105ba476661176913316ef4 (patch)
treeb28e2b1895a6d2cc087162d306d701bc725a13d5 /crawl-ref/source/monplace.cc
parent400b9fc5049359bf0f8b6e51c1b0561ec77cd727 (diff)
downloadcrawl-ref-0bd8f00f48363b713105ba476661176913316ef4.tar.gz
crawl-ref-0bd8f00f48363b713105ba476661176913316ef4.zip
The arena now prevents undesired random monsters from being placed by telling
pick_random_monster() to try something else, rather than by culling them after they're placed. By default the arena prevents zero xp monsters from being randomly placed. To allow them to be placed use the spec tag "allow_zero_xp". Removed the arena spec tag "alert", since it's no longer needed. Added the arena spec tag "cycle_random", which if set causes pick_random_monster() to cycle through all the monsters valid for the level_id chosen as the arena's place. Produces a greater variety of monsters when using test spawners. If arena mode is dumping message to the output file then prefix error messages with "ERROR: " and diagnostic messages with "DIAG: " git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8165 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monplace.cc')
-rw-r--r--crawl-ref/source/monplace.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 2f7e77754e..dd15159111 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -12,6 +12,7 @@
#include "monplace.h"
+#include "arena.h"
#include "branch.h"
#include "directn.h" // for the Compass
#include "externs.h"
@@ -314,6 +315,13 @@ monster_type pick_random_monster(const level_id &place)
monster_type pick_random_monster(const level_id &place, int power,
int &lev_mons)
{
+ if (crawl_state.arena)
+ {
+ monster_type type = arena_pick_random_monster(place, power, lev_mons);
+ if (type != RANDOM_MONSTER)
+ return (type);
+ }
+
if (place.level_type == LEVEL_LABYRINTH)
return (MONS_PROGRAM_BUG);
@@ -387,6 +395,8 @@ monster_type pick_random_monster(const level_id &place, int power,
if (count == 2000)
return (MONS_PROGRAM_BUG);
+ if (crawl_state.arena && arena_veto_random_monster(mon_type))
+ continue;
}
while (random2avg(100, 2) > mons_rare_abyss(mon_type)
&& !one_chance_in(100));
@@ -412,6 +422,9 @@ monster_type pick_random_monster(const level_id &place, int power,
if (count == 2000)
return (MONS_PROGRAM_BUG);
+ if (crawl_state.arena && arena_veto_random_monster(mon_type))
+ continue;
+
level = mons_level(mon_type, place);
diff = level - lev_mons;
chance = mons_rarity(mon_type, place) - (diff * diff);
@@ -1135,6 +1148,9 @@ static int _place_monster_aux(const mgen_data &mg,
if (player_monster_visible(&menv[id]) && mons_near(&menv[id]))
seen_monster(&menv[id]);
+ if (crawl_state.arena)
+ arena_placed_monster(&menv[id], mg, first_band_member);
+
return (id);
}