Random object generation was completely broken. Should be a little better now.
This commit is contained in:
parent
4a7711d110
commit
5135352e2a
2
ai.c
2
ai.c
|
@ -1882,6 +1882,8 @@ int ai_movement(lifeform_t *lf) {
|
|||
// can see a non-enemy on top of the object, and we are adjacent
|
||||
valid = B_FALSE;
|
||||
}
|
||||
} else if (f->val[2] == MR_SOUND) {
|
||||
// always ok.
|
||||
} else {
|
||||
// weird ?
|
||||
raise (SIGINT);
|
||||
|
|
11
data.c
11
data.c
|
@ -7289,6 +7289,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_OBHP, 50, 50, NA, NULL);
|
||||
addflag(lastot->flags, F_OBHPDRAIN, 1, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_NOABSORB, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_DTIMMUNE, DT_WATER, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_REDUCEMOVEMENT, 2, NA, NA, NULL);
|
||||
|
@ -7566,7 +7567,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_STARTOB, 50, NA, NA, "good clothing");
|
||||
addflag(lastot->flags, F_STARTOB, 50, NA, NA, "great clothing");
|
||||
|
||||
addot(OT_WEAPONRACK, "weapon rack", "A large matel frame, made to store weapons.", MT_METAL, 150, OC_FURNITURE, SZ_HUMAN);
|
||||
addot(OT_WEAPONRACK, "weapon rack", "A large metal frame, made to store weapons.", MT_METAL, 150, OC_FURNITURE, SZ_HUMAN);
|
||||
addflag(lastot->flags, F_RARITY, H_ALL, 80, RR_UNCOMMON, NULL);
|
||||
addflag(lastot->flags, F_GLYPH, C_METAL, '\\', NA, NULL);
|
||||
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
|
||||
|
@ -8051,7 +8052,7 @@ void initobjects(void) {
|
|||
killflagsofid(lastot->flags, F_FLAMMABLE);
|
||||
killflagsofid(lastot->flags, F_DTVULN);
|
||||
addflag(lastot->flags, F_MULTISIZE, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
|
||||
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL);
|
||||
addflag(lastot->flags, F_GOESON, BP_BODY, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_ARMOURRATING, 5, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_UNDERCLOTHING, B_TRUE, NA, NA, NULL);
|
||||
|
@ -8405,7 +8406,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_STARTSPLAIN, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_COVERSFACE, B_TRUE, NA, NA, NULL);
|
||||
addot(OT_GOLDCROWN, "golden crown", "A heavy gold crown, encrusted with jewels.", MT_GOLD, 5, OC_ARMOUR, SZ_SMALL);
|
||||
addflag(lastot->flags, F_RARITY, H_ALL, 25, RR_RARE, NULL);
|
||||
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_RARE, NULL);
|
||||
addflag(lastot->flags, F_GOESON, BP_HEAD, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_ARMOURRATING, 1, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_OBHP, 30, 30, NA, NULL);
|
||||
|
@ -9426,8 +9427,8 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_CANBEDIFFMAT, MT_SILVER, 5, NA, NULL);
|
||||
addflag(lastot->flags, F_CANBLOCK, DT_SLASH, NA, NA, NULL);
|
||||
addot(OT_GLADIUS, "gladius", "A short gladiator blade. Designed for stabbing rather than slashing.", MT_METAL, 4, OC_WEAPON, SZ_MEDIUM);
|
||||
addflag(lastot->flags, F_RARITY, H_DUNGEON, 90, NA, NULL);
|
||||
addflag(lastot->flags, F_RARITY, H_CAVE, 90, NA, NULL);
|
||||
addflag(lastot->flags, F_RARITY, H_DUNGEON, 90, RR_UNCOMMON, NULL);
|
||||
addflag(lastot->flags, F_RARITY, H_CAVE, 90, RR_UNCOMMON, NULL);
|
||||
addflag(lastot->flags, F_DAM, DT_PIERCE, 7, NA, NULL);
|
||||
addflag(lastot->flags, F_ALTDAM, DT_SLASH, 6, NA, NULL);
|
||||
addflag(lastot->flags, F_ALTDAM, DT_BASH, 3, NA, "hilt bash"); // with the hilt
|
||||
|
|
9
defs.h
9
defs.h
|
@ -283,8 +283,8 @@
|
|||
|
||||
|
||||
#define MAXPILEOBS 52
|
||||
#define MAXRANDOMOBCANDIDATES 100
|
||||
#define MAXRANDOMLFCANDIDATES 100
|
||||
#define MAXRANDOMOBCANDIDATES 200
|
||||
#define MAXRANDOMLFCANDIDATES 200
|
||||
#define MAXRETCELLS 80
|
||||
#define MAXSPELLLEV 6
|
||||
#define MAXVISRANGE 10 // max visible range in full light
|
||||
|
@ -2979,6 +2979,7 @@ enum FLAG {
|
|||
// also don't stop the player running past it.
|
||||
F_INVISOB, // this object cannot be seen
|
||||
F_NOPICKUP, // cannot pick this up
|
||||
F_NOABSORB, // object cannot be absorbed into soft ground.
|
||||
F_ATTACKABLE, // can attack this with 'A'
|
||||
F_IMPASSABLE, // cannot walk past this if your size is between v0 and v1
|
||||
// (inclusive)
|
||||
|
@ -3949,7 +3950,9 @@ enum FLAG {
|
|||
F_MOVESPEED, // override default move speed
|
||||
F_ACTIONSPEED, // override default action speed
|
||||
F_SPELLSPEED, // override default spellcast speed (ie. movespeed)
|
||||
F_RARITY, // val[0] = habitat, val[1] = rarity%
|
||||
F_RARITY, // val[0] = habitat,
|
||||
// val[1] = rarity% <- pct possiblity of appearing on dungeon level 1
|
||||
// Use this to prevent powerful objects from appearing too early.
|
||||
// val[2] = commonality (enum RARITY RR_xxx)
|
||||
// NA means rr_common
|
||||
|
||||
|
|
2
io.c
2
io.c
|
@ -1011,7 +1011,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
|
|||
if (secwep && (secwep != wep) && streq(obname, obname2)) {
|
||||
char *plur;
|
||||
//plur = makeplural(noprefix(obname));
|
||||
plur = strdup(obname);
|
||||
plur = strdup(noprefix(obname));
|
||||
makeplural(&plur);
|
||||
snprintf(buf2, BUFLEN, "weilding two %s",plur);
|
||||
free(plur);
|
||||
|
|
6
lf.c
6
lf.c
|
@ -4861,8 +4861,8 @@ void do_eyesight_adjust(lifeform_t *lf) {
|
|||
void dumplev(void) {
|
||||
int i;
|
||||
race_t *r;
|
||||
objecttype_t *ot;
|
||||
flag_t *f;
|
||||
//objecttype_t *ot;
|
||||
//flag_t *f;
|
||||
dblog("Start lev monster dump");
|
||||
dblog("------------------\n");
|
||||
// NOTE: this code copied from getrandomrace(), which is used by addmonster().
|
||||
|
@ -4897,6 +4897,7 @@ void dumplev(void) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
dblog("Start object dump");
|
||||
dblog("------------------\n");
|
||||
for (i = 1; i <= 25; i++) {
|
||||
|
@ -4931,6 +4932,7 @@ void dumplev(void) {
|
|||
}
|
||||
fprintf(logfile, "\n");
|
||||
}
|
||||
*/
|
||||
|
||||
fflush(logfile);
|
||||
}
|
||||
|
|
2
map.c
2
map.c
|
@ -8825,7 +8825,7 @@ void initmap(void) {
|
|||
addcelltype(CT_FLOORSNOW, "snow", '.', C_WHITE, NA, B_EMPTY, B_TRANS, MT_SNOW, 0, -1, 0, B_ABSORB);
|
||||
addcelltype(CT_FLOORTILE, "tiled floor", '.', C_CYAN, C_WHITE, B_EMPTY, B_TRANS, MT_METAL, 0, -1, 2, B_NOABSORB);
|
||||
addcelltype(CT_GRASS, "grass", '.', C_GREEN, NA, B_EMPTY, B_TRANS, MT_PLANT, 0, -1, -1, B_ABSORB);
|
||||
addcelltype(CT_DIRT, "dirt", '.', C_DARKYELLOW, C_BROWN, B_EMPTY, B_TRANS, MT_STONE, 0, -1, -1, B_NOABSORB /* mud instead */);
|
||||
addcelltype(CT_DIRT, "dirt", '.', C_DARKYELLOW, C_BROWN, B_EMPTY, B_TRANS, MT_STONE, 0, -1, -1, B_ABSORB);
|
||||
addcelltype(CT_LOWFLOOR, "low rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, -1, -1, 0, B_NOABSORB);
|
||||
addcelltype(CT_VLOWFLOOR, "very low rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, -2, -1, 0, B_NOABSORB);
|
||||
|
||||
|
|
33
nexus.c
33
nexus.c
|
@ -1587,39 +1587,6 @@ char getpctletter(float num, float max) {
|
|||
return '?';
|
||||
}
|
||||
|
||||
void getrarityrange(int depth, int *min, int *max, int range, int oodok) {
|
||||
int upchance = 2;
|
||||
int downchance = 3;
|
||||
|
||||
*min = depth;
|
||||
*max = depth;
|
||||
|
||||
// adjust max depth for better objects
|
||||
if (oodok && (onein(upchance))) {
|
||||
(*max)++;
|
||||
upchance++;
|
||||
// repeated chances of incing level
|
||||
while ((upchance < 10) && (*max < MAXDEPTH) && onein(upchance)) {
|
||||
(*max)++;
|
||||
upchance++;
|
||||
}
|
||||
}
|
||||
|
||||
// adjust min depth for worse objects
|
||||
if (onein(downchance)) {
|
||||
(*min)--;
|
||||
downchance++;
|
||||
while ((downchance < 10) && (*min > 1) && onein(downchance)) {
|
||||
(*min)--;
|
||||
downchance++;
|
||||
}
|
||||
}
|
||||
|
||||
limit(min,1,NA);
|
||||
limit(max,*min,MAXDEPTH);
|
||||
//if (*min > 85) *min = 85;
|
||||
//if (*max < 25) *max = 25;
|
||||
}
|
||||
|
||||
int init(void) {
|
||||
int i;
|
||||
|
|
1
nexus.h
1
nexus.h
|
@ -21,7 +21,6 @@ void gettrrange(int depth, int *min, int *max, int range, int oodok);
|
|||
int getoption(enum OPTION id);
|
||||
enum COLOUR getpctcol(float num, float max);
|
||||
char getpctletter(float num, float max);
|
||||
void getrarityrange(int depth, int *min, int *max, int range, int oodok);
|
||||
int init(void);
|
||||
void initcond(condset_t *cs);
|
||||
void initcondv(condset_t *cs, ...);
|
||||
|
|
156
objects.c
156
objects.c
|
@ -1171,13 +1171,12 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
}
|
||||
|
||||
if (matched) {
|
||||
int minrarity,maxrarity;
|
||||
condset_t cs;
|
||||
|
||||
initcond(&cs);
|
||||
|
||||
// want a specific rarity?
|
||||
rrtorarity(wantrarity, &minrarity, &maxrarity);
|
||||
// want a specific rarity? (ie. "rare weapon")
|
||||
//rrtorarity(wantrarity, &minrarity, &maxrarity);
|
||||
|
||||
if (strstr(p, "firearm")) {
|
||||
addcond(&cs, CC_HASFLAG, B_TRUE, F_FIREARM);
|
||||
|
@ -1209,7 +1208,8 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
}
|
||||
}
|
||||
|
||||
ot = getrandomobofclass(oc->id, minrarity, maxrarity, matchlfskills, &cs);
|
||||
//ot = getrandomobofclass(oc->id, minrarity, maxrarity, matchlfskills, &cs);
|
||||
ot = getrandomobofclass(oc->id, NA, NA, wantrarity, matchlfskills, &cs);
|
||||
if (ot) {
|
||||
found = B_TRUE;
|
||||
break;
|
||||
|
@ -1221,14 +1221,15 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
// cope with "random _otherstuff_"
|
||||
if (!found) {
|
||||
if (strstarts(p, "random gem")) {
|
||||
int minrarity,maxrarity;
|
||||
//int minrarity,maxrarity;
|
||||
condset_t cs;
|
||||
// want a specific rarity?
|
||||
rrtorarity(wantrarity, &minrarity, &maxrarity);
|
||||
//rrtorarity(wantrarity, &minrarity, &maxrarity);
|
||||
|
||||
initcondv(&cs, CC_HASFLAG, B_TRUE, F_GEM,
|
||||
CC_NONE);
|
||||
ot = getrandomobofclass(OC_ROCK, minrarity, maxrarity, NULL, &cs);
|
||||
//ot = getrandomobofclass(OC_ROCK, minrarity, maxrarity, NULL, &cs);
|
||||
ot = getrandomobofclass(OC_ROCK, NA, NA, wantrarity, NULL, &cs);
|
||||
if (ot) {
|
||||
found = B_TRUE;
|
||||
}
|
||||
|
@ -1761,10 +1762,10 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
} else if (where->where && (where->where->habitat->id != H_VILLAGE)) {
|
||||
if (onein(3)) {
|
||||
objecttype_t *ot;
|
||||
int min,max;
|
||||
|
||||
getrarityrange(where->where->map->depth, &min, &max, RARITYVARIANCEOB, B_FALSE);
|
||||
ot = getrandomobofclass(OC_POTION, min, max, NULL, NULL);
|
||||
int pctroll;
|
||||
pctroll = rollforob(where->where->map->depth);
|
||||
//getrarityrange(where->where->map->depth, &min, &max, RARITYVARIANCEOB, B_FALSE);
|
||||
ot = getrandomobofclass(OC_POTION, 0, pctroll, NA, NULL, NULL);
|
||||
if (ot) {
|
||||
f = hasflag(o->flags, F_LINKOB); assert(f);
|
||||
f->val[0] = ot->id;
|
||||
|
@ -3818,6 +3819,25 @@ int doobtraps(object_t *o, lifeform_t *lf) {
|
|||
return B_FALSE;
|
||||
}
|
||||
|
||||
void dumpobs(int ntogen) {
|
||||
int depth, i;
|
||||
char obname[BUFLEN];
|
||||
for (depth = 1; depth <= MAXDEPTH; depth++) {
|
||||
dblog("Sample obs for depth %d:", depth);
|
||||
for (i = 0; i < ntogen; i++) {
|
||||
condset_t cs;
|
||||
initcond(&cs);
|
||||
if (real_getrandomob(NULL, obname, depth, H_DUNGEON, RR_NONE, B_TRUE, &cs)) {
|
||||
dblog(" %s", obname);
|
||||
} else {
|
||||
dblog(" (no object found)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this entire function doesn't really make sense anymore.
|
||||
void dumpobrarity(void) {
|
||||
enum RARITY rr;
|
||||
objecttype_t *ot;
|
||||
|
@ -3828,14 +3848,16 @@ void dumpobrarity(void) {
|
|||
rrtorarity(rr, &min, &max);
|
||||
dblog("Obs with rarity %s:", getrarityname(rr));
|
||||
for (ot = objecttype ; ot ; ot = ot->next) {
|
||||
if (ot->obclass->id == OC_ARMOUR) {
|
||||
if (ot->obclass->id == OC_WEAPON) {
|
||||
int thisrar;
|
||||
f = hasflag(ot->flags, F_RARITY);
|
||||
if (!f) continue;
|
||||
thisrar = f->val[1];
|
||||
|
||||
if ((thisrar >= min) && (thisrar <= max)) {
|
||||
dblog("\t%s", ot->name);
|
||||
skill_t *sk;
|
||||
sk = getobskill(ot->flags);
|
||||
dblog("\t%s - %s", ot->name, sk ? sk->name : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4074,6 +4096,30 @@ objecttype_t *findotn(char *name) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// this will return the number to subtract from our percentage die roll
|
||||
// when determining objects.
|
||||
//
|
||||
// lower roll = better object possibilities
|
||||
int getobrollmod(int depth, int range, int oodok) { // TODO: range currently unused
|
||||
int upchance = 2;
|
||||
//int downchance = 3;
|
||||
int mod = depth; // ie. dlev1 = -1 to roll. dlev 25 = -25 to roll.
|
||||
|
||||
// adjust modifier for better objects
|
||||
if (oodok && (onein(upchance))) {
|
||||
mod++;
|
||||
upchance++;
|
||||
// repeated chances of getting better
|
||||
while ((upchance < 10) && (mod < 100) && onein(upchance)) {
|
||||
mod++;
|
||||
upchance++;
|
||||
}
|
||||
}
|
||||
|
||||
return mod;
|
||||
}
|
||||
|
||||
|
||||
int getrustdampct(object_t *o) {
|
||||
int pct = 100;
|
||||
flag_t *rust;
|
||||
|
@ -5138,12 +5184,12 @@ int getrandomgrimoirelev(void) {
|
|||
return wantlev;
|
||||
}
|
||||
|
||||
objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity, lifeform_t *forlf, condset_t *cs) {
|
||||
objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity, int wantrr, lifeform_t *forlf, condset_t *cs) {
|
||||
objecttype_t *ot;
|
||||
int totcount = 0, count = 0;
|
||||
flag_t *f;
|
||||
objecttype_t **poss;
|
||||
int nposs = 0;
|
||||
int nposs = 0,tryagain = B_TRUE;
|
||||
|
||||
// count total # of objecttypes
|
||||
for (ot = objecttype ; ot ; ot = ot->next) {
|
||||
|
@ -5152,6 +5198,9 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity
|
|||
poss = malloc(totcount*sizeof(objecttype_t *));
|
||||
|
||||
|
||||
tryagain = B_TRUE;
|
||||
while (tryagain) {
|
||||
tryagain = B_FALSE;
|
||||
for (ot = objecttype ; ot ; ot = ot->next) {
|
||||
if ((ot->obclass->id == ocid) && !hasflag(ot->flags, F_UNIQUE)) {
|
||||
int rarityok = B_FALSE;
|
||||
|
@ -5167,7 +5216,20 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity
|
|||
((maxrarity == NA) || (f->val[1] <= maxrarity)) ) {
|
||||
rarityok = B_TRUE;
|
||||
}
|
||||
|
||||
if (wantrr) {
|
||||
int rrok = B_FALSE;
|
||||
if (f->val[2] == NA) {
|
||||
rrok = B_TRUE;
|
||||
} else if (f->val[2] == wantrr) {
|
||||
rrok = B_TRUE;
|
||||
}
|
||||
if (!rrok) rarityok = B_FALSE;
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
// if we're randomly selecting an object for a lf, make sure it matches their
|
||||
// skillset
|
||||
if (forlf) {
|
||||
|
@ -5227,6 +5289,14 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity
|
|||
}
|
||||
}
|
||||
}
|
||||
if (count <= 0) {
|
||||
if ((wantrr != NA) && (wantrr > RR_NONE)) {
|
||||
wantrr--;
|
||||
tryagain = B_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
free(poss);
|
||||
return NULL;
|
||||
|
@ -6914,7 +6984,6 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
|
|||
char *pluralname = NULL;
|
||||
char brandname[BUFLEN];
|
||||
char cursestr[BUFLEN];
|
||||
int raritymin,raritymax;
|
||||
int depth,i;
|
||||
int done = B_FALSE;
|
||||
obmod_t *om;
|
||||
|
@ -6927,6 +6996,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
|
|||
int brandchance;
|
||||
enum OBCLASS wantcl = OC_NONE;
|
||||
int multiwantcl = B_FALSE;
|
||||
int pctroll;
|
||||
|
||||
if (!db) db = obdb;
|
||||
|
||||
|
@ -6952,7 +7022,7 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
|
|||
depth = getmapdifficulty(NULL);
|
||||
}
|
||||
|
||||
getrarityrange(depth, &raritymin, &raritymax, RARITYVARIANCEOB, B_TRUE);
|
||||
//getrarityrange(depth, &raritymin, &raritymax, RARITYVARIANCEOB, B_TRUE);
|
||||
|
||||
// pick rr...
|
||||
if (forcerr == RR_NONE) {
|
||||
|
@ -7017,9 +7087,12 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
|
|||
return selot;
|
||||
}
|
||||
|
||||
// roll to determine object rarity
|
||||
pctroll = rollforob(depth);
|
||||
|
||||
while (!done) {
|
||||
if (db || partdb) dblog("adding random object with rarity value between %d - %d and rr <= %d(%s), for habitat %s",
|
||||
raritymin,raritymax,wantrr, getrarityname(wantrr), habname);
|
||||
if (db || partdb) dblog("adding random object with rarity value > %d rr <= %d(%s), for habitat %s",
|
||||
pctroll,wantrr, getrarityname(wantrr), habname);
|
||||
if (db || partdb) {
|
||||
if (forpickup) {
|
||||
dblog(" must be holdable");
|
||||
|
@ -7052,7 +7125,8 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
|
|||
rarnum = rarflag->val[1];
|
||||
if (rarnum == NA) rarnum = 100;
|
||||
|
||||
if ((rarnum >= raritymin) && (rarnum <= raritymax)) {
|
||||
//if ((rarnum >= raritymin) && (rarnum <= raritymax))
|
||||
if (pctroll <= rarnum) {
|
||||
// now check common, rare, etc
|
||||
enum RARITY thisrr;
|
||||
|
||||
|
@ -7102,13 +7176,13 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
|
|||
|
||||
// nothing found?
|
||||
if (nposs == 0) {
|
||||
// already at lowest rarity?
|
||||
if ((raritymax >= 100) && (raritymin <= 0)) {
|
||||
// already at lowest roll?
|
||||
if (pctroll <= 0) {
|
||||
// now lower wantrr
|
||||
if (rrmoddir == -1) {
|
||||
if (wantrr > RR_FREQUENT) {
|
||||
wantrr--;
|
||||
if (db || partdb) dblog("rarity at min/max and no obs. lowering wantrr to %d (%s).",wantrr,getrarityname(wantrr));
|
||||
if (db || partdb) dblog("pctroll at min (0) and no obs. lowering wantrr to %d (%s).",wantrr,getrarityname(wantrr));
|
||||
} else {
|
||||
// wantrr is already at rr_frequent
|
||||
// start increasing it now.
|
||||
|
@ -7128,10 +7202,9 @@ objecttype_t *real_getrandomob(cell_t *cell, char *buf, int forcedepth, int forc
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// expand range and try again
|
||||
raritymax += 10; if (raritymax > 100) raritymax = 100;
|
||||
raritymin -= 10; if (raritymin < 0) raritymin = 0;
|
||||
if (db || partdb) dblog("no possible objects like this. trying again with rarity %d-%d\n",raritymin,raritymax);
|
||||
// lower roll and try again
|
||||
pctroll -= 10;
|
||||
if (db || partdb) dblog("no possible objects like this. trying again with pctroll=%d\n",pctroll);
|
||||
}
|
||||
} else {
|
||||
// something found
|
||||
|
@ -10988,7 +11061,6 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
addob(where->obpile, "3-5 banana skins");
|
||||
}
|
||||
break;
|
||||
//oooooooooo
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13876,6 +13948,16 @@ void resizeobject(object_t *o, enum LFSIZE wantsize) {
|
|||
}
|
||||
}
|
||||
|
||||
int rollforob(int depth) {
|
||||
int pctroll,mod;
|
||||
pctroll = rnd(1,100);
|
||||
mod = getobrollmod(depth, RARITYVARIANCEOB, B_TRUE);
|
||||
pctroll -= mod;
|
||||
limit(&pctroll,1,100);
|
||||
return pctroll;
|
||||
}
|
||||
|
||||
|
||||
void rrtorarity(enum RARITY r, int *minr, int *maxr) {
|
||||
switch (r) {
|
||||
case RR_UNIQUE:
|
||||
|
@ -13885,22 +13967,22 @@ void rrtorarity(enum RARITY r, int *minr, int *maxr) {
|
|||
break;
|
||||
case RR_VERYRARE:
|
||||
if (minr) *minr = 0;
|
||||
if (maxr) *maxr = 49;
|
||||
if (maxr) *maxr = 25;
|
||||
break;
|
||||
case RR_RARE:
|
||||
if (minr) *minr = 50;
|
||||
if (maxr) *maxr = 64;
|
||||
if (minr) *minr = 25;
|
||||
if (maxr) *maxr = 45;
|
||||
break;
|
||||
case RR_UNCOMMON:
|
||||
if (minr) *minr = 65;
|
||||
if (maxr) *maxr = 79;
|
||||
if (minr) *minr = 45;
|
||||
if (maxr) *maxr = 65;
|
||||
break;
|
||||
case RR_COMMON:
|
||||
if (minr) *minr = 80;
|
||||
if (maxr) *maxr = 100;
|
||||
if (minr) *minr = 65;
|
||||
if (maxr) *maxr = 85;
|
||||
break;
|
||||
case RR_FREQUENT:
|
||||
if (minr) *minr = 90;
|
||||
if (minr) *minr = 85;
|
||||
if (maxr) *maxr = 100;
|
||||
break;
|
||||
default:
|
||||
|
@ -16105,7 +16187,7 @@ void timeeffectsob(object_t *o) {
|
|||
|
||||
|
||||
if ((getmaterialstate(o->type->material->id) == MS_LIQUID) || (o->type->id == OT_SPLASHWATER)) {
|
||||
if (location->type->absorbent) {
|
||||
if (location->type->absorbent && !hasflag(o->flags, F_NOABSORB)) {
|
||||
if (haslos(player, location)) {
|
||||
msg("%s %s absorbed into the %s.", obname,
|
||||
OB1(o,"is","are"), location->type->name);
|
||||
|
|
|
@ -55,6 +55,7 @@ void damageallobs(object_t *srcob, obpile_t *op, int howmuch, int damtype, lifef
|
|||
void dodecay(object_t *o);
|
||||
int doobdieconvert(object_t *o, int wantannounce);
|
||||
int doobtraps(object_t *o, lifeform_t *lf);
|
||||
void dumpobs(int ntogen);
|
||||
void dumpobrarity(void);
|
||||
void explodeob(object_t *o, flag_t *f, int bigness, lifeform_t *causedby);
|
||||
void extinguish(object_t *o);
|
||||
|
@ -96,6 +97,7 @@ lifeform_t *getobcreatedby(object_t *o);
|
|||
int getobjamdiff(int depth);
|
||||
int getoboffermod(object_t *o, lifeform_t *lf, char *why);
|
||||
int getobpoints(object_t *o);
|
||||
int getobrollmod(int depth, int range, int oodok);
|
||||
void getobs(obpile_t *op, condset_t *cs, object_t **retob, int *nretobs);
|
||||
skill_t *getobskill(flagpile_t *fp);
|
||||
enum LFSIZE getobsize(object_t *o);
|
||||
|
@ -113,7 +115,7 @@ object_t *getrandomammo(lifeform_t *lf);
|
|||
objecttype_t *getrandomammofor(object_t *o, int usebasic);
|
||||
brand_t *getrandombrandfor(objecttype_t *ot);
|
||||
int getrandomgrimoirelev(void);
|
||||
objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity, lifeform_t *forlf, condset_t *cs);
|
||||
objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity, int wantrr, lifeform_t *forlf, condset_t *cs);
|
||||
enum OBTYPE getrandomtrapforob(object_t *o);
|
||||
int getrustdampct(object_t *o);
|
||||
int getfirearmrange(object_t *o);
|
||||
|
@ -297,6 +299,7 @@ int removedeadobs(obpile_t *op);
|
|||
int removeob(object_t *o, int howmany);
|
||||
object_t *relinkob(object_t *src, obpile_t *dst);
|
||||
void resizeobject(object_t *o, enum LFSIZE wantsize);
|
||||
int rollforob(int depth);
|
||||
void rrtorarity(enum RARITY r, int *minr, int *maxr);
|
||||
void setblessed(object_t *o, enum BLESSTYPE wantbless);
|
||||
int setcolfromhiddenname(flagpile_t *fp, char *text, int defaultglyph);
|
||||
|
|
2
spell.c
2
spell.c
|
@ -5946,7 +5946,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
flag_t *f;
|
||||
while (pickagain) {
|
||||
pickagain = B_FALSE;
|
||||
ot = getrandomobofclass(OC_FOOD, NA, NA, NULL, NULL);
|
||||
ot = getrandomobofclass(OC_FOOD, NA, NA, NA, NULL, NULL);
|
||||
if (hasflag(ot->flags, F_VENOMSAC)) {
|
||||
pickagain = B_TRUE;
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue