function wtfisdis takes nothing returns nothing
endfunction
Name | Type | is_array | initial_value |
u | unit | No |
struct List
integer size = 0
integer array data[99]
public static method create takes nothing returns List
local thistype this = thistype.allocate()
return this
endmethod
public method Add takes integer i returns nothing
set data[size] = i
set size = size + 1
endmethod
public method Remove takes integer id returns nothing
local integer i = 0
local integer j = 0
loop
exitwhen i >= size
if data[i] == id then
set j = i
loop
exitwhen j >= size
set data[j] = data[j + 1]
set j = j + 1
endloop
set size = size - 1
set j = 0
set i = size + 1
endif
set i = i + 1
endloop
endmethod
endstruct
globals
List instances
integer debugCounter = 0
endglobals
struct Rebirth
static constant integer DUMMY_TYPE = 'h000'
static constant real DUMMY_DURATION = 5
static constant string respawnEffect = "Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl"
integer u
unit deadUnit
location l
real counter
unit egg
static method onInit takes nothing returns nothing
set instances = List.create()
endmethod
static method create takes unit u returns thistype
local thistype this = thistype.allocate()
set this.u = GetUnitTypeId(u)
set this.counter = 0
set this.deadUnit = u
set this.l = GetUnitLoc(u)
set this.egg = CreateUnitAtLoc(GetOwningPlayer(u), DUMMY_TYPE, this.l, 0)
call instances.Add(this)
return this
endmethod
method destroy takes nothing returns nothing
set this.u = 0
call RemoveLocation(this.l)
call instances.Remove(this)
call this.deallocate()
endmethod
method Update takes nothing returns nothing
set debugCounter = debugCounter + 1
set this.counter = this.counter + 0.03
if this.counter > DUMMY_DURATION then
call KillUnit(this.egg)
call AddSpecialEffectLoc(respawnEffect, this.l)
if IsUnitIdType(this.u, UNIT_TYPE_HERO) == false then
call CreateUnitAtLoc(Player(0), this.u, this.l, 0)
call this.destroy()
else
call ReviveHeroLoc(this.deadUnit, this.l, false)
call this.destroy()
endif
endif
endmethod
endstruct