- [+] tweak random monster code - highest TR () shiuld appear at level

23-24!
    - [+] highest TR is about 20.
    - [+] gettrrange()
- [+] F_NUMCONVERT xx text
    - [+] if stack reaches xx in number, change to obtype "text" 
        - [+] eg. blood splash x 5 = large pool of blood
- [+] troll blood -> healing potions
This commit is contained in:
Rob Pearce 2012-04-14 13:23:04 +00:00
parent ac95dc7621
commit 97eda5fa2d
12 changed files with 75 additions and 22 deletions

16
data.c
View File

@ -5695,6 +5695,7 @@ void initobjects(void) {
addflag(lastot->flags, F_DTCONVERT, DT_FIRE, NA, NA, "puff of steam"); addflag(lastot->flags, F_DTCONVERT, DT_FIRE, NA, NA, "puff of steam");
addflag(lastot->flags, F_DRINKABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DRINKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NUMCONVERT, 5, OT_PUDDLEWATERL, NA, NULL);
addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL); addflag(lastot->flags, F_OBHP, 10, 10, NA, NULL);
addflag(lastot->flags, F_OBHPDRAIN, 1, NA, 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_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
@ -5769,7 +5770,7 @@ void initobjects(void) {
addflag(lastot->flags, F_OBHP, 15, 15, NA, NULL); addflag(lastot->flags, F_OBHP, 15, 15, NA, NULL);
addflag(lastot->flags, F_OBHPDRAIN, 1, NA, 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_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_LINKOB, OT_POT_BLOOD, NA, NA, NULL); addflag(lastot->flags, F_NUMCONVERT, 5, OT_BLOODPOOL, NA, NULL);
addflag(lastot->flags, F_COSMETIC, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_COSMETIC, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_PURIFIESTO, OT_SPLASHWATER, NA, NA, NULL); addflag(lastot->flags, F_PURIFIESTO, OT_SPLASHWATER, NA, NA, NULL);
@ -5781,11 +5782,11 @@ void initobjects(void) {
addflag(lastot->flags, F_RARITY, H_DUNGEON, 65, NA, NULL); addflag(lastot->flags, F_RARITY, H_DUNGEON, 65, NA, NULL);
addflag(lastot->flags, F_RARITY, H_CAVE, 65, NA, NULL); addflag(lastot->flags, F_RARITY, H_CAVE, 65, NA, NULL);
addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_SLIPPERY, 3, NA, NA, NULL); addflag(lastot->flags, F_SLIPPERY, 5, NA, NA, NULL);
addflag(lastot->flags, F_DIECONVERT, NA, NA, NA, "blood stain"); addflag(lastot->flags, F_DIECONVERT, NA, NA, NA, "blood stain");
addflag(lastot->flags, F_DIECONVERTTEXT, NA, NA, NA, "dries up"); addflag(lastot->flags, F_DIECONVERTTEXT, NA, NA, NA, "dries up");
addflag(lastot->flags, F_DIECONVERTTEXTPL, NA, NA, NA, "dry up"); addflag(lastot->flags, F_DIECONVERTTEXTPL, NA, NA, NA, "dry up");
addflag(lastot->flags, F_OBHP, 30, 30, NA, NULL); addflag(lastot->flags, F_OBHP, 50, 50, NA, NULL);
addflag(lastot->flags, F_OBHPDRAIN, 1, NA, 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_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_DRINKABLE, B_TRUE, 0, NA, NULL); addflag(lastot->flags, F_DRINKABLE, B_TRUE, 0, NA, NULL);
@ -12382,6 +12383,9 @@ void initrace(void) {
addflag(lastrace->flags, F_RARITY, H_CAVE, NA, RR_UNCOMMON, NULL); addflag(lastrace->flags, F_RARITY, H_CAVE, NA, RR_UNCOMMON, NULL);
addflag(lastrace->flags, F_RARITY, H_SWAMP, NA, RR_COMMON, NULL); addflag(lastrace->flags, F_RARITY, H_SWAMP, NA, RR_COMMON, NULL);
addflag(lastrace->flags, F_HITDICE, 5, NA, NA, NULL); addflag(lastrace->flags, F_HITDICE, 5, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALINGMIN, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALING, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALINGMAJ, NA, NA, NULL);
addflag(lastrace->flags, F_TR, 5, NA, NA, NULL); addflag(lastrace->flags, F_TR, 5, NA, NA, NULL);
addflag(lastrace->flags, F_EVASION, 10, NA, NA, NULL); addflag(lastrace->flags, F_EVASION, 10, NA, NA, NULL);
addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, NULL); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, NULL);
@ -12448,6 +12452,9 @@ void initrace(void) {
addflag(lastrace->flags, F_ALIGNMENT, AL_EVIL, NA, NA, NULL); addflag(lastrace->flags, F_ALIGNMENT, AL_EVIL, NA, NA, NULL);
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_SIZE, SZ_LARGE, NA, NA, NULL); addflag(lastrace->flags, F_SIZE, SZ_LARGE, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALINGMIN, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALING, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALINGMAJ, NA, NA, NULL);
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_UNCOMMON, NULL); addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_UNCOMMON, NULL);
addflag(lastrace->flags, F_RARITY, H_CAVE, NA, RR_UNCOMMON, NULL); addflag(lastrace->flags, F_RARITY, H_CAVE, NA, RR_UNCOMMON, NULL);
addflag(lastrace->flags, F_RARITY, H_SWAMP, NA, RR_COMMON, NULL); addflag(lastrace->flags, F_RARITY, H_SWAMP, NA, RR_COMMON, NULL);
@ -12488,6 +12495,9 @@ void initrace(void) {
addflag(lastrace->flags, F_ALIGNMENT, AL_EVIL, NA, NA, NULL); addflag(lastrace->flags, F_ALIGNMENT, AL_EVIL, NA, NA, NULL);
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_SIZE, SZ_LARGE, NA, NA, NULL); addflag(lastrace->flags, F_SIZE, SZ_LARGE, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALINGMIN, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALING, NA, NA, NULL);
addflag(lastrace->flags, F_FILLPOT, OT_POT_HEALINGMAJ, NA, NA, NULL);
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_UNCOMMON, NULL); addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_UNCOMMON, NULL);
addflag(lastrace->flags, F_RARITY, H_SWAMP, NA, RR_COMMON, NULL); addflag(lastrace->flags, F_RARITY, H_SWAMP, NA, RR_COMMON, NULL);
addflag(lastrace->flags, F_HITDICE, 5, NA, NA, NULL); addflag(lastrace->flags, F_HITDICE, 5, NA, NA, NULL);

