Allow random objects with given rarity in vault files "rare random thing" or "vrare random thing"

poolroom.vlt should have slightly less piranhas and a chance of rare objects underwater
This commit is contained in:
Rob Pearce 2016-06-06 17:07:14 +10:00
parent 8456ed6a74
commit eabf474c08
2 changed files with 25 additions and 2 deletions

View File

@ -13,7 +13,12 @@ autodoors:50
autopop
fill(2,2,-3,-3) cell:low rock floor:100
fill(2,2,-3,-3) ob:waist-deep water:100
scatter(2,2,-3,-3) mon:piranha:50%:100
scatter(2,2,-3,-3) mon:piranha:40%:100
! chance of some good stuff items...
scatter(2,2,-3,-3) ob:rare random thing:1:30
scatter(2,2,-3,-3) ob:rare random thing:1:20
scatter(2,2,-3,-3) ob:vrare random thing:1:10
rarity:vrare
rarity:uncommon
@end

View File

@ -887,6 +887,10 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
wantrarity = RR_VERYRARE;
p += strlen("very rare ");
donesomething = B_TRUE;
} else if (strstarts(p, "vrare ")) {
wantrarity = RR_VERYRARE;
p += strlen("vrare ");
donesomething = B_TRUE;
// force weapon/armour to be ones the holder is skilled in?
} else if (strstarts(p, "appropriate ")) {
if (where->owner) {
@ -1256,6 +1260,18 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
found = B_TRUE;
}
}
if (strstarts(p, "random thing")) {
char buf[BUFLEN];
cell_t *cc;
condset_t cs;
initcond(&cs);
cc = getobpilelocation(where);
ot = real_getrandomob(cc, buf, NA, NA, wantrarity, B_TRUE, &cs);
if (ot) {
found = B_TRUE;
}
}
}
if (!found) {
@ -7158,8 +7174,10 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
}
}
if (wantcl == OC_NONE) {
if (hab) {
addcond(cs, CC_OBCLASS, B_TRUE, getrandomobclass(hab->id));
}
}
/*
if (!nwantclass) {