x0_i0_enemy

Library with functions for finding and identifying enemies.

NOTE: This file includes x0_i0_match.

Constants

NameValueBrief Description
MELEE_DISTANCE3.0

Structures

NameVariablesBrief Description
sEnemiesint FIGHTERS
int FIGHTER_LEVELS
int CLERICS
int CLERIC_LEVELS
int MAGES
int MAGE_LEVELS
int MONSTERS
int MONTERS_LEVELS
int TOTAL
int TOTAL_LEVELS
Used to represent the number and type of enemies that a creature is facing, divided into four main categories: fighters, clerics, mages, monsters.
sSituationint ENEMY_NUM
int ALLY_NUM
int ENEMY_CR
int ALLY_CR
Used to collect the number of enemies and allies in a situation and their respective challenge rating.

Functions

NameBrief Description
CheckEnemyGroupingOnTargetGets the number of enemies in a sphere shape around a target.
CheckFriendlyFireOnTargetGets how many friendly creatures are within a spherical range of a target object.
CountEnemiesAndAlliesCount the number of enemies and allies in a given radius and their respective total CRs (slightly rounded, since we use integers instead of floats).

This returns a "struct sSituation" type value.
DetermineEnemiesReturns number of enemies perceived and their combined levels.
FindSingleRangedTargetSeeks out an enemy more than 3 meters away.
GetIsMeleeAttackerReturns TRUE if the given opponent is a melee attacker, meaning they are in melee range and equipped with a melee weapon.
GetIsRangedAttackerReturns TRUE if the given opponent is a ranged attacker, meaning they are outside melee range.
GetIsWieldingRangedReturns TRUE if the given opponent is wielding a ranged weapon.
GetMostDangerousClassUse the four archetypes to determine the most dangerous group type facing the NPC.
GetNearestEnemyGets the nearest enemy.
GetNearestPerceivedEnemyReturns the nearest object that can be seen, then checks for he nearest heard target.

You may pass in any of the CREATURE_TYPE_* constants used in GetNearestCreature as nCriteriaType, with corresponding values for nCriteriaValue, to get a more specific result.

KLUDGE: Huge default values used here for nCriteriaType/Value because -1 cannot be passed in at the moment due to a compiler bug. Should be changed to -1 once that's fixed.
GetNearestSeenEnemyGet the nearest seen enemy. This will NOT return an enemy that is heard but not seen; for that, use GetNearestPerceivedEnemy instead.
GetNearestSeenFriendGet the nearest seen friend.
GetNearestSeenOrHeardEnemyDetermines closest visual creature and determines the closest heard creature.
GetNumberOfMeleeAttackersDetermines the number of enemies within a 5 meter radius of the target object.
GetNumberOfRangedAttackersDetermines the number of enemies outside a 5 meter radius of the target object.
GetRacialTypeCountDetermine the number of targets within 20 meters that are of the specified racial-type


  author: Mistress