JASS:
function attack_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function HeartTarget takes integer level returns nothing
local integer heart = 0
if level == 1 then
loop
exitwhen heart == 20
set heart = ( heart + 1 )
call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 4, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call TriggerSleepAction( 1 )
endloop
else
if level == 2 then
loop
exitwhen heart == 20
set heart = ( heart + 1 )
call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 6, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call TriggerSleepAction( 1 )
endloop
else
if level == 3 then
loop
exitwhen heart == 20
set heart = ( heart + 1 )
call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), 8, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call TriggerSleepAction( 1 )
endloop
else
endif
endif
endif
set heart = null
endfunction
function MuscleTarget takes integer level returns nothing
local integer muscle = 0
if level == 1 then
loop
exitwhen muscle == 10
set muscle = ( muscle + 2 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call TriggerSleepAction (0.2)
call PauseUnitBJ( false, GetSpellTargetUnit() )
call TriggerSleepAction( 2 )
endloop
else
if level == 2 then
loop
exitwhen muscle == 10
set muscle = ( muscle + 2 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call TriggerSleepAction (0.4)
call PauseUnitBJ( false, GetSpellTargetUnit() )
call TriggerSleepAction( 2 )
endloop
else
if level == 3 then
loop
exitwhen muscle == 10
set muscle = ( muscle + 2 )
call PauseUnitBJ( true, GetSpellTargetUnit() )
call TriggerSleepAction (0.6)
call PauseUnitBJ( false, GetSpellTargetUnit() )
call TriggerSleepAction( 2 )
endloop
else
endif
endif
endif
set muscle = null
endfunction
function ArmorTarget takes integer level returns nothing
endfunction
function attack_Actions takes nothing returns nothing
local integer level
local unit target
local unit caster
set level = GetUnitAbilityLevel ( GetTriggerUnit(),'A001')
if udg_buffselected == 0 then
call HeartTarget(level)
else
if udg_buffselected == 1 then
call MuscleTarget(level)
else
if udg_buffselected == 2 then
call ArmorTarget(level)
else
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_attack takes nothing returns nothing
local trigger attack = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( attack, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( attack, Condition( function attack_Conditions ) )
call TriggerAddAction( attack, function attack_Actions )
set attack = null
endfunction