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_FRIENDLY, // lf will attack all non-players if in sight
|
||||
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.
|
||||
// if val1 = B_COVETS, will even abandon attacks
|
||||
// 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?
|
||||
stamcost = getstamcost(lf, oid);
|
||||
if (stamcost && (getstamina(lf) < stamcost) && !lfhasflag(lf, F_NOSTAM)) {
|
||||
reason = E_NOSTAM;
|
||||
return B_FALSE;
|
||||
// exception: you can always stop flying
|
||||
if ((oid == OT_A_FLY) && isflyingwithwings(lf)) {
|
||||
// ok
|
||||
} else {
|
||||
reason = E_NOSTAM;
|
||||
return B_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
int isflyingwithwings(lifeform_t *lf) {
|
||||
flag_t *isflyingwithwings(lifeform_t *lf) {
|
||||
flag_t *retflag[MAXCANDIDATES];
|
||||
int nretflags,i;
|
||||
getflags(lf->flags, retflag, &nretflags, F_FLYING, F_NONE);
|
||||
for (i = 0; i < nretflags; i++) {
|
||||
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) {
|
||||
|
@ -19053,7 +19058,12 @@ void modstamina(lifeform_t *lf, float howmuch) {
|
|||
}
|
||||
|
||||
if (getstamina(lf) == 0) {
|
||||
flag_t *f;
|
||||
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 rv;
|
||||
flag_t *cwflag;
|
||||
float stamcost = 0;
|
||||
if (!cancast(lf, aid, NULL)) {
|
||||
if (isplayer(lf)) {
|
||||
// announce
|
||||
|
@ -26109,6 +26118,8 @@ int useability(lifeform_t *lf, enum OBTYPE aid, lifeform_t *who, cell_t *where)
|
|||
return B_TRUE;
|
||||
}
|
||||
|
||||
/* Duplicate check.
|
||||
|
||||
stamcost = getstamcost(lf, aid);
|
||||
if (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;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (aid != OT_A_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);
|
||||
flag_t *isfleeing(lifeform_t *lf);
|
||||
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 isfriendly(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;
|
||||
killallobs(target->pack);
|
||||
} else if (abilid == OT_A_FLY) {
|
||||
flag_t *retflag[MAXCANDIDATES],*f;
|
||||
int nretflags,i;
|
||||
flag_t *f;
|
||||
|
||||
// already flying? stop.
|
||||
getflags(user->flags, retflag, &nretflags, F_FLYING, F_NONE);
|
||||
for (i = 0; i < nretflags; i++) {
|
||||
f = retflag[i];
|
||||
if (f->lifetime == FROMABIL) {
|
||||
killflag(f);
|
||||
taketime(user, getactspeed(user));
|
||||
return B_FALSE;
|
||||
}
|
||||
f = isflyingwithwings(user);
|
||||
if (f) {
|
||||
killflag(f);
|
||||
taketime(user, getactspeed(user));
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
if (isimmobile(user)) {
|
||||
|
|
Loading…
Reference in New Issue