Worsen penalties for not meeting weapon requirements

This commit is contained in:
Rob Pearce 2016-07-04 22:44:07 +10:00
parent 2b82e1de44
commit e4cdde4f98
1 changed files with 10 additions and 10 deletions

20
lf.c
View File

@ -18859,7 +18859,7 @@ int meetsattreq(lifeform_t *lf, flag_t *f, object_t *o, int *pctmod) {
int myval;
int neededdiff,bonusdiff;
int dopenaltycheck = B_TRUE, dobonuscheck = B_FALSE;
int scaleamt;
int scale_bonus = 0, scale_penalty = 15;
enum {
NONE=0,
PENALTY=1,
@ -18886,9 +18886,9 @@ int meetsattreq(lifeform_t *lf, flag_t *f, object_t *o, int *pctmod) {
}
if (strlen(f->text)) {
scaleamt = atoi(f->text);
scale_bonus = atoi(f->text);
} else {
scaleamt = 0;
scale_bonus = 0; // default
}
// modify for masterwork
@ -18914,15 +18914,15 @@ int meetsattreq(lifeform_t *lf, flag_t *f, object_t *o, int *pctmod) {
if (dobonuscheck) {
bonusdiff = myval - valbonus;
// for this one, just meeting it gives you once "scaleamt" worth of bonus
// for this one, just meeting it gives you once "scale_bonus" worth of bonus
if (bonusdiff >= 0) bonusdiff += 10;
limit(&bonusdiff,-20, 30);
}
if (dopenaltycheck && (neededdiff < 0)) {
// penalty?
// for firearms, armour or scaleamt == 0, you MUST meet the requirement.
if (scaleamt == 0) {
// for firearms, armour or scale_bonus == 0, you MUST meet the requirement.
if (scale_bonus == 0) {
neededdiff = -20;
} else if (o && isarmour(o)) {
neededdiff = -20;
@ -18940,12 +18940,12 @@ int meetsattreq(lifeform_t *lf, flag_t *f, object_t *o, int *pctmod) {
}
}
if (scaleamt && pctmod) {
// for each 10 points you are over/under the requirement, adjust "scaleamt" percent.
if (scale_bonus && pctmod) {
// for each 10 points you are over/under the requirement, adjust "scale_bonus" percent.
if (bonorpen == PENALTY) {
*pctmod = (neededdiff/10) * scaleamt;
*pctmod = (neededdiff/10) * scale_penalty;
} else if (bonorpen == BONUS) {
*pctmod = (bonusdiff/10) * scaleamt;
*pctmod = (bonusdiff/10) * scale_bonus;
}
}