- [+] Monsters should not use longbows as melee weapons!!
This commit is contained in:
parent
5d61533c15
commit
45c5fd0365
3
attack.c
3
attack.c
|
@ -377,7 +377,8 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gotweapon = getweapons(lf, wep, damflag, &lastweaponidx, &op, &nweps);
|
// monsters won't attack with non-melee weapons like bows
|
||||||
|
gotweapon = getweapons(lf, isplayer(lf) ? B_FALSE : B_MELEEONLY, wep, damflag, &lastweaponidx, &op, &nweps);
|
||||||
for (i = 0; i < nweps; i++) {
|
for (i = 0; i < nweps; i++) {
|
||||||
validwep[i] = B_TRUE;
|
validwep[i] = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
BIN
data/hiscores.db
BIN
data/hiscores.db
Binary file not shown.
2
defs.h
2
defs.h
|
@ -94,6 +94,8 @@
|
||||||
#define B_VERT (0)
|
#define B_VERT (0)
|
||||||
#define B_HORZ (1)
|
#define B_HORZ (1)
|
||||||
|
|
||||||
|
#define B_MELEEONLY (-1)
|
||||||
|
|
||||||
|
|
||||||
//#define B_TEMP (-1)
|
//#define B_TEMP (-1)
|
||||||
//#define B_PERM (-2)
|
//#define B_PERM (-2)
|
||||||
|
|
2
god.c
2
god.c
|
@ -2244,7 +2244,7 @@ int prayto(lifeform_t *lf, lifeform_t *god) {
|
||||||
if (l->race->id == R_COCKATRICE) {
|
if (l->race->id == R_COCKATRICE) {
|
||||||
preventstoning = B_TRUE;
|
preventstoning = B_TRUE;
|
||||||
}
|
}
|
||||||
getweapons(l, wep, damflag, &lastweaponidx, &op, &nweps);
|
getweapons(l, B_MELEEONLY, wep, damflag, &lastweaponidx, &op, &nweps);
|
||||||
for (i = 0; i < nweps; i++) {
|
for (i = 0; i < nweps; i++) {
|
||||||
if (hasflagval(wep[i]->flags, F_HITCONFER, F_PARALYZED, NA, NA, NULL)) {
|
if (hasflagval(wep[i]->flags, F_HITCONFER, F_PARALYZED, NA, NA, NULL)) {
|
||||||
preventparalysis = B_TRUE;
|
preventparalysis = B_TRUE;
|
||||||
|
|
21
lf.c
21
lf.c
|
@ -7135,7 +7135,7 @@ int gethitstokill(lifeform_t *lf, lifeform_t *victim, int useevasion, int usearm
|
||||||
flag_t *damflag[MAXCANDIDATES];
|
flag_t *damflag[MAXCANDIDATES];
|
||||||
obpile_t *op = NULL;
|
obpile_t *op = NULL;
|
||||||
int nweps = 0,hitstokill = 0;
|
int nweps = 0,hitstokill = 0;
|
||||||
getweapons(lf, wep, damflag, NULL, &op, &nweps);
|
getweapons(lf, B_MELEEONLY, wep, damflag, NULL, &op, &nweps);
|
||||||
if (nweps) {
|
if (nweps) {
|
||||||
int maxdam;
|
int maxdam;
|
||||||
getdamrange(wep[0], damflag[0], NULL, &maxdam);
|
getdamrange(wep[0], damflag[0], NULL, &maxdam);
|
||||||
|
@ -8112,6 +8112,17 @@ float getmaxstamina(lifeform_t *lf) {
|
||||||
return stam;
|
return stam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object_t *getmeleeweapon(lifeform_t *lf) {
|
||||||
|
object_t *o;
|
||||||
|
o = getweapon(lf);
|
||||||
|
if (o && ismeleeweapon(o)) {
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getmr(lifeform_t *lf) {
|
int getmr(lifeform_t *lf) {
|
||||||
int amt = 0;
|
int amt = 0;
|
||||||
|
|
||||||
|
@ -9543,7 +9554,6 @@ void getwantdistance(lifeform_t *lf, lifeform_t *victim, int *min, int *max, int
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
object_t *getweapon(lifeform_t *lf) {
|
object_t *getweapon(lifeform_t *lf) {
|
||||||
object_t *o;
|
object_t *o;
|
||||||
o = getequippedob(lf->pack, BP_WEAPON);
|
o = getequippedob(lf->pack, BP_WEAPON);
|
||||||
|
@ -9558,8 +9568,8 @@ object_t *getweapon(lifeform_t *lf) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function MIGHT allocat op!
|
// this function MIGHT allocate op!
|
||||||
int getweapons(lifeform_t *lf, object_t **wep, flag_t **damflag, int *lastweaponidx, obpile_t **op, int *nweps) {
|
int getweapons(lifeform_t *lf, int meleeonly, object_t **wep, flag_t **damflag, int *lastweaponidx, obpile_t **op, int *nweps) {
|
||||||
int gotweapon = B_FALSE;
|
int gotweapon = B_FALSE;
|
||||||
flag_t *retflag[MAXCANDIDATES],*f,*forcewep;
|
flag_t *retflag[MAXCANDIDATES],*f,*forcewep;
|
||||||
int nretflags,i;
|
int nretflags,i;
|
||||||
|
@ -9569,7 +9579,7 @@ int getweapons(lifeform_t *lf, object_t **wep, flag_t **damflag, int *lastweapon
|
||||||
|
|
||||||
forcewep = lfhasflag(lf, F_FORCEATTACK);
|
forcewep = lfhasflag(lf, F_FORCEATTACK);
|
||||||
if (!forcewep) {
|
if (!forcewep) {
|
||||||
wep[*nweps] = getweapon(lf);
|
wep[*nweps] = meleeonly ? getmeleeweapon(lf) : getweapon(lf);
|
||||||
if (wep[*nweps]) {
|
if (wep[*nweps]) {
|
||||||
if (damflag) damflag[*nweps] = hasflag(wep[*nweps]->flags, F_DAM);
|
if (damflag) damflag[*nweps] = hasflag(wep[*nweps]->flags, F_DAM);
|
||||||
if (lastweaponidx) *lastweaponidx = 0;
|
if (lastweaponidx) *lastweaponidx = 0;
|
||||||
|
@ -9616,6 +9626,7 @@ int getweapons(lifeform_t *lf, object_t **wep, flag_t **damflag, int *lastweapon
|
||||||
return gotweapon;
|
return gotweapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum SKILLLEVEL getweaponskill(lifeform_t *lf, object_t *o) {
|
enum SKILLLEVEL getweaponskill(lifeform_t *lf, object_t *o) {
|
||||||
skill_t *sk;
|
skill_t *sk;
|
||||||
if (!o) {
|
if (!o) {
|
||||||
|
|
3
lf.h
3
lf.h
|
@ -204,6 +204,7 @@ float getmaxliftweight(lifeform_t *lf);
|
||||||
int getmaxmp(lifeform_t *lf);
|
int getmaxmp(lifeform_t *lf);
|
||||||
float getmaxpushweight(lifeform_t *lf);
|
float getmaxpushweight(lifeform_t *lf);
|
||||||
float getmaxstamina(lifeform_t *lf);
|
float getmaxstamina(lifeform_t *lf);
|
||||||
|
object_t *getmeleeweapon(lifeform_t *lf);
|
||||||
int getmr(lifeform_t *lf);
|
int getmr(lifeform_t *lf);
|
||||||
int getvisrange(lifeform_t *lf, int useambient);
|
int getvisrange(lifeform_t *lf, int useambient);
|
||||||
void idxtoxy(lifeform_t *lf, int idx, int *x, int *y);
|
void idxtoxy(lifeform_t *lf, int idx, int *x, int *y);
|
||||||
|
@ -265,7 +266,7 @@ int getthrowspeed(lifeform_t *lf);
|
||||||
int getturnspeed(lifeform_t *lf);
|
int getturnspeed(lifeform_t *lf);
|
||||||
void getwantdistance(lifeform_t *lf, lifeform_t *victim, int *min, int *max, int attacking);
|
void getwantdistance(lifeform_t *lf, lifeform_t *victim, int *min, int *max, int attacking);
|
||||||
object_t *getweapon(lifeform_t *lf);
|
object_t *getweapon(lifeform_t *lf);
|
||||||
int getweapons(lifeform_t *lf, object_t **wep, flag_t **damflag, int *lastweaponidx, obpile_t **op, int *nweps);
|
int getweapons(lifeform_t *lf, int meleeonly, object_t **wep, flag_t **damflag, int *lastweaponidx, obpile_t **op, int *nweps);
|
||||||
enum SKILLLEVEL getweaponskill(lifeform_t *lf, object_t *o);
|
enum SKILLLEVEL getweaponskill(lifeform_t *lf, object_t *o);
|
||||||
long getxpforlev(int level);
|
long getxpforlev(int level);
|
||||||
void givejob(lifeform_t *lf, enum JOB jobid);
|
void givejob(lifeform_t *lf, enum JOB jobid);
|
||||||
|
|
2
spell.c
2
spell.c
|
@ -2225,7 +2225,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
||||||
object_t *weplist[MAXPILEOBS];
|
object_t *weplist[MAXPILEOBS];
|
||||||
int nweps;
|
int nweps;
|
||||||
// look for innate attack
|
// look for innate attack
|
||||||
getweapons(user, weplist, NULL, NULL, &op, &nweps);
|
getweapons(user, B_MELEEONLY, weplist, NULL, NULL, &op, &nweps);
|
||||||
if (nweps) {
|
if (nweps) {
|
||||||
wep = weplist[0];
|
wep = weplist[0];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue