//********************************************************************************************************
//* *
//* Caster System 12.8 Cache Module (http://vexorian.wc3campaigns.com/ ) *
//* _______________________________ *
//* CSCache module, a part of Vexorian's Caster System which you can find at the above URL. *
//* *
//********************************************************************************************************
//##Begin of CS Gamecache engine##
//=================================================================================================
// GameCache - Return bug module : Without gamecache or return bug, JASS would be a
// retarded-limited scripting language.
//
//=================================================================================================
// a.k.a H2I, changed name to CS_H2I to prevent conflicts with other systems (I intended this
// system to be easy to copy
//
function CS_H2I takes handle h returns integer
return h
return 0
endfunction
//=================================================================================================
// Main Gamecache handler
//
function CSCache takes nothing returns gamecache
if udg_cscache==null then
call FlushGameCache(InitGameCache("CasterSystem.vx"))
set udg_cscache=InitGameCache("CasterSystem.vx")
call StoreInteger(udg_cscache,"misc","TableMaxReleasedIndex",100)
endif
return udg_cscache
endfunction
//==================================================================================================
// Attachable vars : Attacheable variables are what most other people call Handle Variables, they
// allow to relate data with any handle, using a label, and its value, the stuff auto flushes if
// the value is 0, false, "", or null .
//
// Differences between Attacheable variables and "Local Handle Variables" :
// - The names of the functions
// - The name of the function group does not cause confusion, it is difficult to say:
// "you should set local handle variables to null at the end of a function" since
// it sounds as if you were talking about the "Local Handle Variables"
// - Also Have Attacheable Sets.
// - And can work together with Tables.
//
// Notes: don't "attach" variables on texttags nor those handle types used mostly for parameters
// (for example damagetype) , Although there is no reason to do so anyways
//
// Gamecache stuff are NOT Case Sensitive, don't ever use "" for label (Crashes game!)
//
//============================================================================================================
// For integers
//
function AttachInt takes handle h, string label, integer x returns nothing
local string k=I2S(CS_H2I(h))
if x==0 then
call FlushStoredInteger(CSCache(),k,label)
else
call StoreInteger(CSCache(),k,label,x)
endif
endfunction
function GetAttachedInt_FromSet takes handle h, gamecache g returns integer
return GetStoredInteger(g,I2S(CS_H2I(h))+";"+GetStoredString(g,"argpass","set"),GetStoredString(g,"argpass","seti"))
endfunction
function GetAttachedInt takes handle h, string label returns integer
if (label=="") then
return GetAttachedInt_FromSet(h,CSCache())
endif
return GetStoredInteger(CSCache(), I2S(CS_H2I(h)), label)
endfunction
//=============================================================================================================
function AttachReal takes handle h, string label, real x returns nothing
local string k=I2S(CS_H2I(h))
if x==0 then
call FlushStoredReal(CSCache(),k,label)
else
call StoreReal(CSCache(),k,label,x)
endif
endfunction
function GetAttachedReal takes handle h, string label returns real
return GetStoredReal(CSCache(),I2S(CS_H2I(h)),label)
endfunction
//=============================================================================================================
function AttachBoolean takes handle h, string label, boolean x returns nothing
local string k=I2S(CS_H2I(h))
if not x then
call FlushStoredBoolean(CSCache(),k,label)
else
call StoreBoolean(CSCache(),k,label,x)
endif
endfunction
function GetAttachedBoolean takes handle h, string label returns boolean
return GetStoredBoolean(CSCache(),I2S(CS_H2I(h)),label)
endfunction
//=============================================================================================================
function AttachString takes handle h, string label, string x returns nothing
local string k=I2S(CS_H2I(h))
if x=="" then
call FlushStoredString(CSCache(),k,label)
else
call StoreString(CSCache(),k,label,x)
endif
endfunction
function GetAttachedString takes handle h, string label returns string
return GetStoredString(CSCache(),I2S(CS_H2I(h)),label)
endfunction
//=============================================================================================================
function AttachObject takes handle h, string label, handle x returns nothing
local string k=I2S(CS_H2I(h))
if (x==null) then
call FlushStoredInteger(CSCache(),k,label)
else
call StoreInteger(CSCache(),k,label,CS_H2I(x))
endif
endfunction
function GetAttachedObject takes handle h, string label returns handle
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedWidget takes handle h, string label returns widget
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedRect takes handle h, string label returns rect
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedRegion takes handle h, string label returns region
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedTimerDialog takes handle h, string label returns timerdialog
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedUnit takes handle h, string label returns unit
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedItem takes handle h, string label returns item
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedEffect takes handle h, string label returns effect
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedDestructable takes handle h, string label returns destructable
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedTrigger takes handle h, string label returns trigger
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedTimer takes handle h, string label returns timer
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedGroup takes handle h, string label returns group
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedTriggerAction takes handle h, string label returns triggeraction
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedLightning takes handle h, string label returns lightning
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedImage takes handle h, string label returns image
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedUbersplat takes handle h, string label returns ubersplat
return GetAttachedInt(h,label)
return null
endfunction
function GetAttachedSound takes handle h, string label returns sound
return GetAttachedInt(h,label)
return null
endfunction
//============================================================================================================
// Attached Sets: Attachable Sets are handy in some situations and are a part of attachable variables,
// you can add integers or objects to a set, order doesn't matter and adding the same object twice is
// meaningless. CleanAttachedVars is always ready to clean every set owned by the handle.
//
//============================================================================================================
function AttachedSetAddInt takes handle h, string setn, integer int returns nothing
local gamecache g=CSCache()
local string k=I2S(CS_H2I(h))
local integer n
local integer x=GetStoredInteger(g,k,"#setnumberof;"+setn)
local integer y
if x==0 then
set y=GetStoredInteger(g,k,"#totalsets")+1
call StoreInteger(g,k,"#totalsets",y)
call StoreInteger(g,k,"#setnumberof;"+setn,y)
call StoreString(g,k,"#setName;"+I2S(y),setn)
endif
set k=k+";"+setn
if not HaveStoredInteger(g,k,"Pos"+I2S(int)) then
set n=GetStoredInteger(g,k,"n")+1
call StoreInteger(g,k,"n",n)
call StoreInteger(g,k,I2S(n),int)
call StoreInteger(g,k,"Pos"+I2S(int),n)
endif
set g=null
endfunction
function AttachedSetAddObject takes handle h, string setn, handle val returns nothing
call AttachedSetAddInt(h,setn,CS_H2I(val))
endfunction
//============================================================================================================
function AttachedSetHasInt takes handle h, string setn, integer int returns boolean
return HaveStoredInteger(CSCache(),I2S(CS_H2I(h))+";"+setn,"Pos"+I2S(int))
endfunction
function AttachedSetHasObject takes handle h, string setn, handle val returns boolean
return AttachedSetHasInt(h,setn,CS_H2I(val))
endfunction
//============================================================================================================
function GetAttachedSetSize takes handle h, string setn returns integer
return GetStoredInteger(CSCache(),I2S(CS_H2I(h))+";"+setn,"n")
endfunction
//============================================================================================================
function AttachedSetRemInt takes handle h, string setn, integer int returns nothing
local gamecache g=CSCache()
local string k=I2S(CS_H2I(h))+";"+setn
local integer n
local integer x
local integer y
if HaveStoredInteger(g,k,"Pos"+I2S(int)) then
set x=GetStoredInteger(g,k,"Pos"+I2S(int))
set n=GetStoredInteger(g,k,"n")
if x!=n then
set y=GetStoredInteger(g,k,I2S(n))
call StoreInteger(g,k,I2S(x),y)
call StoreInteger(g,k,"Pos"+I2S(y),x)
endif
call FlushStoredInteger(g,k,"Pos"+I2S(int))
call FlushStoredInteger(g,k,I2S(n))
call StoreInteger(g,k,"n",n-1)
endif
set g=null
endfunction
function AttachedSetRemObject takes handle h, string setn, handle val returns nothing
call AttachedSetRemInt(h,setn,CS_H2I(val))
endfunction
//============================================================================================================
function FromSetElement takes string setn, integer index returns string
local gamecache g=CSCache()
call StoreString(g,"argpass","set",setn)
call StoreString(g,"argpass","seti",I2S(index))
set g=null
return ""
endfunction
//============================================================================================================
function ClearAttachedSet takes handle h, string setn returns nothing
call FlushStoredMission(CSCache(),I2S(CS_H2I(h))+";"+setn)
endfunction
function CleanAttachedVars takes handle h returns nothing
local gamecache g=CSCache()
local string k=I2S(CS_H2I(h))
local integer n=GetStoredInteger(g,k,"#totalsets")
local integer i=1
loop
exitwhen i>n
call FlushStoredMission(g,k+";"+GetStoredString(g,k,"#setName;"+I2S(i)))
set i=i+1
endloop
call FlushStoredMission(g, k )
set g=null
endfunction
function CleanAttachedVars_NoSets takes handle h returns nothing
call FlushStoredMission(CSCache(), I2S(CS_H2I(h)) )
endfunction
//=============================================================================================
// Tables
//
// Tables are lame, the real name would be hash tables, they are just abbreviated usage
// of gamecache natives with the addition that you can also Copy the values of a table to
// another one, but don't expect it to be automatic, it must use a FieldData object to know
// which fields and of wich types to copy, Copying a table to another, with a lot of Fields,
// should surelly be lag friendly.
//
// The other thing about tables is that I can say that the Attached variables of a handle work
// inside a table and GetAttachmentTable which is just return bug and I2S , works to allow you
// to manipulate a handle's attached variables through a table.
//
// NewTable and DestroyTable were created to allow to create tables in the fly, but you can
// simply use strings for tables, but place the table names should be between "("")" for example
// "(mytable)" to avoid conflicts with other caster system stuff.
//
function NewTableIndex takes nothing returns integer
local gamecache g=CSCache()
local integer n=GetStoredInteger(g,"misc","FreeTableTotal")
local integer i
if (n>0) then
set i=GetStoredInteger(g,"misc","FreeTable1")
if (n>1) then
call StoreInteger(g,"misc","FreeTable1", GetStoredInteger(g,"misc","FreeTable"+I2S(n)) )
call FlushStoredInteger(g,"misc","FreeTable"+I2S(n))
endif
call StoreInteger(g,"misc","FreeTableTotal", n-1)
else
set i=GetStoredInteger(g,"misc","TableMaxReleasedIndex")+1
call StoreInteger(g,"misc","TableMaxReleasedIndex",i)
endif
call StoreBoolean(g,"misc","Created"+I2S(i),true)
set g=null
return i
endfunction
function NewTable takes nothing returns string
return I2S(NewTableIndex())
endfunction
function GetAttachmentTable takes handle h returns string
return I2S(CS_H2I(h))
endfunction
//============================================================================================================
function DestroyTable takes string table returns nothing
local gamecache g=CSCache()
local integer i=S2I(table)
local integer n
if (i!=0) and (GetStoredBoolean(g,"misc","Created"+table)) then
call FlushStoredBoolean(g,"misc","Created"+table)
set n=GetStoredInteger(g,"misc","FreeTableTotal")+1
call StoreInteger(g,"misc","FreeTableTotal",n)
call StoreInteger(g,"misc","FreeTable"+I2S(n),i)
endif
call FlushStoredMission(g,table)
set g=null
endfunction
//============================================================================================================
function ClearTable takes string table returns nothing
call FlushStoredMission(CSCache(),table)
endfunction
//============================================================================================================
function SetTableInt takes string table, string field, integer val returns nothing
local gamecache g=CSCache()
if (val==0) then
call FlushStoredInteger(g,table,field)
else
call StoreInteger(g,table,field,val)
endif
set g=null
endfunction
function GetTableInt takes string table, string field returns integer
return GetStoredInteger(CSCache(),table,field)
endfunction
//============================================================================================================
function SetTableReal takes string table, string field, real val returns nothing
local gamecache g=CSCache()
if (val==0) then
call FlushStoredReal(g,table,field)
else
call StoreReal(g,table,field,val)
endif
set g=null
endfunction
function GetTableReal takes string table, string field returns real
return GetStoredReal(CSCache(),table,field)
endfunction
//============================================================================================================
function SetTableBoolean takes string table, string field, boolean val returns nothing
local gamecache g=CSCache()
if (not(val)) then
call FlushStoredBoolean(g,table,field)
else
call StoreBoolean(g,table,field,val)
endif
set g=null
endfunction
function GetTableBoolean takes string table, string field returns boolean
return GetStoredBoolean(CSCache(),table,field)
endfunction
//============================================================================================================
function SetTableString takes string table, string field, string val returns nothing
local gamecache g=CSCache()
if (val=="") or (val==null) then
call FlushStoredString(g,table,field)
else
call StoreString(g,table,field,val)
endif
set g=null
endfunction
function GetTableString takes string table, string field returns string
return GetStoredString(CSCache(),table,field)
endfunction
//============================================================================================================
// You may ask why am I using thousands of functions instead of multi-use return bug exploiters? Well,
// these make the thing much easier to read (in my opinion) and it is also better in performance since we
// have less function calls (H2U(GetTableObject("table","unit"))) would be worse than GetTableUnit that is
// quite direct.
//
function SetTableObject takes string table, string field, handle val returns nothing
local gamecache g=CSCache()
if (val==null) then
call FlushStoredInteger(g,table,field)
else
call StoreInteger(g,table,field,CS_H2I(val))
endif
set g=null
endfunction
function GetTableObject takes string table, string field returns handle
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableWidget takes string table, string field returns widget
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableRect takes string table, string field returns rect
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableRegion takes string table, string field returns region
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableTimerDialog takes string table, string field returns timerdialog
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableUnit takes string table, string field returns unit
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableItem takes string table, string field returns item
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableEffect takes string table, string field returns effect
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableDestructable takes string table, string field returns destructable
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableTrigger takes string table, string field returns trigger
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableTimer takes string table, string field returns timer
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableGroup takes string table, string field returns group
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableTriggerAction takes string table, string field returns triggeraction
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableLightning takes string table, string field returns lightning
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableImage takes string table, string field returns image
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableUbersplat takes string table, string field returns ubersplat
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
function GetTableSound takes string table, string field returns sound
return GetStoredInteger(CSCache(),table,field)
return null
endfunction
//============================================================================================================
// Returns true if the fiel contains a value different from 0, false, null, or "" (depending on the type)
// it is worthless to use this with boolean, since it would be the same as reading the boolean value
//
function HaveSetField takes string table, string field, integer fieldType returns boolean
if (fieldType == bj_GAMECACHE_BOOLEAN) then
return HaveStoredBoolean(CSCache(),table,field)
elseif (fieldType == bj_GAMECACHE_INTEGER) then
return HaveStoredInteger(CSCache(),table,field)
elseif (fieldType == bj_GAMECACHE_REAL) then
return HaveStoredReal(CSCache(),table,field)
elseif (fieldType == bj_GAMECACHE_STRING) then
return HaveStoredString(CSCache(),table,field)
endif
return false
endfunction
//============================================================================================================
// Allows to copy a table to another one, but it needs a FieldData object to know which fields of which type
// it is supposed to copy.
//
function CopyTable takes integer FieldData, string sourceTable, string destTable returns nothing
local gamecache g=CSCache()
local integer i=1
local string k=I2S(FieldData)
local string k2
local string k3
local integer n=GetStoredInteger(g,k,"N")
local integer t
loop
exitwhen (i>n)
set k2=I2S(i)
set t=GetStoredInteger(g,k,k2)
set k3=GetStoredString(g,k,k2)
if (t==bj_GAMECACHE_BOOLEAN) then
if (HaveStoredBoolean(g,sourceTable,k3)) then
call StoreBoolean(g,destTable,k3,GetStoredBoolean(g,sourceTable,k3))
else
call FlushStoredBoolean(g,destTable,k3)
endif
elseif (t==bj_GAMECACHE_INTEGER) then
if (HaveStoredInteger(g,sourceTable,k3)) then
call StoreInteger(g,destTable,k3,GetStoredInteger(g,sourceTable,k3))
else
call FlushStoredInteger(g,destTable,k3)
endif
elseif (t==bj_GAMECACHE_REAL) then
if (HaveStoredReal(g,sourceTable,k3)) then
call StoreReal(g,destTable,k3,GetStoredReal(g,sourceTable,k3))
else
call FlushStoredReal(g,destTable,k3)
endif
elseif (t==bj_GAMECACHE_STRING) then
if (HaveStoredString(g,sourceTable,k3)) then
call StoreString(g,destTable,k3,GetStoredString(g,sourceTable,k3))
else
call FlushStoredString(g,destTable,k3)
endif
endif
set i=i+1
endloop
set g=null
endfunction
//=============================================================================================
// FieldData inherits from Table, was just designed to be used by CopyTable.
//
function FieldData_Create takes nothing returns integer
return NewTableIndex()
endfunction
//============================================================================================================
// valueType uses the same integer variables from blizzard.j :
// bj_GAMECACHE_BOOLEAN, bj_GAMECACHE_INTEGER, bj_GAMECACHE_REAL and bj_GAMECACHE_STRING
//
function FieldData_AddField takes integer fielddata, string field, integer valueType returns nothing
local gamecache g=CSCache()
local string k=I2S(fielddata)
local integer n=GetStoredInteger(g,k,"N")+1
local string k2=I2S(n)
call StoreString(g,k,k2,field)
call StoreInteger(g,k,k2,valueType)
call StoreInteger(g,k,"N",n)
set g=null
endfunction
//=============================================================================================
// Destroys Field Data
function FieldData_Destroy takes integer fielddata returns nothing
call DestroyTable(I2S(fielddata))
endfunction
//##End of CS Gamecache engine##
Name | Type | is_array | initial_value |
A | integer | No | |
Caster | unit | No | |
Circle_of_Teams | group | No | |
CoolHero | unit | No | |
cscache | gamecache | No | |
DoubleKill | timer | Yes | |
DoubleU | unit | Yes | |
DuelTimer | timer | No | |
E | integer | No | |
e | integervar | No | |
EastGroup | group | No | |
Effect | effect | Yes | |
First_Blood | boolean | No | |
FullHero | unit | No | |
GameCache | gamecache | No | |
Gr1 | group | No | |
GroupOfPlayers | force | No | |
Hero | unit | Yes | |
Heroes | group | No | |
I | effect | Yes | |
Killing | integer | Yes | |
Kills | integer | Yes | |
Leaving_Player | player | Yes | |
LiveYes | boolean | Yes | |
local_integer | integer | No | |
local_integer2 | integer | No | |
MajorPoints | integer | No | |
MaxKills | integer | No | |
MinorPoints | integer | No | |
mp_teams | force | Yes | |
NordGroup | group | No | |
PG | force | No | |
Picked | group | No | |
Players | player | Yes | |
PlHero | group | No | |
Points | integer | Yes | |
Random | boolean | Yes | |
RegioEast | boolean | Yes | |
RegionNord | boolean | Yes | |
RegionOfTeams | rect | Yes | |
RegioSouth | boolean | Yes | |
RegioWest | boolean | Yes | |
SouthGroup | group | No | |
StringOfTeam | string | Yes | |
Target | unit | No | |
TargetCharmUnit | unitcode | No | |
TeamSelect1 | boolean | No | |
TrippleKill | timer | Yes | |
TrippleKill_Dead | integer | Yes | |
TunderEffect | lightning | Yes | |
Unit | unit | Yes | |
VictoredU | unit | No | |
Victory_Group | group | No | |
WestGroup | group | No | |
Wow_Unit | unit | No | |
Yah_Unit | unit | No | |
Z | integer | No |
function Trig_First_Initialization_Func001002 takes nothing returns nothing
call SetPlayerFlagBJ( PLAYER_STATE_GIVES_BOUNTY, true, GetEnumPlayer() )
endfunction
function Trig_First_Initialization_Func002002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(0), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func003002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(1), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func004002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(2), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func005002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(3), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func006002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(4), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func007002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(5), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func008002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(6), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func009002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(7), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func010002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(8), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func011002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(9), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func012002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(10), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Func013002 takes nothing returns nothing
call SetPlayerAllianceStateBJ( Player(11), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_First_Initialization_Actions takes nothing returns nothing
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func001002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func002002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func003002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func004002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func005002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func006002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func007002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func008002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func009002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func010002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func011002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func012002 )
call ForForce( GetPlayersAll(), function Trig_First_Initialization_Func013002 )
endfunction
//===========================================================================
function InitTrig_First_Initialization takes nothing returns nothing
set gg_trg_First_Initialization = CreateTrigger( )
call TriggerAddAction( gg_trg_First_Initialization, function Trig_First_Initialization_Actions )
endfunction
function MakeInvulnerable takes nothing returns nothing
local unit e = GetEnumUnit()
if IsUnitType(e, UNIT_TYPE_HERO) then
call SetUnitInvulnerable(e, true) // Make it invulnerable if it's a Hero,
else
call GroupRemoveUnit(udg_Heroes, e) // else remove it from the group.
endif
set e = null
endfunction
function AfterDelay takes nothing returns nothing
call DestroyTimer(GetExpiredTimer()) // Destroy the timer.
call CreateLeaderboardBJ(bj_FORCE_ALL_PLAYERS, "Points") // Create the leaderboard.
call LeaderboardDisplayBJ(true, bj_lastCreatedLeaderboard) // Show the leaderboard.
call ExecuteFunc("InitPlayers") // Use ExecuteFunc to allow a forward reference.
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "Добро пожаловать, выберите одного из героев, расположенных по краям карты либо воспользуйтесь коммандой |cff0000ff-random|r для случайного выбора героя.") // Display a welcome message.
call DisplayTimedTextToForce( GetPlayersAll(), 30, "|cffff0000Также доступны некоторые функции|r (их можно посмотреть в заданиях)")
endfunction
function Initialization takes nothing returns nothing
call GroupEnumUnitsOfPlayer(udg_Heroes, Player(PLAYER_NEUTRAL_PASSIVE), null) // add all neutral passive units to the udg_Heroes group.
call ForGroup(udg_Heroes, function MakeInvulnerable) // Make the units in the group invulnerable, or remove them if they are not heroes (for example the Fountain).
call CreateQuestBJ(bj_QUESTTYPE_REQ_DISCOVERED, "Комманды", "Только для первого игрока:
|cff0000ff-repick|r: играть сначала
|cff0000ff-team|r: начать выбор комманд
|cff0000ff-go|r: завершить выбор комманд
для всех:
|cff0000ff-random|r: выбор случайного героя", "ReplaceableTextures\\CommandButtons\\BTNBrilliance.blp") // Create the quests.
call CreateQuestBJ(bj_QUESTTYPE_OPT_DISCOVERED, "Epic Arena v1.5", "By AmsterCard
Соединяйте предметы в более могущетсвенные, повышайте уровень Героя, собирайтесь в комманды, вообщем будет весело))", "ReplaceableTextures\\CommandButtons\\BTNOrcBattleStandard.blp") // Yes, this was made in the GUI but converted.
call FlashQuestDialogButton() // Flash the Quests button.
call FogEnable(false) // Disable the fog of war.
call FogMaskEnable(false) // Disable the black mask.
call TimerStart(CreateTimer(), 0.1, false, function AfterDelay) // Create and show the leaderboard, can't be done at initialization so I use a timer to give it a wait.
endfunction
//===========================================================================
function InitTrig_Initialization takes nothing returns nothing
set udg_GameCache = InitGameCache("Tutorial.w3v") // Initialize the cache
call ExecuteFunc("Initialization") // Execute the "Initialization" function in another thread (actually not needed, it could've been a normal call).
endfunction
function Trig_Hero_Selection_Conditions takes nothing returns boolean
return udg_Hero[GetPlayerId(GetTriggerPlayer())] == null and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_PASSIVE)
// Check if the player hasn't got a Hero already, and that it is a Hero owned by neutral passive that was selected.
endfunction
function SelectHeroForPlayer takes player p, unit u returns nothing
// Display message, remove unit from group, set global, set unit and camera positions and start the AI if it was a computer player that selected it.
local real x = GetPlayerStartLocationX(p)
local real y = GetPlayerStartLocationY(p)
set udg_Hero[GetPlayerId(p)] = u
set udg_Random[GetConvertedPlayerId(p)] = false
call GroupRemoveUnit(udg_Heroes, u)
call SetUnitOwner( u, p, true )
call SetCameraPositionForPlayer(p, x, y)
call SetUnitPosition(u, x, y)
call SetUnitInvulnerable(u, false)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(p)+" выбрал "+GetUnitName(u)+".")
endfunction
function Trig_Hero_Selection_Actions takes nothing returns nothing
call SelectHeroForPlayer(GetTriggerPlayer(), GetTriggerUnit()) // Call the selecting function.
endfunction
//===========================================================================
function InitTrig_Hero_Selection takes nothing returns nothing
local integer i = 0
set gg_trg_Hero_Selection = CreateTrigger( )
loop
exitwhen i > 11
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Hero_Selection, Player(i), true ) // I use a loop instead of 12 similiar calls.
set i = i + 1
endloop
call TriggerAddCondition( gg_trg_Hero_Selection, Condition( function Trig_Hero_Selection_Conditions ) )
call TriggerAddAction( gg_trg_Hero_Selection, function Trig_Hero_Selection_Actions )
endfunction
function Trig_Destructible_Resurrection_Actions takes nothing returns nothing
local destructable d = GetDyingDestructable()
call DestructableRestoreLife(d, GetDestructableMaxLife(d), true)
set d = null
endfunction
//===========================================================================
function InitTrig_Destructible_Resurrection takes nothing returns nothing
set gg_trg_Destructible_Resurrection = CreateTrigger( )
call TriggerRegisterDestDeathInRegionEvent( gg_trg_Destructible_Resurrection, GetPlayableMapRect() )
call TriggerAddAction( gg_trg_Destructible_Resurrection, function Trig_Destructible_Resurrection_Actions )
endfunction
function InitPlayers takes nothing returns nothing
local integer i = 0
local player p
loop
exitwhen i > 11
set p = Player(i)
if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING then
call LeaderboardAddItemBJ(p, bj_lastCreatedLeaderboard, GetPlayerName(p), 0) // If the player is playing, add him/her to the leaderboard.
endif
set i = i + 1
endloop
set p = null
endfunction
//===========================================================================
function InitTrig_InitPlayers takes nothing returns nothing
endfunction
function HeroRevival_Conditions takes nothing returns boolean
return IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO)
endfunction
function Trig_DY_Func001001 takes player p returns boolean
if ( not ( udg_LiveYes[GetPlayerId(p)] == false ) ) then
return false
endif
return ( GetPlayerSlotState(GetOwningPlayer(GetDyingUnit())) == PLAYER_SLOT_STATE_PLAYING )
endfunction
function HeroRevival_Actions takes nothing returns nothing
local integer r = GetRandomInt(0,11)
local unit d = GetDyingUnit()
local unit u = GetKillingUnit()
local player p = GetOwningPlayer(d) // This function updates the leaderboard, creates an item, displays a message and revives the Hero.
local player k = GetOwningPlayer(GetKillingUnit())
local integer i = GetPlayerId(k)
set udg_Points[i] = udg_Points[i] + 1
call LeaderboardSetPlayerItemValueBJ(k, bj_lastCreatedLeaderboard, udg_Points[i])
call LeaderboardSortItemsBJ(bj_lastCreatedLeaderboard, bj_SORTTYPE_SORTBYVALUE, false)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(p)+" was killed by "+GetPlayerName(k)+".")
call TriggerSleepAction(5)
if ( Trig_DY_Func001001(GetOwningPlayer(GetDyingUnit())) ) then
call ReviveHero(d, GetPlayerStartLocationX(p), GetPlayerStartLocationY(p), true)
else
call DoNothing( )
endif
call SetUnitState(d, UNIT_STATE_MANA, GetUnitState(d, UNIT_STATE_MAX_MANA))
call UnitResetCooldown(d)
call SelectUnitForPlayerSingle(d, p)
call SetCameraPositionForPlayer(p, GetUnitX(d), GetUnitY(d))
set d = null
set p = null
set k = null
endfunction
//===========================================================================
function InitTrig_HeroRevival takes nothing returns nothing
set gg_trg_HeroRevival = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_HeroRevival, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_trg_HeroRevival, Condition(function HeroRevival_Conditions))
call TriggerAddAction(gg_trg_HeroRevival, function HeroRevival_Actions)
endfunction
function Trig_wow_Func001Func001C takes nothing returns boolean
if ( not ( GetForLoopIndexA() != GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ())) ) ) then
return false
endif
if ( not ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] <= ( udg_Killing[GetForLoopIndexA()] + 25 ) ) ) then
return false
endif
return true
endfunction
function Trig_wow_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 12
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( Trig_wow_Func001Func001C() ) then
call DisplayTextToForce( GetPlayersAll(), ( "|cffff0000 " + ( GetUnitName(GetKillingUnitBJ()) + " стал крутым Героем!" ) ) )
set udg_Wow_Unit = GetKillingUnitBJ()
else
call DoNothing( )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_wow takes nothing returns nothing
set gg_trg_wow = CreateTrigger( )
call TriggerAddAction( gg_trg_wow, function Trig_wow_Actions )
endfunction
function Trig_Kills_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
if ( not ( IsUnitType(GetKillingUnitBJ(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Kills_Actions takes nothing returns nothing
set udg_Kills[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] = ( udg_Kills[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + 1 )
endfunction
//===========================================================================
function InitTrig_Kills takes nothing returns nothing
set gg_trg_Kills = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Kills, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Kills, Condition( function Trig_Kills_Conditions ) )
call TriggerAddAction( gg_trg_Kills, function Trig_Kills_Actions )
endfunction
function Trig_Die_2_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
if ( not ( IsUnitType(GetKillingUnitBJ(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Die_2_Func003001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 2 )
endfunction
function Trig_Die_2_Func004001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 2 )
endfunction
function Trig_Die_2_Func005001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 3 )
endfunction
function Trig_Die_2_Func006001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 3 )
endfunction
function Trig_Die_2_Func007001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 4 )
endfunction
function Trig_Die_2_Func008001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 4 )
endfunction
function Trig_Die_2_Func009001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 5 )
endfunction
function Trig_Die_2_Func010001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 5 )
endfunction
function Trig_Die_2_Func011001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 6 )
endfunction
function Trig_Die_2_Func012001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 6 )
endfunction
function Trig_Die_2_Func013001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 7 )
endfunction
function Trig_Die_2_Func014001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 7 )
endfunction
function Trig_Die_2_Func015001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 8 )
endfunction
function Trig_Die_2_Func016001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] == 8 )
endfunction
function Trig_Die_2_Func017001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] >= 9 )
endfunction
function Trig_Die_2_Func018001 takes nothing returns boolean
return ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] >= 9 )
endfunction
function Trig_Die_2_Func020001 takes nothing returns boolean
return ( udg_Kills[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] >= ( udg_Kills[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] + 5 ) )
endfunction
function Trig_Die_2_Actions takes nothing returns nothing
set udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] = ( udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + 1 )
set udg_Killing[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] = 0
if ( Trig_Die_2_Func003001() ) then
call PlaySoundBJ( gg_snd_Killing_Spree )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func004001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_483" )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func005001() ) then
call PlaySoundBJ( gg_snd_Dominating )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func006001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_482" )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func007001() ) then
call PlaySoundBJ( gg_snd_MegaKill )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func008001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_481" )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func009001() ) then
call PlaySoundBJ( gg_snd_Unstoppable )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func010001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_487" )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func011001() ) then
call PlaySoundBJ( gg_snd_WhickedSick )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func012001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_488" )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func013001() ) then
call PlaySoundBJ( gg_snd_MonsterKill )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func014001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_490" )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func015001() ) then
call PlaySoundBJ( gg_snd_GodLike )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func016001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_498" )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func017001() ) then
call PlaySoundBJ( gg_snd_HolyShit )
else
call DoNothing( )
endif
if ( Trig_Die_2_Func018001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_496" )
else
call DoNothing( )
endif
call TriggerSleepAction( 2 )
if ( Trig_Die_2_Func020001() ) then
call PlaySoundBJ( gg_snd_Ownage )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_Die_2 takes nothing returns nothing
set gg_trg_Die_2 = CreateTrigger( )
call DisableTrigger( gg_trg_Die_2 )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Die_2, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Die_2, Condition( function Trig_Die_2_Conditions ) )
call TriggerAddAction( gg_trg_Die_2, function Trig_Die_2_Actions )
endfunction
function Trig_First_Blood_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
if ( not ( IsUnitType(GetKillingUnitBJ(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_First_Blood_Actions takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, ( GetPlayerName(GetOwningPlayer(GetDyingUnit())) + ( " был первым убитым в игре! Его уничтожил " + GetPlayerName(GetOwningPlayer(GetKillingUnitBJ())) ) ) )
call PlaySoundBJ( gg_snd_firstblood )
call EnableTrigger( gg_trg_Die_2 )
call DisableTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_First_Blood takes nothing returns nothing
set gg_trg_First_Blood = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_First_Blood, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_First_Blood, Condition( function Trig_First_Blood_Conditions ) )
call TriggerAddAction( gg_trg_First_Blood, function Trig_First_Blood_Actions )
endfunction
function Trig_Leave_Func002A takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Objects\\Spawnmodels\\Undead\\UCancelDeath\\UCancelDeath.mdl" )
call TriggerSleepAction( 2 )
call RemoveUnit( GetEnumUnit() )
endfunction
function Trig_Leave_Actions takes nothing returns nothing
set udg_LiveYes[GetPlayerId(GetTriggerPlayer())] = true
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, ( GetPlayerName(GetTriggerPlayer()) + " покидает игру!" ) )
call ForGroupBJ( GetUnitsOfPlayerAll(GetTriggerPlayer()), function Trig_Leave_Func002A )
endfunction
//===========================================================================
function InitTrig_Leave takes nothing returns nothing
local integer i = 0
set gg_trg_Leave = CreateTrigger( )
loop
exitwhen i > 11
call TriggerRegisterPlayerEventLeave( gg_trg_Leave, Player(i) )
set i = i + 1
endloop
call TriggerAddAction( gg_trg_Leave, function Trig_Leave_Actions )
endfunction
function Trig_ForceofWild_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A015' ) ) then
return false
endif
return true
endfunction
function Trig_ForceofWild_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
call UnitAddAbilityBJ( 'A016', u )
call TriggerSleepAction( 25.00 )
call UnitRemoveAbilityBJ( 'A016', u )
endfunction
//===========================================================================
function InitTrig_Force_of_Wild takes nothing returns nothing
set gg_trg_Force_of_Wild = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Force_of_Wild, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Force_of_Wild, Condition( function Trig_ForceofWild_Conditions ) )
call TriggerAddAction( gg_trg_Force_of_Wild, function Trig_ForceofWild_Actions )
endfunction
function Trig_Feral_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function Feral1 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A000', GetSpellAbilityUnit()) == 1 )
endfunction
function Feral2 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A000', GetSpellAbilityUnit()) == 2 )
endfunction
function Feral3 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A000', GetSpellAbilityUnit()) == 3 )
endfunction
function Trig_Feral_Func003001003 takes nothing returns boolean
return ( IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true )
endfunction
function Trig_Feral_Func003A takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Items\\AIlm\\AIlmTarget.mdl" )
if ( Feral1() ) then
call UnitDamageTargetBJ( GetSpellAbilityUnit(), GetEnumUnit(), ( 30.00 * I2R(GetHeroLevel(GetSpellAbilityUnit())) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE )
call TriggerSleepAction( 0.50 )
call SetUnitLifeBJ( GetSpellAbilityUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetSpellAbilityUnit()) + ( 50.00 * I2R(GetHeroLevel(GetSpellAbilityUnit())) ) ) )
else
call DoNothing( )
endif
if ( Feral2() ) then
call UnitDamageTargetBJ( GetSpellAbilityUnit(), GetEnumUnit(), ( 60.00 * I2R(GetHeroLevel(GetSpellAbilityUnit())) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE )
call TriggerSleepAction( 0.50 )
call SetUnitLifeBJ( GetSpellAbilityUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetSpellAbilityUnit()) + ( 100.00 * I2R(GetHeroLevel(GetSpellAbilityUnit())) ) ) )
else
call DoNothing( )
endif
if ( Feral3() ) then
call UnitDamageTargetBJ( GetSpellAbilityUnit(), GetEnumUnit(), ( 90.00 * I2R(GetHeroLevel(GetSpellAbilityUnit())) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE )
call TriggerSleepAction( 0.50 )
call SetUnitLifeBJ( GetSpellAbilityUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetSpellAbilityUnit()) + ( 150.00 * I2R(GetHeroLevel(GetSpellAbilityUnit())) ) ) )
else
call DoNothing( )
endif
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_Feral_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRangeOfLocMatching(650.00, GetUnitLoc(GetSpellAbilityUnit()), Condition(function Trig_Feral_Func003001003)), function Trig_Feral_Func003A )
endfunction
//===========================================================================
function InitTrig_Feral takes nothing returns nothing
set gg_trg_Feral = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Feral, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Feral, Condition( function Trig_Feral_Conditions ) )
call TriggerAddAction( gg_trg_Feral, function Trig_Feral_Actions )
endfunction
function Trig_Fire_Chaos_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A001' ) ) then
return false
endif
return true
endfunction
function Trig_Fire_Chaos_Func002Func002001 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A001', GetSpellAbilityUnit()) == 1 )
endfunction
function Trig_Fire_Chaos_Func002Func003001 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A001', GetSpellAbilityUnit()) == 2 )
endfunction
function Trig_Fire_Chaos_Func002Func004001 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A001', GetSpellAbilityUnit()) == 3 )
endfunction
function Trig_Fire_Chaos_Func003A takes nothing returns nothing
call IssueTargetOrderBJ( GetEnumUnit(), "creepthunderbolt", GetSpellTargetUnit() )
endfunction
function Trig_Fire_Chaos_Func006001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetSpellAbilityUnit()) == true )
endfunction
function Trig_Fire_Chaos_Actions takes nothing returns nothing
call PauseUnitBJ( true, GetSpellTargetUnit() )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 10
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateNUnitsAtLoc( 1, 'u000', Player(0), PolarProjectionBJ(GetUnitLoc(GetSpellTargetUnit()), 500.00, ( I2R(GetForLoopIndexA()) * 36.00 )), bj_UNIT_FACING )
if ( Trig_Fire_Chaos_Func002Func002001() ) then
call UnitAddAbilityBJ( 'A01G', GetLastCreatedUnit() )
else
call DoNothing( )
endif
if ( Trig_Fire_Chaos_Func002Func003001() ) then
call UnitAddAbilityBJ( 'A003', GetLastCreatedUnit() )
else
call DoNothing( )
endif
if ( Trig_Fire_Chaos_Func002Func004001() ) then
call UnitAddAbilityBJ( 'A01H', GetLastCreatedUnit() )
else
call DoNothing( )
endif
call AddSpecialEffectLocBJ( GetUnitLoc(GetLastCreatedUnit()), "Objects\\Spawnmodels\\Human\\SmallFlameSpawn\\SmallFlameSpawn.mdl" )
call UnitApplyTimedLifeBJ( 1.50, 'BTLF', GetLastCreatedUnit() )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_Gr1 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call ForGroupBJ( udg_Gr1, function Trig_Fire_Chaos_Func003A )
call GroupClear( udg_Gr1 )
call PauseUnitBJ( false, GetSpellTargetUnit() )
if ( Trig_Fire_Chaos_Func006001() ) then
call IssuePointOrderLocBJ( GetSpellTargetUnit(), "attack", GetUnitLoc(GetSpellAbilityUnit()) )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_Fire_Chaos takes nothing returns nothing
set gg_trg_Fire_Chaos = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Chaos, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Fire_Chaos, Condition( function Trig_Fire_Chaos_Conditions ) )
call TriggerAddAction( gg_trg_Fire_Chaos, function Trig_Fire_Chaos_Actions )
endfunction
function Trig_Fire_Harpoon_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00D' ) ) then
return false
endif
return true
endfunction
function Trig_Fire_Harpoon_Actions takes nothing returns nothing
call PolledWait( 0.10 )
call AddSpecialEffectTargetUnitBJ( "origin", GetSpellTargetUnit(), "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl" )
call SetUnitPositionLoc( GetSpellTargetUnit(), GetUnitLoc(GetSpellAbilityUnit()) )
endfunction
//===========================================================================
function InitTrig_Fire_Harpoon takes nothing returns nothing
set gg_trg_Fire_Harpoon = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Harpoon, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Fire_Harpoon, Condition( function Trig_Fire_Harpoon_Conditions ) )
call TriggerAddAction( gg_trg_Fire_Harpoon, function Trig_Fire_Harpoon_Actions )
endfunction
function Trig_Charm_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00E' ) ) then
return false
endif
return true
endfunction
function Charm1 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A00E', GetSpellAbilityUnit()) == 1 )
endfunction
function Charm2 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A00E', GetSpellAbilityUnit()) == 2 )
endfunction
function Charm3 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A00E', GetSpellAbilityUnit()) == 3 )
endfunction
function Trig_Charm_Func003C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(0) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func004C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(1) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func005C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(2) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func006C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(3) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func007C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(4) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func008C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(5) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func009C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(6) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func010C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(7) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func011C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(8) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func012C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(9) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func013C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(10) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Func014C takes nothing returns boolean
if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(11) ) ) then
return false
endif
return true
endfunction
function Trig_Charm_Actions takes nothing returns nothing
local unit u
set u = GetSpellTargetUnit()
if ( Trig_Charm_Func003C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(0), true )
call SelectUnitForPlayerSingle( u, Player(0) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func004C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(1), true )
call SelectUnitForPlayerSingle( u, Player(1) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func005C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(2), true )
call SelectUnitForPlayerSingle( u, Player(2) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func006C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(3), true )
call SelectUnitForPlayerSingle( u, Player(3) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func007C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(4), true )
call SelectUnitForPlayerSingle( u, Player(4) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func008C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(5), true )
call SelectUnitForPlayerSingle( u, Player(5) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func009C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(6), true )
call SelectUnitForPlayerSingle( u, Player(6) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func010C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(7), true )
call SelectUnitForPlayerSingle( u, Player(7) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func011C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(8), true )
call SelectUnitForPlayerSingle( u, Player(8) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func012C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(9), true )
call SelectUnitForPlayerSingle( u, Player(9) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func013C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(10), true )
call SelectUnitForPlayerSingle( u, Player(10) )
else
call DoNothing( )
endif
if ( Trig_Charm_Func014C() ) then
call SetUnitOwner( u, GetOwningPlayer(GetSpellAbilityUnit()), true )
if ( Charm1() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm2() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm3() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetUnitOwner( u, Player(11), true )
call SelectUnitForPlayerSingle( u, Player(11) )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_Charm takes nothing returns nothing
set gg_trg_Charm = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Charm, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Charm, Condition( function Trig_Charm_Conditions ) )
call TriggerAddAction( gg_trg_Charm, function Trig_Charm_Actions )
endfunction
function Trig_Charm_2_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00E' ) ) then
return false
endif
return true
endfunction
function Charm4 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A00E', GetSpellAbilityUnit()) == 1 )
endfunction
function Charm5 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A00E', GetSpellAbilityUnit()) == 2 )
endfunction
function Charm6 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('A00E', GetSpellAbilityUnit()) == 3 )
endfunction
function Trig_Charm_2_Actions takes nothing returns nothing
local unit u = GetSpellTargetUnit()
local unit c = GetSpellAbilityUnit()
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 1), false )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 2), false )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 3), false )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 4), false )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 5), false )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 6), false )
call SetPlayerHandicapXPBJ( GetOwningPlayer(u), 200.00 )
if ( Charm4() ) then
call TriggerSleepAction( 10.00 )
else
call DoNothing( )
endif
if ( Charm5() ) then
call TriggerSleepAction( 20.00 )
else
call DoNothing( )
endif
if ( Charm6() ) then
call TriggerSleepAction( 30.00 )
else
call DoNothing( )
endif
call SetPlayerHandicapXPBJ( GetOwningPlayer(c), 100.00 )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 1), true )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 2), true )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 3), true )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 4), true )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 5), true )
call SetItemDroppableBJ( UnitItemInSlotBJ(u, 6), true )
set u = null
endfunction
//===========================================================================
function InitTrig_Charm_2 takes nothing returns nothing
set gg_trg_Charm_2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Charm_2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Charm_2, Condition( function Trig_Charm_2_Conditions ) )
call TriggerAddAction( gg_trg_Charm_2, function Trig_Charm_2_Actions )
endfunction
function Trig_GodFire_Conditions takes nothing returns boolean
if(not(GetLearnedSkill()=='A00Y'))then
return false
endif
return true
endfunction
function Trig_GodFire_Actions takes nothing returns nothing
local unit lOs=GetTriggerUnit()
local player lOw=GetOwningPlayer(lOs)
local integer lMP=GetUnitAbilityLevelSwapped('A00Y',GetTriggerUnit())
call SetPlayerTechResearchedSwap('Remg',lMP,lOw)
endfunction
function StartTrigger_Moon_Glaive takes nothing returns nothing
set gg_trg_God_Fire=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_God_Fire,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(gg_trg_God_Fire,Condition(function Trig_GodFire_Conditions))
call TriggerAddAction(gg_trg_God_Fire,function Trig_GodFire_Actions)
endfunction
function InitTrig_God_Fire takes nothing returns nothing
endfunction
function Trig_God_Fire_off_Actions takes nothing returns nothing
call UnitRemoveAbilityBJ( 'A016', GetDyingUnit() )
endfunction
//===========================================================================
function InitTrig_God_Fire_off takes nothing returns nothing
set gg_trg_God_Fire_off = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_God_Fire_off, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_God_Fire_off, function Trig_God_Fire_off_Actions )
endfunction
function GreatHelmC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ciri') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'bgst') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'belv') == true ) ) then
return false
endif
return true
endfunction
function GreatHelmA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ciri') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'bgst') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'belv') )
call UnitAddItemByIdSwapped( 'ckng', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Great_Helm takes nothing returns nothing
set gg_trg_Great_Helm = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Great_Helm, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Great_Helm, Condition( function GreatHelmC ) )
call TriggerAddAction( gg_trg_Great_Helm, function GreatHelmA )
endfunction
function Trig_Authority_of_Speed_Conditions takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'bspd') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'gcel') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ajen') == true ) ) then
return false
endif
return true
endfunction
function Trig_Authority_of_Speed_Actions takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'bspd') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'gcel') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ajen') )
call UnitAddItemByIdSwapped( 'I007', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Authority_of_Speed takes nothing returns nothing
set gg_trg_Authority_of_Speed = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Authority_of_Speed, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Authority_of_Speed, Condition( function Trig_Authority_of_Speed_Conditions ) )
call TriggerAddAction( gg_trg_Authority_of_Speed, function Trig_Authority_of_Speed_Actions )
endfunction
function Trig_Elemental_sphere_Conditions takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ofir') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'oven') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'olig') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ofro') == true ) ) then
return false
endif
return true
endfunction
function Trig_Elemental_sphere_Actions takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ofro') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ofir') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'oli2') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'oven') )
call UnitAddItemByIdSwapped( 'I000', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Elemental_sphere takes nothing returns nothing
set gg_trg_Elemental_sphere = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Elemental_sphere, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Elemental_sphere, Condition( function Trig_Elemental_sphere_Conditions ) )
call TriggerAddAction( gg_trg_Elemental_sphere, function Trig_Elemental_sphere_Actions )
endfunction
function Cold_OrbC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ofro') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ckng') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'pman') == true ) ) then
return false
endif
return true
endfunction
function Cold_OrbA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ofro') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ckng') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'pman') )
call UnitAddItemByIdSwapped( 'I004', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Cold_sphere takes nothing returns nothing
set gg_trg_Cold_sphere = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Cold_sphere, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Cold_sphere, Condition( function Cold_OrbC ) )
call TriggerAddAction( gg_trg_Cold_sphere, function Cold_OrbA )
endfunction
function Flame_OrbC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ofir') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ckng') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'pman') == true ) ) then
return false
endif
return true
endfunction
function Flame_OrbA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ofir') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ckng') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'pman') )
call UnitAddItemByIdSwapped( 'I003', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Flame_sphere takes nothing returns nothing
set gg_trg_Flame_sphere = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_sphere, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Flame_sphere, Condition( function Flame_OrbC ) )
call TriggerAddAction( gg_trg_Flame_sphere, function Flame_OrbA )
endfunction
function Poison_OrbC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'oven') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ckng') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'pman') == true ) ) then
return false
endif
return true
endfunction
function Poison_OrbA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'oven') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ckng') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'pman') )
call UnitAddItemByIdSwapped( 'I002', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Poison_sphere takes nothing returns nothing
set gg_trg_Poison_sphere = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Poison_sphere, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Poison_sphere, Condition( function Poison_OrbC ) )
call TriggerAddAction( gg_trg_Poison_sphere, function Poison_OrbA )
endfunction
function Tunder_OrbC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'olig') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ckng') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'pman') == true ) ) then
return false
endif
return true
endfunction
function Tunder_OrbA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'olig') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ckng') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'pman') )
call UnitAddItemByIdSwapped( 'I001', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Thunder_sphere takes nothing returns nothing
set gg_trg_Thunder_sphere = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Thunder_sphere, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Thunder_sphere, Condition( function Tunder_OrbC ) )
call TriggerAddAction( gg_trg_Thunder_sphere, function Tunder_OrbA )
endfunction
function SatanicSwordC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ckng') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ratf') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'rde4') == true ) ) then
return false
endif
return true
endfunction
function SatanicSwordA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ckng') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'rde4') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ratf') )
call UnitAddItemByIdSwapped( 'I005', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Satanic_sword takes nothing returns nothing
set gg_trg_Satanic_sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Satanic_sword, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Satanic_sword, Condition( function SatanicSwordC ) )
call TriggerAddAction( gg_trg_Satanic_sword, function SatanicSwordA )
endfunction
function Trig_Elementals_High_sphere_Conditions takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I001') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I004') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I002') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I003') == true ) ) then
return false
endif
return true
endfunction
function Trig_Elementals_High_sphere_Actions takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'I004') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'I001') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'I002') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'I003') )
call UnitAddItemByIdSwapped( 'I006', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Elementals_High_sphere takes nothing returns nothing
set gg_trg_Elementals_High_sphere = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Elementals_High_sphere, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Elementals_High_sphere, Condition( function Trig_Elementals_High_sphere_Conditions ) )
call TriggerAddAction( gg_trg_Elementals_High_sphere, function Trig_Elementals_High_sphere_Actions )
endfunction
function Trig_SwordOfOblivion_Conditions takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'hval') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ratc') == true ) ) then
return false
endif
return true
endfunction
function Trig_SwordOfOblivion_Actions takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'hval') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ratc') )
call UnitAddItemByIdSwapped( 'I008', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Sword_of_Oblivion takes nothing returns nothing
set gg_trg_Sword_of_Oblivion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Sword_of_Oblivion, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Sword_of_Oblivion, Condition( function Trig_SwordOfOblivion_Conditions ) )
call TriggerAddAction( gg_trg_Sword_of_Oblivion, function Trig_SwordOfOblivion_Actions )
endfunction
function CrusedSwordC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'evtl') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ratf') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'ocor') == true ) ) then
return false
endif
return true
endfunction
function CrusedSwordA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'evtl') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ratf') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'ocor') )
call UnitAddItemByIdSwapped( 'I009', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Crused_sword takes nothing returns nothing
set gg_trg_Crused_sword = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Crused_sword, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Crused_sword, Condition( function CrusedSwordC ) )
call TriggerAddAction( gg_trg_Crused_sword, function CrusedSwordA )
endfunction
function SwordOfDeathC takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I009') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I005') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I008') == true ) ) then
return false
endif
return true
endfunction
function SwordOfDeathA takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetManipulatingUnit(), "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'I009') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'I005') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), 'I008') )
call UnitAddItemByIdSwapped( 'I00A', GetManipulatingUnit() )
endfunction
//===========================================================================
function InitTrig_Sword_of_Death takes nothing returns nothing
set gg_trg_Sword_of_Death = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Sword_of_Death, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Sword_of_Death, Condition( function SwordOfDeathC ) )
call TriggerAddAction( gg_trg_Sword_of_Death, function SwordOfDeathA )
endfunction
function Trig_No_Target_EVENT_Conditions takes nothing returns boolean
if ( not ( GetPlayerController(GetOwningPlayer(GetAttackedUnitBJ())) == MAP_CONTROL_COMPUTER ) ) then
return false
endif
return true
endfunction
function Trig_No_Target_EVENT_Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetAttackedUnitBJ()) == 'Ofar' ) ) then
return false
endif
return true
endfunction
function Trig_No_Target_EVENT_Actions takes nothing returns nothing
if ( Trig_No_Target_EVENT_Func001C() ) then
call IssueImmediateOrderBJ( GetAttackedUnitBJ(), "spiritwolf" )
call IssueImmediateOrderBJ( GetAttackedUnitBJ(), "frenzy" )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_No_target_EVENT takes nothing returns nothing
set gg_trg_No_target_EVENT = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_No_target_EVENT, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_No_target_EVENT, Condition( function Trig_No_Target_EVENT_Conditions ) )
call TriggerAddAction( gg_trg_No_target_EVENT, function Trig_No_Target_EVENT_Actions )
endfunction