Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. scope Ultimate initializer init
  2.     globals
  3.         // Ability Rawcode.
  4.         private constant integer    ABIL_ID              = 'A000'
  5.         // Tornado Rawcode.
  6.         private constant integer    TORNADO_ID           = 'h000'
  7.         // Amount of Tornado's created.
  8.         private constant integer    MAX_TORNADOS         = 6
  9.         // Distance that the Tornado's are created at.
  10.         private constant real       TORNADO_OFFSET       = 600.00  
  11.         // The periodic time to move tornados, and units.
  12.         private constant real       PERIODIC             = 0.03125
  13.     endglobals
  14.    
  15.     native IsUnitAlive takes unit whichUnit returns boolean
  16.        
  17.     private struct Ultimate
  18.         unit caster
  19.         player owner
  20.         integer level
  21.         real casterX
  22.         real casterY
  23.         unit array tornado[MAX_TORNADOS]
  24.         real array tornadoX[MAX_TORNADOS]
  25.         real array tornadoY[MAX_TORNADOS]
  26.        
  27.         static method onLoop takes nothing returns nothing  
  28.             local thistype this = thistype.allocate()
  29.             if (IsUnitAlive(this.caster)) then
  30.             endif
  31.         endmethod
  32.        
  33.         static method onCreate takes unit whichUnit returns thistype
  34.             local thistype this = thistype.allocate()
  35.             local timer t = NewTimer()
  36.             local integer index = 1
  37.             set this.caster=whichUnit
  38.             set this.owner=GetOwningPlayer(whichUnit)
  39.             set this.level=GetUnitAbilityLevel(whichUnit,ABIL_ID)
  40.             set this.casterX=GetUnitX(whichUnit)
  41.             set this.casterY=GetUnitY(whichUnit)
  42.             loop
  43.                 exitwhen index>=MAX_TORNADOS
  44.                 set tornado[index]=CreateUnit(this.owner,TORNADO_ID,this.casterX,this.casterY,270.00)
  45.                 set index=index+1
  46.             endloop
  47.             call SetTimerData(t,this)
  48.             call TimerStart(t,PERIODIC,true,function thistype.onLoop)
  49.             set t=null
  50.             return this
  51.         endmethod
  52.     endstruct
  53.    
  54.     private function Actions takes nothing returns boolean
  55.         call Ultimate.onCreate(GetTriggerUnit())
  56.         return false
  57.     endfunction
  58.    
  59.     private function init takes nothing returns nothing
  60.         local trigger trig = CreateTrigger()
  61.         call GT_RegisterStartsEffectEvent(trig,ABIL_ID)
  62.         call TriggerAddCondition(trig,Condition(function Actions))
  63.         set trig=null
  64.     endfunction
  65. endscope
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement