WoW:API UnitAttackPower: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(First version)
 
m (Move page script moved page API UnitAttackPower to API UnitAttackPower without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<center>'''UnitAttackPower''' ''-Documentation by [[user:Flickering|Flickering]]-''</center>
{{wowapi}} __NOTOC__
 
base, posBuff, negBuff = UnitAttackPower("unit");
 
Returns the unit's melee attack power and modifiers.
Returns the unit's melee attack power and modifiers.
 
base, posBuff, negBuff = UnitAttackPower(unit);
----
==Parameters==
;''Arguments''
===Arguments===
 
:;unit : [[UnitId]] - The unit to get information from. (Does not work for <tt>"target"</tt> - Possibly only <tt>"player"</tt> and <tt>"pet"</tt>)
:("unit")
===Returns===
:;unit : String - The [[API TYPE UnitId|UnitId]] to get information from. (Does not work for <tt>"target"</tt> - Possibly only <tt>"player"</tt> and <tt>"pet"</tt>)
 
----
;''Returns''
 
:base, posBuff, negBuff
:;base : Number - The unit's base attack power
:;base : Number - The unit's base attack power
:;posBuff : Number - The total effect of positive buffs to attack power.
:;posBuff : Number - The total effect of positive buffs to attack power.
:;negBuff : Number - The total effect of negative buffs to the attack power (a negative number)
:;negBuff : Number - The total effect of negative buffs to the attack power (a negative number)


----
==Example==
;''Example''
  local base, posBuff, negBuff = UnitAttackPower("player");
 
  local base, posBuff, negBuff = UnitAttackPower("unit");
  local effective = base + posBuff + negBuff;
  local effective = base + posBuff + negBuff;
 
DEFAULT_CHAT_MESSAGE("Your current attack power: " .. effective);
----
===Result===
{{Template:WoW API}}
Displays the player's current attack power in the default chat window.
[[Category:API Unit Functions|UnitAttackPower]]

Latest revision as of 04:47, 15 August 2023

WoW API < UnitAttackPower

Returns the unit's melee attack power and modifiers.

base, posBuff, negBuff = UnitAttackPower(unit);

Parameters[edit]

Arguments[edit]

unit
UnitId - The unit to get information from. (Does not work for "target" - Possibly only "player" and "pet")

Returns[edit]

base
Number - The unit's base attack power
posBuff
Number - The total effect of positive buffs to attack power.
negBuff
Number - The total effect of negative buffs to the attack power (a negative number)

Example[edit]

local base, posBuff, negBuff = UnitAttackPower("player");
local effective = base + posBuff + negBuff;
DEFAULT_CHAT_MESSAGE("Your current attack power: " .. effective);

Result[edit]

Displays the player's current attack power in the default chat window.