This is my spell, every time knight suffers damage he gain armor based on stacks and strength.
I'm increasing it with a skill which have around 200 level(max str will be near at 1000 so it's enough)
But mby there a better way to do it than using a skill? It seems that there no way to increase armor directly or just i have lack of knowledge and can't find it.
Also i'm curious about leaks, did i cleared all of them?
Sorry for my bad english, not my native language and never learned it besides in WoW.
I'm increasing it with a skill which have around 200 level(max str will be near at 1000 so it's enough)
But mby there a better way to do it than using a skill? It seems that there no way to increase armor directly or just i have lack of knowledge and can't find it.
Also i'm curious about leaks, did i cleared all of them?
Sorry for my bad english, not my native language and never learned it besides in WoW.
JASS:
function KnightT3Passive_Conditions takes nothing returns boolean
return GetUnitAbilityLevelSwapped('A00J', udg_DamageEventTarget) >= 1
endfunction
function KnightT3Stacks_Clear takes nothing returns nothing
local timer knightT3ClearTimer = GetExpiredTimer()
local unit target = LoadUnitHandle(udg_KnightT3HashTable, GetHandleId(knightT3ClearTimer), 2)
local integer timerCount = LoadInteger(udg_KnightT3HashTable, GetHandleId(target), 51)
local integer playerId = GetConvertedPlayerId(GetOwningPlayer(target))
set timerCount = (timerCount - 1)
call DisplayTextToForce( GetPlayersAll(), ( "timerCount - " + I2S(timerCount)) )
if(timerCount <= 0) then
call SaveInteger(udg_KnightT3HashTable, GetHandleId(target), 51, timerCount)
call SetUnitAbilityLevelSwapped( 'A00R', target, 1)
call FlushChildHashtableBJ(GetHandleIdBJ(knightT3ClearTimer), udg_KnightT3HashTable)
call FlushChildHashtableBJ(GetHandleIdBJ(target), udg_KnightT3HashTable)
call PauseTimer(knightT3ClearTimer)
call DestroyTimer(knightT3ClearTimer)
endif
call SaveInteger(udg_KnightT3HashTable, GetHandleId(target), 51, timerCount)
set target = null
endfunction
function KnightT3_Action takes nothing returns nothing
local timer knightT3Timer = GetExpiredTimer()
local unit target = LoadUnitHandle(udg_KnightT3HashTable, GetHandleId(knightT3Timer), 1)
local integer timerCount = LoadInteger(udg_KnightT3HashTable, GetHandleId(target), 51)
local integer stacks = LoadInteger(udg_KnightT3HashTable, GetHandleId(target), 52)
local integer armorPoints
if(stacks >= 0 and stacks < 10) then
set stacks = (stacks + 1)
endif
call SaveInteger(udg_KnightT3HashTable, GetHandleId(target), 51, 10)
set armorPoints = (stacks + ( stacks * ( GetHeroStatBJ(bj_HEROSTAT_STR, target, true) / 100 ) ))
call SetUnitAbilityLevelSwapped( 'A00R', target, (1 + armorPoints))
call SaveInteger(udg_KnightT3HashTable, GetHandleId(target), 52, stacks)
call FlushChildHashtableBJ(GetHandleIdBJ(knightT3Timer), udg_KnightT3HashTable)
call PauseTimer(knightT3Timer)
call DestroyTimer(knightT3Timer)
set target = null
endfunction
function KnightT3Passive_Actions takes nothing returns nothing
local unit target = udg_DamageEventTarget
local timer knightT3Timer = CreateTimer()
local timer knightT3ClearTimer = CreateTimer()
local integer check = LoadInteger(udg_KnightT3HashTable, GetHandleId(target), 51)
if(check == 0) then
call SaveInteger(udg_KnightT3HashTable, GetHandleId(target), 51, 10)
call SaveUnitHandle(udg_KnightT3HashTable, GetHandleId(knightT3ClearTimer), 2, target)
call TimerStart(knightT3ClearTimer, 1, true, function KnightT3Stacks_Clear)
endif
if(check > 0) then
call PauseTimer(knightT3ClearTimer)
call DestroyTimer(knightT3ClearTimer)
endif
call SaveUnitHandle(udg_KnightT3HashTable, GetHandleId(knightT3Timer), 1, target)
call TimerStart(knightT3Timer, 0.01, false, function KnightT3_Action)
set target = null
endfunction
//===========================================================================
function InitTrig_KnightT3Passive takes nothing returns nothing
set gg_trg_KnightT3Passive = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_KnightT3Passive, "udg_DamageEvent", EQUAL, 1.00 )
call TriggerAddCondition( gg_trg_KnightT3Passive, Condition( function KnightT3Passive_Conditions ) )
call TriggerAddAction( gg_trg_KnightT3Passive, function KnightT3Passive_Actions )
endfunction