Script::UnitAttackPower
function · ui · primitive
- Address
0x518f80· 308 bytes, up to0x5190b3- Signature
int __fastcall (lua_State *L)- Meaning
- Returns a unit's 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_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
- GetUnitFromToken ui
- lua_isstring lua
- lua_tostring lua
- lua_pushnumber lua
- luaL_error lua
Calls and jumps by a bare address, from tables/calls.tsv.