function NullCondition takes nothing returns boolean
return true
endfunction
function Already_Picked takes integer id returns boolean
local integer a = 1
loop
exitwhen a > 10
if (id == GetUnitTypeId(udg_Hero[a])) then
return true
endif
set a = a + 1
endloop
return false
endfunction
function Remove_Unit_From_Rect takes integer i, rect r returns nothing
local group g = GetUnitsInRectMatching(r, Condition(function NullCondition))
local unit e
loop
set e = FirstOfGroup(g)
exitwhen (GetUnitTypeId(e) == i or CountUnitsInGroup(g) <= 0)
call GroupRemoveUnit(g, e)
endloop
call RemoveUnit(e)
set e = null
call DestroyGroup(g)
set g = null
set r = null
endfunction
function Create_Random_Hero takes player p, real x, real y returns unit
local group g = GetUnitsInRectMatching(gg_rct_Hero_Select, Condition(function NullCondition))
local unit e = FirstOfGroup(g)
local unit r
local unitpool u = CreateUnitPool()
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g)
if (not Already_Picked(GetUnitTypeId(e))) then
call UnitPoolAddUnitType(u, GetUnitTypeId(e), 1)
endif
call GroupRemoveUnit(g, e)
endloop
set r = PlaceRandomUnit(u, p, x, y, 270)
call Remove_Unit_From_Rect(GetUnitTypeId(r), gg_rct_Hero_Select)
call DestroyGroup(g)
set g = null
call DestroyUnitPool(u)
set u = null
return r
endfunction
function CountLivingPlayerUnitsOfTypeId_Fixed takes integer unitId, player whichPlayer returns integer
local group g
local integer matchedCount
set g = CreateGroup()
set bj_livingPlayerUnitsTypeId = unitId
call GroupEnumUnitsOfPlayer(g, whichPlayer, filterLivingPlayerUnitsOfTypeId)
set matchedCount = CountUnitsInGroup(g)
call DestroyGroup(g)
set g = null
return matchedCount
endfunction
function MStat takes string s returns integer
if s == "lvl" then
return 1
elseif s == "pow" then
return 2
elseif s == "dex" then
return 3
elseif s == "mind" then
return 4
elseif s == "def" then
return 5
elseif s == "pb" then
return 6
elseif s == "defcycler" then
return 7
else
return -1
endif
endfunction
function MLevelUp takes integer id, integer a, integer b, integer c, integer d, unit u returns nothing
local integer l = LoadInteger(udg_mag, id, MStat("lvl")) + 1
local unit e
local integer o = 0
local integer dc = 0
local item mag = LoadItemHandle(udg_mag, id, 0)
local integer defcycler = LoadInteger(udg_mag, id, MStat("defcycler"))
local integer pow = LoadInteger(udg_mag, id, MStat("pow"))
local integer dex = LoadInteger(udg_mag, id, MStat("dex"))
local integer mind = LoadInteger(udg_mag, id, MStat("mind"))
local integer def = LoadInteger(udg_mag, id, MStat("def"))
call SaveInteger(udg_mag, id, MStat("lvl"), l)
call SaveInteger(udg_mag, id, MStat("pow"), LoadInteger(udg_mag, id, MStat("pow")) + a)
call SaveInteger(udg_mag, id, MStat("dex"), LoadInteger(udg_mag, id, MStat("dex")) + b)
call SaveInteger(udg_mag, id, MStat("mind"), LoadInteger(udg_mag, id, MStat("mind")) + c)
call SaveInteger(udg_mag, id, MStat("def"), LoadInteger(udg_mag, id, MStat("def")) + d)
call SetHeroStr(u, GetHeroStr(u, false) + a, true)
call SetHeroAgi(u, GetHeroAgi(u, false) + b, true)
call SetHeroInt(u, GetHeroInt(u, false) + c, true)
if d > 0 then
set defcycler = defcycler + d
if defcycler >= 3 then
call SetHeroStr(u, GetHeroStr(u, false) + 1, true)
call SetHeroAgi(u, GetHeroAgi(u, false) + 1, true)
call SetHeroInt(u, GetHeroInt(u, false) + 1, true)
set defcycler = 0
endif
endif
call SaveInteger(udg_mag, id, MStat("defcycler"), defcycler)
loop
set e = udg_Hero[o]
exitwhen o > 9 or UnitHasItem(e, mag)
set o = o + 1
endloop
if l == 10 then
if pow == 5 and dex == 5 and mind == 5 and def == 10 then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03D')
else
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03R')
endif
elseif l == 35 then
if pow + dex > mind + def then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03E')
else
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03Q')
endif
elseif l == 50 then
if pow > dex and pow > mind and pow > def then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03N')
elseif dex > pow and dex > mind and dex > def then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03F')
elseif mind > pow and mind > dex and mind > def then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03O')
elseif def >= pow and def >= dex and def >= mind then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03P')
endif
endif
if GetItemLevel(mag) != 3 then
if pow == 100 and pow > dex and pow > mind and pow > def then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03J')
elseif dex == 100 and dex > pow and dex > mind and dex > def then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03L')
elseif mind == 100 and mind > pow and mind > dex and mind > def then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03K')
elseif def == 100 and def > pow and def > dex and def > mind then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03M')
elseif pow == 100 and dex == 100 and mind == 100 and def == 100 then
call RemoveItem(mag)
set mag = UnitAddItemById(e, 'I03H')
endif
endif
call SaveItemHandle(udg_mag, id, 0, mag)
set e = null
set mag = null
endfunction
function Message takes string m, real d returns nothing
local player p
local integer i = 0
loop
exitwhen i > 11
set p = Player(i)
call DisplayTimedTextToPlayer(p, 0, 0, d, m)
set i = i + 1
endloop
set p = null
endfunction
function Enemy_Check takes nothing returns boolean
local unit u = GetFilterUnit()
local player p1 = GetOwningPlayer(u)
local player p2 = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local player p3 = Player(11)
local boolean b = ((GetUnitState(u, UNIT_STATE_LIFE) > 0.405) and ((p1 == p2) or (p1 == p3)))
set u = null
set p1 = null
set p2 = null
set p3 = null
return b
endfunction
function Enemy_Check_11 takes nothing returns boolean
local unit u = GetFilterUnit()
local player p1 = GetOwningPlayer(u)
local player p2 = Player(11)
local boolean b = (p1 == p2)
set u = null
set p1 = null
set p2 = null
return b
endfunction
function Hero_Check takes nothing returns boolean
local unit u = GetFilterUnit()
local boolean b = (u == udg_Hero[1] or u == udg_Hero[2] or u == udg_Hero[3] or u == udg_Hero[4] or u == udg_Hero[5] or u == udg_Hero[6] or u == udg_Hero[7] or u == udg_Hero[8] or u == udg_Hero[9] or u == udg_Hero[10])
set u = null
return b
endfunction
function Count_Held_Items_Of_Type takes unit u, integer id returns integer
local integer count = 0
local integer index = 0
local item indexItem
loop
set indexItem = UnitItemInSlot(u, index)
if indexItem != null and GetItemTypeId(indexItem) == id then
set count = count + 1
endif
set index = index + 1
exitwhen index >= 6
endloop
set indexItem = null
return count
endfunction
function Count_Held_Items_Of_Level takes unit u, integer level, integer t returns integer
local integer count = 0
local integer index = 0
local item indexItem
loop
set indexItem = UnitItemInSlot(u, index)
if indexItem != null and GetItemLevel(indexItem) == level and GetItemType(indexItem) == ConvertItemType(t) then
set count = count + 1
endif
set index = index + 1
exitwhen index >= 6
endloop
set indexItem = null
return count
endfunction
function Count_Players takes nothing returns integer
local integer count = 0
local integer i = 0
local player p
loop
exitwhen i > 9
set p = Player(i)
if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING then
set count = count + 1
endif
set i = i + 1
endloop
set p = null
return count
endfunction
function Count_Humans takes nothing returns integer
local integer count = 0
local integer i = 0
local player p
loop
exitwhen i > 9
set p = Player(i)
if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p) == MAP_CONTROL_USER then
set count = count + 1
endif
set i = i + 1
endloop
set p = null
return count
endfunction
function Spawn_Computer_Heroes takes nothing returns integer
local location l = GetRectCenter(gg_rct_Target)
local player q = Player(0)
local player p
local unit u
local integer i = 0
local integer r = 0
loop
exitwhen i > 9
set p = Player(i)
if GetPlayerController(p) == MAP_CONTROL_COMPUTER then
if (udg_LoadHero[GetPlayerId(p)+1] != null) then
if (not Already_Picked(GetUnitTypeId(udg_LoadHero[GetPlayerId(p)+1]))) then
set u = CreateUnit(p, GetUnitTypeId(udg_LoadHero[GetPlayerId(p)+1]), GetLocationX(l), GetLocationY(l), 0)
else
call Message("Bot " + I2S(i+1) + " could not be the hero selected with the |cff00ff00-d|r command because someone else chose that hero.", 10)
set u = Create_Random_Hero(p, GetLocationX(l), GetLocationY(l))
endif
else
set u = Create_Random_Hero(p, GetLocationX(l), GetLocationY(l))
endif
call Remove_Unit_From_Rect(GetUnitTypeId(u), gg_rct_Hero_Select)
set udg_Hero[i+1] = u
call SetPlayerAlliance(q, p, ALLIANCE_SHARED_CONTROL, true)
call SetPlayerAlliance(p, q, ALLIANCE_SHARED_CONTROL, true)
if GetUnitTypeId(u) == 'N053' then
call RemoveUnit(u)
set u = CreateUnit(p, 'N03D', GetLocationX(l), GetLocationY(l), 0)
endif
if udg_mode == 4 then
call SetHeroLevelBJ(u, 100, false)
endif
set r = r + 1
endif
set i = i + 1
endloop
call RemoveLocation(l)
set l = null
set p = null
set q = null
set u = null
return r
endfunction
function Set_Computer_Controller takes integer whichplayer returns nothing
local player q = Player(whichplayer)
local player p
local integer i = 0
local integer r = 0
loop
exitwhen i > 9
set p = Player(i)
if GetPlayerController(p) == MAP_CONTROL_COMPUTER then
call SetPlayerAlliance(q, p, ALLIANCE_SHARED_CONTROL, true)
call SetPlayerAlliance(p, q, ALLIANCE_SHARED_CONTROL, true)
set r = r + 1
endif
set i = i + 1
endloop
set p = null
set q = null
endfunction
function Spawn_Boss takes nothing returns nothing
local location l = GetRectCenter(gg_rct_WaveSpawn2)
local location t = GetRectCenter(gg_rct_Target)
local player p11 = Player(11)
local unit v
local force f = GetPlayersAll()
local integer m = 1
local integer p = Count_Players() - 1
if udg_mode == 5 then
set m = 4
endif
if udg_waveCount == 5 then
set v = CreateUnitAtLoc(p11, udg_Bosses[0], l, 0)
call SetHeroLevel(v, 49 + p * 7, false)
call DisplayTextToForce(f, "A boss is coming!")
call SetUnitMoveSpeed(v, 1.5 * GetUnitMoveSpeed(v) * m)
call IssuePointOrderLoc(v, "patrol", t)
elseif udg_waveCount == 10 then
set v = CreateUnitAtLoc(p11, udg_Bosses[1], l, 0)
call SetHeroLevel(v, 77 + p * 7, false)
call DisplayTextToForce(f, "A boss is coming!")
call SetUnitMoveSpeed(v, 1.5 * GetUnitMoveSpeed(v) * m)
call IssuePointOrderLoc(v, "patrol", t)
elseif udg_waveCount == 15 then
set v = CreateUnitAtLoc(p11, udg_Bosses[2], l, 0)
call SetHeroLevel(v, 105 + p * 7, false)
call DisplayTextToForce(f, "A boss is coming!")
call SetUnitMoveSpeed(v, 1.5 * GetUnitMoveSpeed(v) * m)
call IssuePointOrderLoc(v, "patrol", t)
elseif udg_waveCount == 20 then
set v = CreateUnitAtLoc(p11, udg_Bosses[3], l, 0)
call SetHeroLevel(v, 133 + p * 7, false)
call DisplayTextToForce(f, "A boss is coming!")
call SetUnitMoveSpeed(v, 1.5 * GetUnitMoveSpeed(v) * m)
call IssuePointOrderLoc(v, "patrol", t)
elseif udg_waveCount == 25 then
set udg_FinalBoss = CreateUnitAtLoc(p11, udg_Bosses[4], l, 0)
call SetHeroLevel(udg_FinalBoss, 200, false)
call DisplayTextToForce(f, "|cffff0000The final boss is coming!|r")
call IssuePointOrderLoc(udg_FinalBoss, "patrol", t)
endif
call RemoveLocation(l)
set l = null
set p11 = null
set v = null
call DestroyForce(f)
set f = null
endfunction
function Spawn_Enemies takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer p = Count_Players() - 1
local integer a = LoadInteger(udg_h, GetHandleId(t), 'a')
local integer b = LoadInteger(udg_h, GetHandleId(t), 'b')
local integer c = 1
local integer m = 1
local unit u
local location array l
local force f = GetPlayersAll()
local player p11 = Player(11)
set l[1] = GetRectCenter(gg_rct_WaveSpawn1)
set l[2] = GetRectCenter(gg_rct_WaveSpawn2)
set l[3] = GetRectCenter(gg_rct_WaveSpawn3)
set l[4] = GetRectCenter(gg_rct_Target)
if udg_mode == 5 then
set m = 4
endif
if a < b then
loop
exitwhen c > 3
set u = CreateUnitAtLoc(p11, udg_Wave[udg_waveCount], l[c], 0)
call UnitApplyTimedLifeBJ( 180, 'BTLF', u )
call SetUnitMoveSpeed(u, 1.5 * GetUnitMoveSpeed(u) * m)
call IssuePointOrderLoc(u, "patrol", l[4])
set u = null
set c = c + 1
endloop
else
call EnableTrigger(gg_trg_Enemy_Cleanup)
call PauseTimer(t)
call DestroyTimer(t)
set udg_waveCount = udg_waveCount + 1
endif
call SaveInteger(udg_h, GetHandleId(t), 'a', a + 1)
set t = null
set u = null
call RemoveLocation(l[1])
call RemoveLocation(l[2])
call RemoveLocation(l[3])
call RemoveLocation(l[4])
set l[1] = null
set l[2] = null
set l[3] = null
set l[4] = null
set p11 = null
call DestroyForce(f)
set f = null
endfunction
function FoShizzle takes nothing returns boolean
return not Enemy_Check()
endfunction
function MaDrizzle takes nothing returns boolean //fixed thanks to Kobas!!
call KillUnit(GetEnumUnit())
return false
endfunction
function Next_Wave takes nothing returns nothing
local timer t = CreateTimer()
local integer m = 0
local group g
local player p = GetLocalPlayer()
call DisableTrigger(gg_trg_Enemy_Cleanup)
if udg_purge == true then
set g = CreateGroup()
call GroupEnumUnitsInRect(g, gg_rct_WaveSpawn1, Condition(function MaDrizzle))
call GroupEnumUnitsInRect(g, gg_rct_WaveSpawn2, Condition(function MaDrizzle))
call GroupEnumUnitsInRect(g, gg_rct_WaveSpawn3, Condition(function MaDrizzle))
call ForGroup(g, function FoShizzle)
endif
if udg_mode != 2 and udg_mode != 4 then
call TimerDialogSetTitle(udg_TimerDialog, "Wave " + I2S(udg_waveCount + 1) + " spawns in:")
if udg_waveCount > 25 then
call PauseTimer(udg_Timer)
call DestroyTimer(udg_Timer)
call DestroyTimerDialog(udg_TimerDialog)
set udg_Timer = null
set udg_TimerDialog = null
return
endif
endif
if udg_mode == 5 then
set m = -2
endif
call PlaySoundBJ( gg_snd_QuestNew )
call Message("Wave |cff00ff00" + I2S(udg_waveCount) + "|r is coming!", 12)
if UnitHasItemOfTypeBJ(udg_Hero[GetPlayerId(p)+1], 'I03A') then
if udg_waveCount < 25 then
call Message("The current wave is |cffff00ff" + GetObjectName(udg_Wave[udg_waveCount]) + "|r.", 20)
endif
if udg_waveCount < 24 then
call Message("The next wave will be |cffff00ff" + GetObjectName(udg_Wave[udg_waveCount+1]) + "|r.", 20)
endif
endif
call SaveInteger(udg_h, GetHandleId(t), 'a', 0)
call SaveInteger(udg_h, GetHandleId(t), 'b', 18 + m)
call Spawn_Boss()
call TimerStart(t, .75, true, function Spawn_Enemies)
set p = null
endfunction
function Send_Wave takes integer wave_to_send, boolean return_to_old_wave_count returns nothing
local integer old_waveCount = udg_waveCount
set udg_waveCount = wave_to_send
call Next_Wave()
if return_to_old_wave_count == true then
call TriggerSleepAction(10)
set udg_waveCount = old_waveCount
endif
endfunction
function SetWaveList takes integer i returns nothing
local integer a = 1
local string s
if i == 1 then
set udg_Wave[1] = 'o00F'
set udg_Wave[2] = 'o00M'
set udg_Wave[3] = 'o00Q'
set udg_Wave[4] = 'o00Y'
set udg_Wave[5] = 'o013'
set udg_Wave[6] = 'o014'
set udg_Wave[7] = 'o021'
set udg_Wave[8] = 'o028'
set udg_Wave[9] = 'o023'
set udg_Wave[10] = 'o024'
set udg_Wave[11] = 'o025'
set udg_Wave[12] = 'o026'
set udg_Wave[13] = 'o027'
set udg_Wave[14] = 'o022'
set udg_Wave[15] = 'o029'
set udg_Wave[16] = 'o02A'
set udg_Wave[17] = 'o02B'
set udg_Wave[18] = 'o02C'
set udg_Wave[19] = 'o02D'
set udg_Wave[20] = 'o02E'
set udg_Wave[21] = 'o02F'
set udg_Wave[22] = 'o02G'
set udg_Wave[23] = 'o017'
set udg_Wave[24] = 'o02H'
set udg_Wave[25] = 'o02I'
set udg_Bosses[0] = 'N04S'
set udg_Bosses[1] = 'N04T'
set udg_Bosses[2] = 'N04U'
set udg_Bosses[3] = 'N04V'
set udg_Bosses[4] = 'N02B'
elseif i == 2 then
loop
set udg_Wave[a] = 'o02I' + a
exitwhen a == 16
set a = a + 1
endloop
set udg_Wave[17] = 'o02Z'
set udg_Wave[18] = 'o030'
set udg_Wave[19] = 'o031'
set udg_Wave[20] = 'o032'
set udg_Wave[21] = 'o033'
set udg_Wave[22] = 'o034'
set udg_Wave[23] = 'o035'
set udg_Wave[24] = 'o036'
set udg_Wave[25] = 'o037'
set udg_Bosses[0] = 'N00D'
set udg_Bosses[1] = 'N04O'
set udg_Bosses[2] = 'N04P'
set udg_Bosses[3] = 'N04Q'
set udg_Bosses[4] = 'N04R'
elseif i == 3 then
set udg_Wave[1] = 'o038'
set udg_Wave[2] = 'o039'
set udg_Wave[3] = 'o03A'
set udg_Wave[4] = 'o03B'
set udg_Wave[5] = 'o03C'
set udg_Wave[6] = 'o03D'
set udg_Wave[7] = 'o03E'
set udg_Wave[8] = 'o03F'
set udg_Wave[9] = 'o03G'
set udg_Wave[10] = 'o03H'
set udg_Wave[11] = 'o03I'
set udg_Wave[12] = 'o03J'
set udg_Wave[13] = 'o03K'
set udg_Wave[14] = 'o03L'
set udg_Wave[15] = 'o03M'
set udg_Wave[16] = 'o03N'
set udg_Wave[17] = 'o03O'
set udg_Wave[18] = 'o03P'
set udg_Wave[19] = 'o03Q'
set udg_Wave[20] = 'o03R'
set udg_Wave[21] = 'o03S'
set udg_Wave[22] = 'o03T'
set udg_Wave[23] = 'o03U'
set udg_Wave[24] = 'o03V'
set udg_Wave[25] = 'o03W'
set udg_Bosses[0] = 'N04W'
set udg_Bosses[1] = 'N04X'
set udg_Bosses[2] = 'N04Y'
set udg_Bosses[3] = 'N04Z'
set udg_Bosses[4] = 'N050'
elseif i == 4 then
call SetWaveList(GetRandomInt(0, 3))
set udg_vpts = udg_vpts + 5
return
else
set udg_Wave[1] = 'o007'
set udg_Wave[2] = 'o006'
set udg_Wave[3] = 'o00E'
set udg_Wave[4] = 'o00G'
set udg_Wave[5] = 'o00H'
set udg_Wave[6] = 'o00I'
set udg_Wave[7] = 'o00J'
set udg_Wave[8] = 'o00K'
set udg_Wave[9] = 'o00L'
set udg_Wave[10] = 'o00N'
set udg_Wave[11] = 'o00R'
set udg_Wave[12] = 'o00S'
set udg_Wave[13] = 'o00T'
set udg_Wave[14] = 'o00U'
set udg_Wave[15] = 'o00V'
set udg_Wave[16] = 'o00W'
set udg_Wave[17] = 'o00X'
set udg_Wave[18] = 'o00Z'
set udg_Wave[19] = 'o031'
set udg_Wave[20] = 'o011'
set udg_Wave[21] = 'o033'
set udg_Wave[22] = 'o016'
set udg_Wave[23] = 'o017'
set udg_Wave[24] = 'o018'
set udg_Wave[25] = 'o019'
set udg_Bosses[0] = 'N01J'
set udg_Bosses[1] = 'N01K'
set udg_Bosses[2] = 'N00H'
set udg_Bosses[3] = 'N01T'
set udg_Bosses[4] = 'N02B'
endif
endfunction
function Check_Chaos takes nothing returns nothing
local player p = Player(11)
local rect array where
local location there
if udg_Chaos < 0 then
call NullCondition()
elseif udg_Chaos >= 10 then
set where[0] = gg_rct_Region_041
set where[1] = gg_rct_Region_036
set where[2] = gg_rct_Region_042
set where[3] = gg_rct_Region_043
set where[4] = gg_rct_Region_046
set there = GetRandomLocInRect(where[GetRandomInt(0, 4)])
call CreateUnitAtLoc(p, 'n052', there, 270)
call Message("--- |cff00ff00Event Report|r ---", 10)
call Message("|cff00ff00Event:|r Chaos Incarnate", 10)
call Message("A mysterious vendor has appeared somewhere.", 10)
set udg_Chaos = -1
set udg_vpts = udg_vpts + 5
set where[0] = null
set where[1] = null
set where[2] = null
set where[3] = null
set where[4] = null
set there = null
endif
call RemoveLocation(there)
set there = null
set p = null
endfunction
Name | Type | is_array | initial_value |
ac | integer | No | |
army | integer | No | |
armybutton | button | Yes | |
ArmySelect | dialog | No | |
asleep | group | No | |
Bosses | unitcode | Yes | |
botspawn | integer | No | |
CameraLocked | boolean | Yes | |
Chaos | integer | No | |
crpt | hashtable | No | |
Defenders | force | No | |
dif | integer | No | |
difbutton | button | Yes | |
DifSelect | dialog | No | |
FinalBoss | unit | No | |
flagbonus | integer | No | 1 |
h | hashtable | No | |
helper | boolean | No | true |
Hero | unit | Yes | UnitNull |
insanity | boolean | No | |
insanityButton | button | No | |
kills | integer | Yes | |
LastCaveUnit | unit | No | |
LoadHero | unit | Yes | |
mag | hashtable | No | |
mgscale | real | No | 0.50 |
mode | integer | No | |
modebutton | button | Yes | |
ModeSelect | dialog | No | |
multiboard | multiboard | No | |
PickedHero | boolean | Yes | |
playerorder | integer | Yes | |
prevbonus | integer | No | |
purge | boolean | No | |
rc | integer | Yes | |
singleplayerbutton | button | No | |
speed | integer | No | |
speedbutton | button | Yes | |
SpeedSelect | dialog | No | |
startingbutton | button | Yes | |
startingcondition | integer | No | |
StartingSelect | dialog | No | |
Timer | timer | No | |
TimerDialog | timerdialog | No | |
tips | hashtable | No | |
ven | integer | No | |
vpts | integer | No | |
Wave | unitcode | Yes | |
waveCount | integer | No | 1 |
function SetHeroTips takes hashtable h returns nothing
call SaveStr(h, 'U00C', 0, "All-Around\nAdept at healing, damaging, & tanking.")
call SaveStr(h, 'N03V', 0, "Warrior\nAdept at killing foes and powering up.")
call SaveStr(h, 'U004', 0, "Warrior\nAdept at killing foes and powering up.")
call SaveStr(h, 'E007', 0, "Warrior\nA mysterious warrior adept at maneuvering in battle and dispatching bosses.")
call SaveStr(h, 'O00O', 0, "Summoner\nCapable of holding back armies by summoning armies of his own. Good at holding back enemies, but slow to kill them.")
call SaveStr(h, 'N00R', 0, "Ranger\n") //elite dark ranger
call SaveStr(h, 'N00I', 0, "Support\nSpecializes in mana restoration rather than healing.")
call SaveStr(h, 'N00V', 0, "Warrior\nUses gravitational magic to push and pull enemies.")
call SaveStr(h, 'N053', 0, "Mage\nAdept at killing groups of foes.")
call SaveStr(h, 'N03D', 0, "Mage\nAdept at killing groups of foes.")
call SaveStr(h, 'N000', 0, "Ranger\nA ranger known for being able to hold her own in combat.")
call SaveStr(h, 'N009', 0, "Tank\nThe keeper of the gates of hell. Legends say he can hold off entire armies.")
call SaveStr(h, 'U000', 0, "Mage\nUses a summon to shield himself while he wields the power of the Earth to destroy enemies.")
call SaveStr(h, 'U007', 0, "Mage\nAdept at avoiding damage and destroying groups of foes.")
call SaveStr(h, 'U00D', 0, "Support\nAdept at both fighting and healing.")
call SaveStr(h, 'H000', 0, "Warrior\nUses lightning to kill enemies as well as ehance himself.")
call SaveStr(h, 'H006', 0, "Ranger\nA gunman who can fight from incredible distances, but also has extremely low HP.")
call SaveStr(h, 'N01I', 0, "Unique\nMust consume the agony of living beings to sustain himself outside the dream world.") //nightmare
call SaveStr(h, 'H008', 0, "Warrior\nTakes on groups of enemies by freezing them.")
call SaveStr(h, 'H002', 0, "Warrior\nAdept at killing foes and powering up.")
call SaveStr(h, 'N01Y', 0, "Warrior\n") //panderen battlemaster
call SaveStr(h, 'N002', 0, "Mage\nA mechanically-ehanced goblin with no attack... in his current form.")
call SaveStr(h, 'U001', 0, "Summoner\nSummons legions of insects to overwhelm foes.")
call SaveStr(h, 'O00D', 0, "Warrior\n") //queen of ages
call SaveStr(h, 'H004', 0, "Ranger\nAdept at weakening and killing groups of foes.")
call SaveStr(h, 'O005', 0, "Warrior\nUses fire magic to destroy groups of foes.")
call SaveStr(h, 'O003', 0, "Tank\nKnown to call upon his ancestors to aid him in battle.")
call SaveStr(h, 'N016', 0, "Unique\nFights by disabling foes.") //temptress
call SaveStr(h, 'H001', 0, "Mage, Summoner\nAdept at killing groups of foes as well as summoning minions.")
call SaveStr(h, 'H003', 0, "Mage\nAdept at using storm magic to disable and kill groups of foes.")
call SaveStr(h, 'E000', 0, "Warrior\nExceptional at enhancing itself; fights better at night.")
call SaveStr(h, 'E00V', 0, "Unique\nFights by infecting enemies with a powerful disease.")
call SaveStr(h, 'E006', 0, "Ranger\nAdept at taking out enemies in certain formations as well as eluding combat.")
call SaveStr(h, 'E005', 0, "Mage\nUses summoned wisps to enhance offensive and support spells.")
call SaveStr(h, 'U00R', 0, "Tank\nMakes use of trees as weapons and food. Extremely good at tanking.")
call SaveStr(h, 'E00S', 0, "Ranger\n") //enchantress
call SaveStr(h, 'E008', 0, "Summoner\nCalls upon trees to fight foes and to support allies.")
call SaveStr(h, 'E00A', 0, "Ranger\n") //troll
call SaveStr(h, 'E00O', 0, "Unique\nCapable of damaging single foes & groups of foes; spells become stronger after taking more damage.")
call SaveStr(h, 'U00Q', 0, "Tank\nAdept and enduring great amounts of damage and holding off groups of foes.")
call SaveStr(h, 'U00E', 0, "Summoner\nUses corpses to bring about the will of the Lich King.")
call SaveStr(h, 'O01Z', 0, "Support, Summoner\nUses summons which support allies and take hits.")
call SaveStr(h, 'U00A', 0, "Warrior\nSustains himself by damaging foes.")
call SaveStr(h, 'H024', 0, "Unique\nSpreads the zombie virus to summon more zombies.")
call SaveStr(h, 'O00A', 0, "Warrior\nA stealthy warrior who specializes in assinating enemies.") //assassin
call SaveStr(h, 'O01A', 0, "Warrior\nA swift warrior who lives for the thrill of the battle.") //centaur
call SaveStr(h, 'O00B', 0, "Warrior\nA cunning warrior who specializes in poison attacks.")
call SaveStr(h, 'O008', 0, "Warrior\n") //draenei
call SaveStr(h, 'O01F', 0, "Mage\n") //shadow caster
call SaveStr(h, 'O01D', 0, "Warrior\nShe is unmatched in swordsmanship.")
call SaveStr(h, 'O01B', 0, "Mage, Support\nAdept at supporting allies as well as fighting.")
call SaveStr(h, 'H023', 0, "Warrior\nEliminates all who oppose him.")
call SaveStr(h, 'H00V', 0, "Summoner\nUses his ingenious inventions to defeat his enemies.") //engineer
call SaveStr(h, 'H00U', 0, "Mage\nAdept at damaging groups of foes.")
call SaveStr(h, 'H01G', 0, "Tank, Warrior\nAdept at fighting against large groups of enemies.")
call SaveStr(h, 'H015', 0, "Support\nAdept at healing allies, but can also use his heavenly powers to destroy the wicked.")
call SaveStr(h, 'H00N', 0, "Warrior\n") //admiral
call SaveStr(h, 'H00J', 0, "Mage\n") //alexis luna
call SaveStr(h, 'H00C', 0, "Summoner\nFights exclusively with summons.")
call SaveStr(h, 'H00B', 0, "Mage\nAdept at damaging groups of foes.")
call SaveStr(h, 'H00Q', 0, "Mage\n") //sea witch
call SaveStr(h, 'H025', 0, "Warrior\nHis mind is his greatest weapon.")
call SaveStr(h, 'H026', 0, "Summoner\nFights by summoning hellish creatures.") //summoner
call SaveStr(h, 'O020', 0, "Warrior\nA swift warrior of the night who is adept at impairing enemies and maneuvering in combat.")
call SaveStr(h, 'U00V', 0, "Tank\nA powerful creature empowered by blight.")
endfunction
function RemoveHide takes nothing returns nothing
local group g = CreateGroup()
local unit u
local integer i = 1
call GroupEnumUnitsInRect(g, gg_rct_Hero_Select, Condition(function NullCondition))
loop
exitwhen i > 60
set u = FirstOfGroup(g)
if GetUnitAbilityLevel(u, 'Ashm') > 0 then
call UnitRemoveAbility(u, 'Ashm')
endif
if GetUnitAbilityLevel(u, 'Sshm') > 0 then
call UnitRemoveAbility(u, 'Sshm')
endif
call GroupRemoveUnit(g, u)
set u = null
set i = i + 1
endloop
call DestroyGroup(g)
set g = null
set u = null
endfunction
function Trig_Initialization_Actions takes nothing returns nothing
local player p
local player p2
local integer a
local location l
local force f = GetPlayersAll()
local timerdialog td
call SetTimeOfDay(6)
set udg_h = InitHashtable() //used for generic operations and trigger-enhanced abilities
set udg_mag = InitHashtable() //used for mag stats only
set udg_tips = InitHashtable() //used for hero selection tips only
set udg_crpt = InitHashtable() //used for spirit of corruption only
call SetHeroTips(udg_tips)
call SetWaveList(udg_army)
set udg_asleep = CreateGroup()
call SaveBoolean(udg_h, 'w', 0, true)
set l = GetRectCenter(gg_rct_Created_by_Teh_Crisis_and_Lord_Alastor)
call CreateTextTagLocBJ("TRIGSTR_7933", l, 0, 10, 100, 100, 100, 0)
set l = null
call SetCreepCampFilterState(false)
set p = Player(10)
set p2 = Player(0)
call SetPlayerTaxRateBJ( 100, PLAYER_STATE_RESOURCE_GOLD, p, p2 )
set p = null
set p2 = null
call RemoveHide()
// Commands: a, b, c, d, e, _, _, _, _, _, k, l, _, _, _, p, _, _, s, _, _, _, w, _, _, z; 42.3%
call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED, "Commands", "|cff00ff00-z|r Zooms out|n|cff00ff00-l|r Toggles camera lock to your hero|n|cff00ff00-k|r Kills your hero; hero respawns instantly with low health & no mana|n|cff00ff00-a|r Kills all units in the hero selection area (|cffff0000Player 1 only|r)|n|cff00ff00-w|r Calls the next wave (|cff00ff00Free Play|r and |cffff00ffLegendary|r only)|n|cff00ff00-c|r Cleans up straggling enemies by ordering them to attack the castle|n|cff00ff00-e|r Enables/disables wayward enemy purging, which kills enemies that have wandered back to the gates for some reason|n|cff00ff00-b|r Gives the calling player control of bots|n|cff00ff00-s|r Changes the spawn point of all bots|n|cff00ff00-d|r |cff33ff33X N|r Defines which hero the bot in player slot X will choose, where N is the name of the hero's class|n|cff00ff00-p|r Toggle password lock (unlocked by default), which prevents players from using password heroes", "ReplaceableTextures\\CommandButtons\\BTNEngineeringUpgrade.blp")
call CreateQuestBJ( bj_QUESTTYPE_REQ_DISCOVERED, "Credits", "|cff00ffffHeroes|r Lord Alastor & Teh Crisis|n|cff00ffffAbilities|r Lord Alastor & Teh Crisis|n|cff00ffffEnemies|r Teh Crisis|n|cff00ffffTerrain|r Teh Crisis|n|cff00ffffItems|r Teh Crisis & Lord Alastor|n|cff00ffffTriggers|r Teh Crisis|n|cff00ffffCustom Resources|r Sellenisko, expresso, sPy, Cavman and Mr Goblin, CRAZYRUSSIAN, Tranquil, Suselishe, Trarrasque, WILLTHEALMIGHTY, zeshuri, dickxunder, HappyTauren, Lordan12, Ampharos_222, Fel Orc Crossbowman, Misha, Mainy, Dionesisst, Elenai, Dan van Ohllus, soulreaver6, jetfanginferno, Suselishe", "ReplaceableTextures\\CommandButtons\\BTNGem.blp" )
call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED, "MAGs", "MAGs are mechanical companions that boost their owner's stats when fed. They also accumulate Photon Blast (PB) energy; after the MAG has stored 100 PB it will use a powerful ability called a Photon Blast. These abilities can heal the owner, kill enemies, and more!\n\nA MAG will level up automatically when its master levels up and whenever the MAG is fed. A MAGs highest stat determines its Photon Blast as well as whether or not it qualifies for some evolutionary paths.\n\nTo destroy your MAG, use the \"|cff00ff00-destroymag|r\" command. |cffff0000There is no way to aquire a second MAG.|r", "ReplaceableTextures\\CommandButtons\\BTNEngineeringUpgrade.blp")
call Message("\nThis map was created by |cff00ffffTeh Crisis|r and |cff00ffffLord Alastor|r.\n", 30)
set p = Player(11)
call SetPlayerFlagBJ(PLAYER_STATE_GIVES_BOUNTY, true, p)
set p = null
set a = 1
loop
exitwhen a > 10
set p = ConvertedPlayer(a)
call SetPlayerHandicap(p, 1)
if udg_startingcondition == 1 then
call SetPlayerStateBJ(p, PLAYER_STATE_RESOURCE_GOLD, 1700)
else
call SetPlayerStateBJ(p, PLAYER_STATE_RESOURCE_GOLD, 300)
if udg_startingcondition == 4 then
call SetPlayerStateBJ(p, PLAYER_STATE_RESOURCE_LUMBER, 7)
endif
endif
if GetPlayerController(p) == MAP_CONTROL_USER or GetPlayerController(p) == MAP_CONTROL_COMPUTER then
call ForceAddPlayerSimple(p, udg_Defenders)
endif
call SetCameraFieldForPlayer(p, CAMERA_FIELD_TARGET_DISTANCE, 2600, 2)
set a = a + 1
endloop
call TriggerSleepAction(1)
set l = GetRectCenter(gg_rct_Base)
set a = 1
loop
exitwhen a > 10
set p = ConvertedPlayer(a)
call CreateFogModifierRadiusLocBJ(true, p, FOG_OF_WAR_VISIBLE, l, 2400)
call CreateFogModifierRectBJ(true, p, FOG_OF_WAR_VISIBLE, gg_rct_Hero_Select)
call CreateFogModifierRectBJ(true, p, FOG_OF_WAR_VISIBLE, gg_rct_SecretHero3)
call RemoveLocation(l)
set p = null
set a = a + 1
endloop
set p = Player(11)
call CreateFogModifierRadiusLocBJ(true, p, FOG_OF_WAR_VISIBLE, l, 1000)
set p = null
call CreateTimerDialogBJ( udg_Timer, "Wave 1 spawns in:" )
call StartTimerBJ( udg_Timer, false, 90 )
if udg_mode == 7 then
call Message("\nIn this mode, you can capture |cff00ffffflags|r to increase gold income, reduce respawn time, and more!\n", 40)
endif
if udg_mode != 2 and udg_mode != 4 then
call TriggerSleepAction( 90 )
else
call Message("\nAny player can use the |cff00ff00-w|r command to send the next wave. This command has a 15 second cooldown.\n", 40)
endif
set td = GetLastCreatedTimerDialogBJ()
call DestroyTimerDialogBJ(td)
set p = null
set p2 = null
call RemoveLocation(l)
set l = null
set p = null
call DestroyForce(f)
set f = null
set td = null
call Message("\nSpawned |cffff0000" + I2S(Spawn_Computer_Heroes()) + "|r computer-controlled heroes.\n", 10)
call TriggerExecute(gg_trg_Waves)
call DestroyTrigger(gg_trg_Initialization)
endfunction
//===========================================================================
function InitTrig_Initialization takes nothing returns nothing
set gg_trg_Initialization = CreateTrigger( )
//call TriggerRegisterDialogEventBJ( gg_trg_Initialization, udg_StartingSelect )
call TriggerAddAction( gg_trg_Initialization, function Trig_Initialization_Actions )
endfunction
function Trig_Army_Selection_Actions takes nothing returns nothing
local player p = Player(0)
call FogEnableOn()
call Message("(1/5) |cffff0000" + GetPlayerName(p) + "|r is choosing the invader's army.", 5)
call DialogSetMessageBJ(udg_ArmySelect, "Invading Army")
set udg_armybutton[1] = DialogAddButtonBJ(udg_ArmySelect, "|cffffffffNormal|r")
set udg_armybutton[2] = DialogAddButtonBJ(udg_ArmySelect, "|cffff00ffScourge|r")
set udg_armybutton[3] = DialogAddButtonBJ(udg_ArmySelect, "|cffff9900Bandits|r")
set udg_armybutton[4] = DialogAddButtonBJ(udg_ArmySelect, "|cff00ff00Ancients|r")
set udg_armybutton[5] = DialogAddButtonBJ(udg_ArmySelect, "|cff999999Random|r")
call DialogDisplayBJ(true, udg_ArmySelect, p)
call DestroyTrigger(gg_trg_Army_Selection)
set p = null
endfunction
//===========================================================================
function InitTrig_Army_Selection takes nothing returns nothing
set gg_trg_Army_Selection = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Army_Selection, 1 )
call TriggerAddAction( gg_trg_Army_Selection, function Trig_Army_Selection_Actions )
endfunction
function Trig_Army_Selection_Handler_Actions takes nothing returns nothing
local button b = GetClickedButton()
local integer a = 1
set udg_army = 0
loop
exitwhen udg_armybutton[a] == null
if (b == udg_armybutton[a]) then
set udg_army = a-1
endif
set a = a + 1
endloop
set b = null
call DestroyTrigger(gg_trg_Amy_Selection_Handler)
endfunction
//===========================================================================
function InitTrig_Amy_Selection_Handler takes nothing returns nothing
set gg_trg_Amy_Selection_Handler = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Amy_Selection_Handler, udg_ArmySelect )
call TriggerAddAction( gg_trg_Amy_Selection_Handler, function Trig_Army_Selection_Handler_Actions )
endfunction
function Trig_Mode_Selection_Actions takes nothing returns nothing
call FogEnableOn()
call TriggerSleepAction(1)
call Message("(2/5) |cffff0000" + GetPlayerName(Player(0)) + "|r is choosing the game mode.", 5)
call DialogSetMessageBJ(udg_ModeSelect, "Game Mode")
set udg_modebutton[1] = DialogAddButtonBJ(udg_ModeSelect, "|cffffffffNormal|r")
set udg_modebutton[2] = DialogAddButtonBJ(udg_ModeSelect, "|cff00ff00Free Play|r")
set udg_modebutton[3] = DialogAddButtonBJ(udg_ModeSelect, "|cffff9900Challenge|r")
set udg_modebutton[4] = DialogAddButtonBJ(udg_ModeSelect, "|cffff00ffLegendary|r")
set udg_modebutton[5] = DialogAddButtonBJ(udg_ModeSelect, "|cff00ffffRush|r")
set udg_modebutton[6] = DialogAddButtonBJ(udg_ModeSelect, "|cffffff00Territory|r |cff999999(new)|r")
call DialogDisplayBJ(true, udg_ModeSelect, Player(0))
call DestroyTrigger(gg_trg_Mode_Selection)
endfunction
//===========================================================================
function InitTrig_Mode_Selection takes nothing returns nothing
set gg_trg_Mode_Selection = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Mode_Selection, udg_ArmySelect )
call TriggerAddAction( gg_trg_Mode_Selection, function Trig_Mode_Selection_Actions )
endfunction
function Trig_Mode_Selection_Handler_Actions takes nothing returns nothing
local button b = GetClickedButton()
if ( b == udg_modebutton[1] ) then //normal
set udg_mode = 1
elseif ( b == udg_modebutton[2] ) then //free play
set udg_mode = 2
set udg_vpts = udg_vpts - 25
elseif ( b == udg_modebutton[3] ) then //challenge
set udg_mode = 3
set udg_vpts = udg_vpts + 25
elseif ( b == udg_modebutton[4] ) then //legendary
set udg_mode = 4
elseif ( b == udg_modebutton[5] ) then //rush
set udg_mode = 5
elseif ( b == udg_modebutton[6] ) then //territory
set udg_mode = 7 //keep as 7 to avoid clashes with old Relentless mode
endif
if udg_mode != 7 then
call RemoveUnit(gg_unit_h01H_0124)
call RemoveUnit(gg_unit_h01H_0125)
call RemoveUnit(gg_unit_h01H_0127)
call RemoveUnit(gg_unit_h01H_0128)
call RemoveUnit(gg_unit_h01H_0129)
call RemoveUnit(gg_unit_h01H_0130)
call RemoveUnit(gg_unit_h01H_0131)
call RemoveUnit(gg_unit_h01H_0132)
call RemoveUnit(gg_unit_h01H_0133)
call DestroyTrigger(gg_trg_Conqueror)
endif
set udg_speed = 0
set b = null
call DestroyTrigger( gg_trg_Mode_Selection_Handler )
endfunction
//===========================================================================
function InitTrig_Mode_Selection_Handler takes nothing returns nothing
set gg_trg_Mode_Selection_Handler = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Mode_Selection_Handler, udg_ModeSelect )
call TriggerAddAction( gg_trg_Mode_Selection_Handler, function Trig_Mode_Selection_Handler_Actions )
endfunction
function Trig_Difficulty_Selection_Actions takes nothing returns nothing
call TriggerSleepAction(1)
call Message("(3/5) |cffff0000" + GetPlayerName(Player(0)) + "|r is choosing the difficulty.", 5)
call DialogSetMessageBJ( udg_DifSelect, "Difficulty" )
if Count_Players() == 1 then
set udg_singleplayerbutton = DialogAddButtonBJ(udg_DifSelect, "|cffff00ffNerfed|r")
endif
set udg_difbutton[1] = DialogAddButtonBJ(udg_DifSelect, "|cffffffffNormal|r")
set udg_difbutton[2] = DialogAddButtonBJ(udg_DifSelect, "|cffffff00Hard|r")
set udg_difbutton[3] = DialogAddButtonBJ(udg_DifSelect, "|cffff9900Very Hard|r")
set udg_insanityButton = DialogAddButtonBJ(udg_DifSelect, "|cffff0000Ultimate|r")
call DialogDisplayBJ(true, udg_DifSelect, Player(0))
call DestroyTrigger(gg_trg_Difficulty_Selection)
endfunction
//===========================================================================
function InitTrig_Difficulty_Selection takes nothing returns nothing
set gg_trg_Difficulty_Selection = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Difficulty_Selection, udg_ModeSelect )
call TriggerAddAction( gg_trg_Difficulty_Selection, function Trig_Difficulty_Selection_Actions )
endfunction
function Trig_Difficulty_Selection_Handler_Actions takes nothing returns nothing
local integer p = Count_Players()
local real m = 0
local player p11 = Player(11)
local player pna = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local button b = GetClickedButton()
if udg_mode == 4 then
set m = 15
elseif udg_mode == 5 and b != udg_singleplayerbutton then
set m = -0.8
elseif udg_mode == 5 then
set m = -0.35
elseif udg_mode == 7 then
set m = -0.1
endif
if ( b == udg_singleplayerbutton ) then
set udg_dif = 1
call SetPlayerHandicap( p11, 0.4 + m )
call SetPlayerHandicap( pna, 0.4 + m )
elseif ( b == udg_difbutton[1] ) then
set udg_dif = 1
call SetPlayerHandicap( p11, 0.8 + 0.1 * p + m )
call SetPlayerHandicap( pna, 0.8 + 0.15 * p + m )
set udg_vpts = udg_vpts - 8
elseif ( b == udg_difbutton[2] ) then
set udg_dif = 2
call SetPlayerHandicap( p11, 0.8 + 0.2 * p + m )
call SetPlayerHandicap( pna, 0.8 + 0.25 * p + m )
set udg_vpts = udg_vpts
elseif ( b == udg_difbutton[3] ) then
set udg_dif = 3
call SetPlayerHandicap( p11, 0.8 + 0.3 * p + m )
call SetPlayerHandicap( pna, 0.8 + 0.35 * p + m )
set udg_vpts = udg_vpts + 4
elseif ( b == udg_insanityButton ) then
set udg_dif = 3
set udg_insanity = true
call SetPlayerHandicap( p11, 9 + m )
call SetPlayerHandicap( pna, 9 + m )
set udg_vpts = udg_vpts + 8
endif
set p11 = null
set pna = null
set b = null
call DestroyTrigger( gg_trg_Difficulty_Selection_Handler )
endfunction
//===========================================================================
function InitTrig_Difficulty_Selection_Handler takes nothing returns nothing
set gg_trg_Difficulty_Selection_Handler = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Difficulty_Selection_Handler, udg_DifSelect )
call TriggerAddAction( gg_trg_Difficulty_Selection_Handler, function Trig_Difficulty_Selection_Handler_Actions )
endfunction
function Trig_Speed_Selection_Actions takes nothing returns nothing
local player p = Player(0)
if udg_mode == 2 or udg_mode == 4 or udg_mode == 5 or udg_mode == 7 then
set udg_speed = 120
if udg_mode == 5 then
set udg_speed = 30
endif
if udg_mode == 7 then
set udg_speed = 90
endif
call Message("(4/5) This step was skipped, because it is unnecesary due to other option choices.", 5)
call TriggerExecute( gg_trg_Starting_Selection )
return
endif
call TriggerSleepAction(1)
call Message("(4/5) |cffff0000" + GetPlayerName(p) + "|r is choosing the time between waves.", 5)
call DialogSetMessageBJ( udg_SpeedSelect, "Wave Frequency" )
set udg_speedbutton[1] = DialogAddButtonBJ(udg_SpeedSelect, "|cff00ff00Boring|r")
set udg_speedbutton[2] = DialogAddButtonBJ(udg_SpeedSelect, "|cff99ff00Slow|r")
set udg_speedbutton[3] = DialogAddButtonBJ(udg_SpeedSelect, "|cffffffffNormal|r")
set udg_speedbutton[4] = DialogAddButtonBJ(udg_SpeedSelect, "|cffff9900Fast|r")
set udg_speedbutton[5] = DialogAddButtonBJ(udg_SpeedSelect, "|cffff0000Mach 5|r")
call DialogDisplayBJ( true, udg_SpeedSelect, p )
set p = null
call DestroyTrigger( gg_trg_Speed_Selection )
endfunction
//===========================================================================
function InitTrig_Speed_Selection takes nothing returns nothing
set gg_trg_Speed_Selection = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Speed_Selection, udg_DifSelect )
call TriggerAddAction( gg_trg_Speed_Selection, function Trig_Speed_Selection_Actions )
endfunction
function Trig_Speed_Selection_Handler_Actions takes nothing returns nothing
local button b = GetClickedButton()
if ( b == udg_speedbutton[1] ) then
set udg_speed = 150
set udg_vpts = udg_vpts - 16
elseif ( b == udg_speedbutton[2] ) then
set udg_speed = 135
set udg_vpts = udg_vpts - 8
elseif ( b == udg_speedbutton[3] ) then
set udg_speed = 120
elseif ( b == udg_speedbutton[4] ) then
set udg_speed = 105
set udg_vpts = udg_vpts + 4
elseif ( b == udg_speedbutton[5] ) then
set udg_speed = 90
set udg_vpts = udg_vpts + 8
endif
set b = null
call DestroyTrigger( gg_trg_Speed_Selection_Handler )
endfunction
//===========================================================================
function InitTrig_Speed_Selection_Handler takes nothing returns nothing
set gg_trg_Speed_Selection_Handler = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Speed_Selection_Handler, udg_SpeedSelect )
call TriggerAddAction( gg_trg_Speed_Selection_Handler, function Trig_Speed_Selection_Handler_Actions )
endfunction
function Trig_Starting_Selection_Actions takes nothing returns nothing
local player p = Player(0)
call TriggerSleepAction(1)
call Message("(5/5) |cffff0000" + GetPlayerName(Player(0)) + "|r is choosing the starting conditions.", 5)
call DialogSetMessageBJ( udg_StartingSelect, "Starting Condition" )
set udg_startingbutton[1] = DialogAddButtonBJ( udg_StartingSelect, "|cffffff00+1400 Gold|r" )
set udg_startingbutton[4] = DialogAddButtonBJ( udg_StartingSelect, "|cff00ffff+7 Arcane Seals|r" )
if udg_mode != 4 then
set udg_startingbutton[3] = DialogAddButtonBJ( udg_StartingSelect, "|cffff00ff+5 Levels|r" )
endif
if udg_mode == 5 then
set udg_startingbutton[2] = DialogAddButtonBJ( udg_StartingSelect, "|cff00ff00Messenger Bird|r (recommended)" )
else
set udg_startingbutton[2] = DialogAddButtonBJ( udg_StartingSelect, "|cff00ff00Messenger Bird|r" )
endif
call DialogDisplayBJ( true, udg_StartingSelect, p )
set p = null
call DestroyTrigger( gg_trg_Starting_Selection )
endfunction
//===========================================================================
function InitTrig_Starting_Selection takes nothing returns nothing
set gg_trg_Starting_Selection = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Starting_Selection, udg_SpeedSelect )
call TriggerAddAction( gg_trg_Starting_Selection, function Trig_Starting_Selection_Actions )
endfunction
function Trig_Starting_Selection_Handler_Actions takes nothing returns nothing
local button b = GetClickedButton()
call EnableTrigger( gg_trg_Hero_Select )
if ( b == udg_startingbutton[1] ) then
set udg_startingcondition = 1
elseif ( b == udg_startingbutton[2] ) then
set udg_startingcondition = 2
elseif ( b == udg_startingbutton[3] ) then
set udg_startingcondition = 3
elseif ( b == udg_startingbutton[4] ) then
set udg_startingcondition = 4
endif
set b = null
call TriggerExecute( gg_trg_Initialization)
call DestroyTrigger( gg_trg_Starting_Selection_Handler )
endfunction
//===========================================================================
function InitTrig_Starting_Selection_Handler takes nothing returns nothing
set gg_trg_Starting_Selection_Handler = CreateTrigger( )
call TriggerRegisterDialogEventBJ( gg_trg_Starting_Selection_Handler, udg_StartingSelect )
call TriggerAddAction( gg_trg_Starting_Selection_Handler, function Trig_Starting_Selection_Handler_Actions )
endfunction
function Trig_Victory_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (u == udg_FinalBoss)
set u = null
return b
endfunction
function Trig_Victory_Victory takes nothing returns nothing
local player p = GetEnumPlayer()
call CustomVictoryBJ( p, true, true )
set p = null
endfunction
function Trig_Victory_Actions takes nothing returns nothing
local player p = Player(0)
local integer humans = Count_Humans()
local integer allplayers = Count_Players()
call Message("TRIGSTR_5977", 10)
call TriggerSleepAction(5)
call PlaySoundBJ(gg_snd_58271D)
set udg_vpts = udg_vpts + udg_flagbonus - allplayers
if udg_mode == 1 and humans > 1 and udg_dif > 1 and udg_speed <= 120 and GetUnitLifePercent(gg_unit_h009_0083) >= 99 then
call Message("|cff00ff00You have unlocked a new password!|r", 15)
call Message("|cff00ff00You can use it before you select your hero.|r", 15)
call Message("|cff00ff00Passwords are not case-sensitive.|r", 15)
call Message("|cff00ff00The password is:|r Divine Wrath", 15)
call Message("Victory is awarded in 15 seconds.", 15)
call TriggerSleepAction(10)
elseif udg_mode == 5 and humans > 1 and udg_dif > 1 and udg_speed <= 120 and GetUnitLifePercent(gg_unit_h009_0083) >= 99 then
call Message("|cff00ff00You have unlocked a new password!|r", 15)
call Message("|cff00ff00You can use it before you select your hero.|r", 15)
call Message("|cff00ff00Passwords are not case-sensitive.|r", 15)
call Message("|cff00ff00The password is:|r The Grave Beckons", 15)
call Message("Victory is awarded in 15 seconds.", 15)
call TriggerSleepAction(10)
elseif ((udg_mode == 3 and udg_speed <= 120) or (udg_mode == 7 and allplayers < 4 and udg_flagbonus > 9)) and humans > 1 then
call Message("|cff00ff00You have unlocked a new password!|r", 15)
call Message("|cff00ff00You can use it before you select your hero.|r", 15)
call Message("|cff00ff00Passwords are not case-sensitive.|r", 15)
call Message("|cff00ff00The password is:|r Age of Tranquility", 15)
call Message("Victory is awarded in 15 seconds.", 15)
call TriggerSleepAction(10)
elseif udg_vpts > 99 and humans > 1 then
call Message("|cff00ff00You have unlocked a new password!|r", 15)
call Message("|cff00ff00You can use it before you select your hero.|r", 15)
call Message("|cff00ff00Passwords are not case-sensitive.|r", 15)
call Message("|cff00ff00The password is:|r Call of the Void", 15)
call Message("Victory is awarded in 15 seconds.", 15)
call TriggerSleepAction(10)
else
call Message("Victory is awarded in 5 seconds.", 5)
endif
call TriggerSleepAction(5)
set p = null
call ForForce(udg_Defenders, function Trig_Victory_Victory)
endfunction
//===========================================================================
function InitTrig_Victory takes nothing returns nothing
set gg_trg_Victory = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Victory, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Victory, Condition( function Trig_Victory_Conditions ) )
call TriggerAddAction( gg_trg_Victory, function Trig_Victory_Actions )
endfunction
function Trig_Loss_Loss takes nothing returns nothing
local player p = GetEnumPlayer()
call CustomDefeatBJ( p, "TRIGSTR_5978" )
set p = null
endfunction
function Trig_Loss_Actions takes nothing returns nothing
call ForForce( udg_Defenders, function Trig_Loss_Loss )
endfunction
//===========================================================================
function InitTrig_Loss takes nothing returns nothing
set gg_trg_Loss = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Loss, gg_unit_h009_0083, EVENT_UNIT_DEATH )
call TriggerAddAction( gg_trg_Loss, function Trig_Loss_Actions )
endfunction
function Trig_Hero_Select_Conditions takes nothing returns boolean
local player p = GetTriggerPlayer()
local rect r = gg_rct_Entire_Hero_Selection_Area
local unit u = GetTriggerUnit()
local boolean b = udg_PickedHero[GetConvertedPlayerId(p)] == false and RectContainsUnit(r, u) == true
set p = null
set r = null
set u = null
return b
endfunction
function Streamline takes nothing returns nothing
//Destroys triggers that are not necessary due to certain units, features, or content not being used
//LOCAL DECLARATIONS
local player p
local unit u
local integer c = 1
local integer cc
local integer id
local boolean array b
local integer array i
local integer isize
//ARRAY SETUP : defines which heroes have trigger-enhanced abilities
set isize = 28
set i[0] = 'E00O'
set i[1] = 'N00V'
set i[2] = 'E005'
set i[3] = 'N01I'
set i[4] = 'E007'
set i[5] = 'O00A'
set i[6] = 'N00I'
set i[7] = 'O00O'
set i[8] = 'O01A'
set i[9] = 'O01D'
set i[10]= 'U004'
set i[11]= 'N016'
set i[12]= 'U00C'
set i[13]= 'U000'
set i[14]= 'E000'
set i[15]= 'U007'
set i[16]= 'H003'
set i[17]= 'H006'
set i[18]= 'H001'
set i[19]= 'H000'
set i[20]= 'N03D'
set i[21]= 'N002'
set i[22]= 'E00V'
set i[23]= 'U00D'
set i[24]= 'U00R'
set i[25]= 'O020'
set i[26]= 'U00V'
set i[27]= 'U00Q'
//CHECK IDs LOOP : for each hero checks each unit id from array i and sets each boolean from array b accordingly
loop //loops through each unit in array udg_Hero
exitwhen c > 10
set u = udg_Hero[c]
set id = GetUnitTypeId(u)
set cc = 0
loop //loops through each integer in array i and set each boolean from array b
exitwhen cc >= isize
if id == i[cc] then
set b[cc] = true
endif
set cc = cc + 1
endloop
set c = c + 1
endloop
//DESTROY TRIGGERS : checks each boolean from array b and destroys the corrosponding trigger
if (not b[0]) then
call DestroyTrigger(gg_trg_Unforgiveness)
call DestroyTrigger(gg_trg_Attrition)
call DestroyTrigger(gg_trg_Backstab)
call DestroyTrigger(gg_trg_Revenge)
endif
if (not b[1]) then
if (not b[27]) then
call DestroyTrigger(gg_trg_Crushing_Blade)
endif
call DestroyTrigger(gg_trg_Fel_Grapple)
call DestroyTrigger(gg_trg_Launching_Strike)
call DestroyTrigger(gg_trg_Knockback)
endif
if (not b[2]) then
call DestroyTrigger(gg_trg_Tranquility)
call DestroyTrigger(gg_trg_Wisp_Explosion)
endif
if (not b[3]) then
call DestroyTrigger(gg_trg_Nightmare_Annihilation)
call DestroyTrigger(gg_trg_Sleep)
endif
if (not b[4]) then
call DestroyTrigger(gg_trg_Demon_Boost)
endif
if (not b[5]) and (not b[4]) then
call DestroyTrigger(gg_trg_One_With_Shadow)
endif
if (not b[6]) then
call DestroyTrigger(gg_trg_INFINITE_POWAH)
call DestroyTrigger(gg_trg_INFINITE_POWAH_kill)
endif
if (not b[7]) then
call DestroyTrigger(gg_trg_Bear_Attack_Bonus)
endif
if (not b[8]) then
call DestroyTrigger(gg_trg_Charge)
endif
if (not b[9]) then
call DestroyTrigger(gg_trg_Crimson)
endif
if (not b[10]) then
call DestroyTrigger(gg_trg_Death_Nova)
endif
if (not b[11]) then
//call DestroyTrigger(gg_trg_Demon_Prison)
//no longer exists
endif
if (not b[12]) then
call DestroyTrigger(gg_trg_Divine_Intervention)
endif
if (not b[13]) then
call DestroyTrigger(gg_trg_Earth_Nova)
endif
if (not b[14]) then
call DestroyTrigger(gg_trg_Full_Moon)
call DestroyTrigger(gg_trg_Howl)
call DestroyTrigger(gg_trg_Metamorphosis)
endif
if (not b[15]) then
call DestroyTrigger(gg_trg_Ghost_Storm)
endif
if (not b[16]) then
call DestroyTrigger(gg_trg_Tornado_Nerf)
endif
if (not b[17]) then
call DestroyTrigger(gg_trg_Headshot)
endif
if (not b[18]) then
call DestroyTrigger(gg_trg_Implode)
endif
if (not b[19]) then
call DestroyTrigger(gg_trg_Lightning_Sword)
call DestroyTrigger(gg_trg_Lightning_Burst)
endif
if (not b[20]) then
call DestroyTrigger(gg_trg_Meteor)
endif
if (not b[21]) then
call DestroyTrigger(gg_trg_Nuclear_Strike)
endif
if (not b[22]) then
call DestroyTrigger(gg_trg_Shadow_Explode)
endif
if (not b[23]) then
call DestroyTrigger(gg_trg_Tribute)
endif
if (not b[24]) then
call DestroyTrigger(gg_trg_Eat_Tree)
call DestroyTrigger(gg_trg_Rage)
endif
if (not b[25]) then
call DestroyTrigger(gg_trg_Hatsuendan)
call DestroyTrigger(gg_trg_Kunaidesu)
endif
if (not b[26]) then
call DestroyTrigger(gg_trg_Vice)
call DestroyTrigger(gg_trg_Total_Corruption)
call DestroyTrigger(gg_trg_Conjure_Blight)
endif
//NULLIFICATIONS
set p = null
set u = null
//RETURN SUCCESS
//call Message("Streamlining is complete; unused triggers have been removed.", 10)//people probably don't need to know this
endfunction
function Trig_Hero_Select_Init_Mag takes unit e returns nothing
local item newmag = UnitAddItemById(e, 'I03C')
local player p = GetOwningPlayer(e)
local integer w = GetPlayerId(p)
call SaveItemHandle(udg_mag, w, 0, newmag) //id
call SaveInteger(udg_mag, w, 1, 4) //lvl
call SaveInteger(udg_mag, w, 2, 0) //pow
call SaveInteger(udg_mag, w, 3, 0) //dex
call SaveInteger(udg_mag, w, 4, 0) //mind
call SaveInteger(udg_mag, w, 5, 0) //def
call SaveInteger(udg_mag, w, 6, 0) //pb
call SaveReal(udg_mag, w, 7, 0) //defcycler
call MLevelUp(w, 0, 0, 0, 5, e) //add initial stats
endfunction
function Trig_Hero_Select_Actions takes nothing returns nothing
local location l = GetRectCenter(gg_rct_Initial_Spawn)
local unit u = GetTriggerUnit()
local unit e
local unit bird
local player p = GetTriggerPlayer()
local player t = GetLocalPlayer()
local integer i = GetUnitTypeId(u)
local integer c = 1
local boolean b = true
if i == 'N053' then
call RemoveUnit(u)
set u = CreateUnit(Player(15), 'N03D', 4223, 13825, 270)
endif
if u == udg_LoadHero[GetConvertedPlayerId(p)] then
if i == 'n02V' then
set e = Create_Random_Hero(p, GetLocationX(l), GetLocationY(l))
else
call RemoveUnit(u)
set e = CreateUnitAtLoc(p, i, l, 270)
endif
if udg_startingcondition == 2 then
set bird = CreateUnitAtLoc(p, 'n03B', l, 270)
elseif udg_startingcondition == 3 then
call SetHeroLevel(e, GetHeroLevel(e)+5, false)
endif
call Trig_Hero_Select_Init_Mag(e)
if udg_mode == 4 then
call SetHeroLevelBJ(e, 100, false)
endif
set udg_PickedHero[GetConvertedPlayerId(p)] = true
set udg_Hero[GetConvertedPlayerId(p)] = e
call PanCameraToTimedLocForPlayer(p, l, 0)
call SetCameraFieldForPlayer(p, CAMERA_FIELD_TARGET_DISTANCE, 2250, 1)
else
set udg_LoadHero[GetConvertedPlayerId(p)] = u
if t == p then
call Message("\n|cffccccccClass:|r " + GetUnitName(u) + "\n|cffccccccType:|r " + LoadStr(udg_tips, GetUnitTypeId(u), 0), 20)
endif
endif
set c = 1
loop
exitwhen c > 10
set t = Player(c-1)
if (GetPlayerSlotState(t) == PLAYER_SLOT_STATE_PLAYING) and (udg_Hero[c] == null) then
set b = false
endif
set c = c + 1
endloop
set bird = null
set t = null
call RemoveLocation(l)
set l = null
set u = null
set e = null
set p = null
if b then
call Streamline()
call FlushParentHashtable(udg_tips)
call DestroyTrigger(gg_trg_Hero_Select)
endif
endfunction
//===========================================================================
function InitTrig_Hero_Select takes nothing returns nothing
local integer i = 0
set gg_trg_Hero_Select = CreateTrigger()
call DisableTrigger(gg_trg_Hero_Select)
loop
exitwhen i > 9
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_Hero_Select, Player(i), true)
set i = i + 1
endloop
call TriggerAddCondition(gg_trg_Hero_Select, Condition(function Trig_Hero_Select_Conditions))
call TriggerAddAction(gg_trg_Hero_Select, function Trig_Hero_Select_Actions)
endfunction
function Respawn_Conditions takes nothing returns boolean
local unit u = GetDyingUnit()
local player p = GetOwningPlayer(u)
local boolean b = (u == udg_Hero[GetConvertedPlayerId(p)])
set u = null
set p = null
return b
endfunction
function Respawn_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetDyingUnit()
local player p = GetOwningPlayer(u)
local location a = GetRectCenter(gg_rct_Base)
local integer respawn_time_formula = 10
local timerdialog d = CreateTimerDialog(t)
if GetPlayerController(p) == MAP_CONTROL_COMPUTER then
if udg_botspawn == 0 then
set a = GetRectCenter(gg_rct_Target)
elseif udg_botspawn == 1 then
set a = GetRectCenter(gg_rct_Base)
elseif udg_botspawn == 2 then
set a = GetRectCenter(gg_rct_LaneW)
elseif udg_botspawn == 3 then
set a = GetRectCenter(gg_rct_LaneSW)
else
set a = GetRectCenter(gg_rct_LaneS)
endif
endif
if udg_mode == 3 then
call CustomDefeatBJ( p, "You've died!" )
endif
if UnitHasItemOfTypeBJ(u, 'I01Z') then
set respawn_time_formula = respawn_time_formula * 4 / 5
endif
if UnitHasItemOfTypeBJ(u, 'I028') then
set respawn_time_formula = respawn_time_formula / 2
endif
if UnitHasItemOfTypeBJ(u, 'I032') then
set respawn_time_formula = 1
endif
call TimerDialogSetTitle(d, "Hero Respawn")
if GetLocalPlayer() == p then
call TimerDialogDisplay(d, true)
endif
call Message(GetUnitName(u) + " has fallen and will revive in |cff00ff00" + I2S(respawn_time_formula) + "|r seconds.", 5)
call TimerStart(t, respawn_time_formula, false, null)
if udg_rc[GetConvertedPlayerId(p)] > 0 then
set udg_rc[GetConvertedPlayerId(p)] = udg_rc[GetConvertedPlayerId(p)] - 1
set respawn_time_formula = 0
endif
if udg_mode == 7 then
set respawn_time_formula = respawn_time_formula - udg_flagbonus + 1
endif
call TriggerSleepAction(I2R(respawn_time_formula))
//this if block is now extra safe to put an end to the no-respawn bug
if ( GetUnitState(u, UNIT_STATE_LIFE) <= 0.405 ) then //checks life
call ReviveHeroLoc( u, a, true )
call PanCameraToTimedLocForPlayer( p, a, 1 )
call SelectUnitForPlayerSingle( u, p )
call Message(GetUnitName(u) + " has revived.", 5)
elseif ( IsUnitType(u, UNIT_TYPE_DEAD) ) then //just incase life is messed up, check unit type dead
call ReviveHeroLoc( u, a, true )
call PanCameraToTimedLocForPlayer( p, a, 1 )
call SelectUnitForPlayerSingle( u, p )
call Message(GetUnitName(u) + " has revived.", 5)
endif
if UnitHasItemOfTypeBJ(u, 'I028') or UnitHasItemOfTypeBJ(u, 'I02B') then
call SetUnitManaPercentBJ(u, 100)
else
call SetUnitManaPercentBJ(u, 33.33)
endif
call RemoveLocation(a)
call DestroyTimerDialog(d)
call DestroyTimer(t)
set d = null
set a = null
set p = null
set u = null
set t = null
endfunction
//===========================================================================
function InitTrig_Respawn takes nothing returns nothing
local integer p = 0
set gg_trg_Respawn = CreateTrigger()
loop
exitwhen p > 9
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Respawn, Player(p), EVENT_PLAYER_UNIT_DEATH )
set p = p + 1
endloop
call TriggerAddCondition( gg_trg_Respawn, Condition( function Respawn_Conditions ) )
call TriggerAddAction( gg_trg_Respawn, function Respawn_Actions )
endfunction
function Trig_Gold_Reward_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p = Player(11)
local boolean b = ( GetUnitTypeId(u) == udg_Wave[(udg_waveCount-2)] or GetUnitTypeId(u) == udg_Wave[(udg_waveCount-1)] or GetUnitTypeId(u) == udg_Wave[(udg_waveCount)] ) and ( CountLivingPlayerUnitsOfTypeId_Fixed(GetUnitTypeId(u), p) == 0 )
set u = null
set p = null
return b
endfunction
function Trig_Gold_Reward_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer a = 0
local integer w = 0
local integer gold_reward_formula = 0
local integer xp_reward_formula = 0
local player p
set a = 0
if ( GetUnitTypeId(u) == udg_Wave[udg_waveCount] ) then
set w = udg_waveCount
elseif ( GetUnitTypeId(u) == udg_Wave[(udg_waveCount-1)] ) then
set w = udg_waveCount - 1
elseif ( GetUnitTypeId(u) == udg_Wave[(udg_waveCount-2)] ) then
set w = udg_waveCount - 2
endif
set u = null
if udg_prevbonus != w then
set udg_prevbonus = w
set gold_reward_formula = w * 50 + 50
set xp_reward_formula = R2I( 10 + Pow(w, 1.2) * 20 + w * 30 * Count_Players() )
if udg_mode == 7 then
set gold_reward_formula = gold_reward_formula + udg_flagbonus * 50 - 300
set xp_reward_formula = R2I( 100 * udg_flagbonus - 100 + Pow(w, 1.2) * 20 + w * 30 * Count_Players() )
endif
loop
exitwhen a > 9
set p = Player(a)
call AddHeroXP( udg_Hero[a + 1], xp_reward_formula, true )
call AdjustPlayerStateBJ( gold_reward_formula, Player(a), PLAYER_STATE_RESOURCE_GOLD )
call AdjustPlayerStateBJ( 1, p, PLAYER_STATE_RESOURCE_LUMBER )
set a = a + 1
endloop
call Message("--- |cff9900ffWave " + I2S(w) + " Report|r ---", 5)
call Message("+|cffffcc00" + I2S(gold_reward_formula) + "|r Gold", 5)
call Message("+|cff0000ff1|r Arcane Seal", 5)
call Message("+|cff00ff00" + I2S(xp_reward_formula) + "|r Experience", 5)
if udg_mode == 6 then
call Next_Wave()
endif
endif
set p = null
endfunction
//===========================================================================
function InitTrig_Gold_Reward takes nothing returns nothing
set gg_trg_Gold_Reward = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Gold_Reward, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Gold_Reward, Condition( function Trig_Gold_Reward_Conditions ) )
call TriggerAddAction( gg_trg_Gold_Reward, function Trig_Gold_Reward_Actions )
endfunction
function Trig_Helper_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = GetUnitLifePercent(u) <= 25 and udg_helper
set u = null
return b
endfunction
function Trig_Helper_Actions takes nothing returns nothing
local location l = GetRectCenter(gg_rct_Base)
local player p = Player(10)
local unit u = CreateUnitAtLoc( p, 'O01E', l, 0 )
set udg_helper = false
call SetHeroLevel( u, 200, false )
call UnitApplyTimedLifeBJ( udg_speed, 'BTLF', u )
set udg_Chaos = udg_Chaos + 5
call Check_Chaos()
set udg_vpts = udg_vpts - 15
set p = null
set u = null
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
function InitTrig_Helper takes nothing returns nothing
set gg_trg_Helper = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Helper, gg_unit_h009_0083, EVENT_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Helper, Condition( function Trig_Helper_Conditions ) )
call TriggerAddAction( gg_trg_Helper, function Trig_Helper_Actions )
endfunction
function Trig_Waves_Actions takes nothing returns nothing
if udg_mode == 2 or udg_mode == 4 then
return
endif
set udg_Timer = CreateTimer()
set udg_TimerDialog = CreateTimerDialog(udg_Timer)
call TimerDialogSetTitle(udg_TimerDialog, "Wave 2 spawns in:")
call TimerStart(udg_Timer, udg_speed, true, function Next_Wave)
call TimerDialogDisplay(udg_TimerDialog, true)
call Next_Wave()
endfunction
//===========================================================================
function InitTrig_Waves takes nothing returns nothing
set gg_trg_Waves = CreateTrigger( )
call DisableTrigger( gg_trg_Waves )
call TriggerAddAction( gg_trg_Waves, function Trig_Waves_Actions )
endfunction
//function Trig_Order_Conditions takes nothing returns boolean
// local player p1 = Player(11)
// local unit u = GetTriggerUnit()
// local player p2 = GetOwningPlayer(u)
// local boolean b = ( p1 == p2 )
// set p1 = null
// set p2 = null
// set u = null
// return b
//endfunction
function Trig_Order_Actions takes nothing returns nothing
local rect r = gg_rct_Target
local unit u = GetTriggerUnit()
call IssuePointOrder(u, "patrol", GetRectCenterX(r), GetRectCenterY(r))
set r = null
set u = null
endfunction
//===========================================================================
function InitTrig_Order takes nothing returns nothing
local rect rr = GetPlayableMapRect()
local region r = CreateRegion()
call RegionAddRect(r, rr)
set gg_trg_Order = CreateTrigger( )
call TriggerRegisterEnterRegion(gg_trg_Order, r, Condition(function Enemy_Check_11))
//call TriggerRegisterEnterRectSimple( gg_trg_Order, GetPlayableMapRect() )
//call TriggerAddCondition( gg_trg_Order, Condition( function Trig_Order_Conditions ) )
call TriggerAddAction(gg_trg_Order, function Trig_Order_Actions)
set r = null
set rr = null
endfunction
//function Trig_Switch_Target_Conditions takes nothing returns boolean
// local unit u = GetTriggerUnit()
// local player p1 = GetOwningPlayer(u)
// local player p2 = Player(11)
// local boolean b = ( p1 == p2)
// set u = null
// set p1 = null
// set p2 = null
// return b
//endfunction
function Trig_Switch_Target_Actions takes nothing returns nothing
local rect r = gg_rct_Main_Target
local location l = GetRectCenter(r)
local unit u = GetTriggerUnit()
call IssuePointOrderLocBJ( u, "patrol", l )
call RemoveLocation(l)
set u = null
set l = null
set r = null
endfunction
//===========================================================================
function InitTrig_Switch_Target takes nothing returns nothing
local region r = CreateRegion()
call RegionAddRect(r, gg_rct_Target)
set gg_trg_Switch_Target = CreateTrigger()
call TriggerRegisterEnterRegion(gg_trg_Switch_Target, r, Condition(function Enemy_Check_11))
//call TriggerRegisterEnterRectSimple( gg_trg_Switch_Target, gg_rct_Target )
//call TriggerAddCondition( gg_trg_Switch_Target, Condition( function Trig_Switch_Target_Conditions ) )
call TriggerAddAction( gg_trg_Switch_Target, function Trig_Switch_Target_Actions )
set r = null
endfunction
//function Trig_Near_Conditions takes nothing returns boolean
// local unit u = GetTriggerUnit()
// local player p1 = Player(11)
// local player p2 = GetOwningPlayer(u)
// local boolean b = ( p1 == p2 )
// set u = null
// set p1 = null
// set p2 = null
// return b
//endfunction
function Trig_Near_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitMoveSpeed(u, GetUnitDefaultMoveSpeed(u))
set u = null
endfunction
//===========================================================================
function InitTrig_Near takes nothing returns nothing
local region r = CreateRegion()
call RegionAddRect(r, gg_rct_Near)
set gg_trg_Near = CreateTrigger( )
call TriggerRegisterEnterRegion(gg_trg_Near, r, Condition(function Enemy_Check_11))
//call TriggerRegisterEnterRectSimple( gg_trg_Near, gg_rct_Near )
//call TriggerAddCondition( gg_trg_Near, Condition( function Trig_Near_Conditions ) )
call TriggerAddAction( gg_trg_Near, function Trig_Near_Actions )
set r = null
endfunction
//function Trig_Enemy_Cleanup_Conditions takes nothing returns boolean
// local unit u = GetTriggerUnit()
// local player p1 = GetOwningPlayer(u)
// local player p2 = Player(11)
// local boolean b = ( p1 == p2 )
// set u = null
// set p1 = null
// set p2 = null
// return b
//endfunction
function Trig_Enemy_Cleanup_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call IssuePointOrder(u, "patrol", GetRectCenterX(gg_rct_Main_Target), GetRectCenterY(gg_rct_Main_Target))
set u = null
endfunction
//===========================================================================
function InitTrig_Enemy_Cleanup takes nothing returns nothing
local rect rr = GetPlayableMapRect()
local region r = CreateRegion()
call RegionAddRect(r, rr)
set gg_trg_Enemy_Cleanup = CreateTrigger()
call TriggerRegisterEnterRegion(gg_trg_Enemy_Cleanup, r, Condition(function Enemy_Check_11))
//call TriggerRegisterEnterRectSimple(gg_trg_Enemy_Cleanup, r)
//call TriggerAddCondition(gg_trg_Enemy_Cleanup, Condition(function Trig_Enemy_Cleanup_Conditions))
call TriggerAddAction(gg_trg_Enemy_Cleanup, function Trig_Enemy_Cleanup_Actions)
set r = null
set rr = null
endfunction
function Trig_Mag_Level_Up_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local item i = LoadItemHandle(udg_mag, GetPlayerId(p), 0)
local boolean b = UnitHasItem(u, i)
set u = null
set p = null
set i = null
return b
endfunction
function Trig_Mag_Level_Up_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
local integer g = GetPlayerId(p)
call MLevelUp(g, 1, 1, 1, 1, u)
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Mag_Level_Up takes nothing returns nothing
set gg_trg_Mag_Level_Up = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mag_Level_Up, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddCondition( gg_trg_Mag_Level_Up, Condition( function Trig_Mag_Level_Up_Conditions ) )
call TriggerAddAction( gg_trg_Mag_Level_Up, function Trig_Mag_Level_Up_Actions )
endfunction
function Trig_Check_Level_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A085'
endfunction
function Trig_Check_Level_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
local integer i = GetPlayerId(p)
local item mag = LoadItemHandle(udg_mag, i, 0)
local integer lvl = LoadInteger(udg_mag, i, MStat("lvl"))
local integer pow = LoadInteger(udg_mag, i, MStat("pow"))
local integer dex = LoadInteger(udg_mag, i, MStat("dex"))
local integer mind = LoadInteger(udg_mag, i, MStat("mind"))
local integer def = LoadInteger(udg_mag, i, MStat("def"))
local integer pb = LoadInteger(udg_mag, i, MStat("pb"))
local string pbname
local string name = GetItemName(mag)
//call IssueImmediateOrder(u,"stop")
if pow > dex and pow > mind and pow > def then
set pbname = "|cffff0000PILLA|r (damage enemies)"
elseif dex > pow and dex > mind and dex > def then
set pbname = "|cffffff00ESTLLA|r (destroy enemy mana)"
elseif mind > pow and mind > dex and mind > def then
set pbname = "|cff00ff00MYLLA & YOULLA|r (cooldown reset)"
else
set pbname = "|cff0000ffLEILLA|r (hp & mana bonus)"
endif
call DisplayTextToPlayer(p, 0, 0, "--- " + name + " ---\n|cffff00ffLVL|r: " + I2S(lvl) + "\n|cffff0000POW|r: " + I2S(pow) + "\n|cffffff00DEX|r: " + I2S(dex) + "\n|cff00ff00MIND|r: " + I2S(mind) + "\n|cff0000ffDEF|r: " + I2S(def) + "\n|cffccccccPB|r: " + I2S(pb) + "\n---\n|cffccccccPhoton Blast|r: " + pbname + "\n---" )
set p = null
set u = null
set mag = null
endfunction
//===========================================================================
function InitTrig_Check_Level takes nothing returns nothing
set gg_trg_Check_Level = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Check_Level, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Check_Level, Condition( function Trig_Check_Level_Conditions ) )
call TriggerAddAction( gg_trg_Check_Level, function Trig_Check_Level_Actions )
endfunction
function Trig_Feed_Trimate_Conditions takes nothing returns boolean
local player p = GetTriggerPlayer()
local boolean b = GetSpellAbilityId() == 'A0A7' and GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) >= 100
set p = null
return b
endfunction
function Trig_Feed_Trimate_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = GetTriggerUnit()
local integer i = GetPlayerId(p)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) - 100)
call MLevelUp(i, 1, 0, 0, 0, u)
call DisplayTextToPlayer(p, 0, 0, "--- |cff00ffffFeeding Report|r ---\n|cffff0000POW|r + 1\n---")
//call IssueImmediateOrder(u,"stop")
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Feed_Trimate takes nothing returns nothing
set gg_trg_Feed_Trimate = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Feed_Trimate, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Feed_Trimate, Condition( function Trig_Feed_Trimate_Conditions ) )
call TriggerAddAction( gg_trg_Feed_Trimate, function Trig_Feed_Trimate_Actions )
endfunction
function Trig_Feed_Sol_Atomizer_Conditions takes nothing returns boolean
local player p = GetTriggerPlayer()
local boolean b = GetSpellAbilityId() == 'A0AA' and GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) >= 100
set p = null
return b
endfunction
function Trig_Feed_Sol_Atomizer_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = GetTriggerUnit()
local integer i = GetPlayerId(p)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) - 100)
call MLevelUp(i, 0, 1, 0, 0, u)
call DisplayTextToPlayer(p, 0, 0, "--- |cff00ffffFeeding Report|r ---\n|cffffff00DEX|r + 1\n---")
//call IssueImmediateOrder(u,"stop")
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Feed_Sol_Atomizer takes nothing returns nothing
set gg_trg_Feed_Sol_Atomizer = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Feed_Sol_Atomizer, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Feed_Sol_Atomizer, Condition( function Trig_Feed_Sol_Atomizer_Conditions ) )
call TriggerAddAction( gg_trg_Feed_Sol_Atomizer, function Trig_Feed_Sol_Atomizer_Actions )
endfunction
function Trig_Feed_Trifluid_Conditions takes nothing returns boolean
local player p = GetTriggerPlayer()
local boolean b = GetSpellAbilityId() == 'A0AB' and GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) >= 100
set p = null
return b
endfunction
function Trig_Feed_Trifluid_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = GetTriggerUnit()
local integer i = GetPlayerId(p)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) - 100)
call MLevelUp(i, 0, 0, 1, 0, u)
call DisplayTextToPlayer(p, 0, 0, "--- |cff00ffffFeeding Report|r ---\n|cff00ff00MIND|r + 1\n---")
//call IssueImmediateOrder(u,"stop")
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Feed_Trifluid takes nothing returns nothing
set gg_trg_Feed_Trifluid = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Feed_Trifluid, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Feed_Trifluid, Condition( function Trig_Feed_Trifluid_Conditions ) )
call TriggerAddAction( gg_trg_Feed_Trifluid, function Trig_Feed_Trifluid_Actions )
endfunction
function Trig_Feed_Moon_Atomizer_Conditions takes nothing returns boolean
local player p = GetTriggerPlayer()
local boolean b = GetSpellAbilityId() == 'A0AC' and GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) >= 100
set p = null
return b
endfunction
function Trig_Feed_Moon_Atomizer_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = GetTriggerUnit()
local integer i = GetPlayerId(p)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) - 100)
call MLevelUp(i, 0, 0, 0, 1, u)
call DisplayTextToPlayer(p, 0, 0, "--- |cff00ffffFeeding Report|r ---\n|cff0000ffDEF|r + 1\n---")
//call IssueImmediateOrder(u,"stop")
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Feed_Moon_Atomizer takes nothing returns nothing
set gg_trg_Feed_Moon_Atomizer = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Feed_Moon_Atomizer, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Feed_Moon_Atomizer, Condition( function Trig_Feed_Moon_Atomizer_Conditions ) )
call TriggerAddAction( gg_trg_Feed_Moon_Atomizer, function Trig_Feed_Moon_Atomizer_Actions )
endfunction
function Trig_PB_Generate_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local boolean b = UnitHasItem(u, LoadItemHandle(udg_mag, GetPlayerId(p), 0)) and LoadInteger(udg_mag, GetPlayerId(p), MStat("pb")) >= 99
if (GetRandomInt(1, 20) <= 7) then
call SaveInteger(udg_mag, GetPlayerId(p), MStat("pb"), LoadInteger(udg_mag, GetPlayerId(p), MStat("pb"))+1)
if GetRandomInt(1, 20) == 7 and UnitHasItemOfTypeBJ(u, 'I02V') and UnitHasItemOfTypeBJ(u, 'I02X') then
call SaveInteger(udg_mag, GetPlayerId(p), MStat("pb"), LoadInteger(udg_mag, GetPlayerId(p), MStat("pb"))+1)
endif
endif
set u = null
set p = null
return b
endfunction
function Trig_PB_Generate_ManaKill takes nothing returns nothing
local unit u = GetEnumUnit()
local real i = GetUnitState(u, UNIT_STATE_LIFE) - (GetUnitState(u, UNIT_STATE_MANA)/5)
if i < 1 then
set i = 1
endif
call SetUnitState(u, UNIT_STATE_LIFE, i)
call SetUnitState(u, UNIT_STATE_MANA, 0)
set u = null
endfunction
function Trig_PB_Generate_Kill takes nothing returns nothing //no longer kills, just sets HP to 1
local unit u = GetEnumUnit()
if GetUnitLevel(u) < 99 then
call SetUnitState(u, UNIT_STATE_LIFE, 1)
else
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE)/2)
endif
set u = null
endfunction
function Trig_PB_Generate_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetUnitLoc(u)
local group g = CreateGroup()
local player p = GetOwningPlayer(u)
local integer id = GetPlayerId(p)
local integer pow = LoadInteger(udg_mag, id, MStat("pow"))
local integer dex = LoadInteger(udg_mag, id, MStat("dex"))
local integer mind = LoadInteger(udg_mag, id, MStat("mind"))
local integer def = LoadInteger(udg_mag, id, MStat("def"))
local texttag t = CreateTextTagUnitBJ("PHOTON BLAST ACTIVATE!", u, 0, 10, 100, 100, 0, 10)
local unit e = CreateUnit(p, 'ncp3', GetUnitX(u), GetUnitY(u), 0)
local string s = "|cffffff00ACTIVATE!|r\n+ Affects "
local integer m = 0
if UnitHasItemOfTypeBJ(u, 'I02V') then
set m = m + 1
endif
if UnitHasItemOfTypeBJ(u, 'I02X') then
set m = m + 1
endif
call SetTextTagPermanentBJ(t, false)
call SetTextTagFadepointBJ(t, 2)
call SetTextTagVelocityBJ(t, 40, 90)
call SetTextTagLifespanBJ(t, 3)
if pow > dex and pow > mind and pow > def then
set s = "|cffff0000PILLA|r " + s + "enemies within 300 range\n+ 99.9% HP destruction (non-bosses)\n+ 50% HP destruction (bosses)"
set g = GetUnitsInRangeOfLocMatching(300 + 50 * m, l, Filter(function Enemy_Check))
call ForGroup(g, function Trig_PB_Generate_Kill)
elseif dex > pow and dex > mind and dex > def then
set s = "|cffffff00ESTLLA|r " + s + "enemies within 2000 range\n+ 20% mana burn damage\n+ 100% mana destruction"
set g = GetUnitsInRangeOfLocMatching(2000 + 500 * m, l, Filter(function Enemy_Check))
call ForGroup(g, function Trig_PB_Generate_ManaKill)
elseif mind > pow and mind > dex and mind > def then
set s = "|cff00ff00MYLLA & YOULLA|r " + s + "self\n+ Cooldown reset"
call UnitResetCooldown(u)
elseif def >= pow and def >= dex and def >= mind then
set s = "|cff0000ffLEILLA|r " + s + "self\n+ Up to 50% HP restore\n+ 100% mana restore"
if GetUnitStatePercent(u, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE) < (50 + 10 * m) then
call SetUnitLifePercentBJ(u, 50 + 50 * m)
endif
call SetUnitManaPercentBJ(u, 100)
endif
if p == GetLocalPlayer() then
call Message("|cffffff00PHOTON BLAST:|r " + s, 8)
endif
call SaveInteger(udg_mag, GetPlayerId(p), MStat("pb"), 0)
set u = null
set p = null
call RemoveLocation(l)
set l = null
call DestroyGroup(g)
set g = null
call TriggerSleepAction(3)
call RemoveUnit(e)
set e = null
set t = null
endfunction
//===========================================================================
function InitTrig_PB_Generate takes nothing returns nothing
set gg_trg_PB_Generate = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_PB_Generate, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_PB_Generate, Condition( function Trig_PB_Generate_Conditions ) )
call TriggerAddAction( gg_trg_PB_Generate, function Trig_PB_Generate_Actions )
endfunction
function Awakenable takes nothing returns boolean
local unit u = GetFilterUnit()
local boolean b = (GetHeroLevel(u) >= 35 and UnitHasItemOfTypeBJ(u, 'I02N'))
set u = null
return b
endfunction
function Trig_Awaken_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i = GetItemOfTypeFromUnitBJ(u, 'I02N')
local player p = GetOwningPlayer(u)
call RemoveItem(i)
set i = UnitAddItemById(u, 'I043')
call Message(GetPlayerName(p) + " has awakened the true power of the Hammer of Thor!", 5)
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\Lightnings Long.mdx", u, "origin"))
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
set udg_vpts = udg_vpts + 10/Count_Players()
set u = null
set p = null
set i = null
endfunction
//===========================================================================
function InitTrig_Awaken takes nothing returns nothing
local region r = CreateRegion()
call RegionAddRect(r, gg_rct_Region_045)
set gg_trg_Awaken = CreateTrigger()
call TriggerRegisterEnterRegion(gg_trg_Awaken, r, Condition(function Awakenable))
call TriggerAddAction(gg_trg_Awaken, function Trig_Awaken_Actions)
set r = null
endfunction
function Trig_Dragon_Stone_Conditions takes nothing returns boolean
local unit u = GetKillingUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I02D')
set u = null
return b
endfunction
function Trig_Dragon_Stone_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local item i = UnitAddItemById(u, 'I032')
call Message(GetPlayerName(p) + " has acquired the legendary Dragon Stone!", 5)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin"))
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
set udg_vpts = udg_vpts + 10/Count_Players()
set u = null
set p = null
set i = null
endfunction
//===========================================================================
function InitTrig_Dragon_Stone takes nothing returns nothing
set gg_trg_Dragon_Stone = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Dragon_Stone, gg_unit_h017_0059, EVENT_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Dragon_Stone, Condition( function Trig_Dragon_Stone_Conditions ) )
call TriggerAddAction( gg_trg_Dragon_Stone, function Trig_Dragon_Stone_Actions )
endfunction
function Trig_Leviathan_Razor_Armor_Conditions takes nothing returns boolean
local unit u = GetKillingUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I02D')
set u = null
return b
endfunction
function Trig_Leviathan_Razor_Armor_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local item i = UnitAddItemById(u, 'I01S')
call Message(GetPlayerName(p) + " has acquired the legendary Leviathan Razor Armor!", 5)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin"))
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
set udg_vpts = udg_vpts + 10/Count_Players()
set u = null
set p = null
set i = null
endfunction
//===========================================================================
function InitTrig_Leviathan_Razor_Armor takes nothing returns nothing
set gg_trg_Leviathan_Razor_Armor = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Leviathan_Razor_Armor, gg_unit_n01U_0046, EVENT_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Leviathan_Razor_Armor, Condition( function Trig_Leviathan_Razor_Armor_Conditions ) )
call TriggerAddAction( gg_trg_Leviathan_Razor_Armor, function Trig_Leviathan_Razor_Armor_Actions )
endfunction
function Trig_Phoenix_Wing_Conditions takes nothing returns boolean
local unit u = GetKillingUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I02D')
set u = null
return b
endfunction
function Trig_Phoenix_Wing_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local item i = UnitAddItemById(u, 'I042')
call Message(GetPlayerName(p) + " has acquired the legendary Phoenix Wing!", 5)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin"))
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
set udg_vpts = udg_vpts + 10/Count_Players()
set u = null
set p = null
set i = null
endfunction
//===========================================================================
function InitTrig_Phoenix_Wing takes nothing returns nothing
set gg_trg_Phoenix_Wing = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Phoenix_Wing, gg_unit_h00P_0042, EVENT_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Phoenix_Wing, Condition( function Trig_Phoenix_Wing_Conditions ) )
call TriggerAddAction( gg_trg_Phoenix_Wing, function Trig_Phoenix_Wing_Actions )
endfunction
function Trig_Masashi_Asuka_Kills_Conditions takes nothing returns boolean
local unit u = GetKillingUnit()
local item i
local integer a = 0
loop
exitwhen a > 6
set i = UnitItemInSlot(u, a)
if (i != null) and (GetItemTypeId(i) == 'I01L') then
set i = null
set u = null
return true
endif
set a = a + 1
endloop
set i = null
set u = null
return false
endfunction
function Trig_Masashi_Asuka_Kills_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local item m = null
local effect e = null
local integer i = LoadInteger( udg_h, GetPlayerId(p), 'SAYK' ) + 1
set u = udg_Hero[GetPlayerId(p)+1]
if ( i >= 230 ) then
set m = GetItemOfTypeFromUnitBJ(u, 'I01L')
call RemoveItem( m )
set m = null
set m = UnitAddItemByIdSwapped( 'I02T', u )
call Message(GetPlayerName(p) + " has unlocked the legendary combo Masashi & Asuka!", 5)
set e = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin" )
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
call DestroyEffect(e)
set e = null
set i = 0
set udg_vpts = udg_vpts + 10/Count_Players()
endif
call SaveInteger( udg_h, GetPlayerId(p), 'SAYK', i )
set u = null
set p = null
set m = null
endfunction
//===========================================================================
function InitTrig_Masashi_Asuka_Kills takes nothing returns nothing
set gg_trg_Masashi_Asuka_Kills = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Masashi_Asuka_Kills, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Masashi_Asuka_Kills, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Masashi_Asuka_Kills, Condition( function Trig_Masashi_Asuka_Kills_Conditions ) )
call TriggerAddAction( gg_trg_Masashi_Asuka_Kills, function Trig_Masashi_Asuka_Kills_Actions )
endfunction
function Trig_Tsumikiri_Kills_Conditions takes nothing returns boolean
local unit u = GetKillingUnit()
local item i
local integer a = 0
loop
set i = UnitItemInSlot(u, a)
if (i != null) and (GetItemTypeId(i) == 'I01I') then
set i = null
set u = null
return true
endif
set a = a + 1
exitwhen a >= 6
endloop
set i = null
set u = null
return false
endfunction
function Trig_Tsumikiri_Kills_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local integer i = LoadInteger( udg_h, GetPlayerId(p), 'TKIL' ) + 1
local effect e = null
set u = udg_Hero[GetPlayerId(p)+1]
if ( i >= 230 ) then
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 'I01I') )
call UnitAddItemByIdSwapped( 'I01J', u )
call Message(GetPlayerName(p) + " has unlocked the legendary Tsumikiri J-Sword!", 5)
set e = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin" )
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
call DestroyEffect(e)
set e = null
set i = 0
set udg_vpts = udg_vpts + 10/Count_Players()
endif
call SaveInteger( udg_h, GetPlayerId(p), 'TKIL', i )
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Tsumikiri_Kills takes nothing returns nothing
set gg_trg_Tsumikiri_Kills = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Tsumikiri_Kills, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Tsumikiri_Kills, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Tsumikiri_Kills, Condition( function Trig_Tsumikiri_Kills_Conditions ) )
call TriggerAddAction( gg_trg_Tsumikiri_Kills, function Trig_Tsumikiri_Kills_Actions )
endfunction
function Trig_Archangel_Kills_Conditions takes nothing returns boolean
local unit u = GetKillingUnit()
local item i
local integer a = 0
loop
set i = UnitItemInSlot(u, a)
if (i != null) and (GetItemTypeId(i) == 'I024') then
set i = null
set u = null
return true
endif
set a = a + 1
exitwhen a >= 6
endloop
set i = null
set u = null
return false
endfunction
function Trig_Archangel_Kills_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local item m
local integer i = LoadInteger( udg_h, GetPlayerId(p), 'AKIL' ) + 1
set u = udg_Hero[GetPlayerId(p)+1]
if ( i >= 230 ) then
set m = GetItemOfTypeFromUnitBJ(u, 'I024')
call RemoveItem( m )
set m = null
set m = UnitAddItemByIdSwapped( 'I02F', u )
call Message(GetPlayerName(p) + " has unlocked the legendary Archangel's Blade!", 5)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin" ) )
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
set i = 0
set udg_vpts = udg_vpts + 10/Count_Players()
endif
call SaveInteger( udg_h, GetPlayerId(p), 'AKIL', i )
set u = null
set p = null
set m = null
endfunction
//===========================================================================
function InitTrig_Archangel_Kills takes nothing returns nothing
set gg_trg_Archangel_Kills = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Archangel_Kills, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Archangel_Kills, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Archangel_Kills, Condition( function Trig_Archangel_Kills_Conditions ) )
call TriggerAddAction( gg_trg_Archangel_Kills, function Trig_Archangel_Kills_Actions )
endfunction
function Trig_Perfect_Rebirth_Damage_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I01Z')
set u = null
return b
endfunction
function Trig_Perfect_Rebirth_Damage_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer mission_id = GetConvertedPlayerId(p)
call SaveInteger( udg_h, mission_id, 'PRBD', LoadInteger(udg_h, mission_id, 'PRBD') + udg_waveCount )
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Perfect_Rebirth_Damage takes nothing returns nothing
set gg_trg_Perfect_Rebirth_Damage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_Perfect_Rebirth_Damage, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition( gg_trg_Perfect_Rebirth_Damage, Condition( function Trig_Perfect_Rebirth_Damage_Conditions ) )
call TriggerAddAction( gg_trg_Perfect_Rebirth_Damage, function Trig_Perfect_Rebirth_Damage_Actions )
endfunction
function Trig_Perfect_Rebirth_Raise_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I01Z')
set u = null
return b
endfunction
function Trig_Perfect_Rebirth_Raise_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local item i
if ( LoadInteger(udg_h, GetConvertedPlayerId(p), 'PRBD') >= 10000 ) then
set i = GetItemOfTypeFromUnitBJ(u, 'I01Z')
call RemoveItem( i )
set i = null
set i = UnitAddItemByIdSwapped( 'I028', udg_Hero[GetPlayerId(p)+1] )
call Message(GetPlayerName(p) + " has unlocked the legendary Perfect Rebirth!", 5)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin" ) )
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
call SaveInteger(udg_h, GetConvertedPlayerId(p), 'PRBD', 0)
set udg_vpts = udg_vpts + 10/Count_Players()
endif
set u = null
set p = null
set i = null
endfunction
//===========================================================================
function InitTrig_Perfect_Rebirth_Raise takes nothing returns nothing
set gg_trg_Perfect_Rebirth_Raise = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Perfect_Rebirth_Raise, EVENT_PLAYER_HERO_REVIVE_FINISH )
call TriggerAddCondition( gg_trg_Perfect_Rebirth_Raise, Condition( function Trig_Perfect_Rebirth_Raise_Conditions ) )
call TriggerAddAction( gg_trg_Perfect_Rebirth_Raise, function Trig_Perfect_Rebirth_Raise_Actions )
endfunction
function Trig_Forgotten_Jewel_Count_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I022')
set u = null
return b
endfunction
function Trig_Forgotten_Jewel_Count_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer count = LoadInteger( udg_h, GetConvertedPlayerId(p), 'FJCC')
local item i
set u = udg_Hero[GetPlayerId(p)+1]
set i = GetItemOfTypeFromUnitBJ(u, 'I022')
if count >= 90 then
call RemoveItem(i)
call UnitAddItemByIdSwapped('I02B', u)
call Message(GetPlayerName(p) + " has unlocked the legendary Forgotten Jewel!", 5)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin" ) )
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
call SaveInteger(udg_h, GetConvertedPlayerId(p), 'FJCC', 0)
set udg_vpts = udg_vpts + 10/Count_Players()
else
set count = count + 1
call SaveInteger(udg_h, GetConvertedPlayerId(p), 'FJCC', count)
endif
set i = null
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Forgotten_Jewel_Count takes nothing returns nothing
set gg_trg_Forgotten_Jewel_Count = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Forgotten_Jewel_Count, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Forgotten_Jewel_Count, Condition( function Trig_Forgotten_Jewel_Count_Conditions ) )
call TriggerAddAction( gg_trg_Forgotten_Jewel_Count, function Trig_Forgotten_Jewel_Count_Actions )
endfunction
function Trig_Obsidian_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I029') and (GetSpellAbilityId() == 'A06R')
set u = null
return b
endfunction
function Trig_Obsidian_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer count = LoadInteger( udg_h, GetConvertedPlayerId(p), 'OBSD')
local item i
set u = udg_Hero[GetPlayerId(p)+1]
set i = GetItemOfTypeFromUnitBJ(u, 'I029')
if count >= 12 then
call RemoveItem(i)
call UnitAddItemByIdSwapped('I044', u)
call Message(GetPlayerName(p) + " has unlocked the legendary Obsidian Blade!", 5)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", u, "origin" ) )
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
call SaveInteger(udg_h, GetConvertedPlayerId(p), 'OBSD', 0)
set udg_vpts = udg_vpts + 10/Count_Players()
else
set count = count + 1
call SaveInteger(udg_h, GetConvertedPlayerId(p), 'OBSD', count)
endif
set i = null
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Obsidian takes nothing returns nothing
set gg_trg_Obsidian = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Obsidian, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Obsidian, Condition( function Trig_Obsidian_Conditions ) )
call TriggerAddAction( gg_trg_Obsidian, function Trig_Obsidian_Actions )
endfunction
function Trig_Spirit_of_Corruption_Timer_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = GetItemTypeId(i) == 'I02P'
set i = null
return b
endfunction
function corruption_check takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer pid = LoadInteger(udg_crpt, GetHandleId(t), 'p')
local item i
local integer c = LoadInteger(udg_crpt, GetHandleId(t), 'c')
if UnitHasItemOfTypeBJ(udg_Hero[pid+1], 'I02P') then
if c >= 300 then
set i = GetItemOfTypeFromUnitBJ(udg_Hero[pid+1], 'I02P')
call RemoveItem(i)
call UnitAddItemByIdSwapped('I01Q', udg_Hero[pid+1])
call Message(GetPlayerName(Player(pid)) + " has unlocked the legendary Spirit of Corruption!", 5)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", udg_Hero[pid+1], "origin" ) )
set udg_Chaos = udg_Chaos + 2
call Check_Chaos()
call SaveInteger(udg_crpt, GetHandleId(t), 'c', -1)
call PauseTimer(t)
call DestroyTimer(t)
set udg_vpts = udg_vpts + 10/Count_Players()
elseif c >= 0 then
call SaveInteger(udg_crpt, GetHandleId(t), 'c', c + 1)
endif
else
call SaveInteger(udg_crpt, GetHandleId(t), 'c', 0)
call FlushChildHashtable(udg_crpt, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
endif
set i = null
set t = null
endfunction
function Trig_Spirit_of_Corruption_Timer_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local timer t = CreateTimer()
call SaveInteger(udg_crpt, GetHandleId(t), 'p', GetPlayerId(p))
call SaveInteger(udg_crpt, GetHandleId(t), 'c', 0)
call TimerStart(t, 3, true, function corruption_check)
set t = null
set p = null
endfunction
//===========================================================================
function InitTrig_Spirit_of_Corruption_Timer takes nothing returns nothing
set gg_trg_Spirit_of_Corruption_Timer = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Spirit_of_Corruption_Timer, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Spirit_of_Corruption_Timer, Condition( function Trig_Spirit_of_Corruption_Timer_Conditions ) )
call TriggerAddAction( gg_trg_Spirit_of_Corruption_Timer, function Trig_Spirit_of_Corruption_Timer_Actions )
endfunction
function PlayerId2ColorString takes integer id returns string
if id == 0 then
return "|cffff0000"
elseif id == 1 then
return "|cff0042ff"
elseif id == 2 then
return "|cff1ce6b9"
elseif id == 3 then
return "|cff540081"
elseif id == 4 then
return "|cffffff00"
elseif id == 5 then
return "|cffff8a0e"
elseif id == 6 then
return "|cff20c000"
elseif id == 7 then
return "|cffe55bb0"
elseif id == 8 then
return "|cff959697"
elseif id == 9 then
return "|cff7ebff1"
else
return "|cff000000"
endif
endfunction
function Trig_Create_Actions takes nothing returns nothing
local integer playerid = 0
local integer boardrow = 0
local player p
local string name
set udg_multiboard = CreateMultiboardBJ( 2, Count_Players(), "Kills" )
call MultiboardSetItemsStyle(udg_multiboard, true, false)
loop
exitwhen playerid > 9
set p = Player(playerid)
if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING then
set name = PlayerId2ColorString(GetPlayerId(p))
if GetPlayerController(p) == MAP_CONTROL_COMPUTER then
set name = name + "Bot " + I2S(GetPlayerId(p)+1) + "|r"
call SetPlayerName(p, name)
else
set name = name + GetPlayerName(p) + "|r"
endif
set udg_playerorder[playerid] = boardrow+1
call MultiboardSetItemWidthBJ(udg_multiboard, 1, udg_playerorder[playerid], 10)
call MultiboardSetItemWidthBJ(udg_multiboard, 2, udg_playerorder[playerid], 3)
call MultiboardSetItemValueBJ(udg_multiboard, 1, udg_playerorder[playerid], name)
call MultiboardSetItemValueBJ(udg_multiboard, 2, udg_playerorder[playerid], I2S(udg_kills[playerid]))
set boardrow = boardrow + 1
endif
set playerid = playerid + 1
endloop
call MultiboardMinimize(udg_multiboard, true)
set p = null
call DestroyTrigger(gg_trg_Create)
endfunction
//===========================================================================
function InitTrig_Create takes nothing returns nothing
set gg_trg_Create = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Create, 10 )
call TriggerAddAction( gg_trg_Create, function Trig_Create_Actions )
endfunction
function Trig_Kill_Increment_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local integer i = GetPlayerId(p)
local integer row = udg_playerorder[i]
if u == null or p == null or i > 9 then
set p = null
return
endif
set udg_kills[i] = udg_kills[i] + 1
if udg_kills[i] == 100 then
call AdjustPlayerStateBJ( 1, p, PLAYER_STATE_RESOURCE_LUMBER )
elseif udg_kills[i] == 200 then
call AdjustPlayerStateBJ( 2, p, PLAYER_STATE_RESOURCE_LUMBER )
set udg_Chaos = udg_Chaos + 1
call Check_Chaos()
elseif udg_kills[i] == 300 then
call AdjustPlayerStateBJ( 3, p, PLAYER_STATE_RESOURCE_LUMBER )
elseif udg_kills[i] == 400 then
call AdjustPlayerStateBJ( 4, p, PLAYER_STATE_RESOURCE_LUMBER )
set udg_Chaos = udg_Chaos + 1
call Check_Chaos()
elseif udg_kills[i] == 500 then
call AdjustPlayerStateBJ( 5, p, PLAYER_STATE_RESOURCE_LUMBER )
set udg_vpts = udg_vpts + 10
elseif udg_kills[i] == 600 then
call AdjustPlayerStateBJ( 6, p, PLAYER_STATE_RESOURCE_LUMBER )
set udg_Chaos = udg_Chaos + 1
call Check_Chaos()
elseif udg_kills[i] == 700 then
call AdjustPlayerStateBJ( 7, p, PLAYER_STATE_RESOURCE_LUMBER )
elseif udg_kills[i] == 800 then
call AdjustPlayerStateBJ( 8, p, PLAYER_STATE_RESOURCE_LUMBER )
set udg_Chaos = udg_Chaos + 1
call Check_Chaos()
elseif udg_kills[i] == 900 then
call AdjustPlayerStateBJ( 9, p, PLAYER_STATE_RESOURCE_LUMBER )
elseif udg_kills[i] == 1000 then
call AdjustPlayerStateBJ( 10, p, PLAYER_STATE_RESOURCE_LUMBER )
set udg_Chaos = udg_Chaos + 1
call Check_Chaos()
set udg_vpts = udg_vpts + 20
endif
call MultiboardSetItemValueBJ(udg_multiboard, 2, row, I2S(udg_kills[i]))
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Kill_Increment takes nothing returns nothing
set gg_trg_Kill_Increment = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Kill_Increment, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Kill_Increment, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Kill_Increment, function Trig_Kill_Increment_Actions )
endfunction
function Trig_Camera_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
call SetCameraFieldForPlayer( p, CAMERA_FIELD_TARGET_DISTANCE, 2250, 1 )
set p = null
endfunction
//===========================================================================
function InitTrig_Camera takes nothing returns nothing
set gg_trg_Camera = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(0), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(1), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(2), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(3), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(4), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(5), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(6), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(7), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(8), "-z", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera, Player(9), "-z", true )
call TriggerAddAction( gg_trg_Camera, function Trig_Camera_Actions )
endfunction
function Trig_Enable_Wayward_Purge_Actions takes nothing returns nothing
local string s = "en"
set udg_purge = not udg_purge
if udg_purge == false then
set s = "dis"
endif
call Message("Wayward purging has been " + s + "abled.", 5)
endfunction
//===========================================================================
function InitTrig_Enable_Wayward_Purge takes nothing returns nothing
set gg_trg_Enable_Wayward_Purge = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(0), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(1), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(2), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(3), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(4), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(5), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(6), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(7), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(8), "-e", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable_Wayward_Purge, Player(9), "-e", true )
call TriggerAddAction( gg_trg_Enable_Wayward_Purge, function Trig_Enable_Wayward_Purge_Actions )
endfunction
function Trig_No_Passwords_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local player l
if IsTriggerEnabled(gg_trg_Secret_Hero_Command_1) then
call DisableTrigger(gg_trg_Secret_Hero_Command_1)
call DisableTrigger(gg_trg_Secret_Hero_Command_2)
call DisableTrigger(gg_trg_Secret_Hero_Command_4)
call DisableTrigger(gg_trg_Secret_Hero_Command_5)
call SavePlayerHandle(udg_h, 'NPAS', 0, p)
call Message("|cffff0000Passwords have been disabled.|r", 5)
else
set l = LoadPlayerHandle(udg_h, 'NPAS', 0)
if p == l or GetPlayerSlotState(l) == PLAYER_SLOT_STATE_LEFT then
call EnableTrigger(gg_trg_Secret_Hero_Command_1)
call EnableTrigger(gg_trg_Secret_Hero_Command_2)
call EnableTrigger(gg_trg_Secret_Hero_Command_4)
call EnableTrigger(gg_trg_Secret_Hero_Command_5)
call Message("|cffff0000Passwords have been enabled.|r", 5)
else
call Message("|cffff0000Only the player who disabled passwords can enable them.|r", 5)
endif
endif
set l = null
set p = null
endfunction
//===========================================================================
function InitTrig_No_Passwords takes nothing returns nothing
set gg_trg_No_Passwords = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(0), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(1), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(2), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(3), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(4), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(5), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(6), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(7), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(8), "-p", true )
call TriggerRegisterPlayerChatEvent( gg_trg_No_Passwords, Player(9), "-p", true )
call TriggerAddAction( gg_trg_No_Passwords, function Trig_No_Passwords_Actions )
endfunction
function Trig_Cleanup_Enemies_Actions takes nothing returns nothing
local player p = Player(11)
local group g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, p, Condition(function NullCondition))
call GroupPointOrder(g, "patrol", GetRectCenterX(gg_rct_Main_Target), GetRectCenterY(gg_rct_Main_Target))
call DestroyGroup(g)
set g = null
set p = null
endfunction
//===========================================================================
function InitTrig_Cleanup_Enemies takes nothing returns nothing
set gg_trg_Cleanup_Enemies = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(0), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(1), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(2), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(3), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(4), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(5), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(6), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(7), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(8), "-c", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Cleanup_Enemies, Player(9), "-c", true )
call TriggerAddAction( gg_trg_Cleanup_Enemies, function Trig_Cleanup_Enemies_Actions )
endfunction
function Trig_Free_Play_Next_Wave_Actions takes nothing returns nothing
if (udg_mode == 2 or udg_mode == 4) and (LoadBoolean(udg_h, 'w', 0) == true) then
call Next_Wave()
call SaveBoolean(udg_h, 'w', 0, false)
call TriggerSleepAction(15)
call SaveBoolean(udg_h, 'w', 0, true)
endif
endfunction
//===========================================================================
function InitTrig_Free_Play_Next_Wave takes nothing returns nothing
set gg_trg_Free_Play_Next_Wave = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(0), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(1), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(2), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(3), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(4), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(5), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(6), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(7), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(8), "-w", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Free_Play_Next_Wave, Player(9), "-w", true )
call TriggerAddAction( gg_trg_Free_Play_Next_Wave, function Trig_Free_Play_Next_Wave_Actions )
endfunction
function Trig_Secret_Hero_Command_1_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
call CreateFogModifierRectBJ( true, p, FOG_OF_WAR_VISIBLE, gg_rct_SecretHero1 )
set udg_vpts = udg_vpts - 5
set p = null
endfunction
//===========================================================================
function InitTrig_Secret_Hero_Command_1 takes nothing returns nothing
set gg_trg_Secret_Hero_Command_1 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(0), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(1), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(2), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(3), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(4), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(5), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(6), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(7), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(8), "Divine Wrath", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_1, Player(9), "Divine Wrath", true )
call TriggerAddAction( gg_trg_Secret_Hero_Command_1, function Trig_Secret_Hero_Command_1_Actions )
endfunction
function Trig_Secret_Hero_Command_2_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local rect r = gg_rct_SecretHero2
call CreateFogModifierRectBJ( true, p, FOG_OF_WAR_VISIBLE, r )
set udg_vpts = udg_vpts - 5
set p = null
set r = null
endfunction
//===========================================================================
function InitTrig_Secret_Hero_Command_2 takes nothing returns nothing
set gg_trg_Secret_Hero_Command_2 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(0), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(1), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(2), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(3), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(4), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(5), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(6), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(7), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(8), "The Grave Beckons", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_2, Player(9), "The Grave Beckons", true )
call TriggerAddAction( gg_trg_Secret_Hero_Command_2, function Trig_Secret_Hero_Command_2_Actions )
endfunction
function Trig_Secret_Hero_Command_4_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local rect r = gg_rct_SecretHero4
call CreateFogModifierRectBJ( true, p, FOG_OF_WAR_VISIBLE, r )
set udg_vpts = udg_vpts - 5
set p = null
set r = null
endfunction
//===========================================================================
function InitTrig_Secret_Hero_Command_4 takes nothing returns nothing
set gg_trg_Secret_Hero_Command_4 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(0), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(1), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(2), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(3), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(4), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(5), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(6), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(7), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(8), "Age of Tranquility", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_4, Player(9), "Age of Tranquility", true )
call TriggerAddAction( gg_trg_Secret_Hero_Command_4, function Trig_Secret_Hero_Command_4_Actions )
endfunction
function Trig_Secret_Hero_Command_5_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local rect r = gg_rct_SecretHero5
call CreateFogModifierRectBJ( true, p, FOG_OF_WAR_VISIBLE, r )
set p = null
set r = null
endfunction
//===========================================================================
function InitTrig_Secret_Hero_Command_5 takes nothing returns nothing
set gg_trg_Secret_Hero_Command_5 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(0), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(1), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(2), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(3), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(4), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(5), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(6), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(7), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(8), "Call of the Void", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Secret_Hero_Command_5, Player(9), "Call of the Void", true )
call TriggerAddAction( gg_trg_Secret_Hero_Command_5, function Trig_Secret_Hero_Command_5_Actions )
endfunction
function Trig_Camera_Lock_Command_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local integer i = GetConvertedPlayerId(p)
if udg_CameraLocked[i] then
call ResetToGameCameraForPlayer(p, 0)
call SetCameraFieldForPlayer(p, CAMERA_FIELD_TARGET_DISTANCE, 2250, 0)
set udg_CameraLocked[i] = false
else
call SetCameraTargetControllerNoZForPlayer(p, udg_Hero[i], 0, 0, false)
set udg_CameraLocked[i] = true
endif
set p = null
endfunction
//===========================================================================
function InitTrig_Camera_Lock_Command takes nothing returns nothing
set gg_trg_Camera_Lock_Command = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(0), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(1), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(2), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(3), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(4), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(5), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(6), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(7), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(8), "-l", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Camera_Lock_Command, Player(9), "-l", true )
call TriggerAddAction( gg_trg_Camera_Lock_Command, function Trig_Camera_Lock_Command_Actions )
endfunction
function Trig_Suicide_Command_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = udg_Hero[GetConvertedPlayerId(p)]
local rect r = gg_rct_Initial_Spawn
local location l = GetRectCenter(r)
call KillUnit( u )
call ReviveHeroLoc( u, l, false )
call PanCameraToTimedLocForPlayer( p, l, 1 )
call SelectUnitForPlayerSingle( u, p )
call DisplayTextToForce( bj_FORCE_ALL_PLAYERS, GetUnitName(u) + " has revived." )
call SetUnitLifePercentBJ( u, 1 )
call SetUnitManaPercentBJ( u, 0 )
set u = null
set p = null
call RemoveLocation(l)
set l = null
set r = null
endfunction
//===========================================================================
function InitTrig_Suicide_Command takes nothing returns nothing
set gg_trg_Suicide_Command = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(0), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(1), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(2), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(3), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(4), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(5), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(6), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(7), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(8), "-k", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Suicide_Command, Player(9), "-k", true )
call TriggerAddAction( gg_trg_Suicide_Command, function Trig_Suicide_Command_Actions )
endfunction
function Trig_Clear_Hero_Area_Remove takes nothing returns nothing
local unit u = GetEnumUnit()
call RemoveUnit(u)
set u = null
endfunction
function Trig_Clear_Hero_Area_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local group g = GetUnitsInRectAll(gg_rct_Entire_Hero_Selection_Area)
if GetTriggerExecCount(t) > 1 then
call ForGroupBJ( g, function Trig_Clear_Hero_Area_Remove )
else
call DisplayTextToForce( bj_FORCE_PLAYER[0], "TRIGSTR_5979" )
endif
set t = null
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Clear_Hero_Area takes nothing returns nothing
set gg_trg_Clear_Hero_Area = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Clear_Hero_Area, Player(0), "-a", true )
call TriggerAddAction( gg_trg_Clear_Hero_Area, function Trig_Clear_Hero_Area_Actions )
endfunction
function Trig_A_Actions takes nothing returns nothing
call StartSound(gg_snd_58271D)
call KillSoundWhenDone(gg_snd_58271D)
set udg_vpts = udg_vpts + 1
endfunction
//===========================================================================
function InitTrig_A takes nothing returns nothing
set gg_trg_A = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(0), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(1), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(2), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(3), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(4), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(5), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(6), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(7), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(8), "-omg", true )
call TriggerRegisterPlayerChatEvent( gg_trg_A, Player(9), "-omg", true )
call TriggerAddAction( gg_trg_A, function Trig_A_Actions )
endfunction
function Trig_Destroy_MAG_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local item i = LoadItemHandle(udg_mag, GetPlayerId(p), 0)
call RemoveItem(i)
set p = null
set i = null
endfunction
//===========================================================================
function InitTrig_Destroy_MAG takes nothing returns nothing
local integer a = 0
set gg_trg_Destroy_MAG = CreateTrigger( )
loop
exitwhen a > 9
call TriggerRegisterPlayerChatEvent( gg_trg_Destroy_MAG, Player(a), "-destroymag", true )
set a = a + 1
endloop
call TriggerAddAction( gg_trg_Destroy_MAG, function Trig_Destroy_MAG_Actions )
endfunction
function Trig_Spawn_Actions takes nothing returns nothing
local string array s
set s[0] = "Battlefield"
set s[1] = "Castle"
set s[2] = "Western Lane"
set s[3] = "Southwestern Lane"
set s[4] = "Southern Lane"
set udg_botspawn = udg_botspawn + 1
if udg_botspawn > 4 then
set udg_botspawn = 0
endif
call Message("Bot Spawn Point changed to the " + s[udg_botspawn] + ".", 5)
endfunction
//===========================================================================
function InitTrig_Spawn takes nothing returns nothing
set gg_trg_Spawn = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(0), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(1), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(2), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(3), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(4), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(5), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(6), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(7), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(8), "-s", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Spawn, Player(9), "-s", true )
call TriggerAddAction( gg_trg_Spawn, function Trig_Spawn_Actions )
endfunction
function Trig_Control_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
call Set_Computer_Controller(GetPlayerId(p))
call Message("Player " + I2S(GetPlayerId(p)+1) + " has been given control of the bots.", 5)
set p = null
endfunction
//===========================================================================
function InitTrig_Control takes nothing returns nothing
set gg_trg_Control = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(0), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(1), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(2), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(3), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(4), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(5), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(6), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(7), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(8), "-b", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Control, Player(9), "-b", true )
call TriggerAddAction( gg_trg_Control, function Trig_Control_Actions )
endfunction
function Trig_Define_Actions takes nothing returns nothing
local string a = GetEventPlayerChatString()
local integer id = S2I(SubString(a, 3, 4))-1
local player p = Player(id)
local string name = SubString(a, 5, StringLength(a))
local group g = CreateGroup()
local unit u
local unit e
local integer i = 0
local integer l = 0
local boolean b = false
if id == 0 and SubString(a, 3, 5) == "10" then
set id = 9
set name = SubString(a, 6, StringLength(a))
set p = Player(id)
endif
if id >= 0 and id < 10 then
call GroupEnumUnitsInRect(g, gg_rct_Entire_Hero_Selection_Area, Condition(function NullCondition))
set l = CountUnitsInGroup(g)
loop
exitwhen ((b == true) or (i > l))
set u = FirstOfGroup(g)
if GetUnitName(u) == name then
set e = u
set b = true
endif
call GroupRemoveUnit(g, u)
set i = i + 1
endloop
if e == null then
call Message("Could not find a hero class called: |cff00ffff" + name + "|r", 10)
elseif GetPlayerController(p) == MAP_CONTROL_COMPUTER then
set udg_LoadHero[id+1] = e
call Message("Player " + I2S(id+1) + " will be |cff00ffff" + GetUnitName(udg_LoadHero[id+1]) + "|r.", 10)
else
call Message("The |cff00ff00-d|r command cannot be used for human players.", 10)
endif
else
call Message("Player " + I2S(id+1) + " not found.", 10)
endif
call DestroyGroup(g)
set g = null
set u = null
set e = null
set p = null
endfunction
//===========================================================================
function InitTrig_Define takes nothing returns nothing
set gg_trg_Define = CreateTrigger()
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(0), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(1), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(2), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(3), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(4), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(5), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(6), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(7), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(8), "-d ", false)
call TriggerRegisterPlayerChatEvent(gg_trg_Define, Player(9), "-d ", false)
call TriggerAddAction( gg_trg_Define, function Trig_Define_Actions )
endfunction
function Trig_Attrition_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A07E'
endfunction
function Trig_Attrition_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetUnitLoc(u)
local group g = GetUnitsInRangeOfLocMatching(1000.00, l, Condition(function Enemy_Check))
local unit e
local integer level = GetUnitAbilityLevelSwapped('A07E', u)
local texttag t = CreateTextTagUnitBJ( "–" + I2S(udg_ven), u, 0, 12, 100, 20, 100, 0 )
call SetTextTagPermanentBJ( t, false )
call SetTextTagFadepointBJ( t, 1 )
call SetTextTagVelocityBJ( t, 64, 90 )
call SetTextTagLifespanBJ( t, 2 )
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g)
call UnitDamageTargetBJ( u, e, 0.75 * udg_ven * level, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
call GroupRemoveUnit(g, e)
endloop
call SetUnitLifePercentBJ( u, GetUnitStatePercent(u, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE) / 4 )
set udg_ven = 0
call RemoveLocation(l)
set l = null
set u = null
set e = null
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Attrition takes nothing returns nothing
set gg_trg_Attrition = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Attrition, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Attrition, Condition( function Trig_Attrition_Conditions ) )
call TriggerAddAction( gg_trg_Attrition, function Trig_Attrition_Actions )
endfunction
function Trig_Backstab_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A07C' )
endfunction
function Trig_Backstab_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit e = GetSpellTargetUnit()
local integer level = GetUnitAbilityLevelSwapped('A07C', u)
local location l = GetSpellTargetLoc()
local texttag t = CreateTextTagUnitBJ( "–" + I2S(udg_ven), u, 0, 12, 100, 20, 100, 0 )
call SetTextTagPermanentBJ( t, false )
call SetTextTagFadepointBJ( t, 1 )
call SetTextTagVelocityBJ( t, 64, 90 )
call SetTextTagLifespanBJ( t, 2 )
set t = null
call TriggerSleepAction(0.7)
call UnitDamageTargetBJ( u, e, 1 * udg_ven * level, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
call SetUnitPositionLoc( u, l )
call RemoveLocation(l)
set l = null
set u = null
set e = null
set udg_ven = 0
endfunction
//===========================================================================
function InitTrig_Backstab takes nothing returns nothing
set gg_trg_Backstab = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Backstab, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Backstab, Condition( function Trig_Backstab_Conditions ) )
call TriggerAddAction( gg_trg_Backstab, function Trig_Backstab_Actions )
endfunction
function Trig_Bear_Attack_Bonus_Conditions takes nothing returns boolean
local unit u = GetAttacker()
local boolean b = (GetUnitTypeId(u) == 'n01S' or GetUnitTypeId(u) == 'n01R')
set u = null
return b
endfunction
function Bear_Attack_Bonus_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit a = GetAttacker()
call UnitDamageTarget( a, u, GetHeroLevel(a) * 10, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
set u = null
set a = null
endfunction
//===========================================================================
function InitTrig_Bear_Attack_Bonus takes nothing returns nothing
set gg_trg_Bear_Attack_Bonus = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bear_Attack_Bonus, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Bear_Attack_Bonus, Condition( function Trig_Bear_Attack_Bonus_Conditions ) )
call TriggerAddAction( gg_trg_Bear_Attack_Bonus, function Bear_Attack_Bonus_Actions )
endfunction
function Charge_Ability_Check takes nothing returns boolean
return GetSpellAbilityId() == 'A07I'
endfunction
function Charge_Move takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, DistanceBetweenPoints(lu, lt) - d, AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Charge_Move_2 takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, DistanceBetweenPoints(lu, lt) + d, AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Charge_Pull takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_h, GetHandleId(t), 0)
local unit e = LoadUnitHandle(udg_h, GetHandleId(t), 1)
local integer level = GetUnitAbilityLevel(u, 'A07I')
local location lu = GetUnitLoc(u)
local location le = GetUnitLoc(e)
local group g
local unit ge
call SaveInteger(udg_h, GetHandleId(t), 2, LoadInteger(udg_h, GetHandleId(t), 2) + 1)
if LoadInteger(udg_h, GetHandleId(t), 2) < 30 and DistanceBetweenPoints(lu, le) > 150 and GetUnitState(e, UNIT_STATE_LIFE) > 0.405 and GetUnitState(u, UNIT_STATE_LIFE) > 0.405 then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", e, "origin"))
call Charge_Move(e, u, 60)
set g = GetUnitsInRangeOfLocMatching(170, lu, Condition(function Enemy_Check))
loop
exitwhen CountUnitsInGroup(g) <= 0
set ge = FirstOfGroup(g)
if ge == e then
call GroupRemoveUnit(g, e)
call UnitDamageTarget(u, ge, 5 * level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_METAL_HEAVY_BASH)
call Charge_Move_2(u, ge, 25)
else
call Charge_Move_2(u, ge, 50)
call UnitDamageTarget(u, ge, 15 * level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_METAL_HEAVY_BASH)
call GroupRemoveUnit(g, ge)
endif
endloop
else
if GetUnitState(e, UNIT_STATE_LIFE) > 0.405 and GetUnitState(u, UNIT_STATE_LIFE) > 0.405 then
call UnitDamageTargetBJ(u, e, 100 + 125 * (level - 1), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)
endif
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_h, GetHandleId(t))
set t = null
set u = null
set e = null
endif
call RemoveLocation(lu)
call RemoveLocation(le)
set lu = null
set le = null
call DestroyGroup(g)
set g = null
set ge = null
set t = null
endfunction
function Charge_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit e = GetSpellTargetUnit()
local integer level = GetUnitAbilityLevel(u, 'A07I')
call SaveUnitHandle( udg_h, GetHandleId(t), 0, u )
call SaveUnitHandle( udg_h, GetHandleId(t), 1, e )
call SaveInteger( udg_h, GetHandleId(t), 2, 0)
call TimerStart(t, 0.05, true, function Charge_Pull)
set u = null
set e = null
set t = null
endfunction
function InitTrig_Charge takes nothing returns nothing
set gg_trg_Charge = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Charge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Charge, Condition( function Charge_Ability_Check ) )
call TriggerAddAction( gg_trg_Charge, function Charge_Actions )
endfunction
function Trig_Consume_Blight_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0DN' )
endfunction
function Trig_Consume_Blight_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
if IsPointBlighted(GetUnitX(u), GetUnitY(u)) == true then
call SetUnitLifePercentBJ(u, GetUnitStatePercent(u, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE) + 3.5 + 7.0 * GetUnitAbilityLevel(u, 'A0DN'))
else
call SetUnitLifePercentBJ(u, GetUnitStatePercent(u, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE) + 3.5 * GetUnitAbilityLevel(u, 'A0DN'))
endif
set u = null
endfunction
//===========================================================================
function InitTrig_Consume_Blight takes nothing returns nothing
set gg_trg_Consume_Blight = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Consume_Blight, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Consume_Blight, Condition( function Trig_Consume_Blight_Conditions ) )
call TriggerAddAction( gg_trg_Consume_Blight, function Trig_Consume_Blight_Actions )
endfunction
function Trig_Conjure_Blight_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0DM' )
endfunction
function Trig_Conjure_Blight_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
call SetBlight(p, GetSpellTargetX(), GetSpellTargetY(), 250, true)
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Conjure_Blight takes nothing returns nothing
set gg_trg_Conjure_Blight = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Conjure_Blight, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Conjure_Blight, Condition( function Trig_Conjure_Blight_Conditions ) )
call TriggerAddAction( gg_trg_Conjure_Blight, function Trig_Conjure_Blight_Actions )
endfunction
function Crimson_Ability_Check takes nothing returns boolean
return GetSpellAbilityId() == 'A00Y'
endfunction
function Crimson_Move takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, DistanceBetweenPoints(lu, lt) - d, AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Crimson_Move_2 takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, DistanceBetweenPoints(lu, lt) + d, AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Crimson_Pull takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_h, GetHandleId(t), 0)
local unit e = LoadUnitHandle(udg_h, GetHandleId(t), 1)
local integer level = GetUnitAbilityLevel(u, 'A00Y')
local location lu = GetUnitLoc(u)
local location le = GetUnitLoc(e)
local group g
local unit ge
call SaveInteger(udg_h, GetHandleId(t), 2, LoadInteger(udg_h, GetHandleId(t), 2) + 1)
if LoadInteger(udg_h, GetHandleId(t), 2) < 30 and DistanceBetweenPoints(lu, le) > 150 and GetUnitState(e, UNIT_STATE_LIFE) > 0.405 and GetUnitState(u, UNIT_STATE_LIFE) > 0.405 then
set g = GetUnitsInRangeOfLocMatching(170, lu, Condition(function Enemy_Check))
if GetRandomInt(0, 5) == 1 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", u, "origin"))
endif
call Crimson_Move(e, u, 60)
loop
exitwhen CountUnitsInGroup(g) <= 0
set ge = FirstOfGroup(g)
if ge == e then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl", e, "origin"))
call GroupRemoveUnit(g, e)
else
call Crimson_Move_2(u, ge, 50)
call UnitDamageTarget(u, ge, 200 * level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_METAL_LIGHT_SLICE)
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl", ge, "origin"))
call GroupRemoveUnit(g, ge)
endif
endloop
else
if GetUnitState(e, UNIT_STATE_LIFE) > 0.405 and GetUnitState(u, UNIT_STATE_LIFE) > 0.405 then
call UnitDamageTarget(u, e, LoadInteger(udg_h, GetHandleId(t), 2) * 20 + 500 * level, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_METAL_LIGHT_SLICE)
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl", ge, "origin"))
endif
call SetUnitVertexColor(u, 255, 255, 255, 255)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_h, GetHandleId(t))
set t = null
set u = null
set e = null
endif
call RemoveLocation(lu)
call RemoveLocation(le)
set lu = null
set le = null
call DestroyGroup(g)
set g = null
set ge = null
set t = null
endfunction
function Crimson_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit e = GetSpellTargetUnit()
local integer level = GetUnitAbilityLevel(u, 'A00Y')
call SetUnitVertexColor(u, 255, 127, 127, 127)
call SaveUnitHandle( udg_h, GetHandleId(t), 0, u )
call SaveUnitHandle( udg_h, GetHandleId(t), 1, e )
call TimerStart(t, 0.05, true, function Crimson_Pull)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", u, "origin"))
set t = null
set u = null
set e = null
endfunction
function InitTrig_Crimson takes nothing returns nothing
set gg_trg_Crimson = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Crimson, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Crimson, Condition( function Crimson_Ability_Check ) )
call TriggerAddAction( gg_trg_Crimson, function Crimson_Actions )
endfunction
function Crushing_Blade_Ability_Check takes nothing returns boolean
return GetSpellAbilityId() == 'A054' or GetSpellAbilityId() == 'A0B0'
endfunction
function Crushing_Blade_Enemy_Check takes nothing returns boolean
local unit u = GetFilterUnit()
local player p = GetOwningPlayer(u)
local player p11 = Player(11)
local player pna = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local boolean b = IsUnitAliveBJ(u) and (p == p11 or p == pna)
set u = null
set p = null
set p11 = null
set pna = null
return b
endfunction
function Crushing_Blade_Move takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, d + DistanceBetweenPoints(lu, lt), AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Crushing_Blade_Knockback takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = LoadInteger( udg_h, GetHandleId(t), 'i' )
local unit u = LoadUnitHandle( udg_h, GetHandleId(t), 'u' )
local location l = GetUnitLoc(u)
local group g = GetUnitsInRangeOfLocMatching(400 + 25 * GetUnitAbilityLevel(u, 'A054'), l, Condition(function Crushing_Blade_Enemy_Check))
local integer a = 1
local integer aa = CountUnitsInGroup( g )
local integer level = GetUnitAbilityLevel(u, 'A054')
local unit e
if level <= 0 then
set level = GetUnitAbilityLevel(u, 'A0B0')
endif
if i < 15 then
loop
exitwhen a > aa
set e = FirstOfGroup( g )
call Crushing_Blade_Move( u, e, 30 )
if i == 1 then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", e, "origin"))
endif
call UnitDamageTarget( u, e, 11 + 11 * level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_METAL_HEAVY_BASH )
call GroupRemoveUnit( g, e )
set a = a + 1
endloop
set i = i + 1
call SaveInteger( udg_h, GetHandleId(t), 'i', i )
else
call FlushChildHashtable(udg_h, GetHandleId(t))
call DestroyGroup(g)
call PauseTimer(t)
call DestroyTimer(t)
endif
call RemoveLocation(l)
set l = null
set e = null
set g = null
set t = null
set u = null
endfunction
function Crushing_Blade_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local integer i = 1
call SaveUnitHandle( udg_h, GetHandleId(t), 'u', u )
call SaveInteger( udg_h, GetHandleId(t), 'i', i )
call TimerStart(t, 0.04, true, function Crushing_Blade_Knockback)
set u = null
set t = null
endfunction
function InitTrig_Crushing_Blade takes nothing returns nothing
set gg_trg_Crushing_Blade = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Crushing_Blade, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Crushing_Blade, Condition( function Crushing_Blade_Ability_Check ) )
call TriggerAddAction( gg_trg_Crushing_Blade, function Crushing_Blade_Actions )
endfunction
function Trig_Death_Nova_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A01K' )
endfunction
function Trig_Death_Nova_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call UnitDamageTargetBJ(u, u, -100 * GetUnitAbilityLevelSwapped('A01K', u), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN)
set u = null
endfunction
//===========================================================================
function InitTrig_Death_Nova takes nothing returns nothing
set gg_trg_Death_Nova = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Death_Nova, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Death_Nova, Condition( function Trig_Death_Nova_Conditions ) )
call TriggerAddAction( gg_trg_Death_Nova, function Trig_Death_Nova_Actions )
endfunction
function Demon_Boost_Ability_Check takes nothing returns boolean
return GetSpellAbilityId() == 'A0E8'
endfunction
function Demon_Boost_Move takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, DistanceBetweenPoints(lu, lt) - d, AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Demon_Boost_Move_2 takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, DistanceBetweenPoints(lu, lt) + d, AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Demon_Boost_Pull takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_h, GetHandleId(t), 0)
local unit e = LoadUnitHandle(udg_h, GetHandleId(t), 1)
local integer level = GetUnitAbilityLevel(u, 'A0E8')
local group g
local unit ge
local location l = GetUnitLoc(u)
local location le = GetUnitLoc(e)
if GetRandomInt(0, 3) == 1 then
call SetUnitAnimation(u, "attack")
endif
call SaveInteger(udg_h, GetHandleId(t), 2, LoadInteger(udg_h, GetHandleId(t), 2) + 1)
if LoadInteger(udg_h, GetHandleId(t), 2) < 40 and GetUnitState(e, UNIT_STATE_LIFE) > 0.405 and GetUnitState(u, UNIT_STATE_LIFE) > 0.405 then
set g = GetUnitsInRangeOfLocMatching(150, l, Condition(function Enemy_Check))
if DistanceBetweenPoints(l, le) > 90 then
call Demon_Boost_Move(e, u, 60)
endif
loop
exitwhen CountUnitsInGroup(g) <= 0
set ge = FirstOfGroup(g)
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl", ge, "origin"))
call UnitDamageTarget(u, ge, GetRandomInt(2, 8) * level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_METAL_LIGHT_SLICE)
call GroupRemoveUnit(g, ge)
if ge != e and DistanceBetweenPoints(l, le) > 90 then
call Demon_Boost_Move_2(u, ge, 76)
endif
endloop
else
call SetUnitTimeScale(u, 1)
call SetUnitVertexColor(u, 255, 255, 255, 255)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_h, GetHandleId(t))
set t = null
set u = null
set e = null
endif
call RemoveLocation(l)
set l = null
call RemoveLocation(le)
set le = null
call DestroyGroup(g)
set g = null
set ge = null
set t = null
endfunction
function Demon_Boost_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit e = GetSpellTargetUnit()
call SetUnitTimeScale(u, 15)
call SetUnitVertexColor(u, 127, 127, 127, 127)
call SaveUnitHandle(udg_h, GetHandleId(t), 0, u)
call SaveUnitHandle(udg_h, GetHandleId(t), 1, e)
call TimerStart(t, 0.05, true, function Demon_Boost_Pull)
set t = null
set u = null
set e = null
endfunction
//===========================================================================
function InitTrig_Demon_Boost takes nothing returns nothing
set gg_trg_Demon_Boost = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Demon_Boost, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Demon_Boost, Condition( function Demon_Boost_Ability_Check ) )
call TriggerAddAction( gg_trg_Demon_Boost, function Demon_Boost_Actions )
endfunction
function Trig_Divine_Intervention_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A04K' )
endfunction
function Trig_Divine_Intervention_Actions takes nothing returns nothing
local integer i = 1
local unit u = GetTriggerUnit()
local player p
local player po
local player pl = GetLocalPlayer()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
loop
exitwhen i > 10
set p = ConvertedPlayer(i)
if udg_Hero[i] != null then
if udg_Hero[i] != u and IsUnitAliveBJ(udg_Hero[i]) == false then
call ReviveHero(udg_Hero[i], x, y, true)
call SelectUnitForPlayerSingle(udg_Hero[i], p)
set po = GetOwningPlayer(udg_Hero[i])
if pl == po then
call PanCameraToTimed(x, y, 0)
endif
call SetUnitLifePercentBJ(udg_Hero[i], 100)
elseif udg_Hero[i] != null and udg_Hero[i] == u then
call SetUnitLifePercentBJ(udg_Hero[i], 100)
endif
endif
set i = i + 1
endloop
set u = null
set p = null
set pl = null
set po = null
endfunction
//===========================================================================
function InitTrig_Divine_Intervention takes nothing returns nothing
set gg_trg_Divine_Intervention = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Divine_Intervention, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Divine_Intervention, Condition( function Trig_Divine_Intervention_Conditions ) )
call TriggerAddAction( gg_trg_Divine_Intervention, function Trig_Divine_Intervention_Actions )
endfunction
function Trig_Earth_Nova_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A006')
endfunction
function Trig_Earth_Nova_Actions takes nothing returns nothing
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local destructable d = CreateDestructable('LTrc', x, y, 270, 1, 0)
set d = null
endfunction
//===========================================================================
function InitTrig_Earth_Nova takes nothing returns nothing
set gg_trg_Earth_Nova = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Earth_Nova, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Earth_Nova, Condition( function Trig_Earth_Nova_Conditions ) )
call TriggerAddAction( gg_trg_Earth_Nova, function Trig_Earth_Nova_Actions )
endfunction
function Trig_Eat_Tree_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0BM' )
endfunction
function Trig_Eat_Tree_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer l = GetUnitAbilityLevelSwapped('A0BM', u)
local real formula = GetUnitLifePercent(u) + 60 + 8 * l
if (formula > 100) then
set formula = 100
endif
if (udg_mgscale < 1.5) then
set udg_mgscale = udg_mgscale + 0.25
endif
call SetUnitLifePercentBJ(u, formula)
call SetUnitManaPercentBJ(u, 100)
call SetUnitScale(u, udg_mgscale, 0, 0)
if GetRandomInt(1, (6 - l)) == 1 then
call SetHeroStr(u, GetHeroStr(u, false), true)
endif
set u = null
endfunction
//===========================================================================
function InitTrig_Eat_Tree takes nothing returns nothing
set gg_trg_Eat_Tree = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Eat_Tree, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Eat_Tree, Condition( function Trig_Eat_Tree_Conditions ) )
call TriggerAddAction( gg_trg_Eat_Tree, function Trig_Eat_Tree_Actions )
endfunction
function Fel_Grapple_Ability_Check takes nothing returns boolean
return GetSpellAbilityId() == 'A055'
endfunction
function Fel_Grapple_Move takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc(t, PolarProjectionBJ(lu, DistanceBetweenPoints(lu, lt) - d, AngleBetweenPoints(lu, lt)))
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Fel_Grapple_Pull takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_h, GetHandleId(t), 'u')
local unit e = LoadUnitHandle(udg_h, GetHandleId(t), 'e')
local integer level = GetUnitAbilityLevel(u, 'A055')
if GetUnitState(e, UNIT_STATE_LIFE) > .405 and GetUnitState(u, UNIT_STATE_LIFE) > .405 then
if GetRandomInt(1, 10) == 5 then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", e, "origin"))
endif
call Fel_Grapple_Move(u, e, 35)
call UnitDamageTarget( u, e, 2 * level, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
endif
set t = null
set u = null
set e = null
endfunction
function Fel_Grapple_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit e = GetSpellTargetUnit()
call SetUnitVertexColor(e, 255, 255, 255, 127)
call SaveUnitHandle(udg_h, GetHandleId(t), 'u', u)
call SaveUnitHandle(udg_h, GetHandleId(t), 'e', e)
call TimerStart(t, 0.04, true, function Fel_Grapple_Pull)
call TriggerSleepAction(8)
call FlushChildHashtable(udg_h, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
call SetUnitVertexColor(e, 255, 255, 255, 255)
set t = null
set u = null
set e = null
endfunction
function InitTrig_Fel_Grapple takes nothing returns nothing
set gg_trg_Fel_Grapple = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Fel_Grapple, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Fel_Grapple, Condition(function Fel_Grapple_Ability_Check))
call TriggerAddAction(gg_trg_Fel_Grapple, function Fel_Grapple_Actions)
endfunction
function Trig_Forgotten_Power_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A06X' )
endfunction
function Trig_Forgotten_Power_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitManaPercentBJ(u, 100)
call UnitResetCooldown(u)
set u = null
endfunction
//===========================================================================
function InitTrig_Forgotten_Power takes nothing returns nothing
set gg_trg_Forgotten_Power = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Forgotten_Power, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Forgotten_Power, Condition( function Trig_Forgotten_Power_Conditions ) )
call TriggerAddAction( gg_trg_Forgotten_Power, function Trig_Forgotten_Power_Actions )
endfunction
function Trig_Full_Moon_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A002' )
endfunction
function Trig_Full_Moon_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitManaPercentBJ(u, 100)
call SetUnitLifePercentBJ(u, 100)
set u = null
endfunction
//===========================================================================
function InitTrig_Full_Moon takes nothing returns nothing
set gg_trg_Full_Moon = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Full_Moon, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Full_Moon, Condition( function Trig_Full_Moon_Conditions ) )
call TriggerAddAction( gg_trg_Full_Moon, function Trig_Full_Moon_Actions )
endfunction
function Trig_Ghost_Storm_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A02J'
endfunction
function Trig_Ghost_Storm_Actions takes nothing returns nothing
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local location l = GetSpellTargetLoc()
local unit u = GetTriggerUnit()
local unit e
local player p = GetTriggerPlayer()
local group g = GetUnitsInRangeOfLocMatching(512, l, Condition(function Enemy_Check))
local group f = GetUnitsOfPlayerAndTypeId(p, 'o009')
local integer count = CountLivingPlayerUnitsOfTypeId('o009', p)
local integer level = GetUnitAbilityLevelSwapped('A02J', u)
call GroupPointOrder(f, "clusterrockets", x, y)
call TriggerSleepAction(1)
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g) //count * 125 + level * 25
call UnitDamageTargetBJ(u, e, count * 125 * level, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
call GroupRemoveUnit(g, e)
endloop
call RemoveLocation(l)
set l = null
set u = null
set e = null
set p = null
call DestroyGroup(g)
set g = null
call DestroyGroup(f)
set f = null
endfunction
//===========================================================================
function InitTrig_Ghost_Storm takes nothing returns nothing
set gg_trg_Ghost_Storm = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ghost_Storm, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Ghost_Storm, Condition( function Trig_Ghost_Storm_Conditions ) )
call TriggerAddAction( gg_trg_Ghost_Storm, function Trig_Ghost_Storm_Actions )
endfunction
function Trig_Golem_Control_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (GetUnitTypeId(u) == 'n028' or GetUnitTypeId(u) == 'n02A' or GetUnitTypeId(u) == 'n029')
set u = null
return b
endfunction
function Trig_Golem_Control_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call UnitApplyTimedLifeBJ( 50, 'BTLF', u )
set u = null
endfunction
//===========================================================================
function InitTrig_Golem_Control takes nothing returns nothing
set gg_trg_Golem_Control = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Golem_Control, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_Golem_Control, Condition( function Trig_Golem_Control_Conditions ) )
call TriggerAddAction( gg_trg_Golem_Control, function Trig_Golem_Control_Actions )
endfunction
function Trig_Tornado_Nerf_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (GetUnitTypeId(u) == 'ntor')
set u = null
return b
endfunction
function Trig_Tornado_Nerf_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call UnitApplyTimedLifeBJ( 10, 'BTLF', u )
set u = null
endfunction
//===========================================================================
function InitTrig_Tornado_Nerf takes nothing returns nothing
set gg_trg_Tornado_Nerf = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Tornado_Nerf, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_Tornado_Nerf, Condition( function Trig_Tornado_Nerf_Conditions ) )
call TriggerAddAction( gg_trg_Tornado_Nerf, function Trig_Tornado_Nerf_Actions )
endfunction
function Trig_Hatsuendan_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0C5'
endfunction
function Trig_Hatsuendan_Actions takes nothing returns nothing
local unit t = GetTriggerUnit()
local real x = GetUnitX(t)
local real y = GetUnitY(t)
local player p = GetTriggerPlayer()
local unit u = CreateUnit(p, 'n02S', x, y, 270)
call UnitApplyTimedLifeBJ( 8, 'BTLF', u )
set u = null
set t = null
set p = null
endfunction
//===========================================================================
function InitTrig_Hatsuendan takes nothing returns nothing
set gg_trg_Hatsuendan = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hatsuendan, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Hatsuendan, Condition( function Trig_Hatsuendan_Conditions ) )
call TriggerAddAction( gg_trg_Hatsuendan, function Trig_Hatsuendan_Actions )
endfunction
function Trig_Headshot_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A01D')
endfunction
function Trig_Headshot_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local texttag t = CreateTextTagUnitBJ("HEADSHOT!", u, 0, 14, 100, 0, 0, 10)
call SetTextTagPermanentBJ(t, false)
call SetTextTagFadepointBJ(t, 2)
call SetTextTagVelocityBJ(t, 64, 90)
call SetTextTagLifespanBJ(t, 3)
set t = null
set u = null
endfunction
//===========================================================================
function InitTrig_Headshot takes nothing returns nothing
set gg_trg_Headshot = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Headshot, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Headshot, Condition( function Trig_Headshot_Conditions ) )
call TriggerAddAction( gg_trg_Headshot, function Trig_Headshot_Actions )
endfunction
function Trig_Howl_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A003'
endfunction
function Trig_Howl_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location c = GetUnitLoc(u)
local unit e
local integer level = GetUnitAbilityLevel(u, 'A003')
local group g = GetUnitsInRangeOfLocMatching(350 + 50 * level, c, Condition(function Enemy_Check))
local integer a = 1
local integer b = CountUnitsInGroup(g)
loop
exitwhen a > b
set e = FirstOfGroup(g)
if (GetTimeOfDay() >= 18) or (GetTimeOfDay() <= 6) then
call SetUnitManaPercentBJ(e, 0)
endif
call GroupRemoveUnit(g, e)
set a = a + 1
endloop
set u = null
call RemoveLocation(c)
set c = null
set e = null
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Howl takes nothing returns nothing
set gg_trg_Howl = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Howl, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Howl, Condition( function Trig_Howl_Conditions ) )
call TriggerAddAction( gg_trg_Howl, function Trig_Howl_Actions )
endfunction
function Implode_Ability_Check takes nothing returns boolean
return GetSpellAbilityId() == 'A057'
endfunction
function Implode_Move takes location u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location l = PolarProjectionBJ( u, DistanceBetweenPoints(u, lt) - d, AngleBetweenPoints( u, lt ) )
call SetUnitPositionLoc( t, l )
call RemoveLocation(lt)
call RemoveLocation(l)
set lt = null
set l = null
endfunction
function Implode_Knockback takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = LoadInteger( udg_h, GetHandleId(t), 'i' )
local unit u = LoadUnitHandle( udg_h, GetHandleId(t), 'u' )
local location c = LoadLocationHandle( udg_h, GetHandleId(t), 'c' )
local group g = GetUnitsInRangeOfLocMatching(325 + 25 * GetUnitAbilityLevel(u, 'A057'), c, Condition(function Enemy_Check))
local integer a = 1
local integer aa = CountUnitsInGroup( g )
local integer level = GetUnitAbilityLevel(u, 'A057')
local unit e
set i = i + 1
call SaveInteger( udg_h, GetHandleId(t), 'i', i )
if (i < 20) and (i > 0) then
loop
exitwhen a > aa
set e = FirstOfGroup( g )
call Implode_Move( c, e, 60 )
if i == 1 then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", e, "origin"))
endif
call UnitDamageTarget( u, e, level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_METAL_HEAVY_BASH )
call GroupRemoveUnit( g, e )
set a = a + 1
endloop
else
call FlushChildHashtable( udg_h, GetHandleId(t) )
call DestroyGroup( g )
call PauseTimer( t )
call DestroyTimer( t )
call RemoveLocation( c )
set i = 1
endif
set e = null
set u = null
set t = null
set g = null
set c = null
endfunction
function Implode_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
call SaveUnitHandle( udg_h, GetHandleId(t), 'u', u )
call SaveLocationHandle( udg_h, GetHandleId(t), 'c', l )
call SaveInteger( udg_h, GetHandleId(t), 'i', 1 )
call TimerStart(t, 0.05, true, function Implode_Knockback)
set t = null
set u = null
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
function InitTrig_Implode takes nothing returns nothing
set gg_trg_Implode = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Implode, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Implode, Condition( function Implode_Ability_Check ) )
call TriggerAddAction( gg_trg_Implode, function Implode_Actions )
endfunction
function Trig_INFINITE_POWAH_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A02Y' )
endfunction
function Trig_INFINITE_POWAH_Actions takes nothing returns nothing
local integer a = 1
local integer b = 1
local unit u = GetTriggerUnit()
local texttag t
loop
exitwhen a > 10
set b = 1
loop
exitwhen b > 10
if ( udg_Hero[b] != u ) then
call SetUnitManaPercentBJ( udg_Hero[b], 100 )
call UnitResetCooldown( udg_Hero[b] )
endif
set t = CreateTextTagUnitBJ( "INFINITE POWER!", udg_Hero[b], -10, 10, 0, 0, 100, 0 )
call SetTextTagPermanentBJ( t, false )
call SetTextTagFadepointBJ( t, 2 )
call SetTextTagVelocityBJ( t, 15, GetRandomDirectionDeg() )
call SetTextTagLifespanBJ( t, 3 )
set b = b + 1
endloop
call TriggerSleepAction( 1.5 )
set a = a + 1
endloop
set u = null
set t = null
endfunction
//===========================================================================
function InitTrig_INFINITE_POWAH takes nothing returns nothing
set gg_trg_INFINITE_POWAH = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_INFINITE_POWAH, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_INFINITE_POWAH, Condition( function Trig_INFINITE_POWAH_Conditions ) )
call TriggerAddAction( gg_trg_INFINITE_POWAH, function Trig_INFINITE_POWAH_Actions )
endfunction
function Trig_INFINITE_POWAH_kill_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A02Y'
endfunction
function Trig_INFINITE_POWAH_kill_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call KillUnit(u)
set u = null
endfunction
//===========================================================================
function InitTrig_INFINITE_POWAH_kill takes nothing returns nothing
set gg_trg_INFINITE_POWAH_kill = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_INFINITE_POWAH_kill, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( gg_trg_INFINITE_POWAH_kill, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_INFINITE_POWAH_kill, Condition( function Trig_INFINITE_POWAH_kill_Conditions ) )
call TriggerAddAction( gg_trg_INFINITE_POWAH_kill, function Trig_INFINITE_POWAH_kill_Actions )
endfunction
function Trig_Kunaidesu_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0C8' )
endfunction
function Trig_Kunaidesu_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit e = GetSpellTargetUnit()
local location l = GetSpellTargetLoc()
call TriggerSleepAction(1)
call SetUnitPositionLoc(u, l)
call RemoveLocation(l)
set l = null
set u = null
set e = null
endfunction
//===========================================================================
function InitTrig_Kunaidesu takes nothing returns nothing
set gg_trg_Kunaidesu = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Kunaidesu, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Kunaidesu, Condition( function Trig_Kunaidesu_Conditions ) )
call TriggerAddAction( gg_trg_Kunaidesu, function Trig_Kunaidesu_Actions )
endfunction
function Trig_Knockback_Conditions takes nothing returns boolean
local unit u = GetAttacker()
local unit t = GetTriggerUnit()
local integer i = GetUnitTypeId(u)
local boolean b = (i=='n00W' or i=='n00X' or i=='n00Y' or i=='n00Z' or i=='n010' or i=='n015' or i=='n014' or i=='n013' or i=='n012' or i=='n011' ) and GetRandomInt(1, 10)==5 and IsUnitType(t, UNIT_TYPE_HERO)
set u = null
set t = null
return b
endfunction
function Knockback_Move takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, d + DistanceBetweenPoints( lu, lt ), AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Knockback_Knockback takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle( udg_h, GetHandleId(t), 'u' )
local unit e = LoadUnitHandle( udg_h, GetHandleId(t), 'e' )
if GetRandomInt(1, 10) == 5 then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", e, "origin"))
endif
call Knockback_Move(u, e, 10)
call UnitDamageTarget( u, e, 5, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
set t = null
set u = null
set e = null
endfunction
function Knockback_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetAttacker()
local unit e = GetTriggerUnit()
call SetUnitVertexColor(e, 255, 255, 255, 127)
call SaveUnitHandle( udg_h, GetHandleId(t), 'u', u )
call SaveUnitHandle( udg_h, GetHandleId(t), 'e', e )
call TimerStart(t, 0.04, true, function Knockback_Knockback)
call TriggerSleepAction(.5)
call FlushChildHashtable( udg_h, GetHandleId(t) )
call PauseTimer(t)
call DestroyTimer(t)
call SetUnitVertexColor(e, 255, 255, 255, 255)
set u = null
set e = null
set t = null
endfunction
//===========================================================================
function InitTrig_Knockback takes nothing returns nothing
set gg_trg_Knockback = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Knockback, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Knockback, Condition( function Trig_Knockback_Conditions ) )
call TriggerAddAction( gg_trg_Knockback, function Knockback_Actions )
endfunction
function Launching_Strike_Ability_Check takes nothing returns boolean
return GetSpellAbilityId() == 'A056'
endfunction
function Launching_Strike_Enemy_Check takes nothing returns boolean
local unit u = GetFilterUnit()
local player p = GetOwningPlayer(u)
local player p11 = Player(11)
local player pna = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local boolean b = (IsUnitAliveBJ(u)) and (p == p11 or p == pna) and GetUnitTypeId(u) != 'h01H'
set u = null
set p = null
set p11 = null
set pna = null
return b
endfunction
function Launching_Strike_Move takes unit u, unit t, real d returns nothing
local location lt = GetUnitLoc(t)
local location lu = GetUnitLoc(u)
call SetUnitPositionLoc( t, PolarProjectionBJ( lu, d + DistanceBetweenPoints(lu, lt), AngleBetweenPoints( lu, lt ) ) )
call RemoveLocation(lt)
call RemoveLocation(lu)
set lt = null
set lu = null
endfunction
function Launching_Strike_Knockback takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle( udg_h, GetHandleId(t), 'u' )
local unit e = LoadUnitHandle( udg_h, GetHandleId(t), 'e' )
local integer level = GetUnitAbilityLevel(u, 'A056')
local group g = GetUnitsInRangeOfLocMatching(150, GetUnitLoc(e), Condition(function Launching_Strike_Enemy_Check))
local integer b = CountUnitsInGroup(g)
local integer a = 1
local unit n
call GroupRemoveUnit(g, e)
loop
exitwhen a > b
set n = FirstOfGroup(g)
if GetUnitState(e, UNIT_STATE_LIFE) > .405 then
call Launching_Strike_Move(e, n, 50)
call UnitDamageTarget( u, n, 75 * level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
endif
call GroupRemoveUnit(g, n)
set a = a + 1
endloop
call DestroyGroup(g)
set g = null
set n = null
if GetRandomInt(1, 10) == 5 then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", e, "origin"))
endif
if GetUnitState(e, UNIT_STATE_LIFE) > .405 then
call Launching_Strike_Move(u, e, 35)
call UnitDamageTarget(u, e, 3 * level, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
endif
set t = null
set u = null
set e = null
endfunction
function Launching_Strike_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit e = GetSpellTargetUnit()
call SetUnitVertexColor(e, 255, 255, 255, 127)
call SaveUnitHandle( udg_h, GetHandleId(t), 'u', u )
call SaveUnitHandle( udg_h, GetHandleId(t), 'e', e )
call TimerStart(t, 0.04, true, function Launching_Strike_Knockback)
call TriggerSleepAction(1)
call FlushChildHashtable(udg_h, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
call SetUnitVertexColor(e, 255, 255, 255, 255)
set t = null
set u = null
set e = null
endfunction
function InitTrig_Launching_Strike takes nothing returns nothing
set gg_trg_Launching_Strike = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Launching_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Launching_Strike, Condition( function Launching_Strike_Ability_Check ) )
call TriggerAddAction( gg_trg_Launching_Strike, function Launching_Strike_Actions )
call Preload("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl")
endfunction
function Trig_Lightning_Burst_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A00F' )
endfunction
function Trig_Lightning_Burst_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitLifePercentBJ( u, 50 )
set u = null
endfunction
//===========================================================================
function InitTrig_Lightning_Burst takes nothing returns nothing
set gg_trg_Lightning_Burst = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Burst, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Lightning_Burst, Condition( function Trig_Lightning_Burst_Conditions ) )
call TriggerAddAction( gg_trg_Lightning_Burst, function Trig_Lightning_Burst_Actions )
endfunction
function Trig_Lightning_Sword_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A016' )
endfunction
function Trig_Lightning_Sword_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitMoveSpeed( u, ( 1.75 * GetUnitMoveSpeed(u) ) )
call TriggerSleepAction( 18 )
call SetUnitMoveSpeed( u, GetUnitDefaultMoveSpeed(u) )
set u = null
endfunction
//===========================================================================
function InitTrig_Lightning_Sword takes nothing returns nothing
set gg_trg_Lightning_Sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Sword, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Lightning_Sword, Condition( function Trig_Lightning_Sword_Conditions ) )
call TriggerAddAction( gg_trg_Lightning_Sword, function Trig_Lightning_Sword_Actions )
endfunction
function Trig_Mana_Burst_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A00G' )
endfunction
function Trig_Mana_Burst_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
call SetUnitMoveSpeed( u, ( .25 * GetUnitMoveSpeed(u) ) )
set u = null
endfunction
//===========================================================================
function InitTrig_Mana_Burst takes nothing returns nothing
set gg_trg_Mana_Burst = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mana_Burst, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Mana_Burst, Condition( function Trig_Mana_Burst_Conditions ) )
call TriggerAddAction( gg_trg_Mana_Burst, function Trig_Mana_Burst_Actions )
endfunction
function Trig_Metamorphosis_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A000' )
endfunction
function Trig_Metamorphosis_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
call DestroyEffect(AddSpecialEffect("WorgenCurse.mdx", x, y))
set u = null
endfunction
//===========================================================================
function InitTrig_Metamorphosis takes nothing returns nothing
set gg_trg_Metamorphosis = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Metamorphosis, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Metamorphosis, Condition( function Trig_Metamorphosis_Conditions ) )
call TriggerAddAction( gg_trg_Metamorphosis, function Trig_Metamorphosis_Actions )
endfunction
function Trig_Meteor_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A09A' )
endfunction
function Trig_Meteor_Actions takes nothing returns nothing
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local player p = GetTriggerPlayer()
local unit u
//call TriggerSleepAction(1)
set u = CreateUnit(p, 'n03E', x, y, 0)
call TriggerSleepAction(2)
call KillUnit(u)
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Meteor takes nothing returns nothing
set gg_trg_Meteor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Meteor, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Meteor, Condition( function Trig_Meteor_Conditions ) )
call TriggerAddAction( gg_trg_Meteor, function Trig_Meteor_Actions )
endfunction
function Trig_Nightmare_Annihilation_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A05L'
endfunction
function Trig_Nightmare_Annihilation_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(u, 'A05L')
local integer a = 1
local integer b = CountUnitsInGroup(udg_asleep)
local unit e
loop
exitwhen a > b
set e = FirstOfGroup(udg_asleep)
if IsHeroUnitId(GetUnitTypeId(e)) then
call UnitDamageTarget(u, e, 25 * level, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
else
call KillUnit(e)
endif
call UnitDamageTarget(u, u, -50 * level, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTargetUnitBJ("origin", e, "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl"))
call GroupRemoveUnit(udg_asleep, e)
set a = a + 1
endloop
call GroupClear(udg_asleep)
call DestroyGroup(udg_asleep)
set udg_asleep = CreateGroup()
set e = null
set u = null
endfunction
//===========================================================================
function InitTrig_Nightmare_Annihilation takes nothing returns nothing
set gg_trg_Nightmare_Annihilation = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Nightmare_Annihilation, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Nightmare_Annihilation, Condition( function Trig_Nightmare_Annihilation_Conditions ) )
call TriggerAddAction( gg_trg_Nightmare_Annihilation, function Trig_Nightmare_Annihilation_Actions )
endfunction
function Trig_Nuclear_Strike_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A01I' )
endfunction
function Trig_Nuclear_Strike_Destroy_Explosions takes nothing returns nothing
local unit u = GetEnumUnit()
call KillUnit(u)
set u = null
endfunction
function Trig_Nuclear_Strike_Actions takes nothing returns nothing
local integer i = 1
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
local player r
local group g
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local location l = Location(x, y)
loop
exitwhen i > GetUnitAbilityLevelSwapped('A01I', u)
set r = GetOwningPlayer(u)
call CreateNUnitsAtLoc( 1, 'n00U', r, PolarProjectionBJ( l, ( ( I2R(GetUnitAbilityLevelSwapped('A01I', u)) - 1 ) * 85 ), ( ( 360 / I2R(GetUnitAbilityLevelSwapped('A01I', u)) ) * i )), bj_UNIT_FACING )
set i = i + 1
endloop
call TriggerSleepAction(4)
set g = GetUnitsOfPlayerAndTypeId(p, 'n00U')
call ForGroupBJ(g, function Trig_Nuclear_Strike_Destroy_Explosions)
set u = null
set p = null
set r = null
call DestroyGroup(g)
set g = null
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
function InitTrig_Nuclear_Strike takes nothing returns nothing
set gg_trg_Nuclear_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Nuclear_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Nuclear_Strike, Condition( function Trig_Nuclear_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Nuclear_Strike, function Trig_Nuclear_Strike_Actions )
endfunction
function Trig_One_With_Shadow_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A05U' or GetSpellAbilityId()=='A04Y'
endfunction
function Trig_One_With_Shadow_Filter takes nothing returns boolean
local unit u = GetFilterUnit()
local player p1 = GetOwningPlayer(u)
local player p2 = Player(11)
local player p3 = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local boolean b = (p1==p2) or (p1==p3)
set u = null
set p1 = null
set p2 = null
set p3 = null
return b
endfunction
function Trig_One_With_Shadow_Attack takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle( udg_h, GetHandleId(t), 'u' )
local group g = LoadGroupHandle( udg_h, GetHandleId(t), 'g' )
local integer c = LoadInteger( udg_h, GetHandleId(t), 'c' )
local integer i = LoadInteger( udg_h, GetHandleId(t), 'i' )
local integer j = LoadInteger( udg_h, GetHandleId(t), 'j' )
local integer lvl = GetUnitAbilityLevelSwapped('A05U', u)
local unit e = FirstOfGroup(g)
local real x = GetUnitX(e)
local real y = GetUnitY(e)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", x, y))
call SetUnitPosition(u, x, y)
if lvl == 0 then
set lvl = GetUnitAbilityLevelSwapped('A04Y', u)
endif
if j > 60 / c then
call GroupRemoveUnit(g, e)
call SaveInteger( udg_h, GetHandleId(t), 'j', 0 )
else
call SaveInteger( udg_h, GetHandleId(t), 'j', j + 1 )
endif
if i <= 60 then
call UnitDamageTarget(u, e, 200 + 200 * lvl, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_METAL_LIGHT_SLICE)
call SetUnitTimeScale(u, 25)
call SetUnitAnimation(u, "attack")
call SetUnitTimeScale(u, 1)
call SaveInteger( udg_h, GetHandleId(t), 'i', i + 1 )
else
call SetUnitVertexColor(u, 255, 255, 255, 255)
call SetUnitPosition(u, LoadReal(udg_h, GetHandleId(t), 'x'), LoadReal(udg_h, GetHandleId(t), 'y'))
call FlushChildHashtable(udg_h, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
call DestroyGroup(g)
endif
set t = null
set u = null
set g = null
set e = null
endfunction
function Trig_One_With_Shadow_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local group g = GetUnitsInRangeOfLocMatching( 400, l, Condition(function Trig_One_With_Shadow_Filter))
local integer c = CountUnitsInGroup(g)
local integer i = 0
local integer j = 0
call SetUnitVertexColor(u, 127, 127, 127, 127)
call SaveUnitHandle(udg_h, GetHandleId(t), 'u', u)
call SaveGroupHandle(udg_h, GetHandleId(t), 'g', g)
call SaveInteger(udg_h, GetHandleId(t), 'c', c )
call SaveInteger(udg_h, GetHandleId(t), 'i', i )
call SaveInteger(udg_h, GetHandleId(t), 'j', j )
call SaveReal(udg_h, GetHandleId(t), 'x', GetLocationX(l))
call SaveReal(udg_h, GetHandleId(t), 'y', GetLocationY(l))
call TimerStart(t, 0.05, true, function Trig_One_With_Shadow_Attack)
call RemoveLocation(l)
set l = null
set t = null
set u = null
set g = null
endfunction
//===========================================================================
function InitTrig_One_With_Shadow takes nothing returns nothing
set gg_trg_One_With_Shadow = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_One_With_Shadow, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_One_With_Shadow, Condition( function Trig_One_With_Shadow_Conditions ) )
call TriggerAddAction( gg_trg_One_With_Shadow, function Trig_One_With_Shadow_Actions )
endfunction
function Trig_Rage_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0BN' )
endfunction
function Trig_Rage_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer l = GetUnitAbilityLevelSwapped('A0BN', u)
local real formula = GetUnitLifePercent(u) + (udg_mgscale - 0.5) * 100
if (formula > 100) then
set formula = 100
endif
set udg_mgscale = 0.5
call SetUnitLifePercentBJ(u, formula)
set u = null
endfunction
//===========================================================================
function InitTrig_Rage takes nothing returns nothing
set gg_trg_Rage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Rage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Rage, Condition( function Trig_Rage_Conditions ) )
call TriggerAddAction( gg_trg_Rage, function Trig_Rage_Actions )
endfunction
function Trig_Revenge_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A07D'
endfunction
function Trig_Revenge_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetUnitLoc(u)
local group g = GetUnitsInRangeOfLocMatching(250, l, Condition(function Enemy_Check))
local unit e
local integer level = GetUnitAbilityLevelSwapped('A07D', u)
local texttag t = CreateTextTagUnitBJ("–" + I2S(udg_ven), u, 0, 12, 100, 20, 100, 0)
call SetTextTagPermanentBJ(t, false)
call SetTextTagFadepointBJ(t, 1)
call SetTextTagVelocityBJ(t, 64, 90)
call SetTextTagLifespanBJ(t, 2)
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g)
call UnitDamageTargetBJ(u, e, 0.75 * udg_ven * level, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)
call GroupRemoveUnit(g, e)
endloop
set udg_ven = 0
call RemoveLocation(l)
set l = null
call DestroyGroup(g)
set g = null
set e = null
set u = null
set t = null
endfunction
//===========================================================================
function InitTrig_Revenge takes nothing returns nothing
set gg_trg_Revenge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Revenge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Revenge, Condition( function Trig_Revenge_Conditions ) )
call TriggerAddAction( gg_trg_Revenge, function Trig_Revenge_Actions )
endfunction
function Trig_Seal_of_Life_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = GetItemTypeId(i) == 'I03W'
set i = null
return b
endfunction
function Trig_Seal_of_Life_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
set udg_rc[GetConvertedPlayerId(p)] = udg_rc[GetConvertedPlayerId(p)] + 1
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Seal_of_Life takes nothing returns nothing
set gg_trg_Seal_of_Life = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Seal_of_Life, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_Seal_of_Life, Condition( function Trig_Seal_of_Life_Conditions ) )
call TriggerAddAction( gg_trg_Seal_of_Life, function Trig_Seal_of_Life_Actions )
endfunction
function Trig_Seal_of_Power_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = GetItemTypeId(i) == 'I03X'
set i = null
return b
endfunction
function Trig_Seal_of_Power_Actions takes nothing returns nothing
set udg_ac = udg_ac + 1
endfunction
//===========================================================================
function InitTrig_Seal_of_Power takes nothing returns nothing
set gg_trg_Seal_of_Power = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Seal_of_Power, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_Seal_of_Power, Condition( function Trig_Seal_of_Power_Conditions ) )
call TriggerAddAction( gg_trg_Seal_of_Power, function Trig_Seal_of_Power_Actions )
endfunction
function Trig_Shadow_Explode_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0B7'
endfunction
function Trig_Shadow_Explode_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetUnitLoc(u)
local group g = GetUnitsInRangeOfLocMatching(3000, l, Condition(function Enemy_Check))
local unit e
local integer level = GetUnitAbilityLevelSwapped('A0B7', u)
local integer d = level * CountUnitsInGroup(g) * 50
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g)
if GetUnitAbilityLevel(e, 'Bapl') > 0 and IsHeroUnitId(GetUnitTypeId(e)) == false then
call UnitDamageTarget(u, e, d, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
elseif GetUnitAbilityLevel(e, 'Bapl') > 0 then
call UnitDamageTarget(u, e, d/2, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(g, e)
endloop
call SetUnitState(u, UNIT_STATE_MANA, 0)
call RemoveLocation(l)
set l = null
set u = null
set e = null
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Shadow_Explode takes nothing returns nothing
set gg_trg_Shadow_Explode = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadow_Explode, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shadow_Explode, Condition( function Trig_Shadow_Explode_Conditions ) )
call TriggerAddAction( gg_trg_Shadow_Explode, function Trig_Shadow_Explode_Actions )
endfunction
function Trig_Sleep_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A05E'
endfunction
function Sleep_Enemy_Check takes nothing returns boolean
local unit u = GetFilterUnit()
local player p1 = GetOwningPlayer(u)
local player p2 = Player(11)
local player p3 = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local boolean b = ( IsUnitAliveBJ(u) ) and ( (p1 == p2) or (p1 == p3) )
set u = null
set p1 = null
set p2 = null
set p3 = null
return b
endfunction
function Sleep_Sleep takes nothing returns nothing
local unit u = GetEnumUnit()
call GroupAddUnit(udg_asleep, u)
call PauseUnit(u, true)
set u = null
endfunction
function Sleep_End takes nothing returns nothing
local unit u = GetEnumUnit()
call GroupRemoveUnit(udg_asleep, u)
call PauseUnit(u, false)
set u = null
endfunction
function Trig_Sleep_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local group g = GetUnitsInRangeOfLocMatching(185 + 15 * GetUnitAbilityLevel(u, 'A05E'), l, Condition(function Sleep_Enemy_Check))
call ForGroup(g, function Sleep_Sleep)
call RemoveLocation(l)
set l = null
set u = null
call TriggerSleepAction(10)
call ForGroup(g, function Sleep_End)
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Sleep takes nothing returns nothing
set gg_trg_Sleep = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Sleep, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Sleep, Condition( function Trig_Sleep_Conditions ) )
call TriggerAddAction( gg_trg_Sleep, function Trig_Sleep_Actions )
endfunction
function Trig_Total_Corruption_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0DK'
endfunction
function Trig_Total_Corruption_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local group g = CreateGroup()
local unit e
local real x = GetUnitX(u)
local real y = GetUnitY(u)
call GroupEnumUnitsInRange(g, x, y, 3000, Condition(function Enemy_Check))
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g)
if IsPointBlighted(GetUnitX(e), GetUnitY(e)) then
set x = GetUnitX(e)
set y = GetUnitY(e)
call UnitDamageTargetBJ(u, e, 40 + 160 * GetUnitAbilityLevel(u, 'A0DK'), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", x, y))
endif
call GroupRemoveUnit(g, e)
endloop
call SetUnitLifePercentBJ(u, GetUnitStatePercent(u, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE) / 2)
set u = null
set e = null
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Total_Corruption takes nothing returns nothing
set gg_trg_Total_Corruption = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Total_Corruption, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Total_Corruption, Condition( function Trig_Total_Corruption_Conditions ) )
call TriggerAddAction( gg_trg_Total_Corruption, function Trig_Total_Corruption_Actions )
endfunction
function Trig_Tsumikiri_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = (GetItemTypeId(i) == 'I01J' or GetItemTypeId(i) == 'A0CA')
set i = null
return b
endfunction
function Trig_Tsumikiri_Actions takes nothing returns nothing
local unit t = GetTriggerUnit()
local real x = GetUnitX(t)
local real y = GetUnitY(t)
local player p = GetTriggerPlayer()
local unit u = CreateUnit(p, 'n00N', x, y, 270)
call TriggerSleepAction(.75)
call KillUnit(u)
set u = null
set t = null
set p = null
endfunction
//===========================================================================
function InitTrig_Tsumikiri takes nothing returns nothing
set gg_trg_Tsumikiri = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Tsumikiri, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_Tsumikiri, Condition( function Trig_Tsumikiri_Conditions ) )
call TriggerAddAction( gg_trg_Tsumikiri, function Trig_Tsumikiri_Actions )
endfunction
function Trig_Tribute_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A04P' )
endfunction
function Trig_Tribute_Actions takes nothing returns nothing
local integer i = 1
local unit u = GetTriggerUnit()
loop
exitwhen i > 10
if ( udg_Hero[i] != null ) and ( udg_Hero[i] != u ) and ( IsUnitAliveBJ(udg_Hero[i]) == true ) then
call SetUnitLifePercentBJ( udg_Hero[i], 100 )
elseif ( udg_Hero[i] != null ) and ( udg_Hero[i] == u ) then
call SetUnitLifePercentBJ( udg_Hero[i], ( GetUnitLifePercent(u) / 4 ) )
endif
set i = i + 1
endloop
set u = null
endfunction
//===========================================================================
function InitTrig_Tribute takes nothing returns nothing
set gg_trg_Tribute = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Tribute, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Tribute, Condition( function Trig_Tribute_Conditions ) )
call TriggerAddAction( gg_trg_Tribute, function Trig_Tribute_Actions )
endfunction
function Trig_Tranquility_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A00B' )
endfunction
function Trig_Tranquility_Filter takes nothing returns boolean
local unit u = GetFilterUnit()
local boolean b = ( GetUnitTypeId(u) == 'e00M' )
set u = null
return b
endfunction
function Trig_Tranquility_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetUnitLoc(u)
local player p = GetTriggerPlayer()
local group wg = GetUnitsOfPlayerMatching(p, Filter(function Trig_Tranquility_Filter))
local integer w = CountUnitsInGroup(wg)
local group g = GetUnitsInRangeOfLocMatching(1000, l, Condition(function Hero_Check))
local unit e
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g)
if e != u then
call SetUnitManaPercentBJ( e, GetUnitStatePercent(u, UNIT_STATE_MANA, UNIT_STATE_MAX_MANA) + w * 2 )
endif
call GroupRemoveUnit(g, e)
endloop
call RemoveLocation(l)
set l = null
call DestroyGroup(g)
set g = null
call DestroyGroup(wg)
set wg = null
set e = null
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Tranquility takes nothing returns nothing
set gg_trg_Tranquility = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Tranquility, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Tranquility, Condition( function Trig_Tranquility_Conditions ) )
call TriggerAddAction( gg_trg_Tranquility, function Trig_Tranquility_Actions )
endfunction
function Trig_Vice_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A0DI')
endfunction
function Trig_Vice_Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local unit e = GetSpellTargetUnit()
local integer level = GetUnitAbilityLevel(u, 'A0DI')
local player p = GetOwningPlayer(u)
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
if IsPointBlighted(GetUnitX(e), GetUnitY(e)) and IsPointBlighted(GetUnitX(u), GetUnitY(u)) and not IsHeroUnitId(GetUnitTypeId(e)) and GetUnitLevel(e) != 99 then
call UnitDamageTarget(u, e, 50000, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", GetUnitX(e), GetUnitY(e)))
else
if IsPointBlighted(GetUnitX(e), GetUnitY(e)) == true then
call UnitDamageTarget(u, e, level * 150, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", GetUnitX(e), GetUnitY(e)))
endif
if IsPointBlighted(GetUnitX(u), GetUnitY(u)) == true then
call UnitDamageTarget(u, e, level * 30, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
endif
endif
call SetBlight(p, x, y, 60, true)
set p = null
set e = null
set u = null
endfunction
//===========================================================================
function InitTrig_Vice takes nothing returns nothing
set gg_trg_Vice = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Vice, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Vice, Condition( function Trig_Vice_Conditions ) )
call TriggerAddAction( gg_trg_Vice, function Trig_Vice_Actions )
endfunction
function Trig_Unforgiveness_Conditions takes nothing returns boolean
local unit u = GetAttackedUnitBJ()
local boolean b = (UnitHasBuffBJ(u, 'B01I') == true)
set u = null
return b
endfunction
function Trig_Unforgiveness_Actions takes nothing returns nothing
local unit u = GetAttackedUnitBJ()
set udg_ven = udg_ven + GetUnitAbilityLevelSwapped('A079', u)
call SetUnitVertexColor(u, 255, 255, 255, 240)
set u = null
endfunction
//===========================================================================
function InitTrig_Unforgiveness takes nothing returns nothing
set gg_trg_Unforgiveness = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Unforgiveness, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Unforgiveness, Condition( function Trig_Unforgiveness_Conditions ) )
call TriggerAddAction( gg_trg_Unforgiveness, function Trig_Unforgiveness_Actions )
endfunction
function Trig_Wisp_Explosion_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00C'
endfunction
function Trig_Wisp_Explosion_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local group g = GetUnitsInRangeOfLocMatching(500, l, Condition(function Enemy_Check))
local unit e = FirstOfGroup(g)
call RemoveLocation(l)
set l = null
loop
exitwhen CountUnitsInGroup(g) <= 0
set e = FirstOfGroup(g)
call UnitDamageTarget(u, e, 110 * CountLivingPlayerUnitsOfTypeId_Fixed('e00M', p), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(g, e)
endloop
set p = null
set u = null
call DestroyGroup(g)
set g = null
set e = null
endfunction
//===========================================================================
function InitTrig_Wisp_Explosion takes nothing returns nothing
set gg_trg_Wisp_Explosion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Wisp_Explosion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Wisp_Explosion, Condition( function Trig_Wisp_Explosion_Conditions ) )
call TriggerAddAction( gg_trg_Wisp_Explosion, function Trig_Wisp_Explosion_Actions )
endfunction
function Trig_Special_Effect_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local texttag t = CreateTextTagUnitBJ("CRAFTED!", u, 0, 9, 0, 100, 0, 10)
call SetTextTagPermanentBJ(t, false)
call SetTextTagFadepointBJ(t, 1)
call SetTextTagVelocityBJ(t, 75, 90)
call SetTextTagLifespanBJ(t, 2)
call DestroyEffect(AddSpecialEffectTargetUnitBJ("origin", u, "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl"))
set u = null
endfunction
//===========================================================================
function InitTrig_Special_Effect takes nothing returns nothing
set gg_trg_Special_Effect = CreateTrigger()
call DisableTrigger(gg_trg_Special_Effect)
call TriggerAddAction(gg_trg_Special_Effect, function Trig_Special_Effect_Actions)
endfunction
function Trig_Chao_Essence_X_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = GetItemTypeId(i) == 'I03S'
set i = null
return b
endfunction
function Trig_Chao_Essence_X_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i = GetItemOfTypeFromUnitBJ(u, 'I03S')
call RemoveItem(i)
set i = UnitAddItemById(u, 'I037')
set i = null
set u = null
endfunction
//===========================================================================
function InitTrig_Chao_Essence_X takes nothing returns nothing
set gg_trg_Chao_Essence_X = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chao_Essence_X, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Chao_Essence_X, Condition( function Trig_Chao_Essence_X_Conditions ) )
call TriggerAddAction( gg_trg_Chao_Essence_X, function Trig_Chao_Essence_X_Actions )
endfunction
function Trig_Night_Essence_X_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = GetItemTypeId(i) == 'I03T'
set i = null
return b
endfunction
function Trig_Night_Essence_X_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i = GetItemOfTypeFromUnitBJ(u, 'I03T')
call RemoveItem(i)
set i = UnitAddItemById(u, 'I03G')
set i = null
set u = null
endfunction
//===========================================================================
function InitTrig_Night_Essence_X takes nothing returns nothing
set gg_trg_Night_Essence_X = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Night_Essence_X, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Night_Essence_X, Condition( function Trig_Night_Essence_X_Conditions ) )
call TriggerAddAction( gg_trg_Night_Essence_X, function Trig_Night_Essence_X_Actions )
endfunction
function Trig_Secret_Essence_X_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = GetItemTypeId(i) == 'I040'
set i = null
return b
endfunction
function Trig_Secret_Essence_X_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i = GetItemOfTypeFromUnitBJ(u, 'I040')
call RemoveItem(i)
set i = UnitAddItemById(u, 'I01B')
set i = null
set u = null
endfunction
//===========================================================================
function InitTrig_Secret_Essence_X takes nothing returns nothing
set gg_trg_Secret_Essence_X = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Secret_Essence_X, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Secret_Essence_X, Condition( function Trig_Secret_Essence_X_Conditions ) )
call TriggerAddAction( gg_trg_Secret_Essence_X, function Trig_Secret_Essence_X_Actions )
endfunction
function Trig_Transform_Dark_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0DY'
endfunction
function Trig_Transform_Dark_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i = GetItemOfTypeFromUnitBJ(u, 'I04C')
call RemoveItem(i)
set i = UnitAddItemById(u, 'I017')
set u = null
set i = null
endfunction
//===========================================================================
function InitTrig_Transform_Dark takes nothing returns nothing
set gg_trg_Transform_Dark = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Transform_Dark, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Transform_Dark, Condition(function Trig_Transform_Dark_Conditions))
call TriggerAddAction(gg_trg_Transform_Dark, function Trig_Transform_Dark_Actions)
endfunction
function Trig_Transform_Light_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A0DZ'
endfunction
function Trig_Transform_Light_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i = GetItemOfTypeFromUnitBJ(u, 'I04C')
call RemoveItem(i)
set i = UnitAddItemById(u, 'I016')
set u = null
set i = null
endfunction
//===========================================================================
function InitTrig_Transform_Light takes nothing returns nothing
set gg_trg_Transform_Light = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Transform_Light, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Transform_Light, Condition(function Trig_Transform_Light_Conditions))
call TriggerAddAction(gg_trg_Transform_Light, function Trig_Transform_Light_Actions)
endfunction
function Trig_Upgrade_Ring_LVL2_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00W') and UnitHasItemOfTypeBJ(u, 'I011')
set u = null
return b
endfunction
function Trig_Upgrade_Ring_LVL2_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00W')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I011')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I00V', u )
call TriggerExecute( gg_trg_Special_Effect )
set i1 = null
set i2 = null
set i3 = null
set u = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Ring_LVL2 takes nothing returns nothing
set gg_trg_Upgrade_Ring_LVL2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Ring_LVL2, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Ring_LVL2, Condition( function Trig_Upgrade_Ring_LVL2_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Ring_LVL2, function Trig_Upgrade_Ring_LVL2_Actions )
endfunction
function Trig_Upgrade_Ring_LVL3_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00V') and UnitHasItemOfTypeBJ(u, 'I010')
set u = null
return b
endfunction
function Trig_Upgrade_Ring_LVL3_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00V')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I010')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I00U', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Ring_LVL3 takes nothing returns nothing
set gg_trg_Upgrade_Ring_LVL3 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Ring_LVL3, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Ring_LVL3, Condition( function Trig_Upgrade_Ring_LVL3_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Ring_LVL3, function Trig_Upgrade_Ring_LVL3_Actions )
endfunction
function Trig_Upgrade_Sword_LVL2_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I000') and UnitHasItemOfTypeBJ(u, 'I001')
set u = null
return b
endfunction
function Trig_Upgrade_Sword_LVL2_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I000')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I001')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I002', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Sword_LVL2 takes nothing returns nothing
set gg_trg_Upgrade_Sword_LVL2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Sword_LVL2, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Sword_LVL2, Condition( function Trig_Upgrade_Sword_LVL2_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Sword_LVL2, function Trig_Upgrade_Sword_LVL2_Actions )
endfunction
function Trig_Upgrade_Sword_LVL3_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I002') and UnitHasItemOfTypeBJ(u, 'I004')
set u = null
return b
endfunction
function Trig_Upgrade_Sword_LVL3_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I002')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I004')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I003', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Sword_LVL3 takes nothing returns nothing
set gg_trg_Upgrade_Sword_LVL3 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Sword_LVL3, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Sword_LVL3, Condition( function Trig_Upgrade_Sword_LVL3_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Sword_LVL3, function Trig_Upgrade_Sword_LVL3_Actions )
endfunction
function Trig_Upgrade_Boots_LVL2_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00E') and UnitHasItemOfTypeBJ(u, 'I00H')
set u = null
return b
endfunction
function Trig_Upgrade_Boots_LVL2_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00E')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00H')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I00F', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Boots_LVL2 takes nothing returns nothing
set gg_trg_Upgrade_Boots_LVL2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Boots_LVL2, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Boots_LVL2, Condition( function Trig_Upgrade_Boots_LVL2_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Boots_LVL2, function Trig_Upgrade_Boots_LVL2_Actions )
endfunction
function Trig_Upgrade_Boots_LVL3_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00F') and UnitHasItemOfTypeBJ(u, 'I00I')
set u = null
return b
endfunction
function Trig_Upgrade_Boots_LVL3_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00F')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00I')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I00G', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Boots_LVL3 takes nothing returns nothing
set gg_trg_Upgrade_Boots_LVL3 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Boots_LVL3, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Boots_LVL3, Condition( function Trig_Upgrade_Boots_LVL3_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Boots_LVL3, function Trig_Upgrade_Boots_LVL3_Actions )
endfunction
function Trig_Upgrade_Armor_LVL2_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00K') and UnitHasItemOfTypeBJ(u, 'I00M')
set u = null
return b
endfunction
function Trig_Upgrade_Armor_LVL2_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00K')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00M')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I00J', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Armor_LVL2 takes nothing returns nothing
set gg_trg_Upgrade_Armor_LVL2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Armor_LVL2, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Armor_LVL2, Condition( function Trig_Upgrade_Armor_LVL2_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Armor_LVL2, function Trig_Upgrade_Armor_LVL2_Actions )
endfunction
function Trig_Upgrade_Armor_LVL3_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00J') and UnitHasItemOfTypeBJ(u, 'I00N')
set u = null
return b
endfunction
function Trig_Upgrade_Armor_LVL3_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00J')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00N')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I00L', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Upgrade_Armor_LVL3 takes nothing returns nothing
set gg_trg_Upgrade_Armor_LVL3 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Upgrade_Armor_LVL3, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Upgrade_Armor_LVL3, Condition( function Trig_Upgrade_Armor_LVL3_Conditions ) )
call TriggerAddAction( gg_trg_Upgrade_Armor_LVL3, function Trig_Upgrade_Armor_LVL3_Actions )
endfunction
function Trig_Craft_Storm_Blade_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I003') and UnitHasItemOfTypeBJ(u, 'I005') and UnitHasItemOfTypeBJ(u, 'I00S')
set u = null
return b
endfunction
function Trig_Craft_Storm_Blade_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I003')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I005')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00S')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00B', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Storm_Blade takes nothing returns nothing
set gg_trg_Craft_Storm_Blade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Storm_Blade, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Storm_Blade, Condition( function Trig_Craft_Storm_Blade_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Storm_Blade, function Trig_Craft_Storm_Blade_Actions )
endfunction
function Trig_Craft_Earth_Blade_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I003') and UnitHasItemOfTypeBJ(u, 'I008') and UnitHasItemOfTypeBJ(u, 'I00D')
set u = null
return b
endfunction
function Trig_Craft_Earth_Blade_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I003')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I008')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00D')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00A', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Earth_Blade takes nothing returns nothing
set gg_trg_Craft_Earth_Blade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Earth_Blade, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Earth_Blade, Condition( function Trig_Craft_Earth_Blade_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Earth_Blade, function Trig_Craft_Earth_Blade_Actions )
endfunction
function Trig_Craft_Fire_Blade_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I003') and UnitHasItemOfTypeBJ(u, 'I009') and UnitHasItemOfTypeBJ(u, 'I006')
set u = null
return b
endfunction
function Trig_Craft_Fire_Blade_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I003')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I009')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I006')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I007', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Fire_Blade takes nothing returns nothing
set gg_trg_Craft_Fire_Blade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Fire_Blade, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Fire_Blade, Condition( function Trig_Craft_Fire_Blade_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Fire_Blade, function Trig_Craft_Fire_Blade_Actions )
endfunction
function Trig_Craft_Storm_Armor_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00L') and UnitHasItemOfTypeBJ(u, 'I005') and UnitHasItemOfTypeBJ(u, 'I00R')
set u = null
return b
endfunction
function Trig_Craft_Storm_Armor_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00L')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I005')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00R')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00O', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Storm_Armor takes nothing returns nothing
set gg_trg_Craft_Storm_Armor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Storm_Armor, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Storm_Armor, Condition( function Trig_Craft_Storm_Armor_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Storm_Armor, function Trig_Craft_Storm_Armor_Actions )
endfunction
function Trig_Craft_Earth_Armor_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00L') and UnitHasItemOfTypeBJ(u, 'I008') and UnitHasItemOfTypeBJ(u, 'I00C')
set u = null
return b
endfunction
function Trig_Craft_Earth_Armor_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00L')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I008')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00C')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00Q', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Earth_Armor takes nothing returns nothing
set gg_trg_Craft_Earth_Armor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Earth_Armor, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Earth_Armor, Condition( function Trig_Craft_Earth_Armor_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Earth_Armor, function Trig_Craft_Earth_Armor_Actions )
endfunction
function Trig_Craft_Fire_Armor_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00L') and UnitHasItemOfTypeBJ(u, 'I009') and UnitHasItemOfTypeBJ(u, 'I00T')
set u = null
return b
endfunction
function Trig_Craft_Fire_Armor_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00L')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I009')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00T')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00P', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Fire_Armor takes nothing returns nothing
set gg_trg_Craft_Fire_Armor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Fire_Armor, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Fire_Armor, Condition( function Trig_Craft_Fire_Armor_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Fire_Armor, function Trig_Craft_Fire_Armor_Actions )
endfunction
function Trig_Craft_Ring_of_Agility_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00U') and UnitHasItemOfTypeBJ(u, 'I005') and UnitHasItemOfTypeBJ(u, 'I013')
set u = null
return b
endfunction
function Trig_Craft_Ring_of_Agility_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00U')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I005')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I013')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00Z', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Ring_of_Agility takes nothing returns nothing
set gg_trg_Craft_Ring_of_Agility = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Ring_of_Agility, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Ring_of_Agility, Condition( function Trig_Craft_Ring_of_Agility_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Ring_of_Agility, function Trig_Craft_Ring_of_Agility_Actions )
endfunction
function Trig_Craft_Ring_of_Strength_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00U') and UnitHasItemOfTypeBJ(u, 'I008') and UnitHasItemOfTypeBJ(u, 'I012')
set u = null
return b
endfunction
function Trig_Craft_Ring_of_Strength_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00U')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I008')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I012')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00Y', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Ring_of_Strength takes nothing returns nothing
set gg_trg_Craft_Ring_of_Strength = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Ring_of_Strength, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Ring_of_Strength, Condition( function Trig_Craft_Ring_of_Strength_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Ring_of_Strength, function Trig_Craft_Ring_of_Strength_Actions )
endfunction
function Trig_Craft_Ring_of_Intelligence_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00U') and UnitHasItemOfTypeBJ(u, 'I009') and UnitHasItemOfTypeBJ(u, 'I014')
set u = null
return b
endfunction
function Trig_Craft_Ring_of_Intelligence_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00U')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I009')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I014')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I00X', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Ring_of_Intelligence takes nothing returns nothing
set gg_trg_Craft_Ring_of_Intelligence = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Ring_of_Intelligence, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Ring_of_Intelligence, Condition( function Trig_Craft_Ring_of_Intelligence_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Ring_of_Intelligence, function Trig_Craft_Ring_of_Intelligence_Actions )
endfunction
function Trig_Craft_Ring_of_Chaos_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (UnitHasItemOfTypeBJ(u, 'I00Z') or UnitHasItemOfTypeBJ(u, 'I00Y') or UnitHasItemOfTypeBJ(u, 'I00X')) and (UnitHasItemOfTypeBJ(u, 'I016') or UnitHasItemOfTypeBJ(u, 'I017')) and UnitHasItemOfTypeBJ(u, 'I01H')
set u = null
return b
endfunction
function Trig_Craft_Ring_of_Chaos_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00Z')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00Y')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00X')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I016')
local item i5 = GetItemOfTypeFromUnitBJ(u, 'I017')
local item i6 = GetItemOfTypeFromUnitBJ(u, 'I01H')
local item i7
if UnitHasItemOfTypeBJ(u, 'I00Z') then
call RemoveItem( i1 )
else
if ( UnitHasItemOfTypeBJ(u, 'I00Y') ) then
call RemoveItem( i2 )
else
call RemoveItem( i3 )
endif
endif
if UnitHasItemOfTypeBJ(u, 'I016') then
call RemoveItem( i4 )
else
call RemoveItem( i5 )
endif
call RemoveItem( i6 )
set i7 = UnitAddItemByIdSwapped( 'I01C', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
set i6 = null
set i7 = null
endfunction
//===========================================================================
function InitTrig_Craft_Ring_of_Chaos takes nothing returns nothing
set gg_trg_Craft_Ring_of_Chaos = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Ring_of_Chaos, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Ring_of_Chaos, Condition( function Trig_Craft_Ring_of_Chaos_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Ring_of_Chaos, function Trig_Craft_Ring_of_Chaos_Actions )
endfunction
function Trig_Craft_Heavenly_Blade_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (UnitHasItemOfTypeBJ(u, 'I00B') or UnitHasItemOfTypeBJ(u, 'I00A') or UnitHasItemOfTypeBJ(u, 'I007')) and UnitHasItemOfTypeBJ(u, 'I016') and UnitHasItemOfTypeBJ(u, 'I01D')
set u = null
return b
endfunction
function Trig_Craft_Heavenly_Blade_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00B')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00A')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I007')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I016')
local item i5 = GetItemOfTypeFromUnitBJ(u, 'I01D')
local item i6
if UnitHasItemOfTypeBJ(u, 'I00B') then
call RemoveItem( i1 )
else
if UnitHasItemOfTypeBJ(u, 'I00A') then
call RemoveItem( i2 )
else
call RemoveItem( i3 )
endif
endif
call RemoveItem( i4 )
call RemoveItem( i5 )
set i6 = UnitAddItemByIdSwapped( 'I01A', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
set i6 = null
endfunction
//===========================================================================
function InitTrig_Craft_Heavenly_Blade takes nothing returns nothing
set gg_trg_Craft_Heavenly_Blade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Heavenly_Blade, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Heavenly_Blade, Condition( function Trig_Craft_Heavenly_Blade_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Heavenly_Blade, function Trig_Craft_Heavenly_Blade_Actions )
endfunction
function Trig_Craft_Hellish_Blade_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (UnitHasItemOfTypeBJ(u, 'I00B') or UnitHasItemOfTypeBJ(u, 'I00A') or UnitHasItemOfTypeBJ(u, 'I007')) and UnitHasItemOfTypeBJ(u, 'I017') and UnitHasItemOfTypeBJ(u, 'I01E')
set u = null
return b
endfunction
function Trig_Craft_Hellish_Blade_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00B')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00A')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I007')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I017')
local item i5 = GetItemOfTypeFromUnitBJ(u, 'I01E')
local item i6
if UnitHasItemOfTypeBJ(u, 'I00B') then
call RemoveItem( i1 )
else
if UnitHasItemOfTypeBJ(u, 'I00A') then
call RemoveItem( i2 )
else
call RemoveItem( i3 )
endif
endif
call RemoveItem( i4 )
call RemoveItem( i5 )
set i6 = UnitAddItemByIdSwapped( 'I019', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
set i6 = null
endfunction
//===========================================================================
function InitTrig_Craft_Hellish_Blade takes nothing returns nothing
set gg_trg_Craft_Hellish_Blade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Hellish_Blade, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Hellish_Blade, Condition( function Trig_Craft_Hellish_Blade_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Hellish_Blade, function Trig_Craft_Hellish_Blade_Actions )
endfunction
function Trig_Craft_Heavenly_Armor_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (UnitHasItemOfTypeBJ(u, 'I00O') or UnitHasItemOfTypeBJ(u, 'I00Q') or UnitHasItemOfTypeBJ(u, 'I00P')) and UnitHasItemOfTypeBJ(u, 'I016') and UnitHasItemOfTypeBJ(u, 'I01F')
set u = null
return b
endfunction
function Trig_Craft_Heavenly_Armor_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00O')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00Q')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00P')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I016')
local item i5 = GetItemOfTypeFromUnitBJ(u, 'I01F')
local item i6
if UnitHasItemOfTypeBJ(u, 'I00O') then
call RemoveItem( i1 )
else
if UnitHasItemOfTypeBJ(u, 'I00Q') then
call RemoveItem( i2 )
else
call RemoveItem( i3 )
endif
endif
call RemoveItem( i4 )
call RemoveItem( i5 )
set i6 = UnitAddItemByIdSwapped( 'I018', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
set i6 = null
endfunction
//===========================================================================
function InitTrig_Craft_Heavenly_Armor takes nothing returns nothing
set gg_trg_Craft_Heavenly_Armor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Heavenly_Armor, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Heavenly_Armor, Condition( function Trig_Craft_Heavenly_Armor_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Heavenly_Armor, function Trig_Craft_Heavenly_Armor_Actions )
endfunction
function Trig_Craft_Hellish_Armor_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (UnitHasItemOfTypeBJ(u, 'I00O') or UnitHasItemOfTypeBJ(u, 'I00Q') or UnitHasItemOfTypeBJ(u, 'I00P')) and UnitHasItemOfTypeBJ(u, 'I017') and UnitHasItemOfTypeBJ(u, 'I01G')
set u = null
return b
endfunction
function Trig_Craft_Hellish_Armor_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00O')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00Q')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00P')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I017')
local item i5 = GetItemOfTypeFromUnitBJ(u, 'I01G')
local item i6
if UnitHasItemOfTypeBJ(u, 'I00O') then
call RemoveItem( i1 )
else
if UnitHasItemOfTypeBJ(u, 'I00Q') then
call RemoveItem( i2 )
else
call RemoveItem( i3 )
endif
endif
call RemoveItem( i4 )
call RemoveItem( i5 )
set i6 = UnitAddItemByIdSwapped( 'I015', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
set i6 = null
endfunction
//===========================================================================
function InitTrig_Craft_Hellish_Armor takes nothing returns nothing
set gg_trg_Craft_Hellish_Armor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Hellish_Armor, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Hellish_Armor, Condition( function Trig_Craft_Hellish_Armor_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Hellish_Armor, function Trig_Craft_Hellish_Armor_Actions )
endfunction
function Trig_Craft_Sealed_JSword_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I019') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I01K')
set u = null
return b
endfunction
function Trig_Craft_Sealed_JSword_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I019')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01K')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I01I', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Sealed_JSword takes nothing returns nothing
set gg_trg_Craft_Sealed_JSword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Sealed_JSword, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Sealed_JSword, Condition( function Trig_Craft_Sealed_JSword_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Sealed_JSword, function Trig_Craft_Sealed_JSword_Actions )
endfunction
function Trig_Craft_Chaos_Scythe_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I04C') and UnitHasItemOfTypeBJ(u, 'I04D') and (UnitHasItemOfTypeBJ(u, 'I019') or UnitHasItemOfTypeBJ(u, 'I01A'))
set u = null
return b
endfunction
function Trig_Craft_Chaos_Scythe_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I04C')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I04D')
local item i3
call RemoveItem(i1)
call RemoveItem(i2)
if UnitHasItemOfTypeBJ(u, 'I019') then
set i3 = GetItemOfTypeFromUnitBJ(u, 'I019')
else
set i3 = GetItemOfTypeFromUnitBJ(u, 'I01A')
endif
call RemoveItem(i3)
set i3 = UnitAddItemByIdSwapped('I04H', u)
call TriggerExecute(gg_trg_Special_Effect)
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Craft_Chaos_Scythe takes nothing returns nothing
set gg_trg_Craft_Chaos_Scythe = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Chaos_Scythe, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Chaos_Scythe, Condition( function Trig_Craft_Chaos_Scythe_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Chaos_Scythe, function Trig_Craft_Chaos_Scythe_Actions )
endfunction
function Trig_Craft_Chaos_Garment_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I04C') and UnitHasItemOfTypeBJ(u, 'I04E') and (UnitHasItemOfTypeBJ(u, 'I015') or UnitHasItemOfTypeBJ(u, 'I018'))
set u = null
return b
endfunction
function Trig_Craft_Chaos_Garment_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I04C')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I04E')
local item i3
call RemoveItem(i1)
call RemoveItem(i2)
if UnitHasItemOfTypeBJ(u, 'I015') then
set i3 = GetItemOfTypeFromUnitBJ(u, 'I015')
else
set i3 = GetItemOfTypeFromUnitBJ(u, 'I018')
endif
call RemoveItem(i3)
set i3 = UnitAddItemByIdSwapped('I04I', u)
call TriggerExecute(gg_trg_Special_Effect)
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Craft_Chaos_Garment takes nothing returns nothing
set gg_trg_Craft_Chaos_Garment = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Chaos_Garment, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Chaos_Garment, Condition( function Trig_Craft_Chaos_Garment_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Chaos_Garment, function Trig_Craft_Chaos_Garment_Actions )
endfunction
function Trig_Craft_Chaos_Chain_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I04C') and UnitHasItemOfTypeBJ(u, 'I04F') and UnitHasItemOfTypeBJ(u, 'I01C')
set u = null
return b
endfunction
function Trig_Craft_Chaos_Chain_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I04C')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I04F')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01C')
call RemoveItem(i1)
call RemoveItem(i2)
call RemoveItem(i3)
set i3 = UnitAddItemByIdSwapped('I04J', u)
call TriggerExecute(gg_trg_Special_Effect)
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Craft_Chaos_Chain takes nothing returns nothing
set gg_trg_Craft_Chaos_Chain = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Chaos_Chain, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Chaos_Chain, Condition( function Trig_Craft_Chaos_Chain_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Chaos_Chain, function Trig_Craft_Chaos_Chain_Actions )
endfunction
function Trig_Craft_Chaos_Crown_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I04C') and UnitHasItemOfTypeBJ(u, 'I04G') and UnitHasItemOfTypeBJ(u, 'I01C')
set u = null
return b
endfunction
function Trig_Craft_Chaos_Crown_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I04C')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I04G')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01C')
call RemoveItem(i1)
call RemoveItem(i2)
call RemoveItem(i3)
set i3 = UnitAddItemByIdSwapped('I04K', u)
call TriggerExecute(gg_trg_Special_Effect)
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Craft_Chaos_Crown takes nothing returns nothing
set gg_trg_Craft_Chaos_Crown = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Chaos_Crown, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Chaos_Crown, Condition( function Trig_Craft_Chaos_Crown_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Chaos_Crown, function Trig_Craft_Chaos_Crown_Actions )
endfunction
function Trig_Craft_Zanglief_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I025') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I01A')
set u = null
return b
endfunction
function Trig_Craft_Zanglief_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I025')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01A')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I024', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Zanglief takes nothing returns nothing
set gg_trg_Craft_Zanglief = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Zanglief, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Zanglief, Condition( function Trig_Craft_Zanglief_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Zanglief, function Trig_Craft_Zanglief_Actions )
endfunction
function Trig_Craft_Angel_Blessing_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I027') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I018')
set u = null
return b
endfunction
function Trig_Craft_Angel_Blessing_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I027')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I018')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I026', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Angel_Blessing takes nothing returns nothing
set gg_trg_Craft_Angel_Blessing = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Angel_Blessing, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Angel_Blessing, Condition( function Trig_Craft_Angel_Blessing_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Angel_Blessing, function Trig_Craft_Angel_Blessing_Actions )
endfunction
function Trig_Craft_Gem_Blade_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I02A') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I00A')
set u = null
return b
endfunction
function Trig_Craft_Gem_Blade_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I02A')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00A')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I029', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Gem_Blade takes nothing returns nothing
set gg_trg_Craft_Gem_Blade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Gem_Blade, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Gem_Blade, Condition( function Trig_Craft_Gem_Blade_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Gem_Blade, function Trig_Craft_Gem_Blade_Actions )
endfunction
function Trig_Craft_Nature_Shield_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00Q') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I030')
set u = null
return b
endfunction
function Trig_Craft_Nature_Shield_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00Q')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I030')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I02X', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Nature_Shield takes nothing returns nothing
set gg_trg_Craft_Nature_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Nature_Shield, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Nature_Shield, Condition( function Trig_Craft_Nature_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Nature_Shield, function Trig_Craft_Nature_Shield_Actions )
endfunction
function Trig_Craft_Tesla_Frame_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00O') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I02Z')
set u = null
return b
endfunction
function Trig_Craft_Tesla_Frame_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00O')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I02Z')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I02W', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Tesla_Frame takes nothing returns nothing
set gg_trg_Craft_Tesla_Frame = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Tesla_Frame, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Tesla_Frame, Condition( function Trig_Craft_Tesla_Frame_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Tesla_Frame, function Trig_Craft_Tesla_Frame_Actions )
endfunction
function Trig_Craft_Burning_Plate_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00P') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I031')
set u = null
return b
endfunction
function Trig_Craft_Burning_Plate_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00P')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I031')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I02Y', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Burning_Plate takes nothing returns nothing
set gg_trg_Craft_Burning_Plate = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Burning_Plate, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Burning_Plate, Condition( function Trig_Craft_Burning_Plate_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Burning_Plate, function Trig_Craft_Burning_Plate_Actions )
endfunction
function Trig_Craft_Slayer_Axe_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I02E') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I007')
set u = null
return b
endfunction
function Trig_Craft_Slayer_Axe_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I02E')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I007')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I02D', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Slayer_Axe takes nothing returns nothing
set gg_trg_Craft_Slayer_Axe = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Slayer_Axe, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Slayer_Axe, Condition( function Trig_Craft_Slayer_Axe_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Slayer_Axe, function Trig_Craft_Slayer_Axe_Actions )
endfunction
function Trig_Craft_Hammer_of_Thor_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00B') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I02O')
set u = null
return b
endfunction
function Trig_Craft_Hammer_of_Thor_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I02O')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I00B')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I02N', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Hammer_of_Thor takes nothing returns nothing
set gg_trg_Craft_Hammer_of_Thor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Hammer_of_Thor, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Hammer_of_Thor, Condition( function Trig_Craft_Hammer_of_Thor_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Hammer_of_Thor, function Trig_Craft_Hammer_of_Thor_Actions )
endfunction
function Trig_Craft_Sange_Yasha_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I019') and UnitHasItemOfTypeBJ(u, 'I01A') and UnitHasItemOfTypeBJ(u, 'I01M')
set u = null
return b
endfunction
function Trig_Craft_Sange_Yasha_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I019')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01A')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01M')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I01L', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Sange_Yasha takes nothing returns nothing
set gg_trg_Craft_Sange_Yasha = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Sange_Yasha, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Sange_Yasha, Condition( function Trig_Craft_Sange_Yasha_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Sange_Yasha, function Trig_Craft_Sange_Yasha_Actions )
endfunction
function Trig_Craft_Secret_Boots_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I00G') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I01V')
set u = null
return b
endfunction
function Trig_Craft_Secret_Boots_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I00G')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01V')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I01T', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Secret_Boots takes nothing returns nothing
set gg_trg_Craft_Secret_Boots = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Secret_Boots, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Secret_Boots, Condition( function Trig_Craft_Secret_Boots_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Secret_Boots, function Trig_Craft_Secret_Boots_Actions )
endfunction
function Trig_Craft_Ring_of_Completion_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I01C') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I01X')
set u = null
return b
endfunction
function Trig_Craft_Ring_of_Completion_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I01C')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01X')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I01Y', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Ring_of_Completion takes nothing returns nothing
set gg_trg_Craft_Ring_of_Completion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Ring_of_Completion, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Ring_of_Completion, Condition( function Trig_Craft_Ring_of_Completion_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Ring_of_Completion, function Trig_Craft_Ring_of_Completion_Actions )
endfunction
function Trig_Craft_Ring_of_Corruption_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I02Q') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I01C')
set u = null
return b
endfunction
function Trig_Craft_Ring_of_Corruption_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I02Q')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01C')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I02P', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Ring_of_Corruption takes nothing returns nothing
set gg_trg_Craft_Ring_of_Corruption = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Ring_of_Corruption, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Ring_of_Corruption, Condition( function Trig_Craft_Ring_of_Corruption_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Ring_of_Corruption, function Trig_Craft_Ring_of_Corruption_Actions )
endfunction
function Trig_Craft_Divine_Body_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I015') and UnitHasItemOfTypeBJ(u, 'I018') and UnitHasItemOfTypeBJ(u, 'I01W')
set u = null
return b
endfunction
function Trig_Craft_Divine_Body_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I015')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I018')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01W')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I01Z', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Divine_Body takes nothing returns nothing
set gg_trg_Craft_Divine_Body = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Divine_Body, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Divine_Body, Condition( function Trig_Craft_Divine_Body_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Divine_Body, function Trig_Craft_Divine_Body_Actions )
endfunction
function Trig_Craft_Death_Cloak_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I021') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I015')
set u = null
return b
endfunction
function Trig_Craft_Death_Cloak_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I021')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I015')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I020', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Death_Cloak takes nothing returns nothing
set gg_trg_Craft_Death_Cloak = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Death_Cloak, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Death_Cloak, Condition( function Trig_Craft_Death_Cloak_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Death_Cloak, function Trig_Craft_Death_Cloak_Actions )
endfunction
function Trig_Craft_Forbidden_Jewel_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I016') and UnitHasItemOfTypeBJ(u, 'I017') and UnitHasItemOfTypeBJ(u, 'I01B') and UnitHasItemOfTypeBJ(u, 'I023')
set u = null
return b
endfunction
function Trig_Craft_Forbidden_Jewel_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I016')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I017')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I023')
local item i5
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
call RemoveItem( i4 )
set i5 = UnitAddItemByIdSwapped( 'I022', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
endfunction
//===========================================================================
function InitTrig_Craft_Forbidden_Jewel takes nothing returns nothing
set gg_trg_Craft_Forbidden_Jewel = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Forbidden_Jewel, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Forbidden_Jewel, Condition( function Trig_Craft_Forbidden_Jewel_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Forbidden_Jewel, function Trig_Craft_Forbidden_Jewel_Actions )
endfunction
function Trig_Craft_Darkness_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I049') and UnitHasItemOfTypeBJ(u, 'I015') and UnitHasItemOfTypeBJ(u, 'I019') and UnitHasItemOfTypeBJ(u, 'I017')
set u = null
return b
endfunction
function Trig_Craft_Darkness_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I049')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I015')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I019')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I017')
local item i5
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
call RemoveItem( i4 )
set i5 = UnitAddItemByIdSwapped( 'I047', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
endfunction
//===========================================================================
function InitTrig_Craft_Darkness takes nothing returns nothing
set gg_trg_Craft_Darkness = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Darkness, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Darkness, Condition( function Trig_Craft_Darkness_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Darkness, function Trig_Craft_Darkness_Actions )
endfunction
function Trig_Craft_Brilliance_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I04A') and UnitHasItemOfTypeBJ(u, 'I018') and UnitHasItemOfTypeBJ(u, 'I01A') and UnitHasItemOfTypeBJ(u, 'I016')
set u = null
return b
endfunction
function Trig_Craft_Brilliance_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I04A')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I018')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01A')
local item i4 = GetItemOfTypeFromUnitBJ(u, 'I016')
local item i5
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
call RemoveItem( i4 )
set i5 = UnitAddItemByIdSwapped( 'I048', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set i5 = null
endfunction
//===========================================================================
function InitTrig_Craft_Brilliance takes nothing returns nothing
set gg_trg_Craft_Brilliance = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Brilliance, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Brilliance, Condition( function Trig_Craft_Brilliance_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Brilliance, function Trig_Craft_Brilliance_Actions )
endfunction
function Trig_Craft_Sacrificial_Claws_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I033') and UnitHasItemOfTypeBJ(u, 'I00Z') and UnitHasItemOfTypeBJ(u, 'I01B')
set u = null
return b
endfunction
function Trig_Craft_Sacrificial_Claws_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I033')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00Z')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I034', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Sacrificial_Claws takes nothing returns nothing
set gg_trg_Craft_Sacrificial_Claws = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Sacrificial_Claws, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Sacrificial_Claws, Condition( function Trig_Craft_Sacrificial_Claws_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Sacrificial_Claws, function Trig_Craft_Sacrificial_Claws_Actions )
endfunction
function Trig_Craft_Tome_of_Eternity_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I03B') and UnitHasItemOfTypeBJ(u, 'I00X') and UnitHasItemOfTypeBJ(u, 'I01B')
set u = null
return b
endfunction
function Trig_Craft_Tome_of_Eternity_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I03B')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00X')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I03A', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Tome_of_Eternity takes nothing returns nothing
set gg_trg_Craft_Tome_of_Eternity = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Tome_of_Eternity, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Tome_of_Eternity, Condition( function Trig_Craft_Tome_of_Eternity_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Tome_of_Eternity, function Trig_Craft_Tome_of_Eternity_Actions )
endfunction
function Trig_Craft_Tome_of_Midnight_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I01P') and UnitHasItemOfTypeBJ(u, 'I00X') and UnitHasItemOfTypeBJ(u, 'I03G')
set u = null
return b
endfunction
function Trig_Craft_Tome_of_Midnight_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I01P')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00X')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I03G')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I01O', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Tome_of_Midnight takes nothing returns nothing
set gg_trg_Craft_Tome_of_Midnight = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Tome_of_Midnight, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Tome_of_Midnight, Condition( function Trig_Craft_Tome_of_Midnight_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Tome_of_Midnight, function Trig_Craft_Tome_of_Midnight_Actions )
endfunction
function Trig_Craft_Blade_of_Midnight_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I046') and UnitHasItemOfTypeBJ(u, 'I00Y') and UnitHasItemOfTypeBJ(u, 'I03G')
set u = null
return b
endfunction
function Trig_Craft_Blade_of_Midnight_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I046')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00Y')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I03G')
local item i4
call RemoveItem(i1)
call RemoveItem(i2)
call RemoveItem(i3)
set i4 = UnitAddItemByIdSwapped('I045', u)
call TriggerExecute(gg_trg_Special_Effect)
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Blade_of_Midnight takes nothing returns nothing
set gg_trg_Craft_Blade_of_Midnight = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Blade_of_Midnight, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Blade_of_Midnight, Condition( function Trig_Craft_Blade_of_Midnight_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Blade_of_Midnight, function Trig_Craft_Blade_of_Midnight_Actions )
endfunction
function Trig_Craft_Branch_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I035') and UnitHasItemOfTypeBJ(u, 'I00Y') and UnitHasItemOfTypeBJ(u, 'I01B')
set u = null
return b
endfunction
function Trig_Craft_Branch_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I035')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I00Y')
local item i3 = GetItemOfTypeFromUnitBJ(u, 'I01B')
local item i4
call RemoveItem( i1 )
call RemoveItem( i2 )
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I036', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
endfunction
//===========================================================================
function InitTrig_Craft_Branch takes nothing returns nothing
set gg_trg_Craft_Branch = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Branch, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Branch, Condition( function Trig_Craft_Branch_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Branch, function Trig_Craft_Branch_Actions )
endfunction
function Trig_Craft_Striker_of_Chao_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = UnitHasItemOfTypeBJ(u, 'I037') and UnitHasItemOfTypeBJ(u, 'I036')
set u = null
return b
endfunction
function Trig_Craft_Striker_of_Chao_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I037')
local item i2 = GetItemOfTypeFromUnitBJ(u, 'I036')
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I038', u )
call TriggerExecute( gg_trg_Special_Effect )
set udg_vpts = udg_vpts + GetRandomInt(0, 1) * GetRandomInt(0, 1) * GetRandomInt(0, 2)
set u = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Craft_Striker_of_Chao takes nothing returns nothing
set gg_trg_Craft_Striker_of_Chao = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Striker_of_Chao, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Striker_of_Chao, Condition( function Trig_Craft_Striker_of_Chao_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Striker_of_Chao, function Trig_Craft_Striker_of_Chao_Actions )
endfunction
function Trig_Craft_Secret_Key_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local boolean b = Count_Held_Items_Of_Type(u, 'I01B') >= 3 and GetPlayerState(p, PLAYER_STATE_RESOURCE_LUMBER) >= 20 //yes that was on purpose just to make the secret key recipe make no sene at all
set u = null
set p = null
return b
endfunction
function Trig_Craft_Secret_Key_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i1
local item i2
local item i3
local item i4
local player p = GetOwningPlayer(u)
call Message("Player " + I2S(GetPlayerId(p)+1) + " has aquired the Secret Key by combining 3 Secret Essences.", 1)
call Message("A Secret Key owned by Player " + I2S(GetPlayerId(p)+1) + " has been burned off for |cff0000ff35|r Arcane Seals", 1)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState(p, PLAYER_STATE_RESOURCE_LUMBER) - 15)
set i1 = GetItemOfTypeFromUnitBJ(u, 'I01B')
call RemoveItem( i1 )
set i2 = GetItemOfTypeFromUnitBJ(u, 'I01B')
call RemoveItem( i2 )
set i3 = GetItemOfTypeFromUnitBJ(u, 'I01B')
call RemoveItem( i3 )
set i4 = UnitAddItemByIdSwapped( 'I02C', u )
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set i1 = null
set i2 = null
set i3 = null
set i4 = null
set p = null
endfunction
//===========================================================================
function InitTrig_Craft_Secret_Key takes nothing returns nothing
set gg_trg_Craft_Secret_Key = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Secret_Key, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Secret_Key, Condition( function Trig_Craft_Secret_Key_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Secret_Key, function Trig_Craft_Secret_Key_Actions )
endfunction
function Trig_Craft_Chao_Mag_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer id = GetPlayerId(p)
local item i = LoadItemHandle(udg_mag, id, 0)
local boolean b = UnitHasItemOfTypeBJ(u, 'I037') and UnitHasItem(u, i) and GetItemLevel(i) != 3 and LoadInteger(udg_mag, id, MStat("lvl")) > 50
set u = null
set p = null
set i = null
return b
endfunction
function Trig_Craft_Chao_Mag_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer id = GetPlayerId(p)
local item i1 = GetItemOfTypeFromUnitBJ(u, 'I037')
local item i2 = LoadItemHandle(udg_mag, id, 0)
local item i3
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I03H', u )
call SaveItemHandle(udg_mag, id, 0, i3)
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set p = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Craft_Chao_Mag takes nothing returns nothing
set gg_trg_Craft_Chao_Mag = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Chao_Mag, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Chao_Mag, Condition( function Trig_Craft_Chao_Mag_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Chao_Mag, function Trig_Craft_Chao_Mag_Actions )
endfunction
function Trig_Craft_Night_Ess_Mag_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer id = GetPlayerId(p)
local item i = LoadItemHandle(udg_mag, id, 0)
local boolean b = UnitHasItemOfTypeBJ(u, 'I03G') and UnitHasItem(u, i) and GetItemLevel(i) != 3 and LoadInteger(udg_mag, id, MStat("lvl")) > 50
set u = null
set p = null
set i = null
return b
endfunction
function Trig_Craft_Night_Ess_Mag_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer id = GetPlayerId(p)
local item i1
local item i2 = LoadItemHandle(udg_mag, id, 0)
local item i3
if LoadInteger(udg_mag, id, MStat("pow")) > LoadInteger(udg_mag, id, MStat("mind")) then
set i1 = GetItemOfTypeFromUnitBJ(u, 'I03G')
else
set i1 = GetItemOfTypeFromUnitBJ(u, 'I03U')
endif
call RemoveItem( i1 )
call RemoveItem( i2 )
set i3 = UnitAddItemByIdSwapped( 'I03I', u )
call SaveItemHandle(udg_mag, id, 0, i3)
call TriggerExecute( gg_trg_Special_Effect )
set u = null
set p = null
set i1 = null
set i2 = null
set i3 = null
endfunction
//===========================================================================
function InitTrig_Craft_Night_Ess_Mag takes nothing returns nothing
set gg_trg_Craft_Night_Ess_Mag = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Craft_Night_Ess_Mag, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Craft_Night_Ess_Mag, Condition( function Trig_Craft_Night_Ess_Mag_Conditions ) )
call TriggerAddAction( gg_trg_Craft_Night_Ess_Mag, function Trig_Craft_Night_Ess_Mag_Actions )
endfunction
function Trig_Self_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p1 = GetOwningPlayer(u)
local player p2 = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local trigger t = GetTriggeringTrigger()
local boolean b = (p1 != p2 and IsUnitType(u, UNIT_TYPE_HERO) and GetTriggerExecCount(t) == 0)
set u = null
set p1 = null
set p2 = null
set t = null
return b
endfunction
function Trig_Self_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local unit e = CreateUnit(p, GetUnitTypeId(u), GetRectCenterX(gg_rct_Self), GetRectCenterY(gg_rct_Self), 0)
local location l = GetRectCenter(gg_rct_Self)
local effect f = AddSpecialEffectLocBJ(l, "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl")
call SetHeroLevelBJ(e, 200, false)
set udg_vpts = udg_vpts + 1
call DestroyEffect(f)
set f = null
set u = null
set p = null
set e = null
call RemoveLocation(l)
set l = null
call DestroyTrigger(gg_trg_Self)
endfunction
//===========================================================================
function InitTrig_Self takes nothing returns nothing
set gg_trg_Self = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Self, gg_rct_Self )
call TriggerAddCondition( gg_trg_Self, Condition( function Trig_Self_Conditions ) )
call TriggerAddAction( gg_trg_Self, function Trig_Self_Actions )
endfunction
function Trig_Dragon_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local boolean b = (GetUnitTypeId(u) == 'h017')
set u = null
return b
endfunction
function Trig_Dragon_Actions takes nothing returns nothing
local location l = GetRectCenter(gg_rct_Dragon)
local unit u = GetTriggerUnit()
call SetUnitPositionLoc(u, l)
call RemoveLocation(l)
set l = null
set u = null
endfunction
//===========================================================================
function InitTrig_Dragon takes nothing returns nothing
set gg_trg_Dragon = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_Dragon, gg_rct_Dragon )
call TriggerAddCondition( gg_trg_Dragon, Condition( function Trig_Dragon_Conditions ) )
call TriggerAddAction( gg_trg_Dragon, function Trig_Dragon_Actions )
endfunction
function Trig_Drops_Conditions takes nothing returns boolean
return GetRandomInt(1, 30) == 5
endfunction
function Trig_Drops_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local itempool i = CreateItemPool()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local item d
set u = null
call ItemPoolAddItemType(i, 'tdex', 20)
call ItemPoolAddItemType(i, 'tint', 20)
call ItemPoolAddItemType(i, 'tstr', 20)
call ItemPoolAddItemType(i, 'I005', 1)
call ItemPoolAddItemType(i, 'I008', 1)
call ItemPoolAddItemType(i, 'I009', 1)
call ItemPoolAddItemType(i, 'I03Y', udg_flagbonus)
set d = PlaceRandomItem(i, x, y)
call DestroyItemPool(i)
set i = null
set d = null
endfunction
//===========================================================================
function InitTrig_Drops takes nothing returns nothing
set gg_trg_Drops = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Drops, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Drops, Condition( function Trig_Drops_Conditions ) )
call TriggerAddAction( gg_trg_Drops, function Trig_Drops_Actions )
endfunction
function Count_Held_Items_Of_Id takes unit u, integer id returns integer
local integer count = 0
local integer slot = GetInventoryIndexOfItemTypeBJ(u, id)
local integer index = 0
local item indexItem
loop
set indexItem = UnitItemInSlot(u, index)
if indexItem != null and GetItemTypeId(indexItem) == id then
set count = count + 1
endif
set index = index + 1
exitwhen index >= 6
endloop
set indexItem = null
return count
endfunction
function Trig_Combine_Charged_Items_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local unit u = GetTriggerUnit()
local boolean b = GetItemType(i) == ITEM_TYPE_PURCHASABLE and (Count_Held_Items_Of_Id(u, GetItemTypeId(i)) > 1)
set i = null
set u = null
return b
endfunction
function Trig_Combine_Charged_Items_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local item temp = GetManipulatedItem()
local integer t = GetItemTypeId(temp)
local item i0
local item i1
local item i2
local integer count0
local integer count1
set temp = null
set i0 = GetItemOfTypeFromUnitBJ(u, t)
set count0 = GetItemCharges(i0)
call RemoveItem(i0)
set i1 = GetItemOfTypeFromUnitBJ(u, t)
set count1 = GetItemCharges(i1)
call RemoveItem(i1)
set i2 = UnitAddItemById(u,t)
call SetItemCharges(i2, count0+count1)
set u = null
set i0 = null
set i1 = null
set i2 = null
endfunction
//===========================================================================
function InitTrig_Combine_Charged_Items takes nothing returns nothing
set gg_trg_Combine_Charged_Items = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Combine_Charged_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Combine_Charged_Items, Condition( function Trig_Combine_Charged_Items_Conditions ) )
call TriggerAddAction( gg_trg_Combine_Charged_Items, function Trig_Combine_Charged_Items_Actions )
endfunction
function Trig_Drop_Similar_Items_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local unit u = GetTriggerUnit()
local boolean b = GetItemType(i) == ITEM_TYPE_ARTIFACT and GetItemLevel(i) != 0 and Count_Held_Items_Of_Level(u, GetItemLevel(i), 3) > 1
set i = null
set u = null
return b
endfunction
function Trig_Drop_Similar_Items_Actions takes nothing returns nothing
local item i = GetManipulatedItem()
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
call UnitRemoveItem(u, i)
set i = null
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Drop_Similar_Items takes nothing returns nothing
set gg_trg_Drop_Similar_Items = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Drop_Similar_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Drop_Similar_Items, Condition( function Trig_Drop_Similar_Items_Conditions ) )
call TriggerAddAction( gg_trg_Drop_Similar_Items, function Trig_Drop_Similar_Items_Actions )
endfunction
function Trig_Conqueror_Conditions takes nothing returns boolean
local unit u = GetDyingUnit()
local boolean b = (GetUnitTypeId(GetDyingUnit()) == 'h01H')
set u = null
return b
endfunction
function Trig_Conqueror_Actions takes nothing returns nothing
local unit u = GetDyingUnit()
local location l = GetUnitLoc(u)
if GetPlayerId(GetOwningPlayer(u)) == 11 then
set u = CreateUnitAtLoc(Player(10), 'h01H', l, 270)
set udg_flagbonus = udg_flagbonus + 1
call Message("Defenders have " + I2S(udg_flagbonus) + " |cff00ffffflags|r!", 10)
else
set u = CreateUnitAtLoc(Player(11), 'h01H', l, 270)
set udg_flagbonus = udg_flagbonus - 1
call Message("Invader has " + I2S(10 - udg_flagbonus) + " |cff00ffffflags|r!", 10)
endif
set u = null
call RemoveLocation(l)
set l = null
endfunction
//===========================================================================
function InitTrig_Conqueror takes nothing returns nothing
set gg_trg_Conqueror = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Conqueror, Player(10), EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Conqueror, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Conqueror, Condition( function Trig_Conqueror_Conditions ) )
call TriggerAddAction( gg_trg_Conqueror, function Trig_Conqueror_Actions )
endfunction
function Trig_Genocide_Actions takes nothing returns nothing
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(u)
local player l = GetLocalPlayer()
if GetTriggerExecCount(gg_trg_Genocide) > 4 then
set u = CreateUnit(p, 'h016', GetUnitX(u), GetUnitY(u), 0)
call SetUnitUseFood(u, false)
call SetUnitVertexColor(u, 127, 127, 127, 127)
call SetUnitMoveSpeed(u, 522)
call SetUnitPathing(u, false)
call SetUnitInvulnerable(u, true)
if p == l then
call Message("--- |cff00ff00Event Report|r ---", 10)
call Message("|cff00ff00Event:|r Genocide", 10)
call Message("You have aquired a free peasant! But there's something weird about him...", 10)
endif
set udg_Chaos = udg_Chaos + 1
call Check_Chaos()
set udg_vpts = udg_vpts + 5
call DestroyTrigger(gg_trg_Genocide)
endif
set l = null
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Genocide takes nothing returns nothing
set gg_trg_Genocide = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Genocide, gg_unit_nvlw_0079, EVENT_UNIT_DEATH )
call TriggerRegisterUnitEvent( gg_trg_Genocide, gg_unit_nvk2_0080, EVENT_UNIT_DEATH )
call TriggerRegisterUnitEvent( gg_trg_Genocide, gg_unit_nvl2_0078, EVENT_UNIT_DEATH )
call TriggerRegisterUnitEvent( gg_trg_Genocide, gg_unit_nvil_0077, EVENT_UNIT_DEATH )
call TriggerRegisterUnitEvent( gg_trg_Genocide, gg_unit_nvl2_0121, EVENT_UNIT_DEATH )
call TriggerAddAction( gg_trg_Genocide, function Trig_Genocide_Actions )
endfunction
function Trig_Pack_Horse_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local boolean b = (GetPlayerController(p) == MAP_CONTROL_USER) and (GetUnitTypeId(u) != 'h02C') and (GetTriggerExecCount(gg_trg_Pack_Horse) <= 1)
set u = null
set p = null
return b
endfunction
function Trig_Pack_Horse_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local player l = GetLocalPlayer()
set u = CreateUnit(p, 'h02C', GetUnitX(u), GetUnitY(u), 0)
if p == l then
call Message("--- |cff00ff00Event Report|r ---", 10)
call Message("|cff00ff00Event:|r Last Survivor", 10)
call Message("You have aquired a free Pack Horse! Its owners probably won't mind...", 10)
endif
set udg_Chaos = udg_Chaos + 1
set udg_vpts = udg_vpts + 5
call Check_Chaos()
set l = null
set u = null
set p = null
call DestroyTrigger(gg_trg_Pack_Horse)
endfunction
//===========================================================================
function InitTrig_Pack_Horse takes nothing returns nothing
set gg_trg_Pack_Horse = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Pack_Horse, gg_rct_DestroyedTown )
call TriggerAddCondition( gg_trg_Pack_Horse, Condition( function Trig_Pack_Horse_Conditions ) )
call TriggerAddAction( gg_trg_Pack_Horse, function Trig_Pack_Horse_Actions )
endfunction
function Trig_Botanist_Conditions takes nothing returns boolean
local item i = GetManipulatedItem()
local boolean b = GetItemTypeId(i) == 'I01R'
set i = null
return b
endfunction
function Trig_Botanist_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local player l = GetLocalPlayer()
local item i
local location there
local rect array where
local boolean gold
set where[0] = gg_rct_Cave_Searinox
set where[1] = gg_rct_Region_035
set where[2] = gg_rct_Cave_2
set where[3] = gg_rct_Meadow
set where[4] = gg_rct_Region_040
set where[5] = gg_rct_Region_041
set where[6] = gg_rct_Region_036
set where[7] = gg_rct_Region_042
set where[8] = gg_rct_Region_043
set where[9] = gg_rct_Region_044
set where[10] = gg_rct_LaneS
set there = GetRandomLocInRect(where[GetRandomInt(0, 10)])
if GetTriggerExecCount(gg_trg_Botanist) < 6 then
call AdjustPlayerStateBJ(1, p, PLAYER_STATE_RESOURCE_LUMBER)
set gold = false
else
call AdjustPlayerStateBJ(200, p, PLAYER_STATE_RESOURCE_GOLD)
set gold = true
endif
if GetTriggerExecCount(gg_trg_Botanist) < 49 then
set i = CreateItem('I01R', GetLocationX(there), GetLocationY(there))
endif
if p == l then
call Message("--- |cff00ff00Event Report|r ---", 10)
call Message("|cff00ff00Event:|r Botanist", 10)
if gold == false then
call Message("You have been awarded 1 Arcane Seal for finding a Rare Herb.", 10)
elseif gold == true then
call Message("You have been awarded 200 Gold for finding a Rare Herb.", 10)
endif
endif
set udg_Chaos = udg_Chaos + 1
call Check_Chaos()
set where[0] = null
set where[1] = null
set where[2] = null
set where[3] = null
set where[4] = null
set where[5] = null
set where[6] = null
set where[7] = null
set where[8] = null
set where[9] = null
set where[10] = null
call RemoveLocation(there)
set there = null
set u = null
set p = null
set l = null
set i = null
if GetTriggerExecCount(gg_trg_Botanist) >= 50 then
call DestroyTrigger(gg_trg_Botanist)
call Message("|cffff0000Rare Herbs have gone extinct.|r", 10)
if udg_mode != 2 and udg_mode != 4 then
set udg_vpts = udg_vpts + 25
endif
endif
endfunction
//===========================================================================
function InitTrig_Botanist takes nothing returns nothing
set gg_trg_Botanist = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Botanist, EVENT_PLAYER_UNIT_PICKUP_ITEM )
//call TriggerRegisterAnyUnitEventBJ( gg_trg_Botanist, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Botanist, Condition( function Trig_Botanist_Conditions ) )
call TriggerAddAction( gg_trg_Botanist, function Trig_Botanist_Actions )
endfunction