//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
//TESH.scrollpos=172
//TESH.alwaysfold=0
globals
hashtable hash = InitHashtable()
constant integer AbilityID = 'A000'
constant integer DummyOne = 'h000' // effect model
constant integer DummyTwo = 'h001' // rasen shuriken
constant integer DummyThree = 'h002' // Naruto clones
constant integer DummyFour = 'h003' // effect model2
constant integer DummyFive = 'h004' // effect model3
constant integer RasenSpeed = 45
constant integer RasenSlideRaidus = 250 // rasengan Raidus
constant real RasenDamage = 10 // base damage
constant real RasenDamageLvl = 5 // damage lvl
constant real RasenDamageRadius = 520.
constant real RasenSlideDur = 0.80
constant real RasenDamageDur = 3.00
constant real RaidusKillThree = 180.
constant boolean ThreesKill = true
constant boolean ThreeOnly = true
constant string RasenSlideEffect = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
constant integer ThreeKillerDummyId= 'u000'
unit Dummy//
endglobals
function KillTrees takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
function UnitCheck takes unit caster, unit u returns boolean
return IsUnitEnemy(u, GetOwningPlayer(caster)) and not (IsUnitType(u, UNIT_TYPE_DEAD) and GetUnitTypeId(u) != 0) and IsUnitType(u, UNIT_TYPE_GROUND) and not IsUnitType(u, UNIT_TYPE_STRUCTURE)
endfunction
function Check_trees takes nothing returns boolean
local destructable dest = GetFilterDestructable()
local boolean result = false
if GetDestructableLife(dest) > 0.405 then
call ShowUnit(Dummy,true)
call SetUnitX(Dummy,GetWidgetX(dest))
call SetUnitY(Dummy,GetWidgetY(dest))
set result = IssueTargetOrder(Dummy,"harvest",dest)
call IssueImmediateOrder(Dummy,"stop")
call ShowUnit(Dummy,false)
set dest = null
return result
endif
set dest = null
return result
endfunction
function PS_KillTrees takes real x, real y, real radius returns nothing
local rect r=Rect(x-radius,y-radius,x+radius,y+radius)
if ThreeOnly then
call EnumDestructablesInRect(r,function Check_trees,function KillTrees)
else
call EnumDestructablesInRect(r,null,function KillTrees)
endif
call RemoveRect(r)
set r=null
endfunction
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// StartSpell
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function Shuriken_Act2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit a = LoadUnitHandle(hash,GetHandleId(t),50)
local unit b = LoadUnitHandle(hash,GetHandleId(t),51)
local group g = CreateGroup()
local unit n
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(a),DummyFour,GetUnitX(b),GetUnitY(b),0),'BTLF',2)
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(a),DummyFive,GetUnitX(b),GetUnitY(b),0),'BTLF',2)
call GroupEnumUnitsInRange(g,GetUnitX(b),GetUnitY(b),RasenDamageRadius,null)
loop
set n = FirstOfGroup(g)
exitwhen n == null
if UnitCheck(a, n) then
call UnitDamageTarget(a,n,RasenDamage+RasenDamageLvl*I2R(GetUnitAbilityLevel(a,AbilityID)),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
endif
call GroupRemoveUnit(g,n)
endloop
call DestroyGroup(g)
set t = null
set a = null
set b = null
set g = null
set n = null
endfunction
function Shuriken_Act takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit a = LoadUnitHandle(hash,GetHandleId(t),50)
local unit b = LoadUnitHandle(hash,GetHandleId(t),51)
local group g = CreateGroup()
local unit n
local real x =GetUnitX(b)+RasenSpeed*Cos(GetUnitFacing(b)*0.0174)
local real y =GetUnitY(b)+RasenSpeed*Sin(GetUnitFacing(b)*0.0174)
if ThreesKill then
call PS_KillTrees(x,y,RaidusKillThree)
endif
call GroupEnumUnitsInRange(g,GetUnitX(b),GetUnitY(b),RasenSlideRaidus,null)
loop
set n = FirstOfGroup(g)
exitwhen n == null
if IsUnitEnemy(n,GetOwningPlayer(a)) == true and UnitCheck(a, n) then
call SetUnitX(n,GetUnitX(b))
call SetUnitY(n,GetUnitY(b))
endif
call GroupRemoveUnit(g,n)
endloop
call DestroyGroup((g))
if IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) == false then
call SetUnitX(b, x)
call SetUnitY(b, y)
endif
call DestroyEffect(AddSpecialEffect(RasenSlideEffect,GetUnitX(b),GetUnitY(b)))
set t = null
set a = null
set b = null
set g = null
set n = null
endfunction
function Trig_RasenShuriken_Actions takes nothing returns nothing
local unit array v
local unit b
local effect e5
local timer t
local integer j = 1
local unit a = GetTriggerUnit()
local player p = GetOwningPlayer(a)
local real d = bj_RADTODEG * Atan2(GetSpellTargetY() - GetUnitY(a),GetSpellTargetX() - GetUnitX(a))
local unit k1 = CreateUnit(p,DummyThree,GetUnitX(a)+100*Cos(bj_DEGTORAD*(d-70)),GetUnitY(a)+100*Sin(bj_DEGTORAD*(d-70)),d+70)
local unit k2 = CreateUnit(p,DummyThree,GetUnitX(a)+100*Cos(bj_DEGTORAD*(d+50)),GetUnitY(a)+100*Sin(bj_DEGTORAD*(d+50)),d-70)
call PauseUnit(a,true)
call SetUnitInvulnerable( a , true )
call SetUnitAnimation(a,"spell channel two")
call SetUnitAnimation(k1,"spell one")
call SetUnitAnimation(k2,"spell three")
call DestroyEffect((AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",GetUnitX(k1),GetUnitY(k1))))
call DestroyEffect((AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",GetUnitX(k2),GetUnitY(k2))))
call PolledWait(0.10)
set e5 = AddSpecialEffectTarget("NewRasenshuriken.mdx",a,"hand rigth")
call PolledWait(0.50)
call SetUnitAnimation(a,"spell chanell five")
call DestroyEffect((AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",GetUnitX(k1),GetUnitY(k1))))
call DestroyEffect((AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",GetUnitX(k2),GetUnitY(k2))))
call RemoveUnit(k1)
call RemoveUnit(k2)
call TriggerSleepAction(0.60)
call SetUnitAnimation(a,"spell three")
call PolledWait(0.30)
call PauseUnit(a,false)
call SetUnitInvulnerable( a , false )
call DestroyEffect(e5)
set b = CreateUnit(p,DummyTwo,GetUnitX(a),GetUnitY(a),d)
set t = CreateTimer()
call SaveUnitHandle(hash,GetHandleId(t),50,a)
call SaveUnitHandle(hash,GetHandleId(t),51,b)
call TimerStart(t,0.03125,true, function Shuriken_Act)
call PolledWait(RasenSlideDur)
call PauseTimer(t)
call TimerStart(t,0.08,true, function Shuriken_Act2)
loop
exitwhen j < 8
set v[j] = CreateUnit(p,DummyOne,GetUnitX(b),GetUnitY(b),j*45)
set j = j + 1
endloop
call PolledWait(RasenDamageDur)
call RemoveUnit(b)
call PauseTimer(t)
call FlushChildHashtable(hash,GetHandleId(t))
call DestroyTimer(t)
loop
exitwhen j < 16
call RemoveUnit(v[j])
set v[j] = null
set j = j + 1
endloop
set a = null
set b = null
set e5 = null
set k1 = null
set k2 = null
set p = null
set t = null
endfunction
function Trig_RasenShuriken_Conditions takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
//===========================================================================
function InitTrig_RasenShuriken takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_RasenShuriken_Conditions ) )
call TriggerAddAction( t, function Trig_RasenShuriken_Actions )
set Dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),ThreeKillerDummyId,0.00,0.00,0.00)
call SetUnitPathing(Dummy,false)
call ShowUnit(Dummy,false)
call UnitAddAbility(Dummy,'Ahrl')
call UnitAddAbility(Dummy,'Aloc')
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_RasenRemove_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == DummyFive
endfunction
function Trig_RasenRemove_Actions takes nothing returns nothing
call RemoveUnit(GetTriggerUnit())
endfunction
//===========================================================================
function InitTrig_RasenRemove takes nothing returns nothing
set gg_trg_RasenRemove = CreateTrigger( )
local boolexpr b = Condition( function Trig_RasenRemove_Conditions )
call TriggerRegisterAnyUnitEventBJ( gg_trg_RasenRemove, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_RasenRemove, b )
call TriggerAddAction( gg_trg_RasenRemove, function Trig_RasenRemove_Actions )
set b = null
endfunction