Binary file not shown.

View File

@ -22,7 +22,7 @@ m:ob:landmine trap
@flags @flags
entertext:You enter an ornate shrine. entertext:You enter an ornate shrine.
shrine tag:shrine
norandom norandom
mayrotate mayrotate
goesin:dungeon goesin:dungeon

2
defs.h
View File

@ -2420,6 +2420,8 @@ enum FLAG {
F_SHRINKSTO, // used for spells. v0=new oid or celltype. F_SHRINKSTO, // used for spells. v0=new oid or celltype.
// v1 = VT_OB or VT_CELL // v1 = VT_OB or VT_CELL
F_NOSHATTER, // object will not shatter, even if it's material should. F_NOSHATTER, // object will not shatter, even if it's material should.
F_NUMCONVERT, // if o->amt is >= v0, object type changes into either
// f->text (if given), or obtype v1.
F_STACKABLE, // can stack multiple objects togethr F_STACKABLE, // can stack multiple objects togethr
F_THE, // say "the xxx", not "a xxx" F_THE, // say "the xxx", not "a xxx"
F_NO_PLURAL, // this obname doesn't need an 's' for plurals (eg. gold, money) F_NO_PLURAL, // this obname doesn't need an 's' for plurals (eg. gold, money)

View File

@ -90,9 +90,6 @@ Flags can be:
// appear when specifically requested via a region's // appear when specifically requested via a region's
// outline. // outline.
shrine // }
stomach // } this vault is a shrine/etc
tag:xxxx // add tag "xxx" to vault(for use with rndvaultwithtag) tag:xxxx // add tag "xxx" to vault(for use with rndvaultwithtag)
NOTES: NOTES:

11
flag.c
View File

@ -8,6 +8,7 @@
#include "io.h" #include "io.h"
#include "lf.h" #include "lf.h"
#include "map.h" #include "map.h"
#include "nexus.h"
#include "objects.h" #include "objects.h"
#include "spell.h" #include "spell.h"
#include "text.h" #include "text.h"
@ -1439,6 +1440,16 @@ int getflags(flagpile_t *fp, flag_t **retflag, int *nretflags, ... ) {
return *nretflags; return *nretflags;
} }
flag_t *getrandomflag(flagpile_t *fp, enum FLAG fid) {
flag_t *retflag[MAXCANDIDATES];
int nretflags = 0;
getflags(fp, retflag, &nretflags, fid, F_NONE);
if (nretflags) {
return retflag[rnd(0,nretflags-1)];
}
return NULL;
}
int modcounter(flagpile_t *fp, int amt) { int modcounter(flagpile_t *fp, int amt) {
flag_t *f; flag_t *f;
f = hasflag(fp, F_COUNTER); f = hasflag(fp, F_COUNTER);

1
flag.h
View File

@ -26,6 +26,7 @@ int flagstacks(enum FLAG fid);
int flagtomaxhp(flag_t *f); int flagtomaxhp(flag_t *f);
cell_t *getflagpilelocation(flagpile_t *fp); cell_t *getflagpilelocation(flagpile_t *fp);
int getflags(flagpile_t *fp, flag_t **retflag, int *nretflags, ... ); int getflags(flagpile_t *fp, flag_t **retflag, int *nretflags, ... );
flag_t *getrandomflag(flagpile_t *fp, enum FLAG fid);
flag_t *hasflag(flagpile_t *fp, int id); flag_t *hasflag(flagpile_t *fp, int id);
flag_t *hasflagknown(flagpile_t *fp, int id); flag_t *hasflagknown(flagpile_t *fp, int id);
flag_t *hasflag_real(flagpile_t *fp, int id, int wantknown, flag_t *exception, int lifetimeexception); flag_t *hasflag_real(flagpile_t *fp, int id, int wantknown, flag_t *exception, int lifetimeexception);

13
lf.c
View File

@ -199,7 +199,7 @@ void awardxpfor(lifeform_t *killed, float pct) {
} }
void bleed(lifeform_t *lf, int splatter) { void bleed(lifeform_t *lf, int splatter) {
flag_t *f,*bloodfillflag; flag_t *f;
char obname[BUFLEN]; char obname[BUFLEN];
flag_t *retflag[MAXCANDIDATES]; flag_t *retflag[MAXCANDIDATES];
int nretflags; int nretflags;
@ -222,22 +222,19 @@ void bleed(lifeform_t *lf, int splatter) {
strcpy(obname, "splash of blood"); strcpy(obname, "splash of blood");
} }
bloodfillflag = hasflag(lf->flags, F_FILLPOT);
if (strlen(obname) > 0) { if (strlen(obname) > 0) {
int nfillpot = 0;
object_t *o; object_t *o;
o = addob(lf->cell->obpile, obname); o = addob(lf->cell->obpile, obname);
if (bloodfillflag) { nfillpot = copyflag(o->flags, lf->flags, F_FILLPOT);
addflag(o->flags, F_FILLPOT, bloodfillflag->val[0], NA, NA, NULL);
}
if (splatter) { if (splatter) {
addobsinradius(lf->cell, 1, DT_COMPASS, obname, B_TRUE, NULL); addobsinradius(lf->cell, 1, DT_COMPASS, obname, B_TRUE, NULL);
if (bloodfillflag) { if (nfillpot) {
int i; int i;
for (i = 0; i < nretobs; i++) { for (i = 0; i < nretobs; i++) {
addflag(retobs[i]->flags, F_FILLPOT, bloodfillflag->val[0], NA, NA, NULL); copyflag(retobs[i]->flags, lf->flags, F_FILLPOT);
} }
} }
} }

2
map.c
View File

@ -7180,7 +7180,7 @@ void initmaplayout(void) {
// l11 - 14: swamp // l11 - 14: swamp
addregionthing(lastregionoutline, rnd(11,14), NA, NA, RT_HABITAT, H_SWAMP, NULL); addregionthing(lastregionoutline, rnd(11,14), NA, NA, RT_HABITAT, H_SWAMP, NULL);
// l25: last level // l25: last level
addregionthing(lastregionoutline, 25, NA, NA, RT_RNDVAULTWITHFLAG, F_VAULTISSHRINE, NULL); // godstone on last floor addregionthing(lastregionoutline, 25, NA, NA, RT_RNDVAULTWITHTAG, NA, "shrine"); // godstone on last floor
// 1-3 fixed sewers // 1-3 fixed sewers
addregionthing(lastregionoutline, rnd(1,25), NA, NA, RT_REGIONLINK, RG_SEWER, "drainage grate"); addregionthing(lastregionoutline, rnd(1,25), NA, NA, RT_REGIONLINK, RG_SEWER, "drainage grate");

View File

@ -1027,9 +1027,10 @@ void gettrrange(int depth, int *min, int *max, int range, int oodok) {
} }
} }
mid = (depth/2); //mid = (depth/2);
mid = (depth);
*min = mid - range; limit(min, 0, maxmonhitdice); *min = mid - range - 10; limit(min, 0, maxmonhitdice);
*max = mid + range; limit(max, *min, maxmonhitdice); *max = mid + range; limit(max, *min, maxmonhitdice);
} }

View File

@ -9700,7 +9700,8 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
if (ch == 'y') { if (ch == 'y') {
char newobname[BUFLEN]; char newobname[BUFLEN];
flag_t *bfob; flag_t *bfob;
bfob = hasflag(oo->flags, F_FILLPOT); // get a random fillpot flag.
bfob = getrandomflag(oo->flags, F_FILLPOT);
if (bfob) { if (bfob) {
objecttype_t *ot; objecttype_t *ot;
ot = findot(bfob->val[0]); ot = findot(bfob->val[0]);
@ -13488,6 +13489,42 @@ void timeeffectsob(object_t *o) {
} }
} }
// objects combine?
f = hasflag(o->flags, F_NUMCONVERT);
if (f && (o->amt >= f->val[0])) {
int newamt,i;
enum OBTYPE newoid = OT_NONE;
obpile_t *op;
char *newobname = NULL;
flagpile_t *fp;
newamt = o->amt / f->val[0];
op = o->pile;
fp = addflagpile(NULL, NULL);
if (strlen(f->text)) {
newobname = strdup(f->text);
} else {
newoid = f->val[1];
}
// some flags will be inherited by the new object
copyflag(fp, o->flags, F_FILLPOT);
removeob(o, o->amt);
for (i = 0; i < newamt; i++) {
object_t *newob;
if (newobname) {
newob = addob(op, newobname);
} else {
newob = addobfast(op, newoid);
}
if (newob) {
copyflags(newob->flags, fp, NA);
}
}
if (newobname) free(newobname);
killflagpile(fp);
return;
}
// expire flags // expire flags
timeeffectsflags(o->flags); timeeffectsflags(o->flags);
checkflagpile(o->flags); checkflagpile(o->flags);

View File

@ -1457,9 +1457,6 @@ int handleline(vault_t *v, char *line) {
p = line + 4; p = line + 4;
addflag(v->flags, F_VAULTTAG, B_TRUE, NA, NA, p); addflag(v->flags, F_VAULTTAG, B_TRUE, NA, NA, p);
ok = B_TRUE; ok = B_TRUE;
} else if (streq(line, "shrine")) { // a godstone shrine
addflag(v->flags, F_VAULTISSHRINE, B_TRUE, NA, NA, NULL);
ok = B_TRUE;
} }
} }
} }