Added support for NPCs with innate range attacks (e.g. vorts) in standoffs

This commit is contained in:
Blixibon 2021-11-21 00:13:56 -06:00
parent 4e3287842e
commit 79ff53ecdf

View File

@ -296,7 +296,12 @@ bool CAI_StandoffBehavior::CanSelectSchedule()
if ( !m_fActive ) if ( !m_fActive )
return false; return false;
#ifdef MAPBASE
// Allow NPCs with innate range attacks to use standoffs
return ( GetNpcState() == NPC_STATE_COMBAT && (GetOuter()->GetActiveWeapon() != NULL || GetOuter()->CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1) );
#else
return ( GetNpcState() == NPC_STATE_COMBAT && GetOuter()->GetActiveWeapon() != NULL ); return ( GetNpcState() == NPC_STATE_COMBAT && GetOuter()->GetActiveWeapon() != NULL );
#endif
} }
//------------------------------------- //-------------------------------------
@ -600,7 +605,11 @@ int CAI_StandoffBehavior::SelectScheduleAttack( void )
!HasCondition( COND_CAN_MELEE_ATTACK1 ) && !HasCondition( COND_CAN_MELEE_ATTACK1 ) &&
HasCondition( COND_TOO_FAR_TO_ATTACK ) ) HasCondition( COND_TOO_FAR_TO_ATTACK ) )
{ {
#ifdef MAPBASE
if ( (GetOuter()->GetActiveWeapon() && ( GetOuter()->GetActiveWeapon()->CapabilitiesGet() & bits_CAP_WEAPON_RANGE_ATTACK1 )) || GetOuter()->CapabilitiesGet() & bits_CAP_INNATE_RANGE_ATTACK1 )
#else
if ( GetOuter()->GetActiveWeapon() && ( GetOuter()->GetActiveWeapon()->CapabilitiesGet() & bits_CAP_WEAPON_RANGE_ATTACK1 ) ) if ( GetOuter()->GetActiveWeapon() && ( GetOuter()->GetActiveWeapon()->CapabilitiesGet() & bits_CAP_WEAPON_RANGE_ATTACK1 ) )
#endif
{ {
if ( !HasCondition( COND_ENEMY_OCCLUDED ) || random->RandomInt(0,99) < 50 ) if ( !HasCondition( COND_ENEMY_OCCLUDED ) || random->RandomInt(0,99) < 50 )
// Don't advance, just fire anyway // Don't advance, just fire anyway