- Joined
- Aug 27, 2011
- Messages
- 41
SpellObjs
Version: 0.41
LastUpdated: 09/30/2011 at 6:00pm (Central Time)
Introduction
This is my new system for holding all the data related to timed spells (Channeled spells, Dots/Hots, Channeled Dots, Channeled AoEs, Dots/Hots AoEs, passive spell proc). It completely removes the need for Hashtables. It recycles the timers that it uses, and has a built-in DamageTarget() function. Right now I've coded it for Channeled Spells, and Dots, AoEs are coming soon, then Passives. Also I might add any suggested features.Requires: vJass
Credits:
- The Creator/s of vJass
- watermelon_1234, for help with some syntax issues
- Magtheridon96, for constructive criticism and help with syntax for structs and increasing speed and system usability.
- Bribe, for constructive criticism and help with general syntax issues, information on better common practices, and speed issues.
- PurgeandFire111, for constructive criticism and a push in the right direction.
- Troll-Brain, for being helpful
Instructions
- Copy SpellObjs into the Map Header in the Trigger Editor.
To use
- Copy and paste the given templates, into a new trigger. Edit it to your needs.
Testmap is at the bottom of post.
EDIT: [9-28-11] Updated code and test map to improve the system based on everyone's feedback.
EDIT: [9-30-11] Updated code based on Bribe's feedback.
Alright here is the Code:
JASS:
//--------------------------------------------------------------------------
//
// SpellObjs
//
// Made by: Fox536
// Date: 09/24/2011
// Version: 0.41
//
//==========================================================================
// This is a system to better hold the info, for MUI Spell, that
// reduces the need to save all your spell's information into a Hashtable,
// down to one Integer save and load.
// Useful for channeled abilities, Dots, Hots, and any other spell that
// might need a timed events.
//
//==========================================================================
// Features
// - Recycling
// - Double Free protection
// - Holds CasterUnit, TargetUnit, Damage, Amount of times the spell Hits.
// - Dots, Hots, and other multi-hit Spells now added in for easy use.
// - What kind of Target the Spell has.
// - Built-in Damage Target handles targetUnit, or targetDestructable
// right now.
//
//==========================================================================
// Planned Features
// - Seperate Real for Allied targets' healing/dmg as well.
// - Real for Range/AoE, for AoE Spells.
// - Array for spell Effects for Enemy targets Spell Effects.
// - Array for spell Effects for Allied targets Spell Effects.
//
//==========================================================================
// Globals
// > group Fox_SpellObjGroup - This is temporarily holds the Group for enumeration.
// > hashtable Fox_SpellObjHash - This is the Hashtable for loading and saving the index of the spell.
//
//==========================================================================
// Struct Methods
// - Private Static
// > None
//
// - Public Static
// > create - Create a new object.
// public static method create takes nothing returns thistype
//
// > getSpellObj - Returns the SpellObj with the given timer.
// public method getSpellObj takes timer objCastTimer return thistype
//
// - Private
// > setupNew - Sets up the Spell to default
// private method setupNew takes nothing return nothing
//
// > resetSpell - Clears the Spell to be reused
// private method resetSpell takes integer spellTypeId, real duration, boolean repeating, real damage returns nothing
//
// > booleanToBoolExpr - Converts the filter variable to boolexpr.
// private static method booleanToBoolExpr takes nothing return boolean
//
// - Public
// > free - Recycle object.
// public method free takes nothing returns nothing
//
// > clear - Clears the SpellObj removing memory leak
// public method clear takes boolean recycle returns nothing
//
// > tick - Checks if the spell can be Ticked
// - If it can it increases tickCount then returns true.
// - Otherwise it clears and recycles itself, then returns false.
// public method tick takes nothing returns boolean
//
// > setupUnitTarget - Sets the timer to be used for Spell Targeting Unit
// public method setupUnitTarget takes real duration, integer repeatTimes, code func, unit caster, unit target, real damage returns boolean
//
// > setupCoorTarget - Sets the timer to be used for Spell Targeting Coors
// public method setupCoorTarget takes real duration, integer repeatTimes, code func, unit caster, real x, real y, real damage returns boolean
//
// > setupSelfTarget - Sets the timer to be used for Spell Targeting Self
// public method setupSelfTarget takes real duration, integer repeatTimes, code func, unit caster, real damage returns boolean
//
// > setupDestructableTarget - Sets the timer to be used for Spell Targeting Destructable
// public method setupDestructableTarget takes real duration, integer repeatTimes, code func, unit caster, destructable target, real damage returns boolean
//
// > damageTarget - Damages the Target
// public method damageTarget takes nothing returns nothing
//
// > damageAoETargets - Damages the Targets of the AoE, either at the targetX, and targetY or using the caster's position.
// public method damageAoETargets takes code filterFunc returns nothing
//
// > getTarget - returns the Target of the spell
// public method getTarget takes nothing returns unit
//
//==========================================================================
// Struct Member's (Variable)
// - Private Static
// > integer instanceCount - The count of current Objects.
// > integer instanceToRecycle - The current object to recycle.
//
// - Public Static
// > None
//
// - Private
// - Timer variables
// > timer castTimer - The cast Timer for the spell.
// > real castTime - The duration of the Timer.
// > boolean castTimerRepeats - Whether or not the Timer Repeats.
// > integer tickCount - Number of Ticks so far
// > integer tickMax - Max number of Ticks
//
// - Spell Target variables
// > integer spellTargetType - The Target Type of the spell.
// > 1 = Unit Targeted Spell
// > 2 = Point Targeted Spell
// > 3 = No Target (Self-Cast/Self-Location Cast)
// > 4 = Targeted Destructable
// > unit casterUnit - The Unit casting the spell.
// > unit targetUnit - The Unit targeted by the spell, for spellType 1 (Unit targeted Spell).
// > real targetX - The Real X targeted by the spell, for spellType 2 (Point Targeted Spell).
// > real targetY - The Real Y targeted by the spell, for spellType 2 (Point Targeted Spell).
// > destructable targetDestructable - The Destructable targeted by the spell, for spellType 4 (Destructable targeted Spell).
//
// - Spell Data variables
// > real damageToWidget - Damage to do to the widget
// > real spellRange - The AoE of the Spell
// > bool filter - Used to convert the boolean value to a boolexpr
//
// - Recycling variables
// > thistype recycleNext - Recycle Stack
// > boolean recycled - The Index of the spellObj.
//
// - Misc
// > boolean filter - The variable used in booleanToBoolExpr
//
// - Public
// > None
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Global Variables
//--------------------------------------------------------------------------
globals
hashtable Fox_SpellObjHash // This holds the Timer handleID for quick lookup.
group Fox_SpellObjGroup // This is the Global Group to keep from having to Create and Destroy a group constantly.
unit Fox_SpellObjEnumUnit // This allows user to check from a function given no parameters.
endglobals
function interface FoxCodeFunction takes nothing returns boolean
private module FoxModSpellObjsInit
private static method onInit takes nothing returns nothing
// Initialize Hashtable
set Fox_SpellObjHash = InitHashtable()
// Create Group
set Fox_SpellObjGroup = CreateGroup()
// Set Unit to null
set Fox_SpellObjEnumUnit = null
endmethod
endmodule
library FoxSpellObjs
// booleanToBoolExpr - Converts the filter variable to boolexpr.
function booleanToBoolExpr takes nothing returns boolean
return SpellObjs.filter
endfunction
//----------------------------------------------------------------------
// SpellObj Struct has all needed Code
//----------------------------------------------------------------------
struct SpellObjs extends array
// Handle Initialization
implement FoxModSpellObjsInit
//------------------------------------------------------------------
// Private Static Variables
//------------------------------------------------------------------
// Added to improve the object recycling
private static integer instanceCount = 0 // The count of current Objects.
private static thistype instanceToRecycle = 0 // The current object to recycle.
//------------------------------------------------------------------
// Public Static Variables
//------------------------------------------------------------------
// Misc
public static boolean filter // The variable used in booleanToBoolExpr
//------------------------------------------------------------------
// Private Struct Variables
//------------------------------------------------------------------
// Timer variables
private timer castTimer // The cast Timer for the spell.
private real castTime // The duration of the Timer.
private boolean castTimerRepeats // Whether or not the Timer Repeats.
private integer tickCount // Number of Ticks so far
private integer tickMax // Max number of Ticks
// Spell Target variables
private integer spellTargetType // The Target Type of the spell. Example:
// 1 = Unit Targeted Spell
// 2 = Point Targeted Spell
// 3 = No Target (Self-Cast/Self-Location Cast)
// 4 = Targeted Destructable
private unit casterUnit // The Unit casting the spell.
private unit targetUnit // The Unit targeted by the spell, for spellType 1 (Unit targeted Spell).
private real targetX // The Real X targeted by the spell, for spellType 2 (Point Targeted Spell).
private real targetY // The Real Y targeted by the spell, for spellType 2 (Point Targeted Spell).
private destructable targetDestructable // The Destructable targeted by the spell, for spellType 4 (Destructable targeted Spell).
// Spell Data variables
private real damageToWidget // Damage to do to the widget
private real spellRange // The AoE of the Spell
// Recycling variables
private thistype recycleNext // Recycle Stack
private boolean recycled // The Index of the spellObj.
//------------------------------------------------------------------
// Public Struct Variables
//------------------------------------------------------------------
// None
//------------------------------------------------------------------
// Private Static Methods
//------------------------------------------------------------------
// None
//------------------------------------------------------------------
// Public Static Methods
//------------------------------------------------------------------
// Create a new object.
public static method create takes nothing returns thistype
local thistype this
// if we aren't going to recycle anything
if (0 == instanceToRecycle) then
set instanceCount = instanceCount + 1 // increase instance count
set this = instanceCount
else
// we have an instance to recycle
// we set the current instance to the recycled one
set this = instanceToRecycle
// we set the recycled instance to the one that proceeds it in the recycle stack
set instanceToRecycle = instanceToRecycle.recycleNext
endif
// setup the object
call setupNew()
// Return new object
return this
endmethod
// getSpellObj - Returns the SpellObj with the given timer.
public static method getSpellObj takes timer objCastTimer returns thistype
return thistype[LoadInteger(Fox_SpellObjHash, GetHandleId(objCastTimer), 0)]
endmethod
//------------------------------------------------------------------
// Private Methods
//------------------------------------------------------------------
// setupNew - Sets up the Spell to default
private method setupNew takes nothing returns nothing
// Object Variables
//--------------------------------------------------------------
// Initializes all the settings for the new SpellObj
// if castTimer doesn't exist
if (.castTimer == null) then
// then create new timer
set .castTimer = CreateTimer()
// Save the handle of the new timer
call SaveInteger(Fox_SpellObjHash, GetHandleId(.castTimer), 0, this)
endif
// Initialize all other variables
set .castTime = 1.0
set .castTimerRepeats = false
set .casterUnit = null
set .targetUnit = null
set .targetX = 0.0
set .targetY = 0.0
set .targetDestructable = null
set .spellTargetType = 0
set .tickCount = 0
set .tickMax = 1
set .spellRange = 0.0
// Sets recycled to false, so it can later be recycled
set .recycled = false
endmethod
// resetSpell - Clears the Spell to be reused
private method resetSpell takes integer spellTypeId, real duration, boolean repeating, real damage returns nothing
// Set Everything to default
//--------------------------------------------------------------
set .casterUnit = null
set .targetUnit = null
set .targetX = 0.0
set .targetY = 0.0
set .targetDestructable = null
// Set given Variables
//--------------------------------------------------------------
set .spellTargetType = spellTypeId
set .castTime = duration
set .castTimerRepeats = repeating
set .damageToWidget = damage
endmethod
//------------------------------------------------------------------
// Public Methods
//------------------------------------------------------------------
// free - Recycle object.
public method free takes nothing returns nothing
if (.recycled == false) then
// Add recycled instance to stack
set .recycleNext = instanceToRecycle
// Make next recycled instance the current one
set .instanceToRecycle = this
endif
endmethod
// clear - Clears the SpellObj removing memory leak
public method clear takes boolean recycle returns nothing
// Pause Timer to avoid possible repeat tick
call PauseTimer(.castTimer)
// Nulls Old Data
set .casterUnit = null
set .targetUnit = null
set .targetX = 0.0
set .targetY = 0.0
set .targetDestructable = null
set .tickCount = 0
set .tickMax = 1
set .spellRange = 0.0
if (recycle) then
call free()
endif
endmethod
// tick - Checks if the spell can be Ticked
// - If it can it increases tickCount then returns true.
// - Otherwise it clears and recycles itself, then returns false.
public method tick takes nothing returns boolean
// If tickCount is lower then tickMax, Increase and return true.
//--------------------------------------------------------------
if (.tickCount < .tickMax) then
// Increase tickCount
set .tickCount = .tickCount + 1
// Ticks have not reached max yet, so return true
return true
//--------------------------------------------------------------
// Otherwise Clear and Recycle this, and return false.
else
// null this out and recycle it
call clear(true)
// Ticks have reached there max
return false
endif
endmethod
// setupUnitTarget - Sets the timer to be used for Spell Targeting Unit
public method setupUnitTarget takes real duration, integer repeatTimes, code func, unit caster, unit target, real damage returns boolean
// Setup if recycled is false, then return true
//--------------------------------------------------------------
if (.recycled == false) then
// Clear Old Data
call resetSpell(1, duration, (repeatTimes > 1), damage)
// Set Variables
set .casterUnit = caster
set .targetUnit = target
set .tickMax = repeatTimes
// Start Timer
call TimerStart(.castTimer, .castTime, .castTimerRepeats, func)
return true
endif
//--------------------------------------------------------------
// Otherwise return false
return false
endmethod
// setupCoorTarget - Sets the timer to be used for Spell Targeting Coors
public method setupCoorTarget takes real duration, integer repeatTimes, code func, unit caster, real x, real y, real damage returns boolean
// Setup if recycled is false, then return true
//--------------------------------------------------------------
if (recycled == false) then
// Clear Old Data
call resetSpell(2, duration, (repeatTimes > 1), damage)
// Set Variables
set .casterUnit = caster
set .targetX = x
set .targetY = y
set .tickMax = repeatTimes
// Start Timer
call TimerStart(.castTimer, .castTime, .castTimerRepeats, func)
return true
endif
//--------------------------------------------------------------
// Otherwise return false
return false
endmethod
// setupSelfTarget - Sets the timer to be used for Spell Targeting Self
public method setupSelfTarget takes real duration, integer repeatTimes, code func, unit caster, real damage returns boolean
// Setup if recycled is false, then return true
//--------------------------------------------------------------
if (recycled == false) then
// Clear Old Data
call resetSpell(3, duration, (repeatTimes > 1), damage)
// Set Variables
set .casterUnit = caster
set .tickMax = repeatTimes
// Start Timer
call TimerStart(.castTimer, .castTime, .castTimerRepeats, func)
return true
endif
//--------------------------------------------------------------
// Otherwise return false
return false
endmethod
// setupDestructableTarget - Sets the timer to be used for Spell Targeting Destructable
public method setupDestructableTarget takes real duration, integer repeatTimes, code func, unit caster, destructable target, real damage returns boolean
// Setup if recycled is false, then return true
//--------------------------------------------------------------
if (recycled == false) then
// Clear Old Data
call resetSpell(4, duration, (repeatTimes > 1), damage)
// Set Variables
set .casterUnit = caster
set .targetDestructable = target
set .tickMax = repeatTimes
// Start Timer
call TimerStart(.castTimer, .castTime, .castTimerRepeats, func)
return true
endif
//--------------------------------------------------------------
// Otherwise return false
return false
endmethod
// damageTarget - Damages the Target
public method damageTarget takes nothing returns nothing
// Locals
local integer i = 0
local unit tempUnit = null
// if the spellTargetType is Unit or Destructable then
if ((.spellTargetType == 1) or (.spellTargetType == 3) or (.spellTargetType == 4)) then
// Damage Unit/Destructable
call UnitDamageTarget(.casterUnit, .targetUnit, .damageToWidget, false, false, null, null, null)
endif
endmethod
// damageAoETargets - Damages the Targets of the AoE, either at the
// targetX, and targetY or using the caster's position.
public method damageAoETargets takes FoxCodeFunction filterFunc returns nothing
local real damageTargetX
local real damageTargetY
// Damage AoE at Point
if (.spellTargetType == 2) then
set damageTargetX = targetX
set damageTargetY = targetY
elseif (.spellTargetType == 4) then
set damageTargetX = GetUnitX(.casterUnit)
set damageTargetY = GetUnitY(.casterUnit)
elseif (.spellRange > 0.0) then
set damageTargetX = GetUnitX(.targetUnit)
set damageTargetY = GetUnitY(.targetUnit)
else
return
endif
// call AoE Coor Function here (use given function to filter through the units)
call GroupEnumUnitsInRange(Fox_SpellObjGroup, damageTargetX, damageTargetY, .spellRange, null)
// Loop through the units found
loop
// Set the Fox_SpellObjEnumUnit to the first in the Global Group
set Fox_SpellObjEnumUnit = FirstOfGroup(Fox_SpellObjGroup)
exitwhen Fox_SpellObjEnumUnit == null
if (filterFunc.evaluate()) then
// Damage the Selected Unit.
call UnitDamageTarget(.casterUnit, Fox_SpellObjEnumUnit, .damageToWidget, false, false, null, null, null)
// Remove Unit from Group
call GroupRemoveUnit(Fox_SpellObjGroup, Fox_SpellObjEnumUnit)
endif
endloop
endmethod
// getTarget - returns the Target of the spell
public method getTarget takes nothing returns unit
return .targetUnit
endmethod
endstruct
endlibrary
JASS:
//--------------------------------------------------------------------------
//
// SpellUnitChanneled Template - [SpellObjs]
//
// Made by: Fox536
// Date: 09/24/2011
// Version: 0.6
//==========================================================================
// This spell template for channeled spells, and should be very easy to use
// configure, and edit. It only requires, that you have
// [SpellObjs by Fox536] in your map.
//==========================================================================
// Features
// - Easy Customization
// - Scope, so you can create as many spells using the template and
// never have to change the code except for the constants and the
// Fox_SpellUnit_Tick() function.
//==========================================================================
// scope FoxSpellUnit1 - Change if you need to add another spell.
scope FoxSpellUnitChanneled1
//======================================================================
// Config
//======================================================================
// To create a spell that Heals, set Fox_SpellUnitDot_DamageAmount to a
// negative value.
//----------------------------------------------------------------------
// Constant Functions
//----------------------------------------------------------------------
// Fox_SpellUnitChanneled_SpellId - Set this your the Spell's Id
constant function Fox_SpellUnitChanneled_SpellId takes nothing returns integer
return 'A000'
endfunction
// Fox_SpellUnitChanneled_DamageAmount - Set this your the Spell's Damage Amount
constant function Fox_SpellUnitChanneled_DamageAmount takes nothing returns real
return 200.0
endfunction
// Fox_SpellUnitChanneled_TickDelay - Set this your the Spell's Tick Delay
constant function Fox_SpellUnitChanneled_TickDelay takes nothing returns real
return 10.0
endfunction
// Fox_SpellUnitChanneled_TickAmount - Set this your the Spell's tick amount.
// (The amount of times you want the timer function to happen.)
constant function Fox_SpellUnitChanneled_TickAmount takes nothing returns integer
return 1
endfunction
//----------------------------------------------------------------------
// Main Timer Function
//----------------------------------------------------------------------
// Fox_SpellUnitChanneled_Tick - Is called whenever the timer expires.
// - edit for customizations if you need to.
function Fox_SpellUnitChanneled_Tick takes nothing returns nothing
local SpellObjs obj
// Get the Obj.
set obj = SpellObjs.getSpellObj(GetExpiredTimer())
// if the Obj. doesn't equal null (Here just in case)
if (obj != null) then
// Damage the Spell's target
call obj.damageTarget()
// Clears and Recycles the Obj.
call obj.clear(true)
endif
endfunction
//======================================================================
// End Config
//======================================================================
//----------------------------------------------------------------------
// Conditions
//----------------------------------------------------------------------
// Fox_SpellUnitChanneled_Conditions - Checks if correct spell was cast.
function Fox_SpellUnitChanneled_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == Fox_SpellUnitChanneled_SpellId())
endfunction
//----------------------------------------------------------------------
// Actions
//----------------------------------------------------------------------
// Fox_SpellUnitChanneled_Actions - Starts the Channeling
function Fox_SpellUnitChanneled_Actions takes nothing returns nothing
local SpellObjs obj = SpellObjs.create()
// Starts the Channel
call obj.setupUnitTarget(Fox_SpellUnitChanneled_TickDelay(), Fox_SpellUnitChanneled_TickAmount(), function Fox_SpellUnitChanneled_Tick, GetTriggerUnit(), GetSpellTargetUnit(), Fox_SpellUnitChanneled_DamageAmount())
endfunction
//----------------------------------------------------------------------
// Main Setup
//----------------------------------------------------------------------
// InitTrig_SpellUnit - Main Trigger Setup
function InitTrig_FoxSpellUnitChanneled1 takes nothing returns nothing
set gg_trg_FoxSpellUnitChanneled1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_FoxSpellUnitChanneled1, EVENT_PLAYER_UNIT_SPELL_CHANNEL)
call TriggerAddCondition(gg_trg_FoxSpellUnitChanneled1, Condition( function Fox_SpellUnitChanneled_Conditions))
call TriggerAddAction(gg_trg_FoxSpellUnitChanneled1, function Fox_SpellUnitChanneled_Actions)
endfunction
endscope
JASS:
//--------------------------------------------------------------------------
//
// SpellUnitDot Template - [SpellObjs]
//
// Made by: Fox536
// Date: 09/24/2011
// Version: 0.6
//==========================================================================
// This spell template for Dot or Hot spells, and should be very easy to
// use configure, and edit. It only requires, that you have
// [SpellObjs by Fox536] in your map.
//==========================================================================
// Features
// - Easy Customization
// - Scope, so you can create as many spells using the template and
// never have to change the code except for the constants and the
// Fox_SpellUnitDot_Tick() function.
//==========================================================================
// scope FoxSpellUnitDot1 - Change if you need to add another spell.
scope FoxSpellUnitDot1
//======================================================================
// Config
//======================================================================
// To create a spell that Heals, set Fox_SpellUnitDot_DamageAmount to a
// negative value.
//----------------------------------------------------------------------
// Constant Functions
//----------------------------------------------------------------------
// Fox_SpellUnitDot_SpellId - Set this your the Spell's Id
constant function Fox_SpellUnitDot_SpellId takes nothing returns integer
return 'A001'
endfunction
// Fox_SpellUnitDot_BuffId - Set this your the Buff's Id
constant function Fox_SpellUnitDot_BuffId takes nothing returns integer
return 'B000'
endfunction
// Fox_SpellUnitDot_DamageAmount - Set this your the Spell's Damage Amount
constant function Fox_SpellUnitDot_DamageAmount takes nothing returns real
return 25.0
endfunction
// Fox_SpellUnitDot_TickDelay - Set this your the Spell's Tick Delay
constant function Fox_SpellUnitDot_TickDelay takes nothing returns real
return 5.0
endfunction
// Fox_SpellUnitDot_TickAmount - Set this your the Spell's tick amount.
// (The amount of times you want the timer function to happen.)
constant function Fox_SpellUnitDot_TickAmount takes nothing returns integer
return 10
endfunction
//----------------------------------------------------------------------
// Main Timer Function
//----------------------------------------------------------------------
// Fox_SpellUnitDot_Tick - Is called whenever the timer expires.
// - edit for customizations if you need to.
function Fox_SpellUnitDot_Tick takes nothing returns nothing
local SpellObjs obj = SpellObjs.getSpellObj(GetExpiredTimer())
if (obj != null) then
if (obj.tick()) then
if (GetUnitAbilityLevel(obj.getTarget(), Fox_SpellUnitDot_BuffId()) > 0) then
call obj.damageTarget()
else
call obj.clear(true)
endif
else
call UnitRemoveAbility(obj.getTarget(), Fox_SpellUnitDot_BuffId())
endif
endif
endfunction
//======================================================================
// End Config
//======================================================================
//----------------------------------------------------------------------
// Conditions
//----------------------------------------------------------------------
function Fox_SpellUnitDot_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == Fox_SpellUnitDot_SpellId())
endfunction
//----------------------------------------------------------------------
// Actions
//----------------------------------------------------------------------
function Fox_SpellUnitDot_Actions takes nothing returns nothing
local SpellObjs obj = SpellObjs.create()
local unit target = GetSpellTargetUnit()
// if unit is not already under the effect of the spell.
if not (GetUnitAbilityLevel(target, Fox_SpellUnitDot_BuffId()) > 0) then
// Create new SpellObj
set obj = SpellObjs.create()
// Setup new SpellObj
call obj.setupUnitTarget(Fox_SpellUnitDot_TickDelay(), Fox_SpellUnitDot_TickAmount(), function Fox_SpellUnitDot_Tick, GetTriggerUnit(), target, Fox_SpellUnitDot_DamageAmount())
endif
// Remove leaks
set target = null
endfunction
//----------------------------------------------------------------------
// Main Setup
//----------------------------------------------------------------------
function InitTrig_FoxSpellUnitDot1 takes nothing returns nothing
set gg_trg_FoxSpellUnitDot1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_FoxSpellUnitDot1, EVENT_PLAYER_UNIT_SPELL_CHANNEL)
call TriggerAddCondition(gg_trg_FoxSpellUnitDot1, Condition( function Fox_SpellUnitDot_Conditions))
call TriggerAddAction(gg_trg_FoxSpellUnitDot1, function Fox_SpellUnitDot_Actions)
endfunction
endscope
Attachments
Last edited: