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. |
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. |
Returns:
- The preferred attack type.
- Type
- string
GetFullAttackRange()
Get the full range of attack using all available attack types.
GetPreference()
Returns undefined if we have no preference or the lowest index of a preferred class.
IsTargetInRange(target) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
target |
number | The entity ID of the target to check. |
Returns:
- Whether this entity is in range of its target.
- Type
- boolean
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.
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. |
Returns:
- Whether we started attacking.
- Type
- boolean
StopAttacking(reason)
Parameters:
Name | Type | Description |
---|---|---|
reason |
string | The reason why we stopped attacking. |