Show stamina cost in weapon description.
This commit is contained in:
parent
0bc557f2f5
commit
5bcf36fdce
4
attack.c
4
attack.c
|
@ -834,8 +834,10 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
|||
dostamloss = B_FALSE;
|
||||
}
|
||||
if (dostamloss) {
|
||||
object_t *priwep;
|
||||
priwep = getweapon(lf);
|
||||
// lose a bit of stamina
|
||||
modstamina(lf, -getattackstamloss(lf));
|
||||
modstamina(lf, -getattackstamloss(priwep));
|
||||
}
|
||||
//}
|
||||
|
||||
|
|
21
io.c
21
io.c
|
@ -6421,6 +6421,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
strncat(retbuf, buf, HUGEBUFLEN);
|
||||
} else if (isweapon(o) && isknown(o)) {
|
||||
flag_t *damflag,*twohandf;
|
||||
float stamcost = STAMTOATTACK;
|
||||
int delay;
|
||||
int critchance;
|
||||
|
||||
|
@ -6587,7 +6588,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
strcat(buf, " (=)");
|
||||
} else {
|
||||
// higher crit chance is better
|
||||
snprintf(buf2, BUFLEN, " %s(%c%d)^n", (diff < 0) ? "^B" : "^g",
|
||||
snprintf(buf2, BUFLEN, " %s(%c%d%%)^n", (diff < 0) ? "^B" : "^g",
|
||||
(diff > 0) ? '+' : '-', abs(diff));
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
|
@ -6610,12 +6611,28 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
strcat(buf, " (=)");
|
||||
} else {
|
||||
// lower attack delay is better
|
||||
snprintf(buf2, BUFLEN, " %s(%c%d)^n", (diff > 0) ? "^B" : "^g",
|
||||
snprintf(buf2, BUFLEN, " %s(%c%d%%)^n", (diff > 0) ? "^B" : "^g",
|
||||
(diff > 0) ? '+' : '-', abs(diff));
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
}
|
||||
|
||||
stamcost = getattackstamloss(o);
|
||||
snprintf(buf2, BUFLEN, ", and Stamina cost is %0.1f",stamcost);
|
||||
strcat(buf, buf2);
|
||||
if (compareob) {
|
||||
float cstamcost,diff;
|
||||
cstamcost = getattackstamloss(compareob);
|
||||
diff = stamcost - cstamcost;
|
||||
if (diff == 0) {
|
||||
strcat(buf, " (=)");
|
||||
} else {
|
||||
// lower stamina loss is better
|
||||
snprintf(buf2, BUFLEN, " %s(%c%0.1f)^n", (diff > 0) ? "^B" : "^g",
|
||||
(diff > 0) ? '+' : '-', fabs(diff));
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
}
|
||||
strcat(buf, ".\n");
|
||||
strncat(retbuf, buf, HUGEBUFLEN);
|
||||
}
|
||||
|
|
8
lf.c
8
lf.c
|
@ -7800,15 +7800,13 @@ int getattackspeed(lifeform_t *lf) {
|
|||
return (int)speed;
|
||||
}
|
||||
|
||||
float getattackstamloss(lifeform_t *lf) {
|
||||
object_t *w;
|
||||
float getattackstamloss(object_t *wep) {
|
||||
float loss;
|
||||
loss = STAMTOATTACK;
|
||||
|
||||
w = getweapon(lf);
|
||||
if (w) {
|
||||
if (wep) {
|
||||
int pctmod;
|
||||
pctmod = getobattackdelay(w); // ie. 50 is fast, 100 is normal, 150 is slow, etc.
|
||||
pctmod = getobattackdelay(wep); // ie. 50 is fast, 100 is normal, 150 is slow, etc.
|
||||
pctmod -= 100; // ie. -50 is fast, 0 is normal, 50 is slow
|
||||
|
||||
// ie. normal attack stamina cost, plus twice the weapon's "attack delay"
|
||||
|
|
3
lf.h
3
lf.h
|
@ -168,8 +168,7 @@ int getarmourevpenalty(lifeform_t *lf);
|
|||
int getarmournoise(lifeform_t *lf);
|
||||
int getarmourrating(lifeform_t *lf, object_t **hitob, int *hitchance, enum BODYPART *hitbp, int *narms);
|
||||
int getattackspeed(lifeform_t *lf);
|
||||
float getattackstamloss(lifeform_t *lf);
|
||||
float getattackstamloss(lifeform_t *lf);
|
||||
float getattackstamloss(object_t *wep);
|
||||
int getattpoints(lifeform_t *lf);
|
||||
int getattr(lifeform_t *lf, enum ATTRIB attr);
|
||||
enum ATTRBRACKET getattrbracket(int attrval, enum ATTRIB whichatt, /*@null@*/char *buf);
|
||||
|
|
Loading…
Reference in New Issue