Name | Type | is_array | initial_value |
Arrow_Angle | real | No | |
Arrow_Caster | unit | Yes | |
Arrow_CasterLoc | location | No | |
Arrow_CountMaxSize | integer | No | |
Arrow_Counts | integer | No | |
Arrow_CusValue | integer | No | |
Arrow_Distance | real | Yes | |
Arrow_DistanceCount | real | Yes | |
Arrow_DistanceTravel | real | Yes | |
Arrow_DummyLoc | location | No | |
Arrow_Movement | location | No | |
Arrow_RandomUnit | group | No | |
Arrow_StartGroup | group | No | |
Arrow_StunDuration | integer | Yes | |
Arrow_TargetPoint | location | No | |
Arrow_UnitGroup | group | No | |
Arrow_UnitPoint | group | No | |
Ball_Lightning_Angle | real | No | |
Baltem | itemcode | No | |
Boolean | boolean | No | |
Casting | unit | No | |
ChAbilityMain | abilcode | No | |
Chronosphere_Caster | unit | No | |
Chronosphere_Group | group | Yes | |
Chronosphere_Point | location | Yes | |
ChUnitEffect | unitcode | No | |
CreepType | unitcode | Yes | |
DummyCaster | unitcode | No | |
Dumunit200 | unit | Yes | |
Dumunit450 | unit | Yes | |
Dumunit700 | unit | Yes | |
HashCache | hashtable | No | |
Hellfire_Laser_Point | location | No | |
Integer | integer | No | |
Kill | integer | Yes | |
Kills | integer | Yes | |
KillTeam | integer | Yes | |
Lightning | lightning | Yes | |
LockedUnits | group | No | |
Mode | integer | No | |
MoneyIncome | real | No | |
OwnerofKillingUnit | player | Yes | |
Player_Colors | string | Yes | |
Point | location | Yes | |
Random | integer | No | |
Real | real | No | |
RecentKill | integer | Yes | |
Select_Unit | unit | No | |
Set | trigger | No | |
ShadowRaze | abilcode | Yes | |
Streak | integer | Yes | |
Temp_Int | integer | No | |
TiAbilityDummy | abilcode | No | |
TiAbilityMain | abilcode | No | |
TiBuff | buffcode | No | |
timer | timer | No | |
Timer1 | timer | Yes | |
timerwindow | timerdialog | No | |
Timewalk_Angle | real | No | |
Timewalk_DistanceTraveled | real | No | |
Timewalk_MaxDistance | real | No | |
Timewalk_Point | location | No | |
Timewalk_Unit | unit | No | |
Timewalk_UnitPoint | location | No | |
UnitGroup | group | Yes |
//TESH.scrollpos=-1
//TESH.alwaysfold=0
//please go to lay in a map//(seize lay in , Troll Warlord.w3x , above , Setup)
function KillTimer takes timer t returns nothing
call PauseTimer(t)
call DestroyTimer(t)
endfunction
function KillTrigger takes trigger t returns nothing
call DisableTrigger(t)
call DestroyTrigger(t)
endfunction
//--------------------------------------------------------------------------//
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function Trig_Berserker_Rage_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A013'
endfunction
function Trig_Berserker_Rage takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(u,'A04Q')
call TriggerSleepAction(.1)
call SetUnitAbilityLevel(u,'A012',GetUnitAbilityLevel(u,'A013'))
if lvl > 0 then
if GetUnitTypeId(u) == 'O000' then
call UnitRemoveAbility(u,'A07C')
call UnitAddAbility(u,'A07A')
call SetUnitAbilityLevel(u,'A07A',lvl)
call UnitMakeAbilityPermanent(u,true,'A07A')
else
call UnitRemoveAbility(u,'A07A')
call UnitAddAbility(u,'A07C')
call SetUnitAbilityLevel(u,'A07C',lvl)
call UnitMakeAbilityPermanent(u,true,'A07C')
endif
endif
set u = null
endfunction
function InitTrig_Berserker_Rage takes nothing returns nothing
set gg_trg_Berserker_Rage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Berserker_Rage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Berserker_Rage, Condition( function Trig_Berserker_Rage_Conditions ) )
call TriggerAddAction( gg_trg_Berserker_Rage, function Trig_Berserker_Rage)
endfunction
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function Trig_Whirling_Axes_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A07A' or GetSpellAbilityId() == 'A07C' or GetLearnedSkill() == 'A04Q'
endfunction
function Trig_Whirling_Axes_Targ takes nothing returns boolean
return not (IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) and IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE) and IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL)) and GetWidgetLife(GetFilterUnit()) > .405 and GetUnitAbilityLevel(GetFilterUnit(),'Aloc') == 0
endfunction
function Trig_Whirling_Axes_Melee takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer s = GetHandleId(t)
local hashtable gc = udg_HashCache
local unit u = LoadUnitHandle(gc,s,1)
local integer c = LoadInteger(gc,s,3)+1
local unit array d
local real a = LoadReal(gc,s,4)+.3490655
local real dist = LoadReal(gc,s,5)
local integer lvl = LoadInteger(gc,s,7)
local group hit = LoadGroupHandle(gc,s,10)
local group dmg = CreateGroup()
local group chk = CreateGroup()
local boolexpr b = LoadBooleanExprHandle(gc,s,33)
local unit p
local unit e
set d[0] = LoadUnitHandle(gc,s,21)
set d[1] = LoadUnitHandle(gc,s,22)
if GetWidgetLife(d[0]) > .405 then
call GroupClear(chk)
call GroupEnumUnitsInRange(chk,GetUnitX(d[0]),GetUnitY(d[0]),125,b)
loop
exitwhen CountUnitsInGroup(chk) == 0
set p = FirstOfGroup(chk)
if IsUnitEnemy(p,GetOwningPlayer(u)) and not IsUnitInGroup(p,hit) then
call GroupAddUnit(dmg,p)
call GroupAddUnit(hit,p)
endif
call GroupRemoveUnit(chk,p)
set p = null
endloop
endif
if GetWidgetLife(d[1]) > .405 then
call GroupClear(chk)
call GroupEnumUnitsInRange(chk,GetUnitX(d[1]),GetUnitY(d[1]),125,b)
loop
exitwhen CountUnitsInGroup(chk) == 0
set p = FirstOfGroup(chk)
if IsUnitEnemy(p,GetOwningPlayer(u)) and not IsUnitInGroup(p,hit) then
call GroupAddUnit(dmg,p)
call GroupAddUnit(hit,p)
endif
call GroupRemoveUnit(chk,p)
set p = null
endloop
endif
if CountUnitsInGroup(dmg) != 0 then
loop
exitwhen CountUnitsInGroup(dmg) == 0
set p = FirstOfGroup(dmg)
call UnitDamageTarget(u,p,75+50*I2R(lvl),false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_METAL_HEAVY_SLICE)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\RexxarMissile\\RexxarMissile.mdl",p,"chest"))
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",p,"head"))
set e = CreateUnit(GetOwningPlayer(u),'e002',GetUnitX(p),GetUnitY(p),0)
call UnitAddAbility(e,'A07J')
call SetUnitAbilityLevel(e,'A07J',lvl)
call IssueTargetOrder(e,"curse",p)
call UnitApplyTimedLife(e,'BTLF',.5)
call GroupRemoveUnit(dmg,p)
set p = null
endloop
endif
call SaveInteger(gc,s,3,c)
if c <= 50 then
set dist = dist+7
call SetUnitX(d[0],GetUnitX(u)+dist*Cos(a))
call SetUnitY(d[0],GetUnitY(u)+dist*Sin(a))
call SetUnitX(d[1],GetUnitX(u)+dist*Cos(a+3.14159))
call SetUnitY(d[1],GetUnitY(u)+dist*Sin(a+3.14159))
call SaveReal(gc,s,5,dist)
call SaveReal(gc,s,4,a)
elseif c <= 95 then
set dist = dist-7
call SetUnitX(d[0],GetUnitX(u)+dist*Cos(a))
call SetUnitY(d[0],GetUnitY(u)+dist*Sin(a))
call SetUnitX(d[1],GetUnitX(u)+dist*Cos(a+3.14159))
call SetUnitY(d[1],GetUnitY(u)+dist*Sin(a+3.14159))
call SaveReal(gc,s,5,dist)
call SaveReal(gc,s,4,a)
else
call KillUnit(d[0])
call KillUnit(d[1])
call KillTimer(t)
call DestroyGroup(hit)
call DestroyBoolExpr(b)
call FlushChildHashtable(gc,s)
endif
call DestroyGroup(chk)
call DestroyGroup(dmg)
set chk = null
set dmg = null
set u = null
set t = null
set gc = null
set d[0] = null
set d[1] = null
endfunction
function Trig_Whirling_Axes_Ranged takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer s = GetHandleId(t)
local hashtable gc = udg_HashCache
local unit u = LoadUnitHandle(gc,s,1)
local real spd = 60
local real dist = LoadReal(gc,s,3)+spd
local unit array d
local real a
local group hit = LoadGroupHandle(gc,s,10)
local group dmg = CreateGroup()
local group chk = CreateGroup()
local boolexpr b = LoadBooleanExprHandle(gc,s,33)
local unit p
local unit e
set d[0] = LoadUnitHandle(gc,s,21)
set d[1] = LoadUnitHandle(gc,s,22)
set d[2] = LoadUnitHandle(gc,s,23)
set d[3] = LoadUnitHandle(gc,s,24)
set d[4] = LoadUnitHandle(gc,s,25)
if GetWidgetLife(d[0]) > .405 then
set a = GetUnitFacing(d[0])*.01745327
call SetUnitFlyHeight(d[0],(dist*75)/900,0)
call SetUnitX(d[0],GetUnitX(d[0])+spd*Cos(a))
call SetUnitY(d[0],GetUnitY(d[0])+spd*Sin(a))
call GroupClear(chk)
call GroupEnumUnitsInRange(chk,GetUnitX(d[0]),GetUnitY(d[0]),125,b)
loop
exitwhen CountUnitsInGroup(chk) == 0
set p = FirstOfGroup(chk)
if IsUnitEnemy(p,GetOwningPlayer(u)) and not IsUnitInGroup(p,hit) then
call GroupAddUnit(dmg,p)
call GroupAddUnit(hit,p)
call KillUnit(d[0])
endif
call GroupRemoveUnit(chk,p)
set p = null
endloop
endif
if GetWidgetLife(d[1]) > .405 then
set a = GetUnitFacing(d[1])*.01745327
call SetUnitFlyHeight(d[1],(dist*75)/900,0)
call SetUnitX(d[1],GetUnitX(d[1])+spd*Cos(a))
call SetUnitY(d[1],GetUnitY(d[1])+spd*Sin(a))
call GroupClear(chk)
call GroupEnumUnitsInRange(chk,GetUnitX(d[1]),GetUnitY(d[1]),125,b)
loop
exitwhen CountUnitsInGroup(chk) == 0
set p = FirstOfGroup(chk)
if IsUnitEnemy(p,GetOwningPlayer(u)) and not IsUnitInGroup(p,hit) then
call GroupAddUnit(dmg,p)
call GroupAddUnit(hit,p)
call KillUnit(d[1])
endif
call GroupRemoveUnit(chk,p)
set p = null
endloop
endif
if GetWidgetLife(d[2]) > .405 then
set a = GetUnitFacing(d[2])*.01745327
call SetUnitFlyHeight(d[2],(dist*75)/900,0)
call SetUnitX(d[2],GetUnitX(d[2])+spd*Cos(a))
call SetUnitY(d[2],GetUnitY(d[2])+spd*Sin(a))
call GroupClear(chk)
call GroupEnumUnitsInRange(chk,GetUnitX(d[2]),GetUnitY(d[2]),125,b)
loop
exitwhen CountUnitsInGroup(chk) == 0
set p = FirstOfGroup(chk)
if IsUnitEnemy(p,GetOwningPlayer(u)) and not IsUnitInGroup(p,hit) then
call GroupAddUnit(dmg,p)
call GroupAddUnit(hit,p)
call KillUnit(d[2])
endif
call GroupRemoveUnit(chk,p)
set p = null
endloop
endif
if GetWidgetLife(d[3]) > .405 then
set a = GetUnitFacing(d[3])*.01745327
call SetUnitFlyHeight(d[3],(dist*75)/900,0)
call SetUnitX(d[3],GetUnitX(d[3])+spd*Cos(a))
call SetUnitY(d[3],GetUnitY(d[3])+spd*Sin(a))
call GroupClear(chk)
call GroupEnumUnitsInRange(chk,GetUnitX(d[3]),GetUnitY(d[3]),125,b)
loop
exitwhen CountUnitsInGroup(chk) == 0
set p = FirstOfGroup(chk)
if IsUnitEnemy(p,GetOwningPlayer(u)) and not IsUnitInGroup(p,hit) then
call GroupAddUnit(dmg,p)
call GroupAddUnit(hit,p)
call KillUnit(d[3])
endif
call GroupRemoveUnit(chk,p)
set p = null
endloop
endif
if GetWidgetLife(d[4]) > .405 then
set a = GetUnitFacing(d[4])*.01745327
call SetUnitFlyHeight(d[4],(dist*75)/900,0)
call SetUnitX(d[4],GetUnitX(d[4])+spd*Cos(a))
call SetUnitY(d[4],GetUnitY(d[4])+spd*Sin(a))
call GroupClear(chk)
call GroupEnumUnitsInRange(chk,GetUnitX(d[4]),GetUnitY(d[4]),125,b)
loop
exitwhen CountUnitsInGroup(chk) == 0
set p = FirstOfGroup(chk)
if IsUnitEnemy(p,GetOwningPlayer(u)) and not IsUnitInGroup(p,hit) then
call GroupAddUnit(dmg,p)
call GroupAddUnit(hit,p)
call KillUnit(d[4])
endif
call GroupRemoveUnit(chk,p)
set p = null
endloop
endif
if CountUnitsInGroup(dmg) != 0 then
loop
exitwhen CountUnitsInGroup(dmg) == 0
set p = FirstOfGroup(dmg)
call UnitDamageTarget(u,p,75,false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_METAL_MEDIUM_SLICE)
set e = CreateUnit(GetOwningPlayer(u),'e002',GetUnitX(p),GetUnitY(p),0)
call UnitAddAbility(e,'A07I')
call SetUnitAbilityLevel(e,'A07I',LoadInteger(gc,s,7))
call IssueTargetOrder(e,"slow",p)
call UnitApplyTimedLife(e,'BTLF',.5)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\RexxarMissile\\RexxarMissile.mdl",p,"chest"))
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",p,"head"))
call GroupRemoveUnit(dmg,p)
set p = null
endloop
endif
call SaveReal(gc,s,3,dist)
if dist > 900 then
call KillUnit(d[0])
call KillUnit(d[1])
call KillUnit(d[2])
call KillUnit(d[3])
call KillUnit(d[4])
call DestroyGroup(hit)
call DestroyBoolExpr(b)
call KillTimer(t)
call FlushChildHashtable(gc,s)
endif
call DestroyGroup(chk)
call DestroyGroup(dmg)
set b = null
set chk = null
set dmg = null
set hit = null
set u = null
set t = null
set gc = null
set d[0] = null
set d[1] = null
set d[2] = null
set d[3] = null
set d[4] = null
endfunction
function Trig_Whirling_Axes takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(u,'A04Q')
local integer id
local timer t
local hashtable gc
local integer s
local real a
local real a2
local unit array d
if GetTriggerEventId() == EVENT_PLAYER_HERO_SKILL then
if GetUnitTypeId(u) == 'O000' then
call UnitRemoveAbility(u,'A07C')
call UnitAddAbility(u,'A07A')
call SetUnitAbilityLevel(u,'A07A',lvl)
call UnitMakeAbilityPermanent(u,true,'A07A')
else
call UnitRemoveAbility(u,'A07A')
call UnitAddAbility(u,'A07C')
call SetUnitAbilityLevel(u,'A07C',lvl)
call UnitMakeAbilityPermanent(u,true,'A07C')
endif
elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_EFFECT then
set id = GetSpellAbilityId()
set t = CreateTimer()
set gc = udg_HashCache
set s = GetHandleId(t)
if id == 'A07A' then
set a = Atan2(GetSpellTargetY()-GetUnitY(u),GetSpellTargetX()-GetUnitX(u))
set a2 = a*57.295827
call SaveUnitHandle(gc,s,1,u)
call SaveInteger(gc,s,2,lvl)
call SaveBooleanExprHandle(gc,s,33,Condition(function Trig_Whirling_Axes_Targ))
call SaveGroupHandle(gc,s,10,CreateGroup())
call SaveInteger(gc,s,7,GetUnitAbilityLevel(u,'A07A'))
call SaveUnitHandle(gc,s,21,CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u)+30*Cos(a),GetUnitY(u)+30*Sin(a),a2-12.5))
call SaveUnitHandle(gc,s,22,CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u)+30*Cos(a),GetUnitY(u)+30*Sin(a),a2-6.25))
call SaveUnitHandle(gc,s,23,CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u)+30*Cos(a),GetUnitY(u)+30*Sin(a),a2))
call SaveUnitHandle(gc,s,24,CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u)+30*Cos(a),GetUnitY(u)+30*Sin(a),a2+6.25))
call SaveUnitHandle(gc,s,25,CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u)+30*Cos(a),GetUnitY(u)+30*Sin(a),a2+12.5))
call TimerStart(t,.04,true,function Trig_Whirling_Axes_Ranged)
else
call SaveUnitHandle(gc,s,1,u)
call SaveInteger(gc,s,2,lvl)
call SaveReal(gc,s,4,GetUnitFacing(u)*.01745327)
call SaveInteger(gc,s,7,GetUnitAbilityLevel(u,'A07C'))
call SaveBooleanExprHandle(gc,s,33,Condition(function Trig_Whirling_Axes_Targ))
call SaveGroupHandle(gc,s,10,CreateGroup())
set d[0] = CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u),GetUnitY(u),0 )
set d[1] = CreateUnit(GetOwningPlayer(u),'n002',GetUnitX(u),GetUnitY(u),0 )
call SaveUnitHandle(gc,s,21,d[0])
call SaveUnitHandle(gc,s,22,d[1])
call SetUnitScale(d[0],.75,.75,.75)
call SetUnitScale(d[1],.75,.75,.75)
set d[0] = null
set d[1] = null
call TimerStart(t,.04,true,function Trig_Whirling_Axes_Melee)
endif
set t = null
set gc = null
endif
set u = null
endfunction
function InitTrig_Whirling_Axes takes nothing returns nothing
set gg_trg_Whirling_Axes = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Whirling_Axes, EVENT_PLAYER_HERO_SKILL )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Whirling_Axes, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Whirling_Axes, Condition( function Trig_Whirling_Axes_Conditions ) )
call TriggerAddAction( gg_trg_Whirling_Axes, function Trig_Whirling_Axes )
endfunction
function Trig_Fervor_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(),'A06C') > 0 and not IsUnitType(GetTriggerUnit(),UNIT_TYPE_STRUCTURE)
endfunction
function Trig_Fervor_Tick takes nothing returns nothing
local unit u
local unit targ
local trigger t = GetTriggeringTrigger()
local hashtable gc = udg_HashCache
local integer s = GetHandleId(t)
local integer lvl = GetUnitAbilityLevel(u,'A06C')
local integer c = 0
if GetTriggerEventId() == EVENT_UNIT_DAMAGED then
set u = LoadUnitHandle(gc,s,1)
if GetEventDamageSource() == u then
set targ = GetTriggerUnit()
set c = GetUnitAbilityLevel(u,'A08T')
if targ != LoadUnitHandle(gc,GetHandleId(u),StringHash("trollfervor")) then
set c = R2I(c/2)
call SaveUnitHandle(gc,GetHandleId(u),StringHash("trollfervor"),targ)
else
set c = c+1
if c > lvl+1 then
set c = lvl+1
endif
endif
call SetUnitAbilityLevel(u,'A08T',c)
set targ = null
endif
set u = null
endif
call TriggerRemoveAction(t,LoadTriggerActionHandle(gc,s,2))
call FlushChildHashtable(gc,s)
call KillTrigger(t)
set t = null
set gc = null
endfunction
function Trig_Fervor takes nothing returns nothing
local unit u = GetAttacker()
local unit targ = GetTriggerUnit()
local trigger t = CreateTrigger()
local integer s = GetHandleId(t)
local hashtable gc = udg_HashCache
local triggeraction ta
if GetUnitAbilityLevel(u,'A08T') == 0 then
call UnitAddAbility(u,'A08T')
endif
call SaveUnitHandle(gc,s,1,u)
call TriggerRegisterUnitEvent(t,targ,EVENT_UNIT_DAMAGED)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_ISSUED_ORDER)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterTimerEvent(t,2.5,false)
set ta = TriggerAddAction(t,function Trig_Fervor_Tick)
call SaveTriggerActionHandle(gc,s,2,ta)
set u = null
set targ = null
set t = null
set gc = null
set ta = null
endfunction
function InitTrig_Fervor takes nothing returns nothing
set gg_trg_Fervor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fervor, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Fervor, Condition( function Trig_Fervor_Conditions ) )
call TriggerAddAction( gg_trg_Fervor, function Trig_Fervor)
endfunction
function Trig_Battle_Trance_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01H'
endfunction
function Trig_Battle_Trance_Targ takes nothing returns boolean
return GetWidgetLife(GetFilterUnit()) > .405 and IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction
function Trig_Battle_Trance_End takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer s = GetHandleId(t)
local hashtable gc = udg_HashCache
local group g = LoadGroupHandle(gc,s,StringHash("g"))
local unit p
local integer i
loop
set p = FirstOfGroup(g)
set i = LoadInteger(gc,GetHandleId(p),StringHash("trolltrance"))-1
call SaveInteger(gc,GetHandleId(p),StringHash("trolltrance"),i)
exitwhen CountUnitsInGroup(g) <= 0
if i <= 0 then
call UnitRemoveAbility(p,'A00E')
call UnitRemoveAbility(p,'B004')
call RemoveSavedInteger(gc,GetHandleId(p),StringHash("trolltrance"))
endif
call GroupRemoveUnit(g,p)
set p = null
endloop
call DestroyGroup(g)
call KillTimer(t)
call FlushChildHashtable(gc,s)
set p = null
set t = null
set g = null
set gc = null
endfunction
function Trig_Battle_Trance_Rampage takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer s = GetHandleId(t)
local hashtable gc = udg_HashCache
local unit p = LoadUnitHandle(gc,s,StringHash("u"))
local integer i = LoadInteger(gc,GetHandleId(p),StringHash("trolltrance"))-1
if i <= 0 then
call UnitRemoveAbility(p,'A00E')
call UnitRemoveAbility(p,'B004')
endif
call KillTimer(t)
call FlushChildHashtable(gc,s)
set p = null
set t = null
set gc = null
endfunction
function Trig_Battle_Trance takes nothing returns nothing
local group g = CreateGroup()
local unit u = GetTriggerUnit()
local boolexpr b = Condition(function Trig_Battle_Trance_Targ)
local integer lvl = GetUnitAbilityLevel(u,'A01H')
local timer t = CreateTimer()
local timer t2 = CreateTimer()
local hashtable gc = udg_HashCache
local unit p
local group g2 = CreateGroup()
call GroupEnumUnitsInRange(g,GetUnitX(u),GetUnitY(u),99999,b)
loop
exitwhen CountUnitsInGroup(g) <= 0
set p = FirstOfGroup(g)
call UnitAddAbility(p,'A00E')
call SetUnitAbilityLevel(p,'S004',lvl)
call SetPlayerAbilityAvailable(GetOwningPlayer(p),'A00E',false)
call SaveInteger(gc,GetHandleId(p),StringHash("trolltrance"),LoadInteger(gc,GetHandleId(p),StringHash("trolltrance"))+1)
call GroupRemoveUnit(g,p)
if p != u then
call GroupAddUnit(g2,p)
endif
set p = null
endloop
call SaveGroupHandle(gc,GetHandleId(t),StringHash("g"),g2)
call SaveUnitHandle(gc,GetHandleId(t2),StringHash("u"),u)
call TimerStart(t,5,false,function Trig_Battle_Trance_End)
call TimerStart(t2,10,false,function Trig_Battle_Trance_Rampage)
call DestroyBoolExpr(b)
call DestroyGroup(g)
call TriggerSleepAction(0)
call SetUnitAnimationByIndex(u,3)
set g = null
set b = null
set t = null
set t2 = null
set gc = null
set p = null
set g2 = null
endfunction
function InitTrig_Battle_Trance takes nothing returns nothing
set gg_trg_Battle_Trance = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Battle_Trance, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Battle_Trance, Condition( function Trig_Battle_Trance_Conditions ) )
call TriggerAddAction( gg_trg_Battle_Trance, function Trig_Battle_Trance)
endfunction