Minor ranged attack tweak
Make monsters with magic and gaze attacks avoid hero, just like spitters and breathers already did. Some small code cleanup related to the ranged attacks.
This commit is contained in:
@@ -306,22 +306,11 @@ can_blnd(
|
||||
boolean
|
||||
ranged_attk(struct permonst* ptr)
|
||||
{
|
||||
register int i, atyp;
|
||||
long atk_mask = (1L << AT_BREA) | (1L << AT_SPIT) | (1L << AT_GAZE);
|
||||
int i;
|
||||
|
||||
/* was: (attacktype(ptr, AT_BREA) || attacktype(ptr, AT_WEAP)
|
||||
* || attacktype(ptr, AT_SPIT) || attacktype(ptr, AT_GAZE)
|
||||
* || attacktype(ptr, AT_MAGC));
|
||||
* but that's too slow -dlc
|
||||
*/
|
||||
for (i = 0; i < NATTK; i++) {
|
||||
atyp = ptr->mattk[i].aatyp;
|
||||
if (atyp >= AT_WEAP)
|
||||
for (i = 0; i < NATTK; i++)
|
||||
if (DISTANCE_ATTK_TYPE(ptr->mattk[i].aatyp))
|
||||
return TRUE;
|
||||
/* assert(atyp < 32); */
|
||||
if ((atk_mask & (1L << atyp)) != 0L)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -756,7 +756,9 @@ dochug(register struct monst* mtmp)
|
||||
return 0;
|
||||
/* Monsters can move and then shoot on same turn;
|
||||
our hero can't. Is that fair? */
|
||||
if (!nearby && (ranged_attk(mdat) || find_offensive(mtmp)))
|
||||
if (!nearby && (ranged_attk(mdat)
|
||||
|| attacktype(mdat, AT_WEAP)
|
||||
|| find_offensive(mtmp)))
|
||||
break;
|
||||
/* engulfer/grabber checks */
|
||||
if (mtmp == u.ustuck) {
|
||||
@@ -945,9 +947,8 @@ m_balks_at_approaching(struct monst* mtmp)
|
||||
|| !m_canseeu(mtmp))
|
||||
return FALSE;
|
||||
|
||||
/* has ammo+launcher or can spit */
|
||||
if (m_has_launcher_and_ammo(mtmp)
|
||||
|| attacktype(mtmp->data, AT_SPIT))
|
||||
/* has ammo+launcher */
|
||||
if (m_has_launcher_and_ammo(mtmp))
|
||||
return TRUE;
|
||||
|
||||
/* is using a polearm and in range */
|
||||
@@ -955,8 +956,8 @@ m_balks_at_approaching(struct monst* mtmp)
|
||||
&& dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <= MON_POLE_DIST)
|
||||
return TRUE;
|
||||
|
||||
/* breath attack, and hp loss or breath not used */
|
||||
if (attacktype(mtmp->data, AT_BREA)
|
||||
/* can attack from distance, and hp loss or attack not used */
|
||||
if (ranged_attk(mtmp->data)
|
||||
&& ((mtmp->mhp < (mtmp->mhpmax+1) / 3)
|
||||
|| !mtmp->mspec_used))
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user