Slightly increase chance of vaults in the main dungeon

When creating vaults, use 50% chance each time of increasing rarity instead of 33%
Make chests have better objects
This commit is contained in:
Rob Pearce 2016-06-18 18:22:43 +10:00
parent f786d9de72
commit 33c532339c
8 changed files with 52 additions and 73 deletions

20
data.c
View File

@ -7092,11 +7092,11 @@ void initobjects(void) {
addflag(lastot->flags, F_CANBELOCKED, 30, 10, NA, NULL);
addflag(lastot->flags, F_CANBETRAPPED, 20, 20, 66, NULL);
addflag(lastot->flags, F_CONTAINER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 90, 5, NA, NULL); // add 5 to depth for object rarity calculation
addflag(lastot->flags, F_STARTOBRND, 80, 5, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 70, 5, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 60, 5, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 50, 5, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 90, 5, RR_RARE, NULL); // add 5 to depth for object rarity calculation
addflag(lastot->flags, F_STARTOBRND, 80, 5, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_STARTOBRND, 70, 5, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_STARTOBRND, 60, 5, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_STARTOBRND, 50, 5, RR_RARE, NULL);
addot(OT_CHESTORNATE, "ornate chest", "An ornate golden treasure chest.", MT_GOLD, 80, OC_FURNITURE, SZ_MEDIUM);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL);
addflag(lastot->flags, F_GLYPH, C_LIGHTYELLOW, '(', NA, NULL);
@ -7109,11 +7109,11 @@ void initobjects(void) {
addflag(lastot->flags, F_CANBELOCKED, 60, 10, NA, NULL);
addflag(lastot->flags, F_CANBETRAPPED, 50, 20, 100, NULL);
addflag(lastot->flags, F_CONTAINER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 90, 10, NA, NULL); // add 10 to depth for object rarity calculation
addflag(lastot->flags, F_STARTOBRND, 80, 10, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 70, 10, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 60, 10, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 50, 10, NA, NULL);
addflag(lastot->flags, F_STARTOBRND, 90, 10, RR_VERYRARE, NULL); // add 10 to depth for object rarity calculation
addflag(lastot->flags, F_STARTOBRND, 80, 10, RR_RARE, NULL);
addflag(lastot->flags, F_STARTOBRND, 70, 10, RR_RARE, NULL);
addflag(lastot->flags, F_STARTOBRND, 60, 10, RR_RARE, NULL);
addflag(lastot->flags, F_STARTOBRND, 50, 10, RR_VERYRARE, NULL);
addot(OT_EMPTYFLASK, "empty flask", "An empty glass flask.", MT_GLASS, 0.2, OC_MISC, SZ_TINY);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);

View File

@ -0,0 +1,20 @@
@id:glass_vault
@map
.....
.GGG.
.GcG.
.GGG.
.....
@end
@legend
#:cell:SOLID
G:cell:glass wall
c:ob:ornate chest:50:ob:chest
@end
@flags
goesin:dungeon
rarity:uncommon
mayrotate
@end

2
defs.h
View File

@ -365,6 +365,7 @@
#define TT_PLAYER 8
#define TT_ALLY 16
#define TT_IMPASSABLE 32
#define TT_VAULT 64
// target requirements
#define TR_NONE 0
@ -3748,6 +3749,7 @@ enum FLAG {
// calculation
F_STARTOBRND, // val0 = %chance of starting with a random ob
// v1 = depth modifier. can use 'RANDOM'
// v2 = minimum rarity rating - can use RR_NONE or NA for random.
F_STARTOBWEPSK, // val0 = %chance of starting with wepskill val1
// v1 = wepskill of object
// optional val2 = addition to map depth for rarity

10
lf.c
View File

@ -11319,7 +11319,7 @@ race_t *getrandomrace(cell_t *c, int forcedepth, condset_t *cs) {
gettrrange(depth, &hdmin, &hdmax, RARITYVARIANCELF, B_TRUE);
// pick rr...
wantrr = pickrr(TT_MONSTER);
wantrr = pickrr(TT_MONSTER, NA);
if (db) dblog("finding random lf with hitdice %d-%d and rr <= %d (for depth %d)\n",hdmin,hdmax, wantrr, depth);
@ -13206,6 +13206,7 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
} else if (id == F_STARTOBRND) {
if (rnd(1,100) <= val[0]) {
int depthmod;
enum RARITY wantrr = RR_NONE;
condset_t cs;
depthmod = val[1];
switch (depthmod) {
@ -13215,10 +13216,15 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
}
depthmod += depthmod2;
// select the rr first so that we can enforce a minimum
if (val[2] != NA) {
wantrr = pickrr(TT_OBJECT, val[2]);
}
initcondv(&cs, CC_MAXSIZE, B_TRUE, maxobsize,
CC_NONE);
if (real_getrandomob(mapcell, buf, targmap->depth + depthmod, NA, RR_NONE, B_TRUE, &cs)) {
if (real_getrandomob(mapcell, buf, targmap->depth + depthmod, NA, wantrr, B_TRUE, &cs)) {
if (isshop) apply_shopob_restrictions(buf);
o = addob(op, buf);
}

2
map.c
View File

@ -8792,7 +8792,7 @@ object_t *hastrailof(obpile_t *op, lifeform_t *lf, int oid, flag_t **tflag, life
void initmap(void) {
// habitats
// thingchance, obchance, vaultchance, maxvisrange, upstiartype, downstairtype, stairs_in_rooms,temp
addhabitat(H_DUNGEON, "dungeon", CT_CORRIDOR, CT_WALL, 5, 60, 30, 6, OT_STAIRSUP, OT_STAIRSDOWN, B_TRUE, T_NORMAL);
addhabitat(H_DUNGEON, "dungeon", CT_CORRIDOR, CT_WALL, 5, 60, 33, 6, OT_STAIRSUP, OT_STAIRSDOWN, B_TRUE, T_NORMAL);
addhabitat(H_ICECAVE, "ice cavern", CT_CORRIDOR, CT_WALLICE, 10, 45, 20, 6, OT_ICESTAIRSUP, OT_ICESTAIRSDOWN, B_FALSE, T_COLD);
addhabitat(H_CAVE, "cave", CT_DIRT, CT_WALLDIRT, 5, 45, 20, 6, OT_TUNNELUP, OT_TUNNELDOWN, B_FALSE, T_NORMAL);
addhabitat(H_FOREST, "forest", CT_GRASS, CT_WALLTREE, 5, 75, 0, MAXVISRANGE, OT_TREEUP, OT_TREEDOWN, B_FALSE, T_NORMAL);

View File

@ -7193,7 +7193,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
// pick rr...
if (forcerr == RR_NONE) {
wantrr = pickrr(TT_OBJECT);
wantrr = pickrr(TT_OBJECT, NA);
} else {
wantrr = forcerr;
}
@ -7508,7 +7508,7 @@ enum OBCLASS getrandomobclass(enum HABITAT hab) {
objectclass_t *oc,*poss[MAXCANDIDATES];
int nposs = 0;
wantrr = pickrr(TT_OBJECT);
wantrr = pickrr(TT_OBJECT, NA);
while (!nposs) {
for (oc = objectclass ; oc ; oc = oc->next) {
enum RARITY thisrarity = RR_NONE;
@ -10614,61 +10614,6 @@ int otmeetscondition(objecttype_t *ot, enum CELLCONDITION cond, int arg, int val
return ok;
}
/*
int obmatchescondition(object_t *o, long opts) {
int ok;
if (opts) {
// default to not ok
ok = B_FALSE;
} else {
// default to ok
ok = B_TRUE;
}
if ((opts & AO_ONLYEQUIPPED) && hasflag(o->flags, F_EQUIPPED)) {
ok = B_TRUE;
}
if ((opts & AO_EQUIPPEDNONWEAPON)) {
flag_t *ff;
ff = hasflag(o->flags, F_EQUIPPED);
if (ff && !isweapon(o)) {
ok = B_TRUE;
}
}
if ((opts & AO_EDIBLE) && isedible(o)) ok = B_TRUE;
if ((opts & AO_DRINKABLE) && isdrinkable(o)) ok = B_TRUE;
if ((opts & AO_READABLE) && isreadable(o)) ok = B_TRUE;
if ((opts & AO_ARMOUR) && (o->type->obclass->id == OC_ARMOUR)) ok = B_TRUE;
if (opts & AO_DAMAGED) {
if (isdamaged(o)) {
ok = B_TRUE;
}
}
if ((opts & AO_WEARABLE) && iswearable(o)) ok = B_TRUE;
if ((opts & AO_WEILDABLE) && isweapon(o)) ok = B_TRUE;
if ((opts & AO_OPERABLE) && isoperable(o)) ok = B_TRUE;
if ((opts & AO_POURABLE) && ispourable(o)) ok = B_TRUE;
if ((opts & AO_NOTIDENTIFIED) && !isidentified(o)) ok = B_TRUE;
if ((opts & AO_NOTKNOWN) && !isknown(o)) ok = B_TRUE;
if (opts & AO_SPECIFIED) {
int n;
int found = B_FALSE;
// does retlist contain this?
for (n = 0; n < nretobs; n++) {
if (retobs[n] == o) {
found = B_TRUE;
break;
}
}
if (found) {
ok = B_TRUE;
}
}
return ok;
}
*/
// returns the amount of light produced
int obproduceslight(object_t *o) {
flag_t *f;
@ -12607,14 +12552,20 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
}
enum RARITY pickrr(int whatfor) {
enum RARITY pickrr(int whatfor, int startrr) {
enum RARITY wantrr = RR_FREQUENT;
int chance = 3;
int mod = 0;
if (startrr != NA) {
wantrr = startrr;
}
if ((gamemode == GM_GAMESTARTED) && hasflag(player->flags, F_EXTRALUCK)) {
if (whatfor == TT_OBJECT) {
wantrr++;
} else if (whatfor == TT_VAULT) {
wantrr++;
} else if (whatfor == TT_MONSTER) {
mod = 1;
}

View File

@ -299,7 +299,7 @@ flag_t *obrestrictsmovement(object_t *o, lifeform_t *lf);
int obsfallthrough(cell_t *c, object_t *pit);
void obtodancing(lifeform_t *newlf, object_t *o);
int operate(lifeform_t *lf, object_t *o, cell_t *where);
enum RARITY pickrr(int whatfor);
enum RARITY pickrr(int whatfor, int startrr);
int pilehasletter(obpile_t *op, char let);
int pileisinshop(obpile_t *op);
void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE potlessed, int *seen);

View File

@ -789,7 +789,7 @@ vault_t *getvaulttype(map_t *m) {
enum RARITY rr = RR_COMMON;
// select random rarity
rr = pickrr(TT_NONE);
rr = pickrr(TT_VAULT, NA);
while (!nposs) {
for (v = firstvault ; v ; v = v->next) {