function Gh takes unit c,unit t,real r returns nothing
local unit d
local real hh=r
if GetUnitAbilityLevel(t,'A02M')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A02M')*.05))
endif
if GetUnitAbilityLevel(t,'A06O')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A06O')*.05))
endif
set d=CreateUnit(GetOwningPlayer(c),'h02X',GetUnitX(t),GetUnitY(t),bj_UNIT_FACING)
call UnitDamageTarget(d,t,r,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC,null)
call RemoveUnit(d)
set d=null
endfunction
function Hh takes unit c,unit t,real r returns nothing
local unit d
local real hh=r
if hh>=50 and UnitHasItemOfTypeBJ(t,'I00R') and GetRandomReal(1,100)<=5 then
set d=CreateUnit(GetOwningPlayer(t),'h00F',GetUnitX(c),GetUnitY(c),bj_UNIT_FACING)
call UnitDamageTarget(d,c,hh,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC,null)
call RemoveUnit(d)
else
if UnitHasItemOfTypeBJ(t,'I028') then
set hh=hh-(hh*.05)
endif
if UnitHasItemOfTypeBJ(t,'I029') then
set hh=hh-(hh*.1)
endif
if UnitHasItemOfTypeBJ(t,'I02A') then
set hh=hh-(hh*.15)
endif
if UnitHasItemOfTypeBJ(t,'I02B') then
set hh=hh-(hh*.2)
endif
if UnitHasItemOfTypeBJ(t,'I02C') then
set hh=hh-(hh*.25)
endif
if GetUnitAbilityLevel(t,'B00D')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A02O')*.05))
endif
if GetUnitAbilityLevel(t,'B006')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A011')*.03))
endif
if GetUnitTypeId(t)=='H02I' then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A02Z')*.05))
endif
if GetUnitAbilityLevel(t,'B00Z')>=1 then
set hh=0
endif
set d=CreateUnit(GetOwningPlayer(c),'h00F',GetUnitX(t),GetUnitY(t),bj_UNIT_FACING)
call UnitDamageTarget(d,t,hh,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC,null)
call RemoveUnit(d)
endif
set d=null
endfunction
function jh takes unit c,unit t,real r returns nothing
local unit d
local real hh=r
local texttag tt
if hh>=50 and UnitHasItemOfTypeBJ(t,'I00R') and GetRandomReal(1,100)<=5 then
set d=CreateUnit(GetOwningPlayer(t),'h02W',GetUnitX(c),GetUnitY(c),bj_UNIT_FACING)
call UnitDamageTarget(d,c,hh,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC,null)
call RemoveUnit(d)
elseif GetUnitAbilityLevel(t,'A067')>=1 and GetRandomReal(1,100)<=5 then
call SetWidgetLife(t,GetWidgetLife(t)+hh)
set tt=CreateTextTag()
call SetTextTagText(tt,I2S(R2I(hh)),.025)
call SetTextTagPos(tt,GetUnitX(t),GetUnitY(t),0)
call SetTextTagColor(tt,100,255,100,255)
call SetTextTagVelocity(tt,0,.07)
call SetTextTagPermanent(tt,false)
call SetTextTagLifespan(tt,1.5)
else
if UnitHasItemOfTypeBJ(t,'I024') then
set hh=hh-(hh*.05)
endif
if UnitHasItemOfTypeBJ(t,'I025') then
set hh=hh-(hh*.1)
endif
if UnitHasItemOfTypeBJ(t,'I026') then
set hh=hh-(hh*.15)
endif
if UnitHasItemOfTypeBJ(t,'I027') then
set hh=hh-(hh*.2)
endif
if UnitHasItemOfTypeBJ(t,'I02C') then
set hh=hh-(hh*.25)
endif
if GetUnitAbilityLevel(t,'A02M')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A02M')*.02))
endif
if GetUnitAbilityLevel(t,'A06O')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A06O')*.02))
endif
if GetUnitAbilityLevel(t,'A067')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A067')*.03))
endif
if GetUnitAbilityLevel(t,'B006')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A011')*.03))
endif
if GetUnitAbilityLevel(t,'B00J')>=1 then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A02W')*.03))
endif
if GetUnitTypeId(t)=='H02I' then
set hh=hh-(hh*(GetUnitAbilityLevel(t,'A02Z')*.05))
endif
if GetUnitAbilityLevel(t,'B00Z')>=1 then
set hh=0
endif
set d=CreateUnit(GetOwningPlayer(c),'h02W',GetUnitX(t),GetUnitY(t),bj_UNIT_FACING)
call UnitDamageTarget(d,t,hh,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC,null)
call RemoveUnit(d)
endif
set d=null
set tt=null
endfunction