If revived while stuck inside a solid wall, move elsewhere.
This commit is contained in:
parent
b7627de8cb
commit
60e28b6c03
43
lf.c
43
lf.c
|
@ -3311,7 +3311,9 @@ int demandbribe(lifeform_t *lf) {
|
|||
return satisfied;
|
||||
}
|
||||
|
||||
void die(lifeform_t *lf) {
|
||||
|
||||
// return B_TRUE if the lf is still alive (saved by ring of miracles, etc)
|
||||
int die(lifeform_t *lf) {
|
||||
char buf[BUFLEN];
|
||||
flag_t *f;
|
||||
int killedgod = B_FALSE;
|
||||
|
@ -3398,7 +3400,7 @@ void die(lifeform_t *lf) {
|
|||
// teleport away!
|
||||
dospelleffects(NULL, OT_S_DISPERSAL, 10, lf, NULL, lf->cell, B_UNCURSED, NULL, B_FALSE, NULL);
|
||||
}
|
||||
return;
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
if (useringofmiracles(lf, 3)) {
|
||||
|
@ -3419,7 +3421,7 @@ void die(lifeform_t *lf) {
|
|||
if (thisisplayer) {
|
||||
statdirty = B_TRUE;
|
||||
}
|
||||
return;
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
// a god died?
|
||||
|
@ -3446,7 +3448,7 @@ void die(lifeform_t *lf) {
|
|||
if (ch == 'n') {
|
||||
lf->hp = lf->maxhp;
|
||||
msg("Not dying.");
|
||||
return;
|
||||
return B_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3523,7 +3525,7 @@ void die(lifeform_t *lf) {
|
|||
//killflagsofid(lf->flags, F_HOSTILE);
|
||||
addflag(lf->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
|
||||
}
|
||||
return;
|
||||
return B_TRUE;
|
||||
}
|
||||
}
|
||||
if (lf->race->id == R_LICH) {
|
||||
|
@ -3541,7 +3543,7 @@ void die(lifeform_t *lf) {
|
|||
// restore all hp
|
||||
lf->hp = lf->maxhp;
|
||||
killflagsofid(lf->flags, F_DEAD);
|
||||
return;
|
||||
return B_TRUE;
|
||||
}
|
||||
} else {
|
||||
noise(lf->cell, lf, NC_OTHER, SV_CAR, "a horrified scream!", "screams in horror!");
|
||||
|
@ -3573,7 +3575,7 @@ void die(lifeform_t *lf) {
|
|||
// ... but you're still dead
|
||||
lf->hp = 0;
|
||||
*/
|
||||
return;
|
||||
return B_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3707,7 +3709,7 @@ void die(lifeform_t *lf) {
|
|||
dospelleffects(god, OT_S_TELEPORT, 3, lf, NULL, NULL, B_UNCURSED, NULL, B_TRUE, NULL);
|
||||
// drop piety level.
|
||||
setpiety(R_GODMERCY, getpietycutoff(PL_INDIFFERENT));
|
||||
return;
|
||||
return B_TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -4352,6 +4354,8 @@ void die(lifeform_t *lf) {
|
|||
if (killedgod) {
|
||||
wingame();
|
||||
}
|
||||
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
void dumplf(void) {
|
||||
|
@ -15583,6 +15587,16 @@ object_t *isstuck(lifeform_t *lf) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int isstuckinwall(lifeform_t *lf) {
|
||||
enum ERROR error;
|
||||
if (!cellwalkable(lf, lf->cell, &error)) {
|
||||
if ((error == E_WALLINWAY) && !isclimbing(lf)) {
|
||||
return B_TRUE;
|
||||
}
|
||||
}
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
|
||||
poisontype_t *addpoisontype(enum POISONTYPE id, char *name, char *desc, char *contracttext, char *damverb, enum OBTYPE vomitob, int dam, int dampct, enum POISONSEVERITY severity, int incubationtime) {
|
||||
poisontype_t *a;
|
||||
|
@ -23307,7 +23321,6 @@ int statdrain(lifeform_t *lf, enum ATTRIB attr, int amt, enum CHECKTYPE sctype,
|
|||
void startlfturn(lifeform_t *lf) {
|
||||
int db = B_FALSE;
|
||||
map_t *map;
|
||||
enum ERROR error;
|
||||
object_t *o,*nexto;
|
||||
flag_t *f;
|
||||
flag_t *asp, *sf,*stasis = NULL;
|
||||
|
@ -23473,15 +23486,13 @@ void startlfturn(lifeform_t *lf) {
|
|||
// if player can se
|
||||
}
|
||||
|
||||
|
||||
// stuck inside solid cells?
|
||||
if (!cellwalkable(lf, lf->cell, &error)) {
|
||||
if ((error == E_WALLINWAY) && !isclimbing(lf)) {
|
||||
if (isplayer(lf)) {
|
||||
msg("^%cYou reintegrate inside a solid object!",getlfcol(lf, CC_VBAD));
|
||||
}
|
||||
losehp(lf, 9999, DT_DIRECT, NULL, "re-integration inside a solid object");
|
||||
//}
|
||||
if (isstuckinwall(lf)) {
|
||||
if (isplayer(lf)) {
|
||||
msg("^%cYou reintegrate inside a solid object!",getlfcol(lf, CC_VBAD));
|
||||
}
|
||||
losehp(lf, 9999, DT_DIRECT, NULL, "re-integration inside a solid object");
|
||||
}
|
||||
|
||||
|
||||
|
|
3
lf.h
3
lf.h
|
@ -101,7 +101,7 @@ int countnearbyhurtallies(lifeform_t *lf);
|
|||
int countplantsinsight(lifeform_t *lf);
|
||||
void debug(lifeform_t *lf);
|
||||
int demandbribe(lifeform_t *lf);
|
||||
void die(lifeform_t *lf);
|
||||
int die(lifeform_t *lf);
|
||||
int digcell(lifeform_t *lf, cell_t *c, object_t *o, int dismantle);
|
||||
int digdown(lifeform_t *lf, object_t *o);
|
||||
int digup(lifeform_t *lf, object_t *o);
|
||||
|
@ -413,6 +413,7 @@ flag_t *isresistantto(flagpile_t *fp, enum DAMTYPE dt, int onlytemp);
|
|||
flag_t *isresting(lifeform_t *lf);
|
||||
int issleepingtimefor(lifeform_t *lf);
|
||||
object_t *isstuck(lifeform_t *lf);
|
||||
int isstuckinwall(lifeform_t *lf);
|
||||
int issmellablelf(lifeform_t *lf);
|
||||
int isswimming(lifeform_t *lf);
|
||||
int isunconscious(lifeform_t *lf);
|
||||
|
|
4
map.c
4
map.c
|
@ -8345,7 +8345,6 @@ cell_t *real_getrandomadjcell(cell_t *c, condset_t *cs, int allowexpand, enum LO
|
|||
(getcelldist(c,new) == radius) &&
|
||||
(new != dontwantcell) && gotlof) {
|
||||
int ok = B_FALSE;
|
||||
numwithlof++;
|
||||
|
||||
ok = cellmeets(new, cs);
|
||||
|
||||
|
@ -8381,7 +8380,8 @@ cell_t *real_getrandomadjcell(cell_t *c, condset_t *cs, int allowexpand, enum LO
|
|||
// found any possibilities ?
|
||||
if (preferlos && nlosposs) {
|
||||
done = B_TRUE;
|
||||
} else if (!preferlos && nposs) {
|
||||
//} else if (!preferlos && nposs) {
|
||||
} else if (nposs) {
|
||||
done = B_TRUE;
|
||||
} else {
|
||||
if (allowexpand) {
|
||||
|
|
15
nexus.c
15
nexus.c
|
@ -857,8 +857,19 @@ void checkdeath(void) {
|
|||
if (hasactivespell(lf, OT_S_DELAYDEATH) && (lf->hp > -15)) {
|
||||
} else {
|
||||
// die!
|
||||
die(lf);
|
||||
continue;
|
||||
if (die(lf)) {
|
||||
// saved!
|
||||
if (isstuckinwall(lf)) {
|
||||
// move elsewhere
|
||||
cell_t *newcell;
|
||||
newcell = real_getrandomadjcell(lf->cell, &ccwalkable, B_ALLOWEXPAND, LOF_DONTNEED, NULL, lf);
|
||||
if (newcell) {
|
||||
movelf(lf, newcell, B_FALSE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue