private static method triggerConditionCast takes nothing returns boolean
local thistype this = AHashTable.global().handleInteger(GetTriggeringTrigger(), "this")
local boolean result = (GetSpellAbilityId() == this.m_ability)
if (result) then
debug call Print("Spell: triggerConditionCast")
debug call Print("Spell target X: " + R2S(GetSpellTargetX()) + " Y: " + R2S(GetSpellTargetY()))
debug call Print("Spell target Location in condition: " + R2S(GetLocationX(GetSpellTargetLoc())) + " and " + R2S(GetLocationY(GetSpellTargetLoc())))
set result = this.onCastCondition()
if (not result) then
//taken from wc3jass.com
//call PauseUnit(this.character().unit(), true)
call IssueImmediateOrder(this.character().unit(), "stop")
//call PauseUnit(this.character().unit(), false)
endif
endif
return result
endmethod
private static method triggerActionCast takes nothing returns nothing
local thistype this = AHashTable.global().handleInteger(GetTriggeringTrigger(), "this")
debug call Print("Spell: triggerActionCast")
debug call Print("Spell target X: " + R2S(GetSpellTargetX()) + " Y: " + R2S(GetSpellTargetY()))
debug call Print("Spell target Location in action: " + R2S(GetLocationX(GetSpellTargetLoc())) + " and " + R2S(GetLocationY(GetSpellTargetLoc())))
call this.onCastAction.execute()
endmethod
private method createCastTrigger takes nothing returns nothing
set this.m_castTrigger = CreateTrigger()
call TriggerRegisterUnitEvent(this.m_castTrigger, this.character().unit(), EVENT_UNIT_SPELL_ENDCAST)
call TriggerAddCondition(this.m_castTrigger, Condition(function thistype.triggerConditionCast))
call TriggerAddAction(this.m_castTrigger, function thistype.triggerActionCast)
call AHashTable.global().setHandleInteger(this.m_castTrigger, "this", this)
endmethod