intended to be portal vaults for Hell portals; we need to add support for portal vaults.
Added support for monster slot randomisation for maps.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@865 c06c8d41-db1a-0410-9941-cceddc491573
A3CO4KBFTFU3ZSHWRY2OPPX3MMTFV7OUCZGL7Q4Y2FU7JO4AP7MAC
5P64LHKJKGKIO3FUV63KFQ2OHZ5RNRV7WXS25OHXVNYYFZAVGLMAC
3DRML4TAWIPPWCXCCXTPWV33SZCRSC2I6DWGAEUNJF7ZOIIWA35QC
QUYSD2DWCIKAAQJGI43EENAWWPA5W33UT3I5WFRSHU6FPSSXTX2AC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
MSQI3TH6T62JAXQGLL52QZCWAMC372TGB6ZNNRDGUGMJKBNNV2VAC
34C4U6EQWERY75GZJKUCM5KVGU2OUICETS5LGZF6RMKMZT4R5SQAC
L6O4LGZRKBURVWEY7XRVCSQLJ5RULNBEWMQJ6I2UYVWWB66FM3MQC
7J3H7JY6AUO2UHNF6DAHDZI4O33JMTUUTYTPRM3CKNPUOF2RQOGAC
XAFFD52IHN6FWFR2TT5F2KCUS7HAVCBI5CWTFMKPQG77GGTGAHLAC
QPF4HHRIRNZTEJUMRMB7EFYRF6RT6CTJECAAWRXV7EKHUEO77V7QC
static void apply_monsters(
const map_def &def,
FixedVector<int,7> &marray)
{
const std::vector<int> &mids = def.mons.get_ids();
size_t ndx = 0;
for (int i = 0, size = mids.size(); i < size; ++i)
{
int mid = mids[i];
if (mid < 0)
{
mid = -100 - mid;
if (mid == DEMON_RANDOM)
mid = random2(DEMON_RANDOM);
mid = summon_any_demon( mid );
}
if (ndx < marray.size())
marray[ndx++] = mid;
}
}
const std::vector<int> &get_ids() const;
int get_monster(int index);
// Returns an error string if the monster is unrecognised.
std::string add_mons(const std::string &s);
size_t size() const { return mons.size(); }
private:
struct mons_spec
{
int mid;
int genweight;
bool fix_mons;
// Returns false if the monster is unrecognised.
bool add_mons(const std::string &s);
mons_spec(int id = RANDOM_MONSTER, int gw = 10, bool _fixmons = false)
: mid(id), genweight(gw), fix_mons(_fixmons)
{
}
};
typedef std::vector<mons_spec> mons_spec_list;
size_t size() const { return mons_ids.size(); }
struct mons_spec_slot
{
mons_spec_list mlist;
bool fix_slot;
mons_spec_slot(const mons_spec_list &list, bool fix = false)
: mlist(list), fix_slot(fix)
{
}
mons_spec_slot()
: mlist(), fix_slot(false)
{
}
};
const std::vector<int> &mons_list::get_ids() const
int mons_list::pick_monster(mons_spec_slot &slot)
{
int totweight = 0;
int pick = RANDOM_MONSTER;
for (mons_spec_list::iterator i = slot.mlist.begin();
i != slot.mlist.end(); ++i)
{
const int weight = i->genweight;
if (random2(totweight += weight) < weight)
{
pick = i->mid;
if (pick < 0 && i->fix_mons)
pick = i->mid = fix_demon(pick);
}
}
if (pick < 0)
pick = fix_demon(pick);
if (slot.fix_slot)
{
slot.mlist.clear();
slot.mlist.push_back( mons_spec(pick) );
slot.fix_slot = false;
}
return (pick);
}
int mons_list::get_monster(int index)
mons_ids.clear();
mons_spec_slot slot;
slot.fix_slot = strip_tag(spec, "fix_slot");
std::vector<std::string> specs = split_string("/", spec);
for (int i = 0, ssize = specs.size(); i < ssize; ++i)
{
std::string s = specs[i];
int weight = strip_number_tag(s, "weight:");
if (weight == TAG_UNFOUND || weight <= 0)
weight = 10;
const bool fixmons = strip_tag(s, "fix_mons");
trim_string(s);
const int mid = mons_by_name(s);
if (mid == MONS_PROGRAM_BUG)
{
error = make_stringf("unrecognised monster \"%s\"", s.c_str());
return (slot);
}
slot.mlist.push_back( mons_spec(mid, weight, fixmons) );
}
return (slot);
const int mid = mons_by_name(s);
if (mid != MONS_PROGRAM_BUG)
mons_ids.push_back(mid);
return (mid != MONS_PROGRAM_BUG);
error.clear();
mons_spec_slot slotmons = parse_mons_spec(s);
if (!error.empty())
return (error);
mons.push_back( slotmons );
return (error);
return (items);
int cumulative = 0;
item_spec spec;
for (item_spec_list::const_iterator i = slot.ilist.begin();
i != slot.ilist.end(); ++i)
{
const int weight = i->genweight;
if (random2(cumulative += weight) < weight)
spec = *i;
}
if (slot.fix_slot)
{
slot.ilist.clear();
slot.ilist.push_back(spec);
slot.fix_slot = false;
}
return (spec);
}
item_spec item_list::get_item(int index)
{
if (index < 0 || index >= (int) items.size())
return (item_spec());
return (pick_item(items[index]));
static const item_spec *dngn_item_by_weight(const item_spec_list &specs)
{
int cumulative = 0;
const item_spec *spec = NULL;
for (item_spec_list::const_iterator i = specs.begin();
i != specs.end(); ++i)
{
const int weight = i->genweight;
if (random2(cumulative += weight) < weight)
spec = &*i;
}
return (spec);
}
xxxxxxxxxxxxxxxxxxxxxxx
xxxxx{.....(.....[xxxxx
xxxxx.............xxxxx
xxxxxx...........xxxxxx
xxxxxx...........xxxxxx
xxxxxxx.........xxxxxxx
xxxxxxx.........xxxxxxx
xxxxxxxx.......xxxxxxxx
xxxxxxxx.......xxxxxxxx
xxxxxxxxx.....xxxxxxxxx
xxxxxxxxx.....xxxxxxxxx
xxxxxxxxxx...xxxxxxxxxx
xxxxxxxxxx...xxxxxxxxxx
xxxxxxxxxx...xxxxxxxxxx
xxxxxxxxxx+++xxxxxxxxxx
xxxxxxxxxx...xxxxxxxxxx
ENDMAP
xxxxxxxxxxxxxxx
x{.....(.....[x
x.............x
xx...........xx
xx...........xx
xxx.........xxx
xxx.........xxx
xxxx.......xxxx
xxxx.......xxxx
xxxxx.....xxxxx
xxxxx.....xxxxx
xxxxxx...xxxxxx
xxxxxx...xxxxxx
xxxxxx...xxxxxx
xxxxxx+++xxxxxx
xxxxxx...xxxxxx
ENDMAP
xxxxxxxxxxxxxxxxxxxxxxx
xxxxx{..1..(.1ww.[xxxxx
xxxxx1.........ww.xxxxx
xxxxxx..w..1....1.xxxxx
xxxxxx........2...xxxxx
xxxxxw...1......w.xxxxx
xxxxxw...........xxxxxx
xxxxx.1....2......xxxxx
xxxxx1......w2....xxxxx
xxxxx............xxxxxx
xxxxxx..........xxxxxxx
xxxxxx..........xxxxxxx
xxxxxx...2......xxxxxxx
xxxxx...........xxxxxxx
xxxxx.2.w......xxxxxxxx
xxxxxxx..2.....xxxxxxxx
xxxxxxx......2xxxxxxxxx
xxx.........xxxxxxxxxxx
xx..xx......xxxxxxxxxxx
...xxxxx.....xxxxxxxxxx
xxxxxxxxxx....xxxxxxxxx
xxxxxxxxxxxx...xxxxxxxx
xxxxxxxxxxxxxxxxxxx
xxxxx{..1..(.1ww.[x
xxxxx1.........ww.x
xxxxxx..w..1....1.x
xxxxxx........2...x
xxxxxw...1......w.x
xxxxxw...........xx
xxxxx.1....2......x
xxxxx1......w2....x
xxxxx............xx
xxxxxx..........xxx
xxxxxx..........xxx
xxxxxx...2......xxx
xxxxx...........xxx
xxxxx.2.w......xxxx
xxxxxxx..2.....xxxx
xxxxxxx......2xxxxx
xxx.........xxxxxxx
xx..xx......xxxxxxx
...xxxxx.....xxxxxx
xxxxxxxxxx....xxxxx
xxxxxxxxxxxx...xxxx
###################################
# broad hall
NAME: lemuel_hall
TAGS: entry
ORIENT: float
MAP
xxxxxxxxxxx
x{...(...[x
x.........x
x.x.....x.x
x.........x
x.........x
x.x.....x.x
x.........x
x.........x
x.x.....x.x
x.........x
x.........x
x.x.....x.x
x.........x
x.........x
x.x.....x.x
x.........x
x@...@...@x
ENDMAP
###################################
# broad hall with supply closet
NAME: lemuel_hall2
TAGS: entry
ORIENT: float
ITEM: meat ration / bread ration / beef jerky / spear / potion of water / apple / club / hammer / knife
MAP
xxxxxxxxxxxx
x{...(...[xx
x.........xx
x.x.....x.xx
x.........xx
x.........xx
x.x.....x.xx
x.........xx
x.........xxxxxx
x.x.....x.xxxddx
x.........=..ddx
x.........xxxxxx
x.x.....x.xx
x.........xx
x.........xx
x.x.....x.xx
x.........xx
x@...@...@xx
ENDMAP
###################################
# behind the green door
NAME: lemuel_green
TAGS: entry
ORIENT: float
###################################
# Hellmouth (Lemuel)
# note that other than the imps, the demons here cannot fly
NAME: hellmouth_1
FLAGS: no_rotate
MONS: imp / quasit / shadow imp, hellion / rotting devil / iron devil / hairy devil / hell hound
ITEM: good_item demon blade / good_item demon whip / good_item demon trident / wand of draining / wand of fire / ring of fire / Necronomicon / book of demonology / scroll of torment
ORIENT: float
MAP
xxxxxxxxxxxxxxxxxxx
xxxxxxxxlllxxxxxxxx
xxxxxxlllAlllxxxxxx
xxxlllll.d.llll.xxx
xlllllll121lllll..x
x.lllllll1llll....x
x...llllllll......x
x....llllll.......x
x.....lllll.......x
xxx....lll......xxx
xxxx...lll.....xxxx
xxxxx..ll.....xxxxx
xxxxx.lll.....xxxxx
xxxxxxlll....xxxxxx
xxxxxxxlll...xxxxxx
xxxxxxxxll..xxxxxxx
xxxxxxxxll..xxxxxxx
xxxxxxxxl.@xxxxxxxx
ENDMAP
###################################
# Hellmouth 2 (Lemuel)
# note that other than the imps, the demons here cannot fly
NAME: hellmouth_2
TAGS: no_monster_gen
FLAGS: no_rotate
MONS: imp / quasit / shadow imp / manes / lemure
MONS: hellion / rotting devil / iron devil / hairy devil / hell hound
ITEM: good_item demon blade / good_item demon whip / good_item demon trident / wand of draining / wand of fire / ring of fire / Necronomicon / book of demonology / scroll of torment
ITEM: good_item demon blade / good_item demon whip / good_item demon trident
ORIENT: float
MAP
.......bbbbbbbbbbbb.......
....bbbb..........bbbb....
..bbb....llllllll....bbb..
.bb....llllllllllll....bb.
.b....llllllllllllll....b.
.b....llllll..llllll....b.
.b....lll........lll....b.
.b....ll....111...ll....b.
.+....l....11211d..l....b.
.+....l....12A21|e.l....b.
.b....ll...11211d.ll....b.
.b....lll...111..lll....b.
.b....llll......llll....b.
.b....llllll..llllll....b.
.bb....llllllllllll....bb.
..bbb....llllllll....bbb..
....bbbb..........bbbb....
.......bbbbbbbbbbbb.......
ENDMAP
###################################
# Hellmouth 3 (Lemuel)
NAME: hellmouth_3
MONS: weight:50 imp / quasit / shadow imp / manes / lemure, hell hound
ITEM: good_item demon blade / good_item demon whip / good_item demon trident
ORIENT: float
MAP
................l.............
..............................
................l.............
....ll..........l.............
...lll..........l.............
....l..........l..............
.............lll..............
..........lllllll.............
........llllllllll............
.......lll111111llll..........
.......llll12Ad1lll...........
........lll11111ll............
.........lllll1ll.............
...........llllll.............
............llll......ll......
.............ll........ll.....
..............................
...................l..........
ENDMAP
#############################################################################