benilla-re systems structs docs

Script::UnitRangedAttackPower

function · ui · primitive

Address
0x5190c0 · 308 bytes, up to 0x5191f3
Signature
int __fastcall (lua_State *L)
Meaning
Returns a unit's ranged attack power and its two mods, each scaled by the multiplier and rounded
Confidence
verified, proof one
Name from
the community database (idb)
Finding
ui/unitstats#attack-power
Test
ui::unit_ranged_attack_power

Finding: Attack power in ui: unit stat functions

UnitAttackPower(unit) and UnitRangedAttackPower(unit) return three integers: the power, the positive mod and the negative mod, each already multiplied by 1 + multiplier and rounded on its own. The power is the signed field (UNIT_FIELD_ATTACK_POWER, field 165), the mods are the low and high signed 16-bit halves of the next field (166), and the multiplier is the float of field 167. The ranged forms use fields 168, 169 and 170. Each value is round_even(float((1 + m) * x)), so the three do not sum to the rounded sum. Any unit of the unit family gets the real answer; a missing unit or non-unit gets zeros.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 5

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