If you run out of stamina while flying, immediately stop flying.
Don't require stamina to stop flying.
This commit is contained in:
parent
95e36275d3
commit
0bc557f2f5
2
defs.h
2
defs.h
|
@ -3893,7 +3893,7 @@ enum FLAG {
|
||||||
F_HOSTILE, // lf will attack the player if in sight
|
F_HOSTILE, // lf will attack the player if in sight
|
||||||
F_FRIENDLY, // lf will attack all non-players if in sight
|
F_FRIENDLY, // lf will attack all non-players if in sight
|
||||||
F_FATALFOOD, // if lf eats food with id = v0, they die.
|
F_FATALFOOD, // if lf eats food with id = v0, they die.
|
||||||
F_NATURALFLIGHT, // lf can fly natural using wings or similar
|
F_NATURALFLIGHT, // lf can fly naturally using wings or similar
|
||||||
F_WANTS, // lf will try to pick up object type val0.
|
F_WANTS, // lf will try to pick up object type val0.
|
||||||
// if val1 = B_COVETS, will even abandon attacks
|
// if val1 = B_COVETS, will even abandon attacks
|
||||||
// for it!
|
// for it!
|
||||||
|
|
24
lf.c
24
lf.c
|
@ -849,8 +849,13 @@ int cancast(lifeform_t *lf, enum OBTYPE oid, int *mpcost) {
|
||||||
// do we have enough stamina to do this?
|
// do we have enough stamina to do this?
|
||||||
stamcost = getstamcost(lf, oid);
|
stamcost = getstamcost(lf, oid);
|
||||||
if (stamcost && (getstamina(lf) < stamcost) && !lfhasflag(lf, F_NOSTAM)) {
|
if (stamcost && (getstamina(lf) < stamcost) && !lfhasflag(lf, F_NOSTAM)) {
|
||||||
reason = E_NOSTAM;
|
// exception: you can always stop flying
|
||||||
return B_FALSE;
|
if ((oid == OT_A_FLY) && isflyingwithwings(lf)) {
|
||||||
|
// ok
|
||||||
|
} else {
|
||||||
|
reason = E_NOSTAM;
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return castable;
|
return castable;
|
||||||
|
@ -14969,16 +14974,16 @@ flag_t *isfleeingfrom(lifeform_t *lf, lifeform_t *runfrom) {
|
||||||
return lfhasflagval(lf, F_FLEEFROM, runfrom->id, NA, NA, NULL);
|
return lfhasflagval(lf, F_FLEEFROM, runfrom->id, NA, NA, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int isflyingwithwings(lifeform_t *lf) {
|
flag_t *isflyingwithwings(lifeform_t *lf) {
|
||||||
flag_t *retflag[MAXCANDIDATES];
|
flag_t *retflag[MAXCANDIDATES];
|
||||||
int nretflags,i;
|
int nretflags,i;
|
||||||
getflags(lf->flags, retflag, &nretflags, F_FLYING, F_NONE);
|
getflags(lf->flags, retflag, &nretflags, F_FLYING, F_NONE);
|
||||||
for (i = 0; i < nretflags; i++) {
|
for (i = 0; i < nretflags; i++) {
|
||||||
if (retflag[i]->lifetime == FROMABIL) {
|
if (retflag[i]->lifetime == FROMABIL) {
|
||||||
return B_TRUE;
|
return retflag[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return B_FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isfreebp(lifeform_t *lf, enum BODYPART bp, object_t *whatfor) {
|
int isfreebp(lifeform_t *lf, enum BODYPART bp, object_t *whatfor) {
|
||||||
|
@ -19053,7 +19058,12 @@ void modstamina(lifeform_t *lf, float howmuch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getstamina(lf) == 0) {
|
if (getstamina(lf) == 0) {
|
||||||
|
flag_t *f;
|
||||||
stopsprinting(lf);
|
stopsprinting(lf);
|
||||||
|
f = isflyingwithwings(lf);
|
||||||
|
if (f) {
|
||||||
|
killflag(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26081,7 +26091,6 @@ int unweild(lifeform_t *lf, object_t *o) {
|
||||||
int useability(lifeform_t *lf, enum OBTYPE aid, lifeform_t *who, cell_t *where) {
|
int useability(lifeform_t *lf, enum OBTYPE aid, lifeform_t *who, cell_t *where) {
|
||||||
int rv;
|
int rv;
|
||||||
flag_t *cwflag;
|
flag_t *cwflag;
|
||||||
float stamcost = 0;
|
|
||||||
if (!cancast(lf, aid, NULL)) {
|
if (!cancast(lf, aid, NULL)) {
|
||||||
if (isplayer(lf)) {
|
if (isplayer(lf)) {
|
||||||
// announce
|
// announce
|
||||||
|
@ -26109,6 +26118,8 @@ int useability(lifeform_t *lf, enum OBTYPE aid, lifeform_t *who, cell_t *where)
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Duplicate check.
|
||||||
|
|
||||||
stamcost = getstamcost(lf, aid);
|
stamcost = getstamcost(lf, aid);
|
||||||
if (stamcost) {
|
if (stamcost) {
|
||||||
if (getstamina(lf) < stamcost) {
|
if (getstamina(lf) < stamcost) {
|
||||||
|
@ -26118,6 +26129,7 @@ int useability(lifeform_t *lf, enum OBTYPE aid, lifeform_t *who, cell_t *where)
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (aid != OT_A_FULLSHIELD) {
|
if (aid != OT_A_FULLSHIELD) {
|
||||||
killflagsofid(lf->flags, F_FULLSHIELD);
|
killflagsofid(lf->flags, F_FULLSHIELD);
|
||||||
|
|
2
lf.h
2
lf.h
|
@ -379,7 +379,7 @@ int isdeaf(lifeform_t *lf);
|
||||||
object_t *isdualweilding(lifeform_t *lf);
|
object_t *isdualweilding(lifeform_t *lf);
|
||||||
flag_t *isfleeing(lifeform_t *lf);
|
flag_t *isfleeing(lifeform_t *lf);
|
||||||
flag_t *isfleeingfrom(lifeform_t *lf, lifeform_t *runfrom);
|
flag_t *isfleeingfrom(lifeform_t *lf, lifeform_t *runfrom);
|
||||||
int isflyingwithwings(lifeform_t *lf);
|
flag_t *isflyingwithwings(lifeform_t *lf);
|
||||||
int isfreebp(lifeform_t *lf, enum BODYPART bp, object_t *whatfor);
|
int isfreebp(lifeform_t *lf, enum BODYPART bp, object_t *whatfor);
|
||||||
int isfriendly(lifeform_t *lf);
|
int isfriendly(lifeform_t *lf);
|
||||||
int isfullyhealed(lifeform_t *lf);
|
int isfullyhealed(lifeform_t *lf);
|
||||||
|
|
16
spell.c
16
spell.c
|
@ -1370,18 +1370,14 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
||||||
target->hp = 0;
|
target->hp = 0;
|
||||||
killallobs(target->pack);
|
killallobs(target->pack);
|
||||||
} else if (abilid == OT_A_FLY) {
|
} else if (abilid == OT_A_FLY) {
|
||||||
flag_t *retflag[MAXCANDIDATES],*f;
|
flag_t *f;
|
||||||
int nretflags,i;
|
|
||||||
|
|
||||||
// already flying? stop.
|
// already flying? stop.
|
||||||
getflags(user->flags, retflag, &nretflags, F_FLYING, F_NONE);
|
f = isflyingwithwings(user);
|
||||||
for (i = 0; i < nretflags; i++) {
|
if (f) {
|
||||||
f = retflag[i];
|
killflag(f);
|
||||||
if (f->lifetime == FROMABIL) {
|
taketime(user, getactspeed(user));
|
||||||
killflag(f);
|
return B_FALSE;
|
||||||
taketime(user, getactspeed(user));
|
|
||||||
return B_FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isimmobile(user)) {
|
if (isimmobile(user)) {
|
||||||
|
|
Loading…
Reference in New Issue