Reduce weapon stamina cost based on proficiency.
add assertion to catch when too many skill abilities/descriptions are added fix duplicate description on some weapon skills
This commit is contained in:
parent
072cc96e4f
commit
4f3375c58b
7
attack.c
7
attack.c
|
@ -834,11 +834,12 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
|||
}
|
||||
if (dostamloss) {
|
||||
object_t *priwep;
|
||||
float loss;
|
||||
priwep = getweapon(lf);
|
||||
// lose a bit of stamina
|
||||
modstamina(lf, -getattackstamloss(priwep));
|
||||
loss = getattackstamlosslf(lf, priwep);
|
||||
// lose a bit of stamina
|
||||
modstamina(lf, -loss);
|
||||
}
|
||||
//}
|
||||
|
||||
// stop sprinting
|
||||
stopsprinting(lf);
|
||||
|
|
3
data.c
3
data.c
|
@ -21201,7 +21201,7 @@ void initskills(void) {
|
|||
|
||||
if (isweaponskill(sk->id) || (sk->id == SK_UNARMED)) {
|
||||
addskilldesc(sk->id, PR_INEPT, "This skill increases your accuracy and damage when using matching weapons.", B_FALSE);
|
||||
if (sk->id == SK_CLUBS) addskilldesc(sk->id, PR_NOVICE, "^gYou gain the 'merciful fighting' ability.^n", B_FALSE);
|
||||
addskilldesc(sk->id, PR_INEPT, "Each skill level also decreases stamina usage of matching weapons by 10%.", B_FALSE);
|
||||
addskilldesc(sk->id, PR_NOVICE, "^gYou can now recognise the quality of matching weapons.^n", B_FALSE);
|
||||
addskilldesc(sk->id, PR_NOVICE, "^gEliminates accuracy penalties with matching weapons.^n", B_FALSE);
|
||||
addskilldesc(sk->id, PR_BEGINNER, "^g+1 accuracy.^n", B_FALSE);
|
||||
|
@ -21220,7 +21220,6 @@ void initskills(void) {
|
|||
addskilldesc(sk->id, PR_SKILLED, "^gYou can now block certain attacks with this kind of weapon.^n", B_FALSE);
|
||||
}
|
||||
addskilldesc(sk->id, PR_EXPERT, "^g+4 accuracy, +30% damage bonus.^n", B_FALSE);
|
||||
if (sk->id == SK_UNARMED) addskilldesc(sk->id, PR_EXPERT, "^gYou gain the 'flip' ability.^n", B_FALSE);
|
||||
addskilldesc(sk->id, PR_MASTER, "^g+6 accuracy, +40%% damage bonus, combination strike ability.^n", B_FALSE);
|
||||
|
||||
if (sk->id != SK_UNARMED) {
|
||||
|
|
7
defs.h
7
defs.h
|
@ -975,6 +975,7 @@ enum SKILLLEVEL {
|
|||
PR_MASTER = 6,
|
||||
};
|
||||
#define MAXSKILLLEVEL 7
|
||||
#define MAXSKILLDESC (MAXSKILLLEVEL*3)
|
||||
#define MAXSKILLWILLS (MAXSKILLLEVEL*5)
|
||||
|
||||
|
||||
|
@ -5371,9 +5372,9 @@ typedef struct skill_s {
|
|||
char *name;
|
||||
char *shortname;
|
||||
char *desc;
|
||||
enum SKILLLEVEL skilldesclev[MAXSKILLLEVEL*2];
|
||||
char *skilldesctext[MAXSKILLLEVEL*2];
|
||||
int skilldescmsg[MAXSKILLLEVEL*2];
|
||||
enum SKILLLEVEL skilldesclev[MAXSKILLDESC];
|
||||
char *skilldesctext[MAXSKILLDESC];
|
||||
int skilldescmsg[MAXSKILLDESC];
|
||||
int nskilldesc;
|
||||
|
||||
struct skillwill_s {
|
||||
|
|
10
io.c
10
io.c
|
@ -6700,12 +6700,12 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
}
|
||||
}
|
||||
|
||||
stamcost = getattackstamloss(o);
|
||||
snprintf(buf2, BUFLEN, ", and Stamina cost is %0.2f",stamcost);
|
||||
stamcost = getattackstamlosslf(player, o);
|
||||
snprintf(buf2, BUFLEN, ", and Stamina cost for you is %0.2f",stamcost);
|
||||
strcat(buf, buf2);
|
||||
if (compareob) {
|
||||
float cstamcost,diff;
|
||||
cstamcost = getattackstamloss(compareob);
|
||||
cstamcost = getattackstamlosslf(player, compareob);
|
||||
diff = stamcost - cstamcost;
|
||||
if (diff == 0) {
|
||||
strcat(buf, " (=)");
|
||||
|
@ -7811,9 +7811,11 @@ char *makedesc_ob(object_t *o, char *retbuf) {
|
|||
sprintf(buf, " - %s", contentname);
|
||||
if ((o->type->id == OT_SPELLBOOK) || (o->type->id == OT_GRIMOIRE)) {
|
||||
char lbuf[BUFLEN];
|
||||
char kbuf[BUFLEN];
|
||||
sprintf(kbuf, " ^%d[known]^n", C_GREEN);
|
||||
sprintf(lbuf, " (Lv %d %s)%s", getspelllevel(oo->type->id), getschoolname(getspellschool(oo->type->id)),
|
||||
lfhasflagval(player, F_CANCAST, oo->type->id, NA, NA, NULL) ?
|
||||
" [known]" : "");
|
||||
kbuf : "");
|
||||
strcat(buf, lbuf);
|
||||
}
|
||||
strcat(buf, "\n");
|
||||
|
|
23
lf.c
23
lf.c
|
@ -8014,6 +8014,25 @@ int getattackspeed(lifeform_t *lf) {
|
|||
return (int)speed;
|
||||
}
|
||||
|
||||
float getattackstamlosslf(lifeform_t *lf, object_t *wep) {
|
||||
float loss;
|
||||
loss = getattackstamloss(wep); // base loss
|
||||
if (wep && loss > 0) {
|
||||
flag_t *f;
|
||||
// modify based on proficiency
|
||||
f = hasflag(wep->flags, F_USESSKILL);
|
||||
if (f && (f->val[0] != SK_NONE)) {
|
||||
enum SKILLLEVEL slev;
|
||||
slev = getskill(lf, f->val[0]);
|
||||
if (slev >= PR_NOVICE) {
|
||||
loss *= ((float)slev/10);
|
||||
limitf(&loss, 0, NA);
|
||||
}
|
||||
}
|
||||
}
|
||||
return loss;
|
||||
}
|
||||
|
||||
float getattackstamloss(object_t *wep) {
|
||||
float loss;
|
||||
loss = STAMTOATTACK;
|
||||
|
@ -16020,6 +16039,7 @@ void addskillabil(enum SKILL id, enum SKILLLEVEL lev, enum OBTYPE abilid, int ti
|
|||
skill_t *sk;
|
||||
sk = findskill(id);
|
||||
assert(sk);
|
||||
assert(sk->nskillwills < MAXSKILLWILLS);
|
||||
|
||||
if (announce) {
|
||||
objecttype_t *ot;
|
||||
|
@ -16039,8 +16059,6 @@ void addskillabil(enum SKILL id, enum SKILLLEVEL lev, enum OBTYPE abilid, int ti
|
|||
sk->skillwill[sk->nskillwills].text = NULL;
|
||||
}
|
||||
sk->nskillwills++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// rid is optional, can be R_NONE
|
||||
|
@ -16238,6 +16256,7 @@ void addskilldesc(enum SKILL id, enum SKILLLEVEL lev, char *text, int wantmsg) {
|
|||
skill_t *sk;
|
||||
sk = findskill(id);
|
||||
assert(sk);
|
||||
assert(sk->nskilldesc < MAXSKILLDESC);
|
||||
sk->skilldesclev[sk->nskilldesc] = lev;
|
||||
sk->skilldesctext[sk->nskilldesc] = strdup(text);
|
||||
sk->skilldescmsg[sk->nskilldesc] = wantmsg;
|
||||
|
|
1
lf.h
1
lf.h
|
@ -170,6 +170,7 @@ 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(object_t *wep);
|
||||
float getattackstamlosslf(lifeform_t *lf, 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