Damage Reduction¶
-
DebugDamageImmunity
(cre)¶ Generates a debug string with damage immunity related values.
Parameters: - cre (
Creature
) – Creature instance.
Return type: string
- cre (
-
DebugDamageResistance
(cre)¶ Generates a debug string with damage resistance related values.
Parameters: - cre (
Creature
) – Creature instance.
Return type: string
- cre (
-
DebugDamageReduction
(cre)¶ Generates a debug string with damage reduction related values.
Parameters: - cre (
Creature
) – Creature instance.
Return type: string
- cre (
-
DoDamageImmunity
(obj, amt, dmgidx)¶ Determines the amount damage is modified by damage immunity.
Parameters: - obj (
Object
) – Object instance. - amt (int) – Damage amount.
- dmgidx (int) – DAMAGE_INDEX_*
Return type: Modified damage amount and the amount damage was modified.
- obj (
-
DoDamageReduction
(obj, amt, eff, power)¶ Determines the amount damage is modified by damage reduction. If the parameter
eff
is a damage absorbtion limit, it will be removed fromobj
.Parameters: - obj (
Object
) – Object instance. - amt (int) – Damage amount.
- eff (
Effect
) – Effect to use to modify the damage amount. Generally this should be the value returned fromGetBestDamageReductionEffect()
. - power (int) – Damage power.
Return type: Modified damage amount, the amount damage was modified, and a
bool
indicating whether the effect was removed.- obj (
-
DoDamageResistance
(obj, amt, eff, dmgidx)¶ Determines the amount damage is modified by damage resistance. If the parameter
eff
is a damage absorbtion limit, it will be removed fromobj
.Parameters: - obj (
Object
) – Object instance. - amt (int) – Damage amount.
- eff (
Effect
) – Effect to use to modify the damage amount. Generally this should be the value returned fromGetBestDamageResistEffect()
. - dmgidx (int) – DAMAGE_INDEX_*
Return type: Modified damage amount, the amount damage was modified, and a
bool
indicating whether the effect was removed.- obj (
-
GetBaseDamageImmunity
(cre, dmgidx)¶ Get base damage immunity.
Parameters: - cre (
Creature
) – Creature instance. - dmgidx (int) – DAMAGE_INDEX_*
- cre (
-
GetBaseDamageReduction
(cre)¶ Get base damage reduction.
Note
This function doesn’t have a user supplied override. To modify its behavior simply replace the function.
Parameters: - cre (
Creature
) – Creature instance.
- cre (
-
GetBaseDamageResistance
(cre, dmgidx)¶ Get base damage resistance.
Parameters: - cre (
Creature
) – Creature instance. - dmgidx (int) – DAMAGE_INDEX_*
- cre (
-
GetBestDamageReductionEffect
(obj, power[, start])¶ Determines the best damage reduction effect currently applied to
obj
. The effect with the highest reduction at any power level greater thanpower
is selected. If multiple effects have the same reduction the effect with the highest soak absorbtion limit is selected.Parameters: - obj (
Object
) – Object instance. - power (int) – Damage power.
- start (int) – Hint for where to start looking in
obj
‘s effect list. This is uesful only for creature objects.
Return type: - obj (
-
GetBestDamageResistEffect
(obj, dmgidx[, start])¶ Determines the best damage resistance effect currently applied to
obj
. The effect with the highest resistance todmgidx
is selected. If multiple effects have the same resistance the effect with the highest damage absorbtion limit is selected.Parameters: - obj (
Object
) – Object instance. - dmgidx (int) – DAMAGE_INDEX_*
- start (int) – Hint for where to start looking in
obj
‘s effect list. This is uesful only for creature objects.
Return type: - obj (
-
GetEffectDamageImmunity
(obj[, dmgidx])¶ Get damage immunity from effects. The values returned by this function are not clamped by
GetEffectDamageImmunityLimits()
Parameters: - obj (
Object
) – Object instance. - dmgidx (int) – DAMAGE_INDEX_*
Return type: If
dmgidx
is provided anint
is returned, otherwise an array of all damage immunity effects is returned.- obj (
-
GetEffectDamageImmunityLimits
(obj)¶ Parameters: - obj (
Object
) – Object instance.
Return type: -100, 100
- obj (
-
SetBaseDamageImmunityOverride
(func, ...)¶ Sets a damage immunity override function.
Example
local function rdd(cre) local res = 0 if cre:GetLevelByClass(CLASS_TYPE_DRAGON_DISCIPLE) >= 10 then res = 100 end return res end Rules.SetBaseDamageImmunityOverride(rdd, DAMAGE_INDEX_FIRE)
Parameters: - func (function) – (
Creature
) ->int
- ... – DAMAGE_INDEX_* constants.
- func (function) – (