Class: Attack

Attack()

new Attack()

Source:

Members

Schema

Source:

callerIID

Source:

checkTimer

Source:

force

Source:

lastAttacked

Source:

preferredClassesSchema

Source:

restrictedClassesSchema

Source:

resyncAnimation

Source:

target

Source:

timer

Source:

Methods

Attack(data, lateness)

Attack our target entity.
Parameters:
Name Type Description
data string The attack type to use.
lateness number The offset of the actual call and when it was expected.
Source:

CanAttack()

Checks whether this entity could ever attack the target, e.g. to decide whether to bother moving towards it. Covers visibility (mirages included), but its range check only requires the target to be reachable in principle: it's ORed with CanEverReachTarget, which ignores terrain. Callers that need to know if the target is precisely in range right now must check that themselves.
Source:

CanEverReachTarget(targetId, type) → {boolean}

Check if the target could potentially ever be reached with the given attack type, as an optimistic estimate. This assumes the attacker can move to the closest possible position to the target — ignoring obstructions and terrain features (e.g., hills) that might help or hinder. This is a best-effort guess: - It may return true even when the target is actually unreachable (e.g., turreted units on walls with a height offset too large for the projectile to overcome). - It may return false even when the target is reachable (e.g., a nearby hill could provide enough elevation to hit a "too high" target, but we don't check for that). Currently these checks are mostly useful to determine if we can reach turreted units (e.g. on a wall, outpost...).
Parameters:
Name Type Description
targetId number The target entity ID.
type string The attack type.
Source:
Returns:
- Whether the target is estimated to be reachable (see caveats above).
Type
boolean

CompareEntitiesByPreference()

Source:

GetAttackEffectsData()

Source:

GetAttackName()

Source:

GetAttackTypes()

Source:

GetAttackYOrigin()

Source:

GetBestAttackAgainst(target, allowCapture) → {string}

Find the best attack against a target.
Parameters:
Name Type Description
target number The entity-ID of the target.
allowCapture boolean Whether capturing is allowed.
Source:
Returns:
- The preferred attack type.
Type
string

GetEffectiveAttackRange(target, type) → {Object}

Get the effective range for attacking a specific target, accounting for elevation and projectile physics where applicable.
Parameters:
Name Type Description
target number The target entity ID.
type string The attack type.
Source:
Returns:
- The min and max effective range, or { Infinity, 0 } if the target cannot be reached on a parabolic trajectory given the current terrain height difference.
Type
Object

GetFullAttackRange()

Get the full range of attack using all available attack types.
Source:

GetPreference()

Returns undefined if we have no preference or the lowest index of a preferred class.
Source:

GetPreferredClasses()

Source:

GetProjectileCount()

Source:

GetRange()

Source:

GetRangeOverlays()

Source:

GetRepeatTime()

Source:

GetRestrictedClasses()

Source:

GetSplashData()

Source:

GetTimers()

Source:

Init()

Source:

IsTargetInRange(target) → {boolean}

Parameters:
Name Type Description
target number The entity ID of the target to check.
Source:
Returns:
- Whether this entity is in range of its target.
Type
boolean

OnValueModification()

Source:

PerformAttack()

Attack the target entity. This should only be called after a successful range check, and should only be called after GetTimers().repeat msec has passed since the last call to PerformAttack.
Source:

RepeatRangeCheck()

Source:

StartAttacking(target, type, callerIID) → {boolean}

Parameters:
Name Type Description
target number The target to attack.
type string The type of attack to use.
callerIID number The IID to notify on specific events.
Source:
Returns:
- Whether we started attacking.
Type
boolean

StopAttacking(reason)

Parameters:
Name Type Description
reason string The reason why we stopped attacking.
Source: