benilla-re systems structs docs

Script::UnitResistance

function · ui · primitive

Address
0x5184a0 · 345 bytes, up to 0x5185f8
Signature
int __fastcall (lua_State *L)
Meaning
Returns a unit's resistance base, value and buffs, raising on an index outside 0 to 6
Confidence
verified, proof one
Name from
the community database (idb)
Finding
ui/unitstats#resistances-and-armor

Finding: Resistances and armor in ui: unit stat functions

UnitResistance(unit, i) returns the base, the resistance, the positive buff and the negative buff, all integers. For the local player the base is the field less the buffs, the resistance is the field (0 when it is negative), and the buffs come from PLAYER_FIELD_RESISTANCEBUFFMODSPOSITIVE and NEGATIVE (fields 1187 and 1194). Any other unit gets the field raised to 0 as both base and resistance, and 0 for both buffs. UnitArmor(unit) does the same for the armor school and returns five values: the base, the effective armor, the armor, and the two buffs. A field below zero makes the resistance and both armor copies 0 while the base keeps the signed difference.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 10

Calls and jumps by a bare address, from tables/calls.tsv.