//TESH.scrollpos=0
//TESH.alwaysfold=0
library Typecaster
// Code taken from http://www.wc3c.net/showthread.php?t=108216
//* BY: Rising_Dusk
//* Credits to Weaaddar for discovering this implementation
//*
//* Based on the following example:
//*
//* local hashtable ht = InitHashtable();
//* local unit u = CreateUnit(Player(0),'hfoo',0,0,0)
//* local integer handleID = GetHandleId(u);
//* local fogstate h = ConvertFogState(handleID);
//* local agent a;
//* call SaveFogStateHandle(ht, 0,0,h);
//* set a = LoadUnitHandle(ht, 0, 0);
//* call BJDebugMsg(I2S(GetHandleId(a)));
//*
globals
private hashtable ht = InitHashtable()
endglobals
function H2I takes handle h returns integer
local integer i = GetHandleId(h)
call SaveFogStateHandle(ht, 0, i, ConvertFogState(i))
return i
endfunction
//! textmacro I2H takes NAME, RETURNTYPE, HASHFUNC
function $NAME$ takes integer i returns $RETURNTYPE$
return $HASHFUNC$(ht, 0, i)
endfunction
//! endtextmacro
//! runtextmacro I2H("I2U", "unit", "LoadUnitHandle")
//! runtextmacro I2H("I2Timer", "timer", "LoadTimerHandle")
//! runtextmacro I2H("I2Trigger", "trigger", "LoadTriggerHandle")
//! runtextmacro I2H("I2TriggerAct", "triggeraction", "LoadTriggerActionHandle")
//! runtextmacro I2H("I2TriggerCond", "triggercondition", "LoadTriggerConditionHandle")
//! runtextmacro I2H("I2E", "effect", "LoadEffectHandle")
//! runtextmacro I2H("I2G", "group", "LoadGroupHandle")
endlibrary
//==========================================================================================
// === Code Graciously taken from http://www.wc3c.net/showthread.php?t=106558
// === Essentially makes kattana's system work for 1.24
library HandleVars initializer init
globals
private hashtable ht
endglobals
// too bad the Handle vars' old functionality forces me to make these things
// inline-unfriendly
function SetHandleHandle takes agent subject, string label, agent value returns nothing
if(value==null) then
call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label))
else
call SaveAgentHandle( ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleInt takes agent subject, string label, integer value returns nothing
if value==0 then
call RemoveSavedInteger(ht, GetHandleId(subject), StringHash(label))
else
call SaveInteger(ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleBoolean takes agent subject, string label, boolean value returns nothing
if (value == false) then
call RemoveSavedBoolean(ht, GetHandleId(subject), StringHash(label))
else
call SaveBoolean(ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleReal takes agent subject, string label, real value returns nothing
if (value == 0.0) then
call RemoveSavedReal(ht, GetHandleId(subject), StringHash(label))
else
call SaveReal(ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function SetHandleString takes agent subject, string label, string value returns nothing
if ((value=="") or (value==null)) then
call RemoveSavedString(ht, GetHandleId(subject), StringHash(label))
else
call SaveStr(ht, GetHandleId(subject), StringHash(label), value) //yay for blizz' consistent naming scheme...
endif
endfunction
function GetHandleHandle takes agent subject, string label returns agent
debug call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake")
return null
endfunction
// these are inline friendly, ok, maybe they aren't because jasshelper does not recognize
// GetHandleId as non-state changing. But they will be once I fix jasshelper...
function GetHandleInt takes agent subject, string label returns integer
return LoadInteger(ht, GetHandleId(subject), StringHash(label))
endfunction
function GetHandleBoolean takes agent subject, string label returns boolean
return LoadBoolean(ht, GetHandleId(subject), StringHash(label))
endfunction
function GetHandleString takes agent subject, string label returns string
return LoadStr(ht, GetHandleId(subject), StringHash(label))
endfunction
function GetHandleReal takes agent subject, string label returns real
return LoadReal(ht, GetHandleId(subject), StringHash(label))
endfunction
// got bored so I now use a textmacro...
//! textmacro FAUX_HANDLE_VARS_GetHandleHandle takes NAME, TYPE
function SetHandle$NAME$ takes agent subject, string label, $TYPE$ value returns nothing
if(value==null) then
call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label))
else
call Save$NAME$Handle( ht, GetHandleId(subject), StringHash(label), value)
endif
endfunction
function GetHandle$NAME$ takes agent subject, string label returns $TYPE$
return Load$NAME$Handle( ht, GetHandleId(subject), StringHash(label))
endfunction
//! endtextmacro
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Player","player")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Widget","widget")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Destructable","destructable")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Item","item")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Unit","unit")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ability","ability")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Timer","timer")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trigger","trigger")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerCondition","triggercondition")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerAction","triggeraction")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerEvent","event")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Force","force")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Group","group")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Location","location")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Rect","rect")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("BooleanExpr","boolexpr")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Sound","sound")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Effect","effect")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("UnitPool","unitpool")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("ItemPool","itempool")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Quest","quest")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("QuestItem","questitem")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("DefeatCondition","defeatcondition")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TimerDialog","timerdialog")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Leaderboard","leaderboard")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Multiboard","multiboard")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("MultiboardItem","multiboarditem")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trackable","trackable")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Dialog","dialog")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Button","button")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TextTag","texttag")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Lightning","lightning")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Image","image")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ubersplat","ubersplat")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Region","region")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogState","fogstate")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogModifier","fogmodifier")
//! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Hashtable","hashtable")
function FlushHandleVars takes agent subject returns nothing
call FlushChildHashtable(ht, GetHandleId(subject))
endfunction
function FlushHandleLocals takes agent subject returns nothing
call FlushHandleVars(subject)
endfunction
private function init takes nothing returns nothing
set ht=InitHashtable()
endfunction
endlibrary
// used in the Gravyeard Scheme for checking the locations of the towers etc.
function MyCompareLocations takes location A, location B returns boolean
if( RAbsBJ(GetLocationX(A) - GetLocationX(B)) > 10 ) then
return false
endif
if( RAbsBJ(GetLocationY(A) - GetLocationY(B)) > 10 ) then
return false
endif
return true
endfunction
// =======================================================================
// =======================================================================
// &&&&&&&&&& STACK DECLARATION &&&&&&&&&&&&&&&&&&
// used for holding the Stack of the player's Graveyards
struct locStack
location array a[100]
// the Top Of Stack represents our empty position
integer tos = 0
endstruct
function pushStack takes locStack s, location loc returns nothing
if( s.tos <= 99 ) then
set s.a[s.tos] = loc
set s.tos = s.tos + 1
else
call BJDebugMsg("&&&& Trying To Push On A Full Stack &&&&")
endif
endfunction
function popStack takes locStack s returns location
if( s.tos >= 1 ) then
set s.tos = (s.tos - 1)
return s.a[s.tos]
else
call BJDebugMsg("%%%% Trying To Pop An Empty Stack %%%%" )
return null
endif
endfunction
function peekStack takes locStack s returns location
return s.a[s.tos-1]
endfunction
function isStackEmpty takes locStack s returns boolean
return ( s.tos == 0 )
endfunction
function getStackSize takes locStack s returns integer
return s.tos
endfunction
// used for pinging the top of a stack
function pingStack takes locStack s, integer plyrNum returns nothing
call PingMinimapLocForPlayer( Player(plyrNum), s.a[s.tos-1], 2 )
endfunction
// used to clear the stack of a location...when a graveyard is taken
function purgeStack takes locStack s, location loc returns nothing
local locStack temp
set temp = locStack.create()
loop
exitwhen (MyCompareLocations(peekStack(s),loc) or (isStackEmpty(s)))
call pushStack(temp, popStack(s))
endloop
// this shoudln't leak, since it will return null if it is empty
// or a preexisting location...
if ( not isStackEmpty(s)) then
call popStack(s)
endif
loop
exitwhen (isStackEmpty(temp))
call pushStack(s, popStack(temp))
endloop
call locStack.destroy(temp)
endfunction
// &&&&&&&&&&&&&& END STACK DECLARATION &&&&&&&&&&&&&&&
// =======================================================================
// =======================================================================
// =======================================================================
// =========== GENERATOR STRUCT ===================================
struct GenData
location make
location rally
integer building
integer spawn
endstruct
// ========== END GENERATOR STRUCT =================================
// =======================================================================
// see the trigger "Array Initilizations" For where these are defined!
globals
// why some variables are udg's and others aren't? meh.
locStack array theGYs[4]
GenData array theGens[12]
rect array finalboss[4]
location array FinalPVP[4]
destructable array pvpgates[4]
location array runespawn[5]
location array bossentrances[4]
location array minibossentrances[2]
location array portLocs[4]
location array shopLocs[2]
location array startLocs[4]
location array selectorLocs[4]
location array pvptowers[8]
itempool lvl1ip
integer array herotype[14]
endglobals
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
//============================= Part of the Handle-System for Timers by KaTTaNa
//function H2I takes handle h returns integer
// return h
// return 0
//endfunction
//function I2Timer takes integer i returns timer
// return i
// return null
//endfunction
function CleanTimer takes timer t returns nothing
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
endfunction
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// a simple function for creating Floating Combat Text to be used globally
// RGB are to be given as a value from 0 to 255
function GlobalFloatingCombatText takes unit targ, integer msg, integer red, integer green, integer blue, boolean isDmg returns nothing
local texttag t = CreateTextTag()
local integer dmg = msg
if ( IsUnitType(targ, UNIT_TYPE_HERO) and isDmg ) then
set dmg = R2I( msg * 0.70 )
endif
call SetTextTagText(t, I2S(dmg), 0.025)
call SetTextTagPos(t, GetUnitX(targ), GetUnitY(targ), 0)
call SetTextTagColor(t, red, green, blue, 255)
call SetTextTagPermanent(t, false)
call SetTextTagVelocity(t, 0, 0.0200)
call SetTextTagFadepoint(t, 1.0)
call SetTextTagLifespan(t, 2.0)
set t = null
endfunction
// a way to localize the way damage is caused by all units in triggers
function GlobalCauseSpellDamage takes unit caster, unit target, real dmg returns nothing
call UnitDamageTarget( caster, target, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
endfunction
function GlobalCausePhysicalDamage takes unit caster, unit target, real dmg returns nothing
call UnitDamageTarget( caster, target, dmg, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
endfunction
function GlobalMessage takes string s returns nothing
call DisplayTextToForce( GetPlayersAll(), s )
endfunction
// used by the boss fights to determine if a unit is a Player Unit
function IsPCd takes nothing returns boolean
return ( GetPlayerId(GetOwningPlayer(GetFilterUnit())) < 8 )
endfunction
function IsPCdAndAlive takes nothing returns boolean
return (( GetPlayerId(GetOwningPlayer(GetFilterUnit())) < 8 ) and IsUnitAliveBJ(GetFilterUnit()) )
endfunction
// simply determines what the other Hero's integer should be given one...
// expects a value from 0 to 7
function otherPlayerNum takes integer plyr returns integer
if( ModuloInteger(plyr, 2) == 1 ) then
// number is odd, subtract 1
return (plyr-1)
else
// number is even, add 1
return (plyr+1)
endif
endfunction
function NumberHeroesAlive takes integer team returns integer
// expects a value ranging from 0 to 3
local integer count = 0
local integer hero1 = (team*2)
if( (udg_theHeroes[hero1] !=null) and (GetUnitState(udg_theHeroes[hero1], UNIT_STATE_LIFE ) > 0) ) then
set count = count + 1
endif
if( (udg_theHeroes[hero1+1] != null) and (GetUnitState( udg_theHeroes[hero1+1], UNIT_STATE_LIFE ) > 0 ) ) then
set count = count + 1
endif
return count
endfunction
// =======================================================================
// ================= BEGIN SPIDER BOSS FUNCTIONS =========================
function Alert_Spider_Reset takes integer i returns nothing
// expecting i to be either 0 or 1,
call GlobalMessage("An Ice |cff0000ffSpider|r has been Reset and can be reentered")
if( i == 0 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX(gg_rct_Miniboss1), GetRectCenterY(gg_rct_Miniboss1), 4.0 )
endif
if( i == 1 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX(gg_rct_Miniboss2), GetRectCenterY(gg_rct_Miniboss2), 4.0 )
endif
endfunction
// Used by Bearmancer code and Death Eater code to kill their summons after death
function Purge_Callback takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
function Purge_Area_Of_Units takes rect r returns nothing
local group g = GetUnitsInRectAll(r)
call ForGroup( g, function Purge_Callback )
call DestroyGroup(g)
set g = null
endfunction
function Alert_Spider_Killed takes integer i returns nothing
// expecting i to be 0 or 1
call GlobalMessage("An Ice |cff0000ffSpider|r has been Downed!")
if( i == 0 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX(gg_rct_Miniboss1), GetRectCenterY(gg_rct_Miniboss1), 4.0 )
call Purge_Area_Of_Units(gg_rct_MiniPurge1)
//call SetDestructableInvulnerable(CreateDestructable( 'LTe3', GetRectCenterX(gg_rct_Miniboss1), GetRectCenterY(gg_rct_Miniboss1), 0, 1.0, 0 ), true )
endif
if( i == 1 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX(gg_rct_Miniboss2), GetRectCenterY(gg_rct_Miniboss2), 4.0 )
call Purge_Area_Of_Units(gg_rct_MiniPurge2)
//call SetDestructableInvulnerable( CreateDestructable( 'LTe1', GetRectCenterX(gg_rct_MiniPurge2), GetRectCenterY(gg_rct_MiniPurge2), 0, 1.0, 0 ), true )
endif
call PolledWait( 5.0 )
call TriggerExecute( gg_trg_PvP )
endfunction
function Trig_SpiderBoss_Bolt takes nothing returns nothing
local integer t = GetHandleId(GetExpiredTimer())
local unit orb = GetHandleUnit(I2Timer(t), "orb")
local location loc = GetUnitLoc(orb)
local unit dummy = CreateUnitAtLoc( Player(12), 'h003', loc, 0 )
call UnitAddAbility( dummy, 'A02V' )
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
call IssueTargetOrder( dummy, "acidbomb", GetEnumUnit() )
call RemoveLocation(loc)
set loc = null
set dummy = null
set orb = null
endfunction
function Trig_SpiderBoss_Orb takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit spider = GetHandleUnit(I2Timer(t), "spider")
local unit orb = GetHandleUnit(I2Timer(t), "orb")
local real orbX = GetUnitX(orb)
local real orbY = GetUnitY(orb)
local boolexpr filter = Condition( function IsPCd )
local group g = CreateGroup()
call GroupEnumUnitsInRange( g, orbX, orbY, 500.0, filter )
call DestroyBoolExpr(filter)
if( IsUnitDeadBJ(spider) ) then
call RemoveUnit(orb)
call CleanTimer(I2Timer(t))
else
call ForGroup(g, function Trig_SpiderBoss_Bolt )
endif
call DestroyGroup(g)
set filter = null
set g = null
set orb = null
set spider = null
endfunction
function Trig_SpiderBoss_Eggs takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit spider = GetHandleUnit(I2Timer(t), "spider")
local unit egg
if( IsUnitDeadBJ(spider) ) then
call CleanTimer(I2Timer(t))
else
set egg = CreateUnit(GetOwningPlayer(spider), 'h00E', GetUnitX(spider), GetUnitY(spider), 0 )
call IssueImmediateOrder( egg, "channel" )
endif
set egg = null
set spider = null
endfunction
// used for determing a "random" item to give to the Player after defeating the miniboss
function GetMiniBossItem takes nothing returns integer
local integer rand = GetRandomInt(1, 3)
if ( rand == 1 ) then
return 'I00T' // Rod of Bearmancy
endif
if ( rand == 2 ) then
return 'I00B' // Lesser Invulnerability
endif
return 'I00P' // Mana Hunger
endfunction
function Trig_MiniBossTeleport takes integer num returns nothing
local location loc = udg_miniBossEntrances[num]
local integer otherUnit = otherPlayerNum(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
local unit other = udg_theHeroes[otherUnit]
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, .25 )
if ( IsUnitDeadBJ(other) ) then
call ReviveHeroLoc(other, loc, true )
else
call SetUnitPositionLoc(other, loc)
endif
call SetUnitLifePercentBJ( other, 100.0 )
call SetUnitManaPercentBJ( other, 100.0 )
call SetUnitLifePercentBJ( GetTriggerUnit(), 100.0 )
call SetUnitManaPercentBJ( GetTriggerUnit(), 100.0 )
call UnitResetCooldown( GetTriggerUnit() )
call UnitResetCooldown( other )
set other = CreateCorpseLocBJ( 'U00A', Player(12), loc )
set loc = null
set other = null
endfunction
// =================== END SPIDER BOSS FUNCTIONS ==========================
// =======================================================================
// used for determing a "random" item to give to the Player after defeating the Boss
function GetBossItem takes nothing returns integer
local integer rand = GetRandomInt(1, 3)
if ( rand == 1 ) then
return 'I00T' // Rod of BEARmancy
endif
if ( rand == 2 ) then
return 'I00Q' // Invulnerability
endif
return 'I00S' // Grapple Beam
endfunction
// =======================================================================
// ================ BEGIN GENERATOR TRIGGERS =====================
// A simple Condition that should be used for all Generator Triggers
function Trig_Gen_Cond takes nothing returns boolean
return ( GetPlayerId(GetOwningPlayer(GetTriggerUnit())) < 8 )
endfunction
// this is the Timer Callback for all the Generator Triggers
function Trig_Gen_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit generator = GetHandleUnit(I2Timer(t), "generator")
local unit genUnit
local integer end = GetHandleInt(I2Timer(t), "end")
local integer steps = GetHandleInt(I2Timer(t), "steps")
// num is used to make this code resuable...and to avoid copy pasting
local integer num = GetHandleInt(I2Timer(t), "num")
local location loc = theGens[num].rally
local integer thisUnit = theGens[num].spawn
if ( IsUnitDeadBJ(generator) or ( steps > end ) ) then
call CleanTimer(I2Timer(t))
else
set genUnit = CreateUnit(Player(12), thisUnit, GetUnitX(generator), GetUnitY(generator), 0 )
call IssuePointOrderLoc( genUnit, "attack", loc )
call SetHandleInt(I2Timer(t), "steps", steps+1)
endif
set loc = null
set genUnit = null
set generator = null
endfunction
function Trig_Gen_TheActions takes integer num returns nothing
local location loc = theGens[num].make
local integer thisBuild = theGens[num].building
local unit generator = CreateUnitAtLoc( Player(12), thisBuild, loc, 270.0 )
local integer t = H2I(CreateTimer())
local real speedOfSpawn = 1.75 // 2.0 seconds to spawn lvl 2 ghouls and ogres
if( num < 4 ) then
set speedOfSpawn = 4.0 // ghoul spawn rate
endif
if( (num == 8) or (num == 10) ) then // goblin mines spawn faster
set speedOfSpawn = 0.5
endif
call SetHandleHandle(I2Timer(t), "generator", generator )
call SetHandleInt(I2Timer(t), "end", 15 )
call SetHandleInt(I2Timer(t), "steps", 0 )
call SetHandleInt(I2Timer(t), "num", num)
call TimerStart(I2Timer(t), speedOfSpawn, true, function Trig_Gen_Callback )
set loc = null
set generator = null
endfunction
// ================ END GENERATOR FUNCTIONS ======================
// =======================================================================
// =======================================================================
// ================ BEGIN FINAL BOSS FUNCTIONS
function MakeMeFarsight takes integer i returns nothing
local unit d = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h003', GetRectCenterX(finalboss[i]), GetRectCenterY(finalboss[i]), 0.0)
call UnitAddAbility(d, 'A010')
call IssueImmediateOrder(d, "farsight")
call UnitApplyTimedLife( d, 'BTLF', 2.0 )
set d = null
endfunction
function Trig_EnterBoss_Conditions takes nothing returns boolean
if( not( GetPlayerId(GetOwningPlayer(GetTriggerUnit())) < 8 ) ) then
return false
endif
if ( not IsUnitType( GetTriggerUnit(), UNIT_TYPE_HERO ) ) then
return false
endif
return true
endfunction
function Trig_FinalBossTeleport takes integer num returns nothing
local location loc = udg_finalBossEntrances[num]
local integer otherUnit = otherPlayerNum(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
local unit other = udg_theHeroes[otherUnit]
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, .25 )
if ( IsUnitDeadBJ(other) ) then
call ReviveHeroLoc(other, loc, true )
else
call SetUnitPositionLoc(other, loc)
endif
call SetUnitLifePercentBJ( other, 100.00 )
call SetUnitManaPercentBJ( other, 100.00 )
call SetUnitLifePercentBJ( GetTriggerUnit(), 100.00 )
call SetUnitManaPercentBJ( GetTriggerUnit(), 100.00 )
set other = CreateCorpseLocBJ( 'U00A', Player(12), loc )
set loc = null
set other = null
endfunction
function Is_Elevator takes nothing returns boolean
local integer dType = GetDestructableTypeId(GetFilterDestructable())
//call BJDebugMsg("Is it an elevator?")
return ( dType == 'DTrx' )
endfunction
function Trig_Final_Boss_Down_Message takes integer num returns nothing
if( num == 1 ) then
call GlobalMessage("|cffff0000The Judicator has been slain" )
endif
if( num == 2 ) then
call GlobalMessage("|cffff0000Sephiroth has been slain" )
endif
if( num == 3 ) then
call GlobalMessage("|cffff0000The Twin Faeries have been slain" )
endif
if( num == 4 ) then
call GlobalMessage("|cffff0000The Skeletal Watcher has been slain" )
endif
call GlobalMessage(" Prepare for PvP!")
endfunction
function Trig_Final_Boss_Down takes integer num returns nothing
// this method is called when someone finishes off a boss fight
// num should be from 0-3, 0 for judicator, 3 for warden
local integer portT = H2I(CreateTimer())
call Trig_Final_Boss_Down_Message(num+1)
call PolledWait(5.0)
call TriggerExecute( gg_trg_PvP )
//call GlobalMessage("...Preparing to teleport you to the PvP arena in 5 seconds...")
//call GlobalMessage("..... type -pvprules to learn more about the PvP arena ....." )
endfunction
function Trig_Boss_Reset_Ping takes integer bossNum returns nothing
if( bossNum == 0 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX( gg_rct_End1 ), GetRectCenterY( gg_rct_End1 ), 2.0 )
call GlobalMessage("The Judicator has been reset and can be re-entered" )
endif
if( bossNum == 1 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX( gg_rct_End2 ), GetRectCenterY( gg_rct_End2 ), 2.0 )
call GlobalMessage("Sephiroth has been reset and can be re-entered" )
endif
if( bossNum == 2 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX( gg_rct_End3 ), GetRectCenterY( gg_rct_End3 ), 2.0 )
call GlobalMessage("The Twin Faeries have been reset and can be re-entered" )
endif
if( bossNum == 3 ) then
call PingMinimapForForce( GetPlayersAll(), GetRectCenterX( gg_rct_End4 ), GetRectCenterY( gg_rct_End4 ), 2.0 )
call GlobalMessage("The Skeletal Watcher has been reset and can be re-entered" )
endif
endfunction
function Trig_AwardBuff takes integer teamnum, integer boss returns nothing
// expecting teamnum == 0-3
// expecting boss to be 0-4
// 0 - Ice Spider
// 1 - Faeries
// 2 - Judicator
// 3 - Warden
// 4 - Sephiroth
if( teamnum == 0 ) then
set udg_team1buffs[boss] = true
endif
if( teamnum == 1 ) then
set udg_team2buffs[boss] = true
endif
if( teamnum == 2 ) then
set udg_team3buffs[boss] = true
endif
if( teamnum == 3 ) then
set udg_team4buffs[boss] = true
endif
endfunction
// ================= END FINAL BOSS FUNCTIONS
// =======================================================================
// =======================================================================
// =================== GRAVEYARD REVIVE CALLBACK
// == Located Here so that the PvP code can call it
function Trig_GY_theRevive takes nothing returns nothing
// Loop through the heroes
local integer i = 0
local integer loopEnd = 7
local location loc
//call BJDebugMsg("reviving heroes")
loop
exitwhen i > loopEnd
//if( udg_debugMode ) then
// if( GetLocalPlayer() == Player(0) ) then
// call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "Hero " + I2S(i+1) + " is " + GetUnitName(udg_theHeroes[i]))
// endif
//endif
if( IsUnitDeadBJ(udg_theHeroes[i]) and (udg_theHeroes[i] != null) and udg_heroCanRez[i] ) then
//call BJDebugMsg("Reviving hero for player " + I2S(i) )
//if( udg_debugMode ) then
// if( GetLocalPlayer() == Player(0) ) then
// call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "+++ Rezzing hero for Player " + I2S(i+1))
// endif
//endif
set loc = peekStack( theGYs[i/2] )
//call PingMinimap( GetLocationX(loc), GetLocationY(loc), 3.0 )
call ReviveHeroLoc( udg_theHeroes[i], loc, true )
call SetUnitManaPercentBJ( udg_theHeroes[i], 75.0 )
if( not udg_deathbypvp[i] ) then
call SetUnitManaPercentBJ( udg_theHeroes[i], 25.0 )
call SetUnitLifePercentBJ( udg_theHeroes[i], 50.0 )
endif
//set udg_heroCanRez[i] = false // set it instead at hero death!!
call PanCameraToTimedLocForPlayer( GetOwningPlayer(udg_theHeroes[i]), loc, 1.0 )
set udg_deathbypvp[i] = false
set loc = null
endif
set i = i+1
endloop
set loc = null
endfunction
// =======================================================================
// =======================================================================
// Hand it a Hero Type, it hands back what slot in the array it is
function Trig_ClearOutUnused_TypeToInt takes integer typeId returns integer
local integer i = 0
loop
exitwhen i > 13
if( typeId == herotype[i] ) then
return i // scour our TypeID array searching for it
endif
set i = i + 1
endloop
return -1
endfunction
// =======================================================================
// =============== Standard Mode - Forced Pick Callback etc.====================
function Trig_ForcedPick_GetRandom takes nothing returns integer
local integer i = GetRandomInt(0,13)
if( i == 0 ) then
return 'H001'
endif
if( i == 1 ) then
return 'H008'
endif
if( i == 2 ) then
return 'O004'
endif
if( i == 3 ) then
return 'H000'
endif
if( i == 4 ) then
return 'H00A'
endif
if( i == 5 ) then
return 'H007'
endif
if( i == 6 ) then
return 'U001'
endif
if( i == 7 ) then
return 'N00X'
endif
if( i == 8 ) then
return 'N00W'
endif
if( i == 9 ) then
return 'E001'
endif
if( i == 10 ) then
return 'E000'
endif
if( i == 11 ) then
return 'E002'
endif
if( i == 12 ) then
return 'O006'
endif
return 'N00D'
endfunction
function Trig_ForcedPick_Random takes integer plyr returns nothing
local integer heroTypeID = Trig_ForcedPick_GetRandom()
local rect makeItHere = gg_rct_1Selector
local integer o
if( ModuloInteger(plyr,2) == 0 ) then
set o = plyr + 1
else
set o = plyr -1
endif
if( plyr == 2 or plyr == 3 ) then
set makeItHere = gg_rct_2Selector
endif
if( plyr == 4 or plyr == 5 ) then
set makeItHere = gg_rct_3Selector
endif
if( plyr == 6 or plyr == 7 ) then
set makeItHere = gg_rct_4Selector
endif
set udg_theHeroes[plyr] = CreateUnit( Player(plyr), heroTypeID, GetRectCenterX(makeItHere), GetRectCenterY(makeItHere), 0.0 )
call AdjustPlayerStateBJ( -1, GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER )
call RemoveUnit(udg_cops[plyr])
call SetPlayerTechMaxAllowed( Player(o), heroTypeID, 0 )
set udg_didRandom[plyr] = true
// *************** Multiboard **************
call MultiboardSetItemValueBJ( udg_theMultiboard, 1, ( plyr + 2 ), ( udg_playerColorCodes[( plyr )] + (GetPlayerName(Player(plyr))) + "|r" ) )
call MultiboardSetItemIconBJ( udg_theMultiboard, 1, ( plyr + 2 ), udg_heroIconNames[GetUnitPointValue(udg_theHeroes[plyr])] )
set makeItHere = null
endfunction
function Trig_ForcedPick_GetRect takes integer i returns rect
if( i < 2 ) then
return gg_rct_PvEStart1
endif
if( i == 2 or i == 3 ) then
return gg_rct_PvEStart2
endif
if( i == 4 or i == 5 ) then
return gg_rct_PvEStart3
endif
return gg_rct_PvEStart4
endfunction
function Trig_ForcedPick_Callback takes nothing returns nothing
local integer t = H2I(udg_stdForcePickTimer)
local timerdialog td = GetHandleTimerDialog(I2Timer(t), "td")
local integer i = 0
local rect portHere
local item it
call DestroyTimerDialog(td)
// we need to loop through each player, if they have no hero, fix that
// then loop again, and port all heroes
// disable -random, -repick
// reward those who have randomed
loop
exitwhen i > 7
if( udg_theHeroes[i] == null and ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING )) then
// give them a hero
call Trig_ForcedPick_Random(i)
endif
set i = i + 1
endloop
// teleport heroes, and give them bandages and water
set i = 0
loop
exitwhen i > 7
set portHere = Trig_ForcedPick_GetRect(i)
call SetUnitX(udg_theHeroes[i], GetRectCenterX(portHere))
call SetUnitY(udg_theHeroes[i], GetRectCenterY(portHere))
set it = UnitAddItemById(udg_theHeroes[i], 'I001' )
set it = UnitAddItemById(udg_theHeroes[i], 'I000' )
call UnitResetCooldown( udg_theHeroes[i] )
set i = i + 1
endloop
// clean up some triggers...also disables repick and random
call TriggerExecute( gg_trg_CleanUpBeg )
// now reward those with random
set i = 0
loop
exitwhen i > 7
if( udg_didRandom[i] ) then
set it = CreateItem( 'I01G', GetUnitX(udg_theHeroes[i]), GetUnitY(udg_theHeroes[i]))
call UnitAddItem( udg_theHeroes[i], it )
endif
set i = i + 1
endloop
// okay, now we clean up unused heroes
call TriggerExecute( gg_trg_ClearOutUnused )
call TriggerExecute( gg_trg_GY_Setup )
// Finally, set up our triggers for the Bearmancer and Death Eater so they will kill summons when they die
call TriggerExecute( gg_trg_SetUpBearDE )
call CleanTimer(I2Timer(t))
set it = null
set portHere = null
set td = null
endfunction
function Trig_Scotts_Weapons_CheckBuff takes unit u, integer b returns boolean
return ( GetUnitAbilityLevel(u, b) > 0 )
endfunction
// =======================================================================
// =======================================================================
Name | Type | is_array | initial_value |
aUnitGroup | group | No | |
bossDown | boolean | No | |
BuffCount | integer | No | |
cineCurTrig | trigger | No | |
cineTimer | timer | No | |
cops | unit | Yes | |
deathbypvp | boolean | Yes | |
debugMode | boolean | No | |
didRandom | boolean | Yes | |
faerieReset | integer | No | |
faeriesDown | boolean | No | |
faerieTrees | destructable | Yes | |
finalBossEntrances | location | Yes | |
forestDead | boolean | No | |
frostDead | boolean | No | |
Golems | rect | Yes | |
GYRects | rect | Yes | |
gyRezTimer | timer | No | |
gyRezWindow | timerdialog | No | |
Hero_Array | unitcode | Yes | |
heroCanRez | boolean | Yes | |
heroIconNames | string | Yes | |
heroKills | integer | Yes | |
heroRezDelay | real | No | 10.00 |
highestLevelTower | integer | Yes | |
isSinglePlayer | boolean | No | true |
isStandardMode | boolean | No | |
miniBossEntrances | location | Yes | |
numRepicks | integer | Yes | 2 |
numTowers | integer | Yes | |
playerColorCodes | string | Yes | |
playerIsReady | boolean | Yes | |
proTips | string | Yes | |
proTipsCount | integer | No | 19 |
proTipsOff | boolean | Yes | |
pvpAfterFirstTower | boolean | No | true |
pvpEndTimer | timer | No | |
pvpMeteorsT | timer | No | |
pvpRezTimer | timer | No | |
pvpRezWindow | timerdialog | No | |
pvpRuneTimer | timer | No | |
pvpStartMeteorsT | timer | No | |
Sandboxes | rect | Yes | |
sephirothDown | boolean | No | |
snowRain | weathereffect | No | |
stdForcePickTimer | timer | No | |
tavs | unit | Yes | |
team1buffs | boolean | Yes | |
team2buffs | boolean | Yes | |
team3buffs | boolean | Yes | |
team4buffs | boolean | Yes | |
theHeroes | unit | Yes | |
theMultiboard | multiboard | No | |
Total_Heroes | integer | No | |
towerTaken | boolean | No | false |
wardenReset | integer | No | |
zzRweaf | real | No | |
zzzUnit | unit | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Welcome_Actions takes nothing returns nothing
call GlobalMessage("*** Welcome To The Fungeon! ***" )
call GlobalMessage("")
call GlobalMessage("Currently you are in 'Free-Play' mode. Feel free to repick heroes and try them out in the sandbox as well as the sandbox-pvp arena!")
call GlobalMessage("")
call GlobalMessage("-standard will begin standard play in the Fungeon, where the goal is to get to the end to defeat one of the Four Bosses")
call GlobalMessage("After the defeat of a boss, 2v2v2v2 PvP will begin in the PvP arena, so be prepared, and good luck")
call GlobalMessage("")
endfunction
//===========================================================================
function InitTrig_Welcome takes nothing returns nothing
set gg_trg_Welcome = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Welcome, 10.0 )
call TriggerAddAction( gg_trg_Welcome, function Trig_Welcome_Actions )
call DisableTrigger( gg_trg_Welcome )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Initialization_Actions takes nothing returns nothing
// these are the triggers to run on execution
// == the Array Initializations is assumed to run on "Map Initialization"
// == i don't know if this causes it to load DURING the map loading screen...
// == run the Time And Sight Triggers
call TriggerExecute( gg_trg_Time_and_Sight )
call TriggerExecute( gg_trg_GenerateCops )
call TriggerExecute( gg_trg_ItemPool1 )
//call TriggerExecute( gg_trg_CineSetup ) runs now at elapsed game time = 0.00 secnods
endfunction
//===========================================================================
function InitTrig_Initialization takes nothing returns nothing
set gg_trg_Initialization = CreateTrigger( )
call TriggerAddAction( gg_trg_Initialization, function Trig_Initialization_Actions )
endfunction
//TESH.scrollpos=237
//TESH.alwaysfold=0
function Trig_Hero_Array_Func001A takes nothing returns nothing
call SetPlayerStateBJ( GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD, 0 )
call SetPlayerStateBJ( GetEnumPlayer(), PLAYER_STATE_RESOURCE_LUMBER, 1 )
call SetPlayerStateBJ( GetEnumPlayer(), PLAYER_STATE_RESOURCE_FOOD_CAP, 5 )
endfunction
function Trig_InitElevators takes nothing returns nothing
call ChangeElevatorHeight( GetEnumDestructable(), 1 )
call ChangeElevatorWalls( true, bj_ELEVATOR_WALL_TYPE_ALL, GetEnumDestructable() )
endfunction
function Trig_Hero_Array_Actions takes nothing returns nothing
local location loc
local integer i = 0
local integer loopEnd = 0
call ForForce( GetPlayersAll(), function Trig_Hero_Array_Func001A )
set udg_Total_Heroes = 14
set udg_Hero_Array[0] = 'H001'
set udg_Hero_Array[1] = 'H008'
set udg_Hero_Array[2] = 'O004'
set udg_Hero_Array[3] = 'H000'
set udg_Hero_Array[4] = 'H00A'
set udg_Hero_Array[5] = 'H007'
set udg_Hero_Array[6] = 'U001'
set udg_Hero_Array[7] = 'N00X'
set udg_Hero_Array[8] = 'N00W'
set udg_Hero_Array[9] = 'E001'
set udg_Hero_Array[10] = 'E000'
set udg_Hero_Array[11] = 'E002'
set udg_Hero_Array[12] = 'O006'
set udg_Hero_Array[13] = 'N00D'
set udg_heroIconNames[0] = "ReplaceableTextures\\CommandButtons\\BTNHeroPaladin.blp"
set udg_heroIconNames[1] = "ReplaceableTextures\\CommandButtons\\BTNBloodelfPhoenixGuard.blp"
set udg_heroIconNames[2] = "ReplaceableTextures\\CommandButtons\\BTNProudmoore.blp"
set udg_heroIconNames[3] = "ReplaceableTextures\\CommandButtons\\BTNIceCrownOverlord.blp"
set udg_heroIconNames[4] = "ReplaceableTextures\\CommandButtons\\BTNWarMage.blp"
set udg_heroIconNames[5] = "ReplaceableTextures\\CommandButtons\\BTNSylvanusWindrunner.blp"
set udg_heroIconNames[6] = "ReplaceableTextures\\CommandButtons\\BTN_Dark_Sorcerer.blp"
set udg_heroIconNames[7] = "ReplaceableTextures\\CommandButtons\\BTNEwok.blp"
set udg_heroIconNames[8] = "ReplaceableTextures\\CommandButtons\\BTNBansheeRanger.blp"
set udg_heroIconNames[9] = "ReplaceableTextures\\CommandButtons\\BTNSpiritWalker.blp"
set udg_heroIconNames[10] = "ReplaceableTextures\\CommandButtons\\BTNTaurenMarine.blp"
set udg_heroIconNames[11] = "ReplaceableTextures\\CommandButtons\\BTNHeroDemonHunter.blp"
set udg_heroIconNames[12] = "ReplaceableTextures\\CommandButtons\\BTNPriest.blp"
set udg_heroIconNames[13] = "ReplaceableTextures\\CommandButtons\\BTNSpellBreaker.blp"
set udg_playerColorCodes[0] = "|caaFF0000"
set udg_playerColorCodes[1] = "|caa0000FF"
set udg_playerColorCodes[2] = "|caa00F3F3"
set udg_playerColorCodes[3] = "|caa8000FF"
set udg_playerColorCodes[4] = "|caaFFFF00"
set udg_playerColorCodes[5] = "|caaFF8000"
set udg_playerColorCodes[6] = "|caa00FF00"
set udg_playerColorCodes[7] = "|caaFF80FF"
// == Region Arrays ===
set udg_Sandboxes[0] = gg_rct_Sandbox1
set udg_Sandboxes[1] = gg_rct_Sandbox2
set udg_Sandboxes[2] = gg_rct_Sandbox3
set udg_Sandboxes[3] = gg_rct_Sandbox4
set loopEnd = 3
loop
exitwhen i > loopEnd
set theGYs[i] = locStack.create()
set i = i + 1
endloop
set i = 0
set loopEnd = 11
loop
exitwhen i > loopEnd
set theGens[i] = GenData.create()
set i = i + 1
endloop
// Initialize the Gravyeard stacks with the Entrances...
set loc = GetRectCenter(gg_rct_PvEStart1)
call pushStack(theGYs[0], loc)
set loc = GetRectCenter(gg_rct_PvEStart2)
call pushStack(theGYs[1], loc)
set loc = GetRectCenter(gg_rct_PvEStart3)
call pushStack(theGYs[2], loc)
set loc = GetRectCenter(gg_rct_PvEStart4)
call pushStack(theGYs[3], loc)
set loc = null
set udg_GYRects[0] = gg_rct_GY1
set udg_GYRects[1] = gg_rct_GY2
set udg_GYRects[2] = gg_rct_GY3
set udg_GYRects[3] = gg_rct_GY4
set udg_GYRects[4] = gg_rct_GY5
set udg_GYRects[5] = gg_rct_GY6
set udg_GYRects[6] = gg_rct_GY7
//set udg_GYRects[7] = gg_rct_GY8
// all the Location initializions are localized here (unlikely to change)
set theGens[0].make = GetRectCenter( gg_rct_MakeGen0 )
set theGens[0].rally = GetRectCenter( gg_rct_Generator0 )
set theGens[1].make = GetRectCenter( gg_rct_MakeGen1 )
set theGens[1].rally = GetRectCenter( gg_rct_Generator1 )
set theGens[2].make = GetRectCenter( gg_rct_MakeGen2 )
set theGens[2].rally = GetRectCenter( gg_rct_Generator2 )
set theGens[3].make = GetRectCenter( gg_rct_MakeGen3 )
set theGens[3].rally = GetRectCenter( gg_rct_Generator3 )
set theGens[4].make = GetRectCenter( gg_rct_MakeGen4 )
set theGens[4].rally = GetRectCenter( gg_rct_Generator4 )
set theGens[5].make = GetRectCenter( gg_rct_MakeGen5 )
set theGens[5].rally = GetRectCenter( gg_rct_Generator5 )
set theGens[6].make = GetRectCenter( gg_rct_MakeGen6 )
set theGens[6].rally = GetRectCenter( gg_rct_Generator6 )
set theGens[7].make = GetRectCenter( gg_rct_MakeGen7 )
set theGens[7].rally = GetRectCenter( gg_rct_Generator7 )
set theGens[8].make = GetRectCenter( gg_rct_MakeGen8 )
set theGens[8].rally = GetRectCenter( gg_rct_Generator8 )
set theGens[9].make = GetRectCenter( gg_rct_MakeGen9 )
set theGens[9].rally = GetRectCenter( gg_rct_Generator9 )
set theGens[10].make = GetRectCenter( gg_rct_MakeGen10 )
set theGens[10].rally = GetRectCenter( gg_rct_Generator10 )
set theGens[11].make = GetRectCenter( gg_rct_MakeGen11 )
set theGens[11].rally = GetRectCenter( gg_rct_Generator11 )
// all the Unit-ID initializations are localized here (likely to change)
set i = 0
set loopEnd = 3
// make the first 4 generators all Ghouls with Pit's
loop
exitwhen i > loopEnd
set theGens[i].building = 'u00D' // Pit
set theGens[i].spawn = 'u00C' // Ghoul
set i = i + 1
endloop
set i = 4
set loopEnd = 6
loop
exitwhen i > loopEnd
set theGens[i].building = 'n00A' // Ogre Farm
set theGens[i].spawn = 'n001' // Ogre Lord
set i = i + 1
endloop
set i = 7
set loopEnd = 11
loop
exitwhen i > loopEnd
set theGens[i].building = 'u006' // Pit -- Level 2
set theGens[i].spawn = 'u00G' // Ghoul -- Level 2 --
set i = i + 1
endloop
// see below...same thing --- NOTE: THESE ARE IN THE MINIBOSS ARENA!
set udg_miniBossEntrances[0] = GetRectCenter( gg_rct_MiniArena1 )
set udg_miniBossEntrances[1] = GetRectCenter( gg_rct_MiniArena2 )
// a more "OO"-style way (using arrays lulz) to get the proper entrance
set udg_finalBossEntrances[0] = GetRectCenter( gg_rct_FinalE1 )
set udg_finalBossEntrances[1] = GetRectCenter( gg_rct_FinalE2 )
set udg_finalBossEntrances[2] = GetRectCenter( gg_rct_FinalE3 )
set udg_finalBossEntrances[3] = GetRectCenter( gg_rct_FinalE4 )
// this is a nice generic way to get the rectangle that contains the entire arena for the boss fights
// == was originally to be used with a 'same fight for all' type of setup, but it could be useful still ==
set finalboss[0] = gg_rct_FinalBoss1
set finalboss[1] = gg_rct_FinalBoss2
set finalboss[2] = gg_rct_FinalBoss3
set finalboss[3] = gg_rct_FinalBoss4
// simple way to get get the rectangle for the starting position of each team
set FinalPVP[0] = GetRectCenter( gg_rct_FinalPVP1 )
set FinalPVP[1] = GetRectCenter( gg_rct_FinalPVP2 )
set FinalPVP[2] = GetRectCenter( gg_rct_FinalPVP3 )
set FinalPVP[3] = GetRectCenter( gg_rct_FinalPVP4 )
// simply sets all the elevators/walls to the proper "usable" state for the Judicator
call EnumDestructablesInRectAll( gg_rct_FinalBoss1, function Trig_InitElevators )
set pvpgates[0] = gg_dest_LTe1_2667
set pvpgates[1] = gg_dest_LTe3_2665
set pvpgates[2] = gg_dest_LTe1_2668
set pvpgates[3] = gg_dest_LTe3_2666
set runespawn[0] = GetRectCenter( gg_rct_RuneSpawn0 )
set runespawn[1] = GetRectCenter( gg_rct_RuneSpawn1 )
set runespawn[2] = GetRectCenter( gg_rct_RuneSpawn2 )
set runespawn[3] = GetRectCenter( gg_rct_RuneSpawn3 )
set runespawn[4] = GetRectCenter( gg_rct_RuneSpawn4 )
set bossentrances[0] = GetRectCenter( gg_rct_End1 )
set bossentrances[1] = GetRectCenter( gg_rct_End2 )
set bossentrances[2] = GetRectCenter( gg_rct_End3 )
set bossentrances[3] = GetRectCenter( gg_rct_End4 )
set minibossentrances[0] = GetRectCenter( gg_rct_Miniboss1 )
set minibossentrances[1] = GetRectCenter( gg_rct_Miniboss2 )
// == run the setup trigger to create all the little triggers for move detections for Xtreme
call TriggerExecute( gg_trg_Aura_Switch )
// init our portal arrays for sight radius
set portLocs[0] = GetRectCenter( gg_rct_TPEndBR )
set portLocs[1] = GetRectCenter( gg_rct_TPEndTR )
set portLocs[2] = GetRectCenter( gg_rct_TPEndBL )
set portLocs[3] = GetRectCenter( gg_rct_TPEndTL )
set shopLocs[0] = GetRectCenter( gg_rct_Shop0 )
set shopLocs[1] = GetRectCenter( gg_rct_Shop1 )
set shopLocs[2] = GetRectCenter( gg_rct_Shop2 )
set startLocs[0] = GetRectCenter( gg_rct_PvEStart1 )
set startLocs[1] = GetRectCenter( gg_rct_PvEStart2 )
set startLocs[2] = GetRectCenter( gg_rct_PvEStart3 )
set startLocs[3] = GetRectCenter( gg_rct_PvEStart4 )
set selectorLocs[0] = GetRectCenter( gg_rct_1Selector )
set selectorLocs[1] = GetRectCenter( gg_rct_2Selector )
set selectorLocs[2] = GetRectCenter( gg_rct_3Selector )
set selectorLocs[3] = GetRectCenter( gg_rct_4Selector )
set pvptowers[0] = GetRectCenter( gg_rct_PVPT11 )
set pvptowers[1] = GetRectCenter( gg_rct_PVPT12 )
set pvptowers[2] = GetRectCenter( gg_rct_PVPT21 )
set pvptowers[3] = GetRectCenter( gg_rct_PVPT22 )
set pvptowers[4] = GetRectCenter( gg_rct_PVPT31 )
set pvptowers[5] = GetRectCenter( gg_rct_PVPT32 )
set pvptowers[6] = GetRectCenter( gg_rct_PVPT41 )
set pvptowers[7] = GetRectCenter( gg_rct_PVPT42 )
set udg_numTowers[0] = 0
set udg_numTowers[1] = 0
set udg_numTowers[2] = 0
set udg_numTowers[3] = 0
// so I am an idiot and this is replication. whoops.
set herotype[0] = 'H001' // templar
set herotype[1] = 'H008' // elementalist
set herotype[2] = 'O004' // ice king
set herotype[3] = 'H000' // battle mage
set herotype[4] = 'H00A' // paladin
set herotype[5] = 'H007' // trapper
set herotype[6] = 'U001' // XD
set herotype[7] = 'N00X' // Bear mancer
set herotype[8] = 'N00W' // Death Eater
set herotype[9] = 'E001' // keeper
set herotype[10] = 'E000' // ranger
set herotype[11] = 'E002' // dismantler
set herotype[12] = 'O006' // Agent of Light
set herotype[13] = 'N00D' // Mystic
set udg_proTips[0] = "|caaffff00PRO TIP|r: For Every Boss Downed in the Fungeon, you will receive a powerful Rune in the PvP Arena."
set udg_proTips[1] = "|caaffff00PRO TIP|r: Anytime a Boss is downed, PvP in the Arena will begin."
set udg_proTips[2] = "|caaffff00PRO TIP|r: In order to advance in the Fungeon, one of the three bosses near the end must be downed."
set udg_proTips[3] = "|caaffff00PRO TIP|r: Killing a GY Tower will make it yours. Type '-gy' to get a ping of all possible Towers"
set udg_proTips[4] = "|caaffff00PRO TIP|r: The Boots will not stack with each other, and the Orb Effect Items will not stack either."
set udg_proTips[5] = "|caaffff00PRO TIP|r: When fighting the Fungeon Master, he will demand a sacrifice. He will be relentless in his assault on the weak."
set udg_proTips[6] = "|caaffff00PRO TIP|r: When the Warden Screams, be sure to be on the lookout, for she will surely wreck all of those |cffff0000Around|r her."
set udg_proTips[7] = "|caaffff00PRO TIP|r: When fighting the Judicator, be sure to avoid the lighted platforms. You will understand in time."
set udg_proTips[8] = "|caaffff00PRO TIP|r: One of the Twin Faeries will resist physical attacks, the other magical attacks. When the faeries are joined, they will heal."
set udg_proTips[9] = "|caaffff00PRO TIP|r: If you are Level 10, you will receive Gold anytime you kill an enemy hero, proportional to their level."
set udg_proTips[10] = "|caaffff00PRO TIP|r: You can turn these tips on or off by typing '-tips'"
set udg_proTips[11] = "|caaffff00PRO TIP|r: The Objective of the Fungeon is to win in the Final Bout of PvP, initiated with the death of the Fungeon Master."
set udg_proTips[12] = "|caaffff00PRO TIP|r: Always tip your waiter or waitress 15%-20%."
set udg_proTips[13] = "|caaffff00PRO TIP|r: Type -ready to declare yourself ready in the beginning of the game, allowing the game to proceed faster."
set udg_proTips[14] = "|caaffff00PRO TIP|r: Look up words you don't know in the dictionary."
set udg_proTips[15] = "|caaffff00PRO TIP|r: Select Map Info at the top to see all these tips, and additional information about...well...the map...yeah."
set udg_proTips[16] = "|caaffff00PRO TIP|r: Type -help to get a listing of helper commands."
set udg_proTips[17] = "|caaffff00PRO TIP|r: When you die, you are unable to Rez for at least 10 seconds, regardless of the Countdown Timer"
set udg_proTips[18] = "|cafffff00PRO TIP|r: The level of a GY Tower you take is equal to the number of towers you own + 1."
//set udg_proTips[11]
endfunction
//===========================================================================
function InitTrig_Array_Initializations takes nothing returns nothing
set gg_trg_Array_Initializations = CreateTrigger( )
call TriggerAddAction( gg_trg_Array_Initializations, function Trig_Hero_Array_Actions )
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call AddUnitToStockBJ( 'hfoo', GetTriggerUnit(), 0, 1 )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Time_and_Sight_Actions takes nothing returns nothing
local integer i = 0
local integer j = 0
local integer loopEnd = 7
local real genRadius = 400
local real x
local real y
local fogmodifier fog
local location loc
call SetTimeOfDay( 12.00 )
call PolledWait(2.0)
set i = 0
loop
exitwhen i > loopEnd
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_FreePVPArena, true, false )
call FogModifierStart(fog)
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_AllSand, true, false )
call FogModifierStart(fog)
set i = i + 1
endloop
// now we will create the little visibility pockets at the following locations
// towers, portals, spideys, bosses, shops
// towers
set i = 0
loop
exitwhen i > loopEnd
set j = 0
loop
exitwhen j > 7
set x = GetRectCenterX( udg_GYRects[j] )
set y = GetRectCenterY( udg_GYRects[j] )
set fog = CreateFogModifierRadius( Player(i), FOG_OF_WAR_VISIBLE, x, y, genRadius, true, false )
call FogModifierStart( fog )
set j = j + 1
endloop
set i = i + 1
endloop
// portals
set i = 0
loop
exitwhen i > loopEnd
set j = 0
loop
exitwhen j > 4
set x = GetLocationX( portLocs[j] )
set y = GetLocationY( portLocs[j] )
set fog = CreateFogModifierRadius( Player(i), FOG_OF_WAR_VISIBLE, x, y, genRadius, true, false )
call FogModifierStart( fog )
set j = j + 1
endloop
set i = i + 1
endloop
// spider entrances
set i = 0
loop
exitwhen i > loopEnd
set j = 0
loop
exitwhen j > 1
set x = GetLocationX( minibossentrances[j] )
set y = GetLocationY( minibossentrances[j] )
set fog = CreateFogModifierRadius( Player(i), FOG_OF_WAR_VISIBLE, x, y, genRadius, true, false )
call FogModifierStart( fog )
set j = j + 1
endloop
set i = i + 1
endloop
// boss entrances
set i = 0
loop
exitwhen i > loopEnd
set j = 0
loop
exitwhen j > 3
set x = GetLocationX( bossentrances[j] )
set y = GetLocationY( bossentrances[j] )
set fog = CreateFogModifierRadius( Player(i), FOG_OF_WAR_VISIBLE, x, y, genRadius, true, false )
call FogModifierStart( fog )
set j = j + 1
endloop
set i = i + 1
endloop
// shops
set i = 0
loop
exitwhen i > loopEnd
set j = 0
loop
exitwhen j > 2
set x = GetLocationX( shopLocs[j] )
set y = GetLocationY( shopLocs[j] )
set fog = CreateFogModifierRadius( Player(i), FOG_OF_WAR_VISIBLE, x, y, genRadius, true, false )
call FogModifierStart( fog )
set j = j + 1
endloop
set i = i + 1
endloop
// start location
set i = 0
loop
exitwhen i > loopEnd
set j = 0
loop
exitwhen j > 4
set x = GetLocationX( startLocs[j] )
set y = GetLocationY( startLocs[j] )
set fog = CreateFogModifierRadius( Player(i), FOG_OF_WAR_VISIBLE, x, y, genRadius, true, false )
call FogModifierStart( fog )
set j = j + 1
endloop
set i = i + 1
endloop
set i = 0
loop
exitwhen i > loopEnd
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_Spider1, true, false )
call FogModifierStart( fog )
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_Spider2, true, false )
call FogModifierStart( fog )
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_FinalBoss1, true, false )
call FogModifierStart( fog )
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_FinalBoss2, true, false )
call FogModifierStart( fog )
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_FinalBoss3, true, false )
call FogModifierStart( fog )
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_FinalBoss4, true, false )
call FogModifierStart( fog )
set fog = CreateFogModifierRect( Player(i), FOG_OF_WAR_VISIBLE, gg_rct_PvPArenaA, true, false )
call FogModifierStart( fog )
set i = i + 1
endloop
set fog = null
call SuspendTimeOfDay(true)
endfunction
//===========================================================================
function InitTrig_Time_and_Sight takes nothing returns nothing
set gg_trg_Time_and_Sight = CreateTrigger( )
call TriggerAddAction( gg_trg_Time_and_Sight, function Trig_Time_and_Sight_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Hero_Revival12_Copy_Conditions takes nothing returns boolean
if ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false ) then
return false
endif
if ( GetPlayerId(GetOwningPlayer(GetTriggerUnit())) < 8 ) then
return true
endif
return false
endfunction
function Trig_Hero_Revival12_Copy_Actions takes nothing returns nothing
local unit theHero = GetDyingUnit()
local rect reviveHere = gg_rct_1Selector
local integer plyr = GetConvertedPlayerId(GetOwningPlayer(theHero))
if ( plyr < 3 ) then
set reviveHere = gg_rct_1Selector
endif
if ( plyr == 3 or plyr == 4 ) then
set reviveHere = gg_rct_2Selector
endif
if ( plyr == 5 or plyr == 6 ) then
set reviveHere = gg_rct_3Selector
endif
if ( plyr == 7 or plyr == 8 ) then
set reviveHere = gg_rct_4Selector
endif
call ReviveHero(theHero, GetRectCenterX(reviveHere), GetRectCenterY(reviveHere), true )
call SetUnitManaPercentBJ( theHero, 50 )
call PanCameraToTimedForPlayer( Player(plyr-1), GetUnitX(theHero), GetUnitY(theHero), 0.5 )
set theHero = null
endfunction
//===========================================================================
function InitTrig_InitRevive takes nothing returns nothing
set gg_trg_InitRevive = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_InitRevive, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_InitRevive, Condition( function Trig_Hero_Revival12_Copy_Conditions ) )
call TriggerAddAction( gg_trg_InitRevive, function Trig_Hero_Revival12_Copy_Actions )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Trig_ToGameScene_ResetCam takes nothing returns nothing
call ResetToGameCameraForPlayer( GetEnumPlayer(), 0 )
endfunction
function Trig_ToGameScene_PanCam takes nothing returns nothing
local integer i = GetPlayerId( GetEnumPlayer() )
local real x = 0
local real y = 0
if( i==0 or i==1 ) then
set x = GetRectCenterX( gg_rct_1Selector )
set y = GetRectCenterY( gg_rct_1Selector )
endif
if( i==2 or i==3 ) then
set x = GetRectCenterX( gg_rct_2Selector )
set y = GetRectCenterY( gg_rct_2Selector )
endif
if( i==4 or i==5 ) then
set x = GetRectCenterX( gg_rct_3Selector )
set y = GetRectCenterY( gg_rct_3Selector )
endif
if( i==6 or i==7 ) then
set x = GetRectCenterX( gg_rct_4Selector )
set y = GetRectCenterY( gg_rct_4Selector )
endif
call PanCameraToTimedForPlayer( GetEnumPlayer(), x, y, 0 )
endfunction
function Trig_ToGameScene_Actions takes nothing returns nothing
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ForForce( GetPlayersAll(), function Trig_ToGameScene_ResetCam )
call SetUserControlForceOn( GetPlayersAll() )
call GlobalMessage("type -help for a listing of help commands")
call GlobalMessage("type -standard to begin")
call CinematicModeBJ( false, GetPlayersAll() )
call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_AMBIENTSOUNDS, 100.00 )
call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_SPELLS, 100.00 )
call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_COMBAT, 100.00 )
call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_FIRE, 100.00 )
call ForForce( GetPlayersAll(), function Trig_ToGameScene_PanCam )
call RemoveUnit( gg_unit_nmed_0023 )
endfunction
//===========================================================================
function InitTrig_ToGameScene takes nothing returns nothing
set gg_trg_ToGameScene = CreateTrigger( )
call TriggerAddAction( gg_trg_ToGameScene, function Trig_ToGameScene_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_PVP_Cheat_Actions takes nothing returns nothing
if( udg_debugMode ) then
call TriggerExecute( gg_trg_PvP )
endif
endfunction
//===========================================================================
function InitTrig_PVP_Cheat takes nothing returns nothing
set gg_trg_PVP_Cheat = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_PVP_Cheat, Player(0), "-pvpcheck", true )
call TriggerAddAction( gg_trg_PVP_Cheat, function Trig_PVP_Cheat_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_checkHeroes_Actions takes nothing returns nothing
local integer i = 0
if( GetLocalPlayer() == Player(0) ) then
loop
exitwhen i > 7
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "Unit " + GetUnitName(udg_theHeroes[i]) + " - Health is: " + R2S(GetUnitState(udg_theHeroes[i], UNIT_STATE_LIFE)))
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "-----------------------------" )
set i = i + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_checkHeroes takes nothing returns nothing
set gg_trg_checkHeroes = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_checkHeroes, Player(0), "-herocheck", true )
call TriggerAddAction( gg_trg_checkHeroes, function Trig_checkHeroes_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_IsSinglePlayer_InstaRezCheat takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
local location loc = peekStack( theGYs[i/2] )
call ReviveHeroLoc( udg_theHeroes[i], loc, true )
call SetUnitLifeBJ(udg_theHeroes[i], 100.0 )
call SetUnitManaBJ(udg_theHeroes[i], 100.0 )
set loc = null
endfunction
function Trig_IsSinglePlayer_MaxLvlCheat takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
call SetHeroLevel( udg_theHeroes[i], 20, true )
endfunction
function Trig_IsSinglePlayer_LvlUpCheat takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
call SetHeroLevel( udg_theHeroes[i], GetHeroLevel(udg_theHeroes[i])+1, true )
endfunction
function Trig_IsSinglePlayer_MakeLvlUpCheat takes integer i returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(i), "-lvlup", true )
call TriggerAddAction( t, function Trig_IsSinglePlayer_LvlUpCheat )
call DisplayTextToForce( GetPlayersAll(), "-lvlup | will level up your Hero by 1 level" )
set t = null
endfunction
function Trig_IsSinglePlayer_MakeRezCheat takes integer i returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(i), "-rez", true )
call TriggerAddAction( t, function Trig_IsSinglePlayer_InstaRezCheat )
call DisplayTextToForce( GetPlayersAll(), "-rez | will attempt to rez your hero if dead" )
set t = null
endfunction
function Trig_IsSinglePlayer_MakeMaxLvlCheat takes integer i returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(i), "-maxlvl", true )
call TriggerAddAction( t, function Trig_IsSinglePlayer_MaxLvlCheat )
call DisplayTextToForce( GetPlayersAll(), "-maxlvl | Levels your hero to the max lvl" )
set t = null
endfunction
function Trig_IsSinglePlayer_MakeCheats takes nothing returns nothing
call Trig_IsSinglePlayer_MakeLvlUpCheat(GetPlayerId(GetTriggerPlayer()))
call Trig_IsSinglePlayer_MakeRezCheat(GetPlayerId(GetTriggerPlayer()))
call Trig_IsSinglePlayer_MakeMaxLvlCheat(GetPlayerId(GetTriggerPlayer()))
endfunction
function Trig_IsSinglePlayer_Actions takes nothing returns nothing
local trigger t
local trigger t2
local integer i = 0
if( bj_isSinglePlayer ) then
call DisplayTextToForce(GetPlayersAll(), " ***** Single Player Mode Detected ***** " )
set t = CreateTrigger()
set t2 = CreateTrigger()
loop
exitwhen i > 7
call TriggerRegisterPlayerChatEvent( t, Player(i), "-enablecheats", true )
set i = i + 1
endloop
call TriggerAddAction( t, function Trig_IsSinglePlayer_MakeCheats )
call DisplayTextToForce(GetPlayersAll(), " ***** Type -enablecheats to Enable Cheats ***** " )
set t = null
endif
endfunction
//===========================================================================
function InitTrig_IsSinglePlayer takes nothing returns nothing
set gg_trg_IsSinglePlayer = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_IsSinglePlayer, 30.00 )
call TriggerAddAction( gg_trg_IsSinglePlayer, function Trig_IsSinglePlayer_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Help_Actions takes nothing returns nothing
local force f = CreateForce()
call ForceAddPlayer( f, GetTriggerPlayer() )
call DisplayTextToForce(f, "==== The Following Commands Can Be Entered At Any Time For Reference ====" )
call DisplayTextToForce(f, "-gyhelp | Explains how the Graveyard System Works" )
call DisplayTextToForce(f, "-gy | Pings on the Minimap the locations of Takeable Graveyard Towers" )
//call DisplayTextToForce(f, "-boss | Pings on the Minimap the locations of the entrances to the Boss Fights (the ultimate goal)" )
call DisplayTextToForce(f, "-pvprules | Explains biefly the odds-and-ends of the Final PvP Arena" )
call DisplayTextToForce(f, "-shop | Pings on the Minimap the locations of the two possibly helpful shops" )
call DestroyForce(f)
set f = null
endfunction
//===========================================================================
function InitTrig_Help takes nothing returns nothing
set gg_trg_Help = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(0), "-help", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(1), "-help", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(2), "-help", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(3), "-help", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(4), "-help", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(5), "-help", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(6), "-help", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Help, Player(7), "-help", true )
call TriggerAddAction( gg_trg_Help, function Trig_Help_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Graveyard_Actions takes nothing returns nothing
local integer i = 0
local force f = CreateForce()
call ForceAddPlayer( f, GetTriggerPlayer() )
call DisplayTextToForce( f, "Graveyard Towers Can Be Found Here. Seizing one will cause you to Resurrect there." )
//call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, "Graveyard Towers Can Be Found Here. Seizing one will cause you to Resurrect there.")
loop
exitwhen i > 7
call PingMinimapForPlayer( GetTriggerPlayer(), GetRectCenterX(udg_GYRects[i]), GetRectCenterY(udg_GYRects[i]), 3.0 )
set i = i + 1
endloop
call DestroyForce(f)
set f = null
endfunction
//===========================================================================
function InitTrig_Graveyard_Ping takes nothing returns nothing
set gg_trg_Graveyard_Ping = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(0), "-gy", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(1), "-gy", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(2), "-gy", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(3), "-gy", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(4), "-gy", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(5), "-gy", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(6), "-gy", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Ping, Player(7), "-gy", true )
call TriggerAddAction( gg_trg_Graveyard_Ping, function Trig_Graveyard_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Graveyard_Expl_Actions takes nothing returns nothing
local force f = CreateForce()
call ForceAddPlayer( f, GetTriggerPlayer() )
call DisplayTextToForce( f, "+++ The Graveyards work as follows: " )
call DisplayTextToForce( f, "+++ Every person owns certain graveyards, all of which can be taken by other players" )
call DisplayTextToForce( f, "+++ (except of course of your starting location)" )
call DisplayTextToForce( f, "+++ At the global resurrect time, all dead players will resurrect at the LAST graveyard they took that they still control" )
call DisplayTextToForce( f, "+++ You will not Rez unless you have been dead for at least 10 seconds." )
call DisplayTextToForce( f, "+++ The Level of a GY Tower you take is equal to the number of GY Towers you had + 1." )
call DestroyForce( f )
set f = null
endfunction
//===========================================================================
function InitTrig_Graveyard_Expl takes nothing returns nothing
set gg_trg_Graveyard_Expl = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(0), "-gyhelp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(1), "-gyhelp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(2), "-gyhelp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(3), "-gyhelp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(4), "-gyhelp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(5), "-gyhelp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(6), "-gyhelp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Graveyard_Expl, Player(7), "-gyhelp", true )
call TriggerAddAction( gg_trg_Graveyard_Expl, function Trig_Graveyard_Expl_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_PVPRules_Actions takes nothing returns nothing
local force f = CreateForce()
call ForceAddPlayer(f, GetTriggerPlayer())
call DisplayTextToForce( f, "---Basic PvP Explanation:" )
call DisplayTextToForce( f, "---PvP Begins whenever a boss is downed in the Fungeon." )
call DisplayTextToForce( f, "---The Goal is to be the last team standing" )
call DisplayTextToForce( f, "---After 3 Minutes, Meteors will fall from the sky, eliminating slackers." )
call DisplayTextToForce( f, "---Runes will randomly appear in certain locations throughout the arena. Use them to your advantage" )
call DestroyForce(f)
set f = null
endfunction
//===========================================================================
function InitTrig_PVPRules takes nothing returns nothing
set gg_trg_PVPRules = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(0), "-pvprules", true )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(1), "-pvprules", true )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(2), "-pvprules", true )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(3), "-pvprules", true )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(4), "-pvprules", true )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(5), "-pvprules", true )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(6), "-pvprules", true )
call TriggerRegisterPlayerChatEvent( gg_trg_PVPRules, Player(7), "-pvprules", true )
call TriggerAddAction( gg_trg_PVPRules, function Trig_PVPRules_Actions )
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
function Trig_Boss_GetString takes integer i returns string
if( i == 0 ) then
return "Here rests the Judicator"
endif
if( i == 1 ) then
return "In the middle left you will find the one called Sephiroth"
endif
if( i == 2 ) then
return "To the right lie the Twin Faeries of the Forest and Frost"
endif
return "Lastly, here you will find the Skeletal Warden"
endfunction
function Trig_Boss_Actions takes nothing returns nothing
local integer i = 0
local force f = CreateForce()
call ForceAddPlayer( f, GetTriggerPlayer() )
loop
exitwhen i > 3
call DisplayTextToForce( f, Trig_Boss_GetString(i) )
call PingMinimapForPlayer( GetTriggerPlayer(), GetLocationX(bossentrances[i]), GetLocationY(bossentrances[i]), 2.0 )
call PolledWait(2.0)
set i = i + 1
endloop
call DisplayTextToForce( f, "..and of course, the mini-bosses, the Ice Spiders" )
call PingMinimapForPlayer( GetTriggerPlayer(), GetRectCenterX(gg_rct_Miniboss1), GetRectCenterY(gg_rct_Miniboss1), 2.0 )
call PingMinimapForPlayer( GetTriggerPlayer(), GetRectCenterX(gg_rct_Miniboss2), GetRectCenterY(gg_rct_Miniboss2), 2.0 )
call DestroyForce( f )
set f = null
endfunction
//===========================================================================
function InitTrig_Boss takes nothing returns nothing
set gg_trg_Boss = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(0), "-boss", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(1), "-boss", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(2), "-boss", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(3), "-boss", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(4), "-boss", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(5), "-boss", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(6), "-boss", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Boss, Player(7), "-boss", true )
call TriggerAddAction( gg_trg_Boss, function Trig_Boss_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Shops_Actions takes nothing returns nothing
local force f = CreateForce()
call ForceAddPlayer(f, GetTriggerPlayer())
call DisplayTextToForce(f, "Shops can be found here and here to purchase possibly useless items." )
call PingMinimapForForce(f, GetRectCenterX(gg_rct_Shop0), GetRectCenterY(gg_rct_Shop0), 2.0)
call PingMinimapForForce(f, GetRectCenterX(gg_rct_Shop1), GetRectCenterY(gg_rct_Shop1), 2.0)
call DestroyForce(f)
set f = null
endfunction
//===========================================================================
function InitTrig_Shops takes nothing returns nothing
set gg_trg_Shops = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(0), "-shop", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(1), "-shop", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(2), "-shop", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(3), "-shop", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(4), "-shop", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(5), "-shop", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(6), "-shop", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Shops, Player(7), "-shop", true )
call TriggerAddAction( gg_trg_Shops, function Trig_Shops_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Movespeed_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
if( GetLocalPlayer() == GetTriggerPlayer() ) then
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, udg_playerColorCodes[i] + GetHeroProperName(udg_theHeroes[i]) + "'s|r movespeed is " + I2S(R2I(GetUnitMoveSpeed(udg_theHeroes[i]))) )
endif
endfunction
//===========================================================================
function InitTrig_Movespeed takes nothing returns nothing
set gg_trg_Movespeed = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(0), "-movespeed", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(1), "-movespeed", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(2), "-movespeed", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(3), "-movespeed", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(4), "-movespeed", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(5), "-movespeed", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(6), "-movespeed", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Movespeed, Player(7), "-movespeed", true )
call TriggerAddAction( gg_trg_Movespeed, function Trig_Movespeed_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Firespark_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A09K' )
endfunction
function Trig_Firespark_Actions takes nothing returns nothing
local unit t = GetSpellTargetUnit()
local unit dummy = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h003', GetUnitX(t), GetUnitY(t), 0 )
call UnitApplyTimedLife( dummy, 'BTLF', 9.0 )
call UnitAddAbility( dummy, 'A09L' )
call IssuePointOrder( dummy, "rainoffire", GetUnitX(t), GetUnitY(t) )
set dummy = null
endfunction
//===========================================================================
function InitTrig_Firespark takes nothing returns nothing
set gg_trg_Firespark = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( gg_trg_Firespark, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_SPELL_EFFECT, null )
call TriggerAddCondition( gg_trg_Firespark, Condition( function Trig_Firespark_Conditions ) )
call TriggerAddAction( gg_trg_Firespark, function Trig_Firespark_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Golem_Conditions takes nothing returns boolean
return (( GetSpellAbilityId() == 'A01L' ) and (GetUnitTypeId(GetTriggerUnit()) == 'n00R'))
endfunction
function Trig_Golem_Filter takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE)) == true )
endfunction
function Trig_Golem_Bolt takes nothing returns nothing
local unit dummy = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h003', GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.0 )
//call BJDebugMsg("Trigger Unit is: " + GetUnitName(GetTriggerUnit()))
call UnitAddAbility( dummy, 'A01M' )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "creepthunderbolt", GetEnumUnit() )
set dummy = null
endfunction
function Trig_Golem_Actions takes nothing returns nothing
local group g = CreateGroup()
local boolexpr filter = Condition(function Trig_Golem_Filter)
local unit dummy = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h003', GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.0 )
call UnitAddAbility( dummy, 'A01N' )
call UnitApplyTimedLife(dummy, 'BTLF', 2.0 )
call IssueImmediateOrder( dummy, "slimemonster" )
//call BJDebugMsg("Blargh go go golems!")
call GroupEnumUnitsInRange( g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 700.0, filter )
call ForGroup( g, function Trig_Golem_Bolt )
call IssueImmediateOrder( GetTriggerUnit(), "slimemonster" )
call DestroyGroup(g)
call DestroyBoolExpr(filter)
set dummy = null
set filter = null
set g = null
endfunction
//===========================================================================
function InitTrig_Golem takes nothing returns nothing
set gg_trg_Golem = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Golem, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Golem, Condition( function Trig_Golem_Conditions ) )
call TriggerAddAction( gg_trg_Golem, function Trig_Golem_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Cleric_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A07G' )
endfunction
function Trig_Cleric_Actions takes nothing returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'h003', GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.0 )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call UnitAddAbility( dummy, 'A07H' )
call IssueTargetOrder( dummy, "faeriefire", GetSpellTargetUnit() )
set dummy = null
endfunction
//===========================================================================
function InitTrig_Cleric takes nothing returns nothing
set gg_trg_Cleric = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Cleric, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Cleric, Condition( function Trig_Cleric_Conditions ) )
call TriggerAddAction( gg_trg_Cleric, function Trig_Cleric_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Egg_Finishes_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A02S' )
endfunction
function Trig_Egg_Finishes_Actions takes nothing returns nothing
local unit egg = GetTriggerUnit()
local unit u = CreateUnit( GetOwningPlayer(egg), 'n00T', GetUnitX(egg), GetUnitY(egg), 0 )
call KillUnit(egg)
set egg = null
set u = null
endfunction
//===========================================================================
function InitTrig_Egg_Finishes takes nothing returns nothing
set gg_trg_Egg_Finishes = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Egg_Finishes, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Egg_Finishes, Condition( function Trig_Egg_Finishes_Conditions ) )
call TriggerAddAction( gg_trg_Egg_Finishes, function Trig_Egg_Finishes_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Miniboss1_Actions takes nothing returns nothing
// now run the the boss script...
call Trig_MiniBossTeleport(0)
call DisableTrigger( GetTriggeringTrigger() )
call TriggerExecute( gg_trg_SpiderBoss1 )
endfunction
//===========================================================================
function InitTrig_Miniboss1_Start takes nothing returns nothing
set gg_trg_Miniboss1_Start = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Miniboss1_Start, gg_rct_Miniboss1 )
call TriggerAddCondition( gg_trg_Miniboss1_Start, Condition( function Trig_EnterBoss_Conditions ) )
call TriggerAddAction( gg_trg_Miniboss1_Start, function Trig_Miniboss1_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Miniboss2_Actions takes nothing returns nothing
// now run the the boss script...
call Trig_MiniBossTeleport(1)
call DisableTrigger( GetTriggeringTrigger() )
call TriggerExecute( gg_trg_SpiderBoss2 )
endfunction
//===========================================================================
function InitTrig_Miniboss2_Start takes nothing returns nothing
set gg_trg_Miniboss2_Start = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Miniboss2_Start, gg_rct_Miniboss2 )
call TriggerAddCondition( gg_trg_Miniboss2_Start, Condition( function Trig_EnterBoss_Conditions ) )
call TriggerAddAction( gg_trg_Miniboss2_Start, function Trig_Miniboss2_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_SpiderBoss1_OnDeath takes nothing returns nothing
local unit u = GetKillingUnit()
local integer i = GetPlayerId(GetOwningPlayer(u))
local integer theItem = GetMiniBossItem()
local trigger trig = GetTriggeringTrigger()
local unit grave = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'o002', minibossentrances[0], 0 )
local integer resetT = GetHandleInt(trig, "resetT")
call CleanTimer(I2Timer(resetT))
call SetUnitInvulnerable(grave, true)
call Trig_AwardBuff( (i/2), 0 )
set grave = null
set u = null
call DestroyTrigger( GetTriggeringTrigger() )
set trig = null
call Alert_Spider_Killed(0)
endfunction
function Trig_SpiderBoss1_KillAll takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Trig_SpiderBoss1_Reset takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit spider = GetHandleUnit(I2Timer(t), "spider")
local boolexpr filter = Condition( function IsPCdAndAlive )
local group g = CreateGroup()
local group g2
local trigger trig = GetHandleTrigger(I2Timer(t), "trig" )
call GroupEnumUnitsInRect( g, gg_rct_Spider1, filter )
//local integer count = CountUnitsInGroup(g)
if( CountUnitsInGroup(g) < 1 ) then
call RemoveUnit(spider)
call DisableTrigger(trig)
call DestroyTrigger(trig)
call EnableTrigger(gg_trg_Miniboss1_Start)
call Alert_Spider_Reset(0)
call CleanTimer(I2Timer(t))
set g2 = GetUnitsInRectOfPlayer( gg_rct_Spider1, Player(12) )
call ForGroup( g2, function Trig_SpiderBoss1_KillAll )
call DestroyGroup(g2)
endif
call DestroyGroup(g)
call DestroyBoolExpr(filter)
set filter = null
set g = null
set g2 = null
set trig = null
set spider = null
endfunction
function Trig_SpiderBoss1_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_Spider1)
local unit theSpider = CreateUnit( Player(12), 'n00Q', GetLocationX(loc)-100, GetLocationY(loc), 0 )
local integer eggT = H2I(CreateTimer())
local integer bOrbT = H2I(CreateTimer())
local integer tOrbT = H2I(CreateTimer())
local integer resetT = H2I(CreateTimer())
local unit tOrb = CreateUnit( Player(12), 'h00K', GetRectCenterX(gg_rct_Spider1OTR), GetRectCenterY(gg_rct_Spider1OTR), 0 )
local unit bOrb = CreateUnit( Player(12), 'h00K', GetRectCenterX(gg_rct_Spider1OBL), GetRectCenterY(gg_rct_Spider1OBL), 0 )
// == Death Trigger
local trigger trig = CreateTrigger()
call TriggerRegisterUnitEvent( trig, theSpider, EVENT_UNIT_DEATH )
call TriggerAddAction( trig, function Trig_SpiderBoss1_OnDeath )
// === Set Orbs In Motion ===
call SetUnitPathing(tOrb, false)
call SetUnitPathing(bOrb, false)
call IssuePointOrder(tOrb, "patrol", GetRectCenterX(gg_rct_Spider1OTL), GetRectCenterY(gg_rct_Spider1OTL) )
call IssuePointOrder(bOrb, "patrol", GetRectCenterX(gg_rct_Spider1OBR), GetRectCenterY(gg_rct_Spider1OBR) )
call SetHandleHandle(I2Timer(eggT), "spider", theSpider )
call SetHandleHandle(I2Timer(bOrbT), "spider", theSpider )
call SetHandleHandle(I2Timer(bOrbT), "orb", bOrb )
call SetHandleHandle(I2Timer(tOrbT), "spider", theSpider )
call SetHandleHandle(I2Timer(tOrbT), "orb", tOrb )
call SetHandleHandle(I2Timer(resetT), "spider", theSpider )
call SetHandleHandle(I2Timer(resetT), "trig", trig )
call SetHandleInt(trig, "resetT", resetT )
call TimerStart(I2Timer(eggT), 10.0, true, function Trig_SpiderBoss_Eggs )
call TimerStart(I2Timer(bOrbT), 3.0, true, function Trig_SpiderBoss_Orb )
call TimerStart(I2Timer(tOrbT), 3.0, true, function Trig_SpiderBoss_Orb )
call TimerStart(I2Timer(resetT), 5.0, true, function Trig_SpiderBoss1_Reset )
call RemoveLocation(loc)
set theSpider = null
set loc = null
set bOrb = null
set tOrb = null
set trig = null
endfunction
//===========================================================================
function InitTrig_SpiderBoss1 takes nothing returns nothing
set gg_trg_SpiderBoss1 = CreateTrigger( )
call TriggerAddAction( gg_trg_SpiderBoss1, function Trig_SpiderBoss1_Actions )
endfunction
//TESH.scrollpos=42
//TESH.alwaysfold=0
function Trig_SpiderBoss2_OnDeath takes nothing returns nothing
local unit u = GetKillingUnit()
local integer i = GetPlayerId(GetOwningPlayer(u))
local integer theItem = GetMiniBossItem()
local trigger trig = GetTriggeringTrigger()
local unit grave = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'o002', minibossentrances[1], 0 )
local integer resetT = GetHandleInt(trig, "resetT" )
call CleanTimer(I2Timer(resetT))
call SetUnitInvulnerable(grave, true)
call Trig_AwardBuff( (i/2), 0 )
set grave = null
set u = null
call DestroyTrigger( GetTriggeringTrigger() )
set trig = null
call Alert_Spider_Killed(1)
endfunction
function Trig_SpiderBoss2_KillAll takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Trig_SpiderBoss2_Reset takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit spider = GetHandleUnit(I2Timer(t), "spider")
local boolexpr filter = Condition( function IsPCdAndAlive )
local group g = CreateGroup()
local group g2
local trigger trig = GetHandleTrigger(I2Timer(t), "trig" )
call GroupEnumUnitsInRect( g, gg_rct_Spider2, filter )
if( CountUnitsInGroup(g) < 1 ) then
call RemoveUnit(spider)
call DisableTrigger(trig)
call DestroyTrigger(trig)
call EnableTrigger(gg_trg_Miniboss2_Start)
call Alert_Spider_Reset(1)
call CleanTimer(I2Timer(t))
set g2 = GetUnitsInRectOfPlayer( gg_rct_Spider2, Player(12) )
call ForGroup( g2, function Trig_SpiderBoss2_KillAll )
call DestroyGroup(g2)
endif
call DestroyBoolExpr(filter)
set filter = null
call DestroyGroup(g)
set g = null
set g2 = null
set trig = null
set spider = null
endfunction
function Trig_SpiderBoss2_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_Spider2)
local unit theSpider = CreateUnit( Player(12), 'n00Q', GetLocationX(loc)-100, GetLocationY(loc), 0 )
local integer eggT = H2I(CreateTimer())
local integer bOrbT = H2I(CreateTimer())
local integer tOrbT = H2I(CreateTimer())
local integer resetT = H2I(CreateTimer())
local unit tOrb = CreateUnit( Player(12), 'h00K', GetRectCenterX(gg_rct_Spider2OTR), GetRectCenterY(gg_rct_Spider2OTR), 0 )
local unit bOrb = CreateUnit( Player(12), 'h00K', GetRectCenterX(gg_rct_Spider2OBL), GetRectCenterY(gg_rct_Spider2OBL), 0 )
// == Death Trigger
local trigger trig = CreateTrigger()
call TriggerRegisterUnitEvent( trig, theSpider, EVENT_UNIT_DEATH )
call TriggerAddAction( trig, function Trig_SpiderBoss2_OnDeath )
// === set orbs in motion ===
call SetUnitPathing(tOrb, false)
call SetUnitPathing(bOrb, false)
call IssuePointOrder(tOrb, "patrol", GetRectCenterX(gg_rct_Spider2OTL), GetRectCenterY(gg_rct_Spider2OTL) )
call IssuePointOrder(bOrb, "patrol", GetRectCenterX(gg_rct_Spider2OBR), GetRectCenterY(gg_rct_Spider2OBR) )
call SetHandleHandle(I2Timer(eggT), "spider", theSpider )
call SetHandleHandle(I2Timer(bOrbT), "spider", theSpider )
call SetHandleHandle(I2Timer(bOrbT), "orb", bOrb )
call SetHandleHandle(I2Timer(tOrbT), "spider", theSpider )
call SetHandleHandle(I2Timer(tOrbT), "orb", tOrb )
call SetHandleHandle(I2Timer(resetT), "spider", theSpider )
call SetHandleHandle(I2Timer(resetT), "trig", trig )
call SetHandleInt(trig, "resetT", resetT)
call TimerStart(I2Timer(eggT), 10.0, true, function Trig_SpiderBoss_Eggs )
call TimerStart(I2Timer(bOrbT), 3.0, true, function Trig_SpiderBoss_Orb )
call TimerStart(I2Timer(tOrbT), 3.0, true, function Trig_SpiderBoss_Orb )
call TimerStart(I2Timer(resetT), 5.0, true, function Trig_SpiderBoss2_Reset)
call RemoveLocation(loc)
set theSpider = null
set loc = null
set bOrb = null
set tOrb = null
set trig = null
endfunction
//===========================================================================
function InitTrig_SpiderBoss2 takes nothing returns nothing
set gg_trg_SpiderBoss2 = CreateTrigger( )
call TriggerAddAction( gg_trg_SpiderBoss2, function Trig_SpiderBoss2_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_FinalBoss2_Start_Actions takes nothing returns nothing
call Trig_FinalBossTeleport(1)
call DisableTrigger( GetTriggeringTrigger() )
call TriggerExecute( gg_trg_SephirothBoss )
endfunction
//===========================================================================
function InitTrig_FinalBoss2_Start takes nothing returns nothing
set gg_trg_FinalBoss2_Start = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_FinalBoss2_Start, gg_rct_End2 )
call TriggerAddCondition( gg_trg_FinalBoss2_Start, Condition( function Trig_EnterBoss_Conditions ) )
call TriggerAddAction( gg_trg_FinalBoss2_Start, function Trig_FinalBoss2_Start_Actions )
endfunction
//TESH.scrollpos=186
//TESH.alwaysfold=0
function Trig_Sephiroth_Dies takes nothing returns nothing
local trigger trig = GetTriggeringTrigger()
local integer resetT = GetHandleInt( trig, "resetT" )
local integer teamnum = (GetPlayerId(GetOwningPlayer(GetKillingUnit())) / 2 )
call Trig_AwardBuff( teamnum, 4 )
call DestroyTrigger(trig)
call CleanTimer(I2Timer(resetT))
set trig = null
set udg_sephirothDown = true
// BAHHHHHHH INSTIGATE FINAL PVP
call Trig_Final_Boss_Down(1)
endfunction
function Trig_Sephiroth_Reset takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit boss = GetHandleUnit(I2Timer(t), "boss" )
local boolexpr filter = Condition(function IsPCdAndAlive)
local group g = CreateGroup()
local trigger trig = GetHandleTrigger(I2Timer(t), "trig" )
local integer count
call GroupEnumUnitsInRect( g, finalboss[1], filter )
call DestroyBoolExpr(filter)
set filter = null
set count = CountUnitsInGroup(g)
if( count < 1 ) then
call DisableTrigger(trig)
call DestroyTrigger(trig)
call RemoveUnit(boss)
call EnableTrigger( gg_trg_FinalBoss2_Start )
call CleanTimer(I2Timer(t))
call Trig_Boss_Reset_Ping(1)
endif
call DestroyGroup(g)
set g = null
set boss = null
set trig = null
endfunction
function Trig_Sephiroth_TextTag takes nothing returns nothing
local texttag t = CreateTextTag()
call SetTextTagText( t, "Sephiroth Demands a Sacrifice", 0.020 )
call SetTextTagPos( t, GetRectCenterX(gg_rct_FinalE2)-200, GetRectCenterY(gg_rct_FinalE2), 0 )
call SetTextTagColor( t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 5.0)
set t = null
endfunction
function Trig_Sephiroth_Farsight takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit sephi = GetHandleUnit(I2Timer(t), "sephi")
if( IsUnitDeadBJ( sephi ) ) then
call CleanTimer(I2Timer(t))
else
call MakeMeFarsight(1)
endif
set sephi = null
endfunction
function Trig_Sephiroth_Meteor_Callback takes nothing returns nothing
//okay, so meteor FX done, cast our warstomp
local integer t = H2I(GetExpiredTimer())
local location loc = GetHandleLocation(I2Timer(t), "loc")
local unit dummy = CreateUnitAtLoc(Player(12), 'h003', loc, 0.0)
call UnitAddAbility( dummy, 'A01R')
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
call IssueImmediateOrder(dummy, "stomp")
//call BJDebugMsg("Warstomp!")
call FlushHandleLocals(I2Timer(t))
call DestroyTimer(I2Timer(t))
set dummy = null
call RemoveLocation(loc)
set loc = null
endfunction
function Trig_Sephiroth_Meteor takes nothing returns nothing
// pick a random location in th rect and cast meteor there
local integer t = H2I(GetExpiredTimer())
local location loc = GetRandomLocInRect( finalboss[1] )
local unit sephi = GetHandleUnit( I2Timer(t), "boss")
local integer warstompT
//call BJDebugMsg("Rawr Meteor FX")
if( IsUnitDeadBJ(sephi) ) then
call CleanTimer(I2Timer(t))
else
set warstompT = H2I(CreateTimer())
call SetHandleHandle(I2Timer(warstompT), "loc", loc)
call DestroyEffect( AddSpecialEffectLoc("Units\\Demon\\Infernal\\InfernalBirth.mdl", loc) )
call TimerStart(I2Timer(warstompT), 0.8, false, function Trig_Sephiroth_Meteor_Callback )
endif
set sephi = null
set loc = null
endfunction
function Trig_Sephiroth_FindLowestHP takes group g returns unit
local unit u
local unit lowest = null
loop
set u = FirstOfGroup(g)
exitwhen ( u == null )
// we know U is not null...
if( lowest == null ) then
set lowest = u
else
if( GetUnitLifePercent(u) < GetUnitLifePercent(lowest)) then
set lowest = u
endif
endif
call GroupRemoveUnit(g, u)
endloop
return lowest
endfunction
function Trig_Sephiroth_Refocus takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local real tX
local real tY
local group g
local unit target
local boolexpr filter = Condition( function IsPCdAndAlive )
if ( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
set g = CreateGroup()
call GroupEnumUnitsInRect( g, finalboss[1], filter)
// TODO: Find the lowest Hp target
set target = Trig_Sephiroth_FindLowestHP(g)
// now we have our target, move sephi and have him attack
set tX = GetUnitX(target)
set tY = GetUnitY(target)
call SetUnitPosition( boss, tX, tY )
call UnitRemoveBuffs( boss, false, true )
call IssueTargetOrder( boss, "attack", target )
call DestroyGroup(g)
endif
call DestroyBoolExpr(filter)
set filter = null
set g = null
set boss = null
endfunction
function Trig_Sephiroth_FightBegins takes unit sephi returns nothing
// Timers to run periodically
local integer refocusT = H2I(CreateTimer())
local integer meteorT = H2I(CreateTimer())
// attaching items to our timers
call SetHandleHandle(I2Timer(refocusT), "boss", sephi) // Makes sephiroth teleport to the guy with the lowest HP
call SetHandleHandle(I2Timer(meteorT), "boss", sephi) // calls down meteor; need Sephi to make sure he's not dead; self clean up
// start our timers
call TimerStart( I2Timer(refocusT), 8.5, true, function Trig_Sephiroth_Refocus )
call TimerStart( I2Timer(meteorT), 2.5, true, function Trig_Sephiroth_Meteor )
endfunction
function Trig_Sephiroth_Kills_All takes nothing returns nothing
// this runs if no one was sent in the pit... so set health to 15% and mana to 10%
// and cool FX GetEnumUnit()
local real dmgDone = ( GetUnitState( GetEnumUnit(), UNIT_STATE_MAX_LIFE ) * .7 )
call DestroyEffect( AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()) ) )
call SetUnitManaPercentBJ( GetEnumUnit(), 30.0 )
call SetUnitLifePercentBJ( GetEnumUnit(), 30.0 )
call GlobalFloatingCombatText( GetEnumUnit(), R2I(dmgDone), 255, 0, 0, false )
endfunction
function Trig_Sephiroth_Fire_To_Sin takes nothing returns nothing
// This will create the fire and a 5 second countdown
// define our number of fires
local integer numFires = 12
local integer i = 0
local integer loopEnd = numFires
local real locX = GetRectCenterX(finalboss[1])
local real locY = GetRectCenterY(finalboss[1])
//local effect array fires[numFires]
local effect array fires
local real range = 350.0
local real degree = ( 360 / numFires )
local unit sephi
local group gInCirc = CreateGroup()
local group gAll = CreateGroup()
local boolexpr filter = Condition(function IsPCdAndAlive)
local unit sap
local real dmgDone
local trigger trig
local integer resetT = H2I(CreateTimer())
local integer farsightT = H2I(CreateTimer())
call PolledWait( 3.0 )
loop
exitwhen i > loopEnd
// X offset by... x + range*(CosBJ(i*degree))
// Y offset by... y + range*(SinBJ(i*degree))
set fires[i] = AddSpecialEffect("Doodads\\Cinematic\\FireRockSmall\\FireRockSmall.mdl", locX + range*(CosBJ(i*degree)), locY + range*(SinBJ(i*degree)) )
set i = (i+1)
endloop
call PolledWait(7.5)
// now we must create sephiroth
set sephi = CreateUnit( Player(12), 'U00E', locX, locY, 270.0 )
// ==== Death Detection Trigger
set trig = CreateTrigger()
call TriggerRegisterUnitEvent( trig, sephi, EVENT_UNIT_DEATH )
call TriggerAddAction( trig, function Trig_Sephiroth_Dies )
call SetHeroLevel( sephi, 18, false )
call SetHandleHandle(I2Timer(resetT), "boss", sephi )
call SetHandleHandle(I2Timer(resetT), "trig", trig )
call SetHandleHandle(I2Timer(farsightT), "boss", sephi )
call SetHandleInt(trig, "resetT", resetT)
call TimerStart( I2Timer(resetT), 3.0, true, function Trig_Sephiroth_Reset )
call TimerStart( I2Timer(farsightT), 15.0, true, function Trig_Sephiroth_Farsight )
// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& BEGIN SIN HARVEST
call GroupEnumUnitsInRange( gInCirc, locX, locY, range, filter)
set sap = FirstOfGroup(gInCirc)
if( sap == null ) then
// whooo boy, there aint no one in the fire
call GroupEnumUnitsInRect( gAll, finalboss[1], filter )
call ForGroup( gAll, function Trig_Sephiroth_Kills_All )
else
// wreck the target
call IssueTargetOrder( sephi, "attack", sap )
call DestroyEffect( AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", GetUnitX(sap), GetUnitY(sap)))
set dmgDone = (GetUnitState( sap, UNIT_STATE_MAX_LIFE ) * 0.4 )
call SetUnitLifePercentBJ( sap, 75.0 )
call SetUnitManaPercentBJ( sap, 75.0 )
call GlobalFloatingCombatText( sap, R2I(dmgDone), 255, 0, 0, false )
endif
// Clean Up Time
set i = 0
loop
exitwhen i > loopEnd
// destroy the fire
call DestroyEffect( fires[i] )
// now null the variable
set fires[i] = null
set i = (i + 1)
endloop
set sap = null
set trig = null
call DestroyGroup(gInCirc)
call DestroyGroup(gAll)
set gInCirc = null
set gAll = null
call DestroyBoolExpr(filter)
set filter = null
call Trig_Sephiroth_FightBegins(sephi)
set sephi = null
endfunction
function Trig_SephirothBoss_Actions takes nothing returns nothing
call Trig_Sephiroth_TextTag()
call Trig_Sephiroth_Fire_To_Sin()
endfunction
//===========================================================================
function InitTrig_SephirothBoss takes nothing returns nothing
set gg_trg_SephirothBoss = CreateTrigger( )
call TriggerAddAction( gg_trg_SephirothBoss, function Trig_SephirothBoss_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_FinalBoss1_Actions takes nothing returns nothing
// get both heroes there, and turn the teleport off...
call Trig_FinalBossTeleport(0)
call DisableTrigger( GetTriggeringTrigger() )
// Now Run the Trigger that has all our code for the boss
call TriggerExecute( gg_trg_JudgementBoss )
endfunction
//===========================================================================
function InitTrig_FinalBoss1_Start takes nothing returns nothing
set gg_trg_FinalBoss1_Start = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_FinalBoss1_Start, gg_rct_End1 )
call TriggerAddCondition( gg_trg_FinalBoss1_Start, Condition(function Trig_EnterBoss_Conditions))
call TriggerAddAction( gg_trg_FinalBoss1_Start, function Trig_FinalBoss1_Actions )
endfunction
//TESH.scrollpos=241
//TESH.alwaysfold=0
function Trig_Judge_Dies takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetKillingUnit()))
local trigger trig = GetTriggeringTrigger()
local integer resetT = GetHandleInt( trig, "resetT" )
call CleanTimer(I2Timer(resetT))
call Trig_AwardBuff( (i/2), 2 )
set trig = null
call DestroyTrigger(trig)
//set it = null
call TriggerExecute( gg_trg_JKillTrees )
call Trig_Final_Boss_Down(0)
endfunction
function Trig_Judge_PlatformAction takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local destructable elevator = GetHandleDestructable(I2Timer(t), "elevator")
local integer int = GetHandleInt(I2Timer(t), "int")
local unit dummy
if( int < 2 ) then
// this one is raised
call ChangeElevatorHeight( elevator, 2 )
else
// create the dummy to cast Starfall on the noobz
set dummy = CreateUnit( Player(12), 'h003', GetDestructableX(elevator), GetDestructableY(elevator), 0.0)
call UnitAddAbility( dummy, 'A03O' )
call UnitApplyTimedLife( dummy, 'BTLF', 8.0 )
call IssueImmediateOrder( dummy, "starfall" )
// trap those noobs
call ChangeElevatorWalls( false, bj_ELEVATOR_WALL_TYPE_ALL, elevator )
endif
// clean up
call FlushHandleLocals(I2Timer(t))
call DestroyTimer(I2Timer(t))
set elevator = null
set dummy = null
endfunction
function Trig_Judge_PlatformIndi takes nothing returns nothing
local integer int = GetRandomInt(0, 2)
local real x = GetDestructableX( GetEnumDestructable() )
local real y = GetDestructableY( GetEnumDestructable() )
local integer t = H2I(CreateTimer())
call SetHandleHandle(I2Timer(t), "elevator", GetEnumDestructable())
call SetHandleInt(I2Timer(t), "int", int)
// 0,1 means it will be raised and safe
// 2 means it will be not safe at all
if ( int == 2 ) then
// for those that will remain lowered, let's create an effect to warn the player,
// then we will call the timer to fire in 1.5 seconds to deal out Judgement
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", x, y))
endif
call TimerStart(I2Timer(t), 1.5, false, function Trig_Judge_PlatformAction )
endfunction
function Trig_Judge_LowerAll takes nothing returns nothing
//call BJDebugMsg("Rawr lower this platform!")
call ChangeElevatorHeight( GetEnumDestructable(), 1 )
call ChangeElevatorWalls( true, bj_ELEVATOR_WALL_TYPE_ALL, GetEnumDestructable() )
endfunction
function Trig_Judge_CallLowerAll takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local rect ourRect = GetHandleRect(I2Timer(t), "rect")
local boolexpr filter = Condition(function Is_Elevator)
//call BJDebugMsg("======About To Lower All!=========")
call EnumDestructablesInRect( ourRect, filter , function Trig_Judge_LowerAll )
call DestroyBoolExpr(filter)
set filter = null
set ourRect = null
call FlushHandleLocals(I2Timer(t))
call DestroyTimer(I2Timer(t))
endfunction
// Timer will call This Method...
function Trig_Judge_Platform takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local integer num = GetHandleInt(I2Timer(t), "num") - 1
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local boolexpr filter = Condition( function Is_Elevator )
// the resetTimer is the timer that fires when we need to "reset" the platforms, as in lower the ones
// that were raised
local integer resetTimer = H2I(CreateTimer())
if ( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
//call BJDebugMsg("boss not dead..")
call SetHandleHandle(I2Timer(resetTimer), "rect", finalboss[num])
// Go through each elevator...then, do stuff to it in the "PlatformIndi" method
call EnumDestructablesInRect( finalboss[num], filter , function Trig_Judge_PlatformIndi )
call TimerStart(I2Timer(resetTimer), 10.0, false, function Trig_Judge_CallLowerAll )
endif
call DestroyBoolExpr(filter)
set filter = null
set boss = null
endfunction
function Trig_Judge_Shackle_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local real x = GetUnitX(boss)
local real y = GetUnitY(boss)
local boolexpr filter = Condition(function IsPCdAndAlive )
local group g = CreateGroup()
call GroupEnumUnitsInRange( g, x, y, 350, filter )
call UnitRemoveAbility( boss, 'A03S' )
if( FirstOfGroup(g) != null ) then
call UnitAddAbility( boss, 'A03S')
call UnitResetCooldown(boss)
if( not IssueTargetOrder( boss, "magicleash", FirstOfGroup(g)) ) then
call UnitRemoveAbility(boss, 'A03S')
endif
else
call IssueImmediateOrder(boss, "stop")
endif
call DestroyBoolExpr(filter)
set filter = null
call FlushHandleLocals(I2Timer(t))
call DestroyTimer(I2Timer(t))
set boss = null
call DestroyGroup(g)
set g = null
endfunction
function Trig_Judge_Shackle takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit boss = GetHandleUnit(I2Timer(t), "boss")
// for creating the FX to warn the players
local integer i = 0
local integer loopEnd = 9
local real x = GetUnitX(boss)
local real y = GetUnitY(boss)
local real range = 350.0
local integer t2 = H2I(CreateTimer())
call SetHandleHandle(I2Timer(t2), "boss", boss)
if ( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
loop
exitwhen i > loopEnd
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", x + range*(CosBJ(i*40)), y + range*(SinBJ(i*40)) ) )
set i = i + 1
endloop
call IssueImmediateOrder(boss, "stop")
call IssueImmediateOrder(boss, "holdposition")
// give the player 1.75 seconds to clear out...otherwise they eat it
call TimerStart(I2Timer(t2), 1.75, false, function Trig_Judge_Shackle_Callback )
endif
set boss = null
endfunction
function Trig_Judge_Banshees takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local integer num = GetHandleInt(I2Timer(t), "num") - 1
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local integer count = GetHandleInt(I2Timer(t), "count")
local integer turn = GetHandleInt(I2Timer(t), "turn")
local unit dummy
local integer slotOffset
// We assume that this is the distance from the center of a Platform to the edge, so a length of 200
local real distOffset = 225
local real x = GetRectCenterX(gg_rct_JudgeBanshee)
local real y = GetRectCenterY(gg_rct_JudgeBanshee)
if ( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
// this business is done to make the banshees stagger everytime they fire
// this determines where we are in the line...and by doing somethign "crazy" at the turn (bottom)
// we get our up and down effect
if( count > 7 ) then
set count = 0
endif
set slotOffset = ( IAbsBJ(turn - count) )
//if( count <= turn ) then
// set slotOffset = count
//else
// set slotOffset = ( (2 * turn) - count )
//endif
set dummy = CreateUnit( Player(12), 'h003', x, y - (slotOffset * distOffset), 0)
call UnitAddAbility( dummy, 'A03H')
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssuePointOrder( dummy, "shockwave", x + 100, y - (slotOffset * distOffset))
// increment our counter...
call SetHandleInt(I2Timer(t), "count", (count+1))
endif
set dummy = null
endfunction
function Trig_Judge_Reset takes nothing returns nothing
local integer t = H2I(GetExpiredTimer()) // reset timer...
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local timer t1 = GetHandleTimer(I2Timer(t), "t1")
local timer t2 = GetHandleTimer(I2Timer(t), "t2")
local timer t4 = GetHandleTimer(I2Timer(t), "t4")
local trigger trig = GetHandleTrigger(I2Timer(t), "trigger")
local boolexpr filter = Condition(function IsPCdAndAlive)
local group g = CreateGroup()
call GroupEnumUnitsInRect( g, finalboss[0], filter )
call DestroyBoolExpr(filter)
set filter = null
if( CountUnitsInGroup(g) < 1 ) then
// deal with removing the boss...disable the trigger that resets
call DisableTrigger(trig)
call DestroyTrigger(trig)
call RemoveUnit(boss)
// clear out our timers...
// this may be completely unnecessary since all the timers self-clear when they detect the boss being dead
call CleanTimer(t1)
call CleanTimer(t2)
call CleanTimer(t4)
call CleanTimer(I2Timer(t))
// Now we need to re-enable the teleport
call EnableTrigger( gg_trg_FinalBoss1_Start )
call Trig_Boss_Reset_Ping(0)
endif
if( udg_bossDown == true ) then
call CleanTimer(I2Timer(t))
endif
set trig = null
set boss = null
set t1 = null
set t2 = null
set t4 = null
endfunction
function Trig_JudgementBoss_Actions takes nothing returns nothing
// ========================= This is Simply stating that we are using all positions as 0/1 =======================
local integer num = 1
local real x = GetRectCenterX(finalboss[num-1])
local real y = GetRectCenterY(finalboss[num-1])
local unit boss = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'U00F', x, y, 270 )
// *** Our Timers
local integer bansheeT = H2I(CreateTimer()) // calls Banshee's
local integer platformT = H2I(CreateTimer()) // calls Platform Havoc
local integer shackleT = H2I(CreateTimer()) // Shackles!
//local integer farsightT = H2I(CreateTimer()) // Farsight for player since platforms are 'glitchy'...at best
// the reset checking timer...
local integer resetT = H2I(CreateTimer()) // checks every 5 seconds for no Player Units
// our trigger to check for the boss to be downwed
local trigger trig = CreateTrigger()
call TriggerRegisterUnitEvent( trig, boss, EVENT_UNIT_DEATH )
call TriggerAddAction( trig, function Trig_Judge_Dies )
call SetHandleInt( trig, "resetT", resetT )
call SetHeroLevel( boss, 15, false )
// -timer- handles
call SetHandleInt(I2Timer(bansheeT), "num", num )
call SetHandleHandle(I2Timer(bansheeT), "boss", boss)
call SetHandleInt(I2Timer(bansheeT), "count", 0)
call SetHandleInt(I2Timer(bansheeT), "turn", 4)
call SetHandleInt(I2Timer(platformT), "num", num )
call SetHandleHandle(I2Timer(platformT), "boss", boss)
call SetHandleHandle(I2Timer(shackleT), "boss", boss)
// -reset- handles
call SetHandleHandle(I2Timer(resetT), "boss", boss)
call SetHandleHandle(I2Timer(resetT), "t1", I2Timer(bansheeT) )
call SetHandleHandle(I2Timer(resetT), "t2", I2Timer(platformT) )
call SetHandleHandle(I2Timer(resetT), "t4", I2Timer(shackleT) )
call SetHandleHandle(I2Timer(resetT), "trigger", trig)
call SetHandleInt(I2Timer(resetT), "num", num )
call TimerStart(I2Timer(bansheeT), 2.0, true, function Trig_Judge_Banshees )
call TimerStart(I2Timer(platformT), 18.0, true, function Trig_Judge_Platform )
//call TimerStart(I2Timer(shackleT), 25.0, true, function Trig_Judge_Shackle )
//call TimerStart(I2Timer(farsightT), 15.0, true, function Trig_Judge_Farsight )
call TimerStart(I2Timer(resetT), 1.5, true, function Trig_Judge_Reset )
set boss = null
endfunction
//===========================================================================
function InitTrig_JudgementBoss takes nothing returns nothing
set gg_trg_JudgementBoss = CreateTrigger( )
call TriggerAddAction( gg_trg_JudgementBoss, function Trig_JudgementBoss_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_JKillTrees_Kill takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
endfunction
function Trig_JKillTrees_Remove takes nothing returns nothing
call RemoveDestructable( GetEnumDestructable() )
endfunction
function Trig_JKillTrees_Actions takes nothing returns nothing
call EnumDestructablesInRect( gg_rct_JTrees, null, function Trig_JKillTrees_Kill )
call EnumDestructablesInRect( gg_rct_JTrees, null, function Trig_JKillTrees_Remove )
endfunction
//===========================================================================
function InitTrig_JKillTrees takes nothing returns nothing
set gg_trg_JKillTrees = CreateTrigger( )
call TriggerAddAction( gg_trg_JKillTrees, function Trig_JKillTrees_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_FinalBoss3_Start_Actions takes nothing returns nothing
call Trig_FinalBossTeleport(2)
call DisableTrigger( GetTriggeringTrigger() )
call TriggerExecute( gg_trg_FaeriesBoss )
endfunction
//===========================================================================
function InitTrig_FinalBoss3_Start takes nothing returns nothing
set gg_trg_FinalBoss3_Start = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_FinalBoss3_Start, gg_rct_End3 )
call TriggerAddCondition( gg_trg_FinalBoss3_Start, Condition( function Trig_EnterBoss_Conditions ) )
call TriggerAddAction( gg_trg_FinalBoss3_Start, function Trig_FinalBoss3_Start_Actions )
endfunction
//TESH.scrollpos=122
//TESH.alwaysfold=0
function Trig_Faeries_KillAll takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Trig_Faeries_Reset takes nothing returns nothing
local integer t = udg_faerieReset // reset timer...
local boolexpr filter = Condition(function IsPCdAndAlive)
local group g = CreateGroup()
local group g2
local trigger forestDies
local trigger frostDies
local unit forest
local unit frost
call GroupEnumUnitsInRect( g, finalboss[2], filter )
call DestroyBoolExpr(filter)
set filter = null
if( CountUnitsInGroup(g) < 1 ) then
// ack now we need to reset them all!
set forestDies = GetHandleTrigger(I2Timer(t), "forestDies")
set frostDies = GetHandleTrigger(I2Timer(t), "frostDies")
call DisableTrigger(forestDies)
call DisableTrigger(frostDies)
call DestroyTrigger(forestDies)
call DestroyTrigger(frostDies)
set forest = GetHandleUnit(I2Timer(t), "forest")
set frost = GetHandleUnit(I2Timer(t), "frost")
call RemoveUnit( forest )
call RemoveUnit( frost )
set g2 = GetUnitsInRectOfPlayer( finalboss[2], Player(12) )
call ForGroup( g2, function Trig_Faeries_KillAll )
call DestroyGroup(g2)
set udg_forestDead = true
set udg_frostDead = true
set udg_faeriesDown = false
// we assume that our Timer's will clean themselves
// ========================= CHANGE THIS =======================
call EnableTrigger( gg_trg_FinalBoss3_Start )
call CleanTimer(I2Timer(t))
call Trig_Boss_Reset_Ping(2)
endif
set forest = null
set frost = null
set forestDies = null
set frostDies = null
call DestroyGroup(g)
set g = null
set g2 = null
endfunction
function Trig_Faeries_AreDead takes nothing returns boolean
return ( udg_forestDead and udg_frostDead )
endfunction
// THIS FIRES ON FULL DEATH
function checkForOther takes integer i returns nothing
local item it
local location loc = peekStack( theGYs[i/2] )
local integer teamnum = (GetPlayerId(GetOwningPlayer(GetKillingUnit())) / 2 )
if( Trig_Faeries_AreDead() ) then
set loc = peekStack( theGYs[i/2] )
call CleanTimer(I2Timer(udg_faerieReset))
call Trig_AwardBuff( teamnum, 3 )
set udg_faeriesDown = true
set loc = null
call TriggerExecute( gg_trg_TFKillTrees )
call Trig_Final_Boss_Down(2)
endif
endfunction
function Trig_Faeries_FrostDeath takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetKillingUnit()))
local trigger trig = GetTriggeringTrigger()
call DestroyTrigger(trig)
set trig = null
set udg_frostDead = true
call RemoveWeatherEffect( udg_snowRain )
set udg_snowRain = AddWeatherEffect( finalboss[2], 'RAhr' )
call checkForOther(i)
endfunction
function Trig_Faeries_ForestDeath takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetKillingUnit()))
local integer j = 0
local trigger trig = GetTriggeringTrigger()
call DestroyTrigger(trig)
set trig = null
set udg_forestDead = true
loop
exitwhen j >= 4
call SetDestructableInvulnerable( udg_faerieTrees[j], false )
call KillDestructable( udg_faerieTrees[j] )
set j = j + 1
endloop
call checkForOther(i)
endfunction
function Trig_Faeries_Farsight takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
if ( Trig_Faeries_AreDead() ) then
call CleanTimer(I2Timer(t))
else
call MakeMeFarsight(2)
endif
endfunction
function Trig_Faeries_Invuln takes nothing returns nothing
call SetDestructableInvulnerable( GetFilterDestructable(), true )
endfunction
function Trig_Faeries_Heal takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit frost = GetHandleUnit(I2Timer(t), "frost")
local unit forest = GetHandleUnit(I2Timer(t), "forest")
local location loc1
local location loc2
// check if either is dead, if so, kill timer
if( udg_forestDead or udg_frostDead ) then
call CleanTimer( I2Timer(t) )
else
//call BJDebugMsg( I2S( R2I ( DistanceBetweenPoints( loc1, loc2))))
set loc1 = GetUnitLoc(frost)
set loc2 = GetUnitLoc(forest)
if( DistanceBetweenPoints( loc1, loc2 ) < 250 ) then
// so they are both alive and within 300 of each other, cast a heal on them both
call SetUnitState( frost, UNIT_STATE_LIFE , RMaxBJ( 0, GetUnitState( frost, UNIT_STATE_LIFE ) + 150 ) )
call SetUnitState( forest, UNIT_STATE_LIFE, RMaxBJ(0, GetUnitState(forest, UNIT_STATE_LIFE ) + 150 ) )
call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", loc1 ) )
call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", loc2 ) )
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
endif
set frost = null
set forest = null
set loc1 = null
set loc2 = null
if( Trig_Faeries_AreDead() ) then
call DisableTrigger(GetTriggeringTrigger())
call DestroyTrigger(GetTriggeringTrigger())
endif
endfunction
function IsWisp takes nothing returns boolean
return ( GetUnitTypeId(GetFilterUnit()) == 'e006' )
endfunction
function Trig_Faeries_WispExplode takes nothing returns nothing // trigger
// surely one of these willwork
//call BJDebugMsg("wisp exploding?")
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl", GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()) ) )
// == end debug checking
call IssuePointOrder( GetTriggerUnit(), "selfdestruct", GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()))
call IssueImmediateOrder( GetTriggerUnit(), "selfdestruct")
call IssueTargetOrder( GetTriggerUnit(), "selfdestruct", GetTriggerUnit() )
if( Trig_Faeries_AreDead() ) then
call DisableTrigger(GetTriggeringTrigger())
call DestroyTrigger(GetTriggeringTrigger())
endif
endfunction
function Trig_Faeries_Wisps takes nothing returns nothing // timer
local integer t = H2I(GetExpiredTimer())
local integer i = GetHandleInt(I2Timer(t), "i")
local unit forest = GetHandleUnit(I2Timer(t), "forest")
local unit wisp
local trigger detonate
if( IsUnitDeadBJ(forest) ) then
call CleanTimer(I2Timer(t))
else
// create a wisp at udg_faerieTrees[i]
set wisp = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'e006', GetDestructableX(udg_faerieTrees[i]), GetDestructableY(udg_faerieTrees[i]), 0)
call IssuePointOrder( wisp, "patrol", GetUnitX(forest), GetUnitY(forest) )
call SetUnitColor( wisp, GetPlayerColor( Player(6) ) )
//call BJDebugMsg( "making a wisp" )
set i = i + 1
if( i >= 4 ) then
set i = 0
endif
call SetHandleInt(I2Timer(t), "i", i)
endif
set detonate = null
set wisp = null
set forest = null
endfunction
function Trig_FaeriesBoss_Actions takes nothing returns nothing
// ========================= CHANGE THIS =======================
local integer num = 3
local location forestSpawn = GetRectCenter(gg_rct_ForestSpawn)
local location frostSpawn = GetRectCenter(gg_rct_FrostSpawn)
local unit forest = CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'E004', forestSpawn, 0 )
local unit frost = CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'E005', frostSpawn, 0 )
local integer i = 0
local integer heal = H2I(CreateTimer()) // checks every 1 second if they are within range and heal them
local integer wisps = H2I(CreateTimer()) // every 1.5 seconds creates a wisp to follow the forest faerie
local integer sight = H2I(CreateTimer()) // every 15 seconds farsights
local trigger wispDeto = CreateTrigger()
local trigger frostDies = CreateTrigger()
local trigger forestDies = CreateTrigger()
// &&&&&&&& TREES &&&&&&&&
set udg_faerieTrees[0] = CreateDestructable( 'VTlt', GetRectCenterX( gg_rct_FaerieTree1 ), GetRectCenterY( gg_rct_FaerieTree1 ), 0, 1, 3 )
set udg_faerieTrees[1] = CreateDestructable( 'VTlt', GetRectCenterX( gg_rct_FaerieTree2 ), GetRectCenterY( gg_rct_FaerieTree2 ), 0, 1, 5 )
set udg_faerieTrees[2] = CreateDestructable( 'VTlt', GetRectCenterX( gg_rct_FaerieTree3 ), GetRectCenterY( gg_rct_FaerieTree3 ), 0, 1, 1 )
set udg_faerieTrees[3] = CreateDestructable( 'VTlt', GetRectCenterX( gg_rct_FaerieTree4 ), GetRectCenterY( gg_rct_FaerieTree4 ), 0, 1, 0 )
call EnumDestructablesInRect( finalboss[2], null, function Trig_Faeries_Invuln )
loop
exitwhen ( i > 3 )
call SetDestructableInvulnerable( udg_faerieTrees[i], true )
set i = i + 1
endloop
set udg_faerieReset = H2I(CreateTimer()) // checks every 5 seconds to see if there are no players
// == wisp detonation
call TriggerRegisterUnitInRange( wispDeto, forest, 65.0, Condition(function IsWisp) )
call TriggerAddAction( wispDeto, function Trig_Faeries_WispExplode )
// ==== Init the Faeries - level & Color ====
call SetHeroLevel( forest, 15, false )
call SetHeroLevel( frost, 15, false )
call SetUnitColor( forest, GetPlayerColor( Player(6) ) )
call SetUnitColor( frost, GetPlayerColor( Player(8) ) )
set udg_frostDead = false
set udg_forestDead = false
// === Snow ===
set udg_snowRain = AddWeatherEffect( finalboss[2], 'SNls' )
// ==== Forest Dies :( ====
call TriggerRegisterUnitEvent( forestDies, forest, EVENT_UNIT_DEATH )
call TriggerAddAction( forestDies, function Trig_Faeries_ForestDeath )
// ==== Frost Dies! :*( ====
call TriggerRegisterUnitEvent( frostDies, frost, EVENT_UNIT_DEATH )
call TriggerAddAction( frostDies, function Trig_Faeries_FrostDeath )
// == need to disable these triggers in case of reset
call SetHandleHandle(I2Timer(heal), "frost", frost)
call SetHandleHandle(I2Timer(heal), "forest", forest)
call SetHandleInt(I2Timer(wisps), "i", 0)
call SetHandleHandle(I2Timer(wisps), "forest", forest)
// === Reset Handles...
call SetHandleHandle(I2Timer(udg_faerieReset), "forestDies", forestDies )
call SetHandleHandle(I2Timer(udg_faerieReset), "frostDies", frostDies )
call SetHandleHandle(I2Timer(udg_faerieReset), "frost", frost )
call SetHandleHandle(I2Timer(udg_faerieReset), "forest", forest )
call SetHandleInt(I2Timer(udg_faerieReset), "heal", heal)
call SetHandleInt(I2Timer(udg_faerieReset), "wisps", wisps)
call SetHandleInt(I2Timer(udg_faerieReset), "sight", sight)
call TimerStart( I2Timer(heal), 2.0, true, function Trig_Faeries_Heal )
call TimerStart( I2Timer(wisps), 2.5, true, function Trig_Faeries_Wisps )
call TimerStart( I2Timer(sight), 15.0, true, function Trig_Faeries_Farsight )
call TimerStart( I2Timer(udg_faerieReset), 3.0, true, function Trig_Faeries_Reset )
// == Clean up
call RemoveLocation(frostSpawn)
call RemoveLocation(forestSpawn)
set forestSpawn = null
set frostSpawn = null
set forest = null
set frost = null
set wispDeto = null
set frostDies = null
set forestDies = null
endfunction
//===========================================================================
function InitTrig_FaeriesBoss takes nothing returns nothing
set gg_trg_FaeriesBoss = CreateTrigger( )
call TriggerAddAction( gg_trg_FaeriesBoss, function Trig_FaeriesBoss_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Faeries_Golem_Conditions takes nothing returns boolean
return ( (GetUnitTypeId(GetDyingUnit()) == 'e006' ) and ( GetOwningPlayer(GetKillingUnit()) == Player(11) ) )
// thus we know that a wisp has died at the hands of Player 11
endfunction
function Trig_Faeries_Golem_Actions takes nothing returns nothing
local unit d = GetDyingUnit()
local real x = GetUnitX(d)
local real y = GetUnitY(d)
local unit g = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'n00U', x, y, 0.0 )
set d = null
set g = null
endfunction
//===========================================================================
function InitTrig_IceGolem takes nothing returns nothing
set gg_trg_IceGolem = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( gg_trg_IceGolem, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerAddCondition( gg_trg_IceGolem, Condition( function Trig_Faeries_Golem_Conditions) )
call TriggerAddAction( gg_trg_IceGolem, function Trig_Faeries_Golem_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Faeries_IceBeam_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A053')
endfunction
function Trig_Faeries_IceBeam_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local location loc = GetUnitLoc(t)
// for some reason, if the Creeps own this unit (Player(12)) it will fail...dunno why
local unit dummy = CreateUnit( Player(11), 'h003', GetUnitX(u), GetUnitY(u), 0.0 )
call UnitAddAbility( dummy, 'A052' )
call IssuePointOrderLoc( dummy, "shockwave", loc )
call UnitApplyTimedLife( dummy, 'BTLF', 4.0 )
set t = null
call RemoveLocation(loc)
set loc = null
set u = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_IceBeam takes nothing returns nothing
set gg_trg_IceBeam = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( gg_trg_IceBeam, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_SPELL_EFFECT, null )
call TriggerAddCondition( gg_trg_IceBeam, Condition( function Trig_Faeries_IceBeam_Conditions ) )
call TriggerAddAction( gg_trg_IceBeam, function Trig_Faeries_IceBeam_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_TFKillTrees_Kill takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
endfunction
function Trig_TFKillTrees_Actions takes nothing returns nothing
call EnumDestructablesInRect( gg_rct_TFTrees, null, function Trig_TFKillTrees_Kill )
endfunction
//===========================================================================
function InitTrig_TFKillTrees takes nothing returns nothing
set gg_trg_TFKillTrees = CreateTrigger( )
call TriggerAddAction( gg_trg_TFKillTrees, function Trig_TFKillTrees_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_FinalBoss4_Start_Actions takes nothing returns nothing
call Trig_FinalBossTeleport(3)
call DisableTrigger( GetTriggeringTrigger() )
call TriggerExecute( gg_trg_WardenBoss )
endfunction
//===========================================================================
function InitTrig_FinalBoss4_Start takes nothing returns nothing
set gg_trg_FinalBoss4_Start = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_FinalBoss4_Start, gg_rct_End4 )
call TriggerAddCondition( gg_trg_FinalBoss4_Start, Condition( function Trig_EnterBoss_Conditions ) )
call TriggerAddAction( gg_trg_FinalBoss4_Start, function Trig_FinalBoss4_Start_Actions )
endfunction
//TESH.scrollpos=133
//TESH.alwaysfold=0
function Trig_Warden_KillAll takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction
function Trig_Warden_ResetC takes nothing returns nothing
local integer t = H2I(GetExpiredTimer()) // reset timer...
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local boolexpr filter = Condition(function IsPCdAndAlive)
local group g = CreateGroup()
local trigger deathTrig = GetHandleTrigger( I2Timer(t), "deathTrig" )
local group g2
call GroupEnumUnitsInRect( g, finalboss[3], filter)
call DestroyBoolExpr(filter)
set filter = null
if( CountUnitsInGroup(g) < 1 ) then
call DisableTrigger( deathTrig )
call DestroyTrigger( deathTrig )
call RemoveUnit(boss)
set g2 = GetUnitsInRectOfPlayer( finalboss[3], Player(12) )
call ForGroup( g2, function Trig_Warden_KillAll )
// clear out any triggers
call DestroyGroup(g2)
call EnableTrigger( gg_trg_FinalBoss4_Start )
call CleanTimer(I2Timer(t))
call Trig_Boss_Reset_Ping(3)
else
set g2 = CreateGroup()
endif
set deathTrig = null
set boss = null
call DestroyGroup(g)
set g = null
set g2 = null
//
endfunction
function Trig_Warden_Dies takes nothing returns nothing
// a kill...now what
local unit killer = GetKillingUnit()
local integer i = GetPlayerId( GetOwningPlayer(killer) )
local location loc = peekStack( theGYs[i/2] )
local trigger trig = GetTriggeringTrigger()
call DestroyTrigger(trig)
call Trig_AwardBuff( (i/2), 1 )
call CleanTimer(I2Timer(udg_wardenReset))
set trig = null
set killer = null
call TriggerExecute( gg_trg_WKillTrees )
call Trig_Final_Boss_Down(3)
endfunction
function Trig_Warden_FarsightC takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit boss = GetHandleUnit(I2Timer(t), "boss")
if ( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
call MakeMeFarsight(3)
endif
endfunction
function Trig_Warden_GravesC takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local unit grave
local location loc = GetRandomLocInRect( gg_rct_GraveyardSpawn )
if( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
// create a grave in a random spot and give it a 10 second expiration timer
set grave = CreateUnitAtLoc( Player(12), 'o002', loc, 0.0 )
call UnitApplyTimedLife( grave, 'BTLF', 14.0 )
call SetUnitAnimation( grave, "birth" )
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", loc ) )
endif
call RemoveLocation(loc)
set loc = null
set grave = null
set boss = null
endfunction
function Trig_Warden_CorpseSpawnC takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local location loc = GetRandomLocInRect( gg_rct_GraveyardSpawn )
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local unit corpse
if( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
set corpse = CreateCorpse( Player(12), 'u00A', GetLocationX(loc), GetLocationY(loc), 0.0 )
endif
call RemoveLocation(loc)
set boss = null
set loc = null
set corpse = null
endfunction
function Trig_Warden_ImpaleLoop takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local integer i = GetHandleInt(I2Timer(t), "i")
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local unit dummy = CreateUnit( Player(12), 'h003', GetUnitX(boss), GetUnitY(boss), 0.0 )
local real x
local real y
//call BJDebugMsg( "iLoop for the " + I2S(i) + "th time" )
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
if( i > 7 ) then
call UnitAddAbility( dummy, 'A058' )
call IssueImmediateOrder( dummy, "fanofknives" )
call CleanTimer(I2Timer(t))
else
call UnitAddAbility( dummy, 'A059' )
//call BJDebugMsg("Old is " + I2S(R2I(GetUnitX(boss))) + "," + I2S(R2I(GetUnitY(boss))))
set x = ( GetUnitX(boss) + ( 200 * Cos( bj_DEGTORAD * (45*i) ) ) )
set y = ( GetUnitY(boss) + ( 200 * Sin( bj_DEGTORAD * (45*i) ) ) )
//call BJDebugMsg("New is " + I2S(R2I( x ) ) + ", " + I2S(R2I(y)) )
//call BJDebugMsg("----------------------")
//call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", x, y ) )
call IssuePointOrder( dummy, "impale", x, y )
call SetHandleInt(I2Timer(t), "i", (i+1))
endif
set boss = null
set dummy = null
endfunction
function Trig_Warden_ImpaleC takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit boss = GetHandleUnit(I2Timer(t), "boss")
local unit dummy
local integer rand
local integer impaleT
local integer i = 0
if( IsUnitDeadBJ(boss) ) then
call CleanTimer(I2Timer(t))
else
// now make a random number, and if they are unlucky enough...
set rand = GetRandomInt(0, 100)
//call BJDebugMsg(" *** RAND WAS " + I2S(rand) + " *****" )
if( rand < 75 ) then
// start the process for some impales
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Other\\HowlOfTerror\\HowlCaster.mdl", GetUnitX(boss), GetUnitY(boss)) )
set impaleT = H2I(CreateTimer())
call SetHandleInt(I2Timer(impaleT), "i", i)
call SetHandleHandle(I2Timer(impaleT), "boss", boss)
call TimerStart( I2Timer(impaleT), 1.0, true, function Trig_Warden_ImpaleLoop )
endif
endif
set dummy = null
set boss = null
endfunction
function Trig_Warden_Actions takes nothing returns nothing
local location center = GetRectCenter( finalboss[3] )
local unit boss
local integer sight = H2I(CreateTimer())
local integer graves = H2I(CreateTimer())
local integer corpse = H2I(CreateTimer())
local integer impale = H2I(CreateTimer())
local trigger deathTrig = CreateTrigger()
set udg_wardenReset = H2I(CreateTimer())
call PolledWait( 2.5 )
set boss = CreateUnitAtLoc( Player(12), 'E007', center, 0 )
call SetHeroLevel( boss, 15, false )
// ================ end locals ============================
// ********* Setup our Triggers and Timers
call TriggerRegisterUnitEvent( deathTrig, boss, EVENT_UNIT_DEATH )
call TriggerAddAction( deathTrig, function Trig_Warden_Dies )
call SetHandleHandle( I2Timer(udg_wardenReset), "boss", boss )
call SetHandleHandle( I2Timer(udg_wardenReset), "deathTrig", deathTrig )
call SetHandleHandle( I2Timer(sight), "boss", boss )
call SetHandleHandle( I2Timer(graves), "boss", boss )
call SetHandleHandle( I2Timer(corpse), "boss", boss )
call SetHandleHandle( I2Timer(impale), "boss", boss )
// &&&&&&&&&&& Start our Timers
call TimerStart(I2Timer(udg_wardenReset), 1.5, true, function Trig_Warden_ResetC )
call TimerStart(I2Timer(graves), 8.0, true, function Trig_Warden_GravesC )
call TimerStart(I2Timer(sight), 15.0, true, function Trig_Warden_FarsightC )
call TimerStart(I2Timer(corpse), 4.0, true, function Trig_Warden_CorpseSpawnC )
call TimerStart(I2Timer(impale), 12.0, true, function Trig_Warden_ImpaleC )
call RemoveLocation(center)
set center = null
set boss = null
endfunction
//===========================================================================
function InitTrig_WardenBoss takes nothing returns nothing
set gg_trg_WardenBoss = CreateTrigger( )
call TriggerAddAction( gg_trg_WardenBoss, function Trig_Warden_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_WKillTrees_Kill takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
endfunction
function Trig_WKillTrees_Actions takes nothing returns nothing
call EnumDestructablesInRect( gg_rct_WTrees, null, function Trig_WKillTrees_Kill )
endfunction
//===========================================================================
function InitTrig_WKillTrees takes nothing returns nothing
set gg_trg_WKillTrees = CreateTrigger( )
call TriggerAddAction( gg_trg_WKillTrees, function Trig_WKillTrees_Actions )
endfunction
//TESH.scrollpos=69
//TESH.alwaysfold=0
function Trig_Enter_The_Ring_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A04Y' ) //A04Y
endfunction
function Trig_Enter_The_Ring_BoxRemoval takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local destructable nL = GetHandleDestructable(I2Timer(t), "nL")
local destructable nM = GetHandleDestructable(I2Timer(t), "nM")
local destructable nR = GetHandleDestructable(I2Timer(t), "nR")
local destructable sL = GetHandleDestructable(I2Timer(t), "sL")
local destructable sM = GetHandleDestructable(I2Timer(t), "sM")
local destructable sR = GetHandleDestructable(I2Timer(t), "sR")
local destructable wT = GetHandleDestructable(I2Timer(t), "wT")
local destructable wM = GetHandleDestructable(I2Timer(t), "wM")
local destructable wB = GetHandleDestructable(I2Timer(t), "wB")
local destructable eT = GetHandleDestructable(I2Timer(t), "eT")
local destructable eM = GetHandleDestructable(I2Timer(t), "eM")
local destructable eB = GetHandleDestructable(I2Timer(t), "eB")
call KillDestructable(nL)
call KillDestructable(nM)
call KillDestructable(nR)
call KillDestructable(sL)
call KillDestructable(sM)
call KillDestructable(sR)
call KillDestructable(wT)
call KillDestructable(wM)
call KillDestructable(wB)
call KillDestructable(eT)
call KillDestructable(eM)
call KillDestructable(eB)
set nL = null
set nM = null
set nR = null
set sL = null
set sM = null
set sR = null
set wT = null
set wM = null
set wB = null
set eT = null
set eM = null
set eB = null
call CleanTimer(I2Timer(t))
endfunction
function Trig_Enter_The_Ring_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer boxT = H2I(CreateTimer())
local real uX = GetUnitX(u)
local real uY = GetUnitY(u)
local destructable northL = CreateDestructable('B003', (uX-150), (uY+250), 270, 1, 0)
local destructable northM = CreateDestructable('B003', (uX), (uY+250), 270, 1, 1)
local destructable northR = CreateDestructable('B003', (uX+150), (uY+250), 270, 1, 0)
local destructable southL = CreateDestructable('B003', (uX-150), (uY-250), 90, 1, 0)
local destructable southM = CreateDestructable('B003', (uX), (uY-250), 90, 1, 1)
local destructable southR = CreateDestructable('B003', (uX+150), (uY-250), 90, 1, 0)
local destructable westT = CreateDestructable('B003', (uX-250), (uY+150), 0, 1, 0)
local destructable westM = CreateDestructable('B003', (uX-250), (uY), 0, 1, 1)
local destructable westB = CreateDestructable('B003', (uX-250), (uY-150), 0, 1, 0)
local destructable eastT = CreateDestructable('B003', (uX+250), (uY+150), 180, 1, 0)
local destructable eastM = CreateDestructable('B003', (uX+250), (uY), 180, 1, 1)
local destructable eastB = CreateDestructable('B003', (uX+250), (uY-150), 180, 1, 0)
local integer level = GetUnitAbilityLevel(u, 'A04Y')
// d&d part
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', uX, uY, 0 )
local integer dAdDur = ( 1 + (level*2))
// === DURATION OF DUMMY => level*3 ==> yields a 3/6/9 lifetime for channeling
// *** CHANGE FOR 4 LEVELS **** -- need it to be 3/5/7/9
call UnitAddAbility( dummy, 'A003' )
call IssuePointOrder( dummy, "deathanddecay", uX, uY )
call UnitApplyTimedLife( dummy, 'BTLF', dAdDur )
call SetHandleHandle(I2Timer(boxT), "nL", northL)
call SetHandleHandle(I2Timer(boxT), "nM", northM)
call SetHandleHandle(I2Timer(boxT), "nR", northR)
call SetHandleHandle(I2Timer(boxT), "sL", southL)
call SetHandleHandle(I2Timer(boxT), "sM", southM)
call SetHandleHandle(I2Timer(boxT), "sR", southR)
call SetHandleHandle(I2Timer(boxT), "wT", westT)
call SetHandleHandle(I2Timer(boxT), "wM", westM)
call SetHandleHandle(I2Timer(boxT), "wB", westB)
call SetHandleHandle(I2Timer(boxT), "eT", eastT)
call SetHandleHandle(I2Timer(boxT), "eM", eastM)
call SetHandleHandle(I2Timer(boxT), "eB", eastB)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl", u, "overhead" ) )
// === DURATION of BOXES ==> ( 3 + dAdDur) -> 6/8/10/13
call TimerStart(I2Timer(boxT), ( 3 + dAdDur ) , false, function Trig_Enter_The_Ring_BoxRemoval )
set u = null
set dummy = null
set northL = null
set northM = null
set northR = null
set southL = null
set southM = null
set southR = null
set westT = null
set westM = null
set westB = null
set eastT = null
set eastM = null
set eastB = null
endfunction
//===========================================================================
function InitTrig_Enter_The_Ring takes nothing returns nothing
set gg_trg_Enter_The_Ring = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Enter_The_Ring, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Enter_The_Ring, Condition( function Trig_Enter_The_Ring_Conditions ) )
call TriggerAddAction( gg_trg_Enter_The_Ring, function Trig_Enter_The_Ring_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Ret_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A009' )
endfunction
function Trig_Ret_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit u = GetHandleUnit(I2Timer(t), "theUnit")
call UnitRemoveAbility(u, 'A002' )
set u = null
call CleanTimer(I2Timer(t))
endfunction
function Trig_Ret_Actions takes nothing returns nothing
local unit retUnit = GetTriggerUnit()
local integer t = H2I(CreateTimer())
// Retribution Duration!
local integer duration = 6
// ===============
call SetHandleHandle(I2Timer(t), "theUnit", retUnit)
call UnitAddAbility( retUnit, 'A002' )
call SetPlayerAbilityAvailable( GetOwningPlayer( retUnit ), 'A002', false)
call SetUnitAbilityLevel( retUnit, 'A002', GetUnitAbilityLevel( retUnit, 'A009') )
call TimerStart(I2Timer(t), duration, false, function Trig_Ret_Callback)
set retUnit = null
endfunction
//===========================================================================
function InitTrig_Retribution_Aura takes nothing returns nothing
set gg_trg_Retribution_Aura = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Retribution_Aura, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Retribution_Aura, Condition( function Trig_Ret_Conditions ) )
call TriggerAddAction( gg_trg_Retribution_Aura, function Trig_Ret_Actions )
endfunction
//TESH.scrollpos=13
//TESH.alwaysfold=0
function Trig_Living_Flames_Conditions takes nothing returns boolean
return ( GetIssuedOrderId() == String2OrderIdBJ("immolation") )
endfunction
function Trig_Living_Flames_MakeFlame takes unit c, real ang returns nothing
local real cx = GetUnitX(c)
local real cy = GetUnitY(c)
local real x = ( cx + 250*(Cos(ang*bj_DEGTORAD)) )
local real y = ( cy + 250*(Sin(ang*bj_DEGTORAD)) )
local unit d = CreateUnit( GetOwningPlayer(c), 'h003', cx, cy, 0 )
call UnitAddAbility( d, 'A04X')
call SetUnitAbilityLevel( d, 'A04X', GetUnitAbilityLevel(c, 'A04W'))
call IssuePointOrder( d, "impale", x, y )
call UnitApplyTimedLife( d, 'BTLF', 1.5 )
set c = null
set d = null
endfunction
function Trig_Living_Flames_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit c = GetHandleUnit(I2Timer(t), "caster")
local real ang = GetUnitFacing(c)
local integer lvl = GetUnitAbilityLevel(c, 'A04W')
if( GetUnitAbilityLevel(c, 'B01W' ) > 0 ) then
if( lvl == 1 or lvl == 4 ) then
call Trig_Living_Flames_MakeFlame(c, ang)
endif
if( lvl > 1 ) then
set ang = ang + 30
call Trig_Living_Flames_MakeFlame(c, ang)
set ang = ang - 60
call Trig_Living_Flames_MakeFlame(c, ang)
endif
else
call CleanTimer(I2Timer(t))
endif
set c = null
endfunction
function Trig_Living_Flames_Actions takes nothing returns nothing
local integer t = H2I( CreateTimer() )
local unit caster = GetOrderedUnit()
call SetHandleHandle(I2Timer(t), "caster", caster)
call TimerStart(I2Timer(t), 2.25, true, function Trig_Living_Flames_Callback)
set caster = null
endfunction
//===========================================================================
function InitTrig_Living_Flames takes nothing returns nothing
set gg_trg_Living_Flames = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Living_Flames, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( gg_trg_Living_Flames, Condition( function Trig_Living_Flames_Conditions ) )
call TriggerAddAction( gg_trg_Living_Flames, function Trig_Living_Flames_Actions )
endfunction
//TESH.scrollpos=37
//TESH.alwaysfold=0
function Trig_Comb_Crit_Conditions takes nothing returns boolean
return ( GetUnitAbilityLevel(GetTriggerUnit(), 'A027') > 0 )
endfunction
function Do_We_Crit takes integer lvl returns boolean
// Here we define our "% chances" based on level; 30%/50%/70%
local integer rand
set rand = GetRandomInt(1,10)
set rand = GetRandomInt(1,10)
set rand = GetRandomInt(1,10)
if ( rand <= ( 1 + ( lvl * 2 ) ) ) then
return true
endif
return false
endfunction
function Trig_Comb_Is_Enemy takes nothing returns boolean
// needs to be an enemy and NOT a dummy!!
local integer int = GetUnitTypeId(GetFilterUnit())
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and ( int != 'h003' ) and ( int != 'h00D' ) )
endfunction
function ApplyAndText takes real damage returns nothing
call GlobalCauseSpellDamage( GetTriggerUnit(), GetSpellTargetUnit(), damage )
// =========== damage*3 since our crit is 50%, and then so its 150% =========
call GlobalFloatingCombatText( GetSpellTargetUnit(), R2I(damage * 3), 255, 255, 0, true )
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl", GetSpellTargetUnit(), "overhead" ) )
endfunction
function Trig_Comb_BW takes nothing returns nothing
local integer dmg = (25 + (50*GetUnitAbilityLevel(GetTriggerUnit(), 'A04Z')))
call GlobalCauseSpellDamage( GetTriggerUnit(), GetEnumUnit(), dmg )
call GlobalFloatingCombatText( GetEnumUnit(), dmg*3, 255, 255, 0, true )
endfunction
function Trig_Comb_Crit_Actions takes nothing returns nothing
local real damage
local integer anAbil = GetSpellAbilityId()
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( u, anAbil )
local rect area = Rect( GetUnitX(u)-350, GetUnitY(u)-350, GetUnitX(u)+350, GetUnitY(u)+350)
local group units = GetUnitsInRectMatching(area, Condition(function Trig_Comb_Is_Enemy))
if( Do_We_Crit( GetUnitAbilityLevel( u, 'A027' ) ) ) then
// ==================== Checking Crits =================
if ( anAbil == 'A01X' ) then
// Apply Damage based on <A01X,DataA1/2/3>
// comes in at 50, 80, 110
call ApplyAndText( 20 + (30*lvl) )
endif
if ( anAbil == 'A04Z' ) then
// rawr rawr rawr BLAST WAVE!
call ForGroupBJ( units, function Trig_Comb_BW)
endif
// ====================== End Checking Crits ===========
endif // end if weDoCrit
set area = null
set u = null
call DestroyGroup(units)
set units = null
endfunction
//===========================================================================
function InitTrig_Combustion_Crit takes nothing returns nothing
// set gg_trg_Combustion_Crit = CreateTrigger( )
// call TriggerRegisterAnyUnitEventBJ( gg_trg_Combustion_Crit, EVENT_PLAYER_UNIT_SPELL_CAST )
// call TriggerAddCondition( gg_trg_Combustion_Crit, Condition( function Trig_Comb_Crit_Conditions ) )
// call TriggerAddAction( gg_trg_Combustion_Crit, function Trig_Comb_Crit_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Mana_Leech_Conditions takes nothing returns boolean
return ( GetUnitAbilityLevel(GetAttacker(), 'A06C' ) > 0 )
endfunction
function Trig_Mana_Leech_Actions takes nothing returns nothing
local unit u = GetAttacker()
local integer lvl = GetUnitAbilityLevel( GetAttacker(), 'A06C' )
local integer amt = ( 3+(5*lvl) )
call SetUnitState( u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) + amt))
set u = null
endfunction
//===========================================================================
function InitTrig_Mana_Leech takes nothing returns nothing
set gg_trg_Mana_Leech = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mana_Leech, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Mana_Leech, Condition( function Trig_Mana_Leech_Conditions ) )
call TriggerAddAction( gg_trg_Mana_Leech, function Trig_Mana_Leech_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_FireBlast_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A01X' )
endfunction
function Trig_FireBlast_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local unit d = CreateUnit(GetOwningPlayer(c), 'h003', GetUnitX(c), GetUnitY(c), 0.0 )
call UnitAddAbility( d, 'A09W')
call SetUnitAbilityLevel( d, 'A09W', GetUnitAbilityLevel(c, GetSpellAbilityId()) )
call UnitApplyTimedLife(d, 'BTLF', 2.0 )
call IssueTargetOrder( d, "soulburn", t )
set d = null
endfunction
//===========================================================================
function InitTrig_FireBlast takes nothing returns nothing
//set gg_trg_FireBlast = CreateTrigger( )
//call TriggerRegisterAnyUnitEventBJ( gg_trg_FireBlast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
//call TriggerAddCondition( gg_trg_FireBlast, Condition( function Trig_FireBlast_Conditions ) )
//call TriggerAddAction( gg_trg_FireBlast, function Trig_FireBlast_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Furor_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A03A' )
endfunction
function Trig_Furor_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( u, 'A03A' )
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(u), GetUnitY(u), 0 )
call UnitAddAbility( dummy, 'A03B' )
call SetUnitAbilityLevel( dummy, 'A03B', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "healingwave", u )
set u = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Furor takes nothing returns nothing
set gg_trg_Furor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Furor, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Furor, Condition( function Trig_Furor_Conditions ) )
call TriggerAddAction( gg_trg_Furor, function Trig_Furor_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Holy_Attack_Local_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A03M' )
endfunction
function Trig_HA_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit u = GetHandleUnit(I2Timer(t), "haUnit")
call UnitRemoveAbility( u , 'A03I' )
set u = null
call FlushHandleLocals(I2Timer(t))
call DestroyTimer(I2Timer(t))
endfunction
function Trig_Holy_Attack_Local_Actions takes nothing returns nothing
local unit haUnit = GetSpellTargetUnit()
local integer t = H2I(CreateTimer())
local unit dummy = CreateUnit( GetOwningPlayer(haUnit), 'h003', GetUnitX(haUnit), GetUnitY(haUnit), 0.0 )
local integer lvl = GetUnitAbilityLevel( GetTriggerUnit(), 'A03M' )
// === Holy Attack Duration ==> A duration of 10 would cause it to last 15 seconds...wierd.
local real duration = 7.5
// =============
call SetHandleHandle(I2Timer(t), "haUnit", haUnit)
call UnitAddAbility( haUnit, 'A03I' )
call SetUnitAbilityLevel( haUnit, 'A03I', lvl )
call SetPlayerAbilityAvailable( GetOwningPlayer(haUnit), 'A03I', false )
call TimerStart(I2Timer(t), duration, false, function Trig_HA_Callback)
call UnitAddAbility( dummy, 'A05N' )
call SetUnitAbilityLevel( dummy, 'A05N', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "unholyfrenzy", haUnit )
set dummy = null
set haUnit = null
endfunction
//===========================================================================
function InitTrig_Holy_Attack_Local takes nothing returns nothing
set gg_trg_Holy_Attack_Local = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Attack_Local, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Attack_Local, Condition( function Trig_Holy_Attack_Local_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Attack_Local, function Trig_Holy_Attack_Local_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Repentance_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Trig_Repentance_Actions takes nothing returns nothing
local unit t = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), 'A000')
local real manaBurnt = GetUnitState(t, UNIT_STATE_MANA) * (0.1 +(lvl * 0.10))
call SetUnitState(t, UNIT_STATE_MANA, RMaxBJ((GetUnitState(t, UNIT_STATE_MANA) - manaBurnt), 0) )
call GlobalFloatingCombatText( t, R2I(manaBurnt), 0, 255, 128, false)
set t = null
endfunction
//===========================================================================
function InitTrig_Repentance takes nothing returns nothing
set gg_trg_Repentance = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Repentance, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Repentance, Condition( function Trig_Repentance_Conditions ) )
call TriggerAddAction( gg_trg_Repentance, function Trig_Repentance_Actions )
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
function Trig_Frost_Nova_Ensnare_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A044' )
endfunction
function Trig_Frost_Nova_Ensnare_Func001A takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit dummy = CreateUnit(GetOwningPlayer(u), 'h003', GetUnitX(u), GetUnitY(u), 0)
call UnitAddAbility(dummy, 'A00G')
call SetUnitAbilityLevel(dummy, 'A00G', GetUnitAbilityLevel(u, 'A044'))
call IssueTargetOrder( dummy, "ensnare", GetEnumUnit() )
call UnitApplyTimedLife(dummy, 'BTLF', 1.0)
set u = null
set dummy = null
endfunction
function Trig_Frost_Nova_Ensnare_Actions takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
local group g = CreateGroup()
local unit u = GetTriggerUnit()
local unit dummy = CreateUnit(GetOwningPlayer(u), 'h003', GetUnitX(u), GetUnitY(u), 0)
call GroupEnumUnitsInRange( g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 450.0, null )
call ForGroup( g, function Trig_Frost_Nova_Ensnare_Func001A )
call DestroyGroup(g)
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
call UnitAddAbility(dummy, 'A06W')
call SetUnitAbilityLevel( dummy, 'A06W', GetUnitAbilityLevel(u, 'A044'))
call IssuePointOrder( dummy, "silence", GetUnitX(dummy), GetUnitY(dummy))
set dummy = null
set u = null
set g = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Frost_Nova_Ensnare takes nothing returns nothing
set gg_trg_Frost_Nova_Ensnare = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frost_Nova_Ensnare, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Frost_Nova_Ensnare, Condition( function Trig_Frost_Nova_Ensnare_Conditions ) )
call TriggerAddAction( gg_trg_Frost_Nova_Ensnare, function Trig_Frost_Nova_Ensnare_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Frost_Nova_Effect_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A044' )
endfunction
function Trig_Frost_Nova_Effect_Actions takes nothing returns nothing
local integer outer = 1
local integer inner = 1
local real cX = GetUnitX(GetTriggerUnit())
local real cY = GetUnitY(GetTriggerUnit())
local real x
local real y
loop
exitwhen outer > 5
set inner = 0
loop
exitwhen inner > 36
set x = cX + (( outer * 90 ) * Cos( inner * 10 * bj_DEGTORAD))
set y = cY + (( outer * 90 ) * Sin( inner * 10 * bj_DEGTORAD))
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Other\\FrostArrows\\NagaColdArrowMissile.mdl", x, y ) )
set inner = inner + 1
endloop
set outer = outer + 1
endloop
endfunction
//===========================================================================
function InitTrig_Frost_Nova_Effect takes nothing returns nothing
set gg_trg_Frost_Nova_Effect = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frost_Nova_Effect, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Frost_Nova_Effect, Condition( function Trig_Frost_Nova_Effect_Conditions ) )
call TriggerAddAction( gg_trg_Frost_Nova_Effect, function Trig_Frost_Nova_Effect_Actions )
endfunction
//TESH.scrollpos=96
//TESH.alwaysfold=0
function Trig_Snow_Day_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A00B')
endfunction
function Trig_Snow_Day_NotFrozen takes nothing returns boolean
local integer t = H2I(GetExpiredTimer())
local unit u = GetHandleUnit(I2Timer(t), "caster")
if( GetUnitAbilityLevel(GetFilterUnit(), 'B01K') > 0 ) then
set u = null
return false
endif
if( not (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(u))) ) then
set u = null
return false
endif
set u = null
return true
endfunction
function Trig_Snow_Day_Refreeze takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit u = GetHandleUnit(I2Timer(t), "caster")
local location loc = GetHandleLocation(I2Timer(t), "loc")
local unit dummy = CreateUnitAtLoc(GetOwningPlayer(u), 'h003', loc, 0)
call UnitAddAbility(dummy, 'A045')
call IssueTargetOrder(dummy, "ensnare", GetEnumUnit())
call UnitApplyTimedLife(dummy, 'BTLF', 1.0)
set dummy = null
set loc = null
set u = null
endfunction
function Trig_Snow_Day_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local location loc = GetHandleLocation(I2Timer(t), "loc")
local integer steps = GetHandleInt(I2Timer(t), "steps")
local integer duration = GetHandleInt(I2Timer(t), "duration")
local effect nn
local effect ss
local effect ww
local effect ee
local effect ne
local effect nw
local effect se
local effect sw
// get units in the 'snow area' who Don't have the buff.
//local weathereffect snow = GetHandleWeather(I2Timer(t), "snow")
local group units = CreateGroup()
local boolexpr filter = Condition(function Trig_Snow_Day_NotFrozen)
call GroupEnumUnitsInRange( units, GetLocationX(loc), GetLocationY(loc), 325, filter)
call DestroyBoolExpr(filter)
set filter = null
// REFREEZE BAHHHHHHHH
call ForGroup(units, function Trig_Snow_Day_Refreeze)
// if steps > duration...pause timer, flush locals, destroy timer
if( steps > duration ) then
//call EnableWeatherEffect(snow, false)
//call RemoveWeatherEffect(snow)
set nn = GetHandleEffect(I2Timer(t), "nn")
set ss = GetHandleEffect(I2Timer(t), "ss")
set ee = GetHandleEffect(I2Timer(t), "ee")
set ww = GetHandleEffect(I2Timer(t), "ww")
set nw = GetHandleEffect(I2Timer(t), "nw")
set ne = GetHandleEffect(I2Timer(t), "ne")
set sw = GetHandleEffect(I2Timer(t), "sw")
set se = GetHandleEffect(I2Timer(t), "se")
call DestroyEffect( nn )
call DestroyEffect( ss )
call DestroyEffect( ee )
call DestroyEffect( ww )
call DestroyEffect( nw )
call DestroyEffect( ne )
call DestroyEffect( sw )
call DestroyEffect( se )
call CleanTimer(I2Timer(t))
call RemoveLocation(loc)
endif
call DestroyGroup(units)
call SetHandleInt(I2Timer(t), "steps", steps+1)
set nn = null
set ss = null
set ee = null
set ww = null
set nw = null
set ne = null
set sw = null
set se = null
set loc = null
set units = null
endfunction
function Trig_Snow_Day_Actions takes nothing returns nothing
local integer t = H2I(CreateTimer())
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(u, 'A00B')
local integer duration = 2 + (lvl*2)
local location loc = GetSpellTargetLoc()
local real x = GetLocationX(loc)
local real y = GetLocationY(loc)
// IFF THE RANGE IS 400, then this is good; if changed!!
local real offL = 300
local real offS = 204
local effect nn = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x, y+offL)
local effect ss = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x, y-offL)
local effect ee = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x+offL, y)
local effect ww = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x-offL, y)
local effect nw = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x-offS, y+offS )
local effect ne = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x+offS, y+offS )
local effect sw = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x-offS, y-offS )
local effect se = AddSpecialEffect("Abilities\\Spells\\Other\\FrostDamage\\FrostDamage.mdl", x+offS, y-offS )
call SetHandleHandle(I2Timer(t), "loc", loc)
call SetHandleHandle(I2Timer(t), "caster", u)
call SetHandleInt(I2Timer(t), "duration", duration)
call SetHandleInt(I2Timer(t), "steps", 0)
call SetHandleHandle(I2Timer(t), "nn", nn)
call SetHandleHandle(I2Timer(t), "ss", ss)
call SetHandleHandle(I2Timer(t), "ww", ww)
call SetHandleHandle(I2Timer(t), "ee", ee)
call SetHandleHandle(I2Timer(t), "nw", nw)
call SetHandleHandle(I2Timer(t), "ne", ne)
call SetHandleHandle(I2Timer(t), "sw", sw)
call SetHandleHandle(I2Timer(t), "se", se)
call TimerStart(I2Timer(t), 1.0, true, function Trig_Snow_Day_Callback)
set nn = null
set ss = null
set ee = null
set ww = null
set nw = null
set ne = null
set sw = null
set se = null
set loc = null
set u = null
endfunction
//===========================================================================
function InitTrig_Snow_Day takes nothing returns nothing
set gg_trg_Snow_Day = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Snow_Day, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Snow_Day, Condition(function Trig_Snow_Day_Conditions ))
call TriggerAddAction( gg_trg_Snow_Day, function Trig_Snow_Day_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function TrigFrostBoltCritCond takes nothing returns boolean
if ( (GetSpellAbilityId() == 'A01I') and (GetUnitAbilityLevel(GetSpellTargetUnit(), 'B020') > 0) ) then
return true
endif
return false
endfunction
function Trig_Frostbolt_Crit_Actions takes nothing returns nothing
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), 'A01I')
local real damage
local unit u = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
if( lvl == 4 ) then
set damage = 165
endif
if ( lvl == 3 ) then
set damage = 135
endif
if ( lvl == 2 ) then
set damage = 105
endif
if ( lvl == 1 ) then
set damage = 75
endif
call PolledWait(0.5)
call GlobalCauseSpellDamage( u, t, damage)
call GlobalFloatingCombatText( t, R2I((damage*7)/3), 0, 0, 255, true )
set u = null
set t = null
endfunction
//===========================================================================
function InitTrig_Frostbolt_Crit takes nothing returns nothing
set gg_trg_Frostbolt_Crit = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Frostbolt_Crit, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Frostbolt_Crit, Condition( function TrigFrostBoltCritCond ) )
call TriggerAddAction( gg_trg_Frostbolt_Crit, function Trig_Frostbolt_Crit_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function TrigConeCritCond takes nothing returns boolean
return GetSpellAbilityId() == 'A01H'
endfunction
function TrigConeHasBuff takes nothing returns boolean
return ( (UnitHasBuffBJ(GetFilterUnit(), 'B01K')) or (UnitHasBuffBJ(GetFilterUnit(), 'B020')) )
endfunction
function Trig_Frost_Breath_Crits takes nothing returns nothing
local real damage
local integer level = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId() )
set damage = 0.75 * (25 + (50 * level) )
call GlobalCauseSpellDamage( GetTriggerUnit(), GetEnumUnit(), damage )
call GlobalFloatingCombatText( GetEnumUnit(), R2I((damage*7)/3), 0, 0, 255, true )
endfunction
function Trig_Cone_of_Cold_R3_Crit_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real dist = 300
local real facing = GetUnitFacing(u)
local real x = GetUnitX(u) + (dist * Cos( facing * bj_DEGTORAD ))
local real y = GetUnitY(u) + (dist * Sin( facing * bj_DEGTORAD ))
local boolexpr filter = Condition( function TrigConeHasBuff )
local group units = CreateGroup()
call GroupEnumUnitsInRange( units, x, y, 250, filter )
call ForGroup( units , function Trig_Frost_Breath_Crits )
call DestroyBoolExpr(filter)
call DestroyGroup(units)
set filter = null
set units = null
set u = null
endfunction
//===========================================================================
function InitTrig_Cone_of_Cold_Crit takes nothing returns nothing
set gg_trg_Cone_of_Cold_Crit = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Cone_of_Cold_Crit, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Cone_of_Cold_Crit, Condition( function TrigConeCritCond ) )
call TriggerAddAction( gg_trg_Cone_of_Cold_Crit, function Trig_Cone_of_Cold_R3_Crit_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Rain_Dance_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A04U' )
endfunction
function Trig_Rain_Dance_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( u, 'A04U' )
local location loc = GetSpellTargetLoc()
local unit dummy = CreateUnit(GetOwningPlayer(u), 'h003', GetUnitX(u), GetUnitY(u), 0 )
call UnitAddAbility( dummy, 'A04T' )
call SetUnitAbilityLevel( dummy, 'A04T', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 12.00 )
call IssuePointOrderLoc( dummy, "monsoon", loc )
set loc = null
set u = null
endfunction
//===========================================================================
function InitTrig_Rain_Dance takes nothing returns nothing
set gg_trg_Rain_Dance = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Rain_Dance, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Rain_Dance, Condition( function Trig_Rain_Dance_Conditions ) )
call TriggerAddAction( gg_trg_Rain_Dance, function Trig_Rain_Dance_Actions )
endfunction
//TESH.scrollpos=18
//TESH.alwaysfold=0
function Trig_Ice_Block_locals_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A015'
endfunction
function Trig_IB_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit u = GetHandleUnit(I2Timer(t), "theMage")
local integer steps = GetHandleInt(I2Timer(t), "steps")
local integer limit = GetHandleInt(I2Timer(t), "limit")
local unit dummy
local real offset = 200
local real loX = GetUnitX(u) - offset
local real hiX = GetUnitX(u) + offset
local real loY = GetUnitY(u) - offset
local real hiY = GetUnitY(u) + offset
if ( steps > limit ) then
call CleanTimer(I2Timer(t))
set u = null
set dummy = null
else
set dummy = CreateUnit( GetOwningPlayer(u), 'h00D', GetRandomReal(loX, hiX), GetRandomReal(loY,hiY) , 0 )
call SetUnitPathing( dummy, false )
call UnitAddAbility( dummy, 'A04V')
call IssueTargetOrder( dummy, "frostnova", dummy )
call UnitApplyTimedLife( dummy, 'BTLF', 1.0 )
call SetHandleInt(I2Timer(t), "steps", steps+1)
endif
set u = null
set dummy = null
endfunction
function Trig_Ice_Block_locals_Actions takes nothing returns nothing
local unit icedUnit = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(GetTriggerUnit(), 'A015')
local integer duration = level + 1 // 2/3/4/5 seconds
local real period = .25
local integer t = H2I(CreateTimer())
call SetHandleHandle(I2Timer(t), "theMage", icedUnit)
call SetHandleInt(I2Timer(t), "steps", 0)
call SetHandleInt(I2Timer(t), "limit", R2I(duration / period))
call UnitRemoveBuffs(icedUnit, false, true )
call TimerStart(I2Timer(t), period, true, function Trig_IB_Callback)
set icedUnit = null
endfunction
//===========================================================================
function InitTrig_Ice_Block takes nothing returns nothing
set gg_trg_Ice_Block = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ice_Block, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ice_Block, Condition( function Trig_Ice_Block_locals_Conditions ) )
call TriggerAddAction( gg_trg_Ice_Block, function Trig_Ice_Block_locals_Actions )
endfunction
//TESH.scrollpos=11
//TESH.alwaysfold=0
function Trig_Explode_Conditions takes nothing returns boolean
return false
//( GetSpellAbilityId() == 'A00A' )
endfunction
function Trig_Explode_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real uX = GetUnitX(u)
local real uY = GetUnitY(u)
local unit dummyOne = CreateUnit(GetOwningPlayer(u), 'h003', uX, uY, 0)
local unit dummyTwo = CreateUnit(GetOwningPlayer(u), 'h003', uX, uY, 0)
local integer lvl = GetUnitAbilityLevel(u, 'A00A')
//call BJDebugMsg("lvl is " + I2S(lvl))
call UnitAddAbility(dummyOne, 'A035')
call SetUnitAbilityLevel(dummyOne, 'A035', lvl)
call IssuePointOrderLoc(dummyOne, "flamestrike",GetSpellTargetLoc())
call UnitApplyTimedLife(dummyOne, 'BTLF', 2.0)
call UnitAddAbility(dummyTwo, 'A034')
call SetUnitAbilityLevel(dummyTwo, 'A034', lvl)
call IssueTargetOrder(dummyTwo, "chainlightning", GetSpellTargetUnit())
call UnitApplyTimedLife(dummyTwo, 'BTLF', 2.0)
set u = null
set dummyOne = null
set dummyTwo = null
endfunction
//===========================================================================
function InitTrig_Explode takes nothing returns nothing
set gg_trg_Explode = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Explode, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Explode, Condition( function Trig_Explode_Conditions ) )
call TriggerAddAction( gg_trg_Explode, function Trig_Explode_Actions )
endfunction
//TESH.scrollpos=4
//TESH.alwaysfold=0
function Trig_Fire_Strike_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A07W' )
endfunction
function Trig_Fire_Strike_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local unit dummy = CreateUnit( GetOwningPlayer(c), 'h003', GetUnitX(t), GetUnitY(t), 0.0 )
local integer lvl = GetUnitAbilityLevel(c, 'A07W')
call PolledWait(0.01)
call SetUnitPosition( c, GetUnitX(t), GetUnitY(t) )
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
call UnitAddAbility( dummy, 'A07X' )
call SetUnitAbilityLevel( dummy, 'A07X', lvl )
call IssueImmediateOrder( dummy, "fanofknives" )
set dummy = null
set c = null
set t = null
endfunction
//===========================================================================
function InitTrig_Fire_Strike takes nothing returns nothing
set gg_trg_Fire_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Fire_Strike, Condition( function Trig_Fire_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Fire_Strike, function Trig_Fire_Strike_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Pinkfire_Summon_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A02E' )
endfunction
function Trig_Pinkfire_Summon_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(u, 'A02E')
local integer b = 'n018'
local unit bear
if ( lvl == 2 ) then
set b = 'n019'
endif
if ( lvl == 3 ) then
set b = 'n01A'
endif
if ( lvl == 4 ) then
set b = 'n01P'
endif
set bear = CreateUnit(GetOwningPlayer(u), b, GetUnitX(u), GetUnitY(u), 0)
call SetUnitVertexColor(bear, 200, 50, 0, 100)
call UnitApplyTimedLife(bear, 'BTLF', 35.0)
set bear = null
set u = null
endfunction
//===========================================================================
function InitTrig_Pinkfire_Summon takes nothing returns nothing
set gg_trg_Pinkfire_Summon = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pinkfire_Summon, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Pinkfire_Summon, Condition( function Trig_Pinkfire_Summon_Conditions ) )
call TriggerAddAction( gg_trg_Pinkfire_Summon, function Trig_Pinkfire_Summon_Actions )
endfunction
//TESH.scrollpos=52
//TESH.alwaysfold=0
function Trig_Pinkfire_Charge_Conditions takes nothing returns boolean
local integer a = GetSpellAbilityId()
if ( (a == 'A02F') or (a == 'A02G') or (a == 'A02H') )then
return true
endif
return false
endfunction
function Trig_Pinkfire_Charge_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit caster = GetHandleUnit(I2Timer(t), "caster")
local unit target = GetHandleUnit(I2Timer(t), "target" )
local real endX = GetHandleReal(I2Timer(t), "endX")
local real endY = GetHandleReal(I2Timer(t), "endY")
local real curX = GetHandleReal(I2Timer(t), "curX")
local real curY = GetHandleReal(I2Timer(t), "curY")
local real theAngle = GetHandleReal(I2Timer(t), "theAngle")
local real theDistance = GetHandleReal(I2Timer(t), "theDistance")
local real curDistance = GetHandleReal(I2Timer(t), "curDistance")
local integer distPerTick = 50
if ( curDistance < 120 ) then
call SetUnitPathing( caster, true )
call PauseUnit(caster, false)
call IssueTargetOrder( caster, "attack", target )
call CleanTimer(I2Timer(t))
else
// our loop
set curDistance = curDistance - distPerTick
set curX = endX + curDistance * Cos(theAngle)
set curY = endY + curDistance * Sin(theAngle)
call SetUnitPosition( caster, curX, curY )
call SetHandleReal( I2Timer(t), "curDistance", curDistance )
call SetHandleReal( I2Timer(t), "curX", curX )
call SetHandleReal( I2Timer(t), "curY", curY )
endif
set target = null
set caster = null
endfunction
function Trig_Pinkfire_Charge_Actions takes nothing returns nothing
local unit target = GetSpellTargetUnit()
local unit caster = GetTriggerUnit()
local real endX = GetUnitX(target)
local real endY = GetUnitY(target)
local real curX = GetUnitX(caster)
local real curY = GetUnitY(caster)
local real theAngle = (Atan2((curY-endY), (curX-endX)) )
local real dx = (curX-endX)
local real dy = (curY-endY)
local real theDistance = SquareRoot( dx*dx + dy*dy )
local real curDistance = theDistance
local integer t = H2I(CreateTimer())
call PolledWait(0.1)
call SetHandleHandle(I2Timer(t), "caster", caster)
call SetHandleHandle(I2Timer(t), "target", target)
call SetHandleReal(I2Timer(t), "endX", endX )
call SetHandleReal(I2Timer(t), "endY", endY )
call SetHandleReal(I2Timer(t), "curX", curX )
call SetHandleReal(I2Timer(t), "curY", curY )
call SetHandleReal(I2Timer(t), "theAngle", theAngle )
call SetHandleReal(I2Timer(t), "theDistance", theDistance )
call SetHandleReal(I2Timer(t), "curDistance", curDistance )
call PauseUnit(caster, true)
call SetUnitPathing( caster, false )
call TimerStart(I2Timer(t), 0.02, true, function Trig_Pinkfire_Charge_Callback )
set caster = null
set target = null
endfunction
//===========================================================================
function InitTrig_Pinkfire_Charge takes nothing returns nothing
set gg_trg_Pinkfire_Charge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pinkfire_Charge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Pinkfire_Charge, Condition( function Trig_Pinkfire_Charge_Conditions ) )
call TriggerAddAction( gg_trg_Pinkfire_Charge, function Trig_Pinkfire_Charge_Actions )
endfunction
//TESH.scrollpos=42
//TESH.alwaysfold=0
function Trig_BearDies_IsBear takes nothing returns boolean
local integer t = GetUnitTypeId(GetFilterUnit())
if( t == 'n00I' ) then
return true
elseif( t == 'n00H' ) then
return true
elseif( t == 'n00J' ) then
return true
elseif( t == 'n015' ) then
return true
elseif( t == 'n016' ) then
return true
elseif( t == 'n017' ) then
return true
elseif( t == 'n012' ) then
return true
elseif( t == 'n013' ) then
return true
elseif( t == 'n014' ) then
return true
elseif( t == 'n018' ) then
return true
elseif( t == 'n019' ) then
return true
elseif( t == 'n01A' ) then
return true
elseif( t == 'z000' ) then
return true
elseif( t == 'z001' ) then
return true
elseif( t == 'z002' ) then
return true
endif
return false
endfunction
function Trig_BearDies_KillAll takes nothing returns nothing
// a bear mancer just died... :*(
// clean house...
local unit u = GetTriggerUnit()
local integer pID = GetPlayerId(GetOwningPlayer(u))
local group g = CreateGroup()
local boolexpr cond = Condition(function Trig_BearDies_IsBear)
call GroupEnumUnitsOfPlayer( g, Player(pID), cond )
call DestroyBoolExpr(cond)
call ForGroup(g, function Purge_Callback )
set u = null
endfunction
function Trig_BearDeadKillSummons_Actions takes nothing returns nothing
local trigger trig
local integer i = 0
loop
exitwhen i > 7
if( udg_theHeroes[i] != null) then
if( GetUnitTypeId(udg_theHeroes[i]) == 'N00X' ) then
set trig = CreateTrigger()
call TriggerRegisterUnitEvent( trig, udg_theHeroes[i], EVENT_UNIT_DEATH )
//call BJDebugMsg("Player " + I2S(i+1) + " is a bearmancer. Trig Made.")
call TriggerAddAction( trig, function Trig_BearDies_KillAll )
endif
else
//call BJDebugMsg("Player " + I2S(i+1) + " is not playing.")
endif
set i = i + 1
endloop
set trig = null
endfunction
//===========================================================================
function InitTrig_BearDeadKillSummons takes nothing returns nothing
set gg_trg_BearDeadKillSummons = CreateTrigger( )
call TriggerAddAction( gg_trg_BearDeadKillSummons, function Trig_BearDeadKillSummons_Actions )
endfunction
//TESH.scrollpos=22
//TESH.alwaysfold=0
function Trig_Blazing_Speed_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A036' )
endfunction
function Trig_Blazing_Speed_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit u = GetHandleUnit(I2Timer(t), "caster")
local integer steps = GetHandleInt(I2Timer(t), "steps")
local integer duration = GetHandleInt(I2Timer(t), "duration")
local unit dummy
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local integer lvl = GetHandleInt(I2Timer(t), "lvl")
if ( steps > duration ) then
call CleanTimer(I2Timer(t))
else
set dummy = CreateUnit(GetOwningPlayer(u), 'h003', x, y, 0)
call UnitAddAbility(dummy, 'A00P')
call SetUnitAbilityLevel(dummy, 'A00P', lvl)
call IssuePointOrder(dummy, "flamestrike", x, y)
call UnitApplyTimedLife(dummy, 'BTLF', 1.5 )
call SetHandleInt(I2Timer(t), "steps", steps+1)
endif
set dummy = null
set u = null
endfunction
function Trig_Blazing_Speed_Actions takes nothing returns nothing
local integer t = H2I(CreateTimer())
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(u, 'A036')
local unit dummy = CreateUnit(GetOwningPlayer(u), 'h003', GetUnitX(u), GetUnitY(u), 0)
local integer duration = 8
call UnitAddAbility(dummy, 'A00O')
call SetUnitAbilityLevel(dummy, 'A00O', lvl)
call IssueTargetOrder( dummy, "slow", u)
call UnitApplyTimedLife( dummy, 'BTLF', 1.0 )
call SetHandleHandle(I2Timer(t), "caster", u )
call SetHandleInt(I2Timer(t), "steps", 0 )
call SetHandleInt(I2Timer(t), "duration", duration*2)
call SetHandleInt(I2Timer(t), "lvl", lvl)
call TimerStart( I2Timer(t), 0.5, true, function Trig_Blazing_Speed_Callback )
set u = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Blazing_Speed takes nothing returns nothing
set gg_trg_Blazing_Speed = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Blazing_Speed, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Blazing_Speed, Condition( function Trig_Blazing_Speed_Conditions ) )
call TriggerAddAction( gg_trg_Blazing_Speed, function Trig_Blazing_Speed_Actions )
// CLEAR THIS OUT IF YOU WANT TO USE TIHS SPELL...
call DisableTrigger( gg_trg_Blazing_Speed )
call DestroyTrigger( gg_trg_Blazing_Speed )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Trap_Card_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A078' )
endfunction
function Trig_Trap_Card_UnitToAbil takes integer uid returns integer
if( uid == 'H001' or uid == 'O004' or uid == 'H000' or uid == 'H00A' or uid == 'U001' or uid == 'E001' or uid == 'E000' or uid == 'E002' or uid == 'O006' or uid == 'N00D' ) then
return 'A07A' // Male unit...turn into female
endif
if( uid == 'H008' or uid == 'H007' or uid == 'N00W' ) then
return 'A079' // female unit...turn into male
endif
return 'A07B' // turn into ???
endfunction
function Trig_Trap_Card_Go takes nothing returns nothing
local unit card = GetHandleUnit( GetTriggeringTrigger(), "card" )
local unit t = GetTriggerUnit()
local unit dummy
local integer abil
local integer lvl = GetHandleInt( GetTriggeringTrigger(), "lvl" )
if( IsUnitEnemy( t, GetOwningPlayer(card)) ) then
set abil = Trig_Trap_Card_UnitToAbil( GetUnitTypeId(t) )
set dummy = CreateUnit( GetOwningPlayer(card), 'h003', GetUnitX(card), GetUnitY(card), 0.0 )
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
call UnitAddAbility( dummy, abil )
call SetUnitAbilityLevel( dummy, abil, lvl )
call IssueTargetOrder( dummy, "hex", t )
call KillUnit(card)
call DestroyTrigger( GetTriggeringTrigger() )
endif
set t = null
set card = null
endfunction
function Trig_Trap_Card_Actions takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local unit theCard = CreateUnitAtLoc( GetOwningPlayer(GetTriggerUnit()), 'n00Y', loc, 0.0 )
local trigger trig = CreateTrigger()
call TriggerRegisterUnitInRange( trig, theCard, 100.0, null )
call TriggerAddAction( trig, function Trig_Trap_Card_Go )
call SetHandleHandle( trig, "card", theCard )
call SetHandleInt( trig, "lvl", GetUnitAbilityLevel( GetTriggerUnit(), 'A078' ))
call UnitApplyTimedLife( theCard, 'BTLF', 30.0 )
set trig = null
set theCard = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Trap_Card takes nothing returns nothing
set gg_trg_Trap_Card = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Trap_Card, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Trap_Card, Condition( function Trig_Trap_Card_Conditions ) )
call TriggerAddAction( gg_trg_Trap_Card, function Trig_Trap_Card_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ExplosiveTrap_Conditions takes nothing returns boolean
local integer i = GetUnitTypeId(GetEnteringUnit())
if ( i == 'n00E' ) then
return true
endif
if ( i == 'n00F' ) then
return true
endif
if ( i == 'n00G' ) then
return true
endif
if ( i == 'n01L' ) then
return true
endif
return false
endfunction
function Trig_ExplosiveTrap_Actions takes nothing returns nothing
call SetUnitExplodedBJ( GetEnteringUnit(), true )
call UnitApplyTimedLife( GetEnteringUnit(), 'BTLF', 120 )
endfunction
//===========================================================================
function InitTrig_ExplosiveTrap takes nothing returns nothing
set gg_trg_ExplosiveTrap = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_ExplosiveTrap, GetPlayableMapRect() )
call TriggerAddCondition( gg_trg_ExplosiveTrap, Condition( function Trig_ExplosiveTrap_Conditions ) )
call TriggerAddAction( gg_trg_ExplosiveTrap, function Trig_ExplosiveTrap_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Consume_Corpse_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A05I'
endfunction
function Trig_Consume_Corpse_Get_Item takes integer lvl returns integer
if( lvl == 2 ) then
return 'I00V'
endif
if( lvl == 3 ) then
return 'I00W'
endif
if( lvl == 4 ) then
return 'I02C'
endif
return 'I00U'
endfunction
function Trig_Consume_Corpse_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( u, 'A05I' )
local item it
// perhaps i should simply add a 'unit' ability...and use that instead of an item...
local integer invCount = UnitInventoryCount( u )
if( (not UnitHasItemOfTypeBJ(u, 'I00U')) and ( not UnitHasItemOfTypeBJ(u, 'I00V' ) )and ( not UnitHasItemOfTypeBJ(u, 'I00W') ) and ( not UnitHasItemOfTypeBJ(u, 'I02C') ) and ( not ( invCount > 5 ) ) ) then
set it = CreateItem( Trig_Consume_Corpse_Get_Item(lvl), 0, 0 )
call UnitAddItem( u, it )
endif
set it = null
set u = null
endfunction
//===========================================================================
function InitTrig_Consume_Corpse takes nothing returns nothing
set gg_trg_Consume_Corpse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Consume_Corpse, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Consume_Corpse, Condition( function Trig_Consume_Corpse_Conditions ) )
call TriggerAddAction( gg_trg_Consume_Corpse, function Trig_Consume_Corpse_Actions )
endfunction
//TESH.scrollpos=29
//TESH.alwaysfold=0
function Trig_DEDead_IsSummon takes nothing returns boolean
local integer t = GetUnitTypeId(GetFilterUnit())
if( t == 'u000' ) then
return true
elseif( t == 'u003' ) then
return true
elseif( t == 'u004' ) then
return true
elseif( t == 'n00K' ) then
return true
elseif( t == 'n00L' ) then
return true
elseif( t == 'n00M' ) then
return true
elseif( t == 'n00Z' ) then
return true
elseif( t == 'n010' ) then
return true
elseif( t == 'n011' ) then
return true
endif
return false
endfunction
function Trig_DEDead_KillAll takes nothing returns nothing
// DE Dead - Kill Summons
local unit u = GetTriggerUnit()
local integer pID = GetPlayerId(GetOwningPlayer(u))
local group g = CreateGroup()
local boolexpr cond = Condition(function Trig_DEDead_IsSummon)
call GroupEnumUnitsOfPlayer( g, Player(pID), cond )
call DestroyBoolExpr(cond)
call ForGroup(g, function Purge_Callback )
set u = null
endfunction
function Trig_DEDeadKillSummons_Actions takes nothing returns nothing
local trigger trig
local integer i = 0
loop
exitwhen i > 7
if( udg_theHeroes[i] != null) then
if( GetUnitTypeId(udg_theHeroes[i]) == 'N00W' ) then
set trig = CreateTrigger()
call TriggerRegisterUnitEvent( trig, udg_theHeroes[i], EVENT_UNIT_DEATH )
//call BJDebugMsg("Player " + I2S(i+1) + " is a DE. Trig Made.")
call TriggerAddAction( trig, function Trig_DEDead_KillAll )
endif
else
//call BJDebugMsg("Player " + I2S(i+1) + " is not playing.")
endif
set i = i + 1
endloop
set trig = null
endfunction
//===========================================================================
function InitTrig_DEDeadKillSummons takes nothing returns nothing
set gg_trg_DEDeadKillSummons = CreateTrigger( )
call TriggerAddAction( gg_trg_DEDeadKillSummons, function Trig_DEDeadKillSummons_Actions )
endfunction
//TESH.scrollpos=78
//TESH.alwaysfold=0
function Trig_Aura_Switch_CondA takes nothing returns boolean
return ( GetSpellAbilityId() == 'A061' )
endfunction
function Trig_Aura_Switch_CondC takes nothing returns boolean
return ( GetSpellAbilityId() == 'A063' )
endfunction
function Trig_Aura_Switch_CondS takes nothing returns boolean
return ( GetSpellAbilityId() == 'A05K' )
endfunction
function Trig_Aura_Switch_CondZ takes nothing returns boolean
return ( GetSpellAbilityId() == 'A062' )
endfunction
function Trig_Aura_Switch_GetAbil takes integer abil returns integer
if( abil == 'A061' ) then
return 'A05Y'
endif
if( abil == 'A063' ) then
return 'A05P'
endif
if( abil == 'A05K' ) then
return 'A060'
endif
if( abil == 'A062' ) then
return 'A05Z' // default return zeal aura...
endif
call BJDebugMsg("MASSIVE ERROR")
return 'A000'
endfunction
// Hand it a Stance-Buff, and it returns the corresponding Spell Book to remove
function Trig_Aura_Switch_GetBook takes unit u returns integer
if( UnitHasBuffBJ( u, 'B02R' ) ) then //B02K -- COMBAT AURA
return 'A05P' // Cmd Book
endif
if( UnitHasBuffBJ( u, 'B02S' ) ) then //B02J -- SHADOW
return 'A060' // Vamp/Shadow Book
endif
if( UnitHasBuffBJ( u, 'B02T' ) ) then // Zeal Stance
return 'A05Z' // Endurance/Zeal Book
endif
if( UnitHasBuffBJ( u, 'B02L' ) ) then // Assassination Stance
return 'A05Y' // Devotion/Asassin Book
endif
return 'A02F' // this is "Charge -- Pinkfire lvl 1--, some stupid spell i know he won't have
endfunction
function Trig_Aura_Switch_ToCDs takes unit u returns nothing
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A061', false )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A063', false )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A05K', false )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A062', false )
call UnitAddAbility( u, 'A066' )
call UnitAddAbility( u, 'A067' )
call UnitAddAbility( u, 'A068' )
call UnitAddAbility( u, 'A069' )
endfunction
function Trig_Aura_Switch_ToMoves takes unit u returns nothing
call UnitRemoveAbility( u, 'A066' )
call UnitRemoveAbility( u, 'A067' )
call UnitRemoveAbility( u, 'A068' )
call UnitRemoveAbility( u, 'A069' )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A061', true )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A063', true )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A05K', true )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), 'A062', true )
endfunction
function Trig_Aura_Switch_GenAction takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( u, GetSpellAbilityId() )
local integer newAbil = Trig_Aura_Switch_GetAbil(GetSpellAbilityId())
local integer curAbil = Trig_Aura_Switch_GetBook(u)
if( curAbil != 'A02F' ) then // if it was A02F, that means none of the buffs were on him
call UnitRemoveAbility( u, curAbil )
endif
// now remove all 4 abilities (Channel-Based Dummies) and replace with the "Cooldowns"
call Trig_Aura_Switch_ToCDs(u)
call PolledWait(4.5)
call UnitAddAbility( u, newAbil )
call SetUnitAbilityLevel( u, newAbil, lvl )
call SetPlayerAbilityAvailable( GetOwningPlayer(u), newAbil, false)
call PolledWait( 1.0 )
call Trig_Aura_Switch_ToMoves(u)
endfunction
function Trig_Aura_Switch_Actions takes nothing returns nothing
// this should be running during MAP INITIALIZATION, and the trigger "ARRAY INITS" should execute this
// these unfortunately are nto being "cleaned up" by the Clean Up code if the XD is not being used.
// WOOPS
local trigger trigA = CreateTrigger()
local trigger trigC = CreateTrigger()
local trigger trigS = CreateTrigger()
local trigger trigZ = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trigA, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterAnyUnitEventBJ( trigC, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterAnyUnitEventBJ( trigS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerRegisterAnyUnitEventBJ( trigZ, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trigA, Condition( function Trig_Aura_Switch_CondA ) )
call TriggerAddCondition( trigC, Condition( function Trig_Aura_Switch_CondC ) )
call TriggerAddCondition( trigS, Condition( function Trig_Aura_Switch_CondS ) )
call TriggerAddCondition( trigZ, Condition( function Trig_Aura_Switch_CondZ ) )
call TriggerAddAction( trigA, function Trig_Aura_Switch_GenAction )
call TriggerAddAction( trigC, function Trig_Aura_Switch_GenAction )
call TriggerAddAction( trigS, function Trig_Aura_Switch_GenAction )
call TriggerAddAction( trigZ, function Trig_Aura_Switch_GenAction )
set trigA = null
set trigC = null
set trigS = null
set trigZ = null
endfunction
//===========================================================================
function InitTrig_Aura_Switch takes nothing returns nothing
set gg_trg_Aura_Switch = CreateTrigger( )
call TriggerAddAction( gg_trg_Aura_Switch, function Trig_Aura_Switch_Actions )
endfunction
//TESH.scrollpos=49
//TESH.alwaysfold=0
function Trig_XD_Melee_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A064' )
endfunction
function Trig_XD_Melee_Guarded takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A061' )
call UnitAddAbility( dummy, 'A0B3' )
call SetUnitAbilityLevel( dummy, 'A0B3', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "slow", t )
// deal 75/150/225 or 75*lvl damage ---> OLD
// deal 50/75/100/125 dmg; or 25 + 25*lvl
call GlobalCausePhysicalDamage(u, t, (25 + (25*lvl)))
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Melee_Combat takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A063' )
call UnitAddAbility( dummy, 'A06D' )
call SetUnitAbilityLevel( dummy, 'A06D', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueImmediateOrder( dummy, "stomp" )
// deal 50/100/150 damage, or 50*lvl -- OLD
// deal 40/80/120/160 --
call GlobalCausePhysicalDamage(u, t, (40*lvl))
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Melee_Shadow takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A05K' )
call UnitAddAbility( dummy, 'A06F' )
call SetUnitAbilityLevel( dummy, 'A06F', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "curse", t )
// deal 60/120/180 damage, or 60*lvl
// deal 60/100/140/180 or 20 + 40 *lvl
call GlobalCausePhysicalDamage(u, t, (20+(40*lvl)))
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Melee_GetZItem takes integer id returns integer
if( id == 2 ) then
return 'I00Y'
endif
if( id == 3 ) then
return 'I00Z'
endif
if( id == 4 ) then
return 'I02E'
endif
return 'I00X' // default to lvl 1 I suppose
endfunction
function Trig_XD_Melee_Zeal takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A062' )
local item it
local integer itId
// deal 50.10.150 damage, or 50*lvl--OLD
// deal 40/80/120/160 dmg, or 40*lvl
call GlobalCausePhysicalDamage(u, t, (40*lvl))
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
if( lvl > 0 ) then
set itId = Trig_XD_Melee_GetZItem(lvl)
set it = CreateItem( itId, 0, 0 )
call UnitAddItem( dummy, it )
call UnitUseItemTarget( dummy, it, u )
call RemoveItem(it)
endif
set it = null
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Melee_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
// check for a buff, do those things
if( GetUnitAbilityLevel( u, 'B02L' ) > 0 ) then
call Trig_XD_Melee_Guarded(u, t)
endif
if( GetUnitAbilityLevel( u, 'B02R' ) > 0 ) then
call Trig_XD_Melee_Combat(u, t)
endif
if( GetUnitAbilityLevel( u, 'B02S' ) > 0 ) then
call Trig_XD_Melee_Shadow(u, t)
endif
if( GetUnitAbilityLevel( u, 'B02T' ) > 0 ) then
call Trig_XD_Melee_Zeal(u, t)
endif
set t = null
set u = null
endfunction
//===========================================================================
function InitTrig_XD_Melee takes nothing returns nothing
set gg_trg_XD_Melee = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_XD_Melee, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_XD_Melee, Condition( function Trig_XD_Melee_Conditions ) )
call TriggerAddAction( gg_trg_XD_Melee, function Trig_XD_Melee_Actions )
endfunction
//TESH.scrollpos=42
//TESH.alwaysfold=0
function Trig_XD_Aug_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A065' )
endfunction
function Trig_XD_Aug_Guarded takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A061' )
call UnitAddAbility( dummy, 'A0B2' )
call SetUnitAbilityLevel( dummy, 'A0B2', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "innerfire", t )
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Aug_Combat takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A063' )
call UnitAddAbility( dummy, 'A06E' )
call SetUnitAbilityLevel( dummy, 'A06E', lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "lightningshield", t )
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Aug_Shadow takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A05K' )
local integer abil = 'A06G'
if( lvl > 2 ) then
set abil = 'A0B4'
set lvl = lvl - 2
endif
call UnitAddAbility( dummy, abil )
call SetUnitAbilityLevel( dummy, abil, lvl )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call IssueTargetOrder( dummy, "antimagicshell", t )
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Aug_GetZItem takes integer id returns integer
if( id == 2 ) then
return 'I011'
endif
if( id == 3 ) then
return 'I012'
endif
if( id == 4 ) then
return 'I02D'
endif
return 'I010' // default to lvl 1 I suppose
endfunction
function Trig_XD_Aug_Zeal takes unit u, unit t returns nothing
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0)
local integer lvl = GetUnitAbilityLevel( u, 'A062' )
local item it
local integer itId
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
if( lvl > 0 ) then
set itId = Trig_XD_Aug_GetZItem(lvl)
set it = CreateItem( itId, 0, 0 )
call UnitAddItem( dummy, it )
call UnitUseItemTarget( dummy, it, t )
call UnitUseItemTarget( dummy, it, t )
call RemoveItem(it)
endif
set it = null
set dummy = null
set u = null
set t = null
endfunction
function Trig_XD_Aug_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
// check for a buff, do those things
if( GetUnitAbilityLevel( u, 'B02L' ) > 0 ) then
call Trig_XD_Aug_Guarded(u, t)
endif
if( GetUnitAbilityLevel( u, 'B02R' ) > 0 ) then
call Trig_XD_Aug_Combat(u, t)
endif
if( GetUnitAbilityLevel( u, 'B02S' ) > 0 ) then
call Trig_XD_Aug_Shadow(u, t)
endif
if( GetUnitAbilityLevel( u, 'B02T' ) > 0 ) then
call Trig_XD_Aug_Zeal(u, t)
endif
set t = null
set u = null
endfunction
//===========================================================================
function InitTrig_XD_Aug takes nothing returns nothing
set gg_trg_XD_Aug = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_XD_Aug, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_XD_Aug, Condition( function Trig_XD_Aug_Conditions ) )
call TriggerAddAction( gg_trg_XD_Aug, function Trig_XD_Aug_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Aimed_Shot_local_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A014' )
endfunction
function Trig_Aimed_Shot_local_Actions takes nothing returns nothing
local unit tUnit = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel( GetTriggerUnit(), 'A014' )
local real message = ( 100 + ( 75 * lvl ) )
call TriggerSleepAction( 0.20 )
call GlobalFloatingCombatText( tUnit, R2I(message), 255, 255, 0, true )
set tUnit = null
endfunction
//===========================================================================
function InitTrig_Aimed_Shot_Text takes nothing returns nothing
set gg_trg_Aimed_Shot_Text = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Aimed_Shot_Text, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Aimed_Shot_Text, Condition( function Trig_Aimed_Shot_local_Conditions ) )
call TriggerAddAction( gg_trg_Aimed_Shot_Text, function Trig_Aimed_Shot_local_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Multishot_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A03C' )
endfunction
function Trig_Multishot_IsEnemy takes nothing returns boolean
return (IsUnitEnemy( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) and (GetFilterUnit() != GetSpellTargetUnit()))
endfunction
function Trig_Multishot_Actions takes nothing returns nothing
local real x = GetUnitX(GetSpellTargetUnit())
local real y = GetUnitY(GetSpellTargetUnit())
local unit c = GetTriggerUnit()
local boolexpr filter = Condition(function Trig_Multishot_IsEnemy)
local group g = CreateGroup()
local integer lvl = GetUnitAbilityLevel( c, 'A03C' )
local integer i = 0
local unit t
local unit dummy
call GroupEnumUnitsInRange( g, x, y, 300, filter)
loop
set t = FirstOfGroup(g)
exitwhen ( (i>4) or (t==null) )
set dummy = CreateUnit( GetOwningPlayer(c), 'h003', GetUnitX(c), GetUnitY(c), 0.0 )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call UnitAddAbility( dummy, 'A03E' )
call SetUnitAbilityLevel( dummy, 'A03E', lvl )
call IssueTargetOrder( dummy, "acidbomb", t )
call GroupRemoveUnit( g, t )
set i = i + 1
endloop
set c = null
set t = null
set dummy = null
call DestroyBoolExpr(filter)
set filter = null
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Multishot takes nothing returns nothing
set gg_trg_Multishot = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Multishot, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Multishot, Condition( function Trig_Multishot_Conditions ) )
call TriggerAddAction( gg_trg_Multishot, function Trig_Multishot_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Blast_of_Light_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A05O' )
endfunction
function Trig_Blast_of_Light_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( u, 'A05O' )
local unit t = GetSpellTargetUnit()
local unit dummy
if( ( GetUnitAbilityLevel(t, 'B00T' ) > 0 ) )then
// has holy fire...
set dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0 )
call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
call UnitAddAbility( dummy, 'A001' )
call SetUnitAbilityLevel( dummy, 'A001', lvl )
call IssueTargetOrder( dummy, "manaburn", t )
endif
if( ( GetUnitAbilityLevel(t, 'B00U' ) > 0 ) ) then
// has blinding light...
set dummy = CreateUnit( GetOwningPlayer(u), 'h003', GetUnitX(t), GetUnitY(t), 0.0 )
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
call UnitAddAbility( dummy, 'A00R' )
call SetUnitAbilityLevel( dummy, 'A00R', lvl )
call IssueImmediateOrder( dummy, "fanofknives" )
endif
set t = null
set dummy = null
set u = null
endfunction
//===========================================================================
function InitTrig_Blast_of_Light takes nothing returns nothing
set gg_trg_Blast_of_Light = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Blast_of_Light, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Blast_of_Light, Condition ( function Trig_Blast_of_Light_Conditions ) )
call TriggerAddAction( gg_trg_Blast_of_Light, function Trig_Blast_of_Light_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Faerie_Fire_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A028'
endfunction
function Trig_Faerie_Fire_Actions takes nothing returns nothing
local integer lvl = GetUnitAbilityLevel( GetTriggerUnit(), 'A028' )
local real dmg = (60 + (40*lvl))
call GlobalCauseSpellDamage( GetTriggerUnit(), GetSpellTargetUnit(), dmg )
//call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl", GetSpellTargetUnit(), "overhead"))
endfunction
//===========================================================================
function InitTrig_Faerie_Fire takes nothing returns nothing
set gg_trg_Faerie_Fire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Faerie_Fire, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Faerie_Fire, Condition( function Trig_Faerie_Fire_Conditions ) )
call TriggerAddAction( gg_trg_Faerie_Fire, function Trig_Faerie_Fire_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Death_Coil_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00V'
endfunction
function Trig_Death_Coil_Actions takes nothing returns nothing
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), 'A00V')
local real damage = (90 + 40*(lvl))
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE ) + damage) )
endfunction
//===========================================================================
function InitTrig_Life_Swap takes nothing returns nothing
set gg_trg_Life_Swap = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Life_Swap, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Life_Swap, Condition( function Trig_Death_Coil_Conditions ) )
call TriggerAddAction( gg_trg_Life_Swap, function Trig_Death_Coil_Actions )
endfunction
//TESH.scrollpos=129
//TESH.alwaysfold=0
function Trig_Grapple_Beam_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A031'
endfunction
function Trig_GBMsg takes integer level, unit targ returns nothing
local texttag t = CreateTextTag()
local string msg
local real size
// this is ugly...
if ( level == 1 ) then
set size = .02
set msg = "Slight Upgrade"
endif
if ( level == 2 ) then
set size = .022
set msg = "Small Upgrade"
endif
if ( level == 3 ) then
set size = .024
set msg = "Medium Upgrade"
endif
if ( level == 4 ) then
set size = .028
set msg = "Big Upgrade"
endif
if ( level == 5 ) then
set size = .040
set msg = "RIDICULOUS"
endif
call SetTextTagText(t, msg, size)
call SetTextTagPos(t, GetUnitX(targ), GetUnitY(targ), 0)
call SetTextTagColor(t, 255, 0, 0, 255)
call SetTextTagPermanent(t, false)
call SetTextTagVelocity(t, 0, 0.0177)
call SetTextTagFadepoint(t, 1.0)
call SetTextTagLifespan(t, 2.0)
endfunction
function Trig_GB_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit caster = GetHandleUnit( I2Timer(t), "caster" )
local unit target = GetHandleUnit( I2Timer(t), "target" )
local integer steps = GetHandleInt( I2Timer(t), "steps")
local real endX = GetHandleReal(I2Timer(t), "endX")
local real endY = GetHandleReal(I2Timer(t), "endY")
local real curX = GetHandleReal(I2Timer(t), "curX")
local real curY = GetHandleReal(I2Timer(t), "curY")
local real theAngle = GetHandleReal(I2Timer(t), "theAngle")
local real theDistance = GetHandleReal(I2Timer(t), "theDistance")
local real curDistance = GetHandleReal(I2Timer(t), "curDistance")
local unit dummyOne
local unit dummyTwo
local integer buffLevel
local integer areWeCasting
// define "balance" numbers
local integer dmgPerTick = 25
local integer distPerTick = 50
if ( steps == 0 ) then
set areWeCasting = 1
else
set areWeCasting = GetUnitAbilityLevel(caster, 'Bmlc')
endif
if( (curDistance < 120) or (GetUnitState(target,UNIT_STATE_LIFE) <= 0) or (areWeCasting < 1) ) then
// target is close; stop pulling and do end stuff (damage and buff)
call SetUnitPathing( target, true )
call PauseUnit(target, false)
//call BJDebugMsg( "steps is " + I2S(steps) )
call GlobalFloatingCombatText( target, R2I( dmgPerTick*steps), 113, 153, 255, true )
call IssueTargetOrder( caster, "attack", target )
if ( steps >= 24 ) then
set buffLevel = 5
endif
if ( ( steps < 24 ) and (steps>=20) ) then
set buffLevel = 4
endif
if ( ( steps < 20 ) and (steps >=15) ) then
set buffLevel = 3
endif
if ( ( steps < 15 ) and (steps >= 8) ) then
set buffLevel = 2
endif
if ( steps < 8 ) then
set buffLevel = 1
endif
set dummyOne = CreateUnit( GetOwningPlayer(caster), 'h003', endX, endY, 0 )
call UnitAddAbility( dummyOne, 'A04O')
call SetUnitAbilityLevel( dummyOne, 'A04O', buffLevel )
call IssueTargetOrder( dummyOne, "innerfire", caster )
call UnitApplyTimedLife( dummyOne, 'BTLF', 3.0 )
call Trig_GBMsg( buffLevel, caster )
set dummyTwo = CreateUnit( GetOwningPlayer(caster), 'h003', endX, endY, 0 )
call UnitAddAbility( dummyTwo, 'A04S' )
call IssueTargetOrder( dummyTwo, "slow", target )
call UnitApplyTimedLife( dummyTwo, 'BTLF', 2.0 )
call CleanTimer(I2Timer(t))
else
// our loop
set steps = steps + 1
set curDistance = curDistance - distPerTick
set curX = endX + curDistance * Cos(theAngle)
set curY = endY + curDistance * Sin(theAngle)
call SetUnitPosition( target, curX, curY )
call GlobalCauseSpellDamage( caster, target, dmgPerTick )
call SetHandleReal( I2Timer(t), "curDistance", curDistance )
call SetHandleReal( I2Timer(t), "curX", curX )
call SetHandleReal( I2Timer(t), "curY", curY )
call SetHandleInt( I2Timer(t), "steps", (steps) )
endif
set dummyOne = null
set dummyTwo = null
set caster = null
set target = null
endfunction
function Trig_Grapple_Beam_Actions takes nothing returns nothing
local unit target = GetSpellTargetUnit()
local unit caster = GetTriggerUnit()
local real endX = GetUnitX(caster)
local real endY = GetUnitY(caster)
local real curX = GetUnitX(target)
local real curY = GetUnitY(target)
local real theAngle = (Atan2((curY-endY), (curX-endX)) )
local real dx = (curX-endX)
local real dy = (curY-endY)
local real theDistance = SquareRoot( dx*dx + dy*dy )
local real curDistance = theDistance
local integer t = H2I(CreateTimer())
// call BJDebugMsg( "Initing...curDistance is " + R2S(curDistance))
call SetHandleHandle(I2Timer(t), "caster", caster)
call SetHandleHandle(I2Timer(t), "target", target)
call SetHandleReal(I2Timer(t), "endX", endX )
call SetHandleReal(I2Timer(t), "endY", endY )
call SetHandleReal(I2Timer(t), "curX", curX )
call SetHandleReal(I2Timer(t), "curY", curY )
call SetHandleReal(I2Timer(t), "theAngle", theAngle )
call SetHandleReal(I2Timer(t), "theDistance", theDistance )
call SetHandleReal(I2Timer(t), "curDistance", curDistance )
call SetHandleInt(I2Timer(t), "steps", 0)
call PauseUnit(target, true)
call SetUnitPathing( target, false )
call TimerStart(I2Timer(t), 0.02, true, function Trig_GB_Callback )
set target = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Grapple_Lasso takes nothing returns nothing
set gg_trg_Grapple_Lasso = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Grapple_Lasso, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Grapple_Lasso, Condition( function Trig_Grapple_Beam_Conditions ) )
call TriggerAddAction( gg_trg_Grapple_Lasso, function Trig_Grapple_Beam_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Mana_Hunger_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A02Z' )
endfunction
function MHHasBuffs takes nothing returns boolean
if ( not ( UnitCountBuffsExBJ(bj_BUFF_POLARITY_EITHER, bj_BUFF_RESIST_EITHER, GetEnumUnit(), false, false) > 0 ) ) then
return false
endif
return true
endfunction
function MHClearBuffs takes nothing returns nothing
if ( MHHasBuffs() ) then
set udg_BuffCount = ( udg_BuffCount + UnitCountBuffsExBJ(bj_BUFF_POLARITY_EITHER, bj_BUFF_RESIST_EITHER, GetEnumUnit(), false, false) )
call UnitRemoveBuffsBJ( bj_REMOVEBUFFS_ALL, GetEnumUnit() )
// call DisplayTextToForce( GetPlayersAll(), ( "The number of buffs removed is " + I2S(udg_BuffCount) ) )
else
endif
endfunction
function MHIsAlly takes nothing returns boolean
// call DisplayTextToForce( GetPlayersAll(), ("Does Unit Have Locust: " + I2S(GetUnitAbilityLevel( GetFilterUnit(), 'Aloc' )) + " and its name is " + GetUnitName(GetFilterUnit()) ))
// This seems to have solved the probelm, but my above checker seemed to indicate otherwise, i do not know
return ( (IsUnitAlly( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) or ( IsUnitOwnedByPlayer( GetFilterUnit() , GetOwningPlayer(GetTriggerUnit())) )) and ( GetUnitAbilityLevel( GetFilterUnit(), 'Aloc' ) < 1 ))
endfunction
function MHHealUnits takes nothing returns nothing
local integer healingAmt = (50 * udg_BuffCount )
call SetUnitLifeBJ( GetEnumUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetEnumUnit()) + I2R( healingAmt ) ) )
call GlobalFloatingCombatText( GetEnumUnit(), healingAmt, 255, 255, 255, false )
endfunction
function Trig_Mana_Hunger_Actions takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
set udg_BuffCount = 0
call ForGroupBJ( GetUnitsInRangeOfLocMatching(600.00, GetSpellTargetLoc(), null ), function MHClearBuffs )
call ForGroupBJ( GetUnitsInRangeOfLocMatching(800.00, loc, Condition(function MHIsAlly)), function MHHealUnits )
set udg_BuffCount = 0
set loc = null
endfunction
//===========================================================================
function InitTrig_Mana_Hunger takes nothing returns nothing
set gg_trg_Mana_Hunger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mana_Hunger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Mana_Hunger, Condition( function Trig_Mana_Hunger_Conditions ) )
call TriggerAddAction( gg_trg_Mana_Hunger, function Trig_Mana_Hunger_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Scotts_Glasses_Conditions takes nothing returns boolean
local integer id = GetSpellAbilityId()
if ( not UnitHasItemOfTypeBJ(GetTriggerUnit(), 'I01S') == true ) then
return false
endif
// living flames, mana shield, 4 DT Aura's,
if( id == 'A04W' or id == 'A00Y' or id == 'A061' or id == 'A063' or id == 'A05K' or id == 'A062' ) then
return false
endif
return true
endfunction
function Trig_Scotts_Glasses_Actions takes nothing returns nothing
local integer i = GetRandomInt(1,100)
if( i > 85 ) then
call SetUnitState( GetTriggerUnit(), UNIT_STATE_MANA, ( GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) + 150.00 ) )
call DestroyEffect( AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetTriggerUnit(), "overhead" ) )
endif
endfunction
//===========================================================================
function InitTrig_Scotts_Glasses takes nothing returns nothing
set gg_trg_Scotts_Glasses = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Scotts_Glasses, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_Scotts_Glasses, Condition( function Trig_Scotts_Glasses_Conditions ) )
call TriggerAddAction( gg_trg_Scotts_Glasses, function Trig_Scotts_Glasses_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_LavaAxeEffect_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0AI' )
endfunction
function Trig_LavaAxeEffect_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
call PolledWait(0.5)
call SetUnitState( c, UNIT_STATE_LIFE, RMaxBJ( (GetUnitState(c,UNIT_STATE_LIFE)-500) , 0))
set c = null
endfunction
//===========================================================================
function InitTrig_LavaAxeEffect takes nothing returns nothing
set gg_trg_LavaAxeEffect = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_LavaAxeEffect, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_LavaAxeEffect, Condition( function Trig_LavaAxeEffect_Conditions ) )
call TriggerAddAction( gg_trg_LavaAxeEffect, function Trig_LavaAxeEffect_Actions )
endfunction
//TESH.scrollpos=2
//TESH.alwaysfold=0
function Trig_Scotts_RayGun_Conditions takes nothing returns boolean
//return ( GetItemTypeId(GetManipulatedItem()) == 'I021' )
return ( GetSpellAbilityId() == 'A0A8' )
endfunction
function Trig_Scotts_RayGun_Actions takes nothing returns nothing
local real dmg = 4 * (GetHeroInt(GetTriggerUnit(), true))
local unit t = GetSpellTargetUnit()
local integer b
set b = 'B01W' // Living Flames - Immolate based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B004' // Mystic Fire - shadowstrike based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B01V' // Rain Dance - Monsoon effect
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B00U' // Blinded - Curse Based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B020' // Frozen - Ensnare Based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
call GlobalCauseSpellDamage( GetTriggerUnit(), t, dmg )
call GlobalFloatingCombatText( t, R2I(dmg), 255, 255, 255, true )
set t = null
endfunction
//===========================================================================
function InitTrig_Scotts_RayGun takes nothing returns nothing
set gg_trg_Scotts_RayGun = CreateTrigger( )
//call TriggerRegisterAnyUnitEventBJ( gg_trg_Scotts_RayGun, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Scotts_RayGun, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Scotts_RayGun, Condition( function Trig_Scotts_RayGun_Conditions ) )
call TriggerAddAction( gg_trg_Scotts_RayGun, function Trig_Scotts_RayGun_Actions )
endfunction
//TESH.scrollpos=7
//TESH.alwaysfold=0
function Trig_ScottsNuker_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A0AL' )
endfunction
function Trig_ScottsNuker_IsEnemy takes nothing returns boolean
if( ( GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) > 0 ) and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) ) then
return true
endif
//call BJDebugMsg("Not An Enemy or Not Alive")
return false
endfunction
function Trig_ScottsNuker_DmgMsg takes nothing returns nothing
local unit t = GetEnumUnit()
local real dmg = 3 * (GetHeroInt(GetTriggerUnit(), true ))
local integer b
set b = 'B01W' // Fire Blast - immolate based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B004' // Mystic Fire - shadowstrike based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B01V' // Rain Dance - Monsoon effect
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B00U' // Blinded - Curse Based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
set b = 'B020' // Frozen - Ensnare Based
if( Trig_Scotts_Weapons_CheckBuff(t,b) ) then
set dmg = 2 * dmg
endif
call GlobalCauseSpellDamage( GetTriggerUnit(), t, dmg )
call GlobalFloatingCombatText( t, R2I(dmg), 255, 122, 0, true )
set t = null
endfunction
function Trig_ScottsNuker_Actions takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local group g = CreateGroup()
local boolexpr filter = Condition( function Trig_ScottsNuker_IsEnemy )
//call BJDebugMsg("Making Group")
call GroupEnumUnitsInRange( g, GetLocationX(loc), GetLocationY(loc), 450.0, filter )
call ForGroup( g, function Trig_ScottsNuker_DmgMsg )
call DestroyGroup(g)
call RemoveLocation(loc)
call DestroyBoolExpr(filter)
set filter = null
set g = null
set loc = null
endfunction
//===========================================================================
function InitTrig_ScottsNuker takes nothing returns nothing
set gg_trg_ScottsNuker = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ScottsNuker, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_ScottsNuker, Condition( function Trig_ScottsNuker_Conditions ) )
call TriggerAddAction( gg_trg_ScottsNuker, function Trig_ScottsNuker_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Pois_Mush_Conditions takes nothing returns boolean
if ( not ( GetItemTypeId(GetManipulatedItem()) == 'I01U' ) ) then
return false
endif
return true
endfunction
function Trig_Pois_Mush_Group takes nothing returns nothing
call UnitDamageTarget( GetTriggerUnit(), GetEnumUnit(), (150 + (50*GetHeroLevel(GetEnumUnit()))), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
endfunction
function Trig_Pois_Mush_Actions takes nothing returns nothing
local effect fx = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\PlagueCloud\\PlagueCloudCaster.mdl", GetTriggerUnit(), "overhead" )
local group g = CreateGroup()
call GroupEnumUnitsInRange( g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 300, null )
call ForGroup( g, function Trig_Pois_Mush_Group )
call PolledWait( 1.0 )
call DestroyEffect(fx)
call DestroyGroup(g)
set g = null
set fx = null
endfunction
//===========================================================================
function InitTrig_Pois_Mush takes nothing returns nothing
set gg_trg_Pois_Mush = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pois_Mush, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Pois_Mush, Condition( function Trig_Pois_Mush_Conditions ) )
call TriggerAddAction( gg_trg_Pois_Mush, function Trig_Pois_Mush_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Heal_Mush_Conditions takes nothing returns boolean
if ( not ( GetItemTypeId(GetManipulatedItem()) == 'I023' ) ) then
return false
endif
return true
endfunction
function Trig_Heal_Mush_Callback takes nothing returns nothing
local real hp = GetUnitState( GetEnumUnit(), UNIT_STATE_LIFE )
call SetUnitState( GetEnumUnit(), UNIT_STATE_LIFE, ( hp + ( 150 + (GetHeroLevel(GetEnumUnit())*25))))
endfunction
function Trig_Heal_Mush_Actions takes nothing returns nothing
local effect fx = AddSpecialEffectTarget("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl", GetTriggerUnit(), "overhead" )
local group g = CreateGroup()
call GroupEnumUnitsInRange( g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 300, null )
call ForGroup( g, function Trig_Heal_Mush_Callback )
call PolledWait( 1.0 )
call DestroyEffect(fx)
call DestroyGroup(g)
set g = null
set fx = null
endfunction
//===========================================================================
function InitTrig_Heal_Mush takes nothing returns nothing
set gg_trg_Heal_Mush = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Heal_Mush, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Heal_Mush, Condition( function Trig_Heal_Mush_Conditions ) )
call TriggerAddAction( gg_trg_Heal_Mush, function Trig_Heal_Mush_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Free_Play_Actions takes nothing returns nothing
local location loc
local integer i
call GlobalMessage("----------- Entering Free Play Mode -----------" )
call TriggerExecute( gg_trg_GenerateTaverns )
call TriggerExecute( gg_trg_GenerateCops )
set i = 0
loop
exitwhen i > 3
set loc = GetRandomLocInRect(udg_Sandboxes[i])
call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'u002', loc, bj_UNIT_FACING )
call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'u002', loc, bj_UNIT_FACING )
call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'u002', loc, bj_UNIT_FACING )
call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'u002', loc, bj_UNIT_FACING )
call RemoveLocation(loc)
set i = i + 1
endloop
call GlobalMessage("^^^ Type in '-standard' to begin the game ^^^" )
set loc = null
endfunction
//===========================================================================
function InitTrig_Free_Play takes nothing returns nothing
set gg_trg_Free_Play = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_Free_Play, 25.00, false )
call TriggerAddAction( gg_trg_Free_Play, function Trig_Free_Play_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GenerateTaverns_Actions takes nothing returns nothing
set udg_tavs[0] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n000', GetRectCenterX(gg_rct_Tavern_0_0), GetRectCenterY(gg_rct_Tavern_0_0), 0 )
set udg_tavs[1] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n00C', GetRectCenterX(gg_rct_Tavern_0_1), GetRectCenterY(gg_rct_Tavern_0_1), 0 )
set udg_tavs[2] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n000', GetRectCenterX(gg_rct_Tavern_1_0), GetRectCenterY(gg_rct_Tavern_1_0), 0 )
set udg_tavs[3] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n00C', GetRectCenterX(gg_rct_Tavern_1_1), GetRectCenterY(gg_rct_Tavern_1_1), 0 )
set udg_tavs[4] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n000', GetRectCenterX(gg_rct_Tavern_2_0), GetRectCenterY(gg_rct_Tavern_2_0), 0 )
set udg_tavs[5] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n00C', GetRectCenterX(gg_rct_Tavern_2_1), GetRectCenterY(gg_rct_Tavern_2_1), 0 )
set udg_tavs[6] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n000', GetRectCenterX(gg_rct_Tavern_3_0), GetRectCenterY(gg_rct_Tavern_3_0), 0 )
set udg_tavs[7] = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'n00C', GetRectCenterX(gg_rct_Tavern_3_1), GetRectCenterY(gg_rct_Tavern_3_1), 0 )
endfunction
//===========================================================================
function InitTrig_GenerateTaverns takes nothing returns nothing
set gg_trg_GenerateTaverns = CreateTrigger( )
call TriggerAddAction( gg_trg_GenerateTaverns, function Trig_GenerateTaverns_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GenerateCops_Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 7
set udg_cops[i] = CreateUnitAtLoc(Player(i), 'ncop', selectorLocs[i/2], 0.0 )
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_GenerateCops takes nothing returns nothing
set gg_trg_GenerateCops = CreateTrigger( )
call TriggerAddAction( gg_trg_GenerateCops, function Trig_GenerateCops_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Random_Conditions takes nothing returns boolean
local integer i = GetPlayerId(GetTriggerPlayer())
return ( udg_theHeroes[i] == null )
endfunction
function Trig_Random_GetRandom takes integer o returns integer
// we have 'o', the other player's hero index
// if there is no hero for him, then just give him a random hero
local integer i
local integer array ar
local integer x
if( udg_theHeroes[o] == null ) then
set i = GetRandomInt(0,13)
return herotype[i]
else
// they have a hero!
set i = 0
loop
exitwhen i > 13
set ar[i] = i
set i = i + 1
endloop
// now we need to know what integer NOT to pick
// hand this function (IN HEADER) a typeID it gives back an int
set x = Trig_ClearOutUnused_TypeToInt(GetUnitTypeId(udg_theHeroes[o]))
set ar[x] = ar[13] // ar[13] = 13
set i = GetRandomInt(0, 12)
return herotype[i]
endif
return 0
endfunction
function Trig_Random_Actions takes nothing returns nothing
local integer heroTypeID
local rect makeItHere = gg_rct_1Selector
local integer plyr = GetPlayerId(GetTriggerPlayer())
local integer o
if( ModuloInteger(plyr,2) == 0 ) then
set o = plyr + 1
else
set o = plyr -1
endif
if( plyr == 2 or plyr == 3 ) then
set makeItHere = gg_rct_2Selector
endif
if( plyr == 4 or plyr == 5 ) then
set makeItHere = gg_rct_3Selector
endif
if( plyr == 6 or plyr == 7 ) then
set makeItHere = gg_rct_4Selector
endif
set heroTypeID = Trig_Random_GetRandom(o)
set udg_theHeroes[plyr] = CreateUnit( Player(plyr), heroTypeID, GetRectCenterX(makeItHere), GetRectCenterY(makeItHere), 0.0 )
call AdjustPlayerStateBJ( -1, GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER )
call RemoveUnit(udg_cops[plyr])
call SetPlayerTechMaxAllowed( Player(o), heroTypeID, 0 )
set udg_didRandom[plyr] = true
// *************** Multiboard **************
call MultiboardSetItemValueBJ( udg_theMultiboard, 1, ( plyr + 2 ), ( udg_playerColorCodes[( plyr )] + (GetPlayerName(GetTriggerPlayer())) + "|r" ) )
call MultiboardSetItemIconBJ( udg_theMultiboard, 1, ( plyr + 2 ), udg_heroIconNames[GetUnitPointValue(udg_theHeroes[plyr])] )
call PanCameraToTimedForPlayer( Player(plyr), GetRectCenterX(makeItHere), GetRectCenterY(makeItHere), 0.5 )
set makeItHere = null
endfunction
//===========================================================================
function InitTrig_Random takes nothing returns nothing
set gg_trg_Random = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(0), "-random", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(1), "-random", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(2), "-random", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(3), "-random", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(4), "-random", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(5), "-random", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(6), "-random", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Random, Player(7), "-random", true )
call TriggerAddCondition( gg_trg_Random, Condition( function Trig_Random_Conditions ) )
call TriggerAddAction( gg_trg_Random, function Trig_Random_Actions )
call DisableTrigger( gg_trg_Random )
endfunction
//TESH.scrollpos=20
//TESH.alwaysfold=0
function Trig_Repick_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
// the following things must be true...
// must have a hero
// if standard, must also have a repick remaining
local integer id = GetUnitTypeId( GetEnteringUnit() )
local integer o
if( ModuloInteger(i,2) == 0 ) then
set o = i + 1
else
set o = i -1
endif
if( udg_theHeroes[i] == null ) then
return
endif
if( udg_isStandardMode ) then
if( udg_numRepicks[i] == 0 ) then
return
endif
endif
// if we've gotten here, do the repick
set id = GetUnitTypeId( udg_theHeroes[i] )
if( udg_isStandardMode ) then
set udg_numRepicks[i] = ( udg_numRepicks[i] - 1 )
endif
call RemoveUnit( udg_theHeroes[i] )
set udg_didRandom[i] = false
set udg_cops[i] = CreateUnitAtLoc( Player(i), 'ncop', selectorLocs[i/2], 0.0 )
call SetPlayerStateBJ( Player(i), PLAYER_STATE_RESOURCE_LUMBER, 1 )
set udg_theHeroes[i] = null
call MultiboardSetItemValueBJ( udg_theMultiboard, 1, ( i+2 ), "TRIGSTR_2832" )
call MultiboardSetItemIconBJ( udg_theMultiboard, 1, ( i+2 ), "ReplaceableTextures\\WorldEditUI\\DoodadPlaceholder.blp" )
call SetPlayerTechMaxAllowed( Player(o), id, -1 )
endfunction
//===========================================================================
function InitTrig_Repick takes nothing returns nothing
set gg_trg_Repick = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(0), "-repick", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(1), "-repick", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(2), "-repick", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(3), "-repick", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(4), "-repick", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(5), "-repick", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(6), "-repick", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Repick, Player(7), "-repick", true )
call TriggerAddAction( gg_trg_Repick, function Trig_Repick_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Hero_Bought_Conditions takes nothing returns boolean
return ( IsUnitType(GetSoldUnit(), UNIT_TYPE_HERO) )
endfunction
function Trig_Hero_Bought_Actions takes nothing returns nothing
local integer i = GetPlayerId( GetOwningPlayer( GetSoldUnit() ) )
local integer o
if( ModuloInteger( i, 2 ) == 0 ) then // even
set o = i+1
else
set o = i-1
endif
set udg_theHeroes[i] = GetSoldUnit()
call RemoveUnit(udg_cops[i])
call SelectUnitForPlayerSingle( GetSoldUnit(), Player(i) )
call SetPlayerTechMaxAllowed( Player(o), GetUnitTypeId(GetSoldUnit()), 0 )
endfunction
//===========================================================================
function InitTrig_Hero_Bought takes nothing returns nothing
set gg_trg_Hero_Bought = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hero_Bought, EVENT_PLAYER_UNIT_SELL )
call TriggerAddCondition( gg_trg_Hero_Bought, Condition( function Trig_Hero_Bought_Conditions ) )
call TriggerAddAction( gg_trg_Hero_Bought, function Trig_Hero_Bought_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ForcedPick_CheckReady takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 7
if( GetPlayerSlotState(Player(i)) != PLAYER_SLOT_STATE_PLAYING ) then
call GlobalMessage( udg_playerColorCodes[i] + GetPlayerName(Player(i)) + "|r is not playing, and thus is Ready!" )
set udg_playerIsReady[i] = true
endif
set i = i + 1
endloop
endfunction
function Trig_ForcedPick_Actions takes nothing returns nothing
local timerdialog td = CreateTimerDialogBJ( udg_stdForcePickTimer, "Type -ready: " )
call SetHandleHandle(udg_stdForcePickTimer, "td", td )
call TimerStart( udg_stdForcePickTimer, 90.0, false, function Trig_ForcedPick_Callback )
call Trig_ForcedPick_CheckReady()
set td = null
endfunction
//===========================================================================
function InitTrig_ForcedPick takes nothing returns nothing
set gg_trg_ForcedPick = CreateTrigger( )
call TriggerAddAction( gg_trg_ForcedPick, function Trig_ForcedPick_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_IAmReady_Actions takes nothing returns nothing
local boolean someoneNotReady = false
local integer i = 0
local integer p = GetPlayerId(GetTriggerPlayer())
if( not udg_playerIsReady[p] ) then
set udg_playerIsReady[p] = true
call GlobalMessage( udg_playerColorCodes[p] + GetPlayerName(GetTriggerPlayer()) + "|r is Ready! type -ready when you are" )
loop
exitwhen ( (i>7) or someoneNotReady )
if( not udg_playerIsReady[i] ) then
set someoneNotReady = true
endif
set i = i + 1
endloop
if( not someoneNotReady ) then
// all players are ready
call PauseTimer( udg_stdForcePickTimer )
call DestroyTimer( udg_stdForcePickTimer )
call DisableTrigger( gg_trg_IAmReady )
call DestroyTrigger( gg_trg_IAmReady )
call Trig_ForcedPick_Callback()
endif
endif
endfunction
//===========================================================================
function InitTrig_IAmReady takes nothing returns nothing
set gg_trg_IAmReady = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(0), "-ready", true )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(1), "-ready", true )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(2), "-ready", true )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(3), "-ready", true )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(4), "-ready", true )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(5), "-ready", true )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(6), "-ready", true )
call TriggerRegisterPlayerChatEvent( gg_trg_IAmReady, Player(7), "-ready", true )
call TriggerAddAction( gg_trg_IAmReady, function Trig_IAmReady_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_CleanUpBeg_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_Random )
call DisableTrigger( gg_trg_Repick )
call DisableTrigger( gg_trg_Free_Play )
call DisableTrigger( gg_trg_Standard_Mode )
call DisableTrigger( gg_trg_GenerateTaverns )
call DisableTrigger( gg_trg_GenerateCops )
call DisableTrigger( gg_trg_Hero_Bought )
call DestroyTrigger( gg_trg_Random )
call DestroyTrigger( gg_trg_Repick )
call DestroyTrigger( gg_trg_Free_Play )
call DestroyTrigger( gg_trg_Standard_Mode )
call DestroyTrigger( gg_trg_GenerateTaverns )
call DestroyTrigger( gg_trg_GenerateCops )
call DestroyTrigger( gg_trg_Hero_Bought )
endfunction
//===========================================================================
function InitTrig_CleanUpBeg takes nothing returns nothing
set gg_trg_CleanUpBeg = CreateTrigger( )
call TriggerAddAction( gg_trg_CleanUpBeg, function Trig_CleanUpBeg_Actions )
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function Trig_ClearOutUnused_CleanUp takes integer i returns nothing
if( i == 0 ) then // templar
call DisableTrigger( gg_trg_Enter_The_Ring )
call DestroyTrigger( gg_trg_Enter_The_Ring )
call DisableTrigger( gg_trg_Retribution_Aura )
call DestroyTrigger( gg_trg_Retribution_Aura )
endif
if( i == 1 ) then // elementalist
call DisableTrigger( gg_trg_Rain_Dance )
call DestroyTrigger( gg_trg_Rain_Dance )
call DisableTrigger( gg_trg_Ice_Block )
call DestroyTrigger( gg_trg_Ice_Block )
call DisableTrigger( gg_trg_Explode )
call DestroyTrigger( gg_trg_Explode )
call DisableTrigger( gg_trg_Fire_Strike )
call DestroyTrigger( gg_trg_Fire_Strike )
endif
if( i == 2 ) then // ice king
call DisableTrigger( gg_trg_Snow_Day )
call DestroyTrigger( gg_trg_Snow_Day )
call DisableTrigger( gg_trg_Frostbolt_Crit )
call DestroyTrigger( gg_trg_Frostbolt_Crit )
call DisableTrigger( gg_trg_Cone_of_Cold_Crit )
call DestroyTrigger( gg_trg_Cone_of_Cold_Crit )
endif
if( i == 3 ) then // battlemage
call DisableTrigger( gg_trg_Living_Flames )
call DestroyTrigger( gg_trg_Living_Flames )
call DisableTrigger( gg_trg_Combustion_Crit )
call DestroyTrigger( gg_trg_Combustion_Crit )
call DisableTrigger( gg_trg_Mana_Leech )
call DestroyTrigger( gg_trg_Mana_Leech )
call DisableTrigger( gg_trg_FireBlast )
call DestroyTrigger( gg_trg_FireBlast )
endif
if( i == 4 ) then // paladin
call DisableTrigger( gg_trg_Furor )
call DestroyTrigger( gg_trg_Furor )
call DisableTrigger( gg_trg_Holy_Attack_Local )
call DestroyTrigger( gg_trg_Holy_Attack_Local )
call DisableTrigger( gg_trg_Repentance )
call DestroyTrigger( gg_trg_Repentance )
endif
if( i == 5 ) then // trapper
call DisableTrigger( gg_trg_Trap_Card )
call DestroyTrigger( gg_trg_Trap_Card )
call DisableTrigger( gg_trg_ExplosiveTrap )
call DestroyTrigger( gg_trg_ExplosiveTrap )
endif
if( i == 6 ) then // XD
call DisableTrigger( gg_trg_Aura_Switch )
call DestroyTrigger( gg_trg_Aura_Switch)
call DisableTrigger( gg_trg_XD_Melee )
call DestroyTrigger( gg_trg_XD_Melee )
call DisableTrigger( gg_trg_XD_Aug )
call DestroyTrigger( gg_trg_XD_Aug )
endif
if( i == 7 ) then // Bearmancer
call DisableTrigger( gg_trg_Pinkfire_Summon )
call DestroyTrigger( gg_trg_Pinkfire_Summon )
call DisableTrigger( gg_trg_Pinkfire_Charge )
call DestroyTrigger( gg_trg_Pinkfire_Charge )
endif
if( i == 8 ) then // Death Eater
call DisableTrigger( gg_trg_Consume_Corpse )
call DestroyTrigger( gg_trg_Consume_Corpse )
endif
if( i == 9 ) then // Keeper
call DisableTrigger( gg_trg_Faerie_Fire )
call DestroyTrigger( gg_trg_Faerie_Fire )
endif
if( i == 10 ) then // ranger
call DisableTrigger( gg_trg_Aimed_Shot_Text )
call DestroyTrigger( gg_trg_Aimed_Shot_Text )
call DisableTrigger( gg_trg_Multishot )
call DestroyTrigger( gg_trg_Multishot )
endif
if( i == 11 ) then // dismantler
call DisableTrigger( gg_trg_Life_Swap )
call DestroyTrigger( gg_trg_Life_Swap )
endif
if( i == 12 ) then // agent
call DisableTrigger( gg_trg_Blast_of_Light )
call DestroyTrigger( gg_trg_Blast_of_Light )
endif
endfunction
function Trig_ClearOutUnused_Actions takes nothing returns nothing
local integer i = 0
local boolean array isUsed
local integer typeId
loop
exitwhen i > 8
if( udg_theHeroes[i] != null ) then
set typeId = GetUnitTypeId( udg_theHeroes[i] )
set isUsed[Trig_ClearOutUnused_TypeToInt(typeId)] = true
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 13
if( isUsed[i] == false ) then
// not being used...run the cleanup
call Trig_ClearOutUnused_CleanUp(i)
endif
set i = i + 1
endloop
call DisableTrigger( gg_trg_ClearOutUnused )
call DestroyTrigger( gg_trg_ClearOutUnused )
endfunction
//===========================================================================
function InitTrig_ClearOutUnused takes nothing returns nothing
set gg_trg_ClearOutUnused = CreateTrigger( )
call TriggerAddAction( gg_trg_ClearOutUnused, function Trig_ClearOutUnused_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_TextTagSuggest_Actions takes nothing returns nothing
local texttag t1
local texttag t2
local location loc
local integer i = 0
local real dbt = 150 // Distance Between Tags
loop
exitwhen i > 3
set t1 = CreateTextTag()
set t2 = CreateTextTag()
set loc = selectorLocs[i]
call SetTextTagText( t1, "We Strongly Suggest Your Team Has", 0.018 )
call SetTextTagText( t2, "One Melee Hero, One Ranged Hero", 0.018 )
call SetTextTagPos( t1, GetLocationX(loc)-200, GetLocationY(loc)+dbt, 0 )
call SetTextTagPos( t2, GetLocationX(loc)-200, GetLocationY(loc)-dbt, 0 )
call SetTextTagColor( t1, 255, 255, 255, 255 )
call SetTextTagColor( t2, 255, 255, 255, 255 )
call SetTextTagPermanent(t1, false)
call SetTextTagPermanent(t2, false)
call SetTextTagLifespan(t1, 45.0)
call SetTextTagLifespan(t2, 45.0)
set i = i + 1
endloop
set t1 = null
set t2 = null
set loc = null
endfunction
//===========================================================================
function InitTrig_TextTagSuggest takes nothing returns nothing
set gg_trg_TextTagSuggest = CreateTrigger( )
call TriggerAddAction( gg_trg_TextTagSuggest, function Trig_TextTagSuggest_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_SetUpBearDE_Actions takes nothing returns nothing
call TriggerExecute( gg_trg_BearDeadKillSummons )
call TriggerExecute( gg_trg_DEDeadKillSummons )
endfunction
//===========================================================================
function InitTrig_SetUpBearDE takes nothing returns nothing
set gg_trg_SetUpBearDE = CreateTrigger( )
call TriggerAddAction( gg_trg_SetUpBearDE, function Trig_SetUpBearDE_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_MakeMob takes nothing returns nothing
call TriggerExecute(gg_trg_MakeRoamer)
endfunction
function Trig_StartEvery5 takes nothing returns nothing
local integer t = H2I(CreateTimer())
call TimerStart(I2Timer(t), 410.0, true, function Trig_MakeMob )
endfunction
function Trig_StartRoamTimers_Actions takes nothing returns nothing
local integer t = H2I(CreateTimer())
call TimerStart(I2Timer(t), 1200.0, false, function Trig_StartEvery5 )
endfunction
//===========================================================================
function InitTrig_StartRoamTimers takes nothing returns nothing
set gg_trg_StartRoamTimers = CreateTrigger( )
call TriggerAddAction( gg_trg_StartRoamTimers, function Trig_StartRoamTimers_Actions )
endfunction
//TESH.scrollpos=20
//TESH.alwaysfold=0
function Trig_MakeRoamer_GetRandomMob takes nothing returns integer
local integer i = GetRandomInt(1,2)
if( i == 2 ) then
return 'e00B'
endif
return 'o00D'
endfunction
function Trig_MakeRoamer_GetRect takes integer i returns rect
// expects i to be between (inclusive) 0-4
if( i == 0 ) then
return gg_rct_Roamer0
endif
if( i == 1 ) then
return gg_rct_Roamer1
endif
if( i == 2 ) then
return gg_rct_Roamer2
endif
if( i == 3 ) then
return gg_rct_Roamer3
endif
return gg_rct_Roamer4
endfunction
function Trig_MakeRoamer_Actions takes nothing returns nothing
// assume this is fired every 5 minutes...
// need to create a random mob, and get two random rects
// send it off
// announce to everyone
local integer i = GetRandomInt(0,4)
local integer j = GetRandomInt(0,4)
local rect r1
local rect r2
local unit mob
local integer mobType = Trig_MakeRoamer_GetRandomMob()
loop
exitwhen (j != i )
set j = GetRandomInt(0,4)
endloop
set r1 = Trig_MakeRoamer_GetRect(i)
set r2 = Trig_MakeRoamer_GetRect(j)
set mob = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), mobType, GetRectCenterX(r1), GetRectCenterY(r1), 0 )
call IssuePointOrder( mob, "patrol", GetRectCenterX(r2), GetRectCenterY(r2))
call GlobalMessage("A Roaming Mob (with a Big Bounty) Has Spawned in the Fungeon!")
call PingMinimapForForceEx( GetPlayersAll(), GetRectCenterX(r1), GetRectCenterY(r1), 4.0, bj_MINIMAPPINGSTYLE_FLASHY, 100, 100, 100 )
set mob = null
set r1 = null
set r2 = null
endfunction
//===========================================================================
function InitTrig_MakeRoamer takes nothing returns nothing
set gg_trg_MakeRoamer = CreateTrigger( )
call TriggerAddAction( gg_trg_MakeRoamer, function Trig_MakeRoamer_Actions )
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
function Trig_MinibossRespawns_GetRandom takes nothing returns integer
local integer i = GetRandomInt(1,3)
if( i == 1 ) then
return 'n01B' // light. rev
endif
if( i == 2 ) then
return 'o005' // Troll head hunter
endif
return 'n00R' // golem
endfunction
function Trig_MinibossRespawns_MakeEm takes nothing returns nothing
local unit mob
local real x
local real y
local integer c = PLAYER_NEUTRAL_AGGRESSIVE
set x = GetRectCenterX(gg_rct_MMC0)
set y = GetRectCenterY(gg_rct_MMC0)
set mob = CreateUnit( Player(c), Trig_MinibossRespawns_GetRandom(), x, y, 0 )
call PingMinimapForForce(GetPlayersAll(), x, y, 5.0 )
set x = GetRectCenterX(gg_rct_MMC3)
set y = GetRectCenterY(gg_rct_MMC3)
set mob = CreateUnit( Player(c), Trig_MinibossRespawns_GetRandom(), x, y, 0 )
call PingMinimapForForce(GetPlayersAll(), x, y, 5.0 )
set x = GetRectCenterX(gg_rct_MMB1)
set y = GetRectCenterY(gg_rct_MMB1)
set mob = CreateUnit( Player(c), Trig_MinibossRespawns_GetRandom(), x, y, 0 )
call PingMinimapForForce(GetPlayersAll(), x, y, 5.0 )
call GlobalMessage("The First Minibosses Have Respawned")
set mob = null
endfunction
function Trig_MinibossRespawns_Kickstart takes nothing returns nothing
// why does this one start at 12 and just runs every 5
local timer t = GetExpiredTimer()
call PauseTimer(t)
call TimerStart( t, 450, true, function Trig_MinibossRespawns_MakeEm )
set t = null
endfunction
function Trig_MinibossRespawns_Actions takes nothing returns nothing
local timer t = CreateTimer()
call TimerStart( t, 720, false, function Trig_MinibossRespawns_Kickstart )
set t = null
endfunction
//===========================================================================
function InitTrig_MinibossRespawns takes nothing returns nothing
set gg_trg_MinibossRespawns = CreateTrigger( )
call TriggerAddAction( gg_trg_MinibossRespawns, function Trig_MinibossRespawns_Actions )
endfunction
//TESH.scrollpos=336
//TESH.alwaysfold=0
function Trig_PvP_MeteorsCallbackPostFX takes nothing returns nothing
//okay, so meteor FX done, cast our warstomp
local integer t = H2I(GetExpiredTimer())
local location loc = GetHandleLocation(I2Timer(t), "loc")
local unit dummy = CreateUnitAtLoc(Player(12), 'h003', loc, 0.0)
call UnitAddAbility( dummy, 'A0AM')
call UnitApplyTimedLife( dummy, 'BTLF', 3.0 )
call IssueImmediateOrder(dummy, "stomp")
//call BJDebugMsg("Warstomp!")
call FlushHandleLocals(I2Timer(t))
call DestroyTimer(I2Timer(t))
set dummy = null
call RemoveLocation(loc)
set loc = null
endfunction
function Trig_PvP_MeteorsCallback takes nothing returns nothing
local location loc = GetRandomLocInRect( gg_rct_PvPArenaA )
local integer warstompT = H2I(CreateTimer())
call SetHandleHandle(I2Timer(warstompT), "loc", loc)
call DestroyEffect( AddSpecialEffectLoc("Units\\Demon\\Infernal\\InfernalBirth.mdl", loc) )
call TimerStart(I2Timer(warstompT), 0.4, false, function Trig_PvP_MeteorsCallbackPostFX )
set loc = null
endfunction
function Trig_PvP_StartMeteors takes nothing returns nothing
call DestroyTimer( udg_pvpMeteorsT )
set udg_pvpMeteorsT = CreateTimer()
call TimerStart( udg_pvpMeteorsT, 0.25, true, function Trig_PvP_MeteorsCallback )
call GlobalMessage( "|cffff0000The Fungeon Master is not amused by your PvP!|r" )
endfunction
function Trig_PvP_IntToBuff takes integer i returns integer
if( i == 0 ) then
return 'I019'
endif
if( i == 1 ) then
return 'I01X'
endif
if( i == 2 ) then
return 'I01Y'
endif
if( i == 3 ) then
return 'I01Z'
endif
if( i == 4 ) then
return 'I020'
endif
return 'I019'
endfunction
function Trig_PvP_InitBossBuffs takes nothing returns nothing
local integer i = 0
local rect r
local location loc
local item it
set i = 0
set r = gg_rct_PVPBuffSpawn1
loop
exitwhen i > 4
set loc = GetRandomLocInRect(r)
if( udg_team1buffs[i] ) then
set it = CreateItem( Trig_PvP_IntToBuff(i), GetLocationX(loc), GetLocationY(loc) )
endif
call RemoveLocation(loc)
set i = i + 1
endloop
set i = 0
set r = gg_rct_PVPBuffSpawn2
loop
exitwhen i > 4
set loc = GetRandomLocInRect(r)
if( udg_team2buffs[i] ) then
set it = CreateItem( Trig_PvP_IntToBuff(i), GetLocationX(loc), GetLocationY(loc) )
endif
call RemoveLocation(loc)
set i = i + 1
endloop
set i = 0
set r = gg_rct_PVPBuffSpawn3
loop
exitwhen i > 4
set loc = GetRandomLocInRect(r)
if( udg_team3buffs[i] ) then
set it = CreateItem( Trig_PvP_IntToBuff(i), GetLocationX(loc), GetLocationY(loc) )
endif
call RemoveLocation(loc)
set i = i + 1
endloop
set i = 0
set r = gg_rct_PVPBuffSpawn4
loop
exitwhen i > 4
set loc = GetRandomLocInRect(r)
if( udg_team4buffs[i] ) then
set it = CreateItem( Trig_PvP_IntToBuff(i), GetLocationX(loc), GetLocationY(loc) )
endif
call RemoveLocation(loc)
set i = i + 1
endloop
set loc = null
set it = null
set r = null
endfunction
function Trig_Final_PvP_PortCondition takes nothing returns boolean
local integer id = GetUnitTypeId(GetFilterUnit())
// don't port the following units
if( id == 'n00B' or id == 'h006' or id == 'h00G' or id == 'h00P' or id == 'h00Q' or id == 'h00R' or id == 'ncop' or id == 'nwad' or id == 'n00E' or id == 'n00F' or id == 'n00G' ) then
return false
endif
if( IsUnitDeadBJ( GetFilterUnit() ) ) then
return false
endif
return true
endfunction
function Trig_Final_PvP_PortAllPUnits takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetEnumUnit()))
local location loc = FinalPVP[i/2]
call SetUnitPositionLoc( GetEnumUnit(), loc )
call SetUnitManaPercentBJ( GetEnumUnit(), 100.0)
call SetUnitLifePercentBJ( GetEnumUnit(), 100.0)
call UnitResetCooldown( GetEnumUnit() )
set loc = null
endfunction
// this function SOLELY teleports our units to the arena.. and sets them to full >_<
function Trig_PvP_Port takes nothing returns nothing
local integer i = 0
local location loc
local group g
local boolexpr cond = Condition( function Trig_Final_PvP_PortCondition )
call GlobalMessage("-------------")
call GlobalMessage("Teleporting to the PvP Arena")
call GlobalMessage("-------------")
loop
exitwhen i > 7
set loc = FinalPVP[i/2]
if( IsUnitDeadBJ(udg_theHeroes[i]) ) then
call ReviveHeroLoc( udg_theHeroes[i], loc, true )
endif
set g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, Player(i), cond )
call ForGroup( g, function Trig_Final_PvP_PortAllPUnits )
call DestroyGroup(g)
set i = i + 1
endloop
// now that all our heroes are in the arena...let's begin
call DestroyBoolExpr(cond)
set cond = null
set g = null
set loc = null
endfunction
function Trig_PvP_GetRandomRune takes nothing returns integer
local integer i = GetRandomInt(1, 5)
if( i == 1 ) then
return 'I01U'
endif
if( i == 2 ) then
return 'I018'
endif
if( i == 3 ) then
return 'I017'
endif
if( i == 4 ) then
return 'I01W'
endif
return 'I023'
endfunction
function Trig_PvP_KillGates takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 3
call KillDestructable( pvpgates[i] )
set i = i + 1
endloop
endfunction
function Trig_PvP_KillGroup takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
function Trig_PvP_RemoveItem takes nothing returns nothing
call RemoveItem( GetEnumItem() )
endfunction
function Trig_PvP_ClearAllUnits takes nothing returns nothing
local group g = CreateGroup()
call GroupEnumUnitsInRect( g, gg_rct_PvPArenaA, null )
call ForGroup( g, function Trig_PvP_KillGroup )
call DestroyGroup(g)
set g = null
call EnumItemsInRect( gg_rct_PvPArenaA, null, function Trig_PvP_RemoveItem )
endfunction
function Trig_PvP_WhichTower takes integer i returns integer
local integer num = udg_numTowers[i/2]
if( num > 3 ) then
return 'h00N' // level 3 tower
endif
if( num > 1 ) then
return 'h00M' // level 2 tower
endif
if( num == 1 ) then
return 'h00L' // level 1 tower
endif
return 0
endfunction
function Trig_PvP_MakeTowers takes nothing returns nothing
local integer i = 0
local integer towerID = 0
loop
exitwhen i > 7
set towerID = Trig_PvP_WhichTower(i)
if( towerID != 0 and ( GetPlayerSlotState(Player(i)) != PLAYER_SLOT_STATE_EMPTY ) ) then
call CreateUnitAtLoc( Player(i), towerID, pvptowers[i], 0 )
endif
set i = i + 1
endloop
endfunction
function Trig_PvP_RestoreGates takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 3
if( i == 0 or i == 2 ) then
set pvpgates[i] = CreateDestructable( 'LTe1', GetDestructableX(pvpgates[i]), GetDestructableY(pvpgates[i]), 0.0, 1.0, 0 )
else
set pvpgates[i] = CreateDestructable( 'LTe3', GetDestructableX(pvpgates[i]), GetDestructableY(pvpgates[i]), 0.0, 1.0, 0 )
endif
set i = i + 1
endloop
endfunction
function Trig_PvP_InitCorpses takes nothing returns nothing
local location loc1 = GetRectCenter( gg_rct_RuneSpawn0 )
local location loc2 = GetRectCenter( gg_rct_RuneSpawn1 )
local location loc3 = GetRectCenter( gg_rct_RuneSpawn2 )
local location loc4 = GetRectCenter( gg_rct_RuneSpawn3 )
local unit c1 = CreateUnitAtLoc( Player(12), 'u00A', loc1, 0.0 )
local unit c2 = CreateUnitAtLoc( Player(12), 'u00A', loc2, 0.0 )
local unit c3 = CreateUnitAtLoc( Player(12), 'u00A', loc3, 0.0 )
local unit c4 = CreateUnitAtLoc( Player(12), 'u00A', loc4, 0.0 )
set c1 = null
set c2 = null
set c3 = null
set c4 = null
call RemoveLocation( loc1 )
call RemoveLocation( loc2 )
call RemoveLocation( loc3 )
call RemoveLocation( loc4 )
set loc1 = null
set loc2 = null
set loc3 = null
set loc4 = null
endfunction
function Trig_PvP_Ally_Rez_Callback takes nothing returns nothing
local integer i = 0
local real x
local real y
loop
exitwhen i > 3
set x = GetLocationX( FinalPVP[i] )
set y = GetLocationY( FinalPVP[i] )
if( NumberHeroesAlive(i) == 1 ) then
// we are only concerned if one hero is alive
if( IsUnitDeadBJ( udg_theHeroes[i*2] ) ) then
call ReviveHero( udg_theHeroes[i*2], x, y, true )
endif
// this is 'playing it safe' as opposed to a 'else' call
if( IsUnitDeadBJ( udg_theHeroes[(i*2)+1] ) ) then
call ReviveHero( udg_theHeroes[(i*2)+1], x, y, true )
endif
endif
set i = i + 1
endloop
endfunction
function Trig_PvP_CheckTeamCount takes integer i returns integer
if( i >= 1 ) then
return 1
endif
return 0
endfunction
function Trig_PvP_Rune_Callback takes nothing returns nothing
// runes: 'rspd', 'rma2', 'rhe3', 'rdis'
local item it
local integer i = GetRandomInt(0, 4)
//call GlobalMessage("Rune Created!")
set it = CreateItem( Trig_PvP_GetRandomRune(), GetLocationX(runespawn[i]), GetLocationY(runespawn[i]) )
set it = null
endfunction
function Trig_PvP_RestoreRezTimer takes nothing returns nothing
//call BJDebugMsg("|Cffff0000^^^^^^^RESTORING REZ TIMER^^^^^^^^^^^^")
set udg_gyRezTimer = CreateTimer()
call TriggerExecute( gg_trg_GY_Revive )
endfunction
function Trig_PvP_RestoreToPvE takes nothing returns nothing
// currently we are just switching the timers around...should probably do more...
call PauseTimer( udg_pvpRezTimer )
call PauseTimer( udg_pvpRuneTimer )
call PauseTimer( udg_pvpMeteorsT )
call PauseTimer( udg_pvpStartMeteorsT )
call TimerDialogDisplay(udg_pvpRezWindow, false )
call DestroyTimerDialog( udg_pvpRezWindow )
call Trig_PvP_RestoreRezTimer()
// do more things?
endfunction
function Trig_PvP_KillAllHeroes takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 7
call UnitResetCooldown(udg_theHeroes[i])
call KillUnit(udg_theHeroes[i])
set udg_deathbypvp[i] = true
set i = i + 1
endloop
endfunction
function Trig_PvP_SetReviveFlags takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 7
set udg_heroCanRez[i] = true
set i = i + 1
endloop
endfunction
function Trig_PvP_Cleanup takes nothing returns nothing
// ===== Runs after we have a winning team ====
call Trig_PvP_RestoreGates()
call Trig_PvP_KillAllHeroes()
call Trig_PvP_ClearAllUnits()
call Trig_PvP_SetReviveFlags()
call Trig_GY_theRevive()
call Trig_PvP_RestoreToPvE()
endfunction
function Trig_PvP_EndCheck takes nothing returns nothing
local integer count = 0
local integer i = 0
local integer t = H2I(GetExpiredTimer())
local integer isAlive = 0 // 1 will be Team Is Alive, 0 not alive
loop
exitwhen i > 3
set isAlive = ( Trig_PvP_CheckTeamCount( NumberHeroesAlive(i) ) )
set count = count + isAlive
if(udg_debugMode) then
if( GetLocalPlayer() == Player(0) ) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Team " + I2S(i+1) + " is alive? " + I2S(isAlive) )
endif
endif
set i = i + 1
endloop
if ( count == 1 ) then
// we have a winner! now what...
call GlobalMessage("A Victor Arises from the Ashes")
call PauseTimer( GetExpiredTimer() )
// wait if this is Sephiroth Down, then do other stuff...else all this is fine
if( udg_sephirothDown ) then
// OH SNAP, WINRAR OF THE GAME
call GlobalMessage("We have a Final Champion of the Fungeon")
call PauseTimer( udg_pvpEndTimer )
call TriggerExecute( gg_trg_FinalVictor )
else
call PauseTimer( udg_pvpEndTimer )
call Trig_PvP_Cleanup()
endif
else
if(udg_debugMode) then
if( GetLocalPlayer() == Player(0) ) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Checking...Count is: " + I2S(count))
endif
endif
endif
if ( count == 0 ) then
// hmmm...everyone is dead...interesting
call GlobalMessage("It would appear that all the heroes have died...interesting.")
//scall GlobalMessage("Resurrecting all players...not...hmmm")
call TriggerExecute( gg_trg_PvP )
// CALL REZ ALL TO PVP
endif
endfunction
function Trig_PvP_Begin_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local integer step = GetHandleInt(I2Timer(t), "step")
if( step == 10 ) then
call GlobalMessage("PvP Begins In")
endif
if( step > 0 ) then
call GlobalMessage("..." + I2S(step))
call SetHandleInt(I2Timer(t), "step", step-1 )
else
call CleanTimer(I2Timer(t))
call Trig_PvP_KillGates()
endif
endfunction
function Trig_PvP_Begin takes nothing returns nothing
local integer t = H2I(CreateTimer())
call SetHandleInt(I2Timer(t), "step", 10)
call TimerStart( I2Timer(t), 1.0, true, function Trig_PvP_Begin_Callback )
endfunction
function Trig_PvP_Actions takes nothing returns nothing
// things to do...pause and hide our rez timer...
//call BJDebugMsg("|cffff0000PAUSING GRAVEYARD TIMER|r")
call TimerDialogDisplay( udg_gyRezWindow, false )
call DestroyTimerDialog( udg_gyRezWindow )
call CleanTimer( udg_gyRezTimer )
// =========================
// set up a timer to create random runes...
call DestroyTimer( udg_pvpRuneTimer )
set udg_pvpRuneTimer = CreateTimer()
call TimerStart( udg_pvpRuneTimer, 20.0, true, function Trig_PvP_Rune_Callback )
//call CreateTimerDialogBJ( udg_pvpRuneTimer, "Rune In At: ")
// now set up our rez timer for here...and our end checking timer
call DestroyTimer( udg_pvpRezTimer )
set udg_pvpRezTimer = CreateTimer()
//call TimerStart( udg_pvpRezTimer, 30.0, true, function Trig_PvP_Ally_Rez_Callback )
//set udg_pvpRezWindow = CreateTimerDialogBJ( udg_pvpRezTimer, "PvP Rez At: " )
call DestroyTimer( udg_pvpEndTimer )
set udg_pvpEndTimer = CreateTimer()
call TimerStart( udg_pvpEndTimer, 0.5, true, function Trig_PvP_EndCheck )
call DestroyTimer( udg_pvpStartMeteorsT )
set udg_pvpStartMeteorsT = CreateTimer()
call TimerStart( udg_pvpStartMeteorsT, 180.0, false, function Trig_PvP_StartMeteors )
// now, port all units and restore health
call Trig_PvP_Port()
call Trig_PvP_InitCorpses()
call Trig_PvP_InitBossBuffs()
// === going to take out towers for now ===
//call Trig_PvP_MakeTowers()
// go ahead and destroy the gates...( 5 second process btw )
call Trig_PvP_Begin()
endfunction
//===========================================================================
function InitTrig_PvP takes nothing returns nothing
set gg_trg_PvP = CreateTrigger( )
call TriggerAddAction( gg_trg_PvP, function Trig_PvP_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Final_Victor_IsLoser takes integer i returns boolean
if( udg_theHeroes[i] != null ) then
if( GetUnitState(udg_theHeroes[i], UNIT_STATE_LIFE) > 0 ) then
return false
// first not null and alive...clearly not losers
endif
endif
if( udg_theHeroes[i+1] != null ) then
if( GetUnitState(udg_theHeroes[i+1], UNIT_STATE_LIFE) > 0 )then
return false
endif
endif
// if either are alive...then they cannot be losers.
// otherwise, they are
return true
endfunction
function Trig_Final_Victor_Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 3
if( Trig_Final_Victor_IsLoser(i) ) then
// they are loser
call CustomDefeatBJ( Player(2*i), "Try Harder.")
call CustomDefeatBJ( Player((2*i)+1), "Try Harder.")
else
call CustomVictoryBJ( Player(2*i), true, true )
call CustomVictoryBJ( Player((2*i)+1), true, true )
endif
endloop
endfunction
//===========================================================================
function InitTrig_FinalVictor takes nothing returns nothing
set gg_trg_FinalVictor = CreateTrigger( )
call TriggerAddAction( gg_trg_FinalVictor, function Trig_Final_Victor_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Death_By_Pvp_Conditions takes nothing returns boolean
return ( IsUnit( GetTriggerUnit(), udg_theHeroes[ GetPlayerId(GetTriggerPlayer()) ] ) )
endfunction
function Trig_Death_ByPvP_CanRezFlag takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local integer num = GetHandleInt(I2Timer(t), "num")
set udg_heroCanRez[num] = true
call CleanTimer(I2Timer(t))
endfunction
function Trig_Death_By_Pvp_Actions takes nothing returns nothing
local integer vicId = GetPlayerId(GetTriggerPlayer())
local integer killId = GetPlayerId(GetOwningPlayer(GetKillingUnit()))
local unit dummy = null
local item it = null
// run timer to set Death By PvP to True
local integer timerT = H2I(CreateTimer())
call SetHandleInt( I2Timer(timerT), "num", vicId )
call TimerStart( I2Timer(timerT), udg_heroRezDelay, false, function Trig_Death_ByPvP_CanRezFlag )
set udg_heroCanRez[vicId] = false
// award if this was a PvP Kill
if( GetOwningPlayer(GetKillingUnit()) != null ) then //maybe problematic
if( killId < 8 and killId >= 0 ) then
if ( (killId/2) != (vicId/2) ) then
set udg_deathbypvp[vicId] = true
call GlobalMessage(udg_playerColorCodes[killId] + GetPlayerName(Player(killId)) + " (" + GetUnitName(udg_theHeroes[killId]) + ")|r has killed " + udg_playerColorCodes[vicId] + GetPlayerName(Player(vicId)) + " (" + GetUnitName(udg_theHeroes[vicId]) + ")|r")
//set dummy = CreateUnit( Player(killId), 'h003', GetUnitX(GetKillingUnit()), GetUnitY(GetKillingUnit()), 0.0 )
//call UnitApplyTimedLife( dummy, 'BTLF', 2.0 )
//set it = CreateItem( 'I013', 0, 0 )
//call UnitAddItem( dummy, it )
//call UnitUseItem( dummy, it )
//call RemoveItem(it)
//set it = null
//set dummy = null
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_Hero_Death takes nothing returns nothing
set gg_trg_Hero_Death = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(0), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(1), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(2), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(3), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(4), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(5), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(6), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Hero_Death, Player(7), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerAddCondition( gg_trg_Hero_Death, Condition( function Trig_Death_By_Pvp_Conditions ) )
call TriggerAddAction( gg_trg_Hero_Death, function Trig_Death_By_Pvp_Actions )
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
function Trig_GY_isP takes nothing returns boolean
return (( GetUnitTypeId(GetFilterUnit()) == 'n00B' ) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 ) )
endfunction
function Trig_GY_isT takes nothing returns boolean
local integer t = GetUnitTypeId(GetFilterUnit())
return ( ( (t=='h006') or (t=='h00P') or (t=='h00G') or (t=='h00Q') or (t=='h00R') ) and (IsUnitAliveBJ(GetFilterUnit())) )
endfunction
function Trig_GY_Peasant takes nothing returns nothing
local integer i = 0
local integer loopEnd = 6
local group g
local group g2
local unit peasant
local location loc
local boolexpr filter
loop
exitwhen i > loopEnd
// need to see if there already is a peasant there
set g = CreateGroup()
set filter = Condition(function Trig_GY_isP)
call GroupEnumUnitsInRect(g, udg_GYRects[i], filter )
call DestroyBoolExpr(filter)
// need to get the Owner of the Graveyardtower there
set g2 = CreateGroup()
set filter = Condition(function Trig_GY_isT)
call GroupEnumUnitsInRect( g2, udg_GYRects[i], filter )
call DestroyBoolExpr(filter)
if( CountUnitsInGroup(g) == 0 ) then
set loc = GetRectCenter( udg_GYRects[i] )
set peasant = CreateUnitAtLoc( GetOwningPlayer(FirstOfGroup(g2)), 'n00B', loc, 0 )
call RemoveLocation( loc )
call IssueImmediateOrder( peasant, "repairon" )
endif
call DestroyGroup(g)
call DestroyGroup(g2)
set i = i + 1
endloop
set filter = null
set peasant = null
set loc = null
set g = null
set g2 = null
endfunction
function Trig_GY_Peasant_Actions takes nothing returns nothing
local integer t2 = H2I(CreateTimer())
call TimerStart( I2Timer(t2), 30.0, true, function Trig_GY_Peasant )
endfunction
//===========================================================================
function InitTrig_GY_Peasant takes nothing returns nothing
set gg_trg_GY_Peasant = CreateTrigger( )
call TriggerAddAction( gg_trg_GY_Peasant, function Trig_GY_Peasant_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
// Trig_GY_theRevive used to be located here...it has since been moved to the map header
function Trig_GY_Revive_Actions takes nothing returns nothing
call TimerStart( udg_gyRezTimer, 35.0, true, function Trig_GY_theRevive )
set udg_gyRezWindow = CreateTimerDialogBJ( udg_gyRezTimer, "Next Hero Rez In: " )
endfunction
//===========================================================================
function InitTrig_GY_Revive takes nothing returns nothing
set gg_trg_GY_Revive = CreateTrigger( )
call DisableTrigger( gg_trg_GY_Revive )
call TriggerAddAction( gg_trg_GY_Revive, function Trig_GY_Revive_Actions )
endfunction
//TESH.scrollpos=33
//TESH.alwaysfold=0
function Trig_GY_Claim_Conditions takes nothing returns boolean
local integer i = GetUnitTypeId(GetDyingUnit())
return ( i == 'h006' ) or ( i == 'h00P' ) or ( i == 'h00G' ) or ( i == 'h00Q' ) or ( i == 'h00R' )
endfunction
// MB stands for Multiboard, although the Multiboard just checks these variables
// every couple seconds...yea i dunno either
function GY_decrementMB takes integer i returns nothing
set udg_numTowers[i] = udg_numTowers[i] - 1
endfunction
function GY_incrementMB takes integer i returns nothing
set udg_numTowers[i] = udg_numTowers[i] + 1
endfunction
function Trig_GY_Claim_LvlToTower takes integer lvl returns integer
if( lvl > 4 ) then
return 'h00R'
endif
if( lvl == 4 ) then
return 'h00Q'
endif
if( lvl == 3 ) then
return 'h00G'
endif
if( lvl == 2 ) then
return 'h00P'
endif
return 'h006'
endfunction
function Trig_GY_Claim_Actions takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
local player loser = GetOwningPlayer(GetTriggerUnit())
local player winner = GetOwningPlayer(GetKillingUnit())
local integer towerID
local integer lID = GetPlayerId(loser)
local integer wID = GetPlayerId(winner)
// if( GetUnitTypeId(GetDyingUnit()) == 'h00G' ) then
// set towerID = 'h00G'
// endif
// time to determine what level to make our new tower.
// first, if the loser was NOT creeps, decrease their level..which could be totally wrong
if ( loser != Player(PLAYER_NEUTRAL_AGGRESSIVE) ) then
call purgeStack( theGYs[lID/2], loc )
call GY_decrementMB(lID/2)
endif
if( winner == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) then
set towerID = 'h00G'
endif
set towerID = Trig_GY_Claim_LvlToTower(udg_numTowers[wID/2]+1)
call CreateUnitAtLoc( winner, towerID, loc, 0 )
if ( winner != Player(PLAYER_NEUTRAL_AGGRESSIVE) ) then
call pushStack( theGYs[wID/2], loc )
call GY_incrementMB(wID/2)
endif
call PingMinimapLocForForce( GetPlayersAll(), loc, 4.0 )
call GlobalMessage("A |cff444444Graveyard Tower|r Has Been Taken!" )
//call RemoveLocation(loc)
set winner = null
set loser = null
set loc = null
// == If a tower had never been taken before, we must now PvP!
// unless we aint playing by those rules... ==
if ((not udg_towerTaken) and udg_pvpAfterFirstTower )then
set udg_towerTaken = true
call GlobalMessage(" Prepare for some real big |cffff0000PvP!|r")
call PolledWait(5.0)
call TriggerExecute( gg_trg_PvP )
endif
endfunction
//===========================================================================
function InitTrig_GY_Claim takes nothing returns nothing
set gg_trg_GY_Claim = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_GY_Claim, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_GY_Claim, Condition( function Trig_GY_Claim_Conditions ) )
call TriggerAddAction( gg_trg_GY_Claim, function Trig_GY_Claim_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GY_1_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 'n00B' )
endfunction
function Trig_GY_1_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_GY1 )
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_GY_1 takes nothing returns nothing
set gg_trg_GY_1 = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_GY_1, gg_rct_GY1 )
call TriggerAddCondition( gg_trg_GY_1, Condition( function Trig_GY_1_Conditions ) )
call TriggerAddAction( gg_trg_GY_1, function Trig_GY_1_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GY_2_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 'n00B' )
endfunction
function Trig_GY_2_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_GY2 )
call SetUnitPositionLoc( GetTriggerUnit(), loc)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_GY_2 takes nothing returns nothing
set gg_trg_GY_2 = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_GY_2, gg_rct_GY2 )
call TriggerAddCondition( gg_trg_GY_2, Condition( function Trig_GY_2_Conditions ) )
call TriggerAddAction( gg_trg_GY_2, function Trig_GY_2_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GY_3_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 'n00B' )
endfunction
function Trig_GY_3_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_GY3 )
call SetUnitPositionLoc( GetTriggerUnit(), loc)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_GY_3 takes nothing returns nothing
set gg_trg_GY_3 = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_GY_3, gg_rct_GY3 )
call TriggerAddCondition( gg_trg_GY_3, Condition( function Trig_GY_3_Conditions ) )
call TriggerAddAction( gg_trg_GY_3, function Trig_GY_3_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GY_4_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 'n00B' )
endfunction
function Trig_GY_4_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_GY4 )
call SetUnitPositionLoc( GetTriggerUnit(), loc)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_GY_4 takes nothing returns nothing
set gg_trg_GY_4 = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_GY_4, gg_rct_GY4 )
call TriggerAddCondition( gg_trg_GY_4, Condition( function Trig_GY_4_Conditions ) )
call TriggerAddAction( gg_trg_GY_4, function Trig_GY_4_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GY_5_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 'n00B' )
endfunction
function Trig_GY_5_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_GY5 )
call SetUnitPositionLoc( GetTriggerUnit(), loc)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_GY_5 takes nothing returns nothing
set gg_trg_GY_5 = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_GY_5, gg_rct_GY5 )
call TriggerAddCondition( gg_trg_GY_5, Condition( function Trig_GY_2_Conditions ) )
call TriggerAddAction( gg_trg_GY_5, function Trig_GY_2_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GY_6_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 'n00B' )
endfunction
function Trig_GY_6_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_GY6 )
call SetUnitPositionLoc( GetTriggerUnit(), loc)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_GY_6 takes nothing returns nothing
set gg_trg_GY_6 = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_GY_6, gg_rct_GY6 )
call TriggerAddCondition( gg_trg_GY_6, Condition( function Trig_GY_6_Conditions ) )
call TriggerAddAction( gg_trg_GY_6, function Trig_GY_6_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GY_7_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetTriggerUnit()) == 'n00B' )
endfunction
function Trig_GY_7_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_GY7 )
call SetUnitPositionLoc( GetTriggerUnit(), loc)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_GY_7 takes nothing returns nothing
set gg_trg_GY_7 = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_GY_7, gg_rct_GY7 )
call TriggerAddCondition( gg_trg_GY_7, Condition( function Trig_GY_7_Conditions ) )
call TriggerAddAction( gg_trg_GY_7, function Trig_GY_7_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ItemPool1_Actions takes nothing returns nothing
// items are...
// I015,I01B,I01D,I01C, - stat boosters
// I008,I01I,I01H - Tomes
// I01A,I016,I017,I018,I019 - Gold/Runes
set lvl1ip = CreateItemPool()
call ItemPoolAddItemType( lvl1ip, 'I015', 1 )
call ItemPoolAddItemType( lvl1ip, 'I01B', 1 )
call ItemPoolAddItemType( lvl1ip, 'I01D', 1 )
call ItemPoolAddItemType( lvl1ip, 'I01C', 1 )
call ItemPoolAddItemType( lvl1ip, 'I008', 1 )
call ItemPoolAddItemType( lvl1ip, 'I01I', 1 )
call ItemPoolAddItemType( lvl1ip, 'I01H', 1 )
call ItemPoolAddItemType( lvl1ip, 'I01A', 1 )
call ItemPoolAddItemType( lvl1ip, 'I016', 1 )
call ItemPoolAddItemType( lvl1ip, 'I017', 1 )
call ItemPoolAddItemType( lvl1ip, 'I018', 1 )
//call ItemPoolAddItemType( lvl1ip, 'I019', 1 ) // rune of the ice spider
call DestroyTrigger( gg_trg_ItemPool1 )
endfunction
//===========================================================================
function InitTrig_ItemPool1 takes nothing returns nothing
set gg_trg_ItemPool1 = CreateTrigger( )
call TriggerAddAction( gg_trg_ItemPool1, function Trig_ItemPool1_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Item_Drop_Conditions takes nothing returns boolean
// chance to drop if one of these
// e008,e003,e00A,h005,h00F,h00C,h00H,h004,o000,o008,o00A, u005,u00B,n002, n01E,n00U,n00P,n01D,n004,n003 ,n00S,n01C
local integer i = GetUnitTypeId(GetDyingUnit())
if( IsUnitIllusion(GetDyingUnit()) ) then
return false
endif
if( i == 'e008' or i == 'e003' or i == 'e00A' or i == 'h005' or i == 'h00F' or i == 'h00C' or i == 'h00H' or i == 'h004' or i == 'o000' or i == 'o008' or i == 'o00A' or i == 'u005' or i == 'u00B' or i == 'n002' or i == 'n01E' or i == 'n00U' or i == 'n00P' or i == 'n01D' or i =='n004' or i == 'n003' or i == 'n00S' or i == 'n01C' ) then
return true
endif
return false
endfunction
function Trig_ItemDrop_Actions takes nothing returns nothing
local integer rand = GetRandomInt(1,100)
local item it
if( rand <= 15 ) then
set it = PlaceRandomItem( lvl1ip, GetUnitX(GetDyingUnit()), GetUnitY(GetDyingUnit()) )
set it = null
endif
endfunction
//===========================================================================
function InitTrig_ItemDrop takes nothing returns nothing
set gg_trg_ItemDrop = CreateTrigger( )
call TriggerAddAction( gg_trg_ItemDrop, function Trig_ItemDrop_Actions )
call TriggerAddCondition( gg_trg_ItemDrop, Condition(function Trig_Item_Drop_Conditions) )
call TriggerRegisterPlayerUnitEvent( gg_trg_ItemDrop, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH, null )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ItemDrop2_Conditions takes nothing returns boolean
local integer i = GetUnitTypeId(GetDyingUnit())
if( IsUnitIllusion(GetDyingUnit()) ) then
return false
endif
if( i == 'o00B' or i == 'n01G' or i == 'n01F' ) then
return true
endif
return false
endfunction
function Trig_ItemDrop2_Actions takes nothing returns nothing
local integer rand = GetRandomInt(1,100)
local unit d = GetDyingUnit()
local unit u
local item it
if( rand >= 85 ) then
// create mimic
set u = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h00I', GetUnitX(d), GetUnitY(d), 0.0 )
set u = null
endif
if( rand <=60 ) then
// drop item
set it = PlaceRandomItem( lvl1ip, GetUnitX(GetDyingUnit()), GetUnitY(GetDyingUnit()) )
set it = null
endif
set d = null
endfunction
//===========================================================================
function InitTrig_ItemDrop2 takes nothing returns nothing
set gg_trg_ItemDrop2 = CreateTrigger( )
call TriggerAddAction( gg_trg_ItemDrop2, function Trig_ItemDrop2_Actions )
call TriggerAddCondition( gg_trg_ItemDrop2, Condition( function Trig_ItemDrop2_Conditions ) )
call TriggerRegisterPlayerUnitEvent( gg_trg_ItemDrop2, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH, null )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ItemDrop3_Conditions takes nothing returns boolean
local integer i = GetUnitTypeId(GetDyingUnit())
if( IsUnitIllusion(GetDyingUnit()) ) then
return false
endif
if( i == 'o005' or i == 'n01B' or i == 'n00R' ) then
return true
endif
return false
endfunction
// revenenant, headhunter, golem
function Trig_ItemDrop3_Actions takes nothing returns nothing
local integer rand = GetRandomInt(1,100)
local unit d = GetDyingUnit()
local unit u
local item it
if( rand >= 75 ) then
// create mimic
set u = CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), 'h00I', GetUnitX(d), GetUnitY(d), 0.0 )
set u = null
endif
if( rand <=74 ) then
// drop item
set it = PlaceRandomItem( lvl1ip, GetUnitX(GetDyingUnit()), GetUnitY(GetDyingUnit()) )
set it = null
endif
set d = null
endfunction
//===========================================================================
function InitTrig_ItemDrop3 takes nothing returns nothing
set gg_trg_ItemDrop3 = CreateTrigger( )
call TriggerAddAction( gg_trg_ItemDrop3, function Trig_ItemDrop3_Actions )
call TriggerAddCondition( gg_trg_ItemDrop3, Condition( function Trig_ItemDrop3_Conditions ) )
call TriggerRegisterPlayerUnitEvent( gg_trg_ItemDrop3, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH, null )
endfunction
//TESH.scrollpos=7
//TESH.alwaysfold=0
function Trig_ItemComb_Conditions takes nothing returns boolean
//if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'I01B') == true ) ) then
// return false
//endif
return ( GetItemTypeId(GetManipulatedItem()) == 'I01B' )
endfunction
function Trig_Item_Combine takes integer id, integer nid, unit u returns nothing
local integer i = 0
local item it
local boolean break = false
loop
set it = UnitItemInSlot( u, i )
if( it != null and (GetItemTypeId(it) == id) and it != GetManipulatedItem() ) then
set break = true
else
set i = i + 1
endif
exitwhen ( i > 5 or break )
endloop
if ( i < 6 ) then
call RemoveItem( it )
call RemoveItem(GetManipulatedItem())
set it = CreateItem( nid, 0, 0)
call UnitAddItem( u, it )
endif
set it = null
endfunction
function Trig_ItemComb_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer id = GetItemTypeId( GetManipulatedItem() )
if ( id == 'I01B' ) then
call Trig_Item_Combine( id, 'I009', u )
endif
if( id == 'I01C' ) then
call Trig_Item_Combine( id, 'I00A', u )
endif
if( id == 'I01D' ) then
call Trig_Item_Combine( id, 'I01E', u )
endif
if( id == 'I015' ) then
call Trig_Item_Combine( id, 'I01G', u )
endif
set u = null
endfunction
//===========================================================================
function InitTrig_ItemComb takes nothing returns nothing
set gg_trg_ItemComb = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ItemComb, EVENT_PLAYER_UNIT_PICKUP_ITEM )
//call TriggerAddCondition( gg_trg_ItemComb, Condition( function Trig_ItemComb_Conditions ) )
call TriggerAddAction( gg_trg_ItemComb, function Trig_ItemComb_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Multiboard_Actions takes nothing returns nothing
local integer count = CountPlayersInForceBJ(GetPlayersByMapControl(MAP_CONTROL_USER))
if( count > 8 ) then
set count = 8
endif
call CreateMultiboardBJ( 3, ( count + 1 ), "TRIGSTR_2821" )
set udg_theMultiboard = GetLastCreatedMultiboard()
call MultiboardSetItemWidthBJ( udg_theMultiboard, 1, 0, 10.50 )
call MultiboardSetItemWidthBJ( udg_theMultiboard, 2, 0, 3.00 )
call MultiboardSetItemWidthBJ( udg_theMultiboard, 3, 0, 3.25 )
// Initialize
call MultiboardSetItemValueBJ( udg_theMultiboard, 1, 0, "TRIGSTR_2831" )
call MultiboardSetItemValueBJ( udg_theMultiboard, 1, 1, "TRIGSTR_2823" )
call MultiboardSetItemValueBJ( udg_theMultiboard, 2, 0, "TRIGSTR_2830" )
call MultiboardSetItemValueBJ( udg_theMultiboard, 2, 1, "TRIGSTR_2824" )
call MultiboardSetItemValueBJ( udg_theMultiboard, 3, 1, "TRIGSTR_4472" )
// Display Style-Icon
call MultiboardSetItemStyleBJ( udg_theMultiboard, 3, 0, true, false )
call MultiboardSetItemStyleBJ( udg_theMultiboard, 2, 0, true, false )
call MultiboardSetItemStyleBJ( udg_theMultiboard, 0, 1, true, false )
call MultiboardSetItemIconBJ( udg_theMultiboard, 1, 0, "ReplaceableTextures\\WorldEditUI\\DoodadPlaceholder.blp" )
call MultiboardDisplay( udg_theMultiboard, true )
call EnableTrigger( gg_trg_Hero_Level_Check )
endfunction
//===========================================================================
function InitTrig_Multiboard takes nothing returns nothing
set gg_trg_Multiboard = CreateTrigger( )
call TriggerAddAction( gg_trg_Multiboard, function Trig_Multiboard_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Hero_Level_Check_Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 7
call MultiboardSetItemValueBJ( udg_theMultiboard, 2, i+2, I2S(GetHeroLevel(udg_theHeroes[i])) )
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 7
call MultiboardSetItemValueBJ( udg_theMultiboard, 3, i+2, I2S(udg_numTowers[i/2]) )
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Hero_Level_Check takes nothing returns nothing
set gg_trg_Hero_Level_Check = CreateTrigger( )
call DisableTrigger( gg_trg_Hero_Level_Check )
call TriggerRegisterTimerEvent( gg_trg_Hero_Level_Check, 5, true )
call TriggerAddAction( gg_trg_Hero_Level_Check, function Trig_Hero_Level_Check_Actions )
endfunction
function Trig_MB_Hero_Bought_Copy_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetSoldUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_MB_Hero_Bought_Copy_Actions takes nothing returns nothing
call MultiboardSetItemValueBJ( udg_theMultiboard, 1, ( GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit())) + 1 ), ( udg_playerColorCodes[( GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit())) - 1 )] + ( GetPlayerName(GetOwningPlayer(GetSoldUnit())) + "|r" ) ) )
call MultiboardSetItemIconBJ( udg_theMultiboard, 1, ( GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit())) + 1 ), udg_heroIconNames[GetUnitPointValue(GetSoldUnit())] )
endfunction
//===========================================================================
function InitTrig_MB_Hero_Bought_Copy takes nothing returns nothing
set gg_trg_MB_Hero_Bought_Copy = CreateTrigger( )
call DisableTrigger( gg_trg_MB_Hero_Bought_Copy )
call TriggerRegisterAnyUnitEventBJ( gg_trg_MB_Hero_Bought_Copy, EVENT_PLAYER_UNIT_SELL )
call TriggerAddCondition( gg_trg_MB_Hero_Bought_Copy, Condition( function Trig_MB_Hero_Bought_Copy_Conditions ) )
call TriggerAddAction( gg_trg_MB_Hero_Bought_Copy, function Trig_MB_Hero_Bought_Copy_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_From_SB_to_Free_PvP_Actions takes nothing returns nothing
local location loc = GetRandomLocInRect(gg_rct_FreePVPArena)
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, 0.10 )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_From_SB_to_Free_PvP takes nothing returns nothing
set gg_trg_From_SB_to_Free_PvP = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_From_SB_to_Free_PvP, gg_rct_1FreePvP )
call TriggerRegisterEnterRectSimple( gg_trg_From_SB_to_Free_PvP, gg_rct_2FreePvP )
call TriggerRegisterEnterRectSimple( gg_trg_From_SB_to_Free_PvP, gg_rct_3FreePvP )
call TriggerRegisterEnterRectSimple( gg_trg_From_SB_to_Free_PvP, gg_rct_4FreePvP )
call TriggerAddAction( gg_trg_From_SB_to_Free_PvP, function Trig_From_SB_to_Free_PvP_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Pacman1_L_to_R_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_TPEndBR)
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, 0.10 )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Pacman1_L_to_R takes nothing returns nothing
set gg_trg_Pacman1_L_to_R = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Pacman1_L_to_R, gg_rct_TPBottomLeft )
call TriggerAddAction( gg_trg_Pacman1_L_to_R, function Trig_Pacman1_L_to_R_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Pacman1_R_to_L_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_TPEndBL)
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, 0.10 )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Pacman1_R_to_L takes nothing returns nothing
set gg_trg_Pacman1_R_to_L = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Pacman1_R_to_L, gg_rct_TPBottomRight )
call TriggerAddAction( gg_trg_Pacman1_R_to_L, function Trig_Pacman1_R_to_L_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Pacman2_L_to_R_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_TPEndTR)
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, 0.10 )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Pacman2_L_to_R takes nothing returns nothing
set gg_trg_Pacman2_L_to_R = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Pacman2_L_to_R, gg_rct_TPTopLeft )
call TriggerAddAction( gg_trg_Pacman2_L_to_R, function Trig_Pacman2_L_to_R_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Pacman2_R_to_L_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_TPEndTL)
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, 0.10 )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Pacman2_R_to_L takes nothing returns nothing
set gg_trg_Pacman2_R_to_L = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Pacman2_R_to_L, gg_rct_TPTopRight )
call TriggerAddAction( gg_trg_Pacman2_R_to_L, function Trig_Pacman2_R_to_L_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Out_of_Spider_1_Conditions takes nothing returns boolean
return ( GetPlayerId(GetOwningPlayer(GetTriggerUnit())) < 8 )
endfunction
function Trig_Out_of_Spider_1_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_Miniboss1 )
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, 1.0 )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Out_of_Spider_1 takes nothing returns nothing
set gg_trg_Out_of_Spider_1 = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Out_of_Spider_1, gg_rct_Mini1TPOut )
call TriggerAddCondition( gg_trg_Out_of_Spider_1, Condition( function Trig_Out_of_Spider_1_Conditions ) )
call TriggerAddAction( gg_trg_Out_of_Spider_1, function Trig_Out_of_Spider_1_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Out_of_Spider_2_Conditions takes nothing returns boolean
return ( GetPlayerId(GetOwningPlayer(GetTriggerUnit())) < 8 )
endfunction
function Trig_Out_of_Spider_2_Actions takes nothing returns nothing
local location loc = GetRectCenter( gg_rct_Miniboss2 )
call SetUnitPositionLoc( GetTriggerUnit(), loc )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), loc, 1.0 )
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Out_of_Spider_2 takes nothing returns nothing
set gg_trg_Out_of_Spider_2 = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Out_of_Spider_2, gg_rct_Mini2TPOut )
call TriggerAddCondition( gg_trg_Out_of_Spider_2, Condition( function Trig_Out_of_Spider_2_Conditions ) )
call TriggerAddAction( gg_trg_Out_of_Spider_2, function Trig_Out_of_Spider_2_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_GiveWater_Actions takes nothing returns nothing
endfunction
//===========================================================================
function InitTrig_GiveWater takes nothing returns nothing
set gg_trg_GiveWater = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_GiveWater, gg_rct_PvEStart1 )
call TriggerRegisterEnterRectSimple( gg_trg_GiveWater, gg_rct_PvEStart2 )
call TriggerRegisterEnterRectSimple( gg_trg_GiveWater, gg_rct_PvEStart3 )
call TriggerRegisterEnterRectSimple( gg_trg_GiveWater, gg_rct_PvEStart4 )
call TriggerAddAction( gg_trg_GiveWater, function Trig_GiveWater_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Lvl10Kills_Conditions takes nothing returns boolean
if ( not ( GetDyingUnit() == udg_theHeroes[GetPlayerId(GetTriggerPlayer())] ) ) then
return false
endif
if ( not ( GetHeroLevel(udg_theHeroes[GetPlayerId(GetOwningPlayer(GetKillingUnit()))]) == 10 ) ) then
return false
endif
return true
endfunction
function Trig_Lvl10Kills_Actions takes nothing returns nothing
local texttag t = CreateTextTag()
local integer g = ( 12 + ( 12 * GetHeroLevel(GetDyingUnit()) ) )
call AdjustPlayerStateBJ( g, GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD )
call SetTextTagText(t, I2S(g), 0.025)
call SetTextTagPos(t, GetUnitX(GetDyingUnit()), GetUnitY(GetDyingUnit()), 0)
call SetTextTagColor(t, 255, 255, 0, 255)
call SetTextTagPermanent(t, false)
call SetTextTagVelocity(t, 0, 0.0200)
call SetTextTagFadepoint(t, 1.0)
call SetTextTagLifespan(t, 2.0)
set t = null
endfunction
//===========================================================================
function InitTrig_Lvl10Kills takes nothing returns nothing
set gg_trg_Lvl10Kills = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(0), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(1), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(2), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(3), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(4), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(5), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(6), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerRegisterPlayerUnitEvent( gg_trg_Lvl10Kills, Player(7), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerAddCondition( gg_trg_Lvl10Kills, Condition( function Trig_Lvl10Kills_Conditions ) )
call TriggerAddAction( gg_trg_Lvl10Kills, function Trig_Lvl10Kills_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_PlayerDrops_Actions takes nothing returns nothing
// announce it to the world
// grant control?
// change multiboard
local player p = GetTriggerPlayer()
call GlobalMessage( udg_playerColorCodes[(GetPlayerId(p))] + GetPlayerName(p) + "|r" + " has left the game.")
call ShareEverythingWithTeam( GetTriggerPlayer() )
call MultiboardSetItemValueBJ( udg_theMultiboard, 1, ( GetPlayerId(p) + 2 ), ( "|caa888888" + ( GetPlayerName(p) + "|r" ) ) )
set p = null
endfunction
//===========================================================================
function InitTrig_PlayerDrops takes nothing returns nothing
set gg_trg_PlayerDrops = CreateTrigger( )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(0), EVENT_PLAYER_LEAVE )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(1), EVENT_PLAYER_LEAVE )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(2), EVENT_PLAYER_LEAVE )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(3), EVENT_PLAYER_LEAVE )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(4), EVENT_PLAYER_LEAVE )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(5), EVENT_PLAYER_LEAVE )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(6), EVENT_PLAYER_LEAVE )
call TriggerRegisterPlayerEvent( gg_trg_PlayerDrops, Player(7), EVENT_PLAYER_LEAVE )
call TriggerAddAction( gg_trg_PlayerDrops, function Trig_PlayerDrops_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ToggleDebug_Actions takes nothing returns nothing
if( udg_debugMode ) then
set udg_debugMode = false
if( GetLocalPlayer() == Player(0) ) then
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "*** Debug Mode Off***")
endif
else
set udg_debugMode = true
if( GetLocalPlayer() == Player(0) ) then
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "*** Debug Mode On -- Messages will Print***")
endif
endif
endfunction
//===========================================================================
function InitTrig_ToggleDebug takes nothing returns nothing
set gg_trg_ToggleDebug = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_ToggleDebug, Player(0), "-debug", true )
call TriggerAddAction( gg_trg_ToggleDebug, function Trig_ToggleDebug_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ProTips_GetRandTip takes nothing returns string
local integer i = GetRandomInt(0, udg_proTipsCount-1 )
return udg_proTips[i]
endfunction
function Trig_ProTips_GiveTips takes nothing returns nothing
local integer i = 0
local string s = Trig_ProTips_GetRandTip()
loop
exitwhen i > 7
if( not udg_proTipsOff[i] ) then
// print a pro tip for the player
if( GetLocalPlayer() == Player(i) ) then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, s)
endif
endif
set i = i + 1
endloop
set s = null
endfunction
function Trig_ProTips_Actions takes nothing returns nothing
local timer t = CreateTimer()
call TimerStart( t, 90.0, true, function Trig_ProTips_GiveTips )
set t = null
endfunction
//===========================================================================
function InitTrig_ProTips takes nothing returns nothing
set gg_trg_ProTips = CreateTrigger( )
call TriggerAddAction( gg_trg_ProTips, function Trig_ProTips_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ProTipsToggle_Actions takes nothing returns nothing
local integer pID = GetPlayerId(GetTriggerPlayer())
if( udg_proTipsOff[pID] ) then
set udg_proTipsOff[pID] = false
if( GetTriggerPlayer() == GetLocalPlayer() ) then
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "Pro Tips are turned on. Type -tips to toggle off" )
endif
else
set udg_proTipsOff[pID] = true
if( GetTriggerPlayer() == GetLocalPlayer() ) then
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "Pro Tips are turned off. Type -tips to toggle on" )
endif
endif
endfunction
//===========================================================================
function InitTrig_ProTipsToggle takes nothing returns nothing
set gg_trg_ProTipsToggle = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(0), "-tips", true )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(1), "-tips", true )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(2), "-tips", true )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(3), "-tips", true )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(4), "-tips", true )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(5), "-tips", true )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(6), "-tips", true )
call TriggerRegisterPlayerChatEvent( gg_trg_ProTipsToggle, Player(7), "-tips", true )
call TriggerAddAction( gg_trg_ProTipsToggle, function Trig_ProTipsToggle_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen0_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 0
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator0 takes nothing returns nothing
set gg_trg_Generator0 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator0, gg_rct_Generator0 )
call TriggerAddCondition( gg_trg_Generator0, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator0, function Trig_Gen0_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen1_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 1
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator1 takes nothing returns nothing
set gg_trg_Generator1 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator1, gg_rct_Generator1 )
call TriggerAddCondition( gg_trg_Generator1, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator1, function Trig_Gen1_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen2_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 2
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator2 takes nothing returns nothing
set gg_trg_Generator2 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator2, gg_rct_Generator2 )
call TriggerAddCondition( gg_trg_Generator2, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator2, function Trig_Gen2_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen3_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 3
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator3 takes nothing returns nothing
set gg_trg_Generator3 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator3, gg_rct_Generator3 )
call TriggerAddCondition( gg_trg_Generator3, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator3, function Trig_Gen3_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen4_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 4
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator4 takes nothing returns nothing
set gg_trg_Generator4 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator4, gg_rct_Generator4 )
call TriggerAddCondition( gg_trg_Generator4, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator4, function Trig_Gen4_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen5_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 5
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator5 takes nothing returns nothing
set gg_trg_Generator5 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator5, gg_rct_Generator5 )
call TriggerAddCondition( gg_trg_Generator5, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator5, function Trig_Gen5_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen6_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 6
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator6 takes nothing returns nothing
set gg_trg_Generator6 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator6, gg_rct_Generator6 )
call TriggerAddCondition( gg_trg_Generator6, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator6, function Trig_Gen6_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen7_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 7
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator7 takes nothing returns nothing
set gg_trg_Generator7 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator7, gg_rct_Generator7 )
call TriggerAddCondition( gg_trg_Generator7, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator7, function Trig_Gen7_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen8_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 8
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator8 takes nothing returns nothing
set gg_trg_Generator8 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator8, gg_rct_Generator8 )
call TriggerAddCondition( gg_trg_Generator8, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator8, function Trig_Gen8_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen9_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 9
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator9 takes nothing returns nothing
set gg_trg_Generator9 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator9, gg_rct_Generator9 )
call TriggerAddCondition( gg_trg_Generator9, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator9, function Trig_Gen9_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen10_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 10
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator10 takes nothing returns nothing
set gg_trg_Generator10 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator10, gg_rct_Generator10 )
call TriggerAddCondition( gg_trg_Generator10, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator10, function Trig_Gen10_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Gen11_Actions takes nothing returns nothing
// CHANGE THIS PER TRIGGER
local integer num = 11
call DisableTrigger( GetTriggeringTrigger() )
call Trig_Gen_TheActions(num)
endfunction
//===========================================================================
function InitTrig_Generator11 takes nothing returns nothing
set gg_trg_Generator11 = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_Generator11, gg_rct_Generator11 )
call TriggerAddCondition( gg_trg_Generator11, Condition(function Trig_Gen_Cond) )
call TriggerAddAction( gg_trg_Generator11, function Trig_Gen11_Actions )
endfunction
function Trig_Use_of_Tome_Conditions takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'I002'
endfunction
function Trig_Use_of_Tome_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer unitCode = GetUnitTypeId(caster)
local integer ultiCode
if ( unitCode == 'H009' or unitCode == 'H001' ) then
set ultiCode = 'A04N' // avatar
endif
if ( unitCode == 'H000' or unitCode == 'H00A' ) then
set ultiCode = 'A04G' // legion of angels
endif
if ( unitCode == 'H007' or unitCode == 'N00D' ) then
set ultiCode = 'A04Q' // grapple beam
endif
if ( unitCode == 'O005' or unitCode == 'O008' ) then
set ultiCode = 'A047' // earth slam
endif
if ( unitCode == 'O004' or unitCode == 'H008' ) then
set ultiCode = 'A04A' // arcane explosion
endif
if ( unitCode == 'O006' or unitCode == 'O000' ) then
set ultiCode = 'A04F' // Mana Hunger
endif
if ( unitCode == 'U001' or unitCode == 'O002' ) then
set ultiCode = 'A04J' // Doom Guard
endif
if ( unitCode == 'O007' or unitCode == 'O001' ) then
set ultiCode = 'A04K' // Shadowstep
endif
if ( unitCode == 'E001' or unitCode == 'E000' ) then
set ultiCode = 'A04P' // Leaf Tree
endif
call UnitAddAbilityBJ( ultiCode, caster )
set caster = null
endfunction
//===========================================================================
function InitTrig_Use_of_Tome takes nothing returns nothing
set gg_trg_Use_of_Tome = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Use_of_Tome, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_Use_of_Tome, Condition( function Trig_Use_of_Tome_Conditions ) )
call TriggerAddAction( gg_trg_Use_of_Tome, function Trig_Use_of_Tome_Actions )
endfunction
//TESH.scrollpos=39
//TESH.alwaysfold=0
function Trig_Legion_of_Angels_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A04G' )
endfunction
function LoAClear takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction
function Trig_Legion_of_Angels_Actions takes nothing returns nothing
local integer loopOne = 1
local integer numOfAngels
local integer rand = GetRandomInt(1,2)
local integer interimTime
local group theAngels = CreateGroup()
local unit caster = GetTriggerUnit()
local unit u = FirstOfGroup(theAngels)
// == Balance Numbers
set interimTime = 6
set numOfAngels = 4
loop
exitwhen loopOne > numOfAngels
// call DisplayTextToForce( GetPlayersAll(), ( "Begin - loop counter is " + I2S(loopOne) ) )
set rand = GetRandomInt(1, 2)
if ( rand == 1 ) then
call CreateNUnitsAtLocFacingLocBJ( 1, 'h002', GetOwningPlayer(caster), GetRandomLocInRect(RectFromCenterSizeBJ(GetUnitLoc(caster), 800.00, 800.00)), GetUnitLoc(caster) )
else
call CreateNUnitsAtLocFacingLocBJ( 1, 'h00B', GetOwningPlayer(caster), GetRandomLocInRect(RectFromCenterSizeBJ(GetUnitLoc(caster), 800.00, 800.00)), GetUnitLoc(caster) )
endif
call AddSpecialEffectTargetUnitBJ( "origin", GetLastCreatedUnit(), "Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call GroupAddUnitSimple( GetLastCreatedUnit(), theAngels )
call TriggerSleepAction( .25 )
set loopOne = loopOne + 1
// call DisplayTextToForce( GetPlayersAll(), ( "End - loop counter is " + I2S(loopOne) ) )
endloop
call TriggerSleepAction( interimTime )
// may be unneeded do math
// call DisplayTextToForce( GetPlayersAll(), ( "Calling ForEach Loop... " ) )
// call ForGroupBJ( theAngels, function LoAClear )
loop
set u = FirstOfGroup( theAngels )
exitwhen u == null
// call DisplayTextToForce( GetPlayersAll(), "Tra la la inside a loopzorz" )
call AddSpecialEffectLocBJ( GetUnitLoc(u), "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call RemoveUnit( u )
call GroupRemoveUnit( theAngels, u )
endloop
call DestroyGroup( theAngels )
set caster = null
set u = null
endfunction
//===========================================================================
function InitTrig_Legion_of_Angels takes nothing returns nothing
set gg_trg_Legion_of_Angels = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Legion_of_Angels, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Legion_of_Angels, Condition( function Trig_Legion_of_Angels_Conditions ) )
call TriggerAddAction( gg_trg_Legion_of_Angels, function Trig_Legion_of_Angels_Actions )
endfunction
function Trig_Doom_Guard_Summon_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A04J' )
endfunction
function Trig_DGSummonAct takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit demon
local integer demonsLife
local integer randTime
//=== Balance Numbers
set demonsLife = 15
set randTime = GetRandomInt( 4, 10 )
// ===========================================
// call DisplayTextToForce( GetPlayersAll(), ( "Random time is: " + I2S(randTime) ) )
// ===========================================
call CreateNUnitsAtLoc( 1, 'n00O', GetOwningPlayer(caster), GetUnitLoc(caster), GetUnitFacing(caster) )
set demon = GetLastCreatedUnit()
call UnitApplyTimedLifeBJ( I2R(demonsLife) , 'BTLF', demon )
call TriggerSleepAction( I2R(randTime) )
// ======
// call DisplayTextToForce( GetPlayersAll(), ("Changing hands...") )
// ======
call SetUnitOwner( demon, Player(PLAYER_NEUTRAL_AGGRESSIVE), false )
call IssueTargetOrderBJ( demon, "attack", caster )
call AddSpecialEffectTargetUnitBJ( "origin", GetLastCreatedUnit(), "Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call TriggerSleepAction( 2.00 )
call IssueImmediateOrderBJ( demon, "stomp" )
call TriggerSleepAction( 1.00 )
call IssueImmediateOrderBJ( demon, "fanofknives" )
call IssueTargetOrderBJ( demon, "attack", caster )
set caster = null
set demon = null
endfunction
//===========================================================================
function InitTrig_Doom_Guard_Summon takes nothing returns nothing
set gg_trg_Doom_Guard_Summon = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Doom_Guard_Summon, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Doom_Guard_Summon, Condition( function Trig_Doom_Guard_Summon_Conditions ) )
call TriggerAddAction( gg_trg_Doom_Guard_Summon, function Trig_DGSummonAct )
endfunction
//TESH.scrollpos=26
//TESH.alwaysfold=0
function Trig_Shadowstep_Conditions takes nothing returns boolean
return false //( GetSpellAbilityId() == 'A04K' )
endfunction
function Trig_SS_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit caster = GetHandleUnit(I2Timer(t), "caster")
local integer fxDur = 20
local integer index = GetHandleInt(I2Timer(t), "index")
local integer bitValue
local integer goalValue = 100
if( index == fxDur ) then
call FlushHandleLocals(I2Timer(t))
call PauseTimer(I2Timer(t))
call DestroyTimer(I2Timer(t))
else
set bitValue = ( index * ( goalValue / fxDur ) )
call SetUnitVertexColor( caster, bitValue, bitValue, bitValue, ( index * (255/fxDur) ) )
set index = index + 1
call SetHandleInt(I2Timer(t), "index", index)
endif
set caster = null
endfunction
function Trig_Shadowstep_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real damage
local real distance = DistanceBetweenPoints( GetUnitLoc(caster) , GetUnitLoc(target) )
local real dispLoc = distance / 8
local integer loopIndex = 1
local integer t = H2I(CreateTimer())
// === Balance Number
set damage = 300
loop
exitwhen loopIndex > 8
call DestroyEffect(AddSpecialEffectLocBJ( PolarProjectionBJ(GetUnitLoc(caster), (dispLoc*loopIndex), AngleBetweenPoints(GetUnitLoc(caster), GetUnitLoc(target))), "Abilities\\Spells\\Other\\BlackArrow\\BlackArrowMissile.mdl" ))
set loopIndex = loopIndex + 1
endloop
call DestroyEffect( AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl", target, "overhead"))
call SetUnitPosition( caster, GetUnitX(target), GetUnitY(target) )
call GlobalCauseSpellDamage( caster, target, damage )
call IssueTargetOrder( caster, "attack", target )
call GlobalFloatingCombatText( target, R2I(damage), 255, 0, 0, true )
call SetUnitVertexColor( caster, 0, 0, 0, 0 )
// fxDur will be 5 seconds, with it happening 4 times a second
call SetHandleHandle(I2Timer(t), "caster", caster)
call SetHandleInt(I2Timer(t), "index", 1)
call TimerStart(I2Timer(t), .25, true, function Trig_SS_Callback )
set caster = null
set target = null
endfunction
//===========================================================================
function InitTrig_Shadowstep takes nothing returns nothing
set gg_trg_Shadowstep = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadowstep, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shadowstep, Condition( function Trig_Shadowstep_Conditions ) )
call TriggerAddAction( gg_trg_Shadowstep, function Trig_Shadowstep_Actions )
endfunction
//TESH.scrollpos=20
//TESH.alwaysfold=0
function Trig_Eviscerate_Total_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A00S' )
endfunction
function Trig_Eviscerate_Total_Actions takes nothing returns nothing
local unit tUnit
local real tUnitMaxHP
local real currentHP
local real dmgDone
local unit cUnit
local integer level
local real multiplier
set tUnit = GetSpellTargetUnit()
set tUnitMaxHP = GetUnitStateSwap( UNIT_STATE_MAX_LIFE, tUnit )
set currentHP = GetUnitStateSwap( UNIT_STATE_LIFE, tUnit )
set cUnit = GetTriggerUnit()
set level = GetUnitAbilityLevelSwapped( 'A00S', GetTriggerUnit() )
// Now we must calculate the damage to be done; based on level
set dmgDone = 0
if ( level == 3 ) then
set multiplier = .20
else
set multiplier = (level*.05)
endif
set dmgDone = ( ( tUnitMaxHP - currentHP ) * multiplier )
// if level 1, do (MAX-Current)* 0.05
// can nerf by calling global spell; gets rid of Chaos
call GlobalCauseSpellDamage( cUnit, tUnit, dmgDone )
call GlobalFloatingCombatText( tUnit, R2I(dmgDone), 255, 255, 0, true )
set tUnit = null
set cUnit = null
endfunction
//===========================================================================
function InitTrig_Eviscerate_Total takes nothing returns nothing
set gg_trg_Eviscerate_Total = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Eviscerate_Total, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Eviscerate_Total, Condition( function Trig_Eviscerate_Total_Conditions ) )
call TriggerAddAction( gg_trg_Eviscerate_Total, function Trig_Eviscerate_Total_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Sacrificial_Pit_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A02Y' )
endfunction
function Trig_Sacrificial_Pit_Actions takes nothing returns nothing
local unit spUnit = GetSpellTargetUnit()
local unit caster = GetTriggerUnit()
local unit dummy
local integer loopstart = 1
local integer loopend = 10
//call DestroyEffect(AddSpecialEffectLoc( "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", GetUnitLoc(spUnit) ) )
loop
exitwhen loopstart > loopend
//call DestroyEffect(AddSpecialEffectLoc( "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", PolarProjectionBJ(GetUnitLoc(spUnit), 350.00, ( 36.00 * loopstart )) ))
set loopstart = (loopstart + 1)
endloop
set dummy = CreateUnit( GetOwningPlayer(caster), 'h003', GetUnitX(spUnit), GetUnitY(spUnit), 0 )
call UnitAddAbilityBJ( 'A03P', dummy )
call SetUnitAbilityLevelSwapped( 'A03P', dummy, GetUnitAbilityLevelSwapped('A02Y', caster) )
call IssuePointOrderLocBJ( dummy, "flamestrike", GetUnitLoc( spUnit ) )
call UnitApplyTimedLifeBJ( 3.00, 'BTLF', dummy )
call TriggerSleepAction( 1.0 )
call KillUnit( spUnit )
set spUnit = null
endfunction
//===========================================================================
function InitTrig_Sacrificial_Pit_Local takes nothing returns nothing
set gg_trg_Sacrificial_Pit_Local = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Sacrificial_Pit_Local, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Sacrificial_Pit_Local, Condition( function Trig_Sacrificial_Pit_Conditions ) )
call TriggerAddAction( gg_trg_Sacrificial_Pit_Local, function Trig_Sacrificial_Pit_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Execute_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A029' )
endfunction
function Trig_Execute_Actions takes nothing returns nothing
local integer level
local real multiplier
local real damage
local real baseDmg = 75
set level = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())
set multiplier = ( level * 1.5 )
if ( level == 3 ) then
set multiplier = 6
endif
set baseDmg = (baseDmg + 25*level)
set damage = ( GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) * multiplier )
call GlobalCauseSpellDamage( GetTriggerUnit(), GetSpellTargetUnit(), damage)
call GlobalFloatingCombatText( GetSpellTargetUnit(), R2I(damage+baseDmg), 255, 255, 0, true )
call SetUnitManaBJ( GetTriggerUnit(), 0 )
endfunction
//===========================================================================
function InitTrig_Execute takes nothing returns nothing
set gg_trg_Execute = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Execute, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Execute, Condition( function Trig_Execute_Conditions ) )
call TriggerAddAction( gg_trg_Execute, function Trig_Execute_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Mind_Flay_Loop_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A00Z' )
endfunction
function Trig_MF_Callback takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local unit caster = GetHandleUnit( I2Timer(t), "caster" )
local unit target = GetHandleUnit( I2Timer(t), "target" )
local integer elapse = GetHandleInt( I2Timer(t), "elapse")
local unit dummyOne
local unit dummyTwo
if( ( GetUnitAbilityLevel(caster,'Bdcl') < 1 ) or (elapse >= 8) ) then
call FlushHandleLocals(I2Timer(t))
call PauseTimer(I2Timer(t))
call DestroyTimer(I2Timer(t))
else
// Damage
call SetHandleInt( I2Timer(t), "elapse", (elapse+1) )
set dummyOne = CreateUnit( GetOwningPlayer(caster), 'h003', GetUnitX(caster), GetUnitY(caster), 0 )
call UnitAddAbility( dummyOne, 'A00J')
call SetUnitAbilityLevel( dummyOne, 'A00J', GetUnitAbilityLevel(caster, 'A00Z') )
call IssueTargetOrder( dummyOne, "drain", target )
call UnitApplyTimedLife( dummyOne, 'BTLF', 2.0 )
// Slow
set dummyTwo = CreateUnit( GetOwningPlayer(caster), 'h003', GetUnitX(caster), GetUnitY(caster), 0 )
call UnitAddAbility( dummyTwo, 'A00K' )
call UnitApplyTimedLife( dummyTwo, 'BTLF', 1.0 )
call IssueTargetOrder( dummyTwo, "slow", target )
endif
set dummyOne = null
set dummyTwo = null
set caster = null
set target = null
endfunction
function Trig_Mind_Flay_Loop_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer t = H2I(CreateTimer())
// ==== Mind Flay Duration ===
local integer duration = 1
// =====
call SetHandleHandle(I2Timer(t), "caster", caster)
call SetHandleHandle(I2Timer(t), "target", target)
call SetHandleBoolean(I2Timer(t), "stillCasting", true)
call SetHandleInt(I2Timer(t), "elapse", 0 )
call TimerStart(I2Timer(t), duration, true, function Trig_MF_Callback )
set caster = null
set target = null
endfunction
//===========================================================================
function InitTrig_Mind_Flay_Loop takes nothing returns nothing
set gg_trg_Mind_Flay_Loop = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mind_Flay_Loop, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Mind_Flay_Loop, Condition( function Trig_Mind_Flay_Loop_Conditions ) )
call TriggerAddAction( gg_trg_Mind_Flay_Loop, function Trig_Mind_Flay_Loop_Actions )
endfunction