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:
@@ -28,6 +28,11 @@
|
|||||||
#define AT_WEAP 254 /* uses weapon */
|
#define AT_WEAP 254 /* uses weapon */
|
||||||
#define AT_MAGC 255 /* uses magic spell(s) */
|
#define AT_MAGC 255 /* uses magic spell(s) */
|
||||||
|
|
||||||
|
#define DISTANCE_ATTK_TYPE(atyp) ((atyp) == AT_SPIT \
|
||||||
|
|| (atyp) == AT_BREA \
|
||||||
|
|| (atyp) == AT_MAGC \
|
||||||
|
|| (atyp) == AT_GAZE)
|
||||||
|
|
||||||
/* Add new damage types below.
|
/* Add new damage types below.
|
||||||
*
|
*
|
||||||
* Note that 1-10 correspond to the types of attack used in buzz().
|
* Note that 1-10 correspond to the types of attack used in buzz().
|
||||||
|
|||||||
+3
-14
@@ -306,22 +306,11 @@ can_blnd(
|
|||||||
boolean
|
boolean
|
||||||
ranged_attk(struct permonst* ptr)
|
ranged_attk(struct permonst* ptr)
|
||||||
{
|
{
|
||||||
register int i, atyp;
|
int i;
|
||||||
long atk_mask = (1L << AT_BREA) | (1L << AT_SPIT) | (1L << AT_GAZE);
|
|
||||||
|
|
||||||
/* was: (attacktype(ptr, AT_BREA) || attacktype(ptr, AT_WEAP)
|
for (i = 0; i < NATTK; i++)
|
||||||
* || attacktype(ptr, AT_SPIT) || attacktype(ptr, AT_GAZE)
|
if (DISTANCE_ATTK_TYPE(ptr->mattk[i].aatyp))
|
||||||
* || 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)
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
/* assert(atyp < 32); */
|
|
||||||
if ((atk_mask & (1L << atyp)) != 0L)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -756,7 +756,9 @@ dochug(register struct monst* mtmp)
|
|||||||
return 0;
|
return 0;
|
||||||
/* Monsters can move and then shoot on same turn;
|
/* Monsters can move and then shoot on same turn;
|
||||||
our hero can't. Is that fair? */
|
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;
|
break;
|
||||||
/* engulfer/grabber checks */
|
/* engulfer/grabber checks */
|
||||||
if (mtmp == u.ustuck) {
|
if (mtmp == u.ustuck) {
|
||||||
@@ -945,9 +947,8 @@ m_balks_at_approaching(struct monst* mtmp)
|
|||||||
|| !m_canseeu(mtmp))
|
|| !m_canseeu(mtmp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* has ammo+launcher or can spit */
|
/* has ammo+launcher */
|
||||||
if (m_has_launcher_and_ammo(mtmp)
|
if (m_has_launcher_and_ammo(mtmp))
|
||||||
|| attacktype(mtmp->data, AT_SPIT))
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* is using a polearm and in range */
|
/* 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)
|
&& dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <= MON_POLE_DIST)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* breath attack, and hp loss or breath not used */
|
/* can attack from distance, and hp loss or attack not used */
|
||||||
if (attacktype(mtmp->data, AT_BREA)
|
if (ranged_attk(mtmp->data)
|
||||||
&& ((mtmp->mhp < (mtmp->mhpmax+1) / 3)
|
&& ((mtmp->mhp < (mtmp->mhpmax+1) / 3)
|
||||||
|| !mtmp->mspec_used))
|
|| !mtmp->mspec_used))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user