Methods
BuildAttackEffectsSchema() → {string}
Builds a RelaxRNG schema of possible attack effects.
See globalscripts/AttackEffects.js for possible elements.
Attacks may also have a "Bonuses" element.
Returns:
- RelaxNG schema string.
- Type
- string
CauseDamageOverArea(data)
Damages units around a given origin.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | The data sent by the caller.
Properties
|
GetAttackBonus(source, target, type, template) → {number}
Calculates the attack damage multiplier against a target.
Parameters:
Name | Type | Description |
---|---|---|
source |
number | The source entity's id. |
target |
number | The target entity's id. |
type |
string | The type of attack. |
template |
Object | The bonus' template. |
Returns:
- The source entity's attack bonus against the specified target.
- Type
- number
GetAttackEffectsData()
Returns a template-like object of attack effects.
GetPlayersToDamage(attackerOwner, friendlyFire) → {Array.<number>}
Get the list of players affected by the damage.
Parameters:
Name | Type | Description |
---|---|---|
attackerOwner |
number | The player id of the attacker. |
friendlyFire |
boolean | A flag indicating if allied entities are also damaged. |
Returns:
The ids of players need to be damaged.
- Type
- Array.<number>
GetTotalAttackEffects(target, effectData, effectType, bonusMultiplier, cmpResistance) → {number}
Calculate the total effect taking bonus and resistance into account.
Parameters:
Name | Type | Description |
---|---|---|
target |
number | The target of the attack. |
effectData |
Object | The effects calculate the effect for. |
effectType |
string | The type of effect to apply (e.g. Damage, Capture or ApplyStatus). |
bonusMultiplier |
number | The factor to multiply the total effect with. |
cmpResistance |
Object | Optionally the resistance component of the target. |
Returns:
- The total value of the effect.
- Type
- number
HandleAttackEffects(target, data, bonusMultiplier) → {boolean}
Handle an attack peformed on an entity.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
target |
number | The targetted entityID. | |||||||||||||||
data |
Object | The data of the attack.
Properties
|
|||||||||||||||
bonusMultiplier |
number | The factor to multiply the total effect with, defaults to 1. |
Returns:
- Whether we handled the attack.
- Type
- boolean