I'm creating spell that called
Curse of Exhaustion - reducing movement and attack speed by X%. If target attacks while under effect of curse, it's speed will be reduce by 10% per attack with builds up to 99%.
Dummy Spell is cripple with increase effect by 10% per level.
It seem to work fine on first cast, but if I cast it again dummy spell always increases more than one level per attack.
Thanks for help!
Curse of Exhaustion - reducing movement and attack speed by X%. If target attacks while under effect of curse, it's speed will be reduce by 10% per attack with builds up to 99%.
JASS:
function Trig_Curse_of_Ex_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A03K039;
endfunction
function Trig_Curse_of_Ex_Curse takes nothing returns nothing
local unit u = GetAttacker()
local unit n
if UnitHasBuffBJ(GetAttacker(), 039;B00I039;) == true and udg_CurseEx <= ( 10 - GetUnitAbilityLevelSwapped(039;A03K039;, udg_Banshee) ) then
set udg_CurseEx = udg_CurseEx + 1
set n = CreateUnit( GetOwningPlayer(udg_Banshee), 039;h001039;, GetUnitX(u), GetUnitY(u), GetUnitFacing(u) )
call UnitAddAbilityBJ( 039;A03I039;, n )
call SetUnitAbilityLevelSwapped( 039;A03I039;, n, ( GetUnitAbilityLevelSwapped(039;A03K039;, udg_Banshee) + udg_CurseEx ) )
call IssueTargetOrderBJ( n, "cripple", u )
call UnitApplyTimedLife( n, 039;BTLF039;, 1.0 )
endif
endfunction
function Trig_Curse_of_Ex_Actions takes nothing returns nothing
local trigger t
set udg_CurseEx = 0
set t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddAction(t,function Trig_Curse_of_Ex_Curse )
endfunction
//===========================================================================
function InitTrig_Curse_of_Ex takes nothing returns nothing
set gg_trg_Curse_of_Ex = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Curse_of_Ex, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Curse_of_Ex, Condition( function Trig_Curse_of_Ex_Conditions ) )
call TriggerAddAction( gg_trg_Curse_of_Ex, function Trig_Curse_of_Ex_Actions )
endfunction
Dummy Spell is cripple with increase effect by 10% per level.
It seem to work fine on first cast, but if I cast it again dummy spell always increases more than one level per attack.
Thanks for help!