Name | Type | is_array | initial_value |
Hashtable | hashtable | No |
constant function TorrentSpellAbilityId takes nothing returns integer
return 'A000' // Torrent Spell Ability Id.
endfunction
constant function TorrentRange takes nothing returns real
return 225. // The range where I search for matching units.
endfunction
constant function TorrentDisableTime takes nothing returns real
return 1.53 // For what time unit will be disabled.
endfunction
function Trig_Torrent_Cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == TorrentSpellAbilityId()
endfunction
function Trig_Torrent_Cast_GroupToss takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local unit caster = LoadUnitHandle(udg_Hashtable,hid,0)
local boolean b = LoadBoolean(udg_Hashtable,hid,2)
local real dmg = LoadReal(udg_Hashtable,hid,4)
local unit e = GetEnumUnit()
local real z = GetUnitFlyHeight(e)
local real zi = LoadReal(udg_Hashtable,hid,3)
if z > 2. then
call SetUnitFlyHeight(e,z + zi,0.)
if dmg > 0 then
call UnitDamageTarget(caster,e,30,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call SaveReal(udg_Hashtable,hid,4,dmg - 30)
endif
call SaveReal(udg_Hashtable,hid,3,zi - 1.)
else
call SaveBoolean(udg_Hashtable,hid,2,true)
endif
set e = null
set caster = null
set t = null
endfunction
function Trig_Torrent_Cast_GroupTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local boolean b = LoadBoolean(udg_Hashtable,hid,2)
local group g = LoadGroupHandle(udg_Hashtable,hid,1)
if b == true then
call FlushChildHashtable(udg_Hashtable,hid)
call GroupClear(g)
call DestroyGroup(g)
call PauseTimer(t)
call DestroyTimer(t)
else
call ForGroup(g,function Trig_Torrent_Cast_GroupToss)
endif
set g = null
set t = null
endfunction
function Trig_Torrent_Cast_Filter takes nothing returns boolean
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local unit caster = LoadUnitHandle(udg_Hashtable,hid,1)
local unit filter = GetFilterUnit()
if IsUnitEnemy(filter,GetOwningPlayer(caster)) == true and IsUnitType(filter,UNIT_TYPE_DEAD) != true and IsUnitType(filter,UNIT_TYPE_STRUCTURE) != true then
set caster = null
set filter = null
set t = null
return true
endif
set caster = null
set filter = null
set t = null
return false
endfunction
function Trig_Torrent_Cast_EnumUnpause takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local unit e = LoadUnitHandle(udg_Hashtable,hid,0)
call PauseUnit(e,false)
call FlushChildHashtable(udg_Hashtable,hid)
call DestroyTimer(t)
set t = null
endfunction
function Trig_Torrent_Cast_Group takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local timer ut = CreateTimer()
local unit e = GetEnumUnit()
local unit caster = LoadUnitHandle(udg_Hashtable,hid,1)
call SetUnitFlyHeight(e,3.,0.)
call UnitAddAbility(e,'Amrf')
call UnitRemoveAbility(e,'Amrf')
call UnitDamageTarget(caster,e,0.5 * 60 * GetUnitAbilityLevel(caster,TorrentSpellAbilityId()) + 60,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call PauseUnit(e,true)
call TimerStart(ut,TorrentDisableTime(),false,function Trig_Torrent_Cast_EnumUnpause)
call SaveUnitHandle(udg_Hashtable,GetHandleId(ut),0,e)
set t = null
set caster = null
set e = null
set ut = null
endfunction
function Trig_Torrent_Cast_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local integer starti = 2
local integer endi = LoadInteger(udg_Hashtable,hid,0)
local real x0 = LoadReal(udg_Hashtable,hid,endi + 1)
local real y0 = LoadReal(udg_Hashtable,hid,endi + 2)
local unit caster = LoadUnitHandle(udg_Hashtable,hid,1)
local group g = CreateGroup()
local timer gt = CreateTimer()
loop
exitwhen starti > endi
call DestroyEffect(LoadEffectHandle(udg_Hashtable,hid,starti))
set starti = starti + 1
endloop
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl",x0,y0))
call DestroyEffect(AddSpecialEffect("Effects\\TidalErruption.mdx",x0,y0))
call GroupEnumUnitsInRange(g,x0,y0,TorrentRange(),Filter(function Trig_Torrent_Cast_Filter))
call ForGroup(g,function Trig_Torrent_Cast_Group)
call SaveUnitHandle(udg_Hashtable,GetHandleId(gt),0,caster)
call SaveGroupHandle(udg_Hashtable,GetHandleId(gt),1,g)
call SaveBoolean(udg_Hashtable,GetHandleId(gt),2,false)
call SaveReal(udg_Hashtable,GetHandleId(gt),3,70.)
call SaveReal(udg_Hashtable,GetHandleId(gt),4,0.5 * 60 * GetUnitAbilityLevel(caster,TorrentSpellAbilityId()) + 60)
call TimerStart(gt,0.04,true,function Trig_Torrent_Cast_GroupTimer)
call FlushChildHashtable(udg_Hashtable,hid)
call DestroyTimer(t)
set gt = null
set g = null
set caster = null
set t = null
endfunction
function Trig_Torrent_Cast_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real x0 = GetSpellTargetX()
local real y0 = GetSpellTargetY()
local real angle = 0.
local string model
local real x
local real y
local integer i = 2
local timer t = CreateTimer()
// The initial bubble effect is only visible to allies.
if IsUnitAlly(caster,GetLocalPlayer()) == true then
set model = "Objects\\Spawnmodels\\Other\\IllidanFootprint\\IllidanWaterSpawnFootPrint.mdl"
endif
// Create the bubble effects.
loop
exitwhen angle > 315.
set x = x0 + 50 * Cos(angle * 0.0174532)
set y = y0 + 50 * Sin(angle * 0.0174532)
call SaveEffectHandle(udg_Hashtable,GetHandleId(t),i,AddSpecialEffect(model,x,y))
set i = i + 1
set angle = angle + 45.
endloop
// This reals are coordinates where I'll create two other effects after 2 seconds.
// I'll also pick the units in range 225 from that point.
call SaveReal(udg_Hashtable,GetHandleId(t),i + 1,x0)
call SaveReal(udg_Hashtable,GetHandleId(t),i + 2,y0)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),1,caster)
// The integer that I saved here can help us to destroy created effects.
call SaveInteger(udg_Hashtable,GetHandleId(t),0,i)
call TimerStart(t,2.,false,function Trig_Torrent_Cast_Timer)
set t = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Torrent_Cast takes nothing returns nothing
set gg_trg_Torrent_Cast = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Torrent_Cast,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Torrent_Cast,Condition(function Trig_Torrent_Cast_Conditions))
call TriggerAddAction(gg_trg_Torrent_Cast,function Trig_Torrent_Cast_Actions)
endfunction
constant function TideAbilityId takes nothing returns integer
return 'A001' // Tidebringer Ability ID
endfunction
constant function TideSpellBookId takes nothing returns integer
return 'A002' // Tidebringer Spellbook ID
endfunction
function Trig_Tidebringer_Learn_Conditions takes nothing returns boolean
return GetLearnedSkill() == TideAbilityId() and GetUnitAbilityLevel(GetTriggerUnit(),TideAbilityId()) == 1
endfunction
function Trig_Tidebringer_Learn_Actions takes nothing returns nothing
local unit learning = GetTriggerUnit()
call SaveBoolean(udg_Hashtable,GetPlayerId(GetOwningPlayer(learning)),0,false)
call UnitAddAbility(learning,TideSpellBookId())
call SetPlayerAbilityAvailable(GetOwningPlayer(learning),TideSpellBookId(),false)
set learning = null
endfunction
//===========================================================================
function InitTrig_Tidebringer_Learn takes nothing returns nothing
set gg_trg_Tidebringer_Learn = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Tidebringer_Learn,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(gg_trg_Tidebringer_Learn,Condition(function Trig_Tidebringer_Learn_Conditions))
call TriggerAddAction(gg_trg_Tidebringer_Learn,function Trig_Tidebringer_Learn_Actions)
endfunction
constant function TidebringerAbilityId takes nothing returns integer
return 'A001' // Tidebringer Ability ID
endfunction
constant function TidebringerSpellBookId takes nothing returns integer
return 'A002' // Tidebringer Spellbook ID
endfunction
constant function TidebringerCleaveId takes nothing returns integer
return 'A003' // Tidebringer Cleave ID
endfunction
function Trig_Tidebringer_Damage_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetEventDamageSource(),TidebringerAbilityId()) != 0
endfunction
function Trig_Tidebringer_Damage_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
call SaveBoolean(udg_Hashtable,GetPlayerId(GetOwningPlayer(source)),0,false)
call UnitAddAbility(source,TidebringerSpellBookId())
call SetUnitAbilityLevel(source,TidebringerCleaveId(),GetUnitAbilityLevel(source,TidebringerAbilityId()))
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call DestroyTimer(t)
set source = null
set t = null
endfunction
function Trig_Tidebringer_Damage_Filter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) == true and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) != true and IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) != true
endfunction
function Trig_Tidebringer_Damage_Group takes nothing returns nothing
local unit e = GetEnumUnit()
local unit source = GetEventDamageSource()
local integer lvl = GetUnitAbilityLevel(source,TidebringerAbilityId())
local real dmg = 15. * lvl
call UnitDamageTarget(source,e,dmg,true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
set source = null
set e = null
endfunction
function Trig_Tidebringer_Damage_Actions takes nothing returns nothing
local unit source = GetEventDamageSource()
local unit damaged = GetTriggerUnit()
local real dx = GetUnitX(damaged)
local real dy = GetUnitY(damaged)
local integer lvl = GetUnitAbilityLevel(source,TidebringerAbilityId())
local integer range = 40 * lvl + 340
local real cooldown = - 4 * lvl + 20
local group g = CreateGroup()
local timer t = CreateTimer()
if LoadBoolean(udg_Hashtable,GetPlayerId(GetOwningPlayer(source)),0) == true then
call DestroyGroup(g)
call DestroyTimer(t)
set t = null
set g = null
set source = null
set damaged = null
return
endif
if IsUnitAlly(damaged,GetOwningPlayer(source)) == true then
call UnitDamageTarget(source,damaged,15 * GetUnitAbilityLevel(source,TidebringerAbilityId()),true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call DestroyGroup(g)
call DestroyTimer(t)
set t = null
set g = null
set source = null
set damaged = null
return
endif
call UnitRemoveAbility(source,TidebringerSpellBookId())
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),0,source)
call SaveBoolean(udg_Hashtable,GetPlayerId(GetOwningPlayer(source)),0,true)
call TimerStart(t,cooldown,false,function Trig_Tidebringer_Damage_Timer)
call GroupEnumUnitsInRange(g,dx,dy,range,Filter(function Trig_Tidebringer_Damage_Filter))
call ForGroup(g,function Trig_Tidebringer_Damage_Group)
call DestroyGroup(g)
set g = null
set t = null
set source = null
set damaged = null
endfunction
//===========================================================================
function InitTrig_Tidebringer_Damage takes nothing returns nothing
set gg_trg_Tidebringer_Damage = CreateTrigger()
call TriggerAddCondition(gg_trg_Tidebringer_Damage,Condition(function Trig_Tidebringer_Damage_Conditions))
call TriggerAddAction(gg_trg_Tidebringer_Damage,function Trig_Tidebringer_Damage_Actions)
endfunction
constant function XMarkAbilityId takes nothing returns integer
return 'A005' // X Marks the Spot Ability ID
endfunction
function Trig_X_Mark_Cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == XMarkAbilityId()
endfunction
function Trig_X_Mark_Cast_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit target = LoadUnitHandle(udg_Hashtable,GetHandleId(t),1)
local real x = LoadReal(udg_Hashtable,GetHandleId(t),2)
local real y = LoadReal(udg_Hashtable,GetHandleId(t),3)
if IsUnitType(target,UNIT_TYPE_MAGIC_IMMUNE) == false and IsUnitType(target,UNIT_TYPE_DEAD) == false then
call SetUnitX(target,x)
call SetUnitY(target,y)
endif
call DestroyEffect(LoadEffectHandle(udg_Hashtable,GetHandleId(t),0))
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call DestroyTimer(t)
set t = null
set target = null
endfunction
function Trig_X_Mark_Cast_Actions takes nothing returns nothing
local unit target = GetSpellTargetUnit()
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local timer t = CreateTimer()
call SaveEffectHandle(udg_Hashtable,GetHandleId(t),0,AddSpecialEffect("war3mapImported\\X_Mark.mdx",x,y))
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),1,target)
call SaveReal(udg_Hashtable,GetHandleId(t),2,x)
call SaveReal(udg_Hashtable,GetHandleId(t),3,y)
call SaveTimerHandle(udg_Hashtable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),0,t)
call TimerStart(t,GetUnitAbilityLevel(GetTriggerUnit(),XMarkAbilityId()),false,function Trig_X_Mark_Cast_Timer)
set t = null
set target = null
endfunction
//===========================================================================
function InitTrig_X_Mark_Cast takes nothing returns nothing
set gg_trg_X_Mark_Cast = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_X_Mark_Cast,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_X_Mark_Cast,Condition(function Trig_X_Mark_Cast_Conditions))
call TriggerAddAction(gg_trg_X_Mark_Cast,function Trig_X_Mark_Cast_Actions)
endfunction
constant function ReturnAbilityId takes nothing returns integer
return 'A006' // Return Ability ID
endfunction
function Trig_Return_Cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ReturnAbilityId()
endfunction
function Trig_Return_Cast_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local timer t = LoadTimerHandle(udg_Hashtable,GetPlayerId(GetOwningPlayer(caster)),0)
local unit target = LoadUnitHandle(udg_Hashtable,GetHandleId(t),1)
local real x = LoadReal(udg_Hashtable,GetHandleId(t),2)
local real y = LoadReal(udg_Hashtable,GetHandleId(t),3)
if IsUnitType(target,UNIT_TYPE_MAGIC_IMMUNE) == false and IsUnitType(target,UNIT_TYPE_DEAD) == false then
call SetUnitX(target,x)
call SetUnitY(target,y)
endif
call DestroyEffect(LoadEffectHandle(udg_Hashtable,GetHandleId(t),0))
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call DestroyTimer(t)
set t = null
set target = null
endfunction
//===========================================================================
function InitTrig_Return_Cast takes nothing returns nothing
set gg_trg_Return_Cast = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Return_Cast,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Return_Cast,Condition(function Trig_Return_Cast_Conditions))
call TriggerAddAction(gg_trg_Return_Cast,function Trig_Return_Cast_Actions)
endfunction
constant function XMarkSpellAbilityId takes nothing returns integer
return 'A005' // X Marks the Spot Ability ID
endfunction
constant function ReturnToXAbilityId takes nothing returns integer
return 'A006' // Return Ability ID
endfunction
function Trig_X_Mark_Learn_Conditions takes nothing returns boolean
return GetLearnedSkill() == XMarkSpellAbilityId() and GetUnitAbilityLevel(GetTriggerUnit(),XMarkSpellAbilityId()) == 1
endfunction
function Trig_X_Mark_Learn_Actions takes nothing returns nothing
call UnitAddAbility(GetTriggerUnit(),ReturnToXAbilityId())
endfunction
//===========================================================================
function InitTrig_X_Mark_Learn takes nothing returns nothing
set gg_trg_X_Mark_Learn = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_X_Mark_Learn,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(gg_trg_Tidebringer_Damage,Condition(function Trig_X_Mark_Learn_Conditions))
call TriggerAddAction(gg_trg_X_Mark_Learn,function Trig_X_Mark_Learn_Actions)
endfunction
constant function GhostShipAbilityId takes nothing returns integer
return 'A007' // Ghost Ship Ability ID
endfunction
constant function ShipDummyId takes nothing returns integer
return 'n000' // Ghost Ship Dummy Unit ID
endfunction
constant function StunDummyId takes nothing returns integer
return 'n001' // Stun Dummy Unit ID
endfunction
constant function GhostShipSpellbookId takes nothing returns integer
return 'A00A' // Ghost Ship Spellbook ID
endfunction
constant function GhostShipRumAbilityId takes nothing returns integer
return 'A00B' // Ghost Ship Rum Ability ID
endfunction
function Trig_Ghost_Ship_Cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == GhostShipAbilityId()
endfunction
function Trig_Ghost_Ship_Cast_Filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),1))) == true
endfunction
function Trig_Ghost_Ship_Group takes nothing returns nothing
local unit e = GetEnumUnit()
local unit caster = LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),1)
local unit dummy = CreateUnit(Player(15),StunDummyId(),GetUnitX(e),GetUnitY(e),0)
call UnitApplyTimedLife(dummy,'BTLF',1)
call IssueTargetOrderById(dummy,852095,e)
call UnitDamageTarget(dummy,e,100 * GetUnitAbilityLevel(caster,GhostShipAbilityId()) + 200,true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
set caster = null
set dummy = null
endfunction
function Trig_Ghost_Ship_Cast_AllyFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),1))) == true
endfunction
function Trig_Ghost_Ship_Cast_RumOff takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit e = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
call UnitRemoveAbility(e,GhostShipSpellbookId())
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call DestroyTimer(t)
set e = null
set t = null
endfunction
function Trig_Ghost_Ship_AllyGroup takes nothing returns nothing
local unit e = GetEnumUnit()
local unit caster = LoadUnitHandle(udg_Hashtable,GetHandleId(GetExpiredTimer()),1)
local real rumtime = GetUnitAbilityLevel(caster,GhostShipAbilityId()) + 4
local timer t = CreateTimer()
if GetUnitAbilityLevel(e,GhostShipRumAbilityId()) == 0 then
call UnitAddAbility(e,GhostShipSpellbookId())
call SetPlayerAbilityAvailable(GetOwningPlayer(e),GhostShipSpellbookId(),false)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),0,e)
call TimerStart(t,rumtime,false,function Trig_Ghost_Ship_Cast_RumOff)
endif
set caster = null
set t = null
endfunction
function Trig_Ghost_Ship_Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit dummy = LoadUnitHandle(udg_Hashtable,GetHandleId(t),0)
local unit caster = LoadUnitHandle(udg_Hashtable,GetHandleId(t),1)
local group g = CreateGroup()
local real x = GetUnitX(dummy) + 26 * Cos(GetUnitFacing(dummy) * 0.0174532)
local real y = GetUnitY(dummy) + 26 * Sin(GetUnitFacing(dummy) * 0.0174532)
if IsUnitType(dummy,UNIT_TYPE_DEAD) == true then
call GroupEnumUnitsInRange(g,x,y,400,Filter(function Trig_Ghost_Ship_Cast_Filter))
call ForGroup(g,function Trig_Ghost_Ship_Group)
call FlushChildHashtable(udg_Hashtable,GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
else
call GroupEnumUnitsInRange(g,x,y,400,Filter(function Trig_Ghost_Ship_Cast_AllyFilter))
call ForGroup(g,function Trig_Ghost_Ship_AllyGroup)
call SetUnitX(dummy,x)
call SetUnitY(dummy,y)
endif
call GroupClear(g)
call DestroyGroup(g)
set caster = null
set g = null
set dummy = null
set t = null
endfunction
function Trig_Ghost_Ship_Cast_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real x = GetUnitX(caster) + 750 * Cos((GetUnitFacing(caster) - 180.) * 0.0174532)
local real y = GetUnitY(caster) + 750 * Sin((GetUnitFacing(caster) - 180.) * 0.0174532)
local unit dummy = CreateUnit(GetOwningPlayer(caster),ShipDummyId(),x,y,GetUnitFacing(caster))
local timer t = CreateTimer()
call UnitApplyTimedLife(dummy,'BTLF',2.308)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),0,dummy)
call SaveUnitHandle(udg_Hashtable,GetHandleId(t),1,caster)
call TimerStart(t,0.04,true,function Trig_Ghost_Ship_Move)
set t = null
set dummy = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Ghost_Ship_Cast takes nothing returns nothing
set gg_trg_Ghost_Ship_Cast = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Ghost_Ship_Cast,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Ghost_Ship_Cast,Condition(function Trig_Ghost_Ship_Cast_Conditions))
call TriggerAddAction(gg_trg_Ghost_Ship_Cast,function Trig_Ghost_Ship_Cast_Actions)
endfunction
constant function GhostShipRumBuffId takes nothing returns integer
return 'B002' // Ghost Ship Rum Buff Id
endfunction
function Trig_Ghost_Ship_Rum_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),GhostShipRumBuffId()) > 0
endfunction
function Trig_Ghost_Ship_Rum_Actions takes nothing returns nothing
local unit damaged = GetTriggerUnit()
local real damage = GetEventDamage() * 0.5
local real needtodamage = LoadReal(udg_Hashtable,GetHandleId(damaged),0)
call SetWidgetLife(damaged,GetWidgetLife(damaged) + damage)
call SaveReal(udg_Hashtable,GetHandleId(damaged),0,needtodamage + damage)
set damaged = null
endfunction
//===========================================================================
function InitTrig_Ghost_Ship_Rum takes nothing returns nothing
set gg_trg_Ghost_Ship_Rum = CreateTrigger()
call TriggerAddCondition(gg_trg_Ghost_Ship_Rum,Condition(function Trig_Ghost_Ship_Rum_Conditions))
call TriggerAddAction(gg_trg_Ghost_Ship_Rum,function Trig_Ghost_Ship_Rum_Actions)
endfunction
function Trig_Ghost_Ship_Rum_Wears_Off_Actions takes nothing returns nothing
local unit damaged = GetTriggerUnit()
local real needtodamage = LoadReal(udg_Hashtable,GetHandleId(damaged),0)
if GetWidgetLife(damaged) < needtodamage then
call SetWidgetLife(damaged,1.)
else
call SetWidgetLife(damaged,GetWidgetLife(damaged) - needtodamage)
endif
call SaveReal(udg_Hashtable,GetHandleId(damaged),0,0.)
set damaged = null
endfunction
//===========================================================================
function InitTrig_Ghost_Ship_Rum_Wears_Off takes nothing returns nothing
set gg_trg_Ghost_Ship_Rum_Wears_Off = CreateTrigger()
call TriggerAddAction(gg_trg_Ghost_Ship_Rum_Wears_Off,function Trig_Ghost_Ship_Rum_Wears_Off_Actions)
endfunction