shiFt
Member
- Reaction score
- 8
How do I do this? I would like it to include bonuses too
library GetLastDamage uses AIDS, Damage
private struct UnitDamage extends array
real last
private method AIDS_onCreate takes nothing returns nothing
set this.last=0
endmethod
//! runtextmacro AIDS()
private static method onDamage takes nothing returns boolean
if Damage_IsAttack() then
set thistype[GetEventDamageSource()].last=GetEventDamage()
endif
return false
endmethod
private static method AIDS_onInit takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerAddCondition(t,Filter(function thistype.onDamage))
call Damage_RegisterEvent(t)
endmethod
endstruct
// use this to get a unit's last attack damage.
function GetUnitLastDamage takes unit u returns real
return UnitDamage<u>.last
endfunction
endlibrary</u>