1 /**
2  * @file
3  * @brief Functions used in Pandemonium.
4 **/
5 
6 #include "AppHdr.h"
7 
8 #include "lev-pand.h"
9 
10 #include <algorithm>
11 
12 #include "colour.h"
13 #include "env.h"
14 #include "tileview.h"
15 
_pan_floor_colour()16 static colour_t _pan_floor_colour()
17 {
18     colour_t col;
19 
20     do
21     {
22         col = random_colour();
23     }
24     // Don't use silence or halo colours for floors.
25     while (col == DARKGREY || col == CYAN || col == YELLOW);
26 
27     return col;
28 }
29 
_pan_rock_colour()30 static colour_t _pan_rock_colour()
31 {
32     colour_t col;
33 
34     do
35     {
36         col = random_colour();
37     }
38     // Don't use stone or metal colours for walls.
39     while (col == DARKGREY || col == LIGHTGREY || col == CYAN);
40 
41     return col;
42 }
43 
init_pandemonium()44 void init_pandemonium()
45 {
46     for (int pc = 0; pc < PAN_MONS_ALLOC; ++pc)
47     {
48         env.mons_alloc[pc] = random_choose_weighted(5, MONS_SMOKE_DEMON,
49                                                     5, MONS_YNOXINUL,
50                                                     5, MONS_ABOMINATION_LARGE,
51                                                     5, MONS_SOUL_EATER,
52                                                     5, MONS_DEMONIC_CRAWLER,
53                                                     5, MONS_SUN_DEMON,
54                                                     2, MONS_NEQOXEC,
55                                                     5, MONS_CHAOS_SPAWN,
56                                                     1, MONS_SHADOW_DEMON,
57                                                     1, MONS_LOROCYPROCA,
58                                                     1, MONS_HELLION,
59                                                     1, MONS_TORMENTOR,
60                                                     1, MONS_REAPER);
61 
62         // The last three slots have a good chance of big badasses.
63         if (pc == 7 && one_chance_in(8)
64          || pc == 8 && one_chance_in(5)
65          || pc == 9 && one_chance_in(3))
66         {
67             env.mons_alloc[pc] = random_choose_weighted(
68                   4, MONS_EXECUTIONER,
69                   4, MONS_GREEN_DEATH,
70                   4, MONS_BLIZZARD_DEMON,
71                   4, MONS_BALRUG,
72                   4, MONS_CACODEMON,
73                   2, MONS_BLOOD_SAINT,
74                   2, MONS_WARMONGER,
75                   2, MONS_CORRUPTER,
76                   2, MONS_BLACK_SUN);
77         }
78     }
79 
80     if (one_chance_in(10))
81         env.mons_alloc[7 + random2(3)] = MONS_BRIMSTONE_FIEND;
82 
83     if (one_chance_in(10))
84         env.mons_alloc[7 + random2(3)] = MONS_ICE_FIEND;
85 
86     if (one_chance_in(10))
87         env.mons_alloc[7 + random2(3)] = MONS_TZITZIMITL;
88 
89     if (one_chance_in(10))
90         env.mons_alloc[7 + random2(3)] = MONS_HELL_SENTINEL;
91 
92     env.floor_colour = _pan_floor_colour();
93     env.rock_colour  = _pan_rock_colour();
94     tile_init_default_flavour();
95 }
96