Damage Reduction

DebugDamageImmunity(cre)

Generates a debug string with damage immunity related values.

Parameters:
Return type:

string

DebugDamageResistance(cre)

Generates a debug string with damage resistance related values.

Parameters:
Return type:

string

DebugDamageReduction(cre)

Generates a debug string with damage reduction related values.

Parameters:
Return type:

string

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.

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 from obj.

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 from GetBestDamageReductionEffect().
  • power (int) – Damage power.
Return type:

Modified damage amount, the amount damage was modified, and a bool indicating whether the effect was removed.

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 from obj.

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 from GetBestDamageResistEffect().
  • dmgidx (int) – DAMAGE_INDEX_*
Return type:

Modified damage amount, the amount damage was modified, and a bool indicating whether the effect was removed.

GetBaseDamageImmunity(cre, dmgidx)

Get base damage immunity.

Parameters:
  • cre (Creature) – Creature instance.
  • dmgidx (int) – DAMAGE_INDEX_*
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:
GetBaseDamageResistance(cre, dmgidx)

Get base damage resistance.

Parameters:
  • cre (Creature) – Creature instance.
  • dmgidx (int) – DAMAGE_INDEX_*
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 than power 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:

Effect

GetBestDamageResistEffect(obj, dmgidx[, start])

Determines the best damage resistance effect currently applied to obj. The effect with the highest resistance to dmgidx 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:

Effect

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 an int is returned, otherwise an array of all damage immunity effects is returned.

GetEffectDamageImmunityLimits(obj)
Parameters:
  • obj (Object) – Object instance.
Return type:

-100, 100

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.
SetBaseDamageResistanceOverride(func, ...)

Sets a damage resistance override function.

Parameters:
  • func (function) – (Creature) -> int
  • ... – DAMAGE_INDEX_* constants.