Name | Type | is_array | initial_value |
BZ_Ability_Level | integer | Yes | |
BZ_Boolean | boolean | Yes | |
BZ_Caster | unit | Yes | |
BZ_Damage | real | Yes | |
BZ_Damage_Per_Level | real | No | |
BZ_Destroy_Destructibles | boolean | No | |
BZ_Dummy | unit | Yes | |
BZ_Dummy_Ability | abilcode | No | |
BZ_Facing | real | Yes | |
BZ_Filaments_Per_Level | integer | No | |
BZ_Index | integer | No | |
BZ_Integer | integer | No | |
BZ_Location | location | Yes | |
BZ_Loop_Location | location | Yes | |
BZ_Loop_Location2 | location | Yes | |
BZ_Max_Index | integer | No | |
BZ_Owner | player | Yes | |
BZ_Temp_Loc | location | Yes | |
BZ_Total_Filament_Count | integer | Yes | |
BZ_Usage_Counter | integer | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
/*********************************************************************
*
* Sub Zero v4.0.0.0
* By Magtheridon96
*
* Description:
* ------------
*
* - This spell is a nova spell that creates projectiles of ice
* that emerge from the center of the casting unit even while he
* is moving.
*
* Requirements:
* -------------
*
* - CTL [By Nestharus]
* - WorldBounds [By Nestharus]
* - SpellEffectEvent [By Bribe]
* - Table [By Bribe]
*
* Implementation:
* ---------------
*
* - Implement all the required systems
* - Copy this code into a new trigger
* - Paste all the object data from the Object editor into your map
* - Configure the system
* - Done!
*
*********************************************************************/
library SubZero requires CTL, WorldBounds, SpellEffectEvent
globals
// Ability Code
private constant integer ABIL_CODE = 'A000'
// Dummy Code
private constant integer DUMMY = 'h000'
// Projectile Speed
private constant real VELOCITY = 18.0
// Attack Type
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL
// Damage Type
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_MAGIC
// Max Collision size in Map
private constant real MAX_COLLISION = 197.0
// Missile Damage Radius
private constant real PROJ_DMG_RADIUS = 175.0
endglobals
private function GetMissiles takes integer level returns integer
return 6 + level * 2
endfunction
private function GetDamage takes integer level returns real
return level * 70.0
endfunction
private function GetRange takes integer level returns real
return 550. + level * 50.
endfunction
private function TargetFilter takes unit u, player p, real x, real y returns boolean
return IsUnitEnemy(u, p) and not IsUnitType(u, UNIT_TYPE_DEAD) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) and IsUnitInRangeXY(u, x, y, PROJ_DMG_RADIUS)
endfunction
private struct Spell extends array
static Table data
static Table array missiles
static Table array hit
static player array owner
static unit array caster
static real array distance
static real array damage
// You mad Jesus4Lyf?
implement CTL
local integer k
local integer i
local unit u
local unit v
local real x
local real y
implement CTLExpire
set distance[this] = distance[this] + VELOCITY
set i = 0
loop
set u = missiles[this].unit[i]
exitwhen null == u
set k = GetHandleId(u)
set x = GetUnitX(caster[this]) + distance[this] * data.real[k * 2]
set y = GetUnitY(caster[this]) + distance[this] * data.real[k * 2 + 1]
if x < WorldBounds.maxX and x > WorldBounds.minX and y < WorldBounds.maxY and y > WorldBounds.minY and GetWidgetLife(u)>0.405 then
call SetUnitX(u, x)
call SetUnitY(u, y)
// You mad Rising_Dusk?
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, PROJ_DMG_RADIUS + MAX_COLLISION, null)
loop
set v = FirstOfGroup(bj_lastCreatedGroup)
exitwhen null == v
set k = GetHandleId(v)
if not hit[this].boolean.has(k) then
if TargetFilter(v, owner[this], x, y) then
call UnitDamageTarget(caster[this], v, damage[this], false, false, ATTACK_TYPE, DAMAGE_TYPE, null)
set hit[this].boolean[k] = true
endif
endif
call GroupRemoveUnit(bj_lastCreatedGroup, v)
endloop
else
call destroy()
set caster[this] = null
set owner[this] = null
call hit[this].destroy()
set i = 0
loop
set u = missiles[this].unit[i]
exitwhen null == u
call KillUnit(u)
set i = i + 1
endloop
call missiles[this].destroy()
exitwhen true
endif
set i = i + 1
endloop
implement CTLNull
implement CTLEnd
static method start takes unit u, integer lvl returns nothing
local thistype this = create()
local integer m = GetMissiles(lvl)
local integer i = m - 1
local integer k = 0
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real r = 0.03125 * GetRange(lvl) / VELOCITY
set caster[this] = u
set owner[this] = GetTriggerPlayer()
set distance[this] = 0.0
set damage[this] = GetDamage(lvl)
set missiles[this] = Table.create()
set hit[this] = Table.create()
loop
set u = CreateUnit(owner[this], DUMMY, x, y, i * 360.0 / m)
set k = GetHandleId(u)
set data.real[k*2] = Cos(i * 6.2831853 / m)
set data.real[k*2+1] = Sin(i * 6.2831853 / m)
call UnitApplyTimedLife(u, 'BTLF', r)
set missiles[this].unit[i] = u
// You mad Nestharus?
exitwhen i == 0
set i = i - 1
endloop
set u = null
endmethod
static method run takes nothing returns nothing
call start(GetTriggerUnit(), GetUnitAbilityLevel(GetTriggerUnit(), ABIL_CODE))
endmethod
static method onInit takes nothing returns nothing
call RegisterSpellEffectEvent(ABIL_CODE, function thistype.run)
// You mad Vexorian?
set data = Table.create()
endmethod
endstruct
endlibrary
//TESH.scrollpos=45
//TESH.alwaysfold=0
library CTL /* v1.1.0.0
*************************************************************************************
*
* CTL or Constant Timer Loop provides a loop for constant merged timers of timeout .03125
*
* Similar to T32 but pauses timer when no structs have instances and removes structs
* from timer trigger when those structs have no instances.
*
* This can also create new timers after destroying a previous timer and generates less
* code in the module. It also generates no triggers so long as the module is implemented
* at the top of the struct.
*
************************************************************************************
*
* static method create takes nothing returns thistype
* - CTL
* - Creates new timer
*
* method destroy takes nothing returns nothing
* - CTL
* - Destroys created timer
*
* Module
*
* module CTL
* - Declare locals in here
* - Run ini code
* module CTLExpire
* - Run timer code
* -
* - thistype this refers to current expiring timer\
* module CTLNull
* - Null locals here
* module CTLEnd
*
* Example of Constant Timer Loop 32
* struct MyTimer extends array
* integer myValue
* implement CTL
* local string s="My value is "
* implement CTLExpire
* call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,s+I2S(myValue))
* call destroy()
* implement CTLNull
* set s=null //pointless, but shows how to use null block
* implement CTLEnd
* endstruct
*
* set MyTimer.create().myValue=16 //will display "My value is 16" in 5 seconds
*
* module CT32
* - A constant running timer. Useful when the timer is pretty much never ever
* - going to stop. Also allows control over loop (just provides an expiring timer).
* - Code goes in between two methods
* module CT32End
*
* Example of Constant Timer 32
*
* //Displays
* // 1
* // 2
* // 3
* struct MyTimers extends array
* integer myValue
* thistype next
* implement CTL2
* local thistype this=thistype(0).next
* loop
* exitwhen 0==this
* call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,s+I2S(myValue))
* set this=next
* endloop
* implement CTL2End
* private static method onInit takes nothing returns nothing
* set thistype(0).next=1
* set thistype(1).next=2
* set thistype(2).next=3
* set thistype(1).myValue=1
* set thistype(2).myValue=2
* set thistype(3).myValue=3
* endmethod
* endstruct
*
************************************************************************************/
globals
private integer ic=0 //instance count
private integer tc=0 //timer count
private integer array rf //root first
private integer array n //next
private integer array p //previous
private integer array th //timer head
private integer array ns //next stack
private trigger t=CreateTrigger()
private timer m=CreateTimer()
private triggercondition array ct
private conditionfunc array rc
endglobals
private function E takes nothing returns nothing
local integer i=ns[0]
set ns[0]=0
loop
exitwhen 0==i
if (0==p[i]) then
if (0==n[i]) then
call TriggerRemoveCondition(t,ct[th[i]])
set ct[th[i]]=null
set tc=tc-1
set rf[th[i]]=0
else
set rf[th[i]]=n[i]
set p[n[i]]=0
endif
else
set p[n[i]]=p[i]
set n[p[i]]=n[i]
endif
set n[i]=n[0]
set n[0]=i
set i=ns[i]
endloop
if (0==tc) then
call PauseTimer(m)
else
call TriggerEvaluate(t)
endif
endfunction
private function CT takes integer r returns integer
local integer i
local integer f
if (0==n[0]) then
set i=ic+1
set ic=i
else
set i=n[0]
set n[0]=n[i]
endif
set th[i]=r
set ns[i]=-1
set f=rf[r]
if (0==f) then
set n[i]=0
set p[i]=0
set rf[r]=i
set ct[r]=TriggerAddCondition(t,rc[r])
if (0==tc) then
call TimerStart(m,.031250000,true,function E)
endif
set tc=tc+1
else
set n[i]=f
set p[i]=0
set p[f]=i
set rf[r]=i
endif
return i
endfunction
private function DT takes integer t returns nothing
debug if (0>ns[t]) then
set ns[t]=ns[0]
set ns[0]=t
debug else
debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"TIMER LOOP ERROR: ATTEMPT TO DESTROY NULL TIMER")
debug endif
endfunction
private keyword r
private keyword e
module CTL
static integer r
static method create takes nothing returns thistype
return CT(r)
endmethod
method destroy takes nothing returns nothing
call DT(this)
endmethod
static method e takes nothing returns boolean
local thistype this=rf[r]
endmodule
module CTLExpire
loop
exitwhen 0==this
endmodule
module CTLNull
set this=n[this]
endloop
endmodule
module CTLEnd
return false
endmethod
private static method onInit takes nothing returns nothing
set r=ic+1
set ic=r
set rc[r]=Condition(function thistype.e)
endmethod
endmodule
module CT32
static method e takes nothing returns boolean
endmodule
module CT32End
return false
endmethod
private static method onInit takes nothing returns nothing
call TriggerAddCondition(t,Condition(function thistype.e))
if (0==tc) then
call TimerStart(m,.031250000,true,function E)
endif
set tc=tc+1
endmethod
endmodule
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library WorldBounds
//struct WorldBounds extends array
//static readonly rect world
// same as GetWorldBounds()
//static readonly region worldRegion
// contains world for triggers
//static readonly real maxX
//static readonly real maxY
//static readonly real minX
//static readonly real minY
//static readonly real centerX
//static readonly real centerY
private module WorldBoundInit
private static method onInit takes nothing returns nothing
set world=GetWorldBounds()
set maxX=GetRectMaxX(world)
set maxY=GetRectMaxY(world)
set minX=GetRectMinX(world)
set minY=GetRectMinY(world)
set centerX=(maxX+minX)/2
set centerY=(minY+maxY)/2
set worldRegion=CreateRegion()
call RegionAddRect(worldRegion,world)
endmethod
endmodule
struct WorldBounds extends array
readonly static real maxX
readonly static real maxY
readonly static real minX
readonly static real minY
readonly static real centerX
readonly static real centerY
readonly static rect world
readonly static region worldRegion
implement WorldBoundInit
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//============================================================================
// SpellEffectEvent
// - Version 1.0.0.1
//
// API
// ---
// RegisterSpellEffectEvent(integer abil, code onCast)
//
// Requires
// --------
// Table: hiveworkshop.com/forums/showthread.php?t=188084
// RegisterPlayerUnitEvent: hiveworkshop.com/forums/showthread.php?t=203338
//
library SpellEffectEvent requires RegisterPlayerUnitEvent, Table
globals
private Table tb
endglobals
//============================================================================
function RegisterSpellEffectEvent takes integer abil, code onCast returns nothing
if not tb.handle.has(abil) then
set tb.trigger[abil] = CreateTrigger()
endif
call TriggerAddCondition(tb.trigger[abil], Filter(onCast))
endfunction
//============================================================================
private module M
static method onCast takes nothing returns boolean
return TriggerEvaluate(tb.trigger[GetSpellAbilityId()])
endmethod
private static method onInit takes nothing returns nothing
set tb = Table.create()
call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_EFFECT, function thistype.onCast)
endmethod
endmodule
//============================================================================
private struct S extends array
implement M
endstruct
endlibrary
//TESH.scrollpos=9
//TESH.alwaysfold=0
/**************************************************************
*
* RegisterPlayerUnitEvent
* v4.1.0.0
* By Magtheridon96
*
* This library was made to replace that GTrigger
* monster by Jesus4Lyf at TheHelper. I would like
* to give a special thanks to Bribe and azlier for
* improving this library. For modularity, it only
* supports player unit events.
*
* Functions passed to RegisterPlayerUnitEvent must
* return false. They can return nothing as well.
*
* API:
* ----
*
* function RegisterPlayerUnitEvent
* takes
* playerunitevent whichEvent : The event that will be registered.
* code whichFunction : The function that will fire when the event occurs.
* returns
* nothing
*
**************************************************************/
library RegisterPlayerUnitEvent // Special Thanks to Bribe and azlier
globals
private trigger array t
private boolexpr array b
endglobals
function RegisterPlayerUnitEvent takes playerunitevent p, code c returns nothing
local integer i = GetHandleId(p)
local integer k = 15
if null == t[i] then
set t[i] = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(t[i], Player(k), p, null)
exitwhen 0 == k
set k = k - 1
endloop
set b[i] = Filter(c)
else
call TriggerClearConditions(t[i])
set b[i] = Or(b[i], Filter(c))
endif
call TriggerAddCondition(t[i], b[i])
endfunction
endlibrary
//TESH.scrollpos=194
//TESH.alwaysfold=0
library Table // made by Bribe, special thanks to Nestharus, version 3.0.0.0
/*
API
------------
struct Table
| static method create takes nothing returns Table
| create a new Table
|
| method destroy takes nothing returns nothing
| destroy it
|
| method flush takes nothing returns nothing
| flush all stored values inside of it
|
| method remove takes integer key returns nothing
| remove the value at index "key"
|
| method operator []= takes integer key, $TYPE$ value returns nothing
| assign "value" to index "key"
|
| method operator [] takes integer key returns $TYPE$
| load the value at index "key"
|
| method has takes integer key returns boolean
| whether or not the key was assigned
|
----------------
struct TableArray
| static method operator [] takes integer array_size returns TableArray
| create a new array of Tables of size "array_size"
|
| method destroy takes nothing returns nothing
| destroy it
|
| method flush takes nothing returns nothing
| flush and destroy it
|
| method operator size takes nothing returns integer
| returns the size of the TableArray
|
| method operator [] takes integer key returns Table
| returns a Table accessible exclusively to index "key"
*/
globals
private hashtable ht = InitHashtable() //The last hashtable you need
private integer more = 2 //Index generation for Tables (above 2)
private integer less = 0 //Index generation for TableArrays (below 0)
endglobals
private struct dex extends array
static method operator size takes nothing returns Table
return 1
endmethod
static method operator list takes nothing returns Table
return 2
endmethod
endstruct
private struct handles extends array
method has takes integer key returns boolean
return HaveSavedHandle(ht, this, key)
endmethod
method remove takes integer key returns nothing
call RemoveSavedHandle(ht, this, key)
endmethod
endstruct
private struct agents extends array
method operator []= takes integer key, agent value returns nothing
call SaveAgentHandle(ht, this, key, value)
endmethod
endstruct
//! textmacro NEW_ARRAY_BASIC takes SUPER, FUNC, TYPE
private struct $TYPE$s extends array
method operator [] takes integer key returns $TYPE$
return Load$FUNC$(ht, this, key)
endmethod
method operator []= takes integer key, $TYPE$ value returns nothing
call Save$FUNC$(ht, this, key, value)
endmethod
method has takes integer key returns boolean
return HaveSaved$SUPER$(ht, this, key)
endmethod
method remove takes integer key returns nothing
call RemoveSaved$SUPER$(ht, this, key)
endmethod
endstruct
private module $TYPE$m
method operator $TYPE$ takes nothing returns $TYPE$s
return this
endmethod
endmodule
//! endtextmacro
//! textmacro NEW_ARRAY takes FUNC, TYPE
private struct $TYPE$s extends array
method operator [] takes integer key returns $TYPE$
return Load$FUNC$Handle(ht, this, key)
endmethod
method operator []= takes integer key, $TYPE$ value returns nothing
call Save$FUNC$Handle(ht, this, key, value)
endmethod
endstruct
private module $TYPE$m
method operator $TYPE$ takes nothing returns $TYPE$s
return this
endmethod
endmodule
//! endtextmacro
//! runtextmacro NEW_ARRAY_BASIC("Real", "Real", "real")
//! runtextmacro NEW_ARRAY_BASIC("Boolean", "Boolean", "boolean")
//! runtextmacro NEW_ARRAY_BASIC("String", "Str", "string")
//! runtextmacro NEW_ARRAY("Player", "player")
//! runtextmacro NEW_ARRAY("Widget", "widget")
//! runtextmacro NEW_ARRAY("Destructable", "destructable")
//! runtextmacro NEW_ARRAY("Item", "item")
//! runtextmacro NEW_ARRAY("Unit", "unit")
//! runtextmacro NEW_ARRAY("Ability", "ability")
//! runtextmacro NEW_ARRAY("Timer", "timer")
//! runtextmacro NEW_ARRAY("Trigger", "trigger")
//! runtextmacro NEW_ARRAY("TriggerCondition", "triggercondition")
//! runtextmacro NEW_ARRAY("TriggerAction", "triggeraction")
//! runtextmacro NEW_ARRAY("TriggerEvent", "event")
//! runtextmacro NEW_ARRAY("Force", "force")
//! runtextmacro NEW_ARRAY("Group", "group")
//! runtextmacro NEW_ARRAY("Location", "location")
//! runtextmacro NEW_ARRAY("Rect", "rect")
//! runtextmacro NEW_ARRAY("BooleanExpr", "boolexpr")
//! runtextmacro NEW_ARRAY("Sound", "sound")
//! runtextmacro NEW_ARRAY("Effect", "effect")
//! runtextmacro NEW_ARRAY("UnitPool", "unitpool")
//! runtextmacro NEW_ARRAY("ItemPool", "itempool")
//! runtextmacro NEW_ARRAY("Quest", "quest")
//! runtextmacro NEW_ARRAY("QuestItem", "questitem")
//! runtextmacro NEW_ARRAY("DefeatCondition", "defeatcondition")
//! runtextmacro NEW_ARRAY("TimerDialog", "timerdialog")
//! runtextmacro NEW_ARRAY("Leaderboard", "leaderboard")
//! runtextmacro NEW_ARRAY("Multiboard", "multiboard")
//! runtextmacro NEW_ARRAY("MultiboardItem", "multiboarditem")
//! runtextmacro NEW_ARRAY("Trackable", "trackable")
//! runtextmacro NEW_ARRAY("Dialog", "dialog")
//! runtextmacro NEW_ARRAY("Button", "button")
//! runtextmacro NEW_ARRAY("TextTag", "texttag")
//! runtextmacro NEW_ARRAY("Lightning", "lightning")
//! runtextmacro NEW_ARRAY("Image", "image")
//! runtextmacro NEW_ARRAY("Ubersplat", "ubersplat")
//! runtextmacro NEW_ARRAY("Region", "region")
//! runtextmacro NEW_ARRAY("FogState", "fogstate")
//! runtextmacro NEW_ARRAY("FogModifier", "fogmodifier")
//! runtextmacro NEW_ARRAY("Hashtable", "hashtable")
struct Table extends array
// Implement modules for intuitive type-syntax
implement realm
implement booleanm
implement stringm
implement playerm
implement widgetm
implement destructablem
implement itemm
implement unitm
implement abilitym
implement timerm
implement triggerm
implement triggerconditionm
implement triggeractionm
implement eventm
implement forcem
implement groupm
implement locationm
implement rectm
implement boolexprm
implement soundm
implement effectm
implement unitpoolm
implement itempoolm
implement questm
implement questitemm
implement defeatconditionm
implement timerdialogm
implement leaderboardm
implement multiboardm
implement multiboarditemm
implement trackablem
implement dialogm
implement buttonm
implement texttagm
implement lightningm
implement imagem
implement ubersplatm
implement regionm
implement fogstatem
implement fogmodifierm
implement hashtablem
method operator handle takes nothing returns handles
return this
endmethod
method operator agent takes nothing returns agents
return this
endmethod
// set this = a[GetSpellAbilityId()]
method operator [] takes integer key returns Table
return LoadInteger(ht, this, key)
endmethod
// set a[389034] = 8192
method operator []= takes integer key, Table a returns nothing
call SaveInteger(ht, this, key, a)
endmethod
// set b = a.has(2493223)
method has takes integer key returns boolean
return HaveSavedInteger(ht, this, key)
endmethod
// call a.remove(294080)
method remove takes integer key returns nothing
call RemoveSavedInteger(ht, this, key)
endmethod
// Remove all data from a Table instance
method flush takes nothing returns nothing
call FlushChildHashtable(ht, this)
endmethod
// local Table a = Table.create()
static method create takes nothing returns Table
local Table this = dex.list[0]
if this == 0 then
set more = more + 1
set this = more
else
set dex.list[0] = dex.list[this]
call dex.list.remove(this)
endif
debug set dex.list[this] = -1
return this
endmethod
// Removes all data from a Table instance and recycles its index.
//
// call a.destroy()
//
method destroy takes nothing returns nothing
debug if dex.list[this] != -1 then
debug call BJDebugMsg("Table Error: Tried to double-free instance: " + I2S(this))
debug return
debug endif
call this.flush()
set dex.list[this] = dex.list[0]
set dex.list[0] = this
endmethod
endstruct
struct TableArray extends array
//Returns a new TableArray to do your bidding. Simply use:
//
// local TableArray ta = TableArray[array_size]
//
static method operator [] takes integer array_size returns TableArray
local Table a = dex.size[array_size] //Get the unique recycle list for this array size
local TableArray this = a[0] //The last-destroyed TableArray that had this array size
debug if array_size <= 0 then
debug call BJDebugMsg("TypeError: Invalid specified TableArray size: " + I2S(array_size))
debug return 0
debug endif
if this == 0 then
set less = less - array_size
set this = less
else
set a[0] = a[this] //Set the last destroyed to the last-last destroyed
call a.remove(this) //Clear hash memory
endif
set dex.size[this] = array_size //This remembers the array size
return this
endmethod
//Returns the size of the TableArray
method operator size takes nothing returns integer
return dex.size[this]
endmethod
//da[integer a].unit[integer b] = unit u
//da[integer a][integer c] = integer d
//
//Inline-friendly when not running in debug mode
//
method operator [] takes integer key returns Table
static if DEBUG_MODE then
local integer i = this.size
if i == 0 then
call BJDebugMsg("IndexError: Tried to get key from invalid TableArray instance: " + I2S(this))
return 0
elseif key < 0 or key >= i then
call BJDebugMsg("IndexError: Tried to get key [" + I2S(key) + "] from outside TableArray bounds: " + I2S(i))
return 0
endif
endif
return this + key
endmethod
//Destroys a TableArray without flushing it; assumed you'd call .flush()
//if you want it flushed too. This is public so that if you are flushing
//instances the whole time you don't waste efficiency when disposing the
//TableArray.
//
method destroy takes nothing returns nothing
local Table a = dex.size[this.size]
debug if this.size <= 0 then
debug call BJDebugMsg("TypeError: Tried to destroy an invalid TableArray: " + I2S(this))
debug return
debug endif
if a == 0 then
//Create an array to index recycled instances with their array size
set a = Table.create()
set dex.size[this.size] = a
endif
call dex.size.remove(this) //Clear the array size from hash memory
set a[this] = a[0]
set a[0] = this
endmethod
//All you need to know about this one is that it won't hit the op limit.
private static method clean takes Table a, integer end returns nothing
local integer i = a + 5000
if i < end then
call clean.evaluate(i, end)
set end = i
endif
loop
call a.flush()
set a = a + 1
exitwhen a == end
endloop
endmethod
//Flushes the TableArray and also destroys it. Doesn't get any more
//similar to the FlushParentHashtable native than this.
//
method flush takes nothing returns nothing
local integer end = this.size + this
debug if this == end then
debug call BJDebugMsg("TypeError: Tried to flush an invalid TableArray instance: " + I2S(this))
debug return
debug endif
call clean.evaluate(this, end)
call this.destroy()
endmethod
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Speedtest // For all those speedfags out there like me.
globals
private constant integer ID = 'O000'
private constant integer AB = 'A000'
private constant integer MAX_LVL = 4
private integer OD = 0
private unit U = null
private camerasetup C = CreateCameraSetup()
endglobals
private function cast takes nothing returns nothing
call IssueImmediateOrderById(U,OD)
endfunction
private function LagTest takes nothing returns nothing
local integer i = 8
set U = CreateUnit(Player(0),ID, 0, 0, 270)
call CameraSetupApply(C,true,false)
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1, " 3...")
call TriggerSleepAction(1.0) // sue me :P
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1, " 2...")
call TriggerSleepAction(1.0) // sue me :P
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1, " 1...")
call TriggerSleepAction(1.0) // sue me :P
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1, " Starting...")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,20," 1 cast!")
call SelectHeroSkill(U,AB)
call SetHeroLevel(U,10,false)
call SetUnitAbilityLevel(U,AB,MAX_LVL)
call cast()
call TriggerSleepAction(5.0) // sue me :P
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,20," 2 casts!")
call cast()
call cast()
call TriggerSleepAction(5.0) // sue me :P
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,20," 8 casts!")
loop
call cast()
set i=i-8
exitwhen i==0
call TriggerSleepAction(0) // sue me :P
endloop
call TriggerSleepAction(5.0) // sue me :P
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,20," >9000 casts!")
loop
call cast()
call TriggerSleepAction(0) // sue me :P
endloop
endfunction
private struct Inits extends array
private static method onInit takes nothing returns nothing
set OD = OrderId("deathcoil")
call CameraSetupSetField(C, CAMERA_FIELD_ANGLE_OF_ATTACK, 304.0, 0.0)
call CameraSetupSetField(C, CAMERA_FIELD_FARZ, 5000.0, 0.0)
call CameraSetupSetField(C, CAMERA_FIELD_FIELD_OF_VIEW, 70.0, 0.0)
call CameraSetupSetField(C, CAMERA_FIELD_ROLL, 0.0, 0.0)
call CameraSetupSetField(C, CAMERA_FIELD_ROTATION, 90.0, 0.0)
call CameraSetupSetField(C, CAMERA_FIELD_TARGET_DISTANCE, 2700.0, 0.0)
call CameraSetupSetField(C, CAMERA_FIELD_ZOFFSET, 0.0, 0.0)
call LagTest()
endmethod
endstruct
endlibrary