- [+] bug: mosnters not wkaing up

- [+] why don't i see "%s dies" when my ally dies?
    - [+] cause it was behind me.  added sound to tell us about this.
- [+] bug: s - 2 four leavesed clover
- [+] random portals
    - [+] genericise code for making destination
    - [+] check gate spell
    - [+] enter a portal which doesn't go anywhere = generate a
          destination.
- [+] increase range of all light sources
- [+] ring of hunger should override vege/carni
This commit is contained in:
Rob Pearce 2011-11-24 19:06:24 +00:00
parent e9edb81ec6
commit c522cac6c0
10 changed files with 161 additions and 87 deletions

View File

@ -489,8 +489,8 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
break;
}
} else if (attackedhelpless) {
angergodmaybe(R_GODMERCY, 100, GA_ATTACKHELPLESS);
angergodmaybe(R_GODPURITY, 100, GA_ATTACKHELPLESS);
angergodmaybe(R_GODMERCY, 50, GA_ATTACKHELPLESS);
angergodmaybe(R_GODPURITY, 50, GA_ATTACKHELPLESS);
if (getalignment(attacktarget) != AL_EVIL) {
pleasegodmaybe(R_GODTHIEVES, 5);
pleasegodmaybe(R_GODDEATH, 10);
@ -499,7 +499,7 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
if (lfhasflag(lf, F_USEDPOISON)) {
killflagsofid(lf->flags, F_USEDPOISON);
angergodmaybe(R_GODPURITY, 100, GA_POISON);
angergodmaybe(R_GODMERCY, 50, GA_POISON);
angergodmaybe(R_GODMERCY, 25, GA_POISON);
pleasegodmaybe(R_GODDEATH, 3);
}
}

51
data.c
View File

@ -155,7 +155,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTSKILL, SK_SS_MENTAL, PR_MASTER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_SUMMONING, PR_MASTER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_TECHUSAGE, PR_ADEPT, NA, NULL);
//addflag(lastjob->flags, F_HASPET, NA, NA, NA, "young wolf");
addflag(lastjob->flags, F_HASPET, NA, NA, NA, "young wolf");
for (i = 1; i < MAXSKILLS; i++) {
addflag(lastjob->flags, F_CANLEARN, i, NA, NA, NULL);
}
@ -964,7 +964,7 @@ void initobjects(void) {
addflag_real(lastbrand->flags, F_ONLYFORWEPSKILL, SK_LONGBLADES, NA, NA, NULL, PERMENANT, B_UNKNOWN, -1);
addflag_real(lastbrand->flags, F_ONLYFORWEPSKILL, SK_SHORTBLADES, NA, NA, NULL, PERMENANT, B_UNKNOWN, -1);
addflag_real(lastbrand->flags, F_RACESLAY, RC_UNDEAD, NA, NA, NULL, PERMENANT, B_UNKNOWN, -1);
addflag_real(lastbrand->flags, F_EQUIPCONFER, F_PRODUCESLIGHT, 2, NA, NULL, PERMENANT, B_KNOWN, -1);
addflag_real(lastbrand->flags, F_EQUIPCONFER, F_PRODUCESLIGHT, 3, NA, NULL, PERMENANT, B_KNOWN, -1);
// feet
addbrand(BR_LEVITATION, "of hovering", BP_FEET);
@ -1258,6 +1258,7 @@ void initobjects(void) {
addot(OT_FOUNTAIN, "fountain", "A running fountain of some kind of liquid.", MT_WATER, 20, OC_MISC, SZ_MEDIUM);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_GLYPH, C_BLUE, NA, NA, "_");
addflag(lastot->flags, F_RARITY, H_VILLAGE, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 90, RR_UNCOMMON, NULL);
@ -1455,6 +1456,7 @@ void initobjects(void) {
addot(OT_PORTAL, "magic portal", "A magical portal to a different place...", MT_MAGIC, 0, OC_DFEATURE, SZ_LARGE);
addflag(lastot->flags, F_RARITY, H_ALL, 80, RR_VERYRARE, NULL);
addflag(lastot->flags, F_GLYPH, C_BOLDGREEN, NA, NA, "^");
addflag(lastot->flags, F_CLIMBABLE, D_IN, NA, NA, NULL);
addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL);
@ -1882,6 +1884,7 @@ void initobjects(void) {
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_RARE, NULL);
addflag(lastot->flags, F_RARITY, H_FOREST, 100, RR_RARE, NULL);
addflag(lastot->flags, F_HOLDCONFER, F_EXTRALUCK, 1, NA, NULL);
killflagsofid(lastot->flags, F_STACKABLE);
addot(OT_BREADSTALE, "loaf of stale bread", "A small loaf of old, stale bread.", MT_FOOD, 0.5, OC_FOOD, SZ_TINY);
addflag(lastot->flags, F_GLYPH, C_BROWN, NA, NA, "%");
addflag(lastot->flags, F_EDIBLE, B_TRUE, 100, NA, "");
@ -3705,8 +3708,8 @@ void initobjects(void) {
addot(OT_BUGLAMP, "glowing flask", "A glass flask with a glowbug corpse inside.", MT_GLASS, 0.3, OC_TOOLS, SZ_SMALL);
addflag(lastot->flags, F_GLYPH, NA, NA, NA, "!");
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
addflag(lastot->flags, F_HOLDCONFER, F_PRODUCESLIGHT, 2, IFKNOWN, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 3, NA, NA, NULL);
addflag(lastot->flags, F_HOLDCONFER, F_PRODUCESLIGHT, 3, IFKNOWN, NULL);
addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "a flask");
addot(OT_CANDLE, "candle", "A short wax candle.", MT_WAX, 0.2, OC_TOOLS, SZ_TINY);
@ -3714,8 +3717,8 @@ void initobjects(void) {
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATEPREFIX, NA, NA, NA, "lit");
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 1, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 1, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 2, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_RNDCHARGES, 200, 400, NA, NULL);
addflag(lastot->flags, F_LIGHTSOURCE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_CHARGELOWMSG, B_TRUE, NA, NA, "flickers");
@ -3753,8 +3756,8 @@ void initobjects(void) {
addflag(lastot->flags, F_RARITY, H_ALL, 70, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 2, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 5, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 5, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_RNDCHARGES, 400, 700, NA, NULL);
addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL);
addflag(lastot->flags, F_LIGHTSOURCE, B_TRUE, NA, NA, NULL);
@ -3765,8 +3768,8 @@ void initobjects(void) {
addflag(lastot->flags, F_RARITY, H_ALL, 55, NA, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 3, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 3, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 6, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 6, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_RNDCHARGES, 500, 900, NA, NULL);
addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL);
addflag(lastot->flags, F_LIGHTSOURCE, B_TRUE, NA, NA, NULL);
@ -3898,8 +3901,8 @@ void initobjects(void) {
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATEPREFIX, NA, NA, NA, "lit");
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 2, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 4, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 4, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_RNDCHARGES, 100, 200, NA, NULL);
addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL);
addflag(lastot->flags, F_RODSHAPED, B_TRUE, NA, NA, NULL);
@ -3970,8 +3973,8 @@ void initobjects(void) {
addflag(lastot->flags, F_RARITY, H_ALL, 75, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 2, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 3, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 3, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_NOVICE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
@ -4105,7 +4108,7 @@ void initobjects(void) {
addflag(lastot->flags, F_RNDCHARGES, 10, 30, NA, NULL);
addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_FLYING, B_TRUE, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 1, NA, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 2, NA, NULL);
addflag(lastot->flags, F_TECHLEVEL, PR_SKILLED, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, NULL);
@ -4463,8 +4466,8 @@ void initobjects(void) {
addflag(lastot->flags, F_OPERABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OPERONOFF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ACTIVATEPREFIX, NA, NA, NA, "lit");
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 4, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 4, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_ACTIVATECONFER, F_PRODUCESLIGHT, 8, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 8, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_REFILLWITH, OT_POT_OIL, NA, NA, NULL);
addflag(lastot->flags, F_RODSHAPED, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_LIGHTSOURCE, B_TRUE, NA, NA, NULL);
@ -4486,7 +4489,7 @@ void initobjects(void) {
addot(OT_FIREPLACE, "fireplace", "A roaring fireplace.", MT_STONE, 200, OC_FURNITURE, SZ_LARGE);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_GLYPH, C_RED, NA, NA, "\\");
addflag(lastot->flags, F_PRODUCESLIGHT, 3, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 6, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_ONFIRE, B_TRUE, NA, NA, NULL);
@ -4601,7 +4604,7 @@ void initobjects(void) {
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_WALKDAM,DT_FIRE, NA, NA, "8d4");
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 3, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 10, NA, NA, NULL);
addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "!");
addot(OT_FIREMED, "medium fire", "A medium-sized roaring fire.", MT_FIRE, 0, OC_EFFECT, SZ_MEDIUM);
addflag(lastot->flags, F_GLYPH, C_RED, NA, NA, "{");
@ -4612,7 +4615,7 @@ void initobjects(void) {
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_WALKDAM, DT_FIRE, NA, NA, "4d4");
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 7, NA, NA, NULL);
addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "!");
addot(OT_FIRESMALL, "small fire", "A small blaze.", MT_FIRE, 0, OC_EFFECT, SZ_SMALL);
addflag(lastot->flags, F_GLYPH, C_RED, NA, NA, "{");
@ -4622,7 +4625,7 @@ void initobjects(void) {
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_WALKDAM, DT_FIRE, NA, NA, "2d4");
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 1, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 5, NA, NA, NULL);
addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "!");
addot(OT_STEAMCLOUD, "cloud of steam", "A thick cloud of scalding steam.", MT_GAS, 0, OC_EFFECT, SZ_HUMAN);
@ -4756,7 +4759,7 @@ void initobjects(void) {
addflag(lastot->flags, F_BLOCKSLOF, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_NOOBDAMTEXT, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_OBDIETEXT, B_TRUE, NA, NA, "vanishes");
addflag(lastot->flags, F_PRODUCESLIGHT, 1, NA, NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
addot(OT_VINE, "entangling vine", "A living vine which grasps nearby creature", MT_SILK, 0.1, OC_EFFECT, SZ_HUMAN);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
@ -7983,7 +7986,7 @@ void initrace(void) {
addflag(lastrace->flags, F_CANWILL, OT_S_FIREDART, NA, NA, "pw:1;");
addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, B_APPENDYOU, "gestures");
addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 3, NA, NULL);
addflag(lastrace->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
addflag(lastrace->flags, F_PRODUCESLIGHT, 3, NA, NA, NULL);
addflag(lastrace->flags, F_DTIMMUNE, DT_FIRE, NA, NA, NULL);
addflag(lastrace->flags, F_NOISETEXT, N_WALK, 1, NA, "^crackling flames");
addflag(lastrace->flags, F_STARTSKILL, SK_SS_FIRE, PR_BEGINNER, NA, NULL);
@ -9641,7 +9644,7 @@ void initrace(void) {
addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, NA, "pulses");
addflag(lastrace->flags, F_NOPACK, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_PRODUCESLIGHT, 2, NA, NA, NULL);
addflag(lastrace->flags, F_PRODUCESLIGHT, 3, NA, NA, NULL);
addflag(lastrace->flags, F_DTVULN, DT_POISONGAS, NA, NA, NULL);
addflag(lastrace->flags, F_NOISETEXT, N_FLY, 1, NA, "^buzzing");
addflag(lastrace->flags, F_DEAF, B_TRUE, NA, NA, NULL);

Binary file not shown.

5
defs.h
View File

@ -24,7 +24,7 @@
#define DEF_RAGETIME 10
#define DEF_SHOPIDENTPRICE (50) // cost to identify a just-purchased item
#define DEF_VAULTMARGIN (3)
#define DEF_VISRANGE (7)
#define DEF_VISRANGE (9)
// Map building defaults
@ -132,7 +132,7 @@
#define MAXRETCELLS 80
#define MAXSPELLLEV 6
#define MAXVISRANGE 10 // max visible range in full light
#define MAXVISLIMIT (MAXVISRANGE*8)
#define MAXVISLIMIT (MAXVISRANGE*20)
#define MAX_EYEADJ 20
#define MINCLEARINGRADIUS 2
@ -423,6 +423,7 @@ enum QUADRANT {
enum SAYPHRASE {
SP_ALLY_ATTACK,
SP_ALLY_ATTACKUNSEEN,
SP_ALLY_DIE,
SP_ALLY_INPAIN,
SP_ALLY_TARGETKILL,
SP_BEG,

103
lf.c
View File

@ -704,39 +704,42 @@ int caneat(lifeform_t *lf, object_t *o) {
return B_FALSE;
}
// ai won't eat bad food
if (!isplayer(lf) && isrotting(o)) {
reason = E_WONT;
return B_FALSE;
}
if ((o->type->id == OT_CORPSE) || (o->type->id == OT_HEAD)) {
flag_t *f;
f = hasflag(o->flags, F_CORPSEOF);
if (f) {
race_t *r;
r = findrace(f->val[0]);
// same race?
if ((r->id == lf->race->id) || (r->baseid == lf->race->baseid)) {
enum RACECLASS rc;
rc = getraceclass(lf);
// race which doens't eat its own?
if ((rc == RC_ANIMAL) || (rc == RC_HUMANOID)) {
// no cannibulism!
reason = E_NOCANNIBUL;
return B_FALSE;
// ring of hunger overrides most eating checks
if (!hasequippedobid(lf->pack, OT_RING_HUNGER)) {
// ai won't eat bad food
if (!isplayer(lf) && isrotting(o)) {
reason = E_WONT;
return B_FALSE;
}
if ((o->type->id == OT_CORPSE) || (o->type->id == OT_HEAD)) {
flag_t *f;
f = hasflag(o->flags, F_CORPSEOF);
if (f) {
race_t *r;
r = findrace(f->val[0]);
// same race?
if ((r->id == lf->race->id) || (r->baseid == lf->race->baseid)) {
enum RACECLASS rc;
rc = getraceclass(lf);
// race which doens't eat its own?
if ((rc == RC_ANIMAL) || (rc == RC_HUMANOID)) {
// no cannibulism!
reason = E_NOCANNIBUL;
return B_FALSE;
}
}
}
}
}
if (lfhasflag(lf, F_VEGETARIAN) && hasflag(o->flags, F_ISMEAT)) {
reason = E_VEGETARIAN;
return B_FALSE;
}
if (lfhasflag(lf, F_CARNIVORE) && !hasflag(o->flags, F_ISMEAT)) {
reason = E_CARNIVORE;
return B_FALSE;
}
if (lfhasflag(lf, F_VEGETARIAN) && hasflag(o->flags, F_ISMEAT)) {
reason = E_VEGETARIAN;
return B_FALSE;
}
if (lfhasflag(lf, F_CARNIVORE) && !hasflag(o->flags, F_ISMEAT)) {
reason = E_CARNIVORE;
return B_FALSE;
}
}
if (lfhasflag(lf, F_PARTVEGETARIAN) && hasflag(o->flags, F_ISMEAT)) {
if (gethungerlevel(gethungerval(player)) < H_PECKISH) {
@ -1528,7 +1531,7 @@ int castspell(lifeform_t *lf, enum OBTYPE sid, lifeform_t *targlf, object_t *tar
}
if (needtovalidate) {
if (!validatespellcell(lf, &targcell,targettype, sid, power, B_FALSE)) {
if (!validatespellcell(lf, &targcell,targettype, sid, power, fromob ? B_TRUE : B_FALSE)) {
if (isplayer(lf)) msg("Cancelled.");
return B_TRUE;
}
@ -2306,6 +2309,19 @@ void die(lifeform_t *lf) {
}
}
// announce pet death
if (ispetof(lf, player)) {
if (cantalk(lf) && canhear(player, lf->cell, 4)) {
sayphrase(lf, SP_ALLY_DIE, SV_SHOUT, NA, NULL);
} else if (cantalk(lf)) {
warn("You feel a profound sense of loss.");
//} else {
// makenoise(lf, N_DIE);
}
}
if (ispetof(lf, player)) {
more();
}
// drop/kill all objects
if (willbecomeghost || !isplayer(lf)) {
@ -13317,6 +13333,7 @@ int say(lifeform_t *lf, char *text, int volume) {
int sayphrase(lifeform_t *lf, enum SAYPHRASE what, int volume, int val0, char *text) {
int i,rv = B_FALSE;
char buf[BUFLEN];
char buf2[BUFLEN];
char *p;
switch (what) {
case SP_ALLY_ATTACK:
@ -13340,6 +13357,17 @@ int sayphrase(lifeform_t *lf, enum SAYPHRASE what, int volume, int val0, char *t
free(p);
rv = say(lf, buf, volume);
break;
case SP_ALLY_DIE:
switch (rnd(1,3)) {
case 1:
getplayername(buf2);
snprintf(buf, BUFLEN, "Avenge me, %s!", buf2);
break;
case 2: snprintf(buf, BUFLEN, "Argh!"); break;
case 3: snprintf(buf, BUFLEN, "Nooooo!"); break;
}
rv = say(lf, buf, volume);
break;
case SP_ALLY_INPAIN:
switch (rnd(1,3)) {
case 1: snprintf(buf, BUFLEN, "I'm hurting here!"); break;
@ -13592,6 +13620,7 @@ void setbodytype(race_t *r, enum BODYTYPE bt) {
switch (bt) {
case BT_BIRD:
addbodypart(r, BP_EYES, NULL);
addbodypart(r, BP_EARS, NULL);
addbodypart(r, BP_HEAD, NULL);
addbodypart(r, BP_BODY, NULL);
addbodypart(r, BP_LEGS, NULL);
@ -13605,6 +13634,7 @@ void setbodytype(race_t *r, enum BODYTYPE bt) {
break;
case BT_QUADRAPED:
addbodypart(r, BP_EYES, NULL);
addbodypart(r, BP_EARS, NULL);
addbodypart(r, BP_HEAD, NULL);
addbodypart(r, BP_BODY, NULL);
addbodypart(r, BP_BACKLEGS, "back legs");
@ -14847,6 +14877,7 @@ void startlfturn(lifeform_t *lf) {
addtempflag(lf->flags, F_RAGE, B_TRUE, NA, NA, NULL, DEF_RAGETIME/2);
if (getstamina(lf) < 1) setstamina(lf, 1);
forceredraw();
if (isplayer(lf)) more();
}
}
}
@ -16376,8 +16407,16 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) {
newmap = newcell->map;
} else {
if (isportal) {
// unconnected portal
if (isplayer(lf)) msg("This portal doesn't seem to go anywhere.");
// unconnected portal - make a destination.
if (curmap->depth < MAXDEPTH) {
newdepth = rnd(curmap->depth, curmap->depth + 5);
limit(&newdepth, curmap->depth, MAXDEPTH);
linkportal(o, newdepth);
newcell = getstairdestination(o, &madenewmap);
}
if (!newcell) {
if (isplayer(lf)) msg("This portal doesn't seem to go anywhere.");
}
}
}

28
map.c
View File

@ -5239,6 +5239,34 @@ int linkholes(map_t *map) {
return nlinked;
}
object_t *linkportal(object_t *srcportal, int wantdepth) {
cell_t *srcloc,*newcell;
map_t *newmap = NULL;
object_t *dstportal = NULL;
srcloc = getoblocation(srcportal);
newmap = findregionmap(srcloc->map->region->id, wantdepth);
if (!newmap) {
// create new map
newmap = addmap();
createmap(newmap, wantdepth, srcloc->map->region, NULL, D_NONE, NULL);
}
// find a random cell there
newcell = getrandomcell(newmap);
while (!cellwalkable(NULL, newcell, NULL) || hasenterableobject(newcell)) {
newcell = getrandomcell(newmap);
}
// add the dst portal
dstportal = addob(newcell->obpile, "magic portal");
// link the dst portal
addflag_real(dstportal->flags, F_MAPLINK, srcloc->map->id, srcloc->x, srcloc->y, NULL, PERMENANT, B_FALSE, -1);
// link the source portal
addflag_real(srcportal->flags, F_MAPLINK, newmap->id, newcell->x, newcell->y, NULL, PERMENANT, B_FALSE, -1);
return dstportal;
}
// link the staircase 'o' to a free one in adjacent maps.
// o2 is options. if not probided, we will try to find
// something to link to ourself.

1
map.h
View File

@ -123,6 +123,7 @@ void killfakes(map_t *map, cell_t *cell);
int linkexit(cell_t *c, int wantfilled, int *ncellsadded);
int linkexits(map_t *m, int roomid);
int linkholes(map_t *map);
object_t *linkportal(object_t *srcportal, int wantdepth);
int linkstairs(object_t *o, object_t *o2);
void makedoor(cell_t *cell, int openchance);
void makelit(cell_t *c, enum LIGHTLEV how, int howlong);

View File

@ -5779,6 +5779,14 @@ int hasedibleob(obpile_t *op) {
return B_FALSE;
}
object_t *hasequippedobid(obpile_t *op, enum OBTYPE oid) {
object_t *o;
for (o = op->first ; o ; o = o->next) {
if ((o->type->id == oid) && isequipped(o)) return o;
}
return NULL;
}
object_t *hasknownob(obpile_t *op, enum OBTYPE oid) {
object_t *o;
for (o = op->first ; o ; o = o->next) {
@ -9349,6 +9357,13 @@ int readsomething(lifeform_t *lf, object_t *o) {
}
return B_TRUE;
}
if (lfhasflag(lf, F_RAGE)) {
if (isplayer(lf)) {
msg("You are too enraged to read anything!");
}
return B_TRUE;
}
getobname(o, obname, 1);
@ -9518,7 +9533,14 @@ int readsomething(lifeform_t *lf, object_t *o) {
}
if (!noeffect) {
castspell(lf, f->val[0], NULL, targob, NULL, o, &seen);
cell_t *targcell = NULL;
lifeform_t *targlf = NULL;
// cursed scrolls target yourself
if (iscursed(o)) {
targcell = lf->cell;
targlf = lf;
}
castspell(lf, f->val[0], targlf, targob, targcell, o, &seen);
/*
dospelleffects(lf, f->val[0], power, NULL, targob, NULL, o->blessed, &seen, B_FALSE);

View File

@ -145,6 +145,7 @@ int getthrowdam(object_t *o);
char *gettopobname(cell_t *c, char *retbuf);
enum BODYPART getweildloc(object_t *o, enum BODYPART *otherloc, int *twohanded);
int hasedibleob(obpile_t *op);
object_t *hasequippedobid(obpile_t *op, enum OBTYPE oid);
object_t *hasknownob(obpile_t *op, enum OBTYPE oid);
object_t *hasob(obpile_t *op, enum OBTYPE oid);
object_t *hasobletter(obpile_t *op, char letter);

29
spell.c
View File

@ -6731,8 +6731,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if ((newdepth < min) || (newdepth > max)) {
fizzle(caster);
} else {
map_t *newmap;
cell_t *newcell,*srccell;
cell_t *srccell;
object_t *srcportal,*dstportal;
// find adjacent cell for portal
@ -6742,7 +6741,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
return B_FALSE;
}
// create the source portal
srcportal = addob(srccell->obpile, "magic portal");
srcportal = addobfast(srccell->obpile, OT_PORTAL);
setobcreatedby(srcportal, caster);
// announce, because we might have a delay creating the level...
@ -6751,30 +6750,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
wrefresh(msgwin);
}
// find new map !
dstportal = linkportal(srcportal, newdepth);
setobcreatedby(dstportal, caster);
//newmap = findmapofdepth(newdepth);
newmap = findregionmap(caster->cell->map->region->id, newdepth);
if (!newmap) {
// create new map
newmap = addmap();
createmap(newmap, newdepth, caster->cell->map->region, NULL, D_NONE, NULL);
}
// find a random cell there
newcell = getrandomcell(newmap);
while (!cellwalkable(caster, newcell, NULL) || hasenterableobject(newcell)) {
newcell = getrandomcell(newmap);
}
// add the dst portal
dstportal = addob(newcell->obpile, "magic portal");
setobcreatedby(dstportal, caster);
// link the dst portal
addflag_real(dstportal->flags, F_MAPLINK, caster->cell->map->id, srccell->x, srccell->y, NULL, PERMENANT, B_FALSE, -1);
// link the source portal
addflag_real(srcportal->flags, F_MAPLINK, newmap->id, newcell->x, newcell->y, NULL, PERMENANT, B_FALSE, -1);
// make both gates temporary
addflag(srcportal->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(srcportal->flags, F_OBHP, 6, 6, NA, NULL);