Name | Type | is_array | initial_value |
ABoard | multiboard | Yes | |
Abysal_Catapult | timer | No | |
BOSSENCOUNTER_Group | group | No | |
C1_Garrosh | unit | No | |
C1_Timer | timer | No | |
C1_TWindow | timerdialog | No | |
C1_Vendors | unit | Yes | |
C2_ENDTIMER | timer | No | |
C2_ENDTIMERWINDOW | timerdialog | No | |
C2_Footmans | group | No | |
C2_Timerini | timer | No | |
C2_TimerStart | timer | No | |
C_Spawns | location | Yes | |
Catapult | unit | No | |
ChapterTimer | timer | No | |
Classhash | integer | Yes | |
ColCharge_Timer | timer | No | |
ColorString | string | Yes | |
Crit_Chance | real | Yes | |
Dummy_Group | group | No | |
Evade_Chance | real | Yes | |
GA_Caster | unit | No | |
GA_Duration | real | No | |
Hall_of_Fame | unit | No | |
hash | hashtable | No | |
Hero | unitcode | Yes | |
HeroClass | string | Yes | |
HeroCount | integer | No | |
Heroes | unit | Yes | |
HeroIcon | string | Yes | |
HL_Angle | real | No | |
HL_Caster | unit | No | |
HL_Damage | real | No | |
HL_Distance | real | No | |
HL_Effect | effect | No | |
HL_FlySpeed | real | No | |
HL_Points | location | Yes | |
HL_Speed | real | No | |
ID_Caster | unit | No | |
ID_Damage | real | No | |
ID_Point | location | No | |
ID_Timer | timer | No | |
Item_Adds1 | real | Yes | |
Item_Adds2 | real | Yes | |
Item_Count | integer | No | |
Item_hashslot1 | integer | Yes | |
Item_hashslot2 | integer | Yes | |
Item_Main | itemcode | Yes | |
Kills | integer | Yes | |
KingOfStormwind | unit | No | |
LeakPoint | location | Yes | |
LeftTimer | timer | No | |
LoopInteger | integer | No | |
Magmaw | unit | No | |
Magmaw_Burow2 | timer | No | |
Magmaw_Burrow | timer | No | |
Magmaw_BurTimes | integer | No | |
Magmaw_Firebreath | timer | No | |
Magmaw_IsBurrow | boolean | No | |
Magmaw_Slam | timer | No | |
Magmawini_timer | timer | No | |
MagmawLocVisited | boolean | Yes | |
MagS_Degree | real | No | |
MagS_Effect | effect | No | |
MagS_Int | integer | No | |
MBoard | multiboard | Yes | |
Meteor_Timer | timer | No | |
MeteorStrike_Timer | timer | No | |
MeteorStrike_Window | timerdialog | No | |
MiddleTimer | timer | No | |
Molten_Preload | integer | Yes | |
NBoard | multiboard | Yes | |
PlayerCount | integer | No | |
Players | player | Yes | |
Players_Group | force | No | |
PlayersInGame | integer | No | |
Potions_COUNT | integer | No | |
Potions_DISABLED | itemcode | Yes | |
Potions_ORIGIN | itemcode | Yes | |
Potions_RUNE | itemcode | Yes | |
RightTimer | timer | No | |
Selector | unit | Yes | |
SimError | sound | No | |
Singleplayer | boolean | No | |
SoloModeDialog | dialog | No | |
SoloModeMultiButton | button | No | |
SoloModeSoloButton | button | No | |
SPD_Bonus | real | Yes | |
Spec_WaveCount | integer | No | |
Spec_WaveUnits | unitcode | Yes | |
Special_WaveC1_Window | timerdialog | No | |
SpiritHealerLoc | location | Yes | |
Supremus | unit | No | |
SupremusTimer | timer | No | |
temp_force | force | No | |
temp_group | group | No | |
temp_int | integer | No | |
temp_real | real | No | |
temp_str | string | No | |
Temp_Unit | unit | No | |
temp_unit | unit | No | |
Tips | string | Yes | |
Tips_Force | force | No | |
TipsCount | integer | No | |
Votes | integer | No | |
Voting_Group | force | No | |
VotingTimer | timer | No |
library WeatherEffects initializer onInit
globals
weathereffect FOG_CHAPTER1_HEAVY = null
weathereffect FOG_CHAPTER1_LIGHT = null
weathereffect MOONLIGHT_CHAPTER3 = null
weathereffect RAIN_ISLAND = null
endglobals
function TurnWeatherEffectsForPlayer takes player whichPlayer, boolean flag returns nothing
if GetLocalPlayer()==whichPlayer then
call EnableWeatherEffect(FOG_CHAPTER1_LIGHT,flag)
call EnableWeatherEffect(FOG_CHAPTER1_HEAVY,flag)
endif
endfunction
private function Acts takes nothing returns nothing
set FOG_CHAPTER1_HEAVY = AddWeatherEffect(gg_rct_GrayFogHeavy, 'WOlw')
set FOG_CHAPTER1_LIGHT = AddWeatherEffect(gg_rct_GrayFogLight, 'WOlw')
set MOONLIGHT_CHAPTER3 = AddWeatherEffect(gg_rct_Act3BOUNDS, 'LRma')
set RAIN_ISLAND = AddWeatherEffect(gg_rct_IslandBounds, 'RLhr')
call EnableWeatherEffect(FOG_CHAPTER1_LIGHT,true)
call EnableWeatherEffect(FOG_CHAPTER1_HEAVY,true)
call EnableWeatherEffect(MOONLIGHT_CHAPTER3,true)
call EnableWeatherEffect(RAIN_ISLAND,true)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterTimerEventSingle( t, 1. )
call TriggerAddAction( t, function Acts )
set t = null
endfunction
endlibrary
library MapGameplayUtils
globals
//integer DD_Count = 1
//integer ME_Count = 3
//integer ST_Count = 5
//integer TR_Count = 6
player ORGRIMMAR = Player(6)
player INVADERS = Player(7)
player STORMWIND = Player(8)
player DARNASSUS = Player(9)
player KOBOLDS = Player(10)
endglobals
function IsUnitAPlayerHero takes unit u returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == u then
return true
endif
set i = i + 1
endloop
return false
endfunction
function AddLocalEffectTarget takes unit u, string eff, string attach, player pl returns effect
local string e = ""
if GetLocalPlayer() == pl then
set e = eff
endif
return AddSpecialEffectTarget(e, u, attach)
endfunction
function StopCameraShake takes nothing returns nothing
local timer t = GetExpiredTimer()
local player p = LoadPlayerHandle(udg_hash,GetHandleId(t),1)
call CameraClearNoiseForPlayer(p)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set p = null
endfunction
function MoltenCore takes player whichPlayer,integer red,integer green,integer blue returns nothing
if GetLocalPlayer() == whichPlayer then
call SetWaterBaseColor(red,green,blue,255)
endif
endfunction
function OrkTown takes player whichPlayer returns nothing
if GetLocalPlayer() == whichPlayer then
call SetWaterBaseColor(0,100,250,255)
endif
endfunction
function SimError takes player ForPlayer, string msg returns nothing
if udg_SimError==null then
set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
endif
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
call StartSound( udg_SimError )
endif
endfunction
function GoldTextTag takes string s, real x,real y returns nothing
local texttag tt = CreateTextTag()
call SetTextTagText(tt, s, 0.023)
call SetTextTagPos(tt,x,y,55.)
call SetTextTagPermanent(tt,false)
call SetTextTagLifespan(tt,1.5)
call SetTextTagVelocityBJ(tt,55.,90.)
call ShowTextTagForceBJ(true,tt,udg_Players_Group)
set tt = null
endfunction
/*
function GetHeroType takes integer u returns string
if u<=DD_Count then
return "Damage Dealer"
elseif (u>DD_Count) and u<=ME_Count then
return "Mage"
elseif (u>ME_Count) and (u<=ST_Count) then
return "Support"
else
return "Tanker"
endif
return "Error"
endfunction
*/
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//globals
//constant mapcontrol USER = MAP_CONTROL_USER
//constant unitstate UNIT_LIFE = UNIT_STATE_LIFE
//constant unitstate UNIT_MANA = UNIT_STATE_MANA
//constant unitstate UNIT_MAX_LIFE = UNIT_STATE_MAX_LIFE
//constant unitstate UNIT_MAX_MANA = UNIT_STATE_MAX_MANA
//constant playerunitevent SPELL_EFFECT = EVENT_PLAYER_UNIT_SPELL_EFFECT
//constant playerevent PLAYER_CHAT = EVENT_PLAYER_CHAT
//constant unittype TYPE_DEAD = UNIT_TYPE_DEAD
//constant unittype TYPE_HERO = UNIT_TYPE_HERO
//endglobals
//TESH.scrollpos=1
//TESH.alwaysfold=0
library Angles
function ConvertAngleTo180 takes real a returns real
if a < -180. then
return 360.+a
elseif a > 180. then
return a-360.
endif
return a
endfunction
function DifferenceBetweenAngles takes real a1, real a2 returns real
return RAbsBJ(ConvertAngleTo180(ConvertAngleTo180(a2)-ConvertAngleTo180(a1)))
endfunction
endlibrary
//TESH.scrollpos=20
//TESH.alwaysfold=0
library DummyCasts //'h009' - dummy rawcode
function DummyCastTarget takes unit owner, unit target,integer abilid,integer abillvl,string order returns nothing
local real x = GetUnitX(owner)
local real y = GetUnitY(owner)
local unit a = CreateUnit(GetOwningPlayer(owner),'h009',x,y,0.)
call UnitAddAbility(a,abilid)
call SetUnitAbilityLevel(a,abilid,abillvl)
call IssueTargetOrder(a,order,target)
call UnitApplyTimedLife(a,'BHwe',0.5)
set a = null
endfunction
function DummyCastNonTarget takes unit u, integer abilid,integer abillvl,string order returns nothing
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local unit a = CreateUnit(GetOwningPlayer(u),'h009',x,y,0.)
call UnitAddAbility(a,abilid)
call SetUnitAbilityLevel(a,abilid,abillvl)
call IssueImmediateOrder(a,order)
call UnitApplyTimedLife(a,'BHwe',0.5)
set a = null
endfunction
function DummyCastPoint takes unit u,real c, real d, integer abilid,integer abillvl,string order returns nothing
local unit a = CreateUnit(GetOwningPlayer(u),'h009',c,d,0.)
call UnitAddAbility(a,abilid)
call SetUnitAbilityLevel(a,abilid,abillvl)
call IssuePointOrder(a,order,c,d)
call UnitApplyTimedLife(a,'BHwe',0.5)
set a = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library AddTextTag initializer onInit
globals
boolean IS_ENEMY_TEXT = false
boolean IS_HEALING_TEXT = false
boolean IS_SPELL_DAMAGE_TEXT = false
boolean IS_PHYS_DAMAGE_TEXT = false
private constant real REFRESH_PREVIOUS_TEXTTAG = 0.75
private constant real MIN_ANGLE = 45.
private constant real MAX_ANGLE = 135.
private constant integer PREVIOUS_TEXTTAG_TIME_ELAPSED_HASH = 1000
private group AFFECTED = CreateGroup()
private timer TT_TIMER = CreateTimer()
endglobals
private function GroupRefresh takes nothing returns nothing
local unit u = GetEnumUnit()
local real elapsed = LoadReal(udg_hash,GetHandleId(u),PREVIOUS_TEXTTAG_TIME_ELAPSED_HASH)
set elapsed = elapsed + 0.04
if elapsed > REFRESH_PREVIOUS_TEXTTAG then
call GroupRemoveUnit(AFFECTED,u)
else
call SaveReal(udg_hash,GetHandleId(u),PREVIOUS_TEXTTAG_TIME_ELAPSED_HASH,elapsed)
endif
set u = null
endfunction
private function onTimer takes nothing returns nothing
call ForGroup(AFFECTED, function GroupRefresh)
endfunction
function AddTextTagUnit takes string s, unit u, force play, real angle, real size,real duration, real Zoffset returns nothing
local texttag tt = CreateTextTag()
local real previous = LoadReal(udg_hash,GetHandleId(u),PREVIOUS_TEXTTAG_TIME_ELAPSED_HASH)
local real newangle = angle
call SetTextTagText(tt,s,size * 0.023 / 10.)
call SetTextTagPosUnit(tt,u,Zoffset)
call SetTextTagColor(tt,255,255,255,255)
call SetTextTagPermanent(tt,false)
call SetTextTagLifespan(tt,duration)
call SetTextTagFadepoint(tt,0.5)
if previous < REFRESH_PREVIOUS_TEXTTAG then
set newangle = GetRandomReal(MIN_ANGLE,MAX_ANGLE)
endif
call SetTextTagVelocity(tt, 0.0355*Cos(newangle*bj_DEGTORAD),0.0355*Sin(newangle*bj_DEGTORAD))
call SaveReal(udg_hash,GetHandleId(u),PREVIOUS_TEXTTAG_TIME_ELAPSED_HASH,0.)
call GroupAddUnit(AFFECTED,u)
if (IsPlayerInForce(GetLocalPlayer(), udg_Players_Group)) then
call SetTextTagVisibility(tt, false)
endif
if (IsPlayerInForce(GetLocalPlayer(), play)) then
if IS_ENEMY_TEXT then
if IsPlayerInForce(GetLocalPlayer(),ENEMY_TEXT_FORCE) and IsPlayerInForce(GetLocalPlayer(),BATTLE_TEXT_FORCE) then
call SetTextTagVisibility(tt, true)
endif
elseif IS_HEALING_TEXT then
if IsPlayerInForce(GetLocalPlayer(),HEALING_TEXT_FORCE) and IsPlayerInForce(GetLocalPlayer(),BATTLE_TEXT_FORCE) then
call SetTextTagVisibility(tt, true)
endif
elseif IS_PHYS_DAMAGE_TEXT then
if IsPlayerInForce(GetLocalPlayer(),PHYS_DAMAGE_TEXT_FORCE) and IsPlayerInForce(GetLocalPlayer(),BATTLE_TEXT_FORCE) then
call SetTextTagVisibility(tt, true)
endif
elseif IS_SPELL_DAMAGE_TEXT then
if IsPlayerInForce(GetLocalPlayer(),SPELL_DAMAGE_TEXT_FORCE) and IsPlayerInForce(GetLocalPlayer(),BATTLE_TEXT_FORCE) then
call SetTextTagVisibility(tt, true)
endif
else
call SetTextTagVisibility(tt, true)
endif
endif
//call ForceClear(play)
set tt = null
endfunction
private function onInit takes nothing returns nothing
call TimerStart(TT_TIMER,0.04,true,function onTimer)
endfunction
endlibrary
//Item abilities are saved as integers in the corresponding hash keys.
//This library allows to put a cooldown on the desired hashkey, which allows not to trigger abiliy proc if it is in cooldown.
library HashprocCooldowns initializer onInit
globals
private integer UNITS_COUNT = 0
private constant integer MAX_COOLDOWNS = 100
private unit array UNITS
private timer HCTimer = CreateTimer()
endglobals
private struct cooldownsSt
integer Count = 0
integer array Hash[MAX_COOLDOWNS]
real array Remaining[MAX_COOLDOWNS]
endstruct
globals
private cooldownsSt array HC
endglobals
private function onTimer takes nothing returns nothing
local integer k = 1
local integer j = 1
local boolean HasCooldowns = false
loop
exitwhen k > UNITS_COUNT
set j = 1
set HasCooldowns = false
loop
exitwhen j>HC[k].Count
if HC[k].Remaining[j]>0. then
set HC[k].Remaining[j] = HC[k].Remaining[j] - 0.04
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Removing cooldown on " + GetUnitName(UNITS[k]) + ". Remaining time: " + R2S(HC[k].Remaining[j]))
set HasCooldowns = true
endif
set j = j + 1
endloop
if not HasCooldowns then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"No cooldowns on " + GetUnitName(UNITS[k]))
set UNITS[k] = null
endif
set k = k + 1
endloop
endfunction
private function onInit takes nothing returns nothing
call TimerStart(HCTimer,0.04,true,function onTimer)
endfunction
//Returns -1 if not found
private function GetUnitCooldownsId takes unit whichUnit returns integer
local integer i = 1
loop
exitwhen i>UNITS_COUNT or UNITS[i]==whichUnit
set i = i +1
endloop
if i<=UNITS_COUNT then
return i
endif
return -1
endfunction
private function NewUnitCooldownsId takes unit whichUnit returns integer
local integer i = 1
loop
exitwhen i > UNITS_COUNT or UNITS[i]==null
set i = i + 1
endloop
if i<=UNITS_COUNT then
set UNITS[i] = whichUnit
return i
endif
set UNITS_COUNT = UNITS_COUNT + 1
set HC[UNITS_COUNT] = cooldownsSt.create()
set UNITS[UNITS_COUNT] = whichUnit
return UNITS_COUNT
endfunction
function HasUnitCooldownHash takes unit whichUnit, integer hashId returns boolean
local integer k = GetUnitCooldownsId(whichUnit)
local integer j = 1
if k==-1 then
return false
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"No cooldown before")
endif
loop
exitwhen HC[k].Hash[j]==hashId or j>HC[k].Count
set j = j + 1
endloop
return HC[k].Remaining[j]>0
endfunction
function UnitAddHashCooldown takes unit whichUnit, integer hashId, real cooldown returns nothing
local integer k = GetUnitCooldownsId(whichUnit)
local integer j = 1
if k==-1 then
set k = NewUnitCooldownsId(whichUnit)
endif
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Adding a cooldown on " + GetUnitName(whichUnit) + " as " + I2S(k) + "'th unit in library")
loop
exitwhen j>HC[k].Count or HC[k].Hash[j]==hashId or HC[k].Remaining[j]<=0.
set j = j + 1
endloop
if j<= HC[k].Count then
set HC[k].Hash[j] = hashId
set HC[k].Remaining[j] = cooldown
else
set HC[k].Count = HC[k].Count + 1
set HC[k].Hash[HC[k].Count] = hashId
set HC[k].Remaining[HC[k].Count] = cooldown
endif
endfunction
endlibrary
library HashtableUtils
/*
1 - Evasion (percent)
2 - Crit (percent)
3 - Block Amount (value)
4 - Haste (percent)
5 - Spell Power (value)
6 - Crit Multiplier (value)
7 - Splash Damage (value)
8 - Healing Reduce to unit (REDUCE TO ATTACKED UNIT) (value)
9 - Healing Bonus to targeted units (BONUS TO THIS UNIT) (value)
10 - Attack damage multiplier (need +1 in calculations) (value)
11 - Bonus to Healing effect, done by unit (in mult value)
12 - Critical strike % increase to Taker (in percent)
13 - Life-stealing (in value)
14 - Block Chance (percent)
15 - Chance to miss (percent)
16 - Spell Resist(value)
17 - Absorb phys damage
18 - Absorb spec effect
19 - Spell Crit
20 - Spell Crit Received Bonus
21 - Last Dealed Phys Damage
22 - Phys Dmg Reduce Multiplier (value)
23 - % bonus to OUT-Combat HP regeneration (value)
24 - % bonus to OUT-Combat MP regeneration (value)
25 - % bonus to OUT-Combat BOTH regenerations (value)
26 - % bonus to IN-Combat HP regeneration (value)
27 - % bonus to IN-Combat MP regeneration (value)
28 - % bonus to IN-Combat BOTH regenerations (value)
29 - Aggro multiplier(value)
30 - Hero Class
31 - Healing Crit
*/
globals
private constant integer EVASION_HASH = 1
private constant integer CRIT_HASH = 2
private constant integer BLOCKAMOUNT_HASH = 3
private constant integer HASTE_HASH = 4
private constant integer SPELLPOWER_HASH = 5
private constant integer CRITMULTIPLIER_HASH = 6
private constant integer SPLASH_HASH = 7
private constant integer HEALINGATTACKREDUCE_HASH = 8
private constant integer HEALINGRECEIVEBONUS_HASH = 9
private constant integer ATTACKDAMAGEMULTIPLIER_HASH = 10
private constant integer HEALINGBONUS_HASH = 11
private constant integer CRITRECEIVEDBONUS_HASH = 12
private constant integer LIFESTEALING_HASH = 13
private constant integer BLOCKCHANCE_HASH = 14
private constant integer MISSCHANCE_HASH = 15
private constant integer SPELLRESIST_HASH = 16
private constant integer SPELLCRIT_HASH = 19
private constant integer SPELLCRIT_RECEIVED_BONUS_HASH = 20
private constant integer PHYSDMGREDUCE_HASH = 22
private constant integer OUTCOMBAT_HP_MP_REGEN_HASH = 25
private constant integer SPELL_CRIT_MULTIPLIER_HASH = 40
private constant integer INCOMBAT_MP_REGEN_HASH = 27
private constant integer AGGRO_MULTIPLIER_HASH = 29
private constant integer RAGE_REGEN_BONUS_HASH = 400
private constant integer FOCUS_REGEN_BONUS_HASH = 401
private constant integer ENERGY_REGEN_BONUS_HASH = 402
private constant integer MANA_REGEN_BONUS_HASH = 403
private constant integer RUNES_REGEN_BONUS_HASH = 404
private constant integer SELF_HEALING_BONUS_HASH = 405
private constant integer FROST_DAMAGE_BONUS_HASH = 410
private constant integer FIRE_DAMAGE_BONUS_HASH = 411
private constant integer ARCANE_DAMAGE_BONUS_HASH = 412
private constant integer WATER_DAMAGE_BONUS_HASH = 413
private constant integer ELEMENTAL_DAMAGE_BONUS_HASH = 414
private constant integer BLEEDING_DAMAGE_BONUS_HASH = 415
private constant integer EARTH_DAMAGE_BONUS_HASH = 416
private constant integer FROST_DAMAGE_RECEIVED_BONUS_HASH = 417
private constant integer FIRE_DAMAGE_RECEIVED_BONUS_HASH = 418
private constant integer ARCANE_DAMAGE_RECEIVED_BONUS_HASH = 419
private constant integer WATER_DAMAGE_RECEIVED_BONUS_HASH = 420
private constant integer ELEMENTAL_DAMAGE_RECEIVED_BONUS_HASH = 421
private constant integer BLEEDING_DAMAGE_RECEIVED_BONUS_HASH = 422
private constant integer EARTH_DAMAGE_RECEIVED_BONUS_HASH = 423
private constant integer PERIODIC_HEALING_RECEIVED_BONUS_HASH = 424
private constant integer PERIODIC_HEALING_BONUS_HASH = 425
private constant integer PERIODIC_HEALING_CRIT_HASH = 426
private constant integer PERIODIC_DAMAGE_BONUS_HASH = 427
private constant integer HEALING_CRIT_MULTIPLIER_HASH = 428
private constant integer DOTED_UNITS_SPELL_DAMAGE_BONUS_HASH = 429
private constant integer PHYS_DAMAGE_RETURN_MULTIPLIER_HASH = 430
endglobals
function GetPhysDamageReturnMultiplierHash takes nothing returns integer
return PHYS_DAMAGE_RETURN_MULTIPLIER_HASH
endfunction
function GetDotedUnitsSpellDamageBonusHash takes nothing returns integer
return DOTED_UNITS_SPELL_DAMAGE_BONUS_HASH
endfunction
function GetHealingCritMultiplierHash takes nothing returns integer
return HEALING_CRIT_MULTIPLIER_HASH
endfunction
function GetPeriodicHealingCritHash takes nothing returns integer
return PERIODIC_HEALING_CRIT_HASH
endfunction
function GetPeriodicDamageBonusHash takes nothing returns integer
return PERIODIC_DAMAGE_BONUS_HASH
endfunction
function GetAggroMultiplierHash takes nothing returns integer
return AGGRO_MULTIPLIER_HASH
endfunction
function GetPeriodicHealingBonusHash takes nothing returns integer
return PERIODIC_HEALING_BONUS_HASH
endfunction
function GetPeriodicHealingReceivedBonusHash takes nothing returns integer
return PERIODIC_HEALING_RECEIVED_BONUS_HASH
endfunction
function GetSpellCritMultiplierHash takes nothing returns integer
return SPELL_CRIT_MULTIPLIER_HASH
endfunction
function GetSpellCritReceivedBonusHash takes nothing returns integer
return SPELLCRIT_RECEIVED_BONUS_HASH
endfunction
function GetSpellCritHash takes nothing returns integer
return SPELLCRIT_HASH
endfunction
function GetEarthDamageReceivedBonusHash takes nothing returns integer
return EARTH_DAMAGE_RECEIVED_BONUS_HASH
endfunction
function GetBleedingDamageReceivedBonusHash takes nothing returns integer
return BLEEDING_DAMAGE_RECEIVED_BONUS_HASH
endfunction
function GetFrostDamageReceivedBonusHash takes nothing returns integer
return FROST_DAMAGE_RECEIVED_BONUS_HASH
endfunction
function GetFireDamageReceivedBonusHash takes nothing returns integer
return FIRE_DAMAGE_RECEIVED_BONUS_HASH
endfunction
function GetArcaneDamageReceivedBonusHash takes nothing returns integer
return ARCANE_DAMAGE_RECEIVED_BONUS_HASH
endfunction
function GetWaterDamageReceivedBonusHash takes nothing returns integer
return WATER_DAMAGE_RECEIVED_BONUS_HASH
endfunction
function GetElementalDamageReceivedBonusHash takes nothing returns integer
return ELEMENTAL_DAMAGE_RECEIVED_BONUS_HASH
endfunction
function GetEarthDamageBonusHash takes nothing returns integer
return EARTH_DAMAGE_BONUS_HASH
endfunction
function GetFrostDamageBonusHash takes nothing returns integer
return FROST_DAMAGE_BONUS_HASH
endfunction
function GetFireDamageBonusHash takes nothing returns integer
return FIRE_DAMAGE_BONUS_HASH
endfunction
function GetArcaneDamageBonusHash takes nothing returns integer
return ARCANE_DAMAGE_BONUS_HASH
endfunction
function GetWaterDamageBonusHash takes nothing returns integer
return WATER_DAMAGE_BONUS_HASH
endfunction
function GetElementalDamageBonusHash takes nothing returns integer
return ELEMENTAL_DAMAGE_BONUS_HASH
endfunction
function GetBleedingDamageBonusHash takes nothing returns integer
return BLEEDING_DAMAGE_BONUS_HASH
endfunction
function GetSelfHealingBonusHash takes nothing returns integer
return SELF_HEALING_BONUS_HASH
endfunction
function GetEnergyRegenBonusHash takes nothing returns integer
return ENERGY_REGEN_BONUS_HASH
endfunction
function GetRageRegenBonusHash takes nothing returns integer
return RAGE_REGEN_BONUS_HASH
endfunction
function GetFocusRegenBonusHash takes nothing returns integer
return FOCUS_REGEN_BONUS_HASH
endfunction
function GetManaRegenBonusHash takes nothing returns integer
return MANA_REGEN_BONUS_HASH
endfunction
function GetRunesRegenBonusHash takes nothing returns integer
return RUNES_REGEN_BONUS_HASH
endfunction
function GetEvasionHash takes nothing returns integer
return EVASION_HASH
endfunction
function GetCritHash takes nothing returns integer
return CRIT_HASH
endfunction
function GetBlockAmountHash takes nothing returns integer
return BLOCKAMOUNT_HASH
endfunction
function GetHasteHash takes nothing returns integer
return HASTE_HASH
endfunction
function GetSpellPowerHash takes nothing returns integer
return SPELLPOWER_HASH
endfunction
function GetCritMultiplierHash takes nothing returns integer
return CRITMULTIPLIER_HASH
endfunction
function GetSplashHash takes nothing returns integer
return SPLASH_HASH
endfunction
function GetHealingAttackReduceHash takes nothing returns integer
return HEALINGATTACKREDUCE_HASH
endfunction
function GetReceivedHealingBonusHash takes nothing returns integer
return HEALINGRECEIVEBONUS_HASH
endfunction
function GetAttackDamageMultiplierHash takes nothing returns integer
return ATTACKDAMAGEMULTIPLIER_HASH
endfunction
function GetHealingBonusHash takes nothing returns integer
return HEALINGBONUS_HASH
endfunction
function GetCritReceivedBonusHash takes nothing returns integer
return CRITRECEIVEDBONUS_HASH
endfunction
function GetLifestealingHash takes nothing returns integer
return LIFESTEALING_HASH
endfunction
function GetBlockChanceHash takes nothing returns integer
return BLOCKCHANCE_HASH
endfunction
function GetMissChanceHash takes nothing returns integer
return MISSCHANCE_HASH
endfunction
function GetSpellResistHash takes nothing returns integer
return SPELLRESIST_HASH
endfunction
function GetPhysDmgReduceHash takes nothing returns integer
return PHYSDMGREDUCE_HASH
endfunction
function GetOutCombatHpMpRegenHash takes nothing returns integer
return OUTCOMBAT_HP_MP_REGEN_HASH
endfunction
function GetInCombatManaRegenHash takes nothing returns integer
return INCOMBAT_MP_REGEN_HASH
endfunction
//Get Parameters
function GetUnitEvasion takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),EVASION_HASH)
endfunction
function GetUnitCritChancePercent takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),CRIT_HASH)
endfunction
function GetUnitBlockAmount takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),BLOCKAMOUNT_HASH)
endfunction
function GetUnitHastePercent takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),HASTE_HASH)
endfunction
function GetUnitSpellPower takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),SPELLPOWER_HASH)
endfunction
function GetUnitSpellCrit takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),SPELLCRIT_HASH)
endfunction
function GetUnitCritMultiplier takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),CRITMULTIPLIER_HASH)
endfunction
function GetUnitSplashValue takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),SPLASH_HASH)
endfunction
function GetUnitHealingAttackReduceValue takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),HEALINGATTACKREDUCE_HASH)
endfunction
function GetUnitHealingReceivedBonusValue takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),HEALINGRECEIVEBONUS_HASH)
endfunction
function GetUnitAttackDamageMultiplier takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),ATTACKDAMAGEMULTIPLIER_HASH)
endfunction
function GetUnitHealingBonusValue takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),HEALINGBONUS_HASH)
endfunction
function GetUnitCritReceivedBonusPercent takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),CRITRECEIVEDBONUS_HASH)
endfunction
function GetUnitLifeStealValue takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),LIFESTEALING_HASH)
endfunction
function GetUnitBlockChancePercent takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),BLOCKCHANCE_HASH)
endfunction
function GetUnitMissChancePercent takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),MISSCHANCE_HASH)
endfunction
function GetUnitSpellResistValue takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),SPELLRESIST_HASH)
endfunction
function GetUnitPhysResistValue takes unit whichUnit returns real
return LoadReal(udg_hash,GetHandleId(whichUnit),PHYSDMGREDUCE_HASH)
endfunction
endlibrary
library ItemHashtableUtils
globals
private constant integer FLAMEBREATHER_HASH = 600
private constant real FLAMEBREATHER_COOLDOWN = 30.
private constant real FLAMEBREATHER_PROC_CHANCE = 40.
private constant real FLAMEBREATHER_PROC_DURATION = 10.
private constant integer HUNGERING_COLD_HASH = 601
private constant real HUNGERING_COLD_COOLDOWN = 30.
private constant real HUNGERING_COLD_PROC_CHANCE = 30.
private constant integer HUNGERING_COLD_ABILCODE = 'A00G'
private constant integer TROGGBANE_HASH = 602
private constant real TROGGBANE_LIFE_STEAL = 0.5
private constant real TROGGBANE_DAMAGE_MULT = 0.2
private constant real TROGGBANE_DURATION = 10.
private constant integer KANG_HASH = 603
private constant integer KANG_ABILCODE = 'A00C'
private constant real KANG_COOLDOWN = 25.
private constant integer BLADEBREAKER_HASH = 604
private constant real BLADEBREAKER_DAMAGE = 100.
private constant real BLADEBREAKER_DOT_DURATION = 3.
private constant real BLADEBREAKER_DOT_PERIOD = 1.
private constant real BLADEBREAKER_COOLDOWN = 15.
private constant real BLADEBREAKER_PROC_CHANCE = 30.
private constant integer HEAVENS_FALL_HASH = 605
private constant real HEAVENS_FALL_DURATION = 10.
private constant real HEAVENS_FALL_BASE_HASTE = 5.
private constant real HEAVENS_FALL_LVL_HASTE = 5.
private constant integer INCINERATUS_HASH = 606
private constant real INCINERATUS_DOT_DAMAGE = 100.
private constant real INCINERATUS_DOT_DURATION = 4.
private constant real INCINERATUS_DOT_PERIOD = 1.
private constant real INCINERATUS_COOLDOWN = 15.
private constant real INCINERATUS_PROC_CHANCE = 40.
private constant integer ICECORESTAFF_HASH = 607
private constant real ICECORESTAFF_MANA = 0.0075
private constant integer MAGHARI_HASH = 608
private constant real MAGHARI_SPELLPOWER_BONUS = 50.
private constant real MAGHARI_PROC_CHANCE = 30.
private constant real MAGHARI_DURATION = 10.
private constant real MAGHARI_COOLDOWN = 30.
private constant integer SKULLFLAME_HASH = 609
private constant real SKULLFLAME_DAMAGE = 0.4
private constant integer BARRIER_HASH = 610
private constant real BARRIER_RESIST = 0.1
private constant real BARRIER_DURATION = 15.
private constant integer WALL_HASH = 611
private constant real WALL_DURATION = 10.
private constant real WALL_COOLDOWN = 2.5
private constant real WALL_BLOCK_BONUS = 10.
private constant integer SACRED_HASH = 612
private constant real SACRED_DURATION = 10.
private constant real SACRED_COOLDOWN = 2.5
private constant real SACRED_HEALING_BONUS = 0.1
private constant integer MAGMA_BREASTPLATE_HASH = 613
private constant real MAGMA_BREASTPLATE_DURATION = 10.
private constant real MAGMA_BREASTPLATE_COOLDOWN = 30.
private constant real MAGMA_BREASTPLATE_THRESHOLD = 0.45
private constant real MAGMA_BREASTPLATE_DODGE = 20.
private constant integer COLDWRAITH_PLATE_HASH = 614
private constant real COLDWRAITH_PLATE_ABSORB = 1000.
private constant real COLDWRAITH_PLATE_DURATION = 10.
private constant integer ABOMINATION_RIBCAGE_HASH = 615
private constant real ABOMINATION_RIBCAGE_BLOCK_AMOUNT = 100.
private constant real ABOMINATION_RIBCAGE_DURATION = 10.
private constant integer LIGHTBRINGER_HASH = 616
private constant real LIGHTBRINGER_RECEIVED_HEALING = 0.25
private constant real LIGHTBRINGER_DURATION = 10.
private constant integer FIREHAND_GAUNTLETS_HASH = 617
private constant integer FIREHAND_GAUNTLETS_EXPERTISE = 20
private constant real FIREHAND_GAUNTLETS_DURATION = 10.
private constant integer FROSTGIANT_GLOVES_HASH = 618
private constant real FROSTGIANT_GLOVES_DURATION = 5.
private constant real FROSTGIANT_GLOVES_COOLDOWN = 30.
private constant real FROSTGIANT_GLOVES_HP_THRESHOLD = 0.7
private constant integer DEMON_STALKER_GAUNTLETS_HASH = 619
private constant real DEMON_STALKER_GAUNTLETS_DURATION = 10.
private constant real DEMON_STALKER_GAUNTLETS_BLOCK_CHANCE = 10.
private constant integer GLOVES_HOLY_MIGHT_HASH = 620
private constant real GLOVES_HOLY_MIGHT_DURATION = 10.
private constant real GLOVES_HOLY_MIGHT_DAMAGE_CONSUMED = 0.1
private constant integer DAYBREAKER_HELM_HASH = 621
private constant real DAYBREAKER_HELM_DURATION = 10.
private constant real DAYBREAKER_HELM_DAMAGE_AMPLIFY = 0.1
private constant real DAYBREAKER_HELM_AFFECT_DURATION = 40.
private constant integer FROSTFORGED_HELM_HASH = 622
private constant real FROSTFORGED_HELM_DURATION = 10.
private constant real FROSTFORGED_HELM_COOLDOWN = 40.
private constant real FROSTFORGED_HELM_RECEIVED_HEALING_BONUS = 0.2
private constant real FROSTFORGED_HELM_HP_THRESHOLD = 0.45
private constant integer BROKEN_RAM_HELM_HASH = 623
private constant real BROKEN_RAM_HELM_DURATION = 15.
private constant real BROKEN_RAM_HELM_DAMAGE_CONSUME = 0.1
private constant integer ELDER_MOON_HELM_HASH = 624
private constant real ELDER_MOON_HELM_DURATION = 15.
private constant real ELDER_MOON_HELM_INCOMBAT_MANAREGEN = 0.3
private constant integer FROSTBROOD_SAPPHIRE_RING_HASH = 625
private constant real FROSTBROOD_SAPPHIRE_RING_DURATION = 10.
private constant real FROSTBROOD_SAPPHIRE_RING_SPELLPOWER = 50.
private constant integer TOME_OF_THE_ICE_LORD_HASH = 626
private constant real TOME_OF_THE_ICE_LORD_DURATION = 10.
private constant real TOME_OF_THE_ICE_LORD_SPELL_CRIT_POWER = 0.1
private constant real TOME_OF_THE_ICE_LORD_DAMAGE_CONSUMED = 0.25
private constant integer BOOK_OF_BINDING_WILL_HASH = 627
private constant real BOOK_OF_BINDING_WILL_SPELL_CRIT = 4.
private constant real BOOK_OF_BINDING_WILL_HP_THRESHOLD = 0.75
private constant integer BOOK_OF_HIGNBORNE_HYMNS_HASH = 628
private constant real BOOK_OF_HIGNBORNE_HYMNS_DURATION = 10.
private constant real BOOK_OF_HIGNBORNE_HYMNS_COOLDOWN = 25.
private constant real BOOK_OF_HIGNBORNE_HYMNS_ENERGY_REGEN = 0.25
private constant integer SCORCHED_SCARLET_KEY_HASH = 629
private constant integer HOLLOW_SKELETON_KEY_HASH = 630
private constant integer THE_NEXUS_KEY_HASH = 631
private constant real THE_NEXUS_KEY_DAMAGE_LVL = 300
private constant real THE_NEXUS_KEY_SPELLPOWER_LVL = 0.25
private constant integer INQUISITIONS_MASTER_KEY_HASH = 632
private constant real INQUISITIONS_MASTER_KEY_DURATION = 5.
private constant real INQUISITIONS_MASTER_KEY_COOLDOWN = 4.
private constant integer INQUISITIONS_MASTER_KEY_PROC_CHANCE = 25
private constant real INQUISITIONS_MASTER_KEY_SHIELD_HEAL_VALUE = 0.35
private constant real INQUISITIONS_MASTER_KEY_SHIELD_POWER = 0.5
private constant integer INQUISITIONS_MASTER_KEY_SHIELD_AURA = 'A08N'
private constant integer INQUISITIONS_MASTER_KEY_SHIELD_BUFF = 'B02K'
private constant integer ARCWEAVER_SPELL_SWORD_HASH = 633
private constant integer ARCWEAVER_SPELL_SWORD_LAST_DAMAGE_BONUS_HASH = 634
private constant real ARCWEAVER_SPELL_SWORD_BONUS_BASE = 0.15
private constant real ARCWEAVER_SPELL_SWORD_BONUS_LVL = 0.15
private constant integer SINISTER_RUNE_HASH = 635
private constant real SINISTER_RUNE_PROC_CHANCE = 30.
private constant real SINISTER_RUNE_DURATION = 10.
private constant real SINISTER_RUNE_INTERNAL_CD = 30.
private constant real SINISTER_RUNE_SPELL_CRIT_BONUS_PER_LEVEL = 7.
private constant integer SINISTER_RUNE_AURA = 'A09V'
private constant integer SINISTER_RUNE_BUFF = 'B036'
private constant integer SHIMMERING_RUNE_HASH = 636
private constant real SHIMMERING_RUNE_PROC_CHANCE = 30.
private constant real SHIMMERING_RUNE_DURATION = 10.
private constant real SHIMMERING_RUNE_INTERNAL_CD = 30.
private constant real SHIMMERING_RUNE_SPELL_CRIT_BONUS_PER_LEVEL = 7.
private constant integer SHIMMERING_RUNE_AURA = 'A09W'
private constant integer SHIMMERING_RUNE_BUFF = 'B037'
private constant integer PULSING_EARTH_RUNE_HASH = 637
private constant real PULSING_EARTH_RUNE_PROC_CHANCE = 30.
private constant real PULSING_EARTH_RUNE_DURATION = 10.
private constant real PULSING_EARTH_RUNE_INTERNAL_CD = 30.
private constant real PULSING_EARTH_RUNE_CRIT_BONUS_PER_LEVEL = 7.
private constant integer PULSING_EARTH_RUNE_AURA = 'A09X'
private constant integer PULSING_EARTH_RUNE_BUFF = 'B038'
private constant integer MYSTERIOUS_RUNE_HASH = 638
private constant real MYSTERIOUS_RUNE_PROC_CHANCE = 30.
private constant real MYSTERIOUS_RUNE_DURATION = 15.
private constant real MYSTERIOUS_RUNE_INTERNAL_CD = 30.
private constant real MYSTERIOUS_RUNE_DAMAGE_RETURN_MULT_PER_LEVEL = 0.5
private constant integer MYSTERIOUS_RUNE_AURA = 'A09Y'
private constant integer MYSTERIOUS_RUNE_BUFF = 'B039'
endglobals
function GetMysteriousRuneDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(MYSTERIOUS_RUNE_PROC_CHANCE)) + "% chance, while receiving physical damage, to get |cffbe8080" + I2S(R2I(MYSTERIOUS_RUNE_DAMAGE_RETURN_MULT_PER_LEVEL*100*lvl)) + "%|r physical damage return for " + I2S(R2I(MYSTERIOUS_RUNE_DURATION)) + " sec. Has a " + I2S(R2I(MYSTERIOUS_RUNE_INTERNAL_CD)) + " sec. internal cooldown."
endfunction
function GetPulsingEarthRuneDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(PULSING_EARTH_RUNE_PROC_CHANCE)) + "% chance, while attacking, to get |cffbe8080" + I2S(R2I(PULSING_EARTH_RUNE_CRIT_BONUS_PER_LEVEL*lvl)) + "%|r bonus Crit for " + I2S(R2I(PULSING_EARTH_RUNE_DURATION)) + " sec. Has a " + I2S(R2I(PULSING_EARTH_RUNE_INTERNAL_CD)) + " sec. internal cooldown."
endfunction
function GetShimmeringRuneDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(SHIMMERING_RUNE_PROC_CHANCE)) + "% chance, while healing, to get |cffbe8080" + I2S(R2I(SHIMMERING_RUNE_SPELL_CRIT_BONUS_PER_LEVEL*lvl)) + "%|r bonus Spell Crit for " + I2S(R2I(SHIMMERING_RUNE_DURATION)) + " sec. Has a " + I2S(R2I(SHIMMERING_RUNE_INTERNAL_CD)) + " sec. internal cooldown."
endfunction
function GetSinisterRuneDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(SINISTER_RUNE_PROC_CHANCE)) + "% chance, while dealing spell damage, to get |cffbe8080" + I2S(R2I(SINISTER_RUNE_SPELL_CRIT_BONUS_PER_LEVEL*lvl)) + "%|r bonus Spell Crit for " + I2S(R2I(SINISTER_RUNE_DURATION)) + " sec. Has a " + I2S(R2I(SINISTER_RUNE_INTERNAL_CD)) + " sec. internal cooldown."
endfunction
function GetArcweaverSpellSwordDescriptionByLevel takes integer lvl returns string
return "Grants |cffbe8080"+ I2S(R2I((ARCWEAVER_SPELL_SWORD_BONUS_BASE+ARCWEAVER_SPELL_SWORD_BONUS_LVL*(lvl-1)) *100.)) +"%|r of SPELL POWER as a bonus to ATTACK POWER."
endfunction
function GetInquisitionsMasterKeyDescriptionByLevel takes integer lvl returns string
return "Healing effects has a "+ I2S(INQUISITIONS_MASTER_KEY_PROC_CHANCE) +"% chance to apply a barrier shield to the target for " + I2S(R2I(INQUISITIONS_MASTER_KEY_DURATION)) + " seconds. Shield Amount equals |cffbe8080" + I2S(R2I(INQUISITIONS_MASTER_KEY_SHIELD_HEAL_VALUE*lvl*100)) +"%|r of the received healing and Shield Power is "+ I2S(R2I(INQUISITIONS_MASTER_KEY_SHIELD_POWER*100)) +"%."
endfunction
function GetTheNexusKeyDescriptionByLevel takes integer lvl returns string
return "Blasts the targeted area dealing |cffbe8080" + I2S(R2I(THE_NEXUS_KEY_DAMAGE_LVL*lvl)) +"|r + [|cffbe8080" + I2S(R2I(THE_NEXUS_KEY_SPELLPOWER_LVL*lvl*100)) + "%|r of Spellpower] |cffff00ffshadow|r damage over 5 seconds."
endfunction
function GetHollowSkeletonKeyDescriptionByLevel takes integer lvl returns string
return "Hero sacrifies 50% of its max HP with a |cffbe8080" + I2S(25*lvl) +"%|r chance to immediately leave the combat. Slows movement speed by 50% for 5 seconds after the cast."
endfunction
function GetScorchedScarletKeyDescriptionByLevel takes integer lvl returns string
return "Increases attack speed by |cffbe8080" + I2S(75*lvl) + "%|r but makes the hero receive 50% more physical and magical damage. Lasts for 5 seconds."
endfunction
function GetBookOfHighborneHymnsDescriptionByLevel takes integer lvl returns string
return "Improves hero's Energy regeneration by |cffbe8080" + I2S(R2I(BOOK_OF_HIGNBORNE_HYMNS_ENERGY_REGEN*100*lvl)) + "%|r for " + I2S(R2I(BOOK_OF_HIGNBORNE_HYMNS_DURATION)) + " sec. if his healing crits. Has a " + I2S(R2I(BOOK_OF_HIGNBORNE_HYMNS_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetBookOfBindingWillDescriptionByLevel takes integer lvl returns string
return "Improves hero's Spell Crit by |cffbe8080" + I2S(R2I(BOOK_OF_BINDING_WILL_SPELL_CRIT*lvl)) + "%|r if his hp is below " + I2S(R2I(BOOK_OF_BINDING_WILL_HP_THRESHOLD*100)) + "%|r."
endfunction
function GetTomeOfTheIceLordDescriptionByLevel takes integer lvl returns string
return "Improves hero's Spell Crit Power by |cffbe8080" + I2S(R2I(TOME_OF_THE_ICE_LORD_SPELL_CRIT_POWER*100*lvl)) + "%|r and makes him consume |cffbe8080" + I2S(R2I(TOME_OF_THE_ICE_LORD_DAMAGE_CONSUMED*100*lvl)) + "%|r of the dealed spell damage to heal himself. Lasts for " + I2S(R2I(TOME_OF_THE_ICE_LORD_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetFrostbroodSapphireRingDescriptionByLevel takes integer lvl returns string
return "Improves hero's Spell Power by |cffbe8080" + I2S(R2I(FROSTBROOD_SAPPHIRE_RING_SPELLPOWER*lvl)) + "|r for " + I2S(R2I(FROSTBROOD_SAPPHIRE_RING_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetElderMoonHelmDescriptionByLevel takes integer lvl returns string
return "Improves the in-combat mana regeneration by |cffbe8080" + I2S(R2I(ELDER_MOON_HELM_INCOMBAT_MANAREGEN*100*lvl)) + "%|r for " + I2S(R2I(ELDER_MOON_HELM_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetBrokenRamHelmDescriptionByLevel takes integer lvl returns string
return "Causes the hero to consume |cffbe8080" + I2S(R2I(BROKEN_RAM_HELM_DAMAGE_CONSUME*100*lvl)) + "%|r of taken damage into his attack (|c007EBFF1active|r)"
endfunction
function GetFrostforgedHelmDescriptionByLevel takes integer lvl returns string
return "Increases the received healing by |cffbe8080" + I2S(R2I(FROSTFORGED_HELM_RECEIVED_HEALING_BONUS*100*lvl)) + "%|r for " + I2S(R2I(FROSTFORGED_HELM_DURATION)) + " sec. every time hero's hp drops below " + I2S(R2I(FROSTFORGED_HELM_HP_THRESHOLD*100))+ "%. Has a " + I2S(R2I(FROSTFORGED_HELM_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetDaybreakerHelmDescriptionByLevel takes integer lvl returns string
return "Burns nearby enemies in 300 AOE, amplifying their damage taken by |cffbe8080" + I2S(R2I(DAYBREAKER_HELM_DAMAGE_AMPLIFY*100)) + "%|r for " + I2S(R2I(DAYBREAKER_HELM_DURATION)) + " sec. Affected units cannot be affected again in the next " + I2S(R2I(DAYBREAKER_HELM_AFFECT_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetGlovesOfHolyMightDescriptionByLevel takes integer lvl returns string
return "Creates a runic barrier for " + I2S(R2I(GLOVES_HOLY_MIGHT_DURATION)) + " sec. that converts |cffbe8080" + I2S(R2I(GLOVES_HOLY_MIGHT_DAMAGE_CONSUMED*100*lvl)) + "%|r of the taken damage into hero's mana (|c007EBFF1active|r)"
endfunction
function GetDemonStalkerGauntletsDescriptionByLevel takes integer lvl returns string
return "Increases the block chance by |cffbe8080" + I2S(R2I(DEMON_STALKER_GAUNTLETS_BLOCK_CHANCE*lvl)) + "%|r for " + I2S(R2I(DEMON_STALKER_GAUNTLETS_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetFrostgiantGlovesDescriptionByLevel takes integer lvl returns string
return "Protects the hero from critical hits for |cffbe8080" + I2S(R2I(FROSTGIANT_GLOVES_DURATION*lvl)) + "|r sec. each time his hp drops below " + I2S(R2I(FROSTGIANT_GLOVES_HP_THRESHOLD*100)) + "%. Has a " + I2S(R2I(FROSTGIANT_GLOVES_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetFirehandGauntletsDescriptionByLevel takes integer lvl returns string
return "Improves the hero expertise by |cffbe8080" + I2S(R2I(FIREHAND_GAUNTLETS_EXPERTISE*lvl)) + "|r for " + I2S(R2I(FIREHAND_GAUNTLETS_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetLightbringerChestguardDescriptionByLevel takes integer lvl returns string
return "Improves the received healing by |cffbe8080" + I2S(R2I(LIGHTBRINGER_RECEIVED_HEALING*100*lvl)) + "%|r for " + I2S(R2I(LIGHTBRINGER_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetAbominationRibcageDescriptionByLevel takes integer lvl returns string
return "Improves the block amount by |cffbe8080" + I2S(R2I(ABOMINATION_RIBCAGE_BLOCK_AMOUNT*lvl)) + "|r for " + I2S(R2I(ABOMINATION_RIBCAGE_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetColdwraithPlateDescriptionByLevel takes integer lvl returns string
return "Protets the hero by a frost barrier, which absorbs |cffbe8080" + I2S(R2I(COLDWRAITH_PLATE_ABSORB*lvl)) + "|r incoming damage (but no more than 50% of incoming damage at a time) and lasts for " + I2S(R2I(COLDWRAITH_PLATE_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetMagmaBreastplateDescriptionByLevel takes integer lvl returns string
return "Increases the dodge chance by |cffbe8080" + I2S(R2I(MAGMA_BREASTPLATE_DODGE*lvl)) + "%|r for " + I2S(R2I(MAGMA_BREASTPLATE_DURATION)) + " sec. every time hero's hp drops below " + I2S(R2I(MAGMA_BREASTPLATE_THRESHOLD*100))+ "%. Has a " + I2S(R2I(MAGMA_BREASTPLATE_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetSacredProtectorDescriptionByLevel takes integer lvl returns string
return "Improves the healing received by |cffbe8080" + I2S(R2I(SACRED_HEALING_BONUS*100*lvl)) + "|r for " + I2S(R2I(SACRED_DURATION)) + " sec. every time the hero dodges an attack. Has a " + I2S(R2I(SACRED_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetWallOfTheDeadDescriptionByLevel takes integer lvl returns string
return "Improves the block ammount by |cffbe8080" + I2S(R2I(WALL_BLOCK_BONUS*lvl)) + "|r for " + I2S(R2I(WALL_DURATION)) + " sec. at each successful block. Has a " + I2S(R2I(WALL_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetBarrierShieldDescriptionByLevel takes integer lvl returns string
return "Improves the spell resist by |cffbe8080" + I2S(R2I(BARRIER_RESIST*100*lvl)) + "%|r for " + I2S(R2I(BARRIER_DURATION)) + " sec. (|c007EBFF1active|r)"
endfunction
function GetSkullflameDescriptionByLevel takes integer lvl returns string
return "Deals |cffbe8080" + I2S(R2I(SKULLFLAME_DAMAGE*100*lvl)) + "%|r of the block amount to the attacker at each successful block."
endfunction
function GetIcecoreStaffDescriptionByLevel takes integer lvl returns string
return "Converts |cffbe8080" + R2SW(ICECORESTAFF_MANA*100*lvl,2,1) + "%|r of the dealed spell damage into hero's mana."
endfunction
function GetMaghariDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(MAGHARI_PROC_CHANCE)) + "% chance, while dealing magical damage, to get |cffbe8080" + I2S(R2I(MAGHARI_SPELLPOWER_BONUS*lvl)) + "|r bonus Spell power for " + I2S(R2I(MAGHARI_DURATION)) + " sec. Has a " + I2S(R2I(MAGHARI_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetIncineratusDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(INCINERATUS_PROC_CHANCE)) + "% chance, while dealing magical damage, to burn the target enemy for |cffbe8080" + I2S(R2I(INCINERATUS_DOT_DAMAGE*lvl)) + "|r damage per " + I2S(R2I(INCINERATUS_DOT_PERIOD)) + " sec. over " + I2S(R2I(INCINERATUS_DOT_DURATION)) + " sec. Has a " + I2S(R2I(INCINERATUS_COOLDOWN)) + " sec. internal cooldown."
endfunction
function GetHeavensFallDescriptionByLevel takes integer lvl returns string
return "Increases the haste rating by |cffbe8080" + I2S(R2I(HEAVENS_FALL_BASE_HASTE+HEAVENS_FALL_LVL_HASTE*lvl)) + "%|r. Lasts for " + I2S(R2I(HEAVENS_FALL_DURATION)) +" seconds(|c007EBFF1active|r))"
endfunction
function GetBladebreakerDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(BLADEBREAKER_PROC_CHANCE)) + "% change to apply a bleeding effect to the target, dealing |cffbe8080" + I2S(R2I(lvl*BLADEBREAKER_DAMAGE)) + "|r damage per second for "+ I2S(R2I(BLADEBREAKER_DOT_DURATION)) + " seconds. Has a " + I2S(R2I(BLADEBREAKER_COOLDOWN)) + " seconds internal cooldown."
endfunction
function GetTroggbaneDescriptionByLevel takes integer lvl returns string
return "Causes the hero to deal |cffbe8080" + I2S(100+R2I(TROGGBANE_DAMAGE_MULT*lvl*100)) + "%|r of normal damage with each attack and consume |cffbe8080" + I2S(lvl*R2I(100*TROGGBANE_LIFE_STEAL)) +"%|r of this damage to heal himself. Lasts for " + I2S(R2I(TROGGBANE_DURATION)) +" seconds(|c007EBFF1active|r)"
endfunction
function GetHungeringColdDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(HUNGERING_COLD_PROC_CHANCE)) + "% chance on attack to freeze the enemies in 350 AOE, reducing their armor by |cffbe8080" + I2S(lvl * 4) + "|r. Has a " + I2S(R2I(HUNGERING_COLD_COOLDOWN)) + " seconds internal cooldown."
endfunction
function GetFlameBreatherDescriptionByLevel takes integer lvl returns string
return "Grants a " + I2S(R2I(FLAMEBREATHER_PROC_CHANCE)) + "% chance on attack to increase the attack damage by |cffbe8080" + I2S(lvl * 100) + "|r for " + I2S(R2I(FLAMEBREATHER_PROC_DURATION)) + " seconds. Has a " + I2S(R2I(FLAMEBREATHER_COOLDOWN)) + " seconds internal cooldown."
endfunction
function GetKangDescriptionByLevel takes integer lvl returns string
return "Reduces the attack damage of enemies in 500 AOE by |cffbe8080" + I2S(10+5*lvl) + "%|r every time the hero deals a crit. Has a " + I2S(R2I(KANG_COOLDOWN)) + " seconds internal cooldown."
endfunction
//////
function GetMysteriousRuneBuff takes nothing returns integer
return MYSTERIOUS_RUNE_BUFF
endfunction
function GetMysteriousRuneAura takes nothing returns integer
return MYSTERIOUS_RUNE_AURA
endfunction
function GetMysteriousRuneDamageReturnMult takes nothing returns real
return MYSTERIOUS_RUNE_DAMAGE_RETURN_MULT_PER_LEVEL
endfunction
function GetMysteriousRuneInternalCooldown takes nothing returns real
return MYSTERIOUS_RUNE_INTERNAL_CD
endfunction
function GetMysteriousRuneDuration takes nothing returns real
return MYSTERIOUS_RUNE_DURATION
endfunction
function GetMysteriousRuneProcChance takes nothing returns real
return MYSTERIOUS_RUNE_PROC_CHANCE
endfunction
function GetMysteriousRuneHash takes nothing returns integer
return MYSTERIOUS_RUNE_HASH
endfunction
function GetPulsingEarthRuneBuff takes nothing returns integer
return PULSING_EARTH_RUNE_BUFF
endfunction
function GetPulsingEarthRuneAura takes nothing returns integer
return PULSING_EARTH_RUNE_AURA
endfunction
function GetPulsingEarthRuneCritBonus takes nothing returns real
return PULSING_EARTH_RUNE_CRIT_BONUS_PER_LEVEL
endfunction
function GetPulsingEarthRuneInternalCooldown takes nothing returns real
return PULSING_EARTH_RUNE_INTERNAL_CD
endfunction
function GetPulsingEarthRuneDuration takes nothing returns real
return PULSING_EARTH_RUNE_DURATION
endfunction
function GetPulsingEarthRuneProcChance takes nothing returns real
return PULSING_EARTH_RUNE_PROC_CHANCE
endfunction
function GetPulsingEarthRuneHash takes nothing returns integer
return PULSING_EARTH_RUNE_HASH
endfunction
function GetShimmeringRuneBuff takes nothing returns integer
return SHIMMERING_RUNE_BUFF
endfunction
function GetShimmeringRuneAura takes nothing returns integer
return SHIMMERING_RUNE_AURA
endfunction
function GetShimmeringRuneSpellCritBonus takes nothing returns real
return SHIMMERING_RUNE_SPELL_CRIT_BONUS_PER_LEVEL
endfunction
function GetShimmeringRuneInternalCooldown takes nothing returns real
return SHIMMERING_RUNE_INTERNAL_CD
endfunction
function GetShimmeringRuneDuration takes nothing returns real
return SHIMMERING_RUNE_DURATION
endfunction
function GetShimmeringRuneProcChance takes nothing returns real
return SHIMMERING_RUNE_PROC_CHANCE
endfunction
function GetShimmeringRuneHash takes nothing returns integer
return SHIMMERING_RUNE_HASH
endfunction
function GetSinisterRuneBuff takes nothing returns integer
return SINISTER_RUNE_BUFF
endfunction
function GetSinisterRuneAura takes nothing returns integer
return SINISTER_RUNE_AURA
endfunction
function GetSinisterRuneSpellCritBonus takes nothing returns real
return SINISTER_RUNE_SPELL_CRIT_BONUS_PER_LEVEL
endfunction
function GetSinisterRuneInternalCooldown takes nothing returns real
return SINISTER_RUNE_INTERNAL_CD
endfunction
function GetSinisterRuneDuration takes nothing returns real
return SINISTER_RUNE_DURATION
endfunction
function GetSinisterRuneProcChance takes nothing returns real
return SINISTER_RUNE_PROC_CHANCE
endfunction
function GetSinisterRuneHash takes nothing returns integer
return SINISTER_RUNE_HASH
endfunction
function GetArcweaverSpellSwordBonusLvl takes nothing returns real
return ARCWEAVER_SPELL_SWORD_BONUS_LVL
endfunction
function GetArcweaverSpellSwordBonusBase takes nothing returns real
return ARCWEAVER_SPELL_SWORD_BONUS_BASE
endfunction
function GetArcweaverSpellSwordLastDamageBonusHash takes nothing returns integer
return ARCWEAVER_SPELL_SWORD_LAST_DAMAGE_BONUS_HASH
endfunction
function GetArcweaverSpellSwordHash takes nothing returns integer
return ARCWEAVER_SPELL_SWORD_HASH
endfunction
function GetInquisitionsMasterKeyShieldBuff takes nothing returns integer
return INQUISITIONS_MASTER_KEY_SHIELD_BUFF
endfunction
function GetInquisitionsMasterKeyShieldAura takes nothing returns integer
return INQUISITIONS_MASTER_KEY_SHIELD_AURA
endfunction
function GetInquisitionsMasterKeyDuration takes nothing returns real
return INQUISITIONS_MASTER_KEY_DURATION
endfunction
function GetInquisitionsMasterKeyProcChance takes nothing returns integer
return INQUISITIONS_MASTER_KEY_PROC_CHANCE
endfunction
function GetInquisitionsMasterKeyShieldHealValue takes nothing returns real
return INQUISITIONS_MASTER_KEY_SHIELD_HEAL_VALUE
endfunction
function GetInquisitionsMasterKeyShieldPower takes nothing returns real
return INQUISITIONS_MASTER_KEY_SHIELD_POWER
endfunction
function GetInquisitionsMasterKeyCooldown takes nothing returns real
return INQUISITIONS_MASTER_KEY_COOLDOWN
endfunction
function GetInquisitionsMasterKeyHash takes nothing returns integer
return INQUISITIONS_MASTER_KEY_HASH
endfunction
function GetTheNexusKeySpellPower takes nothing returns real
return THE_NEXUS_KEY_SPELLPOWER_LVL
endfunction
function GetTheNexusKeyDamage takes nothing returns real
return THE_NEXUS_KEY_DAMAGE_LVL
endfunction
function GetTheNexusKeyHash takes nothing returns integer
return THE_NEXUS_KEY_HASH
endfunction
function GetHollowSkeletonKeyHash takes nothing returns integer
return HOLLOW_SKELETON_KEY_HASH
endfunction
function GetScorchedScarletKeyHash takes nothing returns integer
return SCORCHED_SCARLET_KEY_HASH
endfunction
function GetBookOfHighborneHymnsEnergyRegen takes nothing returns real
return BOOK_OF_HIGNBORNE_HYMNS_ENERGY_REGEN
endfunction
function GetBookOfHighborneHymnsCooldown takes nothing returns real
return BOOK_OF_HIGNBORNE_HYMNS_COOLDOWN
endfunction
function GetBookOfHighborneHymnsDuration takes nothing returns real
return BOOK_OF_HIGNBORNE_HYMNS_DURATION
endfunction
function GetBookOfHighborneHymnsHash takes nothing returns integer
return BOOK_OF_HIGNBORNE_HYMNS_HASH
endfunction
function GetBookOfBindingWillSpellCrit takes nothing returns real
return BOOK_OF_BINDING_WILL_SPELL_CRIT
endfunction
function GetBookOfBindingWillHpThreshold takes nothing returns real
return BOOK_OF_BINDING_WILL_HP_THRESHOLD
endfunction
function GetBookOfBindingWillHash takes nothing returns integer
return BOOK_OF_BINDING_WILL_HASH
endfunction
function GetTomeOfTheIceLordDamageConsumed takes nothing returns real
return TOME_OF_THE_ICE_LORD_DAMAGE_CONSUMED
endfunction
function GetTomeOfTheIceLordSpellCritPower takes nothing returns real
return TOME_OF_THE_ICE_LORD_SPELL_CRIT_POWER
endfunction
function GetTomeOfTheIceLordDuration takes nothing returns real
return TOME_OF_THE_ICE_LORD_DURATION
endfunction
function GetTomeOfTheIceLordHash takes nothing returns integer
return TOME_OF_THE_ICE_LORD_HASH
endfunction
function GetFrostbroodSapphireRingHash takes nothing returns integer
return FROSTBROOD_SAPPHIRE_RING_HASH
endfunction
function GetFrostbroodSapphireRingSpellPower takes nothing returns real
return FROSTBROOD_SAPPHIRE_RING_SPELLPOWER
endfunction
function GetFrostbroodSapphireRingDuration takes nothing returns real
return FROSTBROOD_SAPPHIRE_RING_DURATION
endfunction
function GetElderMoonHelmBonusInCombatRegen takes nothing returns real
return ELDER_MOON_HELM_INCOMBAT_MANAREGEN
endfunction
function GetElderMoonHelmDuration takes nothing returns real
return ELDER_MOON_HELM_DURATION
endfunction
function GetElderMoonHelmHash takes nothing returns integer
return ELDER_MOON_HELM_HASH
endfunction
function GetBrokenRamHelmDuration takes nothing returns real
return BROKEN_RAM_HELM_DURATION
endfunction
function GetBrokenRamHelmDamageConsume takes nothing returns real
return BROKEN_RAM_HELM_DAMAGE_CONSUME
endfunction
function GetBrokenRamHelmHash takes nothing returns integer
return BROKEN_RAM_HELM_HASH
endfunction
function GetFrostforgedHelmHpThreshold takes nothing returns real
return FROSTFORGED_HELM_HP_THRESHOLD
endfunction
function GetFrostforgedHelmReceivedHealingBonus takes nothing returns real
return FROSTFORGED_HELM_RECEIVED_HEALING_BONUS
endfunction
function GetFrostforgedHelmCooldown takes nothing returns real
return FROSTFORGED_HELM_COOLDOWN
endfunction
function GetFrostforgedHelmDuration takes nothing returns real
return FROSTFORGED_HELM_DURATION
endfunction
function GetFrostforgedHelmHash takes nothing returns integer
return FROSTFORGED_HELM_HASH
endfunction
function GetDaybreakerHelmAffectDuration takes nothing returns real
return DAYBREAKER_HELM_AFFECT_DURATION
endfunction
function GetDaybreakerHelmDamageAmplify takes nothing returns real
return DAYBREAKER_HELM_DAMAGE_AMPLIFY
endfunction
function GetDaybreakerHelmDuration takes nothing returns real
return DAYBREAKER_HELM_DURATION
endfunction
function GetDaybreakerHelmHash takes nothing returns integer
return DAYBREAKER_HELM_HASH
endfunction
function GetGlovesOfHolyMightDamageConsumed takes nothing returns real
return GLOVES_HOLY_MIGHT_DAMAGE_CONSUMED
endfunction
function GetGlovesOfHolyMightDuration takes nothing returns real
return GLOVES_HOLY_MIGHT_DURATION
endfunction
function GetGlovesOfHolyMightHash takes nothing returns integer
return GLOVES_HOLY_MIGHT_HASH
endfunction
function GetDemonStalkerGauntletsBlockChance takes nothing returns real
return DEMON_STALKER_GAUNTLETS_BLOCK_CHANCE
endfunction
function GetDemonStalkerGauntletsDuration takes nothing returns real
return DEMON_STALKER_GAUNTLETS_DURATION
endfunction
function GetDemonStalkerGauntletsHash takes nothing returns integer
return DEMON_STALKER_GAUNTLETS_HASH
endfunction
function GetFrostGiantGlovesHPThreshold takes nothing returns real
return FROSTGIANT_GLOVES_HP_THRESHOLD
endfunction
function GetFrostgiantGlovesCooldown takes nothing returns real
return FROSTGIANT_GLOVES_COOLDOWN
endfunction
function GetFrostgiantGlovesDuration takes nothing returns real
return FROSTGIANT_GLOVES_DURATION
endfunction
function GetFrostgiantGlovesHash takes nothing returns integer
return FROSTGIANT_GLOVES_HASH
endfunction
function GetFirehandGauntletsDuration takes nothing returns real
return FIREHAND_GAUNTLETS_DURATION
endfunction
function GetFirehandGauntletsExpertise takes nothing returns integer
return FIREHAND_GAUNTLETS_EXPERTISE
endfunction
function GetFirehandGauntletsHash takes nothing returns integer
return FIREHAND_GAUNTLETS_HASH
endfunction
function GetLightbringerChestguardHash takes nothing returns integer
return LIGHTBRINGER_HASH
endfunction
function GetLightbringerChestguardDuration takes nothing returns real
return LIGHTBRINGER_DURATION
endfunction
function GetLightbringerChestguardReceivedHealing takes nothing returns real
return LIGHTBRINGER_RECEIVED_HEALING
endfunction
function GetColdwraithPlateHash takes nothing returns integer
return COLDWRAITH_PLATE_HASH
endfunction
function GetColdwraithPlateDuration takes nothing returns real
return COLDWRAITH_PLATE_DURATION
endfunction
function GetColdwraithPlateAbsorb takes nothing returns real
return COLDWRAITH_PLATE_ABSORB
endfunction
function GetAbominationRibcageDuration takes nothing returns real
return ABOMINATION_RIBCAGE_DURATION
endfunction
function GetAbominationRibcageBlockAmount takes nothing returns real
return ABOMINATION_RIBCAGE_BLOCK_AMOUNT
endfunction
function GetAbominationRibcageHash takes nothing returns integer
return ABOMINATION_RIBCAGE_HASH
endfunction
function GetMagmaBreastplateDodge takes nothing returns real
return MAGMA_BREASTPLATE_DODGE
endfunction
function GetMagmaBreastplateThreshold takes nothing returns real
return MAGMA_BREASTPLATE_THRESHOLD
endfunction
function GetMagmaBreastplateCooldown takes nothing returns real
return MAGMA_BREASTPLATE_COOLDOWN
endfunction
function GetMagmaBreastplateDuration takes nothing returns real
return MAGMA_BREASTPLATE_DURATION
endfunction
function GetMagmaBreastplateHash takes nothing returns integer
return MAGMA_BREASTPLATE_HASH
endfunction
function GetSacredProtectorDuration takes nothing returns real
return SACRED_DURATION
endfunction
function GetSacredProtectorCooldown takes nothing returns real
return SACRED_COOLDOWN
endfunction
function GetSacredProtectorHealing takes nothing returns real
return SACRED_HEALING_BONUS
endfunction
function GetSacredProtectorHash takes nothing returns integer
return SACRED_HASH
endfunction
function GetWallOfTheDeadDuration takes nothing returns real
return WALL_DURATION
endfunction
function GetWallOfTheDeadCooldown takes nothing returns real
return WALL_COOLDOWN
endfunction
function GetWallOfTheDeadBlock takes nothing returns real
return WALL_BLOCK_BONUS
endfunction
function GetWallOfTheDeadHash takes nothing returns integer
return WALL_HASH
endfunction
function GetBarrierShieldResist takes nothing returns real
return BARRIER_RESIST
endfunction
function GetBarrierShieldDuration takes nothing returns real
return BARRIER_DURATION
endfunction
function GetBarrierShieldHash takes nothing returns integer
return BARRIER_HASH
endfunction
function GetSkullflameDamage takes nothing returns real
return SKULLFLAME_DAMAGE
endfunction
function GetSkullflameHash takes nothing returns integer
return SKULLFLAME_HASH
endfunction
function GetIncineratusHash takes nothing returns integer
return INCINERATUS_HASH
endfunction
function GetIncineratusDotDuration takes nothing returns real
return INCINERATUS_DOT_DURATION
endfunction
function GetIncineratusDotPeriod takes nothing returns real
return INCINERATUS_DOT_PERIOD
endfunction
function GetIncineratusDotDamage takes nothing returns real
return INCINERATUS_DOT_DAMAGE
endfunction
function GetIncineratusProcChance takes nothing returns real
return INCINERATUS_PROC_CHANCE
endfunction
function GetIncineratusCooldown takes nothing returns real
return INCINERATUS_COOLDOWN
endfunction
function GetIcecoreStaffHash takes nothing returns integer
return ICECORESTAFF_HASH
endfunction
function GetIcecoreStaffMana takes nothing returns real
return ICECORESTAFF_MANA
endfunction
function GetMaghariProcChance takes nothing returns real
return MAGHARI_PROC_CHANCE
endfunction
function GetMaghariHash takes nothing returns integer
return MAGHARI_HASH
endfunction
function GetMaghariCooldown takes nothing returns real
return MAGHARI_COOLDOWN
endfunction
function GetMaghariDuration takes nothing returns real
return MAGHARI_DURATION
endfunction
function GetMaghariSpellPowerBonus takes nothing returns real
return MAGHARI_SPELLPOWER_BONUS
endfunction
function GetHeavensFallLvlHaste takes nothing returns real
return HEAVENS_FALL_LVL_HASTE
endfunction
function GetHeavensFallBaseHaste takes nothing returns real
return HEAVENS_FALL_BASE_HASTE
endfunction
function GetHeavensFallDuration takes nothing returns real
return HEAVENS_FALL_DURATION
endfunction
function GetHeavensFallHash takes nothing returns integer
return HEAVENS_FALL_HASH
endfunction
function GetBladebreakerProcChance takes nothing returns real
return BLADEBREAKER_PROC_CHANCE
endfunction
function GetBladebreakerCooldown takes nothing returns real
return BLADEBREAKER_COOLDOWN
endfunction
function GetBladebreakerDotDuration takes nothing returns real
return BLADEBREAKER_DOT_DURATION
endfunction
function GetBladebreakerDotPeriod takes nothing returns real
return BLADEBREAKER_DOT_PERIOD
endfunction
function GetBladebreakerDamage takes nothing returns real
return BLADEBREAKER_DAMAGE
endfunction
function GetBladebreakerHash takes nothing returns integer
return BLADEBREAKER_HASH
endfunction
function GetKangCooldown takes nothing returns real
return KANG_COOLDOWN
endfunction
function GetKangAbil takes nothing returns integer
return KANG_ABILCODE
endfunction
function GetKangHash takes nothing returns integer
return KANG_HASH
endfunction
function GetTroggbaneDamageMult takes nothing returns real
return TROGGBANE_DAMAGE_MULT
endfunction
function GetTroggbaneLifeSteal takes nothing returns real
return TROGGBANE_LIFE_STEAL
endfunction
function GetTroggbaneDuration takes nothing returns real
return TROGGBANE_DURATION
endfunction
function GetTroggbaneHash takes nothing returns integer
return TROGGBANE_HASH
endfunction
function GetHungeringColdAbil takes nothing returns integer
return HUNGERING_COLD_ABILCODE
endfunction
function GetHungeringColdProcChance takes nothing returns real
return HUNGERING_COLD_PROC_CHANCE
endfunction
function GetHungeringColdHash takes nothing returns integer
return HUNGERING_COLD_HASH
endfunction
function GetHungeringColdCooldown takes nothing returns real
return HUNGERING_COLD_COOLDOWN
endfunction
function GetFlameBreatherProcChance takes nothing returns real
return FLAMEBREATHER_PROC_CHANCE
endfunction
function GetFlameBreatherHash takes nothing returns integer
return FLAMEBREATHER_HASH
endfunction
function GetFlameBreatherCooldown takes nothing returns real
return FLAMEBREATHER_COOLDOWN
endfunction
endlibrary
library DamageEventMethods initializer onInit
globals
//0 for physical, 1 for magical
private integer LAST_DAMAGE_TYPE = 0
//0 for non-doted, 1 for bleeding etc. See DamageOverTime library
//Todo: elemental damage
private integer DOT_TYPE = 0
private boolean ELEMENTAL = false
private boolean FROST = false
private boolean EARTH = false
private boolean FIRE = false
private boolean WATER = false
private boolean ARCANE = false
private boolean DEATH = false
private boolean SHADOW = false
private boolean LAST_DAMAGE_CAN_BE_CRITICAL = true
private string array DOT_NAMES[10]
endglobals
private function onInit takes nothing returns nothing
set DOT_NAMES[0] = "none"
set DOT_NAMES[2] = "BLEEDING"
set DOT_NAMES[1] = "BURNING"
set DOT_NAMES[3] = "FREEZING"
set DOT_NAMES[4] = "PLAGUED"
set DOT_NAMES[5] = "POISONED"
endfunction
function SetLastDamageType takes integer Type returns nothing
set LAST_DAMAGE_TYPE = Type
endfunction
function GetLastDamageType takes nothing returns string
if LAST_DAMAGE_TYPE == 0 then
return "PHYSICAL"
endif
if LAST_DAMAGE_TYPE == 1 then
return "MAGICAL"
endif
return "-1"
endfunction
function IsLastDamageShadow takes nothing returns boolean
return SHADOW
endfunction
function IsLastDamageDeath takes nothing returns boolean
return DEATH
endfunction
function IsLastDamageFrost takes nothing returns boolean
return FROST
endfunction
function IsLastDamageFire takes nothing returns boolean
return FIRE
endfunction
function IsLastDamageArcane takes nothing returns boolean
return ARCANE
endfunction
function IsLastDamageEarth takes nothing returns boolean
return EARTH
endfunction
function IsLastDamageWater takes nothing returns boolean
return WATER
endfunction
function IsLastDamageElemental takes nothing returns boolean
return ELEMENTAL
endfunction
function IsLastDamageDot takes nothing returns boolean
return DOT_TYPE > 0
endfunction
function GetLastDotType takes nothing returns string
return DOT_NAMES[DOT_TYPE]
endfunction
function DealPhysicalDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 0
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
endfunction
private function DealPhysicalDamageOverTime takes unit Dealer, unit Taker, real Damage, integer DotType returns nothing
set LAST_DAMAGE_TYPE = 0
set DOT_TYPE = DotType
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set DOT_TYPE = 0
endfunction
function IsDealedDamageAbleToCrit takes nothing returns boolean
return LAST_DAMAGE_CAN_BE_CRITICAL
endfunction
function DealMagicalDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = false
set FIRE = false
set DEATH = false
set SHADOW = false
set WATER = false
set ARCANE = false
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
endfunction
function DealMagicalDamageOfType takes unit Dealer, unit Taker, real Damage, string Type returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = false
set EARTH = false
set FIRE = false
set SHADOW = false
set WATER = false
set DEATH = false
set ARCANE = false
if Type == "FIRE" then
set FIRE = true
set ELEMENTAL = true
endif
if Type == "FROST" then
set FROST = true
set ELEMENTAL = true
endif
if Type == "EARTH" then
set EARTH = true
set ELEMENTAL = true
endif
if Type == "WATER" then
set WATER = true
set ELEMENTAL = true
endif
if Type == "DEATH" then
set DEATH = true
endif
if Type == "SHADOW" then
set SHADOW = true
endif
if Type == "ARCANE" then
set ARCANE = true
set ELEMENTAL = true
endif
if Type == "ELEMENTAL" then
set ELEMENTAL = true
endif
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = false
set EARTH = false
set FIRE = false
set DEATH = false
set WATER = false
set ARCANE = false
endfunction
private function DealMagicalDamageOverTime takes unit Dealer, unit Taker, real Damage, integer DotType returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = DotType
set ELEMENTAL = false
set FROST = false
set EARTH = false
set FIRE = false
set SHADOW = false
set WATER = false
set ARCANE = false
set DEATH = false
if DotType == 1 then
set FIRE = true
set ELEMENTAL = true
endif
if DotType == 3 then
set FROST = true
set ELEMENTAL = true
endif
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = false
set EARTH = false
set SHADOW = false
set FIRE = false
set DEATH = false
set WATER = false
set ARCANE = false
endfunction
function DealFrostDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = true
set EARTH = false
set SHADOW = false
set FIRE = false
set WATER = false
set ARCANE = false
set DEATH = false
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set FROST = false
endfunction
function DealEarthDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = false
set EARTH = true
set SHADOW = false
set FIRE = false
set WATER = false
set ARCANE = false
set DEATH = false
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set EARTH = false
endfunction
function DealFireDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = true
set FROST = false
set EARTH = false
set SHADOW = false
set FIRE = true
set WATER = false
set ARCANE = false
set DEATH = false
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set FIRE = false
endfunction
function DealWaterDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = true
set FROST = false
set EARTH = false
set SHADOW = false
set FIRE = false
set WATER = true
set ARCANE = false
set DEATH = false
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set WATER = false
endfunction
function DealArcaneDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = true
set FROST = false
set EARTH = false
set SHADOW = false
set FIRE = false
set WATER = false
set DEATH = false
set ARCANE = true
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set ARCANE = false
endfunction
function DealDeathDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = false
set EARTH = false
set SHADOW = false
set FIRE = false
set WATER = false
set DEATH = true
set ARCANE = false
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set DEATH = false
endfunction
function DealShadowDamage takes unit Dealer, unit Taker, real Damage returns nothing
set LAST_DAMAGE_TYPE = 1
set DOT_TYPE = 0
set ELEMENTAL = false
set FROST = false
set EARTH = false
set SHADOW = true
set FIRE = false
set WATER = false
set DEATH = false
set ARCANE = false
call UnitDamageTarget(Dealer,Taker,Damage,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set LAST_DAMAGE_TYPE = -1
set SHADOW = false
endfunction
function DealDotTypeDamage takes unit Dealer, unit Taker, real Damage, integer DotType returns nothing
set DOT_TYPE = DotType
if DotType==2 then
call DealPhysicalDamageOverTime(Dealer,Taker,Damage,DotType)
else
call DealMagicalDamageOverTime(Dealer,Taker,Damage,DotType)
endif
set DOT_TYPE = 0
endfunction
endlibrary
//TESH.scrollpos=523
//TESH.alwaysfold=0
library DAMAGEEVENT initializer DAMAGE_EVENT_INI requires DDBossMb,DummyCasts, AddTextTag, Angles, OutOfCombat, AkamaComboMechanics
globals
private constant integer RANGER = 'H00O'
private constant integer WOLF = 'o00B'
private constant integer HORDECHAMPION = 'O002'
private constant integer BLOODELFCAPTAIN = 'O005'
//DAMAGE VARIABLES
group DPS_GROUP = CreateGroup() //Group for dummies which deals damage per sec
group FIRE_DPS_GROUP = CreateGroup()
group ELEMENTAL_DPS_GROUP = CreateGroup()
group ONE_ATTACK_REMOVE_GROUP = CreateGroup()
group MAP_UNITS_ALIVE = CreateGroup()
trigger DAMAGE_EVENT_TRIGGER = null
real GLOBAL_MEELE_SPLASH_ANGLE = 0.
private real SPLASH_DAMAGE = 0.
private real SPLASH_PERCENT = 0.
private real SPLASH_ANGLE = 0.
private unit SPLASH_DEALER = null
private unit SPLASH_CENTER = null
private constant real EXPERTISE_SPELL_SPLASHING_RADIUS = 600.
private constant real EXPERTISE_SPELL_COEFF_FOR_SPLASHING = 0.0035
private constant real EXPERTISE_CRIT_RESIST_COEFF = 0.0035
//DAMAGE CONSTANTS
private constant integer DETECTOR_RAWCODE = 'B000' //Damage Detector Buff
constant integer ARMOR_PENETRATION = 'A02A'
private constant real ARMOR_PER_EXPERTISE = 0.2
private constant real SPLASH_DAMAGE_RADIUS = 200.
private constant string SPLASH_COLOR = "|c007EBFF1"
private constant string ENEMY_PHYS_COLOR = "|c00FF0000"
private constant string MISS_COLOR = "|cffFF0000"
private constant string BLOCK_COLOR = "|c00FF0000"
private constant string CRIT_COLOR = "|c00FF0000"
private constant string RESIST_COLOR = "|c007EBFF1"
private constant string SPELL_CRIT_COLOR = "|c001CE6B9"
private constant string SPELL_COLOR = "|c000080FF"
private constant string ENEMY_SPELL_COLOR = "|cff6f2583"
private constant string ENEMY_SPELL_CRIT_COLOR = "|cff6f2583"
private constant string ABSORB_COLOR = "|c00FFFFFF"
private constant string MAGICAL_ABSORB_COLOR = "|cffff00ff"
endglobals
private function GroupFilterEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and not BlzIsUnitInvulnerable(GetFilterUnit())
endfunction
function SplashSpellByUnitNearPoint takes unit whichUnit, real damage, real x, real y returns nothing
local group g = null
local unit tempu = null
local force tempF = null
local string TXT = ""
set tempF = CreateForce()
call ForceAddPlayer(tempF,GetOwningPlayer(whichUnit))
set udg_temp_unit = whichUnit
set g = CreateGroup()
call GroupEnumUnitsInRange(g, x, y, EXPERTISE_SPELL_SPLASHING_RADIUS, function GroupFilterEnemy)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call ForceAddPlayer(tempF,GetOwningPlayer(tempu))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\SludgeMissile\\SludgeMissile.mdl",tempu,"chest"))
call DisableTrigger(GetTriggeringTrigger())
call UnitDamageTarget(whichUnit,tempu,damage,false,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(GetTriggeringTrigger())
if GetPlayerController(GetOwningPlayer(tempu)) == MAP_CONTROL_COMPUTER then
set TXT = ENEMY_SPELL_COLOR+I2S(R2I(damage))
else
set TXT = SPELL_COLOR+I2S(R2I(damage))
endif
if IsUnitEnemy(tempu,Player(7)) then
set IS_ENEMY_TEXT = true
call AddTextTagUnit(TXT,tempu,tempF,GetRandomReal(45.,135.),10.,1.5,0.)
set IS_ENEMY_TEXT = false
else
set IS_SPELL_DAMAGE_TEXT = true
call AddTextTagUnit(TXT,tempu,tempF,GetRandomReal(45.,135.),10.,1.5,0.)
set IS_SPELL_DAMAGE_TEXT = false
endif
call GroupRemoveUnit(g,tempu)
call ForceRemovePlayer(tempF,GetOwningPlayer(tempu))
endloop
call DestroyGroup(g)
call DestroyForce(tempF)
set g = null
set tempF = null
endfunction
function fullhp takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call SetWidgetLife(u,GetUnitState(u,UNIT_STATE_MAX_LIFE))
call FlushChildHashtable(udg_hash, GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
function fullhpBlock takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real dmg = LoadReal(udg_hash,GetHandleId(t),2)
call SetWidgetLife(u, GetWidgetLife(u) + dmg + 1.)
call FlushChildHashtable(udg_hash, GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
function DamageBlock takes unit u, real dmg returns nothing
local timer t = null
local real CURRENT_HP = GetWidgetLife(u)
if CURRENT_HP <= dmg then
call SetWidgetLife(u,CURRENT_HP + dmg + 1.)
elseif CURRENT_HP >= (GetUnitState(u, UNIT_STATE_MAX_LIFE)-dmg) then
set t = CreateTimer()
call TimerStart(t,0.0,false,function fullhpBlock)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveReal(udg_hash,GetHandleId(t),2,dmg)
set t = null
else
call SetWidgetLife(u,CURRENT_HP + dmg)
endif
endfunction
function IsUnitSplashed takes location p1,location p2, real ang returns boolean
local real a = ConvertAngleTo180(AngleBetweenPoints(p1,p2))
local real k = DifferenceBetweenAngles(a,ConvertAngleTo180(ang))
if (k >= 60 and k<=-60) or (k <= 60 and k>= -60) then
return true
else
return false
endif
endfunction
function SplashConds takes nothing returns boolean
return (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 ) and (IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(SPLASH_DEALER)))
endfunction
function DealSplash takes nothing returns nothing
local unit a = GetEnumUnit()
local real curdmg = SPLASH_DAMAGE * SPLASH_PERCENT
local location p1 = GetUnitLoc(a)
local location p2 = GetUnitLoc(SPLASH_DEALER)
local force play = CreateForce()
call ForceAddPlayer(play,GetOwningPlayer(SPLASH_DEALER))
call ForceAddPlayer(play,GetOwningPlayer(a))
if (IsUnitSplashed(p1,p2,SPLASH_ANGLE+180.)) then
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(SPLASH_DEALER,a,curdmg,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
if GetPlayerController(GetOwningPlayer(SPLASH_DEALER)) == MAP_CONTROL_USER and IsUnitType(SPLASH_DEALER,UNIT_TYPE_HERO) then
call Aggro.add(a,SPLASH_DEALER,curdmg*0.05*(1.+LoadReal(udg_hash,GetHandleId(SPLASH_DEALER),29)))
endif
//Check Frostmourne buff on ATTACKER to add Frostmourne damage done
if GetUnitAbilityLevel(SPLASH_DEALER,FROSTMOURNE_BUFFCODE)>0 then
call SaveReal(udg_hash,GetHandleId(SPLASH_DEALER),FROSTMOURNE_HASHKEY_DAMAGE,LoadReal(udg_hash,GetHandleId(SPLASH_DEALER),FROSTMOURNE_HASHKEY_DAMAGE)+curdmg)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl",GetEnumUnit(),"chest"))
else
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl",GetEnumUnit(),"overhead"))
endif
if IsUnitEnemy(SPLASH_DEALER,Player(7)) then
set IS_PHYS_DAMAGE_TEXT = true
call AddTextTagUnit(SPLASH_COLOR + I2S(R2I(curdmg)) + "|r",a,play,GLOBAL_MEELE_SPLASH_ANGLE,10.,1.5,-50.)
set IS_PHYS_DAMAGE_TEXT = false
else
set IS_ENEMY_TEXT = true
call AddTextTagUnit(SPLASH_COLOR + I2S(R2I(curdmg)) + "|r",a,play,GLOBAL_MEELE_SPLASH_ANGLE,10.,1.5,-50.)
set IS_ENEMY_TEXT = false
endif
endif
call DestroyForce(play)
call RemoveLocation(p1)
call RemoveLocation(p2)
set a = null
set p1 = null
set p2 = null
set play = null
endfunction
function DealSplash_Ranged takes nothing returns nothing
local unit a = GetEnumUnit()
local real curdmg = SPLASH_DAMAGE * SPLASH_PERCENT
local force play = CreateForce()
call ForceAddPlayer(play,GetOwningPlayer(SPLASH_DEALER))
call ForceAddPlayer(play,GetOwningPlayer(a))
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(SPLASH_DEALER,a,curdmg,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
if GetPlayerController(GetOwningPlayer(SPLASH_DEALER)) == MAP_CONTROL_USER and IsUnitType(SPLASH_DEALER,UNIT_TYPE_HERO) then
call Aggro.add(a,SPLASH_DEALER,curdmg*0.05*(1.+LoadReal(udg_hash,GetHandleId(SPLASH_DEALER),29)))
endif
if IsUnitEnemy(SPLASH_DEALER,Player(7)) then
set IS_PHYS_DAMAGE_TEXT = true
call AddTextTagUnit(SPLASH_COLOR + I2S(R2I(curdmg)) + "|r",a,play,90.,10.,1.5,-50.)
set IS_PHYS_DAMAGE_TEXT = false
else
set IS_ENEMY_TEXT = true
call AddTextTagUnit(SPLASH_COLOR + I2S(R2I(curdmg)) + "|r",a,play,90.,10.,1.5,-50.)
set IS_ENEMY_TEXT = false
endif
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl",GetEnumUnit(),"overhead"))
call DestroyForce(play)
set play = null
set a = null
endfunction
function SplashDmg takes unit u,unit u2, real dmg,real persplash, real ang returns nothing
local location p = GetUnitLoc(u)
local group g = CreateGroup()
local boolexpr GROUPFILTER = Condition(function SplashConds)
set SPLASH_DEALER = u2
set SPLASH_CENTER = u
set SPLASH_DAMAGE = dmg
set SPLASH_PERCENT = persplash
set SPLASH_ANGLE = ang
if dmg > 0. then
call GroupEnumUnitsInRangeOfLoc(g,p,SPLASH_DAMAGE_RADIUS, GROUPFILTER)
call GroupRemoveUnit(g,u)
if IsUnitType(u2,UNIT_TYPE_RANGED_ATTACKER) then
call ForGroup(g,function DealSplash_Ranged)
else
call ForGroup(g,function DealSplash)
endif
endif
call DestroyGroup(g)
call DestroyBoolExpr(GROUPFILTER)
call RemoveLocation(p)
set g = null
set p = null
set GROUPFILTER = null
endfunction
function ReleaseFlame takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local integer id = LoadInteger(udg_hash,GetHandleId(t),1)
call UnitRemoveAbility(u,id)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
function DestroyEffectEnd takes nothing returns nothing
local timer t = GetExpiredTimer()
local effect e = LoadEffectHandle(udg_hash,GetHandleId(t),1)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyEffect(e)
call DestroyTimer(t)
set t = null
set e = null
endfunction
function DestroyEffectTimed takes effect e, real dur returns nothing
local timer t = CreateTimer()
call SaveEffectHandle(udg_hash,GetHandleId(t),1,e)
call TimerStart(t,dur,false,function DestroyEffectEnd)
set t = null
endfunction
function ARMOR_RESET takes nothing returns nothing
call UnitRemoveAbility(LoadUnitHandle(udg_hash,GetHandleId(GetExpiredTimer()),1),ARMOR_PENETRATION)
call RemoveSavedHandle(udg_hash,GetHandleId(LoadUnitHandle(udg_hash,GetHandleId(GetExpiredTimer()),1)),38)
call FlushChildHashtable(udg_hash,GetHandleId(GetExpiredTimer()))
call DestroyTimer(GetExpiredTimer())
endfunction
//function UnitAddMana takes unit u, real mana returns nothing
//if (GetUnitState(u,UNIT_STATE_MAX_MANA)>200.) then
//call RegenerateMana(u,mana)
//endif
//endfunction
function ApplyArmorPenetration takes unit whichUnit, real value returns nothing
if GetUnitAbilityLevel(whichUnit,ARMOR_PENETRATION) > 0 then
call SetUnitAbilityLevel(whichUnit,ARMOR_PENETRATION,GetUnitAbilityLevel(whichUnit,ARMOR_PENETRATION) + R2I(value))
call TimerStart(LoadTimerHandle(udg_hash,GetHandleId(whichUnit),38),4.,false,function ARMOR_RESET)
else
call UnitAddAbility(whichUnit,ARMOR_PENETRATION)
call SetUnitAbilityLevel(whichUnit,ARMOR_PENETRATION,R2I(value))
call SaveTimerHandle(udg_hash,GetHandleId(whichUnit),38,CreateTimer())
call TimerStart(LoadTimerHandle(udg_hash,GetHandleId(whichUnit),38),4.,false,function ARMOR_RESET)
call SaveUnitHandle(udg_hash,GetHandleId(LoadTimerHandle(udg_hash,GetHandleId(whichUnit),38)),1,whichUnit)
endif
endfunction
private function CheckBattleground takes unit ATTACKER, unit TAKER returns nothing
local boolean TAKERHERO = IsUnitAPlayerHero(TAKER)
local boolean ATTACKERHERO = IsUnitAPlayerHero(ATTACKER)
if MAGMAW_BATTLE_INITIALIZED then
if ATTACKER==udg_Magmaw and TAKERHERO then
if not IsUnitInGroup(TAKER,MAGMAW_BATTLEGROUP) then
call GroupAddUnit(MAGMAW_BATTLEGROUP,TAKER)
endif
endif
if TAKER==udg_Magmaw and ATTACKERHERO then
if not IsUnitInGroup(ATTACKER,MAGMAW_BATTLEGROUP) then
call GroupAddUnit(MAGMAW_BATTLEGROUP,ATTACKER)
endif
endif
endif
if SUPREMUS_BATTLE_INITIALIZED then
if ATTACKER==udg_Supremus and TAKERHERO then
if not IsUnitInGroup(TAKER,SUPREMUS_BATTLEGROUP) then
call GroupAddUnit(SUPREMUS_BATTLEGROUP,TAKER)
endif
endif
if TAKER==udg_Supremus and ATTACKERHERO then
if not IsUnitInGroup(ATTACKER,SUPREMUS_BATTLEGROUP) then
call GroupAddUnit(SUPREMUS_BATTLEGROUP,ATTACKER)
endif
endif
endif
if EREDARS_BATTLE_INITIALIZED then
if (ATTACKER==ARCHIMONDE or ATTACKER==KILJAEDEN) and TAKERHERO then
if not IsUnitInGroup(TAKER,EREDARS_BATTLEGROUP) then
call GroupAddUnit(EREDARS_BATTLEGROUP,TAKER)
endif
endif
if (TAKER==ARCHIMONDE or TAKER==KILJAEDEN) and ATTACKERHERO then
if not IsUnitInGroup(ATTACKER,EREDARS_BATTLEGROUP) then
call GroupAddUnit(EREDARS_BATTLEGROUP,ATTACKER)
endif
endif
endif
endfunction
function Damage_Detect_Main takes nothing returns nothing
//locals for both damage types
local unit TAKER = GetTriggerUnit()
local unit ATTACKER = GetEventDamageSource()
local player P_TAKER = GetOwningPlayer(TAKER)
local player P_ATTACKER = GetOwningPlayer(ATTACKER)
local integer ID_ATTACKER = GetHandleId(ATTACKER)
local integer ID_TAKER = GetHandleId(TAKER)
local real MIND = 90.
local real MAXD = 90.
local unit TARGET = GetTriggerUnit()
local boolean PhysAttackFullyBlocked = false
local boolean PhysAttackFullyReduced = false
local boolean PhysAttackFullyAbsorbed = false
local boolean MagicalAttackFullyAbsorbed = false
local boolean AttackCritical = false
local boolean PHYSICAL_ABILITY = false
local integer i = 0
local real CRIT = LoadReal(udg_hash,ID_ATTACKER,GetCritHash())
local real MULTIPLIER = LoadReal(udg_hash,ID_ATTACKER,GetCritMultiplierHash())
local real CRITADD = LoadReal(udg_hash,ID_TAKER,12)
local real AGGRO = LoadReal(udg_hash,ID_ATTACKER,29)
local real DAMAGE = 0.
local force TEXTFORCE = CreateForce()
local string TEXT = "|c00FFFFFF-"
local string ENEMY_CRIT = ""
local effect e = null
local timer t = null
local timer t1 = null
local unit tempunit = null
local integer HOLYMIGHT = 0
//locals for phys damage type
local real EXPERTISE = 0.
local real PENETRATION = 0. // Expertise for armor reduction on phys attack crits
local real TOUGHNESS = 0. // Expertise for damage reduction on received crit phys attacks
local real SPELL_MASTERY = 0. //Expertise for splashing spell damage on crits
local real REDUCTION = 0.
local real EVASION = 0.
local real BLOCKVALUE = 0.
local real ABSORB = 0.
local real Haste = 0.
local real Splash = 0.
local real Mortal = 0.
local real Healing = 0.
local real DmgInc = 0.
local real LIFESTEALING = 0.
local real BLOCKCHANCE = 0.
local real CHANCETOMISS = 0.
local integer FLAMEBREATHER = 0
local integer KANGTD = 0
local integer HUNGERING = 0
local integer BLADEBREAKER = 0
local integer SKULLFLAME = 0
local integer WALLOFTHEDEAD = 0
local integer SACREDSHIELD = 0
local integer MAGMAPLATE = 0
local integer FROSTGIANTS = 0
local integer SKULLRAM = 0
local integer FROSTFORGED = 0
//locals for spell damage type
local real SPELLPOWER = 0.
local real SPELL_CRIT = 0.
local real SPELL_CRIT_RECEIVED_BONUS = 0.
local real SPELL_CRIT_MULTIPLIER = 0.
local real SPELLRESIST = 0.
local integer INCINERATUS = 0
local integer ICECORE = 0
local integer MAGHARI = 0
local integer SINISTER_RUNE = 0
local integer PULSING_EARTH_RUNE = 0
local integer MYSTERIOUS_RUNE = 0
local real tempr = 0.
local real ElementalsMult = 0.
local integer STORM_ADEPT_LEVEL = 0
local real PHYS_DAMAGE_RETURN_MULTIPLIER = 0.
//BEGIN
call CheckBattleground(ATTACKER,TAKER)
call ForceAddPlayer(TEXTFORCE,GetOwningPlayer(ATTACKER))
call ForceAddPlayer(TEXTFORCE,GetOwningPlayer(TAKER))
if IsUnitType(TAKER,UNIT_TYPE_HERO) and GetPlayerController(P_TAKER)== MAP_CONTROL_USER then //MAKE TAKER HERO IN COMBAT
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Making in combat TAKER")
call MAKE_UNIT_COMBAT(TAKER)
set HOLYMIGHT = LoadInteger(udg_hash,ID_TAKER,GetGlovesOfHolyMightHash())
set SKULLRAM = LoadInteger(udg_hash,ID_TAKER,GetBrokenRamHelmHash())
set FROSTFORGED = LoadInteger(udg_hash,ID_TAKER,GetFrostforgedHelmHash())
endif
if IsUnitType(ATTACKER,UNIT_TYPE_HERO) and GetPlayerController(P_ATTACKER)== MAP_CONTROL_USER then //MAKE ATTACKER HERO IN COMBAT
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Making in combat ATTACKER")
call MAKE_UNIT_COMBAT(ATTACKER)
endif //END
//Check if the damage is physical and from ability
if GetPlayerController(P_ATTACKER)== MAP_CONTROL_USER and not (GetUnitAbilityLevel(TAKER,DETECTOR_RAWCODE)>0) then
if GetLastDamageType()=="PHYSICAL" and not IsUnitInGroup(ATTACKER,DPS_GROUP) then
set PHYSICAL_ABILITY = true
endif
endif
if IsUnitInGroup(ATTACKER,WATER_CLEANSING_DUMMIES) then
if IsUnitCarriesWater(TAKER) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\WaterElementalMissile\\WaterElementalMissile.mdl",ATTACKER,"origin"))
call KillUnit(ATTACKER)
endif
endif
if GetUnitAbilityLevel(TAKER,DETECTOR_RAWCODE)>0 or PHYSICAL_ABILITY then //PHYS DAMAGE CHECK
call UnitRemoveAbility(TAKER,DETECTOR_RAWCODE)
//Check Intervene buff on TAKER to redirect
if GetUnitAbilityLevel(TAKER,'B00A')>0 then
set tempunit = LoadUnitHandle(udg_hash,ID_TAKER,99)
if not IsUnitType(tempunit,UNIT_TYPE_DEAD) then
/*
set DAMAGE = GetEventDamage()
call BlzSetEventDamage(0)
*/
call DamageBlock(TAKER,GetEventDamage())
set TAKER = tempunit
set P_TAKER = GetOwningPlayer(TAKER)
set ID_TAKER = GetHandleId(TAKER)
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,DAMAGE,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
endif
endif
//Check PresenceOfTheLichKing buff to freeze
if GetUnitAbilityLevel(TAKER,PRESENCE_BUFFCODE)>0 then
if LoadInteger(udg_hash,ID_TAKER,PRESENCE_HASH_CHARGES)>0 then
call SaveUnitHandle(udg_hash,GetHandleId(PRESENCE_TIMER),1,ATTACKER)
call SaveUnitHandle(udg_hash,GetHandleId(PRESENCE_TIMER),2,TAKER)
call TimerStart(PRESENCE_TIMER,0.0,false,null)
endif
endif
//Check if Attacker is Shaman with Adept of the Storm talent
if GetUnitTypeId(ATTACKER)=='O003' or GetUnitTypeId(ATTACKER)=='O004' then
set STORM_ADEPT_LEVEL = LoadInteger(udg_hash,ID_ATTACKER,STORM_ADEPT_LEVEL_HASH)
if STORM_ADEPT_LEVEL > 0 then
call SaveUnitHandle(udg_hash,GetHandleId(STORM_ADEPT_TIMER),1,ATTACKER)
call SaveUnitHandle(udg_hash,GetHandleId(STORM_ADEPT_TIMER),2,TAKER)
call TimerStart(STORM_ADEPT_TIMER,0.0,false,null)
endif
endif
set REDUCTION = LoadReal(udg_hash,ID_TAKER,22)
set EVASION = LoadReal(udg_hash,ID_TAKER,1)
set BLOCKVALUE = LoadReal(udg_hash,ID_TAKER,3)
//set ABSORB = LoadReal(udg_hash,ID_TAKER,17)
set Haste = LoadReal(udg_hash,ID_ATTACKER,4)
set Splash = LoadReal(udg_hash,ID_ATTACKER,7)
set Mortal = LoadReal(udg_hash,ID_ATTACKER,8)
set Healing = LoadReal(udg_hash,ID_TAKER,9)
set DmgInc = LoadReal(udg_hash,ID_ATTACKER,10)
set LIFESTEALING = LoadReal(udg_hash,ID_ATTACKER,13)
set BLOCKCHANCE = LoadReal(udg_hash,ID_TAKER,14)
set CHANCETOMISS = LoadReal(udg_hash,ID_ATTACKER,15)
set PHYS_DAMAGE_RETURN_MULTIPLIER = LoadReal(udg_hash,ID_TAKER,GetPhysDamageReturnMultiplierHash())
if not IsUnitType(ATTACKER,UNIT_TYPE_MELEE_ATTACKER) then
set Haste = Haste * 0.5
endif
if IsUnitType(TAKER,UNIT_TYPE_HERO) then
set EXPERTISE = I2R(GetHeroAgi(TAKER,true))
if not (GetHeroClass(TAKER) == "Tanker") then
set TOUGHNESS = 0.5*EXPERTISE
else
set TOUGHNESS = EXPERTISE
endif
endif
if IsUnitType(ATTACKER,UNIT_TYPE_HERO) then
//INITIALIZATION PHYS ATTACK ITEMS
set EXPERTISE = I2R(GetHeroAgi(ATTACKER,true))
if not (GetHeroClass(ATTACKER) == "Damage Dealer") then
set PENETRATION = 0.5*EXPERTISE
else
set PENETRATION = EXPERTISE
endif
set HUNGERING = LoadInteger(udg_hash,ID_ATTACKER,GetHungeringColdHash())
set BLADEBREAKER = LoadInteger(udg_hash,ID_ATTACKER,GetBladebreakerHash())
set KANGTD = LoadInteger(udg_hash,ID_ATTACKER,GetKangHash())
set FLAMEBREATHER = LoadInteger(udg_hash,ID_ATTACKER,GetFlameBreatherHash())
set PULSING_EARTH_RUNE = LoadInteger(udg_hash,ID_ATTACKER,GetPulsingEarthRuneHash())
//ENDINI
endif
if IsUnitType(TAKER,UNIT_TYPE_HERO) then
//INITIALIZATION PHYS DEFEND ITEMS
set SKULLFLAME = LoadInteger(udg_hash,ID_TAKER,GetSkullflameHash())
set WALLOFTHEDEAD = LoadInteger(udg_hash,ID_TAKER,GetWallOfTheDeadHash())
set SACREDSHIELD = LoadInteger(udg_hash,ID_TAKER,GetSacredProtectorHash())
set MAGMAPLATE = LoadInteger(udg_hash,ID_TAKER,GetMagmaBreastplateHash())
set FROSTGIANTS = LoadInteger(udg_hash,ID_TAKER,GetFrostgiantGlovesHash())
set MYSTERIOUS_RUNE = LoadInteger(udg_hash,ID_TAKER,GetMysteriousRuneHash())
//ENDINI
endif
set TEXT = "|c00FFFFFF-"
if IsUnitType(ATTACKER,UNIT_TYPE_MELEE_ATTACKER) then
set MIND = GetUnitFacing(ATTACKER)
set MAXD = MIND
set GLOBAL_MEELE_SPLASH_ANGLE = MIND
endif
set DAMAGE = ( GetEventDamage()*(1. + DmgInc) )
if PHYSICAL_ABILITY and IsLastDamageDot() and GetLastDotType()=="BLEEDING" then
set tempr = LoadReal(udg_hash,ID_ATTACKER, GetBleedingDamageBonusHash())+LoadReal(udg_hash,ID_TAKER,GetBleedingDamageReceivedBonusHash())
if tempr > 0 then
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,DAMAGE*tempr,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE * (1 + tempr)
endif
endif
//Check Frostmourne buff on ATTACKER to trigger effects
if GetUnitAbilityLevel(ATTACKER,FROSTMOURNE_BUFFCODE)>0 then
if not LoadBoolean(udg_hash,GetHandleId(ATTACKER),FROSTMOURNE_HASHKEY_FLAG) then
call SaveBoolean(udg_hash,GetHandleId(ATTACKER),FROSTMOURNE_HASHKEY_FLAG,true)
set Splash = Splash + 0.25*GetUnitAbilityLevel(ATTACKER,FROSTMOURNE_ABILCODE)
set tempr = DAMAGE + GetUnitSpellPower(ATTACKER)*(0.125*GetUnitAbilityLevel(ATTACKER,FROSTMOURNE_ABILCODE))
if LoadInteger(udg_hash,ID_ATTACKER,INEXORABLE_ASSAULT_LEVEL_HASH)>0 then
set tempr = tempr + GetUnitSpellPower(ATTACKER)*LoadInteger(udg_hash,ID_ATTACKER,INEXORABLE_ASSAULT_LEVEL_HASH)*INEXORABLE_ASSAULT_SPELLPOWER_EFFECT_BONUS
set CRIT = CRIT + LoadInteger(udg_hash,ID_ATTACKER,INEXORABLE_ASSAULT_LEVEL_HASH)*INEXORABLE_ASSAULT_CRIT_INCREASE
endif
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,tempr-DAMAGE,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = tempr
call SaveUnitHandle(udg_hash,GetHandleId(FROSTMOURNE_TIMER),1,ATTACKER)
if LoadInteger(udg_hash,GetHandleId(ATTACKER),FROSTMOURNE_HASHKEY_CHARGES) >= 4 then
set CRIT = CRIT + 100.
endif
call TimerStart(FROSTMOURNE_TIMER,0.0,false,null)
endif
endif
//Check ChimaeraShot buff on ATTACKER
if GetUnitAbilityLevel(ATTACKER,CHIMAERASHOT_BUFFCODE)>0 and not PHYSICAL_ABILITY then
call UnitRemoveAbility(ATTACKER,CHIMAERASHOT_BUFFCODE)
call UnitRemoveAbility(ATTACKER,CHIMAERASHOT_VENOMCODE)
call SaveUnitHandle(udg_hash,GetHandleId(CHIMAERASHOT_TIMER),1,ATTACKER)
call SaveUnitHandle(udg_hash,GetHandleId(CHIMAERASHOT_TIMER),2,TAKER)
call TimerStart(CHIMAERASHOT_TIMER,0.0,false,null)
endif
//Check KillCommand buff on ATTACKER
if GetUnitAbilityLevel(ATTACKER,KILLCOMMAND_WOLFABILCODE)>0 then
set Splash = Splash + KILLCOMMAND_SPLASH*GetUnitAbilityLevel(ATTACKER,KILLCOMMAND_WOLFABILCODE)
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,KILLCOMMAND_WOLFBONUSDAMAGE*GetUnitAbilityLevel(ATTACKER,KILLCOMMAND_WOLFABILCODE),true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE + KILLCOMMAND_WOLFBONUSDAMAGE*GetUnitAbilityLevel(ATTACKER,KILLCOMMAND_WOLFABILCODE)
call SaveUnitHandle(udg_hash,GetHandleId(KILLCOMMAND_TIMER),1,ATTACKER)
call SaveUnitHandle(udg_hash,GetHandleId(KILLCOMMAND_TIMER),2,TAKER)
call TimerStart(KILLCOMMAND_TIMER,0.0,false,null)
endif
//Check Felhammer (Pit Lord) buff
if GetUnitAbilityLevel(ATTACKER,FELHAMMER_BUFFCODE)>0 then
set Splash = Splash + FELHAMMER_SPLASH
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,FELHAMMER_BONUSDAMAGE,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE + FELHAMMER_BONUSDAMAGE
call SaveUnitHandle(udg_hash,GetHandleId(FELHAMMER_TIMER),1,ATTACKER)
call SaveUnitHandle(udg_hash,GetHandleId(FELHAMMER_TIMER),2,TAKER)
call TimerStart(FELHAMMER_TIMER,0.0,false,null)
endif
//Check Legion Strike(Felguard Annihilator) buff
if GetUnitAbilityLevel(ATTACKER,LEGION_STRIKE_BUFFCODE)>0 then
set Splash = Splash + LEGION_STRIKE_SPLASH
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,LEGION_STRIKE_BONUSDAMAGE,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE + LEGION_STRIKE_BONUSDAMAGE
call SaveUnitHandle(udg_hash,GetHandleId(LEGION_STRIKE_TIMER),1,ATTACKER)
call SaveUnitHandle(udg_hash,GetHandleId(LEGION_STRIKE_TIMER),2,TAKER)
call TimerStart(LEGION_STRIKE_TIMER,0.0,false,null)
endif
//Check Punishment (Succub) buff
if GetUnitAbilityLevel(ATTACKER,PUNISHMENT_BUFFCODE)>0 then
call SaveUnitHandle(udg_hash,GetHandleId(PUNISHMENT_TIMER),1,ATTACKER)
call SaveUnitHandle(udg_hash,GetHandleId(PUNISHMENT_TIMER),2,TAKER)
call TimerStart(PUNISHMENT_TIMER,0.0,false,null)
endif
//Check Firehands (Kiljaeden) buff
if GetUnitAbilityLevel(ATTACKER,FIREHANDS_BUFFCODE)>0 then
set Splash = Splash + FIREHANDS_SPLASH
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,FIREHANDS_BONUSDAMAGE,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE + FIREHANDS_BONUSDAMAGE
call SaveUnitHandle(C3_hash,GetHandleId(FIREHANDS_TIMER),1,ATTACKER)
call SaveUnitHandle(C3_hash,GetHandleId(FIREHANDS_TIMER),2,TAKER)
call TimerStart(FIREHANDS_TIMER,0.0,false,null)
endif
//Check Null Barrier (Archimonde) buff
if GetUnitAbilityLevel(TAKER,NULLBARRIER_BUFFCODE)>0 then
call SaveUnitHandle(C3_hash,GetHandleId(NULLBARRIER_TIMER),1,ATTACKER)
call SaveUnitHandle(C3_hash,GetHandleId(NULLBARRIER_TIMER),2,TAKER)
call TimerStart(NULLBARRIER_TIMER,0.0,false,null)
endif
//Refresh Ranger last target for Wolf
if GetUnitTypeId(ATTACKER)==RANGER and not PHYSICAL_ABILITY then
call SaveUnitHandle(udg_hash,GetHandleId(LoadUnitHandle(udg_hash,ID_ATTACKER,SUMMON_WOLF_WOLFCASTERHASH)),SUMMON_WOLF_LASTRANGERTARGETHASH,TAKER)
if LoadInteger(udg_hash,ID_ATTACKER,KILLER_INSTINCT_LEVEL_HASH)>0 and GetWidgetLife(TAKER)/GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) < KILLER_INSTINCT_HP_THRESHOLD then
set CRIT = CRIT + KILLER_INSTINCT_CRIT_BONUS*LoadInteger(udg_hash,ID_ATTACKER,KILLER_INSTINCT_LEVEL_HASH)
endif
endif
//Apply killer instinct or Smell of Blood for Wolf
if GetUnitTypeId(ATTACKER) == WOLF then
if LoadInteger(udg_hash,ID_ATTACKER,KILLER_INSTINCT_LEVEL_HASH)>0 and GetWidgetLife(TAKER)/GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) < KILLER_INSTINCT_HP_THRESHOLD then
set CRIT = CRIT + KILLER_INSTINCT_CRIT_BONUS*LoadInteger(udg_hash,ID_ATTACKER,KILLER_INSTINCT_LEVEL_HASH)
endif
if LoadInteger(udg_hash,ID_ATTACKER,SMELL_OF_BLOOD_LEVEL_HASH)>0 and IsUnitDotBleeding(TAKER) then
set DAMAGE = DAMAGE * (1 + SMELL_OF_BLOOD_DAMAGE_INC*LoadInteger(udg_hash,ID_ATTACKER,SMELL_OF_BLOOD_LEVEL_HASH))
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,DAMAGE*SMELL_OF_BLOOD_DAMAGE_INC*LoadInteger(udg_hash,ID_ATTACKER,SMELL_OF_BLOOD_LEVEL_HASH),true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
endif
endif
if GetUnitTypeId(ATTACKER) == BLOODELFCAPTAIN and not PHYSICAL_ABILITY then
if GetRandomInt(0,100) <= LoadInteger(udg_hash,ID_ATTACKER,HEAVY_REPERCUSSIONS_LEVEL_HASH)*HEAVY_REPERCUSSIONS_PROC_CHANCE then
call BlzEndUnitAbilityCooldown(ATTACKER,SHIELD_SLAM_ABILCODE)
endif
endif
if REDUCTION > 0 then
if REDUCTION <= 1. then
call DamageBlock(TAKER,DAMAGE*REDUCTION)
else
call DamageBlock(TAKER,DAMAGE)
endif
set DAMAGE = DAMAGE - (DAMAGE*REDUCTION)
if DAMAGE <= 0. then
set PhysAttackFullyReduced = true
endif
elseif REDUCTION < 0 then
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TARGET,-1.*DAMAGE*REDUCTION,true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE + (-1.*DAMAGE * REDUCTION)
endif
if GetOwningPlayer(ATTACKER) == Player(7) then
set TEXT = ENEMY_PHYS_COLOR + "-"
set MAXD = MIND + 90.
set MIND = MIND - 90.
endif
if HUNGERING > 0 and not PHYSICAL_ABILITY then
if GetRandomReal(1.,100.)<=GetHungeringColdProcChance() and not HasUnitCooldownHash(ATTACKER,GetHungeringColdHash()) then
call DummyCastNonTarget(ATTACKER,GetHungeringColdAbil(),HUNGERING,"howlofterror")
call UnitAddHashCooldown(ATTACKER,GetHungeringColdHash(),GetHungeringColdCooldown())
endif
endif
if BLADEBREAKER > 0 and not PHYSICAL_ABILITY then
if GetRandomReal(1.,100.)<=GetBladebreakerProcChance() and not HasUnitCooldownHash(ATTACKER,GetBladebreakerHash()) then
call DOT(ATTACKER,TAKER,GetBladebreakerDamage()*BLADEBREAKER,GetBladebreakerDotDuration(),GetBladebreakerDotPeriod(),2,"Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl","chest",false)
call UnitAddHashCooldown(ATTACKER,GetBladebreakerHash(),GetBladebreakerCooldown())
endif
endif
if FLAMEBREATHER > 0 and not PHYSICAL_ABILITY then
if GetRandomReal(1.,100.) <= GetFlameBreatherProcChance() and not HasUnitCooldownHash(ATTACKER,GetFlameBreatherHash()) then
set t = CreateTimer()
call TimerStart(t,10.,false,function ReleaseFlame)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,ATTACKER)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl",ATTACKER,"origin"))
call UnitAddAbility(ATTACKER,'A007')
call SetUnitAbilityLevel(ATTACKER,'A007',FLAMEBREATHER)
call SaveInteger(udg_hash,GetHandleId(t),1,'A007')
call UnitAddHashCooldown(ATTACKER,GetFlameBreatherHash(),GetFlameBreatherCooldown())
endif
endif
if (GetRandomReal(1.,100.) <= Haste) and GetUnitAbilityLevel(ATTACKER,'A002') <= 0 then
call UnitAddAbility(ATTACKER,'A002')
set MIND = 45
set MAXD = 135
if GetUnitTypeId(ATTACKER)=='O00C' then
call AddAkamaComboLevel(TAKER,1,6)
endif
else
call UnitRemoveAbility(ATTACKER,'A002')
endif
if Mortal>0. then
call AddHeroParameter(TAKER,-Mortal,5.,9,"","")
call AddHeroParameter(ATTACKER,-Mortal,5.,8,"","")
endif
if DAMAGE > 0. then
if (GetRandomReal(1.,100.) <= EVASION + CHANCETOMISS) and GetUnitAbilityLevel(ATTACKER,'B004')<=0 then
set TEXT = MISS_COLOR + "miss|r"
set TARGET = ATTACKER
call DamageBlock(TAKER,DAMAGE)
set DAMAGE = 0.
if SACREDSHIELD > 0 then
if not HasUnitCooldownHash(TAKER,GetSacredProtectorHash()) then
call AddHeroParameter(TAKER,SACREDSHIELD,10.,9,"Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl","overhead")
call UnitAddHashCooldown(TAKER,GetSacredProtectorHash(),GetSacredProtectorCooldown())
endif
endif
elseif (GetRandomReal(1.,100.) <= CRIT + CRITADD) and (GetUnitAbilityLevel(TAKER,'A030') <= 0) and IsDealedDamageAbleToCrit() then
if TOUGHNESS > 0. then
set MULTIPLIER = MULTIPLIER - EXPERTISE_CRIT_RESIST_COEFF * TOUGHNESS
if MULTIPLIER < -1. then
set MULTIPLIER = -1.
endif
endif
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,DAMAGE*(1.+MULTIPLIER),true,false, ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
if GetPlayerController(P_ATTACKER) == MAP_CONTROL_USER then
set TEXT ="<" + TEXT + CRIT_COLOR + I2S( R2I((2.0 + MULTIPLIER) * DAMAGE) ) + "|r>"
set AttackCritical = true
else
set ENEMY_CRIT = "!"
endif
set DAMAGE = DAMAGE * (2.+MULTIPLIER)
if GetUnitTypeId(ATTACKER)=='O00C' and (not PHYSICAL_ABILITY) then
call AddAkamaComboLevel(TAKER,1,6)
endif
//Checking for deep wounds
if GetUnitTypeId(ATTACKER)==HORDECHAMPION and not IS_BLOOD_HURRICANE_DAMAGE then
if LoadInteger(udg_hash,ID_ATTACKER,DEEP_WOUNDS_LEVEL_HASH) > 0 then
call AUTODOT(ATTACKER,TAKER,DAMAGE*(DEEP_WOUNDS_BLEED_DAMAGE*LoadInteger(udg_hash,ID_ATTACKER,DEEP_WOUNDS_LEVEL_HASH)),DEEP_WOUNDS_BLEED_DURATION,DEEP_WOUNDS_BLEED_PERIOD,2,"Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl","chest",false)
endif
endif
if GetUnitAbilityLevel(ATTACKER,'B001') > 0 and not PHYSICAL_ABILITY then
call AddHeroParameter(ATTACKER,0.1*I2R(GetUnitAbilityLevel(ATTACKER,'A003')),10.,6,"none","none")
endif
if KANGTD > 0 then
if not HasUnitCooldownHash(ATTACKER,GetKangHash()) then
call DummyCastNonTarget(ATTACKER,GetKangAbil(),KANGTD,"howlofterror")
call UnitAddHashCooldown(ATTACKER,GetKangHash(),GetKangCooldown())
endif
endif
if PENETRATION > 0. and not PHYSICAL_ABILITY then
if GetUnitAbilityLevel(TAKER,ARMOR_PENETRATION) > 0 then
if GetRandomReal(1.,100.) <= 30. then
call SetUnitAbilityLevel(TAKER,ARMOR_PENETRATION,GetUnitAbilityLevel(TAKER,ARMOR_PENETRATION) + R2I(PENETRATION * 0.2))
call TimerStart(LoadTimerHandle(udg_hash,ID_TAKER,38),5.,false,function ARMOR_RESET)
endif
else
call UnitAddAbility(TAKER,ARMOR_PENETRATION)
call SetUnitAbilityLevel(TAKER,ARMOR_PENETRATION,R2I(PENETRATION * 0.2))
call SaveTimerHandle(udg_hash,ID_TAKER,38,CreateTimer())
call TimerStart(LoadTimerHandle(udg_hash,ID_TAKER,38),5.,false,function ARMOR_RESET)
call SaveUnitHandle(udg_hash,GetHandleId(LoadTimerHandle(udg_hash,ID_TAKER,38)),1,TAKER)
endif
endif
else
if DmgInc > 0. then
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,DAMAGE + BLOCKVALUE - GetEventDamage(),true,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
endif
endif
endif
set ABSORB = UnitShield.Block(TAKER,DAMAGE,0)
if ABSORB > 0. and DAMAGE>0. then
if ABSORB >= DAMAGE then
call DamageBlock(TAKER,DAMAGE)
set DAMAGE = 0.
set PhysAttackFullyAbsorbed = true
else
call DamageBlock(TAKER,ABSORB)
set DAMAGE = DAMAGE - ABSORB
endif
endif
if GetRandomReal(1.,100.) <= BLOCKCHANCE and BLOCKVALUE > 0. and DAMAGE > 0. then
if BLOCKVALUE > DAMAGE then
call DamageBlock(TAKER,DAMAGE)
set DAMAGE = 0.
set PhysAttackFullyBlocked = true
else
call DamageBlock(TAKER,BLOCKVALUE)
set DAMAGE = DAMAGE - BLOCKVALUE
endif
if SKULLFLAME > 0 then
call DealPhysicalDamage(TAKER,ATTACKER,BLOCKVALUE*SKULLFLAME*GetSkullflameDamage())
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\GyroCopter\\GyroCopterMissile.mdl",ATTACKER,"head"))
endif
if WALLOFTHEDEAD > 0 then
if not HasUnitCooldownHash(TAKER,GetWallOfTheDeadHash()) then
call AddHeroParameter(TAKER,WALLOFTHEDEAD*GetWallOfTheDeadBlock(),GetWallOfTheDeadDuration(),GetBlockAmountHash(),"none","none")
call UnitAddHashCooldown(TAKER,GetWallOfTheDeadHash(),GetWallOfTheDeadCooldown())
endif
endif
endif
if DAMAGE > 0. then
if not AttackCritical then
set TEXT = TEXT + I2S(R2I(DAMAGE)) + ENEMY_CRIT
endif
if Splash > 0. and not PHYSICAL_ABILITY then
call SplashDmg(TAKER,ATTACKER,DAMAGE,Splash,GetUnitFacing(ATTACKER))
endif
if LIFESTEALING > 0. and not PHYSICAL_ABILITY then
call HealUnit(ATTACKER,ATTACKER,DAMAGE*LIFESTEALING)
if not IS_BLOOD_HURRICANE_DAMAGE then
call DestroyEffectTimed(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl",ATTACKER,"chest"),1.)
endif
endif
call SaveReal(udg_hash,ID_ATTACKER,21,DAMAGE)
endif
if PhysAttackFullyReduced then
set TEXT = "|c00FFFF80immune|r"
elseif PhysAttackFullyBlocked then
set TEXT = BLOCK_COLOR + "block|r"
elseif PhysAttackFullyAbsorbed then
set TEXT = "|c00FFFFFFabsorb|r"
endif
if MAGMAPLATE > 0 then
if GetWidgetLife(TAKER) - DAMAGE <= GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) * GetMagmaBreastplateThreshold() and not HasUnitCooldownHash(TAKER,GetMagmaBreastplateHash()) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdl",TAKER,"origin"))
call AddHeroParameter(TAKER,GetMagmaBreastplateDodge()*MAGMAPLATE,GetMagmaBreastplateDuration(),GetEvasionHash(),"Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkTarget.mdl","chest")
call UnitAddHashCooldown(TAKER,GetMagmaBreastplateHash(),GetMagmaBreastplateCooldown())
endif
endif
if FROSTGIANTS > 0 then
if GetWidgetLife(TAKER) - DAMAGE <= GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) * GetFrostGiantGlovesHPThreshold() and not HasUnitCooldownHash(TAKER,GetFrostgiantGlovesHash()) then
set IHP_ABI = 'A030'
set IHP_BUFFER = 'B00S'
call AddHeroParameter(TAKER,0.,GetFrostgiantGlovesDuration()*FROSTGIANTS,0,"","")
call UnitAddHashCooldown(TAKER,GetFrostgiantGlovesHash(),GetFrostgiantGlovesCooldown())
endif
endif
if HOLYMIGHT > 0 and GetUnitAbilityLevel(TAKER,'A02Z') > 0 then
call RegenerateMana(TAKER,DAMAGE*GetGlovesOfHolyMightDamageConsumed()*HOLYMIGHT)
endif
if SKULLRAM > 0 and GetUnitAbilityLevel(TAKER,'A036') > 0 then
call SetUnitAbilityLevel(TAKER,'A036',GetUnitAbilityLevel(TAKER,'A036') + R2I(SKULLRAM*GetBrokenRamHelmDamageConsume()*DAMAGE/5.))
endif
if FROSTFORGED > 0 then
if GetWidgetLife(TAKER) - DAMAGE <= GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) * GetFrostforgedHelmHpThreshold() and not HasUnitCooldownHash(TAKER,GetFrostforgedHelmHash()) then
set IHP_ABI = 'A037'
set IHP_BUFFER = 'B00V'
call AddHeroParameter(TAKER,FROSTFORGED*GetFrostforgedHelmReceivedHealingBonus(),GetFrostforgedHelmDuration(),GetReceivedHealingBonusHash(),"","")
call UnitAddHashCooldown(TAKER,GetFrostforgedHelmHash(),GetFrostforgedHelmCooldown())
endif
endif
if PULSING_EARTH_RUNE > 0 then
if GetRandomReal(1.,100.) <= GetPulsingEarthRuneProcChance() and not HasUnitCooldownHash(ATTACKER,GetPulsingEarthRuneHash()) then
call SetAddHeroParameterAuraBuff(GetPulsingEarthRuneAura(), GetPulsingEarthRuneBuff())
call AddHeroParameter(ATTACKER,PULSING_EARTH_RUNE*GetPulsingEarthRuneCritBonus(),GetPulsingEarthRuneDuration(),GetCritHash(),"","")
call UnitAddHashCooldown(ATTACKER,GetPulsingEarthRuneHash(),GetPulsingEarthRuneInternalCooldown())
endif
endif
if PHYS_DAMAGE_RETURN_MULTIPLIER > 0 then
call DealMagicalDamage(TAKER, ATTACKER, DAMAGE*PHYS_DAMAGE_RETURN_MULTIPLIER)
endif
if MYSTERIOUS_RUNE > 0 then
if GetRandomReal(1.,100.) <= GetMysteriousRuneProcChance() and not HasUnitCooldownHash(TAKER,GetMysteriousRuneHash()) then
call SetAddHeroParameterAuraBuff(GetMysteriousRuneAura(), GetMysteriousRuneBuff())
call AddHeroParameter(TAKER,MYSTERIOUS_RUNE*GetMysteriousRuneDamageReturnMult(),GetMysteriousRuneDuration(),GetPhysDamageReturnMultiplierHash(),"","")
call UnitAddHashCooldown(TAKER,GetMysteriousRuneHash(),GetMysteriousRuneInternalCooldown())
endif
endif
if not IS_BLOOD_HURRICANE_DAMAGE then
if IsUnitEnemy(TARGET,Player(7)) then
set IS_ENEMY_TEXT = true
call AddTextTagUnit(TEXT,TARGET,TEXTFORCE,GetRandomReal(MIND,MAXD),10.,1.5,-50.)
set IS_ENEMY_TEXT = false
else
set IS_PHYS_DAMAGE_TEXT = true
call AddTextTagUnit(TEXT,TARGET,TEXTFORCE,GetRandomReal(MIND,MAXD),10.,1.5,-50.)
set IS_PHYS_DAMAGE_TEXT = false
endif
endif
//Check if Horde Champion and add rage
if GetUnitTypeId(ATTACKER)==HORDECHAMPION or GetUnitTypeId(ATTACKER)==BLOODELFCAPTAIN and DAMAGE>0. then
if PHYSICAL_ABILITY then
call RegenerateRage(ATTACKER,0.01*DAMAGE*0.25)
else
call RegenerateRage(ATTACKER,0.01*DAMAGE)
endif
endif
if GetUnitTypeId(TAKER)==BLOODELFCAPTAIN and DAMAGE>0. then
call RegenerateRage(TAKER,0.01*DAMAGE*0.5)
endif
//Check Frostmourne buff on ATTACKER to add Frostmourne damage done
if GetUnitAbilityLevel(ATTACKER,FROSTMOURNE_BUFFCODE)>0 then
call SaveReal(udg_hash,GetHandleId(ATTACKER),FROSTMOURNE_HASHKEY_DAMAGE,LoadReal(udg_hash,GetHandleId(ATTACKER),FROSTMOURNE_HASHKEY_DAMAGE)+DAMAGE)
endif
if GetUnitTypeId(ATTACKER)=='O00C' and (not PHYSICAL_ABILITY) then
call AddAkamaComboLevel(TAKER,1,3)
call RegenerateEnergy(ATTACKER,GetUnitAbilityLevel(TAKER,AKAMA_COMBO_ABILCODE))
endif
//----------------------------------------------------------------------------------------------------------
else //Begining of Spell Damage Actions
call UnitRemoveAbility(ATTACKER,'A002') //Remove Haste AS bonus buff to prevent some bugs with multishot abilities
set SPELLRESIST = LoadReal(udg_hash,ID_TAKER,GetSpellResistHash())
set SPELL_CRIT = LoadReal(udg_hash,ID_ATTACKER,GetSpellCritHash())
set SPELL_CRIT_RECEIVED_BONUS = LoadReal(udg_hash,ID_TAKER,GetSpellCritReceivedBonusHash())
set SPELL_CRIT_MULTIPLIER = LoadReal(udg_hash,ID_TAKER,GetSpellCritMultiplierHash())
if IsUnitType(ATTACKER,UNIT_TYPE_HERO) then
//INI SPELL COMBAT ITEMS
set EXPERTISE = I2R(GetHeroAgi(ATTACKER,true))
if not (GetHeroClass(ATTACKER) == "Mage") then
set SPELL_MASTERY = 0.5*EXPERTISE
else
set SPELL_MASTERY = EXPERTISE
endif
set INCINERATUS = LoadInteger(udg_hash,ID_ATTACKER,GetIncineratusHash())
set ICECORE = LoadInteger(udg_hash,ID_ATTACKER,GetIcecoreStaffHash())
set MAGHARI = LoadInteger(udg_hash,ID_ATTACKER,GetMaghariHash())
set SINISTER_RUNE = LoadInteger(udg_hash,ID_ATTACKER,GetSinisterRuneHash())
//ENDINI
endif
set DAMAGE = GetEventDamage()
if IsLastDamageElemental() or IsUnitInGroup(ATTACKER,ELEMENTAL_DPS_GROUP) then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetElementalDamageBonusHash())
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_TAKER,GetElementalDamageReceivedBonusHash())
endif
if IsLastDamageFire() or IsUnitInGroup(ATTACKER,FIRE_DPS_GROUP) then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetFireDamageBonusHash())
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_TAKER,GetFireDamageReceivedBonusHash())
endif
if IsLastDamageFrost() then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetFrostDamageBonusHash())
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_TAKER,GetFireDamageReceivedBonusHash())
endif
if IsLastDamageWater() then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetWaterDamageBonusHash())
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_TAKER,GetWaterDamageReceivedBonusHash())
endif
if IsLastDamageEarth() then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetEarthDamageBonusHash())
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_TAKER,GetEarthDamageReceivedBonusHash())
endif
if IsLastDamageArcane() then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetArcaneDamageBonusHash())
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_TAKER,GetArcaneDamageReceivedBonusHash())
endif
if IsLastDamageDot() then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetPeriodicDamageBonusHash())
endif
if IsUnitDoted(TAKER) then
set ElementalsMult = ElementalsMult + LoadReal(udg_hash,ID_ATTACKER,GetDotedUnitsSpellDamageBonusHash())
endif
if ElementalsMult>0. then
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,DAMAGE*ElementalsMult,false,true,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE * (1 + ElementalsMult)
endif
if IsUnitInGroup(ATTACKER,DPS_GROUP) then
set SPELLPOWER = LoadReal(udg_hash,ID_ATTACKER,5)
set DAMAGE = DAMAGE + SPELLPOWER
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,SPELLPOWER,false,true,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
endif
if INCINERATUS > 0 then
if GetRandomReal(1.,100.) <= GetIncineratusProcChance() and not HasUnitCooldownHash(ATTACKER,GetIncineratusHash()) then
call DOT(ATTACKER,TAKER,INCINERATUS*GetIncineratusDotDamage(),GetIncineratusDotDuration(),GetIncineratusDotPeriod(),1,"Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl","chest",false)
call UnitAddHashCooldown(ATTACKER,GetIncineratusHash(),GetIncineratusCooldown())
endif
endif
if MAGHARI > 0 then
if GetRandomReal(1.,100.) <= GetMaghariProcChance() and not HasUnitCooldownHash(ATTACKER,GetMaghariHash()) then
call AddHeroParameter(ATTACKER,MAGHARI*GetMaghariSpellPowerBonus(),GetMaghariDuration(),GetSpellPowerHash(),"Abilities\\Spells\\Other\\Drain\\ManaDrainCaster.mdl","overhead")
call UnitAddHashCooldown(ATTACKER,GetMaghariHash(),GetMaghariCooldown())
endif
endif
if SINISTER_RUNE > 0 then
if GetRandomReal(1.,100.) <= GetSinisterRuneProcChance() and not HasUnitCooldownHash(ATTACKER,GetSinisterRuneHash()) then
call SetAddHeroParameterAuraBuff(GetSinisterRuneAura(), GetSinisterRuneBuff())
call AddHeroParameter(ATTACKER,SINISTER_RUNE*GetSinisterRuneSpellCritBonus(),GetSinisterRuneDuration(),GetSpellCritHash(),"","")
call UnitAddHashCooldown(ATTACKER,GetSinisterRuneHash(),GetSinisterRuneInternalCooldown())
endif
endif
if SPELLRESIST > 0. then
if SPELLRESIST <= 1. then
call DamageBlock(TAKER,DAMAGE*SPELLRESIST)
set DAMAGE = DAMAGE - (DAMAGE*SPELLRESIST)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"DamageResisted: " + R2S(DAMAGE*SPELLRESIST) + ". Remained damage: " + R2S(DAMAGE) )
else
call DamageBlock(TAKER,DAMAGE)
set DAMAGE = 0.
endif
elseif SPELLRESIST < 0. then
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,-1.*DAMAGE*SPELLRESIST,false,true,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE = DAMAGE +(-1.*DAMAGE*SPELLRESIST)
endif
set ABSORB = UnitShield.Block(TAKER,DAMAGE,1)
if ABSORB > 0. and DAMAGE>0. then
if ABSORB >= DAMAGE then
call DamageBlock(TAKER,DAMAGE)
set DAMAGE = 0.
set MagicalAttackFullyAbsorbed = true
else
call DamageBlock(TAKER,ABSORB)
set DAMAGE = DAMAGE - ABSORB
endif
endif
if DAMAGE <= 0. then
if SPELLRESIST>0. then
set TEXT = RESIST_COLOR + "resist|r"
endif
if MagicalAttackFullyAbsorbed then
set TEXT = MAGICAL_ABSORB_COLOR + "absorbed|r"
endif
else
if GetRandomReal(1.,100.)<=SPELL_CRIT+SPELL_CRIT_RECEIVED_BONUS and DAMAGE>0. and IsDealedDamageAbleToCrit() then
set DAMAGE = (2.0+SPELL_CRIT_MULTIPLIER)*DAMAGE
if GetPlayerController(P_ATTACKER) == MAP_CONTROL_COMPUTER then
set TEXT = "<"+ENEMY_SPELL_CRIT_COLOR+I2S(R2I(DAMAGE))+">"
else
set TEXT = "<"+SPELL_CRIT_COLOR+I2S(R2I(DAMAGE))+">"
endif
set AttackCritical = true
call DisableTrigger(DAMAGE_EVENT_TRIGGER)
call UnitDamageTarget(ATTACKER,TAKER,DAMAGE*(1.+MULTIPLIER),false,false,ATTACK_TYPE_CHAOS,null,null)
call EnableTrigger(DAMAGE_EVENT_TRIGGER)
if SPELL_MASTERY > 0. then
call SplashSpellByUnitNearPoint(ATTACKER,EXPERTISE_SPELL_COEFF_FOR_SPLASHING*SPELL_MASTERY*DAMAGE,GetUnitX(TAKER),GetUnitY(TAKER))
endif
endif
endif
if ICECORE > 0 then
call RegenerateMana(ATTACKER,DAMAGE*ICECORE*GetIcecoreStaffMana())
endif
if HOLYMIGHT > 0 and GetUnitAbilityLevel(TAKER,'A02Z') > 0 then
call RegenerateMana(TAKER,DAMAGE*GetGlovesOfHolyMightDamageConsumed()*HOLYMIGHT)
endif
if SKULLRAM > 0 and GetUnitAbilityLevel(TAKER,'A036') > 0 then
call SetUnitAbilityLevel(TAKER,'A036',GetUnitAbilityLevel(TAKER,'A036') + R2I(SKULLRAM*GetBrokenRamHelmDamageConsume()*DAMAGE/5.))
endif
if FROSTFORGED > 0 then
if GetWidgetLife(TAKER) - DAMAGE <= GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) * GetFrostforgedHelmHpThreshold() and not HasUnitCooldownHash(TAKER,GetFrostforgedHelmHash()) then
set IHP_ABI = 'A037'
set IHP_BUFFER = 'B00V'
call AddHeroParameter(TAKER,FROSTFORGED*GetFrostforgedHelmReceivedHealingBonus(),GetFrostforgedHelmDuration(),GetReceivedHealingBonusHash(),"","")
call UnitAddHashCooldown(TAKER,GetFrostforgedHelmHash(),GetFrostforgedHelmCooldown())
endif
endif
if GetUnitAbilityLevel(ATTACKER,TOME_OF_THE_ICE_LORD_BUFF)>0 then
call HealUnit(ATTACKER,ATTACKER, DAMAGE*GetTomeOfTheIceLordDamageConsumed()*LoadInteger(udg_hash,ID_ATTACKER,GetTomeOfTheIceLordHash()))
endif
if not AttackCritical and DAMAGE > 0. then
if GetPlayerController(P_ATTACKER) == MAP_CONTROL_COMPUTER then
set TEXT = ENEMY_SPELL_COLOR+I2S(R2I(DAMAGE))
else
set TEXT = SPELL_COLOR+I2S(R2I(DAMAGE))
endif
endif
if IsUnitEnemy(TAKER,Player(7)) then
set IS_ENEMY_TEXT = true
call AddTextTagUnit(TEXT,TAKER,TEXTFORCE,GetRandomReal(MIND,MAXD),10.,1.5,0.)
set IS_ENEMY_TEXT = false
else
set IS_SPELL_DAMAGE_TEXT = true
call AddTextTagUnit(TEXT,TAKER,TEXTFORCE,GetRandomReal(MIND,MAXD),10.,1.5,0.)
set IS_SPELL_DAMAGE_TEXT = false
endif
call DestroyForce(TEXTFORCE)
endif
if GetWidgetLife(TAKER) <= DAMAGE and GetUnitAbilityLevel(TAKER,GUARDIAN_SPIRIT_BUFFCODE) > 0 then
call BlzSetEventDamage(0.)
call SetUnitState(TAKER,UNIT_STATE_LIFE,GetUnitState(TAKER,UNIT_STATE_MAX_LIFE)*GUARDIAN_SPIRIT_LIFE_PERCENT)
call UnitRemoveAbility(TAKER,GUARDIAN_SPIRIT_AURACODE)
call UnitRemoveAbility(TAKER,GUARDIAN_SPIRIT_BUFFCODE)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl",TAKER,"origin"))
endif
if GetPlayerController(P_ATTACKER) == MAP_CONTROL_USER and IsUnitType(ATTACKER,UNIT_TYPE_HERO) then
if not (GetUnitAbilityLevel(ATTACKER,ENVELOPING_MIST_BUFF_CODE)>0) then
call Aggro.add(TAKER,ATTACKER,DAMAGE*0.05*(1.+AGGRO))
endif
endif
if GetPlayerController(P_ATTACKER) == MAP_CONTROL_COMPUTER and not (GetUnitAbilityLevel(ATTACKER,'Aloc')>0.) then
if Aggro.target(ATTACKER) == TAKER then
call Aggro.add(ATTACKER,TAKER,0.)
endif
endif
if GetPlayerController(P_ATTACKER) == MAP_CONTROL_USER then
call AddDamageDoneMB(P_ATTACKER, DAMAGE)
endif
//Clearing-------------------------------------------------------------------
call SetLastDamageType(-1)
call DestroyForce(TEXTFORCE)
set TEXTFORCE = null
set tempunit = null
set ATTACKER = null
set P_TAKER = null
set P_ATTACKER = null
set TAKER = null
set TARGET = null
set t = null
set t1 = null
set e = null
endfunction
function Damage_Detect_Conds takes nothing returns boolean
if IsUnitInGroup(GetEventDamageSource(),ONE_ATTACK_REMOVE_GROUP) then
call GroupRemoveUnit(ONE_ATTACK_REMOVE_GROUP,GetEventDamageSource())
call RemoveUnit(GetEventDamageSource())
return false
endif
return GetEventDamage()>1. and not IsUnitInGroup(GetEventDamageSource(), udg_Dummy_Group) and not IsUnitType(GetTriggerUnit(),UNIT_TYPE_DEAD)
endfunction
function REGISTER_UNIT_EVENT takes nothing returns nothing
call TriggerRegisterUnitEvent( DAMAGE_EVENT_TRIGGER, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
call TriggerRegisterUnitEvent( HEALEVENT_TRIGGER, GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call GroupAddUnit(MAP_UNITS_ALIVE,GetTriggerUnit())
call UnitAddAbility(GetTriggerUnit(),'Aave')
call UnitRemoveAbility(GetTriggerUnit(),'Aave')
endfunction
private function RegisterUnitsAlive takes nothing returns nothing
call TriggerRegisterUnitEvent( DAMAGE_EVENT_TRIGGER, GetEnumUnit(), EVENT_UNIT_DAMAGED )
endfunction
function RefreshDamageEventTrigger takes nothing returns nothing
call DestroyTrigger(DAMAGE_EVENT_TRIGGER)
set DAMAGE_EVENT_TRIGGER = CreateTrigger()
call TriggerAddAction(DAMAGE_EVENT_TRIGGER, function Damage_Detect_Main)
call TriggerAddCondition(DAMAGE_EVENT_TRIGGER,Filter(function Damage_Detect_Conds))
call ForGroup(MAP_UNITS_ALIVE,function RegisterUnitsAlive)
endfunction
function DAMAGE_EVENT_INI takes nothing returns nothing
local trigger t = CreateTrigger()
local region rectRegion = CreateRegion()
call RegionAddRect(rectRegion, bj_mapInitialPlayableArea)
call TriggerRegisterEnterRegion(t,rectRegion,null)
call TriggerAddAction(t,function REGISTER_UNIT_EVENT)
set t = null
set rectRegion = null
//MAIN TRIGGER
set DAMAGE_EVENT_TRIGGER = CreateTrigger()
call TriggerAddAction(DAMAGE_EVENT_TRIGGER, function Damage_Detect_Main)
call TriggerAddCondition(DAMAGE_EVENT_TRIGGER,Filter(function Damage_Detect_Conds))
endfunction
endlibrary
library HealingEventMethods initializer onInit
globals
private boolean PERIODIC = false
private boolean LIFESTEALING = false
endglobals
private function onInit takes nothing returns nothing
endfunction
function IsLastHealingPeriodic takes nothing returns boolean
return PERIODIC
endfunction
function HealUnit takes unit Healer, unit Target, real Healing returns nothing
set PERIODIC = false
set LIFESTEALING = false
call UnitDamageTarget(Healer,Target,-1*Healing,false,false,ATTACK_TYPE_NORMAL,null,null)
endfunction
function HealUnitPeriodic takes unit Healer, unit Target, real Healing returns nothing
set PERIODIC = true
set LIFESTEALING = false
call UnitDamageTarget(Healer,Target,-1*Healing,false,false,ATTACK_TYPE_NORMAL,null,null)
set PERIODIC = false
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library HealingEvent initializer onInit requires HDBossMb, OutOfCombat,ShieldSystem
globals
trigger HEALEVENT_TRIGGER = null
private constant real EXPERTISE_HEALING_SPLASHING_RADIUS = 600.
private constant real EXPERTISE_COEFF_FOR_SPLASHING = 0.0035
endglobals
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and (GetWidgetLife(GetFilterUnit())>0.) and (not BlzIsUnitInvulnerable(GetFilterUnit()))
endfunction
function SplashHealingByUnitNearPoint takes unit whichUnit, real heal, real x, real y returns nothing
local group g = null
local unit tempu = null
local force tempF = null
local string TXT = "+|c0000FF00" + I2S(R2I(heal)) + "|r"
set tempF = CreateForce()
call ForceAddPlayer(tempF,GetOwningPlayer(whichUnit))
set udg_temp_unit = whichUnit
set g = CreateGroup()
call GroupEnumUnitsInRange(g, x, y, EXPERTISE_HEALING_SPLASHING_RADIUS, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call ForceAddPlayer(tempF,GetOwningPlayer(tempu))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl",tempu,"chest"))
call DisableTrigger(GetTriggeringTrigger())
call UnitDamageTarget(whichUnit,tempu,-1*heal,false,false,ATTACK_TYPE_NORMAL,null,null)
call EnableTrigger(GetTriggeringTrigger())
set IS_HEALING_TEXT = true
call AddTextTagUnit(TXT,tempu,tempF,90.,10.,1.5,0.)
set IS_HEALING_TEXT = false
call GroupRemoveUnit(g,tempu)
call ForceRemovePlayer(tempF,GetOwningPlayer(tempu))
endloop
call DestroyGroup(g)
call DestroyForce(tempF)
set g = null
set tempF = null
endfunction
private function onHeal takes nothing returns nothing
local unit TAKER = GetTriggerUnit()
local unit HEALER = GetEventDamageSource()
local integer ID_TAKER = GetHandleId(TAKER)
local integer ID_HEALER = GetHandleId(HEALER)
local player P_TAKER = GetOwningPlayer(TAKER)
local player P_HEALER = GetOwningPlayer(HEALER)
local real BASEHEAL = -1.*GetEventDamage()
local real HEAL = -1.*GetEventDamage()
local real HEAL_RECEIDED_BONUS = LoadReal(udg_hash,ID_TAKER,GetReceivedHealingBonusHash())
local real HEAL_BONUS = LoadReal(udg_hash,ID_HEALER,GetHealingBonusHash())
local real SELFHEAL = 0.
local string TXT = ""
local boolean IS_CRITICAL = false
local force HEALFORCE = CreateForce()
local boolean IsHealerInCombat = LoadBoolean(udg_hash,GetHandleId(HEALER),32)
local boolean IsTakerInCombat = LoadBoolean(udg_hash,GetHandleId(TAKER),32)
local real PERIODIC_HEALING_RECEIVED_BONUS = 0.
local real PERIODIC_HEALING_BONUS = 0.
local real PERIODIC_HEALING_CRIT = 0.
local real HEALING_CRIT = LoadReal(udg_hash,ID_HEALER,GetSpellCritHash())
local real HEALING_CRIT_MULTIPLIER = LoadReal(udg_hash,ID_HEALER,GetHealingCritMultiplierHash())
local integer BOOK_OF_HIGHBORNE_HYMNS_LEVEL = 0
local integer INQUISITIONS_MASTER_KEY_LVL = LoadInteger(udg_hash,ID_HEALER,GetInquisitionsMasterKeyHash())
local integer SHIMMERING_RUNE_LVL = LoadInteger(udg_hash,ID_HEALER,GetShimmeringRuneHash())
local real CRIT = 0.
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
local real EXPERTISE = 0.
local real HEALING_MASTERY = 0. //Expertise for splashing healing on crits
//Start some actions
if IsUnitType(HEALER,UNIT_TYPE_HERO) then
set EXPERTISE = I2R(GetHeroAgi(HEALER,true))
if not (GetHeroClass(HEALER) == "Healer") then
set HEALING_MASTERY = 0.5*EXPERTISE
else
set HEALING_MASTERY = EXPERTISE
endif
endif
if IsUnitInGroup(TAKER,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,ID_TAKER,XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
call BlzSetEventDamage(-BASEHEAL + BASEHEAL*BELIAR_DEEP_FREEZE_COEFF)
set BASEHEAL = GetEventDamage()
set HEAL = GetEventDamage()
endif
if HEALER==TAKER then
set SELFHEAL = LoadReal(udg_hash,ID_HEALER,GetSelfHealingBonusHash())
endif
set HEAL = HEAL * (1. + HEAL_RECEIDED_BONUS+HEAL_BONUS+SELFHEAL)
if IsLastHealingPeriodic() then
set PERIODIC_HEALING_RECEIVED_BONUS = LoadReal(udg_hash,ID_TAKER,GetPeriodicHealingReceivedBonusHash())
set PERIODIC_HEALING_BONUS = LoadReal(udg_hash,ID_HEALER,GetPeriodicHealingBonusHash())
set HEAL = HEAL * (1. + PERIODIC_HEALING_RECEIVED_BONUS+PERIODIC_HEALING_BONUS)
set PERIODIC_HEALING_CRIT = LoadReal(udg_hash,ID_HEALER,GetPeriodicHealingCritHash())
endif
set CRIT = HEALING_CRIT + PERIODIC_HEALING_CRIT
if GetRandomInt(0,100) <= CRIT then
set HEAL = HEAL * (2+HEALING_CRIT_MULTIPLIER)
set IS_CRITICAL = true
set BOOK_OF_HIGHBORNE_HYMNS_LEVEL = LoadInteger(udg_hash,ID_HEALER,GetBookOfHighborneHymnsHash())
if BOOK_OF_HIGHBORNE_HYMNS_LEVEL > 0 and not HasUnitCooldownHash(HEALER,GetBookOfHighborneHymnsHash()) then
set IHP_ABI = GetBookOfHighborneHymnsAbilBuff()
set IHP_BUFFER = GetBookOfHighborneHymnsBuff()
call AddHeroParameter(HEALER,GetBookOfHighborneHymnsEnergyRegen()*BOOK_OF_HIGHBORNE_HYMNS_LEVEL,GetBookOfHighborneHymnsDuration(),GetEnergyRegenBonusHash(),"","")
call UnitAddHashCooldown(HEALER,GetBookOfHighborneHymnsHash(),GetBookOfHighborneHymnsCooldown())
endif
if HEALING_MASTERY > 0. then
call SplashHealingByUnitNearPoint(HEALER, EXPERTISE_COEFF_FOR_SPLASHING * HEALING_MASTERY * HEAL, GetUnitX(TAKER), GetUnitY(TAKER))
endif
endif
call DisableTrigger(GetTriggeringTrigger())
call UnitDamageTarget(HEALER,TAKER,-1*(HEAL-BASEHEAL),false,false,ATTACK_TYPE_NORMAL,null,null)
call EnableTrigger(GetTriggeringTrigger())
if SHIMMERING_RUNE_LVL > 0 then
if GetRandomReal(1.,100.) <= GetShimmeringRuneProcChance() and not HasUnitCooldownHash(HEALER,GetShimmeringRuneHash()) then
call SetAddHeroParameterAuraBuff(GetShimmeringRuneAura(), GetShimmeringRuneBuff())
call AddHeroParameter(HEALER,SHIMMERING_RUNE_LVL*GetShimmeringRuneSpellCritBonus(),GetShimmeringRuneDuration(),GetSpellCritHash(),"","")
call UnitAddHashCooldown(HEALER,GetShimmeringRuneHash(),GetShimmeringRuneInternalCooldown())
endif
endif
if GetPlayerController(P_HEALER) == MAP_CONTROL_USER then
call AddHealingDoneMB(P_HEALER,TAKER,HEAL)
endif
if HEAL > (GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) - GetWidgetLife(TAKER)) then
set HEAL = GetUnitState(TAKER,UNIT_STATE_MAX_LIFE) - GetWidgetLife(TAKER)
endif
if (INQUISITIONS_MASTER_KEY_LVL > 0) and (not HasUnitCooldownHash(HEALER,GetInquisitionsMasterKeyHash())) then
if GetRandomInt(1,100) <= GetInquisitionsMasterKeyProcChance() then
call UnitShield.Add(TAKER,HEALER,HEAL*GetInquisitionsMasterKeyShieldHealValue()*INQUISITIONS_MASTER_KEY_LVL,GetInquisitionsMasterKeyDuration(),-1,GetInquisitionsMasterKeyShieldPower(),GetInquisitionsMasterKeyShieldAura(),GetInquisitionsMasterKeyShieldBuff())
call UnitAddHashCooldown(HEALER,GetInquisitionsMasterKeyHash(),GetInquisitionsMasterKeyCooldown())
endif
endif
if not IS_BLOOD_HURRICANE_DAMAGE then
if HEAL>0. then
if IS_CRITICAL then
set TXT = "+<|c0000FF00" + I2S(R2I(HEAL)) + "|r!>"
else
set TXT = "+|c0000FF00" + I2S(R2I(HEAL)) + "|r"
endif
endif
endif
//--------------------------------------------------------
call ForceAddPlayer(HEALFORCE,GetOwningPlayer(HEALER))
call ForceAddPlayer(HEALFORCE,GetOwningPlayer(TAKER))
if IsUnitType(TAKER,UNIT_TYPE_HERO) and GetPlayerController(P_TAKER)== MAP_CONTROL_USER and IsHealerInCombat then
call MAKE_UNIT_COMBAT(TAKER)
endif
if IsUnitType(HEALER,UNIT_TYPE_HERO) and GetPlayerController(P_HEALER)== MAP_CONTROL_USER and IsTakerInCombat then
call MAKE_UNIT_COMBAT(HEALER)
endif
set IS_HEALING_TEXT = true
call AddTextTagUnit(TXT,TAKER,HEALFORCE,90.,10.,1.5,0.)
set IS_HEALING_TEXT = false
call DestroyForce(HEALFORCE)
set TAKER = null
set HEALER = null
set HEALFORCE = null
endfunction
private function Conds takes nothing returns boolean
return GetEventDamage() < 0. and not IsUnitType(GetTriggerUnit(),UNIT_TYPE_DEAD)
endfunction
private function onInit takes nothing returns nothing
set HEALEVENT_TRIGGER = CreateTrigger()
call TriggerAddCondition(HEALEVENT_TRIGGER,Condition(function Conds))
call TriggerAddAction(HEALEVENT_TRIGGER,function onHeal)
endfunction
private function RegisterUnitsAlive takes nothing returns nothing
call TriggerRegisterUnitEvent( HEALEVENT_TRIGGER, GetEnumUnit(),EVENT_UNIT_DAMAGED)
endfunction
function RefreshHealingEventTrigger takes nothing returns nothing
call DestroyTrigger(HEALEVENT_TRIGGER)
set HEALEVENT_TRIGGER = CreateTrigger()
call TriggerAddCondition(HEALEVENT_TRIGGER,Condition(function Conds))
call TriggerAddAction(HEALEVENT_TRIGGER,function onHeal)
call ForGroup(MAP_UNITS_ALIVE, function RegisterUnitsAlive)
endfunction
endlibrary
library RefreshCombatTriggers initializer onInit requires DAMAGEEVENT, HealingEvent
globals
timer REFRESH_COMBAT_TRIGGERS_TIMER = CreateTimer()
endglobals
private function RefreshCombatTriggers takes nothing returns nothing
call RefreshDamageEventTrigger()
call RefreshHealingEventTrigger()
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,REFRESH_COMBAT_TRIGGERS_TIMER)
call TriggerAddAction(t, function RefreshCombatTriggers)
set t = null
endfunction
endlibrary
//TESH.scrollpos=63
//TESH.alwaysfold=0
library OutOfCombat requires HDBossMb, DDBossMb,PotionsUtils,AddTextTag,HeroInitializer
globals
private constant integer RANGER = 'H00O'
private constant integer HORDE_CHAMPION = 'O002'
private constant integer BLOODELF_CAPTAIN = 'O005'
private constant integer COMBATHASH = 32 //Is Unit In Combat
private constant real RAGE_REGEN_IN_COMBAT = 3.
private constant real RAGE_REGEN_OUT_COMBAT = -3.
private constant real SPIRIT_MANA_REGEN_FACTOR = 0.35
boolean IS_BOSS_BATTLE = false
private boolean IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED = false
constant integer OUT_OF_COMBAT_TIMER_HASH = 31
endglobals
function IsUnitInCombat takes unit whichUnit returns boolean
return LoadBoolean(udg_hash,GetHandleId(whichUnit),COMBATHASH)
endfunction
private function CountHeroesInCombat takes nothing returns integer
local integer count = 0
local integer i = 0
loop
exitwhen i>udg_PlayerCount
if IsUnitInCombat(udg_Heroes[i]) and (GetWidgetLife(udg_Heroes[i])>0.) then
set count = count + 1
endif
set i = i + 1
endloop
return count
endfunction
function RegenerateRage takes unit whichUnit, real value returns nothing
local real rageBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetRageRegenBonusHash())
local real energyBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetEnergyRegenBonusHash())
local real reg = 0.
local real newvalue = value
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
if IsUnitInGroup(whichUnit,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) and not IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,GetHandleId(whichUnit),XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
set newvalue = value - value*BELIAR_DEEP_FREEZE_COEFF
endif
if newvalue>0 then
set reg = newvalue*(1+rageBonusMult+energyBonusMult)
else
set reg = newvalue
endif
call SetUnitState(whichUnit,UNIT_STATE_MANA, GetUnitState(whichUnit,UNIT_STATE_MANA)+reg)
endfunction
function RegenerateFocus takes unit whichUnit, real value returns nothing
local real focusBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetFocusRegenBonusHash())
local real energyBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetEnergyRegenBonusHash())
local real newvalue = value
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
if IsUnitInGroup(whichUnit,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) and not IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,GetHandleId(whichUnit),XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
set newvalue = value - value*BELIAR_DEEP_FREEZE_COEFF
endif
call SetUnitState(whichUnit,UNIT_STATE_MANA, GetUnitState(whichUnit,UNIT_STATE_MANA)+newvalue*(1+focusBonusMult+energyBonusMult))
endfunction
function RegenerateCombo takes unit whichUnit, real value returns nothing
local real comboBonusMult = 0.//LoadReal(udg_hash,GetHandleId(whichUnit),GetFocusRegenBonusHash())
local real energyBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetEnergyRegenBonusHash())
local real newvalue = value
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
if IsUnitInGroup(whichUnit,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) and not IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,GetHandleId(whichUnit),XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
set newvalue = value - value*BELIAR_DEEP_FREEZE_COEFF
endif
call SetUnitState(whichUnit,UNIT_STATE_MANA, GetUnitState(whichUnit,UNIT_STATE_MANA)+newvalue*(1+comboBonusMult+energyBonusMult))
endfunction
function RegenerateMana takes unit whichUnit, real value returns nothing
local real manaBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetManaRegenBonusHash())
local real energyBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetEnergyRegenBonusHash())
local real reg = 0.
local real newvalue = value
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
if IsUnitInGroup(whichUnit,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) and not IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,GetHandleId(whichUnit),XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
set newvalue = value - value*BELIAR_DEEP_FREEZE_COEFF
endif
if GetUnitState(whichUnit,UNIT_STATE_MAX_MANA) > 200. then
if newvalue > 0 then
set reg = newvalue*(1+manaBonusMult+energyBonusMult)
else
set reg = newvalue
endif
call SetUnitState(whichUnit,UNIT_STATE_MANA, GetUnitState(whichUnit,UNIT_STATE_MANA)+reg)
endif
endfunction
function RegenerateRunes takes unit whichUnit, real value returns nothing
local real runesBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetRunesRegenBonusHash())
local real energyBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetEnergyRegenBonusHash())
local real newvalue = value
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
if IsUnitInGroup(whichUnit,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) and not IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,GetHandleId(whichUnit),XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
set newvalue = value - value*BELIAR_DEEP_FREEZE_COEFF
endif
call SetUnitState(whichUnit,UNIT_STATE_MANA, GetUnitState(whichUnit,UNIT_STATE_MANA)+newvalue*(1+runesBonusMult+energyBonusMult))
endfunction
function RegenerateCharge takes unit whichUnit, real value returns nothing
//local real runesBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetRunesRegenBonusHash())
local real energyBonusMult = LoadReal(udg_hash,GetHandleId(whichUnit),GetEnergyRegenBonusHash())
local real newvalue = value
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
if IsUnitInGroup(whichUnit,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) and not IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,GetHandleId(whichUnit),XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
set newvalue = value - value*BELIAR_DEEP_FREEZE_COEFF
endif
call SetUnitState(whichUnit,UNIT_STATE_MANA, GetUnitState(whichUnit,UNIT_STATE_MANA)+newvalue*(1+energyBonusMult))
endfunction
function RegenerateEnergy takes unit whichUnit, real value returns nothing
local string str = GetHeroEnergy(whichUnit)
local real newvalue = value
local integer BELIAR_DEEP_FREEZE_LVL = 0
local real BELIAR_DEEP_FREEZE_COEFF = 0.
if IsUnitInGroup(whichUnit,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) then
set BELIAR_DEEP_FREEZE_LVL = LoadInteger(udg_hash,GetHandleId(whichUnit),XARDAS_MARKED_ITEMS_COUNT_HASH)
set BELIAR_DEEP_FREEZE_COEFF = BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE * BELIAR_DEEP_FREEZE_LVL
if BELIAR_DEEP_FREEZE_COEFF >= 1. then
set BELIAR_DEEP_FREEZE_COEFF = 0.99
endif
set newvalue = value - value*BELIAR_DEEP_FREEZE_COEFF
set IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED = true
endif
if str == "Rage" then
call RegenerateRage(whichUnit,value)
endif
if str == "Focus" then
call RegenerateFocus(whichUnit,value)
endif
if str == "Mana" then
call RegenerateMana(whichUnit,value)
endif
if str == "Runes" then
call RegenerateRunes(whichUnit,value)
endif
if str == "Combo" then
call RegenerateCombo(whichUnit,value)
endif
if str == "Charge" then
call RegenerateCharge(whichUnit,value)
endif
set IS_BELIAR_SACRIFICE_DEEP_FREEZE_AFFECTED = false
endfunction
private function REGEN_OUT_OF_COMBAT takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolean IS_UNIT_IN_COMBAT = LoadBoolean(udg_hash,GetHandleId(u),32)
local integer id = GetHandleId(u)
local real hpreg = GetUnitState(u,UNIT_STATE_MAX_LIFE)*0.1
local real mpreg = GetUnitState(u,UNIT_STATE_MAX_MANA)*0.1
local real hpbonus = LoadReal(udg_hash,id,23)
local real mpbonus = LoadReal(udg_hash,id,24)
local real allbonus = LoadReal(udg_hash,id,25)
set hpreg = hpreg * (1. + hpbonus + allbonus)
set mpreg = mpreg * (1. + mpbonus + allbonus)
if not IS_UNIT_IN_COMBAT then
call SetWidgetLife(u,GetWidgetLife(u)+hpreg)
if GetUnitState(u,UNIT_STATE_MAX_MANA)>200 then
call RegenerateMana(u,mpreg)
endif
if GetUnitTypeId(u)==HORDE_CHAMPION or GetUnitTypeId(u)==BLOODELF_CAPTAIN then
call RegenerateRage(u,RAGE_REGEN_OUT_COMBAT)
endif
else
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
private function REGEN_IN_COMBAT takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolean IsInCombat = LoadBoolean(udg_hash,GetHandleId(u),32)
local real hpbonus = LoadReal(udg_hash,GetHandleId(u),26)
local real mpbonus = LoadReal(udg_hash,GetHandleId(u),27)
local real bothbonus = LoadReal(udg_hash,GetHandleId(u),28)
local real toRegenMana = SPIRIT_MANA_REGEN_FACTOR * I2R(GetHeroInt(u,true))
if IsInCombat then
if GetUnitState(u,UNIT_STATE_MAX_MANA) > 200. then
call RegenerateMana( u,toRegenMana + toRegenMana*(mpbonus+bothbonus) )
endif
if GetUnitTypeId(u)==HORDE_CHAMPION or GetUnitTypeId(u)==BLOODELF_CAPTAIN then
call RegenerateRage(u,RAGE_REGEN_IN_COMBAT)
endif
else
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
function OUT_OF_COMBAT takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer slot = 0
local integer index = 1
local integer charges = 0
local integer rawcode = 0
call SaveInteger(udg_hash,GetHandleId(u),33,0)
call SaveInteger(udg_hash,GetHandleId(u),34,0)
call SaveInteger(udg_hash,GetHandleId(u),35,0)
loop
exitwhen slot > 5
set rawcode = GetItemTypeId(UnitItemInSlot(u,slot))
set index = 1
loop
exitwhen index > udg_Potions_COUNT
if rawcode == udg_Potions_DISABLED[index] then
set charges = GetItemCharges(UnitItemInSlot(u,slot))
call RemoveItem(UnitItemInSlot(u,slot))
call UnitAddItemToSlotById(u,GetOriginPotion(rawcode),slot)
call SetItemCharges(UnitItemInSlot(u,slot),charges)
endif
set index = index + 1
endloop
set slot = slot + 1
endloop
call ForceAddPlayer(udg_temp_force,GetOwningPlayer(u))
call AddTextTagUnit("|c00FF0000Out of combat|r",u,udg_temp_force,270.,9.,2.,-100.)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,u)
call TimerStart(t1,5.,true,function REGEN_OUT_OF_COMBAT)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call RemoveSavedHandle(udg_hash,GetHandleId(u),OUT_OF_COMBAT_TIMER_HASH)
call SaveBoolean(udg_hash,GetHandleId(u),COMBATHASH,false)
if CountHeroesInCombat() == 0 then
set IS_HEROES_IN_COMBAT = false
endif
if GetUnitTypeId(u) == RANGER then
if HaveSavedHandle(udg_hash,GetHandleId(u),SUMMON_WOLF_WOLFCASTERHASH) then
call SaveBoolean(udg_hash,GetHandleId(LoadUnitHandle(udg_hash,GetHandleId(u),SUMMON_WOLF_WOLFCASTERHASH)),SUMMON_WOLF_COMBATHASH, false)
endif
endif
call DestroyTimer(t)
set t = null
set t1 = null
set u = null
endfunction
function MAKE_UNIT_COMBAT takes unit u returns nothing
local timer t = null
local timer t1 = null
if not IsUnitType(u,UNIT_TYPE_DEAD) then
if HaveSavedHandle(udg_hash,GetHandleId(u),OUT_OF_COMBAT_TIMER_HASH) then
call TimerStart(LoadTimerHandle(udg_hash,GetHandleId(u),OUT_OF_COMBAT_TIMER_HASH),6.+2*CURRENT_DIFFICULTY,false,function OUT_OF_COMBAT)
else
set t = CreateTimer()
call SaveTimerHandle(udg_hash,GetHandleId(u),OUT_OF_COMBAT_TIMER_HASH,t)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,6.+2*CURRENT_DIFFICULTY,false,function OUT_OF_COMBAT)
call ForceAddPlayer(udg_temp_force,GetOwningPlayer(u))
call AddTextTagUnit("|c00FF0000Entering combat|r",u,udg_temp_force,270.,9.,2.,-200.)
if GetUnitTypeId(u) == RANGER then
if HaveSavedHandle(udg_hash,GetHandleId(u),SUMMON_WOLF_WOLFCASTERHASH) then
call SaveBoolean(udg_hash,GetHandleId(LoadUnitHandle(udg_hash,GetHandleId(u),SUMMON_WOLF_WOLFCASTERHASH)),SUMMON_WOLF_COMBATHASH, true)
endif
endif
set t1 = CreateTimer()
call TimerStart(t1,5.,true,function REGEN_IN_COMBAT)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,u)
set t1 = null
set t = null
endif
if CountHeroesInCombat() == 0 and (not IS_BOSS_BATTLE) then
call RefreshDamageDoneMB()
call RefreshHealingDoneMB()
endif
call SaveBoolean(udg_hash,GetHandleId(u),COMBATHASH,true)
if CountHeroesInCombat() > 0 then
set IS_HEROES_IN_COMBAT = true
endif
endif
endfunction
function MakeUnitOutOfCombat takes unit u returns nothing
if IsUnitInCombat(u) then
call TimerStart(LoadTimerHandle(udg_hash,GetHandleId(u),OUT_OF_COMBAT_TIMER_HASH),0.,false,function OUT_OF_COMBAT)
endif
endfunction
endlibrary
//TESH.scrollpos=238
//TESH.alwaysfold=0
library CreepAggro initializer onInit requires IsUnitDead
/*
Create by GodLike! aka Helpmeplz aka Demolishka
Give me credit if you use it in your map.
Uses GetUnitUserData()
functions:
call Aggro.new(unit ForUnit) - creates an aggro table for "ForUnit"
call Aggro.add(unit ForUnit,unit Attacker,real amount) - adds a "amount" of aggro to "ForUnit" from "Attacker"
call Aggro.get(unit ForUnit,unit Attacker,boolean percent) - returns an aggro amount of "ForUnit" genericed by "Attacker". If "percent" is true then returns the percent value from ALL aggro
call Aggro.target(unit ForUnit) - returns the current target for "ForUnit"
call Aggro.top(unit ForUnit) - returns the amount of Aggro of "ForUnit"'s Target
call Aggro.clear(unit ForUnit,unit Attacker) - clears the aggro of "Attacker" for "ForUnit". If "Attacker" is null then clears FULL AGGRO TABLE for "ForUnit"
call Aggro.remove(unit ForUnit) - removes the Aggro Table for "ForUnit"
call Aggro.ignoreAggro(unit whichUnit, real duration, unit TARGET, boolean ignorePrevious) - makes the unit whichUnit ignore aggro table in his attack orders (but still count aggro from attackes) for duration. Start attack TARGET if not null and ignores previous ignoreAggro callbacks if ignorePrevious is true.
*/
globals
private constant integer MAX_ATTACKERS = 10 //maximum attackers of one unit
private constant real CLEAR_AGGRO_PERIOD = 10. //time after the last attack when the Aggro of unit will be cleared
private constant real TARGET_AGGRO_BONUS = 2. //multiplier if the unit gets aggro from its attacker
private constant real AGGRO_MULTIPLIER_TO_REDIRECT = 1.1 // How much the unit should generate threat value (comparing with his target's target) to make the target attack him
private constant real TIMER_PERIOD = 0.1
endglobals
struct Aggro
private static Aggro array st
private static integer index = 0
private static timer t = CreateTimer()
static trigger trg = CreateTrigger()
static group ordered = CreateGroup()
integer Count = 0
unit Unit = null
unit Target = null
unit CHASED_TARGET = null
real IGNORE_TIME = 0.
unit array Attacker[MAX_ATTACKERS]
real array Aggro[MAX_ATTACKERS]
real array Dur[MAX_ATTACKERS]
static method GetNewTarget takes unit whichUnit returns integer
local integer i = GetUnitUserData(whichUnit)
local integer k = 0
local integer j = 0
loop
exitwhen j >= .st[i].Count
if .st[i].Aggro[j] > .st[i].Aggro[k] then
set k = j
endif
set j = j + 1
endloop
return k
endmethod
static method add takes unit whichUnit, unit ATTACKER,real amount returns boolean
local integer i = GetUnitUserData(whichUnit)
local integer j = 0
local boolean founded = false
if not (.st[i].Unit == whichUnit) then
call Aggro.new(whichUnit)
set i = GetUnitUserData(whichUnit)
endif
if (not (.st[i].IGNORE_TIME > 0.) and .st[i].Target == ATTACKER) or (.st[i].IGNORE_TIME > 0. and .st[i].CHASED_TARGET==ATTACKER) then
set amount = amount * TARGET_AGGRO_BONUS
endif
loop
exitwhen j >= .st[i].Count
if .st[i].Attacker[j] == ATTACKER then
set founded = true
if amount > 0. then
//call BJDebugMsg("Adding " + R2S(amount) + "threat from " + GetUnitName(.st[i].Attacker[j]) + " to " + GetUnitName(.st[i].Unit))
endif
set .st[i].Aggro[j] = .st[i].Aggro[j] + amount
set .st[i].Dur[j] = CLEAR_AGGRO_PERIOD
if not (.st[i].IGNORE_TIME > 0.) and .st[i].Aggro[j] > AGGRO_MULTIPLIER_TO_REDIRECT*Aggro.Targetaggro(whichUnit) and not( .st[i].Attacker[j] == .st[i].Target ) then
//call BJDebugMsg(GetUnitName(.st[i].Attacker[j]) + "'s aggro on " + GetUnitName(.st[i].Unit)+ " is " + R2S(.st[i].Aggro[j]) + " that is greater that " + R2S(AGGRO_MULTIPLIER_TO_REDIRECT*Aggro.Targetaggro(whichUnit)) + ". So redirect.")
set .st[i].Target = ATTACKER
call IssueTargetOrder(whichUnit,"attack",ATTACKER)
endif
set j = .st[i].Count
endif
set j = j + 1
endloop
if not founded then
if .st[i].Count <= MAX_ATTACKERS then
set .st[i].Attacker[.st[i].Count] = ATTACKER
set .st[i].Aggro[.st[i].Count] = amount
set .st[i].Dur[.st[i].Count] = CLEAR_AGGRO_PERIOD
if not (.st[i].IGNORE_TIME > 0.) and amount > AGGRO_MULTIPLIER_TO_REDIRECT*Aggro.Targetaggro(whichUnit) then
//call BJDebugMsg("New unit " + GetUnitName(ATTACKER) + "'s aggro on " + GetUnitName(.st[i].Unit)+ " is " + R2S(.st[i].Aggro[j]) + " that is greater that " + R2S(AGGRO_MULTIPLIER_TO_REDIRECT*Aggro.Targetaggro(whichUnit)) + ". So redirect.")
set .st[i].Target = ATTACKER
call IssueTargetOrder(whichUnit,"attack",ATTACKER)
endif
set .st[i].Count = .st[i].Count + 1
endif
endif
return true
endmethod
static method ignoreAggro takes unit whichUnit, real duration, unit ATTACK_TARGET, boolean ignorePrevious returns nothing
local integer i = GetUnitUserData(whichUnit)
if not (.st[i].Unit == whichUnit) then
call Aggro.new(whichUnit)
set i = GetUnitUserData(whichUnit)
endif
if (not(.st[i].IGNORE_TIME>0.)) or ignorePrevious then
if ignorePrevious then
//call BJDebugMsg(GetUnitName(whichUnit) + " charges " + GetUnitName(ATTACK_TARGET))
else
//call BJDebugMsg(GetUnitName(whichUnit) + " taunted by " + GetUnitName(ATTACK_TARGET))
endif
call Aggro.add(.st[i].Unit,ATTACK_TARGET,0.)
set .st[i].IGNORE_TIME = duration
if .st[i].IGNORE_TIME > 0. and not IsUnitDeadBX(ATTACK_TARGET) then
//set .st[i].Target = ATTACK_TARGET
set .st[i].CHASED_TARGET = ATTACK_TARGET
call IssueTargetOrder(.st[i].Unit,"attack",ATTACK_TARGET)
endif
endif
endmethod
static method get takes unit TARGET, unit ATTACKER, boolean percent returns real
local integer i = GetUnitUserData(TARGET)
local integer j = 0
local real aggro = 0.
local real mainaggro = 0.
if .st[i].Count > 0 then
loop
exitwhen j >= .st[i].Count
set mainaggro = mainaggro + .st[i].Aggro[j]
if .st[i].Attacker[j] == ATTACKER then
set aggro = .st[i].Aggro[j]
endif
set j = j + 1
endloop
if percent then
return aggro / mainaggro * 100.
endif
return aggro
endif
return 0.
endmethod
static method target takes unit whichUnit returns unit
if whichUnit == .st[GetUnitUserData(whichUnit)].Unit then
return .st[GetUnitUserData(whichUnit)].Target
endif
return null
endmethod
static method Targetaggro takes unit whichUnit returns real
if whichUnit == .st[GetUnitUserData(whichUnit)].Unit then
//call BJDebugMsg("Returning target aggro ")
return Aggro.get(whichUnit,.st[GetUnitUserData(whichUnit)].Target,false)
endif
return 0.
endmethod
static method clear takes unit whichUnit, unit Attacker returns nothing
local integer i = GetUnitUserData(whichUnit)
local integer j = 0
local integer k = 0
if not (Attacker == null) then
loop
exitwhen j >= .st[i].Count
if Attacker == .st[i].Attacker[j] then
if .st[i].Attacker[j] == .st[i].Target then
set .st[i].Target = null
call IssueImmediateOrder(.st[i].Unit,"stop")
endif
if .st[i].Attacker[j] == .st[i].CHASED_TARGET then
set .st[i].IGNORE_TIME = 0.
set .st[i].CHASED_TARGET = null
if not IsUnitDeadBX(.st[i].Target) then
call IssueTargetOrder(.st[i].Unit,"attack",.st[i].Target)
else
call IssueImmediateOrder(.st[i].Unit,"stop")
endif
endif
set .st[i].Count = .st[i].Count - 1
set .st[i].Attacker[j] = .st[i].Attacker[.st[i].Count]
set .st[i].Aggro[j] = .st[i].Aggro[.st[i].Count]
set .st[i].Dur[j] = .st[i].Dur[.st[i].Count]
set .st[i].Attacker[.st[i].Count] = null
set j = .st[i].Count
endif
set j = j + 1
endloop
if .st[i].Count == 0 then
set .st[i].Target = null
set .st[i].Count = 0
set .st[i].Target = null
set .st[i].IGNORE_TIME = 0.
set .st[i].CHASED_TARGET = null
elseif .st[i].Target == null then
if not ( (.st[i].IGNORE_TIME>0.) and not IsUnitDeadBX(.st[i].CHASED_TARGET)) then
set k = Aggro.GetNewTarget(.st[i].Unit)
set .st[i].Target = .st[i].Attacker[k]
//call BJDebugMsg("Clear: case of attack")
call IssueTargetOrder(.st[i].Unit,"attack",.st[i].Target)
endif
endif
else
set .st[i].Count = 0
set .st[i].Target = null
set .st[i].IGNORE_TIME = 0.
set .st[i].CHASED_TARGET = null
call IssueImmediateOrder(whichUnit,"stop")
endif
endmethod
private static method remove takes integer i returns nothing
//call BJDebugMsg("Removing" + GetUnitName(.st[i].Unit))
if .st[i].Count > 0 and .st[i] != null then
call .st[i].destroy()
endif
set .index = .index - 1
set .st[i] = .st[.index]
set .st[.index] = 0
call SetUnitUserData(.st[i].Unit, i)
if .index == 0 then
call PauseTimer(.t)
endif
//call BJDebugMsg("Removed aggro table for: " + GetUnitName(whichUnit) + "with .index " + I2S(GetUnitUserData(whichUnit)))
endmethod
static method onTimer takes nothing returns nothing
local integer i = 0
local integer j = 0
local integer k = 0
loop
exitwhen i >= .index
if IsUnitDeadBX(.st[i].Unit) then
//call BJDebugMsg(GetUnitName(.st[i].Unit) + "is dead or null. Removing")
call Aggro.remove(i)
set i = i - 1
else
if .st[i].IGNORE_TIME>0. then
set .st[i].IGNORE_TIME = .st[i].IGNORE_TIME - TIMER_PERIOD
if .st[i].IGNORE_TIME < 0. or IsUnitDeadBX(.st[i].CHASED_TARGET) then
//call BJDebugMsg("IGNORE finished on " + GetUnitName(.st[i].Unit))
set .st[i].CHASED_TARGET = null
if not IsUnitDeadBX(.st[i].Target) then
call IssueTargetOrder(.st[i].Unit,"attack",.st[i].Target)
else
call IssueImmediateOrder(.st[i].Unit,"stop")
endif
endif
endif
//call BJDebugMsg("onTimer for " + GetUnitName(.st[i].Unit))
set j = 0
loop
exitwhen j >= .st[i].Count
set .st[i].Dur[j] = .st[i].Dur[j] - TIMER_PERIOD
if (.st[i].Dur[j] <= 0. and not(.st[i].Attacker[j]==.st[i].CHASED_TARGET) ) or IsUnitDeadBX(.st[i].Attacker[j]) then
if .st[i].Attacker[j] == .st[i].Target then
set .st[i].Target = null
call IssueImmediateOrder(.st[i].Unit,"stop")
endif
set .st[i].Count = .st[i].Count - 1
set .st[i].Attacker[j] = .st[i].Attacker[.st[i].Count]
set .st[i].Aggro[j] = .st[i].Aggro[.st[i].Count]
set .st[i].Dur[j] = .st[i].Dur[.st[i].Count]
set j = j - 1
endif
set j = j + 1
endloop
//call BJDebugMsg("j-loop finished")
if .st[i].Count == 0 then
set .st[i].Target = null
elseif .st[i].Target == null then
if not ( (.st[i].IGNORE_TIME>0.) and not IsUnitDeadBX(.st[i].CHASED_TARGET)) then
set k = Aggro.GetNewTarget(.st[i].Unit)
set .st[i].Target = .st[i].Attacker[k]
//call BJDebugMsg("onTimer case of attack")
call IssueTargetOrder(.st[i].Unit,"attack",.st[i].Target)
endif
endif
endif
set i = i + 1
endloop
endmethod
static method new takes unit whichUnit returns nothing
if (GetUnitUserData(whichUnit) >= .index) or not (.st[GetUnitUserData(whichUnit)].Unit == whichUnit) then
set .st[.index] = Aggro.create()
set .st[.index].Unit = whichUnit
set .st[.index].Target = null
set .st[.index].Count = 0
set .st[.index].CHASED_TARGET = null
set .st[.index].IGNORE_TIME = 0.
//call BJDebugMsg("Setting user data for " + GetUnitName(whichUnit) + " to " + I2S(.index) )
call SetUnitUserData(whichUnit,.index)
if .index == 0 then
call TimerStart(.t,TIMER_PERIOD,true,function Aggro.onTimer)
endif
if not IsUnitInGroup(whichUnit,.ordered) then
call TriggerRegisterUnitEvent(Aggro.trg,whichUnit,EVENT_UNIT_ISSUED_TARGET_ORDER)
call GroupAddUnit(.ordered,whichUnit)
endif
set .index = .index + 1
//call BJDebugMsg("Created aggro table for: " + GetUnitName(whichUnit) + "with index= " + I2S(GetUnitUserData(whichUnit)))
endif
endmethod
static method onOrder takes nothing returns boolean
local integer i = 0
if (GetIssuedOrderId() == OrderId("attack")) or (GetIssuedOrderId() == OrderId("smart")) then
set i = GetUnitUserData(GetTriggerUnit())
if .st[i].Unit==GetTriggerUnit() then
if not (GetOrderTargetUnit() == .st[i].Target) and not (.st[i].IGNORE_TIME>0. ) and not IsUnitDeadBX(.st[i].Target) then
call IssueTargetOrder(.st[i].Unit,"attack",.st[i].Target)
//call BJDebugMsg("Redirecting " + GetUnitName(GetTriggerUnit()) + " to target " + GetUnitName(.st[i].Target))
endif
if .st[i].IGNORE_TIME>0. and not IsUnitDeadBX(.st[i].CHASED_TARGET) and not (GetOrderTargetUnit() == .st[i].CHASED_TARGET) then
call IssueTargetOrder(.st[i].Unit,"attack",.st[i].CHASED_TARGET)
//call BJDebugMsg("Redirecting " + GetUnitName(GetTriggerUnit()) + " to CHASED target " + GetUnitName(.st[i].CHASED_TARGET))
endif
endif
endif
return false
endmethod
endstruct
private function onInit takes nothing returns nothing
call TriggerAddCondition(Aggro.trg,Condition(function Aggro.onOrder))
endfunction
endlibrary
//TESH.scrollpos=26
//TESH.alwaysfold=0
library AggroTable initializer onInit requires CreepAggro
/*
Created by GodLike aka Helpmeplz
Give me credit if you use it in your map.
This system allows you to adds an Aggro bar for your multiboard, showing an Aggro amount of any Unit on the other.
functions:
Table.add(ForUnit,Attacker,Mb,Row,S_COLUMN,E_COLUMN) - adds an Aggro Bar (showing Aggro of "Attacker" on "ForUnit") for multiboard "mb" in row "ROW" starts with S_COMUN and Ends with E_COLUMN.
Automaticaly increases the counts of rows/columns of multiboard if they are lesser than needed.
NOTE: the differense beetwen the start column and the end column must be at least 3!
Table.remove(ForUnit,Attacker,Mb) - removes an Aggro Bar (showing Aggro of "Attacker" on "ForUnit") for multiboard "mb"
NOTE: I think you won't create two aggro bars in various rows. That's why this function doesn't require row number.
*/
globals
private string array Bars[24]
private constant integer MAX_TABLES = 20
endglobals
struct Table
static Table array st[MAX_TABLES]
static integer index = 0
static timer t = CreateTimer()
unit Target = null
unit Attacker = null
multiboard mb = null
integer ROW = 0
real COUNT = 0
integer S_COL = 0
integer E_COL = 0
static method GetIcon takes integer index,integer s_col, integer e_col returns string
if index == s_col then
return Bars[0]
elseif index == e_col then
return Bars[23]
endif
return Bars[24]
endmethod
static method RefreshTable takes nothing returns nothing
local integer i = 0
local integer j = 0
local multiboarditem mbi = null
local string icon = ""
local integer k = 0
loop
exitwhen i >= .index
set j = .st[i].S_COL
set k = R2I(Aggro.get(.st[i].Target,.st[i].Attacker,true) / .st[i].COUNT)
loop
exitwhen j > .st[i].E_COL
set mbi = MultiboardGetItem(.st[i].mb,.st[i].ROW,j)
if j == .st[i].S_COL then
if k == 0 then
set icon = Bars[0]
elseif k>=7 then
set k=k-7
set icon = Bars[7]
else
set icon = Bars[k]
set k = 0
endif
elseif j == .st[i].E_COL then
if k==0 then
set icon = Bars[23]
elseif k>=7 then
set icon = Bars[22]
else
set icon = Bars[15+k]
endif
else
if k==0 then
set icon = Bars[24]
elseif k>=7 then
set k = k - 7
set icon = Bars[15]
else
set icon = Bars[7+k]
set k = 0
endif
endif
set j = j + 1
call MultiboardSetItemIcon(mbi,icon)
call MultiboardReleaseItem(mbi)
set mbi = null
endloop
set i = i + 1
endloop
endmethod
static method remove takes multiboard m, integer row returns nothing
local integer i = 0
local integer j = 0
local multiboarditem mbi = null
loop
exitwhen i >=. index
if .st[i].ROW == row and .st[i].mb == m then
set j = .st[i].S_COL
loop
exitwhen j > .st[i].E_COL
set mbi = MultiboardGetItem(.st[i].mb,.st[i].ROW,j)
call MultiboardSetItemStyle(mbi,false,false)
call MultiboardReleaseItem(mbi)
set mbi = null
set j = j + 1
endloop
call .st[i].destroy()
set .index = .index - 1
set .st[i] = .st[.index]
if .index == 0 then
call PauseTimer(.t)
endif
set i = .index
endif
set i = i + 1
endloop
endmethod
static method add takes unit Target,unit Attacker, multiboard m,integer row,integer s_col,integer e_col returns nothing
local integer i = 0
local multiboarditem mbi = null
set .st[.index] = Table.create()
set .st[.index].mb = m
set .st[.index].ROW = row
set .st[.index].S_COL = s_col
set .st[.index].E_COL = e_col
set .st[.index].Target = Target
set .st[.index].Attacker = Attacker
set .st[.index].COUNT = 100. / ( (e_col - s_col + 1) * 8 - 2)
if e_col > MultiboardGetColumnCount(m) then
call MultiboardSetColumnCount(m,e_col)
endif
if row > MultiboardGetRowCount(m) then
call MultiboardSetRowCount(m,row)
endif
set i = s_col
loop
exitwhen i > .st[.index].E_COL
set mbi = MultiboardGetItem(m,row,i)
call MultiboardSetItemStyle(mbi,false,true)
call MultiboardSetItemWidth(mbi,0.01)
call MultiboardSetItemIcon(mbi,Table.GetIcon(i,.st[.index].S_COL,.st[.index].E_COL))
call MultiboardReleaseItem(mbi)
set mbi = null
set i = i + 1
endloop
if .index == 0 then
call TimerStart(.t,0.04,true,function Table.RefreshTable)
endif
set .index = .index + 1
endmethod
endstruct
private function onInit takes nothing returns nothing
set Bars[0] = "war3mapImported\\AggroL0.tga"
set Bars[1] = "war3mapImported\\AggroL1.tga"
set Bars[2] = "war3mapImported\\AggroL2.tga"
set Bars[3] = "war3mapImported\\AggroL3.tga"
set Bars[4] = "war3mapImported\\AggroL4.tga"
set Bars[5] = "war3mapImported\\AggroL5.tga"
set Bars[6] = "war3mapImported\\AggroL6.tga"
set Bars[7] = "war3mapImported\\AggroL7.tga"
set Bars[8] = "war3mapImported\\AggroM1.tga"
set Bars[9] = "war3mapImported\\AggroM2.tga"
set Bars[10] = "war3mapImported\\AggroM3.tga"
set Bars[11] = "war3mapImported\\AggroM4.tga"
set Bars[12] = "war3mapImported\\AggroM5.tga"
set Bars[13] = "war3mapImported\\AggroM6.tga"
set Bars[14] = "war3mapImported\\AggroM7.tga"
set Bars[15] = "war3mapImported\\AggroM8.tga"
set Bars[16] = "war3mapImported\\AggroR1.tga"
set Bars[17] = "war3mapImported\\AggroR2.tga"
set Bars[18] = "war3mapImported\\AggroR3.tga"
set Bars[19] = "war3mapImported\\AggroR4.tga"
set Bars[20] = "war3mapImported\\AggroR5.tga"
set Bars[21] = "war3mapImported\\AggroR6.tga"
set Bars[22] = "war3mapImported\\AggroR7.tga"
set Bars[23] = "war3mapImported\\AggroR0.tga"
set Bars[24] = "war3mapImported\\AggroM0.tga"
endfunction
endlibrary
library ShieldSystem
globals
private constant integer MAX_SHIELDS = 50 // Maximum shields on one unit
private constant integer MAX_UNITS = 100 // Maximum units, which may have shields at the same time
private constant real TIMER_PERIOD = 0.25 //Shield duration checking timer period
private constant unit array INDEXED_UNITS[MAX_UNITS]
private integer INDEXED_UNIT_COUNT = 0
endglobals
private function GetShieldUnitIndex takes unit whichUnit returns integer
local integer i = 1
local integer pos = INDEXED_UNIT_COUNT + 1
local boolean found = false
loop
exitwhen i > INDEXED_UNIT_COUNT or found
if INDEXED_UNITS[i] == null and (i < pos) then
set pos = i
endif
if INDEXED_UNITS[i] == whichUnit then
set found = true
set pos = i
endif
set i = i + 1
endloop
if not(INDEXED_UNITS[pos] == whichUnit) then
set INDEXED_UNITS[pos] = whichUnit
//call BJDebugMsg("Creating new index for " + GetUnitName(whichUnit) + " as " + I2S(pos))
endif
if pos > INDEXED_UNIT_COUNT then
set INDEXED_UNIT_COUNT = INDEXED_UNIT_COUNT + 1
endif
return pos
endfunction
private function IsUnitShielded takes unit whichUnit returns boolean
local integer i = 1
local boolean found = false
loop
exitwhen i > INDEXED_UNIT_COUNT or found
if INDEXED_UNITS[i] == whichUnit then
set found = true
endif
set i = i + 1
endloop
if found then
return true
endif
return false
endfunction
private struct Shield
unit CASTER = null
integer AURACODE
integer BUFFCODE
real REMAINING_TIME
real DURABILITY
real MAX_DURABILITY
real BLOCK_MULT // a value beetwen 0 and 1 = which part of damage will be blocked
integer BLOCK_DAMAGE_TYPE // -1 any damage, 0 phys damage, 1 magical damage
endstruct
struct UnitShield
private static UnitShield array st[MAX_UNITS]
private static timer t = null
private static Shield tempShield
unit TARGET
integer N = 0 // number of shields on target
Shield array Shields[MAX_SHIELDS]
private static method UnitWithIndexHasBuff takes integer k, integer forbidden_i, integer BUFFCODE returns boolean
local integer i = 1
loop
exitwhen i > .st[k].N
if .st[k].Shields[i].BUFFCODE == BUFFCODE and not(i==forbidden_i) then
return true
endif
set i = i + 1
endloop
return false
endmethod
private static method RemoveUnitFromIndexerByIndex takes integer k returns nothing
local integer i = 1
set INDEXED_UNITS[k] = null
loop
exitwhen i > .st[k].N
call UnitRemoveAbility(.st[k].TARGET,.st[k].Shields[i].AURACODE)
call UnitRemoveAbility(.st[k].TARGET,.st[k].Shields[i].BUFFCODE)
call .st[k].Shields[i].destroy()
set .st[k].Shields[i] = 0
set i = i + 1
endloop
call .st[k].destroy()
set .st[k] = 0
if k == INDEXED_UNIT_COUNT then
set INDEXED_UNIT_COUNT = INDEXED_UNIT_COUNT - 1
endif
endmethod
private static method RemoveShieldByIndexes takes integer k, integer i returns nothing
if not UnitWithIndexHasBuff(k,i,.st[k].Shields[i].BUFFCODE) then
call UnitRemoveAbility(.st[k].TARGET,.st[k].Shields[i].AURACODE)
call UnitRemoveAbility(.st[k].TARGET,.st[k].Shields[i].BUFFCODE)
endif
call .st[k].Shields[i].destroy()
set .st[k].Shields[i] = .st[k].Shields[.st[k].N]
set .st[k].Shields[.st[k].N] = 0
set .st[k].N = .st[k].N - 1
//if no shields on unit remove it from indexer
if .st[k].N == 0 then //and not (IsUnitType(.st[k].TARGET,UNIT_TYPE_HERO))
call RemoveUnitFromIndexerByIndex(k)
endif
endmethod
private static method onTimer takes nothing returns nothing
local integer k = 1
local integer i = 1
local integer j = 1
local boolean flag = false
//call BJDebugMsg("Timer Tick")
loop
exitwhen k > INDEXED_UNIT_COUNT
if IsUnitDeadBX(.st[k].TARGET) then
call RemoveUnitFromIndexerByIndex(k)
else
set i = 1
loop
exitwhen i > .st[k].N
//call BJDebugMsg("Lowering time for k=" + I2S(k) + ", i=" + I2S(i) + " by " + R2S(TIMER_PERIOD))
set .st[k].Shields[i].REMAINING_TIME = .st[k].Shields[i].REMAINING_TIME - TIMER_PERIOD
if .st[k].Shields[i].REMAINING_TIME <= 0. then
//call BJDebugMsg("Shield " + I2S(i) + " for " + GetUnitName(.st[k].TARGET) + " with index k=" + I2S(k) + " has expired.")
call RemoveShieldByIndexes(k,i)
set i = i - 1
endif
set i = i + 1
endloop
//Sorting shields in increasing in REMAINING_TIME order
set i = 1
loop
exitwhen i > .st[k].N
set j = i+1
loop
exitwhen j > .st[k].N
if .st[k].Shields[i].REMAINING_TIME > .st[k].Shields[j].REMAINING_TIME then
set tempShield = .st[k].Shields[i]
set .st[k].Shields[i] = .st[k].Shields[j]
set .st[k].Shields[j] = tempShield
endif
set j = j + 1
endloop
set i = i + 1
endloop
endif
set k = k + 1
endloop
endmethod
static method IncreaseShieldDurability takes unit TARGET, unit CASTER, integer BUFFCODE, real durability, boolean PERCENTMAXDUR returns boolean
local integer k = 0
local integer i = 1
if IsUnitShielded(TARGET) then
set k = GetShieldUnitIndex(TARGET)
else
return false
endif
loop
exitwhen i > .st[k].N
if (.st[k].Shields[i].BUFFCODE == BUFFCODE) or (BUFFCODE == 0) then
if (.st[k].Shields[i].CASTER == CASTER) or (CASTER == null) then
if PERCENTMAXDUR then
set .st[k].Shields[i].DURABILITY = .st[k].Shields[i].DURABILITY + .st[k].Shields[i].MAX_DURABILITY*durability
else
set .st[k].Shields[i].DURABILITY = .st[k].Shields[i].DURABILITY + durability
endif
endif
endif
set i = i + 1
endloop
return true
endmethod
static method IncreaseShieldDuration takes unit TARGET, unit CASTER, integer BUFFCODE, real duration returns boolean
local integer k = 0
local integer i = 1
if IsUnitShielded(TARGET) then
set k = GetShieldUnitIndex(TARGET)
else
return false
endif
loop
exitwhen i > .st[k].N
if (.st[k].Shields[i].BUFFCODE == BUFFCODE) or (BUFFCODE == 0) then
if (.st[k].Shields[i].CASTER == CASTER) or (CASTER == null) then
set .st[k].Shields[i].REMAINING_TIME = .st[k].Shields[i].REMAINING_TIME + duration
endif
endif
set i = i + 1
endloop
return true
endmethod
//Try to block a part of damage (AMOUNT) of a given type (damageTYPE) for unit (whichUnit) and returns the blocked part
static method Block takes unit whichUnit, real AMOUNT, integer damageTYPE returns real
local integer k = 0
local integer i = 1
local real blocked = 0.
local real curAmount = AMOUNT
local real tempAmount = 0.
if IsUnitShielded(whichUnit) then
set k = GetShieldUnitIndex(whichUnit)
else
return 0.
endif
loop
exitwhen i > .st[k].N or curAmount <= 0.
if (.st[k].Shields[i].BLOCK_DAMAGE_TYPE == damageTYPE) or (.st[k].Shields[i].BLOCK_DAMAGE_TYPE == -1) then
set tempAmount = AMOUNT * .st[k].Shields[i].BLOCK_MULT
if tempAmount > curAmount then
set tempAmount = curAmount
endif
if .st[k].Shields[i].DURABILITY > tempAmount then
set .st[k].Shields[i].DURABILITY = .st[k].Shields[i].DURABILITY - tempAmount
set blocked = blocked + tempAmount
set curAmount = curAmount - tempAmount
else
set blocked = blocked + .st[k].Shields[i].DURABILITY
set curAmount = curAmount - .st[k].Shields[i].DURABILITY
call RemoveShieldByIndexes(k,i)
set i = i - 1
endif
endif
set i = i + 1
endloop
return blocked
endmethod
static method Add takes unit TARGET, unit CASTER, real AMOUNT, real DURATION, integer damageTYPE, real Mult, integer AURACODE, integer BUFFCODE returns nothing
local integer k = GetShieldUnitIndex(TARGET)
if t == null then
set t = CreateTimer()
//call BJDebugMsg("Initializing timer for shields ")
call TimerStart(t,TIMER_PERIOD,true,function UnitShield.onTimer)
endif
if .st[k] == 0 then
set .st[k] = UnitShield.create()
//call BJDebugMsg("Creating UnitShields struct for "+ GetUnitName(TARGET) + " with index " + I2S(k))
else
//call BJDebugMsg("UnitShields struct for " + GetUnitName(TARGET) + " with index " + I2S(k) + " is already initialized.")
endif
if not(.st[k].TARGET == TARGET) then
set .st[k].TARGET = TARGET
set .st[k].N = 0
endif
set .st[k].N = .st[k].N + 1
if .st[k].Shields[.st[k].N] == 0 then
set .st[k].Shields[.st[k].N] = Shield.create()
//call BJDebugMsg("Initializing Shields struct for " + GetUnitName(TARGET) + " with index k=" + I2S(k) + " and i=" + I2S(.st[k].N))
else
//call BJDebugMsg("Shields struct for " + GetUnitName(TARGET) + " with index k=" + I2S(k) + " and i=" + I2S(.st[k].N) + " is already initialized.")
endif
set .st[k].Shields[.st[k].N].CASTER = CASTER
set .st[k].Shields[.st[k].N].AURACODE = AURACODE
set .st[k].Shields[.st[k].N].BUFFCODE = BUFFCODE
set .st[k].Shields[.st[k].N].REMAINING_TIME = DURATION
set .st[k].Shields[.st[k].N].DURABILITY = AMOUNT
set .st[k].Shields[.st[k].N].MAX_DURABILITY = AMOUNT
set .st[k].Shields[.st[k].N].BLOCK_DAMAGE_TYPE = damageTYPE
if Mult < 0. then
set Mult = 0.
endif
if Mult <= 1. then
set .st[k].Shields[.st[k].N].BLOCK_MULT = Mult
else
set .st[k].Shields[.st[k].N].BLOCK_MULT = 1.
endif
if not UnitWithIndexHasBuff(k,.st[k].N,BUFFCODE) then
call UnitAddAbility(TARGET,AURACODE)
endif
endmethod
endstruct
endlibrary
library SimulateItemDrop
globals
private constant real MIN_TIME = 2.
private constant real MAX_TIME = 3.
private constant real MIN_HEIGHT = 150.
private constant real MAX_HEIGHT = 300.
private constant integer GEM_ITEM_TYPE = 'I017'
private constant integer GEM_MISSILE = 'h046'
private constant real GEM_AOE_DROP = 250.
endglobals
private function onTimerCreateItem takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer itemType = LoadInteger(udg_hash,GetHandleId(t),1)
local real x = LoadReal(udg_hash,GetHandleId(t),2)
local real y = LoadReal(udg_hash,GetHandleId(t),3)
call CreateItem(itemType,x,y)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
endfunction
function SimulateItemDropAtPoint takes real x, real y, real aoe, integer itemType, integer missileUnitType returns nothing
local timer t = CreateTimer()
local real TIME = GetRandomReal(MIN_TIME,MAX_TIME)
local real ANGLE = GetRandomReal(0.,360.)
local unit DUMMY = CreateUnit(ORGRIMMAR,missileUnitType,x,y,ANGLE)
local real xn = x + aoe*Cos(Deg2Rad(ANGLE))
local real yn = y + aoe*Sin(Deg2Rad(ANGLE))
call UnitApplyTimedLife(DUMMY,'BHwe',TIME)
call ParKnock(DUMMY,GetRandomReal(MIN_HEIGHT,MAX_HEIGHT),aoe,TIME,ANGLE,false,"")
call SaveInteger(udg_hash,GetHandleId(t),1,itemType)
call SaveReal(udg_hash,GetHandleId(t),2,xn)
call SaveReal(udg_hash,GetHandleId(t),3,yn)
call TimerStart(t,TIME,false,function onTimerCreateItem)
set t = null
endfunction
function DropGemFromPoint takes real x, real y returns nothing
call SimulateItemDropAtPoint(x,y,GEM_AOE_DROP, GEM_ITEM_TYPE,GEM_MISSILE)
endfunction
function CalculateGemDropFromPoint takes real x, real y returns nothing
local integer j = 0
local integer k = udg_PlayerCount
local integer m = 0
local integer p = 10*k+40
set j = 1
loop
exitwhen j>k
set m = GetRandomInt(1,100)
if m <= p then
call DropGemFromPoint(x,y)
endif
set p = R2I(p/1.5)
set j = j + 1
endloop
endfunction
endlibrary
library Lightnings requires TerrainHeight
globals
private hashtable udg_Hash = InitHashtable()
endglobals
function TimerLightning takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local lightning l = LoadLightningHandle(udg_Hash, hid, 0)
call DestroyLightning(l)
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash, hid)
set t = null
set l = null
endfunction
function TimerLightningMoveUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local lightning l = LoadLightningHandle(udg_Hash, hid, 0)
local unit u1 = LoadUnitHandle(udg_Hash, hid, 1)
local unit u2 = LoadUnitHandle(udg_Hash, hid, 2)
local real time = LoadReal(udg_Hash, hid, 3)
local real timen = LoadReal(udg_Hash, hid, 4)
local boolean check = LoadBoolean(udg_Hash, hid, 5)
if timen>=time then
call DestroyLightning(l)
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash, hid)
else
call MoveLightningEx(l, check, GetUnitX(u1), GetUnitY(u1), GetTerrainZ(GetUnitX(u1), GetUnitY(u1)) + GetUnitFlyHeight(u1) + 50., GetUnitX(u2), GetUnitY(u2), GetTerrainZ(GetUnitX(u2), GetUnitY(u2)) + GetUnitFlyHeight(u1) + 50.)
call SaveReal(udg_Hash, hid, 4, timen+0.02)
endif
set t = null
set l = null
set u1 = null
set u2 = null
endfunction
function TimerLightningMoveTo takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hid = GetHandleId(t)
local lightning l = LoadLightningHandle(udg_Hash, hid, 0)
local unit u1 = LoadUnitHandle(udg_Hash, hid, 1)
local unit u2 = LoadUnitHandle(udg_Hash, hid, 2)
local real r = LoadReal(udg_Hash, hid, 3)
local real r1 = LoadReal(udg_Hash, hid, 4)
local real ang = Atan2(GetUnitY(u2)-GetUnitY(u1), GetUnitX(u2)-GetUnitX(u1))
local real x = GetUnitX(u1)+r*Cos(ang)
local real y = GetUnitY(u1)+r*Sin(ang)
local real sq = SquareRoot((x-GetUnitX(u2))*(x-GetUnitX(u2))+(y-GetUnitY(u2))*(y-GetUnitY(u2)))
local boolean check = LoadBoolean(udg_Hash, hid, 5)
if sq<50. then
call DestroyLightning(l)
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash, hid)
else
call MoveLightning(l, check, GetUnitX(u1), GetUnitY(u1), x, y)
call SaveReal(udg_Hash, hid, 3, r+r1)
endif
set t = null
set l = null
set u1 = null
set u2 = null
endfunction
function LightningUU takes string m, boolean check, unit u1, unit u2, real time returns nothing
local lightning l = AddLightning(m, check, GetUnitX(u1), GetUnitY(u1), GetUnitX(u2), GetUnitY(u2))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningPP takes string m, boolean check, location l1, location l2, real time returns nothing
local lightning l = AddLightning(m, check, GetLocationX(l1), GetLocationY(l1), GetLocationX(l2), GetLocationY(l2))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningCoord takes string m, boolean check, real x1, real y1, real x2, real y2, real time returns nothing
local lightning l = AddLightning(m, check, x1, y1, x1, y2)
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningExUU takes string m, boolean check, unit u1, unit u2, real time returns nothing
local lightning l = AddLightningEx(m, check, GetUnitX(u1), GetUnitY(u1), GetUnitFlyHeight(u1), GetUnitX(u2), GetUnitY(u2), GetUnitFlyHeight(u2))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningExUUZ takes string m, boolean check, unit u1, real z1, unit u2, real z2, real time returns lightning
local lightning l = AddLightningEx(m, check, GetUnitX(u1), GetUnitY(u1), z1, GetUnitX(u2), GetUnitY(u2), z2)
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
return l
endfunction
function LightningExPP takes string m, boolean check, location l1, location l2, real time returns nothing
local lightning l = AddLightningEx(m, check, GetLocationX(l1), GetLocationY(l1), GetLocationZ(l1), GetLocationX(l2), GetLocationY(l2), GetLocationZ(l2))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningExCoord takes string m, boolean check, real x1, real y1, real z1, real x2, real y2, real z2, real time returns nothing
local lightning l = AddLightningEx(m, check, x1, y1, z1, x2, y2, z2)
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningDownU takes string m, boolean check, unit u, real time returns nothing
local lightning l = AddLightningEx(m, check, GetUnitX(u), GetUnitY(u), 1500., GetUnitX(u), GetUnitY(u), GetUnitFlyHeight(u))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningDownP takes string m, boolean check, location p, real time returns nothing
local lightning l = AddLightningEx(m, check, GetLocationX(p), GetLocationY(p), 1500., GetLocationX(p), GetLocationY(p), GetLocationZ(p))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningDownCoord takes string m, boolean check, real x, real y, real time returns nothing
local lightning l = AddLightningEx(m, check, x, y, 1500., x, y, 0.)
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call TimerStart(t, time, false, function TimerLightning)
set t = null
set l = null
endfunction
function LightningUnit takes string m, boolean check, unit u1, unit u2, real time returns lightning
local lightning l = AddLightning(m, check, GetUnitX(u1), GetUnitY(u1), GetUnitX(u2), GetUnitY(u2))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call SaveUnitHandle(udg_Hash, hid, 1, u1)
call SaveUnitHandle(udg_Hash, hid, 2, u2)
call SaveReal(udg_Hash, hid, 3, time)
call SaveReal(udg_Hash, hid, 4, 0.)
call SaveBoolean(udg_Hash, hid, 5, check)
call TimerStart(t, 0.02, true, function TimerLightningMoveUnit)
set t = null
return l
endfunction
function LightningMoveUU takes string m, boolean check, unit u1, unit u2, real r returns nothing
local real ang = Atan2(GetUnitY(u2)-GetUnitY(u1), GetUnitX(u2)-GetUnitX(u1))
local lightning l = AddLightning(m, check, GetUnitX(u1), GetUnitY(u1), GetUnitX(u1), GetUnitY(u1))
local timer t = CreateTimer()
local integer hid = GetHandleId(t)
call SaveLightningHandle(udg_Hash, hid, 0, l)
call SaveUnitHandle(udg_Hash, hid, 1, u1)
call SaveUnitHandle(udg_Hash, hid, 2, u2)
call SaveReal(udg_Hash, hid, 3, r)
call SaveReal(udg_Hash, hid, 4, r)
call SaveBoolean(udg_Hash, hid, 5, check)
call TimerStart(t, 0.02, true, function TimerLightningMoveTo)
set t = null
set l = null
endfunction
endlibrary
library MakeUnitPassive requires IsUnitDead
function IsUnitPassive takes unit whichUnit returns boolean
return IsUnitType(whichUnit,UNIT_TYPE_PEON)
endfunction
private function onTimerAddWorker takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call UnitRemoveType(u,UNIT_TYPE_PEON)
call UnitAddType(u,UNIT_TYPE_PEON)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
function MakeUnitPassive takes unit whichUnit returns nothing
local timer t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichUnit)
call TimerStart(t,0.5, false, function onTimerAddWorker)
set t = null
endfunction
private function onTimerRemoveWorker takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call UnitRemoveType(u,UNIT_TYPE_PEON)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
function MakeUnitAggressive takes unit whichUnit returns nothing
local timer t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichUnit)
call TimerStart(t,0.5, false, function onTimerRemoveWorker)
set t = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library IsUnitDead
function IsUnitDeadBX takes unit u returns boolean
return GetUnitTypeId(u) == 0 or IsUnitType(u, UNIT_TYPE_DEAD)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ListModule
//===========================================================================
// Information:
//==============
//
// This module allows you to create a linked list containing all of the allocated
// instances of a struct. Iterating through a linked list is slightly faster than the
// typical method of looping through an array containing all of the instances. However,
// getting a random struct from a list is an O(n) operation instead of O(1) as with
// SetModule. This should be a good trade as most systems don't need random access.
//
// There is no speed loss while iterating through structs compared to doing
// it yourself, since all of method calls used while iterating get inlined. The best
// use for this module is to hide a lot of ugly low-level code from your systems.
//
// How to use List:
//==================
//
// Implement the List module in your struct. Your struct will gain all of the
// following methods:
//
// (static) getLength: Returns an integer indicating the number of structs in the list.
//
// (static) getRandom: Returns a random struct from the list. Note that this is rather
// slow due to the fact that this is a linked list implementation.
//
// (static) getFirst: Returns the first struct in the list.
//
// (static) getLast: Returns the last struct in the list.
//
// getNext: Returns the next struct in the list.
//
// getPrev: Returns the previous struct in the list.
//
// inList: Returns a boolean indicating whether this struct is in the list.
//
// addList: Adds this struct to the list. Returns false if adding failed because the
// list is being destroyed or the struct was already in the list.
//
// removeList: Removes this struct from the list. Returns false if removal failed
// because the struct was not in the list.
//
// (static) destroyList: Destroys all of the structs in the list.
//
// Example of List usage:
//========================
//
// struct YourStruct
// implement List
//
// static method create takes nothing returns YourStruct
// local YourStruct ys = .allocate()
// call ys.addList()
// return ys
// endmethod
//
// method onDestroy takes nothing returns nothing
// call .removeList()
// endmethod
//
// static method GetRandomStruct takes nothing returns YourStruct
// return .getRandom() //That was easy... but slow.
// endmethod
//
// static method LoopThroughAllYourStructs takes nothing returns nothing
// local YourStruct ys = .getFirst() //This is inlined to a variable read.
// loop
// exitwhen ys == 0
// //Do something with the YourStruct instance here.
// set ys = ys.getNext() //This is inlined to an array read.
// endloop
// endmethod
// endstruct
//
//===========================================================================
module List
private static boolean destroyinglist = false
private static thistype length = 0
private static thistype first = 0
private static thistype last = 0
private thistype prev = 0
private thistype next = 0
private boolean inlist = false
static method getLength takes nothing returns integer
return .length
endmethod
static method getFirst takes nothing returns thistype
return .first
endmethod
static method getLast takes nothing returns thistype
return .last
endmethod
static method getRandom takes nothing returns thistype
local thistype s = .first
local thistype array list
local integer n = -1
loop
exitwhen s == 0
set n = n + 1
set list[n] = s
set s = s.next
endloop
if n == -1 then
return 0
endif
return list[GetRandomInt(0, n)]
endmethod
method getNext takes nothing returns thistype
return .next
endmethod
method getPrev takes nothing returns thistype
return .prev
endmethod
method inList takes nothing returns boolean
return .inlist
endmethod
method addList takes nothing returns boolean
if not .inlist and not .destroyinglist then
set .inlist = true
if .first == 0 then
set .first = this
else
set .prev = .last
set .prev.next = this
endif
set .last = this
set .length = .length + 1
return true
endif
return false
endmethod
method removeList takes nothing returns boolean
if .inlist then
if .destroyinglist then
return true
endif
set .inlist = false
if .first == this then
set .first = .next
endif
if .last == this then
set .last = .prev
endif
set .prev.next = .next
set .next.prev = .prev
set .length = .length - 1
return true
endif
return false
endmethod
static method destroyList takes nothing returns nothing
local thistype s = .first
if not .destroyinglist then
loop
exitwhen s == 0
set .destroyinglist = false
call s.removeList()
set .destroyinglist = true
call s.destroy()
set s = s.next
endloop
set .destroyinglist = false
endif
endmethod
endmodule
endlibrary
//TESH.scrollpos=300
//TESH.alwaysfold=0
library RegionalFog requires ListModule
/**** RegionalFog 1.1b by Opossum ************************************************
RegionalFog is a vJass system that enables an easy syntax to create fogs across
certain rects and optionally add day/night cycles to them. To set up a fog
you first have to declare a fogData which includes the final values for the
created fog:
local fogData fd = fogData.create()
You can then change any of its members independently:
set fd.zStart = 2500
set fd.green = 1
Unaltered members will just use the default values below (-> struct fogData).
When you are done setting up the fogData you create the fog itself.
There are two different types of fogs:
- Rect Fogs created by:
local fog f = fog.createFromRect(fogData dayData, rect where)
or by using coordinates directly:
local fog f = fog.create(fogData dayData, real minX, real maxX, real minY, real maxY)
- Circular Fogs created by
local fog f = fog.createCircular(fogData dayData, real centerX, real centerY, real radius)
Rects can be destroyed after creating a fog if you do not need them anymore. However,
fogDatas may not be destroyed as long as their parent fog(s) are still in use.
You can safely use a single fogData for multiple fogs, though.
Fog structs feature a blendWidth value that determines a transition zone in which
fog values are smoothly blended into each other to make it feel more natural.
By default blendWidth is set to 0 meaning that as soon as you enter a fog's range
its values are applied immediately.
Positive blendWidth values add the transition zone to the rect while negative values
will let the transition zone go inwards:
set f.blendWidth = 500 //going outwards
set f.blendWidth = -500 //going inwards
If you want a fog to be dynamic and change depending on daytime you can add another
fogData to it that will be used as the midnight fog setting.
set f.nightData = fd2
This will cause the system to smoothly blend day and night settings into each other
over fogData.TRANSITION_DURATION ingame hours.
If you want a fog to not be dynamic anymore set the nightData pointer to 0 again:
set f.nightData = 0
Any of a fog's or fogData's non-static members can be modified at any time without
breaking the system.
If no fog is set up for the current camera position or the fogs affecting this point
are too "thin", a default fog will be added to that point. Think of it like a
background layer in paint programs that is only visible if above layers are too
transparent. The default fog values can be modified below by changing fogData's
default values.
You can access (readonly) these values and also the current fog values via two static
fog members "defaultFog" and "currentFog".
call BJDebugMsg("default fog zStart = "+R2S(fog.defaultFog.zStart))
call BJDebugMsg("current fog zStart = "+R2S(fog.currentFog.zStart))
Keep in mind that currentFog's members are asynchronous and should only be used in
code that does not cause net traffic. Using it in global code might cause desyncs.
-----------------------------------------------------------------------------------
This system requires vJass and ListModule by grim001.
********************************************************************************/
struct fogData
// Calibration
static constant real SAMPLE_RATE = 0.10 /* Determines the interval during
which the camera position is
sampled and the global fog is
updated. Lower values may lower
performance. */
static constant real TRANSITION_DURATION = 6 /* Determines the duration of a
day/night transition centered
at 6 am/pm.
Example: If set to 6 the system
will start to blend from night
to day settings at 3 am and will
finish at 9 am (= 6 ingame hours). */
real zStart = 2000
real zEnd = 3000
real red = 0
real green = 0
real blue = 0
// End of calibration. Don't change anything below!
endstruct
struct fog
readonly static fogData defaultData
readonly static fogData currentData
readonly static real dawnStart
readonly static real dawnEnd
readonly static real duskStart
readonly static real duskEnd
fogData dayData
fogData nightData = 0
readonly boolean circular = false
real blendWidth = 0
real minX // not used if circular
real maxX // not used if circular
real minY // not used if circular
real maxY // not used if circular
real centerX // not used if rectangular
real centerY // not used if rectangular
real radius // not used if rectangular
implement List
static method create takes fogData dayData, real minX, real maxX, real minY, real maxY returns fog
local fog f = fog.allocate()
set f.dayData = dayData
set f.minX = minX
set f.maxX = maxX
set f.minY = minY
set f.maxY = maxY
call f.addList()
return f
endmethod
static method createFromRect takes fogData dayData, rect where returns fog
local fog f = fog.allocate()
set f.dayData = dayData
set f.minX = GetRectMinX(where)
set f.maxX = GetRectMaxX(where)
set f.minY = GetRectMinY(where)
set f.maxY = GetRectMaxY(where)
call f.addList()
return f
endmethod
static method createCircular takes fogData dayData, real centerX, real centerY, real radius returns fog
local fog f = fog.allocate()
set f.dayData = dayData
set f.centerX = centerX
set f.centerY = centerY
set f.radius = radius
set f.circular = true
call f.addList()
return f
endmethod
method onDestroy takes nothing returns nothing
call .removeList()
endmethod
static method sample takes nothing returns nothing
local fog f = .getFirst()
local real time = GetFloatGameState(GAME_STATE_TIME_OF_DAY)
local real x = GetCameraTargetPositionX()
local real y = GetCameraTargetPositionY()
local real dx
local real dy
local real dayratio
local real d
local real r = 0
if (time >= .duskEnd and time < 24) or (time >= 0 and time < .dawnStart) then
set dayratio = 0
elseif time >= .dawnStart and time < .dawnEnd then
set dayratio = 1/fogData.TRANSITION_DURATION * (time-6) + 0.5
elseif time >= .dawnEnd and time < .duskStart then
set dayratio = 1
elseif time >= .duskStart and time < .duskEnd then
set dayratio = 1/fogData.TRANSITION_DURATION * (18-time) + 0.5
endif
set .currentData.zStart = 0
set .currentData.zEnd = 0
set .currentData.red = 0
set .currentData.green = 0
set .currentData.blue = 0
loop
exitwhen f == 0
if f.circular then
set dx = x-f.centerX
set dy = y-f.centerY
set d = SquareRoot(dx*dx+dy*dy)
if f.blendWidth <= 0 then
if d > f.radius then
set d = 0
elseif d <= f.radius + f.blendWidth then
set d = 1
else
set d = 1-(f.radius+f.blendWidth-d)/f.blendWidth
endif
else
if d > f.radius + f.blendWidth then
set d = 0
elseif d <= f.radius then
set d = 1
else
set d = (f.radius+f.blendWidth-d)/f.blendWidth
endif
endif
else
set dx = f.minX-x
set d = x-f.maxX
if d > dx then
set dx = d
endif
set dy = f.minY-y
set d = y-f.maxY
if d > dy then
set dy = d
endif
if dx > dy then
set d = dx
else
set d = dy
endif
if f.blendWidth >= 0 then
if d > f.blendWidth then
set d = 0
elseif d <= 0 then
set d = 1
else
set d = 1 - d/f.blendWidth
endif
elseif f.blendWidth < 0 then
if d <= f.blendWidth then
set d = 1
elseif d > 0 then
set d = 0
else
set d = d/f.blendWidth
endif
endif
endif
if d != 0 then
set r = r+d
if f.nightData == 0 then
set .currentData.zStart = .currentData.zStart + d*f.dayData.zStart
set .currentData.zEnd = .currentData.zEnd + d*f.dayData.zEnd
set .currentData.red = .currentData.red + d*f.dayData.red
set .currentData.green = .currentData.green + d*f.dayData.green
set .currentData.blue = .currentData.blue + d*f.dayData.blue
else
set dx = d*dayratio
set dy = d-dx
set .currentData.zStart = .currentData.zStart + dx*f.dayData.zStart + dy*f.nightData.zStart
set .currentData.zEnd = .currentData.zEnd + dx*f.dayData.zEnd + dy*f.nightData.zEnd
set .currentData.red = .currentData.red + dx*f.dayData.red + dy*f.nightData.red
set .currentData.green = .currentData.green + dx*f.dayData.green + dy*f.nightData.green
set .currentData.blue = .currentData.blue + dx*f.dayData.blue + dy*f.nightData.blue
endif
endif
set f = f.getNext()
endloop
if r < 1 then
set d = 1-r
set .currentData.zStart = .currentData.zStart + d*.defaultData.zStart
set .currentData.zEnd = .currentData.zEnd + d*.defaultData.zEnd
set .currentData.red = .currentData.red + d*.defaultData.red
set .currentData.green = .currentData.green + d*.defaultData.green
set .currentData.blue = .currentData.blue + d*.defaultData.blue
set r = 1
else
set .currentData.zStart = .currentData.zStart / r
set .currentData.zEnd = .currentData.zEnd / r
set .currentData.red = .currentData.red / r
set .currentData.green = .currentData.green / r
set .currentData.blue = .currentData.blue / r
endif
call SetTerrainFogEx(0, .currentData.zStart, .currentData.zEnd, 0, .currentData.red, .currentData.green, .currentData.blue)
endmethod
static method onInit takes nothing returns nothing
local timer t = CreateTimer()
set .defaultData = fogData.create()
set .currentData = fogData.create()
set .dawnStart = 6 - fogData.TRANSITION_DURATION/2
set .dawnEnd = 6 + fogData.TRANSITION_DURATION/2
set .duskStart = 18 - fogData.TRANSITION_DURATION/2
set .duskEnd = 18 + fogData.TRANSITION_DURATION/2
call TimerStart(t, fogData.SAMPLE_RATE, true, function thistype.sample)
call .sample()
set t = null
endmethod
endstruct
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TerrainHeight
globals
private location loc = Location(0, 0)
endglobals
function GetTerrainZ takes real x, real y returns real
call MoveLocation(loc, x, y)
return GetLocationZ(loc)
endfunction
endlibrary
library IsPointPathable
globals
private constant integer TEST_ITEM_CODE = 'I03T'
endglobals
function IsPointPathable takes real x, real y returns boolean
local item it = CreateItem(TEST_ITEM_CODE,x,y)
local real xn = GetItemX(it)
local real yn = GetItemY(it)
local boolean Pathable = true
if (x-xn)*(x-xn)+(y-yn)*(y-yn) >= 100. then
//call DisplayTimedTextToPlayer(Player(0),0,0,15.,"Item created at: (" + R2S(xn)+","+R2S(yn)+") instead of (" + R2S(x) + ","+R2S(y)+")")
set Pathable = false
endif
call RemoveItem(it)
set it = null
return Pathable
endfunction
endlibrary
library Knockbackable
globals
private constant integer ISGIANT_HASH = 300
endglobals
function IsUnitKnockbackable takes unit whichUnit returns boolean
return ( not IsUnitType(whichUnit,UNIT_TYPE_HERO) ) and (not LoadBoolean(udg_hash,GetHandleId(whichUnit),ISGIANT_HASH) )
endfunction
function MakeUnitGiant takes unit whichUnit, boolean flag returns nothing
call SaveBoolean(udg_hash,GetHandleId(whichUnit),ISGIANT_HASH,flag)
endfunction
function IsUnitGiant takes unit whichUnit returns boolean
return LoadBoolean(udg_hash,GetHandleId(whichUnit),ISGIANT_HASH)
endfunction
endlibrary
//TESH.scrollpos=82
//TESH.alwaysfold=0
library ParabolaMovement
//call ParKnock(unit,height,distance,duration,angle,check path,string se)
private struct st
static st array data
static timer t = CreateTimer()
static integer index = 0
unit u = null
real dist = 0.
real Z = 0.
real dur = 0.
real angle = 0.
real Xspeed = 0.
real Yspeed = 0.
real Xstart = 0.
real Ystart = 0.
boolean path = false
string SFX = ""
static method ParabolaZ takes real h, real d, real x returns real
return (4 * h / d) * (d - x) * (x / d)
endmethod
static method onTimer takes nothing returns nothing
local integer i = 0
local real x = 0.
local real y = 0.
local real dist = 0.
loop
exitwhen i >= .index
set x = GetUnitX(.data[i].u) + .data[i].Xspeed
set y = GetUnitY(.data[i].u) + .data[i].Yspeed
set dist = SquareRoot((x-.data[i].Xstart)*(x-.data[i].Xstart)+(y-.data[i].Ystart)*(y-.data[i].Ystart))
set .data[i].dur = .data[i].dur - 0.04
if .data[i].path then
if IsPointPathable(x,y) then
call DestroyEffect(AddSpecialEffect(.data[i].SFX,x,y ))
call SetUnitX(.data[i].u,x)
call SetUnitY(.data[i].u,y)
else
call SetUnitX(.data[i].u,GetUnitX(.data[i].u))
call SetUnitY(.data[i].u,GetUnitY(.data[i].u))
endif
else
call DestroyEffect(AddSpecialEffect(.data[i].SFX,x,y ))
call SetUnitX(.data[i].u,x)
call SetUnitY(.data[i].u,y)
endif
if GetOwningPlayer(.data[i].u) != Player(7) then
call IssueImmediateOrder(.data[i].u,"stop")
endif
if .data[i].Z > 0. then
call SetUnitFlyHeight(.data[i].u,st.ParabolaZ(.data[i].Z,.data[i].dist,dist),0.)
endif
if .data[i].dur <= 0. then
call SetUnitFlyHeight(.data[i].u,GetUnitDefaultFlyHeight(.data[i].u),0.)
call SetUnitPathing(.data[i].u,true)
call GroupRemoveUnit(BR_AffectedGroup,.data[i].u)
call .data[i].destroy()
set .index = .index - 1
set .data[i] = .data[.index]
if .index == 0 then
call PauseTimer(.t)
endif
set i = i -1
endif
set i = i + 1
endloop
endmethod
static method onCast takes unit whichUnit,real height,real dist,real duration, real angle,boolean path,string SFX returns nothing
set .data[.index] = st.create()
set .data[.index].u = whichUnit
set .data[.index].dist = dist
set .data[.index].Z = height
set .data[.index].dur = duration
set .data[.index].angle = angle
set .data[.index].path = path
set .data[.index].SFX = SFX
set .data[.index].Xspeed = dist / (duration*25.) * Cos(angle*bj_DEGTORAD)
set .data[.index].Yspeed = dist / (duration*25.) * Sin(angle*bj_DEGTORAD)
set .data[.index].Xstart = GetUnitX(whichUnit)
set .data[.index].Ystart = GetUnitY(whichUnit)
call SetUnitPathing(.data[.index].u,false)
if .index == 0 then
call TimerStart(.t,0.04,true,function st.onTimer)
endif
set .index = .index + 1
endmethod
endstruct
function ParKnock takes unit whichUnit,real height,real distance,real duration,real angle,boolean path,string SFX returns nothing
call st.onCast(whichUnit,height,distance,duration,angle,path,SFX)
endfunction
endlibrary
library MakeUnitFall
private function onTimerFall takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real speed = LoadReal(udg_hash,GetHandleId(t),2)
local real duration = LoadReal(udg_hash,GetHandleId(t),3)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),4)
call SetUnitFlyHeight(u, GetUnitFlyHeight(u)+speed,0.)
set elapsed = elapsed + 0.04
if elapsed >= duration then
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),4,elapsed)
endif
set t = null
set u = null
endfunction
function MakeUnitFall takes unit whichUnit, real startHeight, real finalHeight, real duration returns nothing
local timer t = CreateTimer()
local real speed = (finalHeight-startHeight) / duration
call UnitAddAbility(whichUnit,'Aave')
call UnitRemoveAbility(whichUnit,'Aave')
call SetUnitFlyHeight(whichUnit,startHeight,0)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichUnit)
call SaveReal(udg_hash,GetHandleId(t),2,speed/25.)
call SaveReal(udg_hash,GetHandleId(t),3,duration)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call TimerStart(t,0.04,true,function onTimerFall)
set t = null
endfunction
endlibrary
//TESH.scrollpos=88
//TESH.alwaysfold=0
library DamageOverTime initializer Init requires IsUnitDead
//call DOT (Damager,Taker,Damage,Duration,Period,groupindex,SFX,attach,permanent)
globals
group array DOTED_Units[6]
integer array DOTED_ABILS[6]
integer array DOTED_BUFFS[6]
private integer MAX_DOTS = 6
endglobals
private function Init takes nothing returns nothing
set DOTED_Units[1] = CreateGroup() //Burning units
set DOTED_Units[2] = CreateGroup() //Bleeding units
set DOTED_Units[3] = CreateGroup() //Freezing units
set DOTED_Units[4] = CreateGroup() //Plagued units
set DOTED_Units[5] = CreateGroup() //Poisoned units
set DOTED_Units[6] = CreateGroup() //Shadowed units
set DOTED_ABILS[1] = 'A02C'
set DOTED_ABILS[2] = 'A02D'
set DOTED_ABILS[3] = 'A02E'
set DOTED_ABILS[4] = 'A03E'
set DOTED_ABILS[5] = 'A043'
set DOTED_ABILS[6] = 'A07X'
set DOTED_BUFFS[1] = 'B00K'
set DOTED_BUFFS[2] = 'B00L'
set DOTED_BUFFS[3] = 'B00M'
set DOTED_BUFFS[4] = 'B00Y'
set DOTED_BUFFS[5] = 'B01B'
set DOTED_BUFFS[6] = 'B02D'
endfunction
function IsUnitDotBurned takes unit whichUnit returns boolean
if GetUnitAbilityLevel(whichUnit,DOTED_BUFFS[1])>0 then
return true
else
return false
endif
endfunction
function IsUnitDotBleeding takes unit whichUnit returns boolean
if GetUnitAbilityLevel(whichUnit,DOTED_BUFFS[2])>0 then
return true
else
return false
endif
endfunction
function IsUnitDotFreezed takes unit whichUnit returns boolean
if GetUnitAbilityLevel(whichUnit,DOTED_BUFFS[3])>0 then
return true
else
return false
endif
endfunction
function IsUnitDotPlagued takes unit whichUnit returns boolean
if GetUnitAbilityLevel(whichUnit,DOTED_BUFFS[4])>0 then
return true
else
return false
endif
endfunction
function IsUnitDotPoisoned takes unit whichUnit returns boolean
if GetUnitAbilityLevel(whichUnit,DOTED_BUFFS[5])>0 then
return true
else
return false
endif
endfunction
function IsUnitDoted takes unit whichUnit returns boolean
local integer i = 1
loop
exitwhen i > MAX_DOTS
if GetUnitAbilityLevel(whichUnit,DOTED_BUFFS[i])>0 then
return true
endif
set i = i + 1
endloop
return false
endfunction
private struct st
static st array data
static timer t = CreateTimer()
static integer index = 0
unit DAMAGER = null
unit TAKER = null
effect E = null
real DMG = 0.
real DUR = 0.
real PER = 0.
real TICK = 0.
integer GINDEX = 0
string SFX = ""
string ATTACH = ""
boolean PERM = false
static method onTimer takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= .index
set .data[i].TICK = .data[i].TICK + 0.04
if .data[i].TICK >= .data[i].PER then
set .data[i].TICK = 0.
set .data[i].DUR = .data[i].DUR - .data[i].PER
if not .data[i].PERM then
call DestroyEffect(AddSpecialEffectTarget(.data[i].SFX,.data[i].TAKER,.data[i].ATTACH))
endif
call DealDotTypeDamage(.data[i].DAMAGER,.data[i].TAKER,.data[i].DMG,.data[i].GINDEX)
if .data[i].DUR < .data[i].PER or IsUnitDeadBX(.data[i].TAKER) then
call DestroyEffect(.data[i].E)
call GroupRemoveUnit(DOTED_Units[.data[i].GINDEX],.data[i].TAKER)
call UnitRemoveAbility(.data[i].TAKER,DOTED_ABILS[.data[i].GINDEX])
call UnitRemoveAbility(.data[i].TAKER,DOTED_BUFFS[.data[i].GINDEX])
call .data[i].destroy()
set .index = .index - 1
if .index == 0 then
call PauseTimer(.t)
endif
set .data[i] = .data[.index]
set i = i - 1
endif
endif
set i = i + 1
endloop
endmethod
static method onCast takes unit dmger,unit taker,real dmg,real dur,real period,integer gindex,string sfx,string attach,boolean perm returns nothing
set .data[.index] = st.create()
set .data[.index].DAMAGER = dmger
set .data[.index].TAKER = taker
set .data[.index].DMG = dmg
set .data[.index].DUR = dur
set .data[.index].PER = period
set .data[.index].GINDEX = gindex
set .data[.index].SFX = sfx
set .data[.index].ATTACH = attach
set .data[.index].PERM = perm
set .data[.index].TICK = 0.
call GroupAddUnit(DOTED_Units[gindex],taker)
call UnitAddAbility(taker,DOTED_ABILS[gindex])
if perm then
set .data[.index].E = AddSpecialEffectTarget(sfx,taker,attach)
endif
if .index == 0 then
call TimerStart(.t,0.04,true,function st.onTimer)
endif
set .index = .index + 1
endmethod
endstruct
function DOT takes unit Damager,unit Taker,real Damage,real Duration,real Period,integer groupindex, string SFX,string attach,boolean permanent returns nothing
if not IsUnitInGroup(Taker,DOTED_Units[groupindex]) then
call st.onCast(Damager,Taker,Damage,Duration,Period,groupindex,SFX,attach,permanent)
endif
endfunction
function AUTODOT takes unit Damager,unit Taker,real OverAllDamage,real Duration,real Period,integer groupindex, string SFX,string attach,boolean permanent returns nothing
call DOT(Damager,Taker,OverAllDamage*Period/Duration,Duration,Period,groupindex,SFX,attach,permanent)
endfunction
endlibrary
//TESH.scrollpos=16
//TESH.alwaysfold=0
library AddHeroMoveSpeed //call AddUnitMS(unit,amount,dur,effect,attach)
function RemoveUnitMS takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_hash,id,1)
local real a = LoadReal(udg_hash,id,2)
local effect e = LoadEffectHandle(udg_hash,id,3)
call DestroyEffect(e)
call SetUnitMoveSpeed(u,GetUnitMoveSpeed(u)-a)
call FlushChildHashtable(udg_hash,id)
call DestroyTimer(t)
set t = null
set u = null
set e = null
endfunction
function AddUnitMS takes unit whichUnit, real amount, real duration,string seffect,string attach returns nothing
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local effect e = AddSpecialEffectTarget(seffect,whichUnit,attach)
call SetUnitMoveSpeed(whichUnit,GetUnitMoveSpeed(whichUnit)+amount)
call SaveUnitHandle(udg_hash,id,1,whichUnit)
call SaveReal(udg_hash,id,2,amount)
call SaveEffectHandle(udg_hash,id,3,e)
call TimerStart(t,duration,false,function RemoveUnitMS)
set e = null
set t = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library IncHeroParameter
globals
integer IHP_ABI = 0
integer IHP_BUFFER = 0
endglobals
private struct st
static st array data
static integer index = 0
static timer t = CreateTimer()
unit u = null
effect SFX = null
real value = 0.
real dur = 0
integer hkey = 0
integer abi = 0
integer buffer = 0
static method onTimer takes nothing returns nothing
local integer i = 0
local real a = 0.
loop
exitwhen i >= .index
set .data[i].dur = .data[i].dur - 0.04
if .data[i].dur <= 0 or IsUnitType(.data[i].u,UNIT_TYPE_DEAD) then
set a = LoadReal(udg_hash,GetHandleId(.data[i].u),.data[i].hkey)
call SaveReal(udg_hash,GetHandleId(.data[i].u),.data[i].hkey,a - .data[i].value)
call DestroyEffect(.data[i].SFX)
call UnitRemoveAbility(.data[i].u,.data[i].abi)
call UnitRemoveAbility(.data[i].u,.data[i].buffer)
call .data[i].destroy()
set .index = .index - 1
if .index == 0 then
call PauseTimer(.t)
endif
set .data[i] = .data[.index]
set i = i - 1
endif
set i = i + 1
endloop
endmethod
static method onCast takes unit whichUnit,real amount,real duration,integer hashkey, string Seffect, string attachpoint returns nothing
local real a = 0.
set .data[.index] = st.create()
set .data[.index].u = whichUnit
set .data[.index].value = amount
set .data[.index].dur = duration
set .data[.index].hkey = hashkey
set .data[.index].SFX = AddSpecialEffectTarget(Seffect,whichUnit,attachpoint)
if IHP_ABI != 0 then
call UnitAddAbility(.data[.index].u,IHP_ABI)
set .data[.index].abi = IHP_ABI
set .data[.index].buffer = IHP_BUFFER
set IHP_ABI = 0
set IHP_BUFFER = 0
endif
set a = LoadReal(udg_hash,GetHandleId(whichUnit),hashkey)
call SaveReal(udg_hash,GetHandleId(whichUnit),hashkey,a + amount)
if .index == 0 then
call TimerStart(.t,0.04,true,function st.onTimer)
endif
set .index = .index + 1
endmethod
endstruct
function SetAddHeroParameterAuraBuff takes integer AuraID, integer BuffID returns nothing
set IHP_ABI = AuraID
set IHP_BUFFER = BuffID
endfunction
function AddHeroParameter takes unit whichUnit,real amount,real duration,integer hashkey, string Seffect, string attachpoint returns nothing
call st.onCast(whichUnit,amount,duration,hashkey,Seffect,attachpoint)
endfunction
/*function ReleaseAbsorb takes nothing returns nothing
local timer t = GetExpiredTimer()
local effect e = LoadEffectHandle(udg_hash,GetHandleId(t),1)
local integer id = LoadInteger(udg_hash,GetHandleId(t),2)
call SaveReal(udg_hash,id,17,0.)
call DestroyEffect(e)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set e = null
endfunction
*/
/*function AddAbsorb takes unit whichUnit, real amount,real duration,string whichEffect, string attach returns nothing
local effect e = LoadEffectHandle(udg_hash,GetHandleId(whichUnit),18)
local timer t = CreateTimer()
call DestroyEffect(e)
set e = null
set e = AddSpecialEffectTarget(whichEffect,whichUnit,attach)
call SaveReal(udg_hash,GetHandleId(whichUnit),17,amount)
call SaveEffectHandle(udg_hash,GetHandleId(whichUnit),18,e)
call SaveEffectHandle(udg_hash,GetHandleId(t),1,e)
call SaveInteger(udg_hash,GetHandleId(t),2,GetHandleId(whichUnit))
call TimerStart(t,duration,false,function ReleaseAbsorb)
set e = null
set t = null
endfunction
*/
endlibrary
//TESH.scrollpos=33
//TESH.alwaysfold=0
library AggroWarning
function FadeForPlayer takes player p, integer alpha, integer red, integer green, integer blue, string tex returns nothing
if GetLocalPlayer() == p then
if tex!="" then
call SetCineFilterTexture(tex)
endif
call SetCineFilterBlendMode(BLEND_MODE_BLEND)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterEndUV(0,0,1,1)
call SetCineFilterEndColor(red,green,blue,alpha)
call DisplayCineFilter(true)
endif
endfunction
function AggroWarningActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local player p = LoadPlayerHandle(udg_hash,GetHandleId(t),1)
local real timeout = LoadReal(udg_hash,GetHandleId(t),2)
local boolean bool = LoadBoolean(udg_hash,GetHandleId(t),3)
if bool then
call SaveBoolean(udg_hash,GetHandleId(t),3,false)
if GetLocalPlayer() == p then
call DisplayCineFilter(false)
endif
call CameraClearNoiseForPlayer(p)
else
call CameraSetEQNoiseForPlayer( p, 15 )
call FadeForPlayer(p,150,255,0,0,"ReplaceableTextures\\CameraMasks\\HazeAndFogFilter_Mask.blp")
call SaveBoolean(udg_hash,GetHandleId(t),3,true)
endif
set timeout = timeout + 0.20
call SaveReal(udg_hash,GetHandleId(t),2,timeout)
if timeout >= 2. then
call CameraClearNoiseForPlayer(p)
if GetLocalPlayer() == p then
call DisplayCineFilter(false)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set p = null
endfunction
function AggroWarning takes player whichPlayer returns nothing
local timer t = CreateTimer()
if GetLocalPlayer() == whichPlayer then
call StartSound(gg_snd_AggroWarningSound)
endif
call SavePlayerHandle(udg_hash,GetHandleId(t),1,whichPlayer)
call TimerStart(t,0.20,true,function AggroWarningActs)
set t = null
endfunction
endlibrary
//TESH.scrollpos=14
//TESH.alwaysfold=0
library FadeInTime
private function FadeInTimeActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_hash,id,1)
local real time = LoadReal(udg_hash,id,2)
local real timeout = LoadReal(udg_hash,id,3)
local integer color = LoadInteger(udg_hash,id,4)
set timeout = timeout + time/24
call SaveReal(udg_hash,id,3,timeout)
set color = color - 11
call SetUnitVertexColor(u,255,255,255,color)
call SaveInteger(udg_hash,id,4,color)
if timeout>=time then
call FlushChildHashtable(udg_hash,id)
call RemoveUnit(u)
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
private function FadeOutTimeActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_hash,id,1)
local real time = LoadReal(udg_hash,id,2)
local real timeout = LoadReal(udg_hash,id,3)
local integer color = LoadInteger(udg_hash,id,4)
set timeout = timeout + time/24
call SaveReal(udg_hash,id,3,timeout)
set color = color + 11
call SetUnitVertexColor(u,255,255,255,color)
call SaveInteger(udg_hash,id,4,color)
if timeout>=time then
call FlushChildHashtable(udg_hash,id)
if LoadBoolean(udg_hash,id,5) then
call RemoveUnit(u)
endif
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
function FadeUnitIn takes unit whichUnit,real time returns nothing
local timer t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichUnit)
call SaveReal(udg_hash,GetHandleId(t),2,time)
call SaveInteger(udg_hash,GetHandleId(t),4,255)
call TimerStart(t,time/24,true,function FadeInTimeActs)
set t = null
endfunction
function FadeUnitOut takes unit whichUnit,real time, boolean removeAfter returns nothing
local timer t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichUnit)
call SetUnitVertexColor(whichUnit,255,255,255,0)
call SaveReal(udg_hash,GetHandleId(t),2,time)
call SaveInteger(udg_hash,GetHandleId(t),4,0)
call SaveBoolean(udg_hash,GetHandleId(t),5,removeAfter)
call TimerStart(t,time/24,true,function FadeOutTimeActs)
set t = null
endfunction
endlibrary
//TESH.scrollpos=94
//TESH.alwaysfold=0
//===========================================================================
// A simple handle counter that shows:
// * Maximum handles reached
// * Elapsed seconds
//
//========== FOR VERSION 1.24+ ONLY ==========
//
// The leaderboard can be accessed with
// HandleCounter_LEADERBOARD
// The clock (timer) can be accessed with
// HandleCounter_CLOCK
//
// This could be useful only if you'd like to see
// if your map is leaking a lot of handles.
// Otherwise it isn't really needed.
//
// Requires a vJASS compiler to work.
//
// To use:
// Create a trigger named HandleCounter,
// convert to custom script and paste this.
//===========================================================================
library HandleCounter initializer Init
//===========================================================================
// Configurables
//===========================================================================
globals
// Leaderboard title/name.
private constant string TITLE = "Handle Counter"
// Text that represents the time.
private constant string TIME_TEXT = "Elapsed Time:"
// Should the leaderboard show time as well? True or false.
private constant boolean SHOW_TIME = true
// How often should the handle count update (of course this is not for the clock).
private constant real UPDATE_PERIOD = 0.25
// Number of locations created for better counting result.
private constant integer STACK_END_TRESHOLD = 15
// Player(0) = Player 1 (Red); Player(1) = Player 2 (Blue); etc.
// Player color of the maximum handles text.
private constant player MAX = Player(0)
// Player color of the time text.
private constant player PLAYER = Player(1)
endglobals
//===========================================================================
// Do not edit bellow this point unless you know what you're doing.
//===========================================================================
globals
public leaderboard LEADERBOARD = null
public timer CLOCK = null
private integer CURRENT_HANDLE = 0
private integer MAX_HANDLE = 0
private integer SECONDS = 0
endglobals
private function UpdateTime takes nothing returns nothing
set SECONDS = SECONDS + 1
call LeaderboardSetItemLabel(LEADERBOARD, 1, TIME_TEXT)
call LeaderboardSetItemValue(LEADERBOARD, 1, SECONDS)
endfunction
private function Callback takes nothing returns nothing
local location array loc
local integer a = 0
local integer index
local integer prevIndex = 0
local integer next = 0
loop
set loc[a] = Location(0., 0.)
set index = GetHandleId(loc[a]) - 0x100000
set a = a + 1
if index == prevIndex + 1 then
set next = next + 1
else
set next = 0
endif
set prevIndex = index
exitwhen next >= STACK_END_TRESHOLD
endloop
call LeaderboardSetItemValue(LEADERBOARD, 0, index - a)
loop
set a = a - 1
call RemoveLocation(loc[a])
set loc[a] = null
exitwhen a <= 0
endloop
endfunction
private function Actions takes nothing returns nothing
local timer tim = GetExpiredTimer()
set LEADERBOARD = CreateLeaderboard()
call LeaderboardSetLabel(LEADERBOARD, TITLE)
call PlayerSetLeaderboard(GetLocalPlayer(), LEADERBOARD)
call LeaderboardDisplay(LEADERBOARD, true)
call TimerStart(tim, UPDATE_PERIOD, true, function Callback)
call LeaderboardAddItem(LEADERBOARD, "Max Handles", 0, MAX)
call LeaderboardSetSizeByItemCount(LEADERBOARD, 1)
if SHOW_TIME then
set CLOCK = CreateTimer()
call TimerStart(CLOCK, 1., true, function UpdateTime)
call LeaderboardAddItem(LEADERBOARD, "", 1, PLAYER)
// Prevent leaderboard showing "1" during the first second.
call LeaderboardSetItemLabel(LEADERBOARD, 1, TIME_TEXT)
call LeaderboardSetItemValue(LEADERBOARD, 1, SECONDS)
call LeaderboardSetSizeByItemCount(LEADERBOARD, 2)
endif
set tim = null
endfunction
private function Init takes nothing returns nothing
call TimerStart(CreateTimer() , 0., false, function Actions)
endfunction
endlibrary
//TESH.scrollpos=52
//TESH.alwaysfold=0
library GameRestart requires MultiHeroRegime
globals
boolean GAME_RESTARTED = false
endglobals
private function SelectHall takes nothing returns nothing
if IsPlayerInForce(GetLocalPlayer(),PLAYER_SELECTORS) then
call ClearSelection()
call SelectUnit(udg_Hall_of_Fame,true)
endif
if CountPlayersInForceBJ(PLAYER_SELECTORS) == 0 then
call DestroyTimer(GetExpiredTimer())
endif
endfunction
private function PreloadRest takes nothing returns nothing
local integer i = 1
local timer t = CreateTimer()
call ClearTextMessages()
call DisplayCineFilter(false)
call UnitApplyTimedLife(CreateUnit(Player(1),'h009',GetRectCenterX(gg_rct_Hero_Arrival),GetRectCenterY(gg_rct_Hero_Arrival),0.),'BHwe',90.)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1., "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ClearSelection()
call SelectUnit(udg_Hall_of_Fame,true)
loop
exitwhen i > udg_PlayerCount
call ForceAddPlayer(PLAYER_SELECTORS,udg_Players[i])
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 5
call IssueImmediateOrder(camera_u[i],"darkportal")
set i = i + 1
endloop
call TimerStart(t,1.,true,function SelectHall)
set t = null
endfunction
private function RemoveUnitsNew takes nothing returns nothing
call FlushChildHashtable(udg_hash,GetHandleId(GetEnumUnit()))
call GroupRemoveUnit(CHAPTER_ONE_GROUP,GetEnumUnit())
call RemoveUnit(GetEnumUnit())
endfunction
private function ShowMboard takes player plr, multiboard mb, boolean show returns nothing
if GetLocalPlayer() == plr then
call MultiboardDisplay(mb,show)
endif
endfunction
private function RemoveItems takes nothing returns nothing
call FlushChildHashtable(udg_hash,GetHandleId(GetEnumItem()))
call RemoveItem(GetEnumItem())
endfunction
private function Restart takes nothing returns nothing
local integer i = 0
local integer j = 1
call PauseAllUnitsBJ(false)
set GAME_RESTARTED = true
call SetPlayerTechResearched(ORGRIMMAR, 'R00J', 0)
//call GroupEnumUnitsInRange(udg_temp_group,GetRectCenterX(gg_rct_Garrosh1),GetRectCenterY(gg_rct_Garrosh1),20000.,Filter(function RemoveUnits))
call ForGroup(CHAPTER_ONE_GROUP,function RemoveUnitsNew)
set udg_LeakPoint[1] = GetRectCenter(gg_rct_DummySelect)
call CreateNUnitsAtLoc( 1, 'n002', Player(PLAYER_NEUTRAL_PASSIVE), udg_LeakPoint[1], bj_UNIT_FACING )
set udg_Hall_of_Fame = bj_lastCreatedUnit
set udg_PlayerCount = 0
set PLAYER_SELECTORS = CreateForce()
set TURBO_MODE = false
loop
exitwhen j>6
set WavesOpened[j] = false
set j = j + 1
endloop
set j = 1
loop
exitwhen i > 5
if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_LUMBER,0)
set udg_PlayerCount = udg_PlayerCount + 1
set udg_Players[udg_PlayerCount] = Player(i)
call SaveInteger(udg_hash,GetHandleId(udg_Players[udg_PlayerCount]),5,udg_PlayerCount)
call ForceAddPlayer(PLAYER_SELECTORS,udg_Players[udg_PlayerCount])
set WavesOpened[i+1] = true
set udg_Kills[udg_PlayerCount] = 0
call ShowMboard(udg_Players[udg_PlayerCount],udg_MBoard[udg_PlayerCount], false)
set j = 1
loop
exitwhen j > udg_HeroCount
call SetPlayerUnitAvailableBJ(udg_Hero[j], true, udg_Players[udg_PlayerCount])
set j = j + 1
endloop
call SetCameraBoundsToRectForPlayerBJ(udg_Players[udg_PlayerCount], gg_rct_Hero_Arrival )
call ForceAddPlayerSimple( udg_Players[udg_PlayerCount], udg_Players_Group )
call ForceAddPlayerSimple( udg_Players[udg_PlayerCount], udg_Players_Group )
call CreateNUnitsAtLoc( 1, 'h007', udg_Players[udg_PlayerCount], udg_LeakPoint[1], bj_UNIT_FACING )
set udg_Selector[udg_PlayerCount] = bj_lastCreatedUnit
call UnitAddAbility(bj_lastCreatedUnit,'Aloc')
call ShowUnit( bj_lastCreatedUnit,false )
call UnitRemoveAbility(bj_lastCreatedUnit,'Aloc')
call ShowUnit( bj_lastCreatedUnit,true)
call SetPlayerState(udg_Players[udg_PlayerCount],PLAYER_STATE_RESOURCE_GOLD,1500)
endif
set i = i + 1
endloop
set udg_PlayersInGame = udg_PlayerCount
//Reset wave upgrades
call SetPlayerTechResearched(Player(7), 'R002', 0 )
call RemoveLocation(udg_LeakPoint[1])
call EnumItemsInRect(bj_mapInitialPlayableArea,null,function RemoveItems)
call DisableTrigger(gg_trg_C1_defeat)
call EnableTrigger(CHAPTER1_CINEMATIC_TRIGGER)
call DisableTrigger(gg_trg_c1_sec_ini)
call DisableTrigger(gg_trg_Left_Waves_C1)
call DisableTrigger(gg_trg_Right_Waves_C1)
call DisableTrigger(gg_trg_Middle_Waves_C1)
call DisableTrigger(gg_trg_SpecWaves_C1)
call EnableTrigger(gg_trg_c1_battle_ini)
call PauseTimer(CHAPTER1_END_TIMER)
set OGRE_GLADIATOR = CreateUnit(ORGRIMMAR, 'o00S', -9897., -6558.,352.)
call SetUnitAnimation(OGRE_GLADIATOR,"sleep")
set XARDAS = CreateUnit(INVADERS, 'o00V', GetRectCenterX(gg_rct_XardasTowerPlacement) + 50.,GetRectCenterY(gg_rct_XardasTowerPlacement) - 50., 330. )
call MakeUnitGiant(XARDAS,true)
set udg_C1_Vendors[1] = CreateUnit(ORGRIMMAR, 'h004',GetRectCenterX(gg_rct_Armorer), GetRectCenterY(gg_rct_Armorer),315. )
set udg_C1_Vendors[2] = CreateUnit(ORGRIMMAR, 'h003',GetRectCenterX(gg_rct_Indendant), GetRectCenterY(gg_rct_Indendant),225. )
set udg_C1_Vendors[3] = CreateUnit(ORGRIMMAR, 'h006',GetRectCenterX(gg_rct_Weaponer), GetRectCenterY(gg_rct_Weaponer),315. )
set udg_C1_Vendors[4] = CreateUnit(ORGRIMMAR, 'h005',GetRectCenterX(gg_rct_Inscriptor), GetRectCenterY(gg_rct_Inscriptor),225. )
call SetUnitPathing( udg_C1_Vendors[1], false )
call SetUnitPathing( udg_C1_Vendors[2], false )
call SetUnitPathing( udg_C1_Vendors[3], false )
call SetUnitPathing( udg_C1_Vendors[4], false )
//Manekens Chapter I
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C1DummyTop),GetRectCenterY(gg_rct_C1DummyTop),225.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C1DummyMid),GetRectCenterY(gg_rct_C1DummyMid),180.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C1DummyBot),GetRectCenterY(gg_rct_C1DummyBot),135.),true)
call PreloadRest()
set CHAPTER1_STARTED = false
set SPECIAL_WAVE_STOP_NEXT_LEFT = false
set SPECIAL_WAVE_STOP_NEXT_RIGHT = false
set SPECIAL_WAVE_STOP_NEXT_MIDDLE = false
if udg_PlayerCount == 1 then
set IsMultiHeroes = false
set MultiHeroesCounter = 1
set MultiHeroesPicked = 0
call ShowSoloDialogToPlayer(udg_Players[1])
else
call DisplayDifficultyDialogToPlayer(udg_Players[1])
endif
endfunction
private function Leave takes nothing returns nothing
local integer i = 0
loop
exitwhen i > udg_PlayerCount
call CustomVictoryBJ(udg_Players[i],false,true)
set i = i + 1
endloop
endfunction
function GameRestart takes boolean rest returns nothing
if rest then
call Restart()
else
call Leave()
endif
endfunction
endlibrary
//TESH.scrollpos=3
//TESH.alwaysfold=0
library Victory
globals
boolean IS_VICTORY = false
force PVP_FORCE = CreateForce()
endglobals
function EndTheGame takes nothing returns nothing
local integer i = 1
local integer j = 1
local real time = LoadReal(udg_hash,GetHandleId(GetExpiredTimer()),1)
set time = time + 1.
call SaveReal(udg_hash,GetHandleId(GetExpiredTimer()),1,time)
loop
exitwhen i > udg_PlayerCount
set j = 1
loop
exitwhen j > udg_PlayerCount
if not(i==j) then
if IsPlayerInForce(udg_Players[i],PVP_FORCE) and IsPlayerInForce(udg_Players[j],PVP_FORCE) then
call SetPlayerAllianceStateBJ( udg_Players[i], udg_Players[j], bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( udg_Players[j], udg_Players[i], bj_ALLIANCE_UNALLIED )
else
call SetPlayerAllianceStateBJ( udg_Players[i], udg_Players[j], bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( udg_Players[j], udg_Players[i], bj_ALLIANCE_ALLIED )
call SetPlayerAllianceBJ( udg_Players[i], ALLIANCE_SHARED_ADVANCED_CONTROL, true, udg_Players[j] )
endif
endif
set j = j + 1
endloop
set i = i + 1
endloop
if 180. - time > 0. then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0.,0.,0.5,"The game will end in |c00804040" + I2S(R2I(60. - time))+"|r seconds.")
else
call DestroyTimer(GetExpiredTimer())
loop
set i = 1
exitwhen i > udg_PlayerCount
call CustomVictoryBJ( udg_Players[i], true, true )
set i = i + 1
endloop
endif
endfunction
function Victory takes nothing returns nothing
local timer t = CreateTimer()
call DestroyTimer(GetExpiredTimer())
set IS_VICTORY = true
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.,0.,60.,"Thank you for playing |c00804040Impossible Siege 2|r. If you liked the map see the map info (F9) for the ways to support its development.")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.,0.,60.,"If you got some questions email me at |[email protected]|r")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.,0.,60.,"The game will end in |c00804040180|r seconds.")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.,0.,60.,"Now you can use the command |cff80ff80-pvp on/off|r to turn on/off PVP mode.")
call TimerStart(CreateTimer(),1.,true,function EndTheGame)
call TimerStart(t,180.,false,null)
call TimerDialogDisplay(CreateTimerDialog(t),true)
set t = null
endfunction
endlibrary
library PreloadSystem initializer onInit
globals
private integer array PRELOAD_UNITS
private timer PRELOAD_TIMER = CreateTimer()
private integer ARRAY_LEN = 0
private integer CUR_INDEX = 0
real PRELOAD_TIMER_PERIOD = 2.
endglobals
function AddUnitToPreloadQueueById takes integer whichUnitId returns nothing
set ARRAY_LEN = ARRAY_LEN + 1
set PRELOAD_UNITS[ARRAY_LEN] = whichUnitId
endfunction
private function onTimer takes nothing returns nothing
if CUR_INDEX < ARRAY_LEN then
set CUR_INDEX = CUR_INDEX + 1
call UnitApplyTimedLife(CreateUnit(Player(15),PRELOAD_UNITS[CUR_INDEX],10700.,12000.,0.),'BHwe',0.1)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TimerStart(PRELOAD_TIMER,PRELOAD_TIMER_PERIOD,true,null)
call TriggerRegisterTimerExpireEvent(t,PRELOAD_TIMER)
call TriggerAddAction(t,function onTimer)
set t = null
endfunction
endlibrary
//TESH.scrollpos=66
//TESH.alwaysfold=0
library GamePreload initializer Init requires DifficultyChoose, MultiHeroRegime
globals
private integer index = 0
force PLAYER_SELECTORS = CreateForce()
endglobals
function SelectUntil takes nothing returns nothing
if IsPlayerInForce(GetLocalPlayer(),PLAYER_SELECTORS) then
call ClearSelection()
call SelectUnit(udg_Hall_of_Fame,true)
endif
if CountPlayersInForceBJ(PLAYER_SELECTORS) == 0 then
call DestroyTimer(GetExpiredTimer())
endif
endfunction
private function Message takes nothing returns nothing
call DestroyTimer(GetExpiredTimer())
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Have a question, suggestion or found any bug? Email me at |[email protected]|r.")
call PlaySoundBJ(gg_snd_Hint)
endfunction
private function PreloadFinish takes nothing returns nothing
local integer i = 1
local timer t = CreateTimer()
call DestroyTimer(GetExpiredTimer())
call ClearTextMessages()
call DisplayCineFilter(false)
call UnitApplyTimedLife(CreateUnit(Player(1),'h009',GetRectCenterX(gg_rct_Hero_Arrival),GetRectCenterY(gg_rct_Hero_Arrival),0.),'BHwe',90.)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1., "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call ClearSelection()
call SelectUnit(udg_Hall_of_Fame,true)
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Playing |c00804040Impossible Siege 2|r first time? Type \"|cff80ff80-hero info|r\" to get some tips about your hero.")
if udg_PlayerCount == 1 then
set udg_Singleplayer = true
//call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Singleplayer mode has been enabled.")
call ShowSoloDialogToPlayer(udg_Players[1])
else
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 0.5, udg_ColorString[GetConvertedPlayerId(udg_Players[1])] + GetPlayerName(udg_Players[1]) + "|r is choosing difficulty. Please wait..." )
call DisplayDifficultyDialogToPlayer(udg_Players[1])
call TimerStart(SHOW_AGGRO_MB_INITIALIZE_TIMER,0.0,false,null)
endif
call PlaySoundBJ(gg_snd_Hint)
//call TimerStart(CreateTimer(),30.,false,function Message)
loop
exitwhen i > udg_PlayerCount
call ForceAddPlayer(PLAYER_SELECTORS,udg_Players[i])
set i = i + 1
endloop
call TimerStart(t,1.,true,function SelectUntil)
set i = 0
//loop
//exitwhen i > 5
//call IssueImmediateOrder(camera_u[i],"darkportal")
//set i = i + 1
//endloop
set t = null
endfunction
private function PreloadHeroes takes nothing returns nothing
set index = 1
loop
exitwhen index > udg_HeroCount
call UnitApplyTimedLife(CreateUnit(Player(15),udg_Hero[index],0.,0.,0.),'BHwe',0.1)
set index = index + 1
endloop
call DestroyTimer(GetExpiredTimer())
endfunction
private function PreloadUnits takes nothing returns nothing
//Chapter1 WaveUnits
call UnitApplyTimedLife(CreateUnit(Player(15),'n000',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n001',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n004',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n005',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n006',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n007',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'O000',0.,0.,0.),'BHwe',0.1)
//Chapter 1 Garrosh and Grunts
call UnitApplyTimedLife(CreateUnit(Player(15),'n000',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'o001',0.,0.,0.),'BHwe',0.1)
//Chapter 1 ImpossibleWaveUnits
call UnitApplyTimedLife(CreateUnit(Player(15),'o009',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00D',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00C',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00H',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00G',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00B',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00A',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n009',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n008',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00F',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'n00E',0.,0.,0.),'BHwe',0.1)
//DummyUnitAbilities
call UnitApplyTimedLife(CreateUnit(Player(15),'h008',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00S',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00N',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h014',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00M',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00W',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h016',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00P',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00Q',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00R',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h001',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h002',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h017',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01E',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h009',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00B',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h015',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01D',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01H',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01I',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00E',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00Y',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00C',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00J',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00L',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00G',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00K',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00I',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00F',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01L',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01F',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01G',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h018',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01A',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01M',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00D',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h007',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01K',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01J',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h019',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h01B',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h00H',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'o00A',0.,0.,0.),'BHwe',0.1)
//chapter2 merchants
call UnitApplyTimedLife(CreateUnit(Player(15),'h010',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h011',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h012',0.,0.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h013',0.,0.,0.),'BHwe',0.1)
call DestroyTimer(GetExpiredTimer())
endfunction
private function PreloadAbilities takes nothing returns nothing
local unit u = CreateUnit(Player(15),'h009',0.,0.,0.)
call DestroyTimer(GetExpiredTimer())
call UnitAddAbility(u,'A00P') // preload Bash Dummy
call UnitAddAbility(u,'A01T') // preload Divine Shield
call UnitAddAbility(u,'A01G') // preload Rodeo Cancel
call UnitAddAbility(u,'A018') // preload Intervene Buffer
call UnitAddAbility(u,'A013') // preload Heroism Dummy
call UnitAddAbility(u,'A00Y') // preload Ghost Wolf Form
call UnitAddAbility(u,'A01R') // preload Hurl Boulder (Rock Golem)
call UnitAddAbility(u,'A01S') // preload Armor (Mud Golem)
call UnitAddAbility(u,'A00T') // preload Bladebreaker Dummy
call UnitAddAbility(u,'A00C') // preload Axe of Mayhem Dummy
call UnitAddAbility(u,'A00G') // preload Hungering Cold Dummy
call UnitAddAbility(u,'A01W') // preload Fire Rodeo damage
call UnitAddAbility(u,'A01D') // preload Magmaw fires
call UnitAddAbility(u,'A01C') // preload Magmaw fires
call UnitAddAbility(u,'A01P') // preload Boss no Aggro
call UnitAddAbility(u,'A01Q') // preload -50 armor (Supremus)
call UnitAddAbility(u,'A001') // preload Damage Detect Buffer
call UnitAddAbility(u,'A002') // preload Haste +400 AS
call UnitAddAbility(u,'A022') // preload +50 armor (Elixir of Deep Earth)
call UnitAddAbility(u,'A01Z') // preload Elixir of Deadly Strikes Buff
call UnitAddAbility(u,'A020') // preload Elixir of Deep Earth Buff
call UnitAddAbility(u,'A021') // preload Elixir of Stoneblood Buff
call UnitAddAbility(u,'A00N') // preload Elixir of the Frost Wyrm Buff
call UnitAddAbility(u,'A017') // preload Shield Wall Buff
call UnitAddAbility(u,'A011') // preload Lifebloom Buff
call UnitAddAbility(u,'A028') // preload Regrowth Buff
call UnitAddAbility(u,'A02A') // preload Armor Penetration
call UnitAddAbility(u,'A02D') // preload Mark of the Wild Stats
call UnitAddAbility(u,'A02B') // preload Mark of the Wild Buff
call UnitAddAbility(u,'A02C') // preload Burned Units Buff
call UnitAddAbility(u,'A02D') // preload Bleeding Units Buff
call UnitAddAbility(u,'A02E') // preload Frozen Units Buff
call UnitAddAbility(u,'A02G') // preload +50 mana
call UnitAddAbility(u,'A02I') // preload Lightbringer Chestguard buff
call UnitAddAbility(u,'A02J') // preload Abonimation Ribcage buff
call UnitAddAbility(u,'A02R') // preload +20 Expertise
call UnitAddAbility(u,'A02S') // preload +40 Expertise
call UnitAddAbility(u,'A02T') // preload +80 Expertise
call UnitAddAbility(u,'A02Z') // preload Gloves of Holy Might Buff
call UnitAddAbility(u,'A033') // preload Helm of the Elder Moon Buff
call UnitAddAbility(u,'A035') // preload Broken Ram Skull Helm Buff
call UnitAddAbility(u,'A038') // preload Daybreaker Helm Buff
call UnitAddAbility(u,'A036') // preload 201 level DAMAGE
call UnitApplyTimedLife(u,'BHwe',1.)
set u = null
endfunction
private function Init takes nothing returns nothing
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 10000.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.,0.,UNIT_INITIALIZATION_TIME,"Please wait. Preloading game resources...")
call TimerStart(CreateTimer(),UNIT_INITIALIZATION_TIME+1.,false,function PreloadFinish)
endfunction
endlibrary
library PreloadHeroArrays initializer onInit requires PreloadSystem
globals
private integer HERO_ARRAY_MAXLEN = 100
private integer array HERO_UNITS_PRELOAD //1..100 are reserved for the first hero, 101..200 for the second etc.
private boolean array IS_HERO_INITIALIZED
endglobals
function AddHeroUnitsToPreloadQueue takes unit hero returns nothing
local integer k = 1 //Hero Number
local integer N = 0
local integer i = 1
if GetUnitTypeId(hero) == HORDE_CHAMPION_CODE then
set k = 1
endif
if GetUnitTypeId(hero) == SORCERESS_CODE then
set k = 2
endif
if GetUnitTypeId(hero) == SHAMAN_CODE then
set k = 3
endif
if GetUnitTypeId(hero) == BLOODELF_CAPTAIN_CODE then
set k = 4
endif
if GetUnitTypeId(hero) == STONEBREAKER_CODE then
set k = 5
endif
if GetUnitTypeId(hero) == DRUID_CODE then
set k = 6
endif
if GetUnitTypeId(hero) == DEATH_KNIGHT_CODE then
set k = 7
endif
if GetUnitTypeId(hero) == RANGER_CODE then
set k = 8
endif
if GetUnitTypeId(hero) == PRIEST_CODE then
set k = 9
endif
if GetUnitTypeId(hero) == ERETIC_CODE then
set k = 10
endif
if GetUnitTypeId(hero) == AKAMA_CODE then
set k = 11
endif
if GetUnitTypeId(hero) == IRON_GOLEM_CODE then
set k = 12
endif
if not IS_HERO_INITIALIZED[k] then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"|cff80ff80" + GetUnitName(hero) + "|r's resources are added to the preload queue. Players may suffer freezes for a duration.")
set N = (k-1)*100
set i = 1
loop
exitwhen (HERO_UNITS_PRELOAD[N+i]==0) or (i > HERO_ARRAY_MAXLEN)
call AddUnitToPreloadQueueById(HERO_UNITS_PRELOAD[N+i])
set i = i + 1
endloop
set IS_HERO_INITIALIZED[k] = true
endif
endfunction
private function onInit takes nothing returns nothing
set HERO_UNITS_PRELOAD[1] = 'h02K' //Standard
set HERO_UNITS_PRELOAD[2] = 'h02L' //Standard Aura
set HERO_UNITS_PRELOAD[3] = 'h008' //Blood Hurricane
set HERO_UNITS_PRELOAD[101] = 'h02M' // Arcane Beam
set HERO_UNITS_PRELOAD[102] = 'h00B' //Icy Disaster Missile
set HERO_UNITS_PRELOAD[103] = 'h00C' //Icy Disaster Rock
set HERO_UNITS_PRELOAD[104] = 'h017' //Ice Impale Effect
set HERO_UNITS_PRELOAD[201] = SHAMAN_WOLF_CODE
set HERO_UNITS_PRELOAD[202] = 'h00E' // Healing Rain Effect
set HERO_UNITS_PRELOAD[203] = 'h00F' // Mana Spring Totem - Totem
set HERO_UNITS_PRELOAD[204] = 'h01F' // Mana Spring Totem - Aura Effect
set HERO_UNITS_PRELOAD[301] = 'o00A' // Intervene unit
set HERO_UNITS_PRELOAD[401] = 'h02N' //Eartquake Effect
set HERO_UNITS_PRELOAD[402] = 'h00M' //Boulder Falls - Boulder
set HERO_UNITS_PRELOAD[403] = 'h00W' //Boulder Falls - Fire Boulder
set HERO_UNITS_PRELOAD[404] = 'h015' //Rodeo - Fire Dummy
set HERO_UNITS_PRELOAD[405] = 'h00N' //Rodeo - Boulder
set HERO_UNITS_PRELOAD[406] = 'h016' //Ragging Charge - Small Boulder
set HERO_UNITS_PRELOAD[501] = DRUID_TREE_CODE
set HERO_UNITS_PRELOAD[502] = 'h03S' //Monsoon - Tornado
set HERO_UNITS_PRELOAD[503] = 'h03T' //Monsoon - Rain
set HERO_UNITS_PRELOAD[504] = 'h03U' //Monsoon - Cloud
set HERO_UNITS_PRELOAD[505] = 'h00D' //Regrowth Effect
set HERO_UNITS_PRELOAD[506] = 'h018' //Mark of the Wild Effect
set HERO_UNITS_PRELOAD[507] = 'h019' //Tree of Life Aura
set HERO_UNITS_PRELOAD[601] = 'u002' //Frostwyrms Fury - Dragon
set HERO_UNITS_PRELOAD[602] = 'h029' //Frostwyrms Fury - Missile
set HERO_UNITS_PRELOAD[603] = 'h02A' //Obliteration - Frostmourne
set HERO_UNITS_PRELOAD[701] = 'o00B' // Wolf Code
set HERO_UNITS_PRELOAD[702] = 'h02C' //Chakram Trap - Net
set HERO_UNITS_PRELOAD[703] = 'h02D' //Chakram Trap - Rotor
set HERO_UNITS_PRELOAD[704] = 'h02J' //Chakram Trap - Column
set HERO_UNITS_PRELOAD[705] = 'h02F' //Chimaera Shot - Acid Missile
set HERO_UNITS_PRELOAD[706] = 'h02E' //Chimaera Shot - Fire Missile
set HERO_UNITS_PRELOAD[707] = 'h02G' //Chimaera Shot - Arcane Missile
set HERO_UNITS_PRELOAD[801] = 'h03K' //Prayer of Healing - Sun
set HERO_UNITS_PRELOAD[802] = 'h03L' //Prayer of Healing - Wave
set HERO_UNITS_PRELOAD[803] = 'h03M' //Divine Hymn - Inner Fire Effect
set HERO_UNITS_PRELOAD[804] = 'h03N' //Divine Hymn - Effect
set HERO_UNITS_PRELOAD[901] = 'h03R' //Graveyard - Grave
set HERO_UNITS_PRELOAD[902] = 'h03X' //Graveyard - Aura
set HERO_UNITS_PRELOAD[903] = 'u004' //Bone Ritual - Skeleton
set HERO_UNITS_PRELOAD[904] = 'h03V' //Bone Ritual - Blood Explosion
set HERO_UNITS_PRELOAD[1001] = 'h044' //Nether Bomb - Bomb
set HERO_UNITS_PRELOAD[1002] = 'h043' //Devouring Shadows - Shadow
set HERO_UNITS_PRELOAD[1101] = 'h04C' //Rockets - Phys Rocket
set HERO_UNITS_PRELOAD[1102] = 'h04D' //Rockets - Magic Rocket
set HERO_UNITS_PRELOAD[1201] = 0
set HERO_UNITS_PRELOAD[1201] = 0
set HERO_UNITS_PRELOAD[1201] = 0
set HERO_UNITS_PRELOAD[1201] = 0
set HERO_UNITS_PRELOAD[1201] = 0
set HERO_UNITS_PRELOAD[1201] = 0
set HERO_UNITS_PRELOAD[1201] = 0
set HERO_UNITS_PRELOAD[1201] = 0
endfunction
endlibrary
//TESH.scrollpos=59
//TESH.alwaysfold=0
scope FogInit initializer Init
private function Init takes nothing returns nothing
local fogData fd1
local fogData fd2
local fog f
local region reg
set fd1 = fogData.create()
set fd1.red = 0.75
set fd1.blue = 0.75
set fd1.green = 0.75
set fd1.zStart = 0
set fd1.zEnd = 6000
set f = fog.createFromRect(fd1, gg_rct_GrayFogHeavy)
set f.blendWidth = 500
set fd1 = fogData.create()
set fd1.red = 0.83
set fd1.blue = 0.0
set fd1.green = 0.0
set fd1.zStart = 1000
set fd1.zEnd = 8000
set f = fog.createFromRect(fd1, gg_rct_GrayFogLight)
set f.blendWidth = 750
set fd1 = fogData.create()
set fd1.red = 0.9
set fd1.blue = 0.
set fd1.green = 0.
set fd1.zStart = 500
set fd1.zEnd = 5000
set f = fog.createFromRect(fd1, gg_rct_MOLTENFOG)
set f.blendWidth = 750
set fd1 = fogData.create()
set fd1.red = 0.83
set fd1.blue = 0.37
set fd1.green = 0.10
set fd1.zStart = 500
set fd1.zEnd = 5000
set f = fog.createFromRect(fd1, gg_rct_Act2FOG)
set f.blendWidth = 750
set fd1 = fogData.create()
set fd1.red = 0.50
set fd1.blue = 0.37
set fd1.green = 0.83
set fd1.zStart = 500
set fd1.zEnd = 5000
set f = fog.createFromRect(fd1, gg_rct_StonecoreFOG)
set f.blendWidth = 750
set fd1 = fogData.create()
set fd1.red = 0.15
set fd1.blue = 0.70
set fd1.green = 0.30
set fd1.zStart = 500
set fd1.zEnd = 5000
set f = fog.createFromRect(fd1, gg_rct_Act3BOUNDS)
set f.blendWidth = 750
set fd1 = fogData.create()
set fd1.red = 0.0
set fd1.blue = 0.30
set fd1.green = 0.10
set fd1.zStart = 500
set fd1.zEnd = 5000
set f = fog.createFromRect(fd1, gg_rct_EredarsBounds)
set f.blendWidth = 750
set fd1 = fogData.create()
set fd1.red = 0.94
set fd1.blue = 0.90
set fd1.green = 0.54
set fd1.zStart = 500
set fd1.zEnd = 5000
set f = fog.createFromRect(fd1, gg_rct_IslandBounds)
set f.blendWidth = 750
/* set fd1 = fogData.create()
set fd1.red = 1
set fd1.blue = 1
set fd1.green = 1
set fd1.zStart = -300
set fd1.zEnd = 3000
set fd2 = fogData.create()
set fd2.red = 0.6
set fd2.blue = 0.7
set fd2.green = 0.6
set fd2.zStart = -700
set fd2.zEnd = 2000
set f = fog.createFromRect(fd1, gg_rct_Snow1)
set f.nightData = fd2
set f.blendWidth = 2000
set f = fog.createFromRect(fd1, gg_rct_Snow2)
set f.blendWidth = 2000
set f.nightData = fd2 */
endfunction
endscope
scope MapInitialization initializer onInit
globals
boolean IS_MULTIPLAYER = false
integer TRAINING_DUMMY_CODE = 'o00H' //'h043'
endglobals
private function Trig_map_ini_Func009Func001C takes nothing returns boolean
if ( not ( GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexB())) == PLAYER_SLOT_STATE_PLAYING ) ) then
return false
endif
return true
endfunction
private function CreateYoutubeQuest takes nothing returns nothing
local quest q = CreateQuest()
call QuestSetTitle(q,"YouTube channel")
call QuestSetDescription(q,"Visit |cffff8080www.youtube.com/user/ImpossibleSiege|r for the latest video updates.")
call QuestSetIconPath(q,"ReplaceableTextures\\CommandButtons\\BTNyoutube.blp")
call QuestSetDiscovered(q,true)
set q = null
endfunction
private function CreateTextTagQuest takes nothing returns nothing
local quest q = CreateQuest()
call QuestSetTitle(q,"Texttags On/Off")
call QuestSetDescription(q,"|cffff8080-bt on/off|r : turns on/off battle texttags (physical/spell damage, healing etc.)|n|cffff8080-et on/off|r : turns on/off enemy damage texttags.|n|cffff8080-st on/off|r : turns on/off spell damage texttags.|n|cffff8080-pt on/off|r : turns on/off physical damage texttags.|n|cffff8080-ht on/off|r turns on/off healing texttags.")
call QuestSetIconPath(q,"ReplaceableTextures\\CommandButtons\\BTNScrollOfHealing.blp")
call QuestSetDiscovered(q,true)
set q = null
endfunction
private function Acts takes nothing returns nothing
local integer j = 1
call SetTimeOfDayScale(0.01)
set udg_hash = InitHashtable()
call SetReservedLocalHeroButtons( 1 )
set udg_SpiritHealerLoc[1] = GetRectCenter(gg_rct_Ressurect1)
set udg_SpiritHealerLoc[2] = GetRectCenter(gg_rct_Ressurect2)
set udg_SpiritHealerLoc[3] = GetRectCenter(gg_rct_Ressurect3)
set udg_SpiritHealerLoc[4] = GetRectCenter(gg_rct_IslandRespawn)
set udg_LeakPoint[1] = GetRectCenter(gg_rct_DummySelect)
call CreateNUnitsAtLoc( 1, 'n002', Player(PLAYER_NEUTRAL_PASSIVE), udg_LeakPoint[1], bj_UNIT_FACING )
set udg_Hall_of_Fame = GetLastCreatedUnit()
loop
exitwhen j>6
set WavesOpened[j] = false
set j = j + 1
endloop
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = 6
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
if ( Trig_map_ini_Func009Func001C() ) then
call SetCameraBoundsToRectForPlayerBJ( ConvertedPlayer(GetForLoopIndexB()), gg_rct_Hero_Arrival )
set udg_PlayerCount = ( udg_PlayerCount + 1 )
set WavesOpened[GetForLoopIndexB()] = true
set udg_Players[udg_PlayerCount] = ConvertedPlayer(GetForLoopIndexB())
call SaveInteger(udg_hash,GetHandleId(udg_Players[udg_PlayerCount]),PLAYER_ID_HASH,udg_PlayerCount)
call ForceAddPlayerSimple( udg_Players[udg_PlayerCount], udg_Tips_Force )
call ForceAddPlayerSimple( udg_Players[udg_PlayerCount], udg_Players_Group )
call ForceAddPlayer(ENEMY_TEXT_FORCE,udg_Players[udg_PlayerCount])
call ForceAddPlayer(HEALING_TEXT_FORCE,udg_Players[udg_PlayerCount])
call ForceAddPlayer(BATTLE_TEXT_FORCE,udg_Players[udg_PlayerCount])
call ForceAddPlayer(SPELL_DAMAGE_TEXT_FORCE,udg_Players[udg_PlayerCount])
call ForceAddPlayer(PHYS_DAMAGE_TEXT_FORCE,udg_Players[udg_PlayerCount])
else
endif
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
set udg_PlayersInGame = udg_PlayerCount
if udg_PlayerCount > 1 then
set IS_MULTIPLAYER = true
endif
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateFogModifierRectBJ( true, Player(bj_forLoopAIndex), FOG_OF_WAR_VISIBLE, gg_rct_EredarVision )
call SetPlayerAllianceStateBJ( udg_Players[GetForLoopIndexA()], Player(6), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( Player(6), udg_Players[GetForLoopIndexA()], bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( udg_Players[GetForLoopIndexA()], Player(8), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( Player(8), udg_Players[GetForLoopIndexA()], bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( udg_Players[GetForLoopIndexA()], Player(9), bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( Player(9), udg_Players[GetForLoopIndexA()], bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( udg_Players[GetForLoopIndexA()], KOBOLDS, bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( KOBOLDS, udg_Players[GetForLoopIndexA()], bj_ALLIANCE_ALLIED )
call SetPlayerAllianceStateBJ( udg_Players[GetForLoopIndexA()], Player(7), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(7), udg_Players[GetForLoopIndexA()], bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceBJ( Player(0), ALLIANCE_SHARED_ADVANCED_CONTROL, true, udg_Players[GetForLoopIndexA()] )
call SetPlayerAllianceBJ( Player(1), ALLIANCE_SHARED_ADVANCED_CONTROL, true, udg_Players[GetForLoopIndexA()] )
call SetPlayerAllianceBJ( Player(2), ALLIANCE_SHARED_ADVANCED_CONTROL, true, udg_Players[GetForLoopIndexA()] )
call SetPlayerAllianceBJ( Player(3), ALLIANCE_SHARED_ADVANCED_CONTROL, true, udg_Players[GetForLoopIndexA()] )
call SetPlayerAllianceBJ( Player(4), ALLIANCE_SHARED_ADVANCED_CONTROL, true, udg_Players[GetForLoopIndexA()] )
call SetPlayerAllianceBJ( Player(5), ALLIANCE_SHARED_ADVANCED_CONTROL, true, udg_Players[GetForLoopIndexA()] )
call CreateNUnitsAtLoc( 1, 'h007', udg_Players[GetForLoopIndexA()], udg_LeakPoint[1], bj_UNIT_FACING )
set udg_Selector[GetForLoopIndexA()] = GetLastCreatedUnit()
call UnitAddAbility(GetLastCreatedUnit(),'Aloc')
call ShowUnitHide( GetLastCreatedUnit() )
call UnitRemoveAbility(GetLastCreatedUnit(),'Aloc')
call ShowUnitShow( GetLastCreatedUnit() )
call SetPlayerStateBJ( udg_Players[GetForLoopIndexA()], PLAYER_STATE_RESOURCE_GOLD, 1500 )
call SetPlayerHandicapXPBJ( udg_Players[GetForLoopIndexA()], 0.00 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
set udg_ColorString[1] = "|cffFF0000"
set udg_ColorString[2] = "|cff0000FF"
set udg_ColorString[3] = "|cff00FFFF"
set udg_ColorString[4] = "|cff800080"
set udg_ColorString[5] = "|cffFFFF00"
set udg_ColorString[6] = "|cffFF8000"
set udg_ColorString[7] = "|cff00FF00"
set udg_ColorString[8] = "|cffFF80C0"
set udg_ColorString[9] = "|cffC0C0C0"
set udg_ColorString[10] = "|cff8080FF"
call SetPlayerAllianceStateBJ( Player(6), Player(7), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(7), Player(6), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(8), Player(7), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(7), Player(8), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(9), Player(7), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(7), Player(9), bj_ALLIANCE_UNALLIED )
call SetPlayerColorBJ( Player(6), PLAYER_COLOR_BROWN, true )
call SetPlayerColorBJ( Player(8), PLAYER_COLOR_BROWN, true )
call SetPlayerColorBJ( Player(9), PLAYER_COLOR_BROWN, true )
call SetPlayerColorBJ( Player(7), ConvertPlayerColor(12), true )
set udg_C_Spawns[1] = GetRectCenter(gg_rct_LeftSpawn)
set udg_C_Spawns[2] = GetRectCenter(gg_rct_RightSpawn)
set udg_C_Spawns[3] = GetRectCenter(gg_rct_MiddleSpawn)
set udg_C_Spawns[4] = GetRectCenter(gg_rct_Garrosh1)
call MultiboardAllowDisplayBJ( false )
call CreateQuestBJ( bj_QUESTTYPE_OPT_DISCOVERED, "TRIGSTR_3239", "TRIGSTR_3240", "ReplaceableTextures\\CommandButtons\\BTNHelmArcanite.blp" )
call CreateQuestBJ( bj_QUESTTYPE_OPT_DISCOVERED, "TRIGSTR_3241", "TRIGSTR_3242", "ReplaceableTextures\\CommandButtons\\BTNAmbush.blp" )
call CreateQuestBJ( bj_QUESTTYPE_OPT_DISCOVERED, "Special Thanks", "|cffff8080Beta Testers:|r|n IN0K, MS_Lich, MuhaCikotuha, chromjke, BK.Jugg, Fear.ka, olo)LOLO, SanDeR.|n|n|cffff8080Code systems:|r|nOpossum (RegionalFog) and grim001 (ListModule)|n|n|cffff8080Icons, Models, Effects:|r|n Blizzard Entertainment, Directive255, Marcelo Hossomi, Champara Bro, JetFangInferno, JesusHipster, CRAZYRUSSIAN, Mc !, Mythic, TassAvadar, Empyreal, iZucken, WILL THE ALMIGHTY, Buster, Lord_T, xYours Trulyx, KAIL333XZ, Spellbound, chopinski, communist_orc, ratamahatta, Power, HerrDave, Callahan, Vinz, Hate, Zenonoth and The Panda.|n|n|cffff8080Resources Databases:|r|n xgm.guru, hiveworkshop.com and wowhead.com", "ReplaceableTextures\\CommandButtons\\BTNOrcCaptureFlag.blp" )
call CreateQuestBJ( bj_QUESTTYPE_OPT_DISCOVERED, "Game commands", "\"|cffff8080-cam #|r\": changes camera's Z-offset to #, where # is a value between -500 and 1000 \n\"|cffff8080-clear|r\": clears the text messages on the screen \n\"|cffff8080-tips on/off|r\": turn on/off tips text messages \n\"|cffff8080-show stats|r\" or \"|cffff8080-ss|r\": shows the hero stats multiboard \n\"|cffff8080-show stats big|r\" or \"|cffff8080-ssb|r\": shows a detailed hero stats multiboard \n\"|cffff8080-show aggro|r\" or \"|cffff8080-sa|r\": shows the aggro multiboard, which refreshes on click on enemy unit. \n\"|cffff8080-kill|r\": kills the player hero. Use if your hero or camera is stuck. \n\"|cffff8080-hero info|r\": shows some tips for the player hero. \n\"|cffff8080-aa on/off|r\": turn on/off the player hero auto attacks. In Multi-Hero regime affects the last clicked hero. \n\"|cffff8080-kick #|r\": kick the player with # as a name or color. \n\"|cffff8080-repick|r\": repicks your hero. \n\"|cffff8080-debug camera|r: debugs camera.", "ReplaceableTextures\\CommandButtons\\BTNDestroyer.blp" )
call CreateYoutubeQuest()
call CreateTextTagQuest()
//Manekens Chapter I
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C1DummyTop),GetRectCenterY(gg_rct_C1DummyTop),135.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C1DummyMid),GetRectCenterY(gg_rct_C1DummyMid),135.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C1DummyBot),GetRectCenterY(gg_rct_C1DummyBot),135.),true)
//Manekens Chapter II
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C2ManekenShop),GetRectCenterY(gg_rct_C2ManekenShop),60.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C2ManekenPortalBot),GetRectCenterY(gg_rct_C2ManekenPortalBot),180.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C2ManekenPortalTop),GetRectCenterY(gg_rct_C2ManekenPortalTop),210.),true)
//Manekens Chapter III
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C3ManekenLeft),GetRectCenterY(gg_rct_C3ManekenLeft),45.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C3ManekenRight),GetRectCenterY(gg_rct_C3ManekenRight),90.),true)
call MakeUnitGiant(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),TRAINING_DUMMY_CODE, GetRectCenterX(gg_rct_C3ManekenTop),GetRectCenterY(gg_rct_C3ManekenTop),250.),true)
call DestroyTrigger(GetTriggeringTrigger())
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterTimerEventSingle( t, 0.10 )
call TriggerAddAction( t, function Acts )
set t = null
endfunction
endscope
library RegimeChoosing
globals
boolean TURBO_MODE = false
integer TURBO_LEVEL = 0
real TURBO_TIMER_FACTOR = 1.
real TURBO_DAMAGE_FACTOR = 1.
private constant real TURBO_TIMER_COEFF_PER_LEVEL = 0.25
private constant real TURBO_DAMAGE_COEFF_PER_LEVEL = 0.2
private dialog ModeDialog = null
private dialog TurboModeDialog = null
private button array ModeButtonArray
private button array TurboModeButtonArray
private player ChoosingPlayer = null
string array ModeName
string array TurboModeName
endglobals
private function ChooseTurboRegimes takes nothing returns nothing
local button b = GetClickedButton()
local integer j = 1
loop
exitwhen b==TurboModeButtonArray[j]
set j = j + 1
endloop
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Timers Speed chosen: " + TurboModeName[j])
set TURBO_LEVEL = j
set TURBO_TIMER_FACTOR = 1. + TURBO_TIMER_COEFF_PER_LEVEL*(j-1)
set TURBO_DAMAGE_FACTOR = TURBO_DAMAGE_COEFF_PER_LEVEL*(j-1)
call PauseGame(false)
call TimerStart(SHOW_AGGRO_MB_INITIALIZE_TIMER,0.0,false,null)
endfunction
private function ChooseModesActs takes nothing returns nothing
local button b = GetClickedButton()
local integer j = 1
loop
exitwhen b==ModeButtonArray[j]
set j = j + 1
endloop
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Game Mode chosen: " + ModeName[j])
if j==2 then
set TURBO_MODE = true
call DialogDisplay(ChoosingPlayer,TurboModeDialog,true)
else
call PauseGame(false)
call TimerStart(SHOW_AGGRO_MB_INITIALIZE_TIMER,0.0,false,null)
endif
endfunction
private function TurboModeActs takes nothing returns nothing
local unit u = GetTriggerUnit()
if CHAPTER_3_STARTED then
call SaveReal(udg_hash,GetHandleId(u),GetPhysDmgReduceHash(),LoadReal(udg_hash,GetHandleId(u),GetPhysDmgReduceHash())-TURBO_DAMAGE_FACTOR)
call SaveReal(udg_hash,GetHandleId(u),GetSpellResistHash(),LoadReal(udg_hash,GetHandleId(u),GetSpellResistHash())-TURBO_DAMAGE_FACTOR)
else
call SaveReal(udg_hash,GetHandleId(u),GetPhysDmgReduceHash(),LoadReal(udg_hash,GetHandleId(u),GetPhysDmgReduceHash())-TURBO_DAMAGE_FACTOR)
call SaveReal(udg_hash,GetHandleId(u),GetSpellResistHash(),LoadReal(udg_hash,GetHandleId(u),GetSpellResistHash())-TURBO_DAMAGE_FACTOR)
endif
set u = null
endfunction
private function TurboModeConds takes nothing returns boolean
return TURBO_MODE and (GetOwningPlayer(GetTriggerUnit()) == INVADERS) and ((not IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)) or GetUnitTypeId(GetTriggerUnit())=='N00S' or GetUnitTypeId(GetTriggerUnit())=='N00V' or GetUnitTypeId(GetTriggerUnit())=='N00U')
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer j = 1
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local region rectRegion = CreateRegion()
call RegionAddRect(rectRegion, bj_mapInitialPlayableArea)
call TriggerRegisterEnterRegion(t1,rectRegion,null)
call TriggerAddCondition(t1,function TurboModeConds)
call TriggerAddAction(t1,function TurboModeActs)
set t1 = null
set rectRegion = null
set ModeDialog = DialogCreate()
call DialogSetMessage(ModeDialog,"Choose Game Mode")
set ModeName[1] = "|cffd45e19Standard|r"
set ModeName[2] = "|cffffff00Turbo|r"
loop
exitwhen j>2
set ModeButtonArray[j] = DialogAddButton(ModeDialog,ModeName[j], j)
set j = j + 1
endloop
call TriggerRegisterDialogEvent(t,ModeDialog)
call TriggerAddAction(t,function ChooseModesActs)
set TurboModeDialog = DialogCreate()
call DialogSetMessage(TurboModeDialog,"Choose Timers Speed")
set j = 1
loop
exitwhen j>5
set TurboModeName[j] = I2S(100 + 25*(j-1)) + "%"
set TurboModeButtonArray[j] = DialogAddButton(TurboModeDialog,TurboModeName[j],j)
set j = j + 1
endloop
call TriggerRegisterDialogEvent(t2,TurboModeDialog)
call TriggerAddAction(t2,function ChooseTurboRegimes)
set t = null
set t2 = null
endfunction
function DisplayModeDialogToPlayer takes player whichPlayer returns nothing
set ChoosingPlayer = whichPlayer
call PauseGame(true)
call Init()
call DialogDisplay(whichPlayer,ModeDialog,true)
endfunction
endlibrary
library MultiHeroRegime requires DifficultyChoose
globals
boolean IsMultiHeroes = false
integer MultiHeroesCounter = 1
integer MultiHeroesPicked = 0
private dialog MultiHeroesDialog = null
private button array MultiHeroesButtonArray
private player ChoosingPlayer = null
endglobals
private function TurnOnMultiHeroesButtonClicked takes nothing returns nothing
local button b = GetClickedButton()
local integer j = 0
local integer wavescount = 1
loop
exitwhen b==MultiHeroesButtonArray[j]
set j = j + 1
endloop
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A mode with " + I2S(j+1) + " heroes.")
set IsMultiHeroes = true
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "|c00804040Multi Hero|r mode has been enabled.")
set MultiHeroesCounter = j + 1
set udg_Singleplayer = false
call SetPlayerState(udg_Players[1],PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(udg_Players[1],PLAYER_STATE_RESOURCE_GOLD)+1500*(MultiHeroesCounter-1))
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "You can choose up to |c00804040" + I2S(MultiHeroesCounter) + "|r heroes.")
call SetPlayerMaxHeroesAllowed( MultiHeroesCounter, udg_Players[1] )
set udg_PlayersInGame = MultiHeroesCounter
set j = 1
loop
exitwhen wavescount >= MultiHeroesCounter
if not WavesOpened[j] then
set WavesOpened[j] = true
set wavescount = wavescount + 1
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Opened: " + I2S(j) + " wave door.")
else
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"The : " + I2S(j) + " wave door is already opened.")
endif
set j = j + 1
endloop
call PauseGame(false)
call DisplayDifficultyDialogToPlayer(ChoosingPlayer)
endfunction
private function TurnOnMultiHeroesDialog takes nothing returns nothing
local integer j = 0
local trigger t = null
local button b = GetClickedButton()
if b==udg_SoloModeSoloButton then //If Solo hero is chosen
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"SoloHero is chosen")
set udg_Singleplayer = true
set IsMultiHeroes = false
set udg_PlayersInGame = 1
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "|c00804040Solo Hero|r mode has been enabled.")
call SetPlayerState(udg_Players[1],PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(udg_Players[1],PLAYER_STATE_RESOURCE_GOLD)+1500)
call PauseGame(false)
call DisplayDifficultyDialogToPlayer(ChoosingPlayer)
else //If MultiHeroes is chosen
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MultiHeroes is chosen")
set t = CreateTrigger()
set MultiHeroesDialog = DialogCreate()
call DialogSetMessage(MultiHeroesDialog,"How many heroes?")
loop
exitwhen j >=6
set MultiHeroesButtonArray[j] = DialogAddButton(MultiHeroesDialog,I2S(j+1), j+1)
//call TriggerRegisterDialogButtonEvent(t,MultiHeroesButtonArray[j])
set j = j+1
endloop
call TriggerRegisterDialogEvent(t,MultiHeroesDialog)
call TriggerAddAction(t,function TurnOnMultiHeroesButtonClicked)
call DialogDisplay(ChoosingPlayer, MultiHeroesDialog, true)
set t = null
endif
set b = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterDialogEvent(t,udg_SoloModeDialog)
call TriggerAddAction(t,function TurnOnMultiHeroesDialog)
set t = null
endfunction
function ShowSoloDialogToPlayer takes player whichPlayer returns nothing
call PauseGame(true)
set udg_SoloModeDialog = DialogCreate()
call DialogSetMessage(udg_SoloModeDialog,"Game mode")
set udg_SoloModeSoloButton = DialogAddButton(udg_SoloModeDialog,"Solo", 1)
set udg_SoloModeMultiButton = DialogAddButton(udg_SoloModeDialog,"Multi Heroes", 2)
set ChoosingPlayer = whichPlayer
call Init()
call DialogDisplay(whichPlayer,udg_SoloModeDialog,true)
endfunction
endlibrary
library DifficultyChoose requires RegimeChoosing
globals
integer CURRENT_DIFFICULTY = 1
private dialog DifficultiesDialog = null
private button array DifficultiesButtonArray
private player ChoosingPlayer = null
string array DifficultiesName
endglobals
private function ChooseDifficultyActs takes nothing returns nothing
local button b = GetClickedButton()
local integer j = 1
local integer i = 0
loop
exitwhen b==DifficultiesButtonArray[j]
set j = j + 1
endloop
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Difficulty chosen: " + DifficultiesName[j])
set CURRENT_DIFFICULTY = j
if IsMultiHeroes then
call SetPlayerState(udg_Players[1],PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(udg_Players[1],PLAYER_STATE_RESOURCE_GOLD)+MultiHeroesCounter*(1750-250*CURRENT_DIFFICULTY))
else
set i = 1
loop
exitwhen i > udg_PlayerCount
call SetPlayerState(udg_Players[i],PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(udg_Players[i],PLAYER_STATE_RESOURCE_GOLD)+1750-250*CURRENT_DIFFICULTY)
set i = i + 1
endloop
endif
call PauseGame(false)
call DisplayModeDialogToPlayer(ChoosingPlayer)
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer j = 1
set DifficultiesDialog = DialogCreate()
call DialogSetMessage(DifficultiesDialog,"Choose Difficulty")
set DifficultiesName[1] = "|cffffffffEasy|r"
set DifficultiesName[2] = "|cff8080ffNormal|r"
set DifficultiesName[3] = "|cff80ff80Extreme|r"
set DifficultiesName[4] = "|cffdc143cImpossible|r"
set DifficultiesName[5] = "|c00FFCC00Legend|r"
loop
exitwhen j>5
set DifficultiesButtonArray[j] = DialogAddButton(DifficultiesDialog,DifficultiesName[j], j)
set j = j + 1
endloop
call TriggerRegisterDialogEvent(t,DifficultiesDialog)
call TriggerAddAction(t,function ChooseDifficultyActs)
set t = null
endfunction
function DisplayDifficultyDialogToPlayer takes player whichPlayer returns nothing
set ChoosingPlayer = whichPlayer
call PauseGame(true)
call Init()
call DialogDisplay(whichPlayer,DifficultiesDialog,true)
endfunction
endlibrary
scope InitializeUnits initializer onInit
globals
real UNIT_INITIALIZATION_TIME = 8.
endglobals
private function InitializeChapter3Wisps takes nothing returns nothing
local unit tempu = null
//Wisps
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp1), GetRectCenterY(gg_rct_C3Wisp1),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,200.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp2), GetRectCenterY(gg_rct_C3Wisp2),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,350.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp3), GetRectCenterY(gg_rct_C3Wisp3),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,450.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp4), GetRectCenterY(gg_rct_C3Wisp4),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,450.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp5), GetRectCenterY(gg_rct_C3Wisp5),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,350.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp6), GetRectCenterY(gg_rct_C3Wisp6),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,600.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp7), GetRectCenterY(gg_rct_C3Wisp7),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,200.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp8), GetRectCenterY(gg_rct_C3Wisp8),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,200.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp9), GetRectCenterY(gg_rct_C3Wisp9),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,300.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp10), GetRectCenterY(gg_rct_C3Wisp10),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,100.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp11), GetRectCenterY(gg_rct_C3Wisp11),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,200.,0.)
set tempu = CreateUnit(DARNASSUS, 'h034', GetRectCenterX(gg_rct_C3Wisp12), GetRectCenterY(gg_rct_C3Wisp12),0.)
call SetUnitAnimation(tempu,"stand lumber")
call SetUnitFlyHeight(tempu,250.,0.)
call DestroyTimer(GetExpiredTimer())
endfunction
private function InitializeChapter3Cenarius takes nothing returns nothing
set CENARIUS = CreateUnit(DARNASSUS,'E000',GetRectCenterX(gg_rct_CenariusStart),GetRectCenterY(gg_rct_CenariusStart),135.)
call SetUnitAnimation(CENARIUS,"Stand Channel")
call DestroyTimer(GetExpiredTimer())
endfunction
private function InitializeChapter3Vendors takes nothing returns nothing
call CreateUnit(DARNASSUS, 'h02O',GetRectCenterX(gg_rct_ElvesWeaponer), GetRectCenterY(gg_rct_ElvesWeaponer),280.)
call CreateUnit(DARNASSUS, 'h02P',GetRectCenterX(gg_rct_ElvesArmorer), GetRectCenterY(gg_rct_ElvesArmorer),270.)
call CreateUnit(DARNASSUS, 'h02Q',GetRectCenterX(gg_rct_ElvesInscriptor), GetRectCenterY(gg_rct_ElvesInscriptor),250.)
call CreateUnit(DARNASSUS, 'h02R',GetRectCenterX(gg_rct_ElvesAlchemist), GetRectCenterY(gg_rct_ElvesAlchemist),240.)
call DestroyTimer(GetExpiredTimer())
endfunction
private function InitializeChapter3 takes nothing returns nothing
local unit tempu = null
//Treants
set tempu = CreateUnit(DARNASSUS, 'h03H', GetRectCenterX(gg_rct_Chapter3Treant1), GetRectCenterY(gg_rct_Chapter3Treant1),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
set tempu = CreateUnit(DARNASSUS, 'h03H', GetRectCenterX(gg_rct_Chapter3Treant2), GetRectCenterY(gg_rct_Chapter3Treant2),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
set tempu = CreateUnit(DARNASSUS, 'h03H', GetRectCenterX(gg_rct_Chapter3Treant3), GetRectCenterY(gg_rct_Chapter3Treant3),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
set tempu = CreateUnit(DARNASSUS, 'h03H', GetRectCenterX(gg_rct_Chapter3Treant4), GetRectCenterY(gg_rct_Chapter3Treant4),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
set tempu = CreateUnit(DARNASSUS, 'h03H', GetRectCenterX(gg_rct_Chapter3Treant5), GetRectCenterY(gg_rct_Chapter3Treant5),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
//Ancient of Winds
set tempu = CreateUnit(DARNASSUS, 'h03I', GetRectCenterX(gg_rct_Chapter3Winds1), GetRectCenterY(gg_rct_Chapter3Winds1),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
set tempu = CreateUnit(DARNASSUS, 'h03I', GetRectCenterX(gg_rct_Chapter3Winds2), GetRectCenterY(gg_rct_Chapter3Winds2),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
set tempu = CreateUnit(DARNASSUS, 'h03I', GetRectCenterX(gg_rct_Chapter3Winds3), GetRectCenterY(gg_rct_Chapter3Winds3),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
set tempu = CreateUnit(DARNASSUS, 'h03I', GetRectCenterX(gg_rct_Chapter3Winds4), GetRectCenterY(gg_rct_Chapter3Winds4),GetRandomReal(0.,360.))
call SetUnitAnimation(tempu,"death")
call DestroyTimer(GetExpiredTimer())
set tempu = null
endfunction
private function InitializeStoneCoreEntrance takes nothing returns nothing
//The Stonecore entrance
call SetUnitAnimation( CreateUnit(Player(26), 'h01Q',GetRectCenterX(gg_rct_Region_101), GetRectCenterY(gg_rct_Region_101),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01Q',GetRectCenterX(gg_rct_Region_103), GetRectCenterY(gg_rct_Region_103),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01Q',GetRectCenterX(gg_rct_Region_107), GetRectCenterY(gg_rct_Region_107),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01Q',GetRectCenterX(gg_rct_Region_110), GetRectCenterY(gg_rct_Region_110),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01Q',GetRectCenterX(gg_rct_Region_114), GetRectCenterY(gg_rct_Region_114),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01Q',GetRectCenterX(gg_rct_Region_115), GetRectCenterY(gg_rct_Region_115),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Region_102), GetRectCenterY(gg_rct_Region_102),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Region_113), GetRectCenterY(gg_rct_Region_113),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Region_105), GetRectCenterY(gg_rct_Region_105),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Region_106), GetRectCenterY(gg_rct_Region_106),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Region_120), GetRectCenterY(gg_rct_Region_120),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Region_119), GetRectCenterY(gg_rct_Region_119),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01R',GetRectCenterX(gg_rct_Region_104), GetRectCenterY(gg_rct_Region_104),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01R',GetRectCenterX(gg_rct_Region_108), GetRectCenterY(gg_rct_Region_108),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01R',GetRectCenterX(gg_rct_Region_109), GetRectCenterY(gg_rct_Region_109),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01R',GetRectCenterX(gg_rct_Region_111), GetRectCenterY(gg_rct_Region_111),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h01R',GetRectCenterX(gg_rct_Region_112), GetRectCenterY(gg_rct_Region_112),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Region_116), GetRectCenterY(gg_rct_Region_116),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Region_117), GetRectCenterY(gg_rct_Region_117),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Region_118), GetRectCenterY(gg_rct_Region_118),GetRandomReal(0.,360.) ), "death" )
call DestroyTimer(GetExpiredTimer())
endfunction
private function InitializeStoneCoreAbyss takes nothing returns nothing
// The Stonecore Abyss
call SetUnitAnimation( CreateUnit(Player(26), 'h00Q',GetRectCenterX(gg_rct_Rect_062), GetRectCenterY(gg_rct_Rect_062),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_061), GetRectCenterY(gg_rct_Rect_061),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_063), GetRectCenterY(gg_rct_Rect_063),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_074), GetRectCenterY(gg_rct_Rect_074),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_071), GetRectCenterY(gg_rct_Rect_071),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Rect_064), GetRectCenterY(gg_rct_Rect_064),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Rect_065), GetRectCenterY(gg_rct_Rect_065),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Rect_072), GetRectCenterY(gg_rct_Rect_072),GetRandomReal(0.,360.) ), "sleep" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00R',GetRectCenterX(gg_rct_Rect_073), GetRectCenterY(gg_rct_Rect_073),GetRandomReal(0.,360.) ), "sleep" )
call DestroyTimer(GetExpiredTimer())
endfunction
private function InitializeStoneCoreGarroshUnits takes nothing returns nothing
set STONECORE_PEON = CreateUnit(ORGRIMMAR, 'h03F', GetRectCenterX(gg_rct_StonecorePeon),GetRectCenterY(gg_rct_StonecorePeon), 0. )
set STONECORE_WITCHDOCTOR = CreateUnit(ORGRIMMAR, 'h03E', GetRectCenterX(gg_rct_StonecoreWitchDoctor),GetRectCenterY(gg_rct_StonecoreWitchDoctor), 300. )
set STONECORE_GRUNT1 = CreateUnit(ORGRIMMAR, 'h001', GetRectCenterX(gg_rct_StonecoreGrunt1),GetRectCenterY(gg_rct_StonecoreGrunt1), 0. )
set STONECORE_GRUNT2 = CreateUnit(ORGRIMMAR, 'h001', GetRectCenterX(gg_rct_StonecoreGrunt2),GetRectCenterY(gg_rct_StonecoreGrunt2), 320. )
set STONECORE_TAUREN = CreateUnit(ORGRIMMAR, 'h002', GetRectCenterX(gg_rct_StonecoreTauren),GetRectCenterY(gg_rct_StonecoreTauren), 30. )
call DestroyTimer(GetExpiredTimer())
endfunction
private function InitializeStoneCoreGarrosh takes nothing returns nothing
//GarroshUnits
set STONECORE_GARROSH = CreateUnit(ORGRIMMAR, 'O000', GetRectCenterX(gg_rct_StonecoreGarrosh),GetRectCenterY(gg_rct_StonecoreGarrosh), 315. )
call PauseUnit(STONECORE_GARROSH,true)
call DestroyTimer(GetExpiredTimer())
endfunction
private function onTimerStartInitializing takes nothing returns nothing
local integer i = 1
local unit tempu = null
local real x = 0.
local real y = 0.
local real xt = 0.
local real yt = 0.
local real ang = 0.
local unit u = null
loop
exitwhen i > udg_PlayerCount
call SetPlayerMaxHeroesAllowed( 1, udg_Players[i] )
set i = i + 1
endloop
call UnitApplyTimedLife(CreateUnit(Player(15),'h009',10700.,12000.,0.),'BHwe',0.1)
call UnitApplyTimedLife(CreateUnit(Player(15),'h02B',10700.,12000.,0.),'BHwe',0.1)
call TimerStart(CreateTimer(),1., false, function InitializeStoneCoreGarrosh)
call TimerStart(CreateTimer(),2., false, function InitializeStoneCoreGarroshUnits)
call TimerStart(CreateTimer(),3., false, function InitializeStoneCoreEntrance)
call TimerStart(CreateTimer(),4., false, function InitializeStoneCoreAbyss)
call TimerStart(CreateTimer(),5., false, function InitializeChapter3)
call TimerStart(CreateTimer(),6., false, function InitializeChapter3Vendors)
call TimerStart(CreateTimer(),7., false, function InitializeChapter3Cenarius)
call TimerStart(CreateTimer(),8., false, function InitializeChapter3Wisps)
// Chapter 1
//Xardas
set XARDAS = CreateUnit(INVADERS, 'o00V', GetRectCenterX(gg_rct_XardasTowerPlacement) + 50.,GetRectCenterY(gg_rct_XardasTowerPlacement) - 50., 330. )
call MakeUnitGiant(XARDAS,true)
//Ogre
set OGRE_GLADIATOR = CreateUnit(ORGRIMMAR, 'o00S', -9897., -6558.,352.)
call SetUnitPathing( OGRE_GLADIATOR, false )
call SetUnitAnimation(OGRE_GLADIATOR,"sleep")
//workers
set tempu = CreateUnit(ORGRIMMAR, 'h04G', -10245., -6670.,43.)
call SetUnitAnimation(tempu,"stand work")
call SetUnitFlyHeight(tempu,255.,0.)
set tempu = CreateUnit(ORGRIMMAR, 'h04G', -10755., -7665.,184.)
call SetUnitAnimation(tempu,"stand work")
call SetUnitFlyHeight(tempu,180.,0.)
// vendors
set udg_C1_Vendors[1] = CreateUnit(ORGRIMMAR, 'h004',GetRectCenterX(gg_rct_Armorer), GetRectCenterY(gg_rct_Armorer),315. )
set udg_C1_Vendors[2] = CreateUnit(ORGRIMMAR, 'h003',GetRectCenterX(gg_rct_Indendant), GetRectCenterY(gg_rct_Indendant),225. )
set udg_C1_Vendors[3] = CreateUnit(ORGRIMMAR, 'h006',GetRectCenterX(gg_rct_Weaponer), GetRectCenterY(gg_rct_Weaponer),315. )
set udg_C1_Vendors[4] = CreateUnit(ORGRIMMAR, 'h005',GetRectCenterX(gg_rct_Inscriptor), GetRectCenterY(gg_rct_Inscriptor),225. )
call SetUnitPathing( udg_C1_Vendors[1], false )
call SetUnitPathing( udg_C1_Vendors[2], false )
call SetUnitPathing( udg_C1_Vendors[3], false )
call SetUnitPathing( udg_C1_Vendors[4], false )
//headhunter
call SetUnitAnimation( CreateUnit(Player(26), 'h04A',GetRectCenterX(gg_rct_Chapter1HeadHunter), GetRectCenterY(gg_rct_Chapter1HeadHunter),240. ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h04B',GetRectCenterX(gg_rct_Chapter1HeadHunter2), GetRectCenterY(gg_rct_Chapter1HeadHunter2),255. ), "death" )
// grunts
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_010), GetRectCenterY(gg_rct_Rect_010),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_007), GetRectCenterY(gg_rct_Rect_007),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_001), GetRectCenterY(gg_rct_Rect_001),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_005), GetRectCenterY(gg_rct_Rect_005),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_009), GetRectCenterY(gg_rct_Rect_009),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_045), GetRectCenterY(gg_rct_Rect_045),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_047), GetRectCenterY(gg_rct_Rect_047),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_048), GetRectCenterY(gg_rct_Rect_048),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h001',GetRectCenterX(gg_rct_Rect_051), GetRectCenterY(gg_rct_Rect_051),GetRandomReal(0.,360.) ), "death" )
// taurens
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_000), GetRectCenterY(gg_rct_Rect_000),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_002), GetRectCenterY(gg_rct_Rect_002),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_008), GetRectCenterY(gg_rct_Rect_008),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_003), GetRectCenterY(gg_rct_Rect_003),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_004), GetRectCenterY(gg_rct_Rect_004),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_006), GetRectCenterY(gg_rct_Rect_006),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_044), GetRectCenterY(gg_rct_Rect_044),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_046), GetRectCenterY(gg_rct_Rect_046),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_049), GetRectCenterY(gg_rct_Rect_049),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h002',GetRectCenterX(gg_rct_Rect_050), GetRectCenterY(gg_rct_Rect_050),GetRandomReal(0.,360.) ), "death" )
// -
call SetUnitAnimation( CreateUnit(Player(26), 'h00P',GetRectCenterX(gg_rct_Rect_053), GetRectCenterY(gg_rct_Rect_053),GetRandomReal(0.,360.) ), "death" )
call SetUnitAnimation( CreateUnit(Player(26), 'h00P',GetRectCenterX(gg_rct_Rect_054), GetRectCenterY(gg_rct_Rect_054),GetRandomReal(0.,360.) ), "death" )
//acolytes
set xt = GetRectCenterX(gg_rct_XardasTowerEnter)
set yt = GetRectCenterY(gg_rct_XardasTowerEnter)
set x = GetRectCenterX(gg_rct_XardasAcolyte1)
set y = GetRectCenterY(gg_rct_XardasAcolyte1)
set ang = Atan2(yt-y,xt-x)
set u = CreateUnit(Player(26), 'h04L',x, y, Rad2Deg(ang) )
call SetUnitAnimation( u , "stand channel" )
set x = GetRectCenterX(gg_rct_XardasAcolyte2)
set y = GetRectCenterY(gg_rct_XardasAcolyte2)
set ang = Atan2(yt-y,xt-x)
set u = CreateUnit(Player(26), 'h04L',x, y, Rad2Deg(ang) )
call SetUnitAnimation( u , "stand channel" )
set x = GetRectCenterX(gg_rct_XardasAcolyte3)
set y = GetRectCenterY(gg_rct_XardasAcolyte3)
set ang = Atan2(yt-y,xt-x)
set u = CreateUnit(Player(26), 'h04L',x, y, Rad2Deg(ang) )
call SetUnitAnimation( u , "stand channel" )
set u = null
call DestroyTimer(GetExpiredTimer())
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterTimerEventSingle( t, 0.75 )
call TriggerAddAction( t, function onTimerStartInitializing )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope ClearingTheMap initializer onInit
globals
private constant real FADE_TIME = 5.
endglobals
private function Conds takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == false
endfunction
private function FlushUnitOnTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local string name = LoadStr(udg_hash,GetHandleId(t),2)
if u==null then
call BJDebugMsg("|c00FF0000Unit cleaning error:|r died unit " + name + " is null.")
endif
call FlushChildHashtable(udg_hash,GetHandleId(u))
call FlushChildHashtable(C3_hash,GetHandleId(u))
call GroupRemoveUnit(DPS_GROUP,u)
call GroupRemoveUnit(FIRE_DPS_GROUP,u)
call GroupRemoveUnit(ELEMENTAL_DPS_GROUP,u)
call GroupRemoveUnit(WATER_CLEANSING_DUMMIES,u)
call GroupRemoveUnit(udg_Dummy_Group,u)
//call Aggro.remove(u)
call GroupRemoveUnit(Aggro.ordered,u)
//call RemoveUnit(u)
call FadeUnitIn(u,5.)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function Acts takes nothing returns nothing
local unit u = GetTriggerUnit()
if not IsUnitType(u,UNIT_TYPE_HERO) then
call GroupRemoveUnit(MAP_UNITS_ALIVE,u)
call GroupRemoveUnit(DPS_GROUP,u)
call GroupRemoveUnit(FIRE_DPS_GROUP,u)
call GroupRemoveUnit(ELEMENTAL_DPS_GROUP,u)
call GroupRemoveUnit(WATER_CLEANSING_DUMMIES,u)
call GroupRemoveUnit(udg_Dummy_Group,u)
endif
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i>10
call TriggerRegisterPlayerUnitEvent( t,Player(i), EVENT_PLAYER_UNIT_DEATH, null )
set i = i + 1
endloop
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function Acts )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_no_ally_attack_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) == true ) ) then
return false
endif
return true
endfunction
function Trig_no_ally_attack_Actions takes nothing returns nothing
call IssueImmediateOrder( GetAttacker(), "stop" )
endfunction
//===========================================================================
function InitTrig_no_ally_attack takes nothing returns nothing
set gg_trg_no_ally_attack = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_no_ally_attack, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_no_ally_attack, Condition( function Trig_no_ally_attack_Conditions ) )
call TriggerAddAction( gg_trg_no_ally_attack, function Trig_no_ally_attack_Actions )
endfunction
scope UpgradeBalance initializer onInit
globals
private constant integer TANKERS_BASE_DMGUPGRADE = 'R007'
private constant integer TANKERS_MAGMAW_DMGUPGRADE = 'R001'
private constant integer TANKERS_SUPREMUS_DMGUPGRADE = 'R009'
private constant integer TANKERS_EREDARS_DMGUPGRADE = 'R00E'
integer C3_PLAYER_HP_BALANCE = 'R00F'
private constant integer DAMAGERS_BASE_HPUPGRADE = 'R006'
private constant integer DAMAGERS_MAGMAW_HPUPGRADE = 'R008'
private constant integer DAMAGERS_SUPREMUS_HPUPGRADE = 'R000'
private constant integer DAMAGERS_EREDARS_HPUPGRADE = 'R00D'
private constant integer KING_OF_STORMWIND_HP_BALANCE = 'R004'
private constant integer STONECORE_GUARDIAN_HP_UPGRADE = 'R00C'
private constant integer CENARIUS_HP_BALANCE = 'R00H'
private constant integer DIFFICULTY_HP_BONUS = 'R003'
private constant integer DIFFICULTY_EXTREMEPLUS_DMG_BONUS = 'R00A'
private constant integer HERO_CLASS_HASH = 30
private integer LAST_DD_COUNT = -1
private integer LAST_TANKER_COUNT = -1
private integer LAST_HEALER_COUNT = -1
private integer LAST_PLAYER_COUNT = -1
private integer LAST_DIFFICULTY_COUNT = -1
private integer LAST_STONECORE_GUARDIANS_KILLED = -1
private player ENEMY = Player(7)
private player STORMWIND = Player(8)
endglobals
function CountPlayersInGame takes nothing returns integer
local integer j = 1
local integer counter = 0
loop
exitwhen j > udg_PlayerCount
if GetPlayerSlotState(udg_Players[j])==PLAYER_SLOT_STATE_PLAYING then
set counter = counter + 1
endif
set j = j + 1
endloop
return counter
endfunction
function CountDDInGame takes nothing returns integer
local integer j = 1
local integer counter = 0
loop
exitwhen j > udg_PlayerCount
if (LoadStr(udg_hash,GetHandleId(udg_Heroes[j]),HERO_CLASS_HASH) == "Damage Dealer" or LoadStr(udg_hash,GetHandleId(udg_Heroes[j]),HERO_CLASS_HASH) == "Mage") and GetPlayerSlotState(udg_Players[j])==PLAYER_SLOT_STATE_PLAYING then
set counter = counter + 1
endif
set j = j + 1
endloop
return counter
endfunction
function CountPhysDamagersInGame takes nothing returns integer
local integer j = 1
local integer counter = 0
loop
exitwhen j > udg_PlayerCount
if LoadStr(udg_hash,GetHandleId(udg_Heroes[j]),HERO_CLASS_HASH) == "Damage Dealer" and GetPlayerSlotState(udg_Players[j])==PLAYER_SLOT_STATE_PLAYING then
set counter = counter + 1
endif
set j = j + 1
endloop
return counter
endfunction
function CountMagesInGame takes nothing returns integer
local integer j = 1
local integer counter = 0
loop
exitwhen j > udg_PlayerCount
if LoadStr(udg_hash,GetHandleId(udg_Heroes[j]),HERO_CLASS_HASH) == "Mage" and GetPlayerSlotState(udg_Players[j])==PLAYER_SLOT_STATE_PLAYING then
set counter = counter + 1
endif
set j = j + 1
endloop
return counter
endfunction
function CountHealersInGame takes nothing returns integer
local integer j = 1
local integer counter = 0
loop
exitwhen j > udg_PlayerCount
if LoadStr(udg_hash,GetHandleId(udg_Heroes[j]),HERO_CLASS_HASH) == "Healer" and GetPlayerSlotState(udg_Players[j])==PLAYER_SLOT_STATE_PLAYING then
set counter = counter + 1
endif
set j = j + 1
endloop
return counter
endfunction
function CountTankersInGame takes nothing returns integer
local integer j = 1
local integer counter = 0
loop
exitwhen j > udg_PlayerCount
if LoadStr(udg_hash,GetHandleId(udg_Heroes[j]),HERO_CLASS_HASH) == "Tanker" and GetPlayerSlotState(udg_Players[j])==PLAYER_SLOT_STATE_PLAYING then
set counter = counter + 1
endif
set j = j + 1
endloop
return counter
endfunction
function UpgradeStonecoreGuardians takes nothing returns nothing
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"STONECOREGUARDIANS UPGRADES FROM: " + I2S(GetPlayerTechCount(ENEMY,STONECORE_GUARDIAN_HP_UPGRADE,true)))
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"STONECOREGUARDIANS UPGRADES TO: " + I2S(GetPlayerTechCount(ENEMY,STONECORE_GUARDIAN_HP_UPGRADE,true)))
endfunction
private function onTimerUpdate takes nothing returns nothing
local integer DDSCOUNT = CountDDInGame()
local integer PHYSDAMAGERSCOUNT = CountPhysDamagersInGame()
local integer MAGESCOUNT = CountMagesInGame()
local integer TANKERSCOUNT = CountTankersInGame()
local integer HEALERSCOUNT = CountHealersInGame()
local integer PLAYERSCOUNT = CountPlayersInGame()
local integer tempInt = 0
local integer tempMage = 0
local integer tempPD = 0
local integer STONECORE_GUARDIANS_KILLED = GOLEM_COUNT
if not (STONECORE_GUARDIANS_KILLED == LAST_STONECORE_GUARDIANS_KILLED) or not (LAST_PLAYER_COUNT == PLAYERSCOUNT) then
call SetPlayerTechResearched(ENEMY,STONECORE_GUARDIAN_HP_UPGRADE, STONECORE_GUARDIANS_KILLED * (R2I(PLAYERSCOUNT/2.)) )
set LAST_STONECORE_GUARDIANS_KILLED = GOLEM_COUNT
endif
if not (LAST_TANKER_COUNT == TANKERSCOUNT) or not (LAST_HEALER_COUNT == HEALERSCOUNT) or not (LAST_PLAYER_COUNT == PLAYERSCOUNT) then
if not (LAST_TANKER_COUNT == -1) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Tankers number has changed. Rebalancing...")
endif
set tempInt = TANKERSCOUNT * (7-PLAYERSCOUNT)
call SetPlayerTechResearched(ENEMY, TANKERS_BASE_DMGUPGRADE, tempInt )
if CURRENT_DIFFICULTY>=3 then
call SetPlayerTechResearched(ENEMY, TANKERS_MAGMAW_DMGUPGRADE, TANKERSCOUNT + HEALERSCOUNT)
call SetPlayerTechResearched(ENEMY, TANKERS_SUPREMUS_DMGUPGRADE, TANKERSCOUNT + HEALERSCOUNT)
call SetPlayerTechResearched(ENEMY, TANKERS_EREDARS_DMGUPGRADE, TANKERSCOUNT + HEALERSCOUNT)
else
call SetPlayerTechResearched(ENEMY, TANKERS_MAGMAW_DMGUPGRADE, TANKERSCOUNT)
call SetPlayerTechResearched(ENEMY, TANKERS_SUPREMUS_DMGUPGRADE, TANKERSCOUNT)
call SetPlayerTechResearched(ENEMY, TANKERS_EREDARS_DMGUPGRADE, TANKERSCOUNT)
endif
endif
if not (LAST_DD_COUNT == DDSCOUNT) or not (LAST_PLAYER_COUNT == PLAYERSCOUNT) or not (LAST_DIFFICULTY_COUNT == CURRENT_DIFFICULTY) then
if not (LAST_DD_COUNT == -1) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Damage Dealers/Mages number has changed. Rebalancing...")
endif
set tempMage = 12 - 2 * (PLAYERSCOUNT-1)
set tempPD = 8 - (PLAYERSCOUNT-1)
set tempInt = MAGESCOUNT*tempMage + PHYSDAMAGERSCOUNT*tempPD
call SetPlayerTechResearched(ENEMY, DAMAGERS_BASE_HPUPGRADE, tempInt)
call SetPlayerTechResearched(ENEMY, DAMAGERS_MAGMAW_HPUPGRADE, (7+CURRENT_DIFFICULTY)*DDSCOUNT )
call SetPlayerTechResearched(ENEMY, DAMAGERS_SUPREMUS_HPUPGRADE, (7+CURRENT_DIFFICULTY)*DDSCOUNT )
call SetPlayerTechResearched(ENEMY, DAMAGERS_EREDARS_HPUPGRADE, (7+CURRENT_DIFFICULTY)*DDSCOUNT )
endif
if not (LAST_DIFFICULTY_COUNT == CURRENT_DIFFICULTY) then
set LAST_DIFFICULTY_COUNT = CURRENT_DIFFICULTY
call SetPlayerTechResearched(ENEMY, DIFFICULTY_HP_BONUS, CURRENT_DIFFICULTY )
if CURRENT_DIFFICULTY < 3 then
call SetPlayerTechResearched(ENEMY, DIFFICULTY_EXTREMEPLUS_DMG_BONUS, 0)
endif
if CURRENT_DIFFICULTY >=3 then
call SetPlayerTechResearched(ENEMY, DIFFICULTY_EXTREMEPLUS_DMG_BONUS, CURRENT_DIFFICULTY-2)
endif
endif
if not (LAST_PLAYER_COUNT == PLAYERSCOUNT) then
if not (LAST_PLAYER_COUNT == -1) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Player number has changed. Rebalancing...")
endif
set LAST_PLAYER_COUNT = PLAYERSCOUNT
call SetPlayerTechResearched( STORMWIND,KING_OF_STORMWIND_HP_BALANCE, PLAYERSCOUNT)
call SetPlayerTechResearched( DARNASSUS,CENARIUS_HP_BALANCE, PLAYERSCOUNT)
if CHAPTER_3_STARTED then
if PLAYERSCOUNT == 3 or PLAYERSCOUNT == 5 then
call SetPlayerTechResearched( ENEMY,C3_PLAYER_HP_BALANCE, 2)
endif
if PLAYERSCOUNT == 2 or PLAYERSCOUNT == 6 then
call SetPlayerTechResearched( ENEMY,C3_PLAYER_HP_BALANCE, 3)
endif
if PLAYERSCOUNT == 4 then
call SetPlayerTechResearched( ENEMY,C3_PLAYER_HP_BALANCE, 4)
endif
endif
endif
set LAST_TANKER_COUNT = TANKERSCOUNT
set LAST_HEALER_COUNT = HEALERSCOUNT
set LAST_DD_COUNT = DDSCOUNT
endfunction
private function onInit takes nothing returns nothing
local timer t = CreateTimer()
call TimerStart(t,5.0,true,function onTimerUpdate)
set t = null
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope Tips initializer onInit
globals
private integer previous = 0
private boolean array fInd[100]
endglobals
private function onTimer takes nothing returns nothing
local integer i = 0
local integer k = 0
set i = 1
loop
exitwhen i>udg_TipsCount
if not fInd[i] then
set k = k + 1
endif
set i = i + 1
endloop
if k > 0 then
loop
set i = GetRandomInt(1,udg_TipsCount)
exitwhen not fInd[i]
endloop
set fInd[i] = true
else
set i = 1
loop
exitwhen i>udg_TipsCount
set fInd[i] = false
set i = i + 1
endloop
set i = GetRandomInt(1,udg_TipsCount)
set fInd[i] = true
endif
if IsPlayerInForce(GetLocalPlayer(),udg_Tips_Force) then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,udg_Tips[i])
endif
call DestroyTimer(GetExpiredTimer())
call TimerStart(CreateTimer(),30.,false,function onTimer)
endfunction
private function Acts takes nothing returns nothing
local integer i = 1
set udg_TipsCount = 23
set udg_Tips[1] ="|c00804040Tip 1 of " +I2S(udg_TipsCount)+":|r Choose heroes with the roles that are needed for your party. Without a tanker or a healer you cannot beat the map."
set udg_Tips[2] ="|c00804040Tip 2 of " +I2S(udg_TipsCount)+":|r Playing a tanker or a damage dealer you may use an aggro table (type \"|c00804040-sa|r\" to show) to control your aggro on creeps."
set udg_Tips[3] ="|c00804040Tip 3 of " +I2S(udg_TipsCount)+":|r Do not forget that elixirs can help you in difficult situations such as impossible waves or boss encounters."
set udg_Tips[4] ="|c00804040Tip 4 of " +I2S(udg_TipsCount)+":|r Playing a healer take care about your mana regeneration, buying items with spirit boost or energy regeneration. Use mana potions in difficult situations and do not forget that you can leave the combat to regenerate mana."
set udg_Tips[5] ="|c00804040Tip 5 of " +I2S(udg_TipsCount)+":|r Do not be in the epicenter of battle when you are playing Mage or Damage Dealer. This can make problems to your healer."
set udg_Tips[6] ="|c00804040Tip 6 of " +I2S(udg_TipsCount)+":|r Choose a right way to leveling your hero in order to improve the performance of your party setup."
set udg_Tips[7] ="|c00804040Tip 7 of " +I2S(udg_TipsCount)+":|r If you lose during Chapter I, you can always restart the game without leaving it."
set udg_Tips[8] ="|c00804040Tip 8 of " +I2S(udg_TipsCount)+":|r You can change the camera height as you like. Just type \"|c00804040-camera|r\"."
set udg_Tips[9] ="|c00804040Tip 9 of " +I2S(udg_TipsCount)+":|r To turn off these messages type \"|c00804040-tips off|r\"."
set udg_Tips[10] ="|c00804040Tip 10 of " +I2S(udg_TipsCount)+":|r To see a detail info about the Hero stats type \"|c00804040-ssb|r\". To switch back to the main hero stats type \"|c00804040-ss|r\"."
set udg_Tips[11] ="|c00804040Tip 11 of " +I2S(udg_TipsCount)+":|r You leave the combat in few seconds since the last taking or dealing any damage or healing. Use this mechanics to reset the limits of your elixirs and potions and to regenerate mana."
set udg_Tips[12] ="|c00804040Tip 12 of " +I2S(udg_TipsCount)+":|r Any creep or boss resets the aggro on the hero in 10 seconds if they do not deal damage to each other."
set udg_Tips[13] ="|c00804040Tip 13 of " +I2S(udg_TipsCount)+":|r A unit cannot have two damage over time effects of the same type."
set udg_Tips[14] ="|c00804040Tip 14 of " +I2S(udg_TipsCount)+":|r If your hero is stucked or camera is bugged type \"|c00804040-kill|r\" to kill the hero. He will be revived at the nearest spirit healer."
set udg_Tips[15] ="|c00804040Tip 15 of " +I2S(udg_TipsCount)+":|r There is a |c00804040dynamical auto-balancing|r, depending on the number of players in game and picked heroes' roles. So, do not worry if a player leaves the game: it is immediately balanced for the remained players."
set udg_Tips[16] ="|c00804040Tip 16 of " +I2S(udg_TipsCount)+":|r If you like personal challenges, you can try the |c00804040Multi-Heroes regime|r in singleplayer."
set udg_Tips[17] ="|c00804040Tip 17 of " +I2S(udg_TipsCount)+":|r Type \"|c00804040-hero info|r\" to get some tips about your hero."
set udg_Tips[18] ="|c00804040Tip 18 of " +I2S(udg_TipsCount)+":|r Type \"|c00804040-weather off/on|r\" or \"|c00804040-fog off/on|r\" to turn off/on weather effects."
set udg_Tips[19] ="|c00804040Tip 19 of " +I2S(udg_TipsCount)+":|r Join the map community in Battle.net: |c00804040https://blizzard.com/invite/RbvqV0SEAV|r."
set udg_Tips[20] ="|c00804040Tip 20 of " +I2S(udg_TipsCount)+":|r The first player can change the difficulty level by typing \"|c00804040-difficulty j|r\", where j is any integer between 1 and 5."
set udg_Tips[21] ="|c00804040Tip 21 of " +I2S(udg_TipsCount)+":|r Some heroes have additional skins. Type \"|c00804040-skin 2|r\" to change your hero's skin to custom one. Type \"|c00804040-skin 1|r\" to switch back."
set udg_Tips[22] ="|c00804040Tip 22 of " +I2S(udg_TipsCount)+":|r To see damage or healing meters type \"|c00804040-dd|r\" or \"|c00804040-hd|r\" respectively. It resets at each new fight, i. e. the next one after all the heroes leaves the combat (this does not refresh while boss fighting)."
set udg_Tips[23] ="|c00804040Tip 23 of " +I2S(udg_TipsCount)+":|r You cannot enter the boss battleground while it is active. Type \"|c00804040-bosscam|r\" to switch camera to the boss battleground. Click on your hero to switch back to the hero camera."
loop
exitwhen i>udg_TipsCount
set fInd[i] = false
set i = i + 1
endloop
call TimerStart(CreateTimer(),0.0,false,function onTimer)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t,50.,false)
call TriggerAddAction( t, function Acts )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library GameCommands initializer onInit requires MakeUnitPassive, WeatherEffects
globals
force BATTLE_TEXT_FORCE = CreateForce()
force SPELL_DAMAGE_TEXT_FORCE = CreateForce()
force PHYS_DAMAGE_TEXT_FORCE = CreateForce()
force HEALING_TEXT_FORCE = CreateForce()
force ENEMY_TEXT_FORCE = CreateForce()
constant integer PLAYER_ID_HASH = 5
constant integer SHOW_STATS_SHOWED = 7
constant integer SHOW_AGGRO_SHOWED = 8
constant integer DD_MB_SHOWED = 20
constant integer HD_MB_SHOWED = 21
endglobals
function ShowMboard takes player plr, multiboard mb, boolean show returns nothing
if GetLocalPlayer() == plr then
call MultiboardDisplay(mb,show)
endif
endfunction
private function Acts takes nothing returns nothing
local integer i = 1
local integer j = 1
local string str = GetEventPlayerChatString()
local integer id = LoadInteger(udg_hash,GetHandleId(GetTriggerPlayer()),PLAYER_ID_HASH)
if str == "-show stats" or str == "-ss" then
call ShowMboard(GetTriggerPlayer(),udg_MBoard[id],true)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_AGGRO_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),DD_MB_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),HD_MB_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_STATS_SHOWED,true)
endif
if str == "-show stats big" or str == "-ssb" then
call ShowMboard(GetTriggerPlayer(),udg_NBoard[id],true)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_AGGRO_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_STATS_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),DD_MB_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),HD_MB_SHOWED,false)
endif
if str == "-show aggro" or str == "-sa" then
call ShowMboard(GetTriggerPlayer(),udg_ABoard[id],true)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_AGGRO_SHOWED,true)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_STATS_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),DD_MB_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),HD_MB_SHOWED,false)
endif
if str == "-tips off" then
call ForceRemovePlayer(udg_Tips_Force,GetTriggerPlayer())
endif
if str == "-tips on" then
call ForceAddPlayer(udg_Tips_Force,GetTriggerPlayer())
endif
if str == "-bt off" then
call ForceRemovePlayer(BATTLE_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-bt on" then
call ForceAddPlayer(BATTLE_TEXT_FORCE,GetTriggerPlayer())
call ForceAddPlayer(SPELL_DAMAGE_TEXT_FORCE,GetTriggerPlayer())
call ForceAddPlayer(PHYS_DAMAGE_TEXT_FORCE,GetTriggerPlayer())
call ForceAddPlayer(HEALING_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-st off" then
call ForceRemovePlayer(SPELL_DAMAGE_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-st on" then
call ForceAddPlayer(SPELL_DAMAGE_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-pt off" then
call ForceRemovePlayer(PHYS_DAMAGE_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-pt on" then
call ForceAddPlayer(PHYS_DAMAGE_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-ht off" then
call ForceRemovePlayer(HEALING_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-ht on" then
call ForceAddPlayer(HEALING_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-et off" then
call ForceRemovePlayer(ENEMY_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-et on" then
call ForceAddPlayer(ENEMY_TEXT_FORCE,GetTriggerPlayer())
endif
if str == "-dd" then
call ShowMboard(GetTriggerPlayer(),DD_BOSS_MB,true)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_AGGRO_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_STATS_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),DD_MB_SHOWED,true)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),HD_MB_SHOWED,false)
endif
if str == "-hd" then
call ShowMboard(GetTriggerPlayer(),HD_BOSS_MB,true)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_AGGRO_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_STATS_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),DD_MB_SHOWED,false)
call SaveBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),HD_MB_SHOWED,true)
endif
if str == "-pvp on" and IS_VICTORY then
if not IsPlayerInForce(GetTriggerPlayer(),PVP_FORCE) then
call ForceAddPlayer(PVP_FORCE,GetTriggerPlayer())
call DisplayTextToForce( GetPlayersAll(), ( udg_ColorString[GetConvertedPlayerId(GetTriggerPlayer())] + ( GetPlayerName(GetTriggerPlayer()) + " |r turned on |cff80ff80PVP|r flag." ) ) )
endif
endif
if str == "-pvp off" and IS_VICTORY then
if IsPlayerInForce(GetTriggerPlayer(),PVP_FORCE) then
call ForceRemovePlayer(PVP_FORCE,GetTriggerPlayer())
call DisplayTextToForce( GetPlayersAll(), ( udg_ColorString[GetConvertedPlayerId(GetTriggerPlayer())] + ( GetPlayerName(GetTriggerPlayer()) + " |r turned off |cff80ff80PVP|r flag." ) ) )
endif
endif
if str == "-weather on" or str == "-fog on" then
call TurnWeatherEffectsForPlayer(GetTriggerPlayer(),true)
endif
if str == "-weather off" or str == "-fog off" then
call TurnWeatherEffectsForPlayer(GetTriggerPlayer(),false)
endif
if str == "-train on" then
call SetPlayerAllianceStateBJ( GetTriggerPlayer(), Player(PLAYER_NEUTRAL_PASSIVE), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(PLAYER_NEUTRAL_PASSIVE), GetTriggerPlayer(), bj_ALLIANCE_UNALLIED )
endif
if str == "-train off" then
call SetPlayerAllianceStateBJ( GetTriggerPlayer(), Player(PLAYER_NEUTRAL_PASSIVE), bj_ALLIANCE_NEUTRAL)
call SetPlayerAllianceStateBJ( Player(PLAYER_NEUTRAL_PASSIVE), GetTriggerPlayer(), bj_ALLIANCE_NEUTRAL)
endif
if str == "-hero info" then
set i = 1
loop
exitwhen i > udg_PlayerCount
if GetTriggerPlayer()==GetOwningPlayer(udg_Heroes[i]) then
set j = 1
loop
exitwhen j > udg_HeroCount
if GetUnitTypeId(udg_Heroes[i]) == udg_Hero[j] then
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,60.,HERO_INFO_BASE[j])
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,60.,HERO_INFO_I1[j])
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,60.,HERO_INFO_I2[j])
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,60.,HERO_INFO_T[j])
endif
set j = j + 1
endloop
endif
set i = i +1
endloop
endif
if str == "-aa off" then
if IsMultiHeroes and PLAYER_HERO_CLICKED_INDEX > 0 then
if not IsUnitPassive(udg_Heroes[PLAYER_HERO_CLICKED_INDEX]) then
call MakeUnitPassive(udg_Heroes[PLAYER_HERO_CLICKED_INDEX])
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,10.,"|cff80ff80" +GetUnitName(udg_Heroes[PLAYER_HERO_CLICKED_INDEX]) + "|r will be passive.")
endif
elseif udg_PlayerCount>1 then
set i = 1
loop
exitwhen i>udg_PlayerCount
if GetOwningPlayer(udg_Heroes[i])==GetTriggerPlayer() then
if not IsUnitPassive(udg_Heroes[i]) then
call MakeUnitPassive(udg_Heroes[i])
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,10.,"|cff80ff80" + GetUnitName(udg_Heroes[i]) + "|r will be passive.")
endif
endif
set i = i + 1
endloop
endif
endif
if str == "-aa on" then
if IsMultiHeroes and PLAYER_HERO_CLICKED_INDEX > 0 then
if IsUnitPassive(udg_Heroes[PLAYER_HERO_CLICKED_INDEX]) then
call MakeUnitAggressive(udg_Heroes[PLAYER_HERO_CLICKED_INDEX])
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,10.,"|cff80ff80" + GetUnitName(udg_Heroes[PLAYER_HERO_CLICKED_INDEX]) + "|r will be aggressive.")
endif
elseif udg_PlayerCount>1 then
set i = 1
loop
exitwhen i>udg_PlayerCount
if GetOwningPlayer(udg_Heroes[i])==GetTriggerPlayer() then
if IsUnitPassive(udg_Heroes[i]) then
call MakeUnitAggressive(udg_Heroes[i])
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,10.,"|cff80ff80" + GetUnitName(udg_Heroes[i]) + "|r now can attack.")
endif
endif
set i = i + 1
endloop
endif
endif
set j = 1
loop
exitwhen j>5
if str == ("-difficulty " + I2S(j)) then
if GetTriggerPlayer()==udg_Players[1] then
if (not (CURRENT_DIFFICULTY == j)) and (not (IS_BOSS_BATTLE)) then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,"Difficulty is changed to: " + DifficultiesName[j])
else
if IS_BOSS_BATTLE then
call SimError(GetTriggerPlayer(),"You are not allowed to change the difficulty during boss encounters.")
endif
endif
set CURRENT_DIFFICULTY = j
else
call SimError(GetTriggerPlayer(),"You are not allowed to change the difficulty.")
endif
endif
set j = j + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "-", false )
call TriggerRegisterPlayerChatEvent( t, Player(1), "-", false )
call TriggerRegisterPlayerChatEvent( t, Player(2), "-", false )
call TriggerRegisterPlayerChatEvent( t, Player(3), "-", false )
call TriggerRegisterPlayerChatEvent( t, Player(4), "-", false )
call TriggerRegisterPlayerChatEvent( t, Player(5), "-", false )
call TriggerAddAction( t, function Acts)
set t = null
endfunction
endlibrary
library RedGameCommands initializer onInit
private function GetColorString takes player p returns string
if GetPlayerColor(p) == PLAYER_COLOR_BLUE then
return "blue"
endif
if GetPlayerColor(p) == PLAYER_COLOR_CYAN then
return "teal"
endif
if GetPlayerColor(p) == PLAYER_COLOR_PURPLE then
return "purple"
endif
if GetPlayerColor(p) == PLAYER_COLOR_YELLOW then
return "yellow"
endif
if GetPlayerColor(p) == PLAYER_COLOR_ORANGE then
return "orange"
endif
return ""
endfunction
private function Acts takes nothing returns nothing
local integer i = 1
local string str = GetEventPlayerChatString()
loop
exitwhen i >= udg_PlayerCount
if (str == ("-kick " + GetPlayerName(udg_Players[i])) ) or (str == ("-kick " + GetColorString(udg_Players[i])) ) then
//call RemovePlayer(udg_Players[i],PLAYER_GAME_RESULT_DEFEAT)
if (GetLocalPlayer() == udg_Players[i]) then
call EndGame(true)
endif
endif
set i = i + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "-", false )
call TriggerAddAction( t, function Acts)
set t = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CameraSettings initializer Init
globals
unit array camera_u[5]
endglobals
private function Settings takes nothing returns boolean
local player p = GetOwningPlayer(GetTriggerUnit())
local real a = 0.
if GetSpellAbilityId() == 'A02O' then
set a = LoadReal(udg_hash,GetHandleId(p),1)
if a < 600. then
set a = a + 50.
else
call SimError(p,"You can't increase the camera height more than 600")
endif
if GetLocalPlayer() == p then
call SetCameraField(CAMERA_FIELD_ZOFFSET, a, 0.25)
endif
call SaveReal(udg_hash,GetHandleId(p),1,a)
elseif GetSpellAbilityId() == 'A02P' then
set a = LoadReal(udg_hash,GetHandleId(p),1)
if GetLocalPlayer() == p then
set a = a - 50.
call SetCameraField(CAMERA_FIELD_ZOFFSET, a, 0.25)
endif
call SaveReal(udg_hash,GetHandleId(p),1,a)
elseif GetSpellAbilityId() == 'A02M' then
set a = LoadReal(udg_hash,GetHandleId(p),2)
set a = a - 20.
if a <= -360. then
set a = a + 360.
endif
if GetLocalPlayer() == p then
call SetCameraField(CAMERA_FIELD_ROTATION, a, 0.25)
endif
call SaveReal(udg_hash,GetHandleId(p),2,a)
elseif GetSpellAbilityId() == 'A02N' then
set a = LoadReal(udg_hash,GetHandleId(p),2)
set a = a + 20.
if a >= 360. then
set a = a - 360.
endif
if GetLocalPlayer() == p then
call SetCameraField(CAMERA_FIELD_ROTATION, a, 0.25)
endif
call SaveReal(udg_hash,GetHandleId(p),2,a)
elseif GetSpellAbilityId() == 'A02Q' then
if GetLocalPlayer() == p then
call ResetToGameCamera(0.25)
endif
call SaveReal(udg_hash,GetHandleId(p),1,a)
call SaveReal(udg_hash,GetHandleId(p),2,90.)
endif
return false
endfunction
private function Select takes nothing returns nothing
if GetLocalPlayer() == GetTriggerPlayer() then
call ClearSelection()
call SelectUnit(camera_u[GetPlayerId(GetTriggerPlayer())],true)
endif
endfunction
private function Init takes nothing returns nothing
local integer i = 0
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-camera",true)
call TriggerRegisterPlayerChatEvent(t, Player(1),"-camera",true)
call TriggerRegisterPlayerChatEvent(t, Player(2),"-camera",true)
call TriggerRegisterPlayerChatEvent(t, Player(3),"-camera",true)
call TriggerRegisterPlayerChatEvent(t, Player(4),"-camera",true)
call TriggerRegisterPlayerChatEvent(t, Player(5),"-camera",true)
call TriggerAddAction(t, function Select)
set t = null
set t = CreateTrigger()
loop
exitwhen i > 5
set camera_u[i] = CreateUnit(Player(i),'h01B',GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect),0.)
call TriggerRegisterUnitEvent(t,camera_u[i],EVENT_UNIT_SPELL_CAST)
set i = i + 1
endloop
call TriggerAddCondition(t,Condition(function Settings))
set t = null
endfunction
endscope
scope CameraSettingsCam initializer Init
globals
unit array camera_u[5]
endglobals
private function Select takes nothing returns nothing
local real a = 0.
set a = S2I(SubStringBJ(GetEventPlayerChatString(), 6, 9))
if a >= -500. and a <= 1000. then
if GetLocalPlayer() == GetTriggerPlayer() then
call SetCameraField(CAMERA_FIELD_ZOFFSET, a, 0.25)
endif
call SaveReal(udg_hash,GetHandleId(GetTriggerPlayer()),1,a)
else
call SimError(GetTriggerPlayer(), "Camera Z-offset should be between -500 and 1000")
endif
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-cam",false)
call TriggerRegisterPlayerChatEvent(t, Player(1),"-cam",false)
call TriggerRegisterPlayerChatEvent(t, Player(2),"-cam",false)
call TriggerRegisterPlayerChatEvent(t, Player(3),"-cam",false)
call TriggerRegisterPlayerChatEvent(t, Player(4),"-cam",false)
call TriggerRegisterPlayerChatEvent(t, Player(5),"-cam",false)
call TriggerAddAction(t, function Select)
set t = null
endfunction
endscope
scope CameraSettingsCamera initializer Init
private function Select takes nothing returns nothing
local real a = 0.
set a = S2I(SubStringBJ(GetEventPlayerChatString(), 9, 12))
if a >= -500. and a <= 1000. then
if GetLocalPlayer() == GetTriggerPlayer() then
call SetCameraField(CAMERA_FIELD_ZOFFSET, a, 0.25)
endif
call SaveReal(udg_hash,GetHandleId(GetTriggerPlayer()),1,a)
else
call SimError(GetTriggerPlayer(), "Camera Z-offset should be between -500 and 1000")
endif
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-camera",false)
call TriggerRegisterPlayerChatEvent(t, Player(1),"-camera",false)
call TriggerRegisterPlayerChatEvent(t, Player(2),"-camera",false)
call TriggerRegisterPlayerChatEvent(t, Player(3),"-camera",false)
call TriggerRegisterPlayerChatEvent(t, Player(4),"-camera",false)
call TriggerRegisterPlayerChatEvent(t, Player(5),"-camera",false)
call TriggerAddAction(t, function Select)
set t = null
endfunction
endscope
scope HeroSkins initializer onInit
globals
integer array HERO_SKINS_COUNT[11]
integer array HERO_SKINS[11][10]
endglobals
private function ChangeSkin takes nothing returns nothing
local integer j = 1
local integer i = 1
local integer k = 1
local integer hero_ID = 1
local string str = GetEventPlayerChatString()
loop
exitwhen j > udg_PlayerCount
if GetTriggerPlayer()==udg_Players[j] then
set i = 1
loop
exitwhen i > udg_HeroCount
set hero_ID = j
if IsMultiHeroes and PLAYER_HERO_CLICKED_INDEX > 0 then
set hero_ID = PLAYER_HERO_CLICKED_INDEX
endif
if GetUnitTypeId(udg_Heroes[hero_ID])==udg_Hero[i] then
set k = 1
loop
exitwhen k > HERO_SKINS_COUNT[i]
if str == ("-skin " + I2S(k)) then
call BlzSetUnitSkin(udg_Heroes[hero_ID],HERO_SKINS[i][k])
endif
set k = k + 1
endloop
endif
set i = i + 1
endloop
endif
set j = j + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-skin",false)
call TriggerRegisterPlayerChatEvent(t, Player(1),"-skin",false)
call TriggerRegisterPlayerChatEvent(t, Player(2),"-skin",false)
call TriggerRegisterPlayerChatEvent(t, Player(3),"-skin",false)
call TriggerRegisterPlayerChatEvent(t, Player(4),"-skin",false)
call TriggerRegisterPlayerChatEvent(t, Player(5),"-skin",false)
call TriggerAddAction(t, function ChangeSkin)
set t = null
//Horde Champion
set HERO_SKINS_COUNT[1] = 2
set HERO_SKINS[1][1] = 'O002'
set HERO_SKINS[1][2] = 'O00E'
//Sorceress
set HERO_SKINS_COUNT[2] = 3
set HERO_SKINS[2][1] = 'H00A'
set HERO_SKINS[2][2] = 'H014'
set HERO_SKINS[2][3] = 'H01G'
//Stonebreaker
set HERO_SKINS_COUNT[3] = 1
set HERO_SKINS[3][1] = 'O008'
//Shaman
set HERO_SKINS_COUNT[4] = 2
set HERO_SKINS[4][1] = 'O003'
set HERO_SKINS[4][2] = 'O00F'
//Druid
set HERO_SKINS_COUNT[5] = 2
set HERO_SKINS[5][1] = 'O006'
set HERO_SKINS[5][2] = 'O00G'
//BLOODELF CAPTAIN
set HERO_SKINS_COUNT[6] = 2
set HERO_SKINS[6][1] = 'O005'
set HERO_SKINS[6][2] = 'O00D'
//DEATH KNIGHT
set HERO_SKINS_COUNT[7] = 2
set HERO_SKINS[7][1] = 'H01C'
set HERO_SKINS[7][2] = 'H042'
//RANGER
set HERO_SKINS_COUNT[8] = 2
set HERO_SKINS[8][1] = 'H00O'
set HERO_SKINS[8][2] = 'H03Z'
//PRIEST
set HERO_SKINS_COUNT[9] = 2
set HERO_SKINS[9][1] = 'H01I'
set HERO_SKINS[9][2] = 'H040'
//Eretic
set HERO_SKINS_COUNT[10] = 2
set HERO_SKINS[10][1] = 'H03J'
set HERO_SKINS[10][2] = 'H041'
//Akama
set HERO_SKINS_COUNT[11] = 2
set HERO_SKINS[11][1] = 'O00C'
set HERO_SKINS[11][2] = 'O00I'
//Iron Golem
set HERO_SKINS_COUNT[12] = 3
set HERO_SKINS[12][1] = 'O00R'
set HERO_SKINS[12][2] = 'O00T'
set HERO_SKINS[12][3] = 'O00U'
endfunction
endscope
scope RangerWolfSkins initializer onInit
globals
integer WOLF_SKINS_COUNT = 9
integer array WOLF_SKINS[11]
real array WOLF_NORMAL_SIZES[11]
real array WOLF_BONUS_SIZES[11]
integer WOLF_ACTIVE_SKIN_NUMBER = 0
endglobals
private function ChangeSkin takes nothing returns nothing
local integer j = 1
local integer i = 1
local integer k = 1
local integer hero_ID = 1
local string str = GetEventPlayerChatString()
local unit WOLF = null
loop
exitwhen j > udg_PlayerCount
if GetTriggerPlayer()==udg_Players[j] then
set i = 1
loop
exitwhen i > udg_HeroCount
set hero_ID = j
if IsMultiHeroes and PLAYER_HERO_CLICKED_INDEX > 0 then
set hero_ID = PLAYER_HERO_CLICKED_INDEX
endif
if GetUnitTypeId(udg_Heroes[hero_ID])=='H00O' then
set WOLF = LoadUnitHandle(udg_hash,GetHandleId(udg_Heroes[hero_ID]),SUMMON_WOLF_WOLFCASTERHASH)
set k = 1
loop
exitwhen k > WOLF_SKINS_COUNT
if str == ("-beastskin " + I2S(k)) then
if not (WOLF == null) then
call BlzSetUnitSkin(WOLF,WOLF_SKINS[k])
set WOLF_ACTIVE_SKIN_NUMBER = k
endif
endif
set k = k + 1
endloop
endif
set i = i + 1
endloop
endif
set j = j + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-beastskin",false)
call TriggerRegisterPlayerChatEvent(t, Player(1),"-beastskin",false)
call TriggerRegisterPlayerChatEvent(t, Player(2),"-beastskin",false)
call TriggerRegisterPlayerChatEvent(t, Player(3),"-beastskin",false)
call TriggerRegisterPlayerChatEvent(t, Player(4),"-beastskin",false)
call TriggerRegisterPlayerChatEvent(t, Player(5),"-beastskin",false)
call TriggerAddAction(t, function ChangeSkin)
set t = null
set WOLF_SKINS[1] = 'o00B'
set WOLF_NORMAL_SIZES[1] = 1.3
set WOLF_BONUS_SIZES[1] = 0.65
set WOLF_SKINS[2] = 'o00J'
set WOLF_NORMAL_SIZES[2] = 1.3
set WOLF_BONUS_SIZES[2] = 0.65
set WOLF_SKINS[3] = 'o00K'
set WOLF_NORMAL_SIZES[3] = 1.7
set WOLF_BONUS_SIZES[3] = 0.85
set WOLF_SKINS[4] = 'o00L'
set WOLF_NORMAL_SIZES[4] = 1.7
set WOLF_BONUS_SIZES[4] = 0.85
set WOLF_SKINS[5] = 'o00M'
set WOLF_NORMAL_SIZES[5] = 2.0
set WOLF_BONUS_SIZES[5] = 1.1
set WOLF_SKINS[6] = 'o00N'
set WOLF_NORMAL_SIZES[6] = 2.0
set WOLF_BONUS_SIZES[6] = 1.1
set WOLF_SKINS[7] = 'o00O'
set WOLF_NORMAL_SIZES[7] = 0.7
set WOLF_BONUS_SIZES[7] = 0.3
set WOLF_SKINS[8] = 'o00P'
set WOLF_NORMAL_SIZES[8] = 1.0
set WOLF_BONUS_SIZES[8] = 0.4
set WOLF_SKINS[9] = 'o00Q'
set WOLF_NORMAL_SIZES[9] = 0.9
set WOLF_BONUS_SIZES[9] = 0.3
endfunction
endscope
function Trig_clear_Actions takes nothing returns nothing
call ClearTextMessages()
endfunction
//===========================================================================
function InitTrig_clear takes nothing returns nothing
set gg_trg_clear = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_clear, Player(0), "-clear", true )
call TriggerRegisterPlayerChatEvent( gg_trg_clear, Player(1), "-clear", true )
call TriggerRegisterPlayerChatEvent( gg_trg_clear, Player(2), "-clear", true )
call TriggerRegisterPlayerChatEvent( gg_trg_clear, Player(3), "-clear", true )
call TriggerRegisterPlayerChatEvent( gg_trg_clear, Player(4), "-clear", true )
call TriggerRegisterPlayerChatEvent( gg_trg_clear, Player(5), "-clear", true )
call TriggerAddAction( gg_trg_clear, function Trig_clear_Actions )
endfunction
function Trig_suicide_Actions takes nothing returns nothing
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerPlayer()==udg_Players[i] then
call KillUnit(udg_Heroes[i])
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_suicide takes nothing returns nothing
set gg_trg_suicide = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_suicide, Player(0), "-kill", true )
call TriggerRegisterPlayerChatEvent( gg_trg_suicide, Player(1), "-kill", true )
call TriggerRegisterPlayerChatEvent( gg_trg_suicide, Player(2), "-kill", true )
call TriggerRegisterPlayerChatEvent( gg_trg_suicide, Player(3), "-kill", true )
call TriggerRegisterPlayerChatEvent( gg_trg_suicide, Player(4), "-kill", true )
call TriggerRegisterPlayerChatEvent( gg_trg_suicide, Player(5), "-kill", true )
call TriggerAddAction( gg_trg_suicide, function Trig_suicide_Actions )
endfunction
scope RepickCommand initializer onInit
globals
boolean CHAPTER1_STARTED = false
endglobals
private function Acts takes nothing returns nothing
local integer i = 1
local integer j = 1
local integer heroType = 0
local string heroName = ""
local player p = null
local integer pIndex = 0
if IsMultiHeroes and PLAYER_HERO_CLICKED_INDEX > 0 then
if not (udg_Heroes[PLAYER_HERO_CLICKED_INDEX]==null) then
set heroType = GetUnitTypeId(udg_Heroes[PLAYER_HERO_CLICKED_INDEX])
set heroName = GetUnitName(udg_Heroes[PLAYER_HERO_CLICKED_INDEX])
call FlushChildHashtable(udg_hash,GetHandleId(udg_Heroes[PLAYER_HERO_CLICKED_INDEX]))
call RemoveUnit(udg_Heroes[PLAYER_HERO_CLICKED_INDEX])
set udg_Heroes[PLAYER_HERO_CLICKED_INDEX] = udg_Heroes[MultiHeroesPicked]
set udg_Heroes[MultiHeroesPicked] = null
set MultiHeroesPicked = MultiHeroesPicked - 1
set p = udg_Players[1]
set PLAYER_HERO_CLICKED_INDEX = 0
set pIndex = 1
endif
endif
if not IsMultiHeroes then
loop
exitwhen i>udg_PlayerCount
if GetTriggerPlayer()==udg_Players[i] then
if not (udg_Heroes[i]==null) then
set heroType = GetUnitTypeId(udg_Heroes[i])
set heroName = GetUnitName(udg_Heroes[i])
set p = udg_Players[i]
set pIndex = i
call RemoveUnit(udg_Heroes[i])
set udg_Heroes[i] = null
endif
endif
set i = i + 1
endloop
endif
if (not (p==null)) then
//Enable repicked hero to pick for all players
loop
exitwhen j > udg_PlayerCount
call SetPlayerUnitAvailableBJ( heroType, true, udg_Players[j] )
set j = j + 1
endloop
call DisplayTextToForce( GetPlayersAll(), udg_ColorString[GetConvertedPlayerId(p)] + GetPlayerName(p) + "|r decided to repick |cff80ff80" + heroName + "|r." )
if CountPlayersInForceBJ(PLAYER_SELECTORS) == 0 then
call TimerStart(CreateTimer(),1.,true,function SelectUntil)
endif
call ForceAddPlayer(PLAYER_SELECTORS,p)
if GetLocalPlayer()==p then
call SetCameraField(CAMERA_FIELD_ZOFFSET, 0, 0.25)
endif
call SetCameraBoundsToRectForPlayerBJ(p, gg_rct_Hero_Arrival )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_DummySelect)
call CreateNUnitsAtLoc( 1, 'h007', p, udg_LeakPoint[1], bj_UNIT_FACING )
set udg_Selector[pIndex] = GetLastCreatedUnit()
call UnitAddAbility(GetLastCreatedUnit(),'Aloc')
call ShowUnitHide( GetLastCreatedUnit() )
call UnitRemoveAbility(GetLastCreatedUnit(),'Aloc')
call ShowUnitShow( GetLastCreatedUnit())
if GetLocalPlayer()==p then
call ClearSelection()
call SelectUnit(udg_Hall_of_Fame,true)
endif
else
call SimError(GetTriggerPlayer(),"Nothing to repick.")
endif
endfunction
private function Conds takes nothing returns boolean
if CHAPTER1_STARTED then
call SimError(GetTriggerPlayer(),"Too late to repick.")
endif
return not CHAPTER1_STARTED
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "-repick", true )
call TriggerRegisterPlayerChatEvent( t, Player(1), "-repick", true )
call TriggerRegisterPlayerChatEvent( t, Player(2), "-repick", true )
call TriggerRegisterPlayerChatEvent( t, Player(3), "-repick", true )
call TriggerRegisterPlayerChatEvent( t, Player(4), "-repick", true )
call TriggerRegisterPlayerChatEvent( t, Player(5), "-repick", true )
call TriggerAddCondition(t, Condition( function Conds ) )
call TriggerAddAction( t, function Acts )
endfunction
endscope
scope ResetCameraCommand initializer onInit
private function Acts takes nothing returns nothing
local integer i = 1
local player p = null
local unit hero = null
local location heroLoc = null
local location dummyLoc = null
if IsMultiHeroes and PLAYER_HERO_CLICKED_INDEX > 0 then
if not (udg_Heroes[PLAYER_HERO_CLICKED_INDEX]==null) then
set hero = udg_Heroes[PLAYER_HERO_CLICKED_INDEX]
set p = udg_Players[1]
endif
endif
if not IsMultiHeroes then
loop
exitwhen i>udg_PlayerCount
if GetTriggerPlayer()==udg_Players[i] then
if not (udg_Heroes[i]==null) then
set p = udg_Players[i]
set hero = udg_Heroes[i]
endif
endif
set i = i + 1
endloop
endif
if not (p==null) then
call SaveRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH,null)
call SaveRectHandle(udg_hash,GetHandleId(hero),UNIT_RECT_HASH,null)
set dummyLoc = Location(GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect))
set heroLoc = GetUnitLoc(hero)
call SetUnitPositionLoc(hero,dummyLoc)
call SetUnitPositionLoc(hero,heroLoc)
call RemoveLocation(dummyLoc)
call RemoveLocation(heroLoc)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "-debug camera", true )
call TriggerRegisterPlayerChatEvent( t, Player(1), "-debug camera", true )
call TriggerRegisterPlayerChatEvent( t, Player(2), "-debug camera", true )
call TriggerRegisterPlayerChatEvent( t, Player(3), "-debug camera", true )
call TriggerRegisterPlayerChatEvent( t, Player(4), "-debug camera", true )
call TriggerRegisterPlayerChatEvent( t, Player(5), "-debug camera", true )
call TriggerAddAction( t, function Acts )
endfunction
endscope
scope TestCommand1 initializer Init
private function Acts takes nothing returns nothing
local string str = GetEventPlayerChatString()
if str == "-test 1" then
call SetDestructableAnimation(gg_dest_B00M_2596,"death")
call RemoveDestructable( gg_dest_YTpc_3053 )
call RemoveDestructable( gg_dest_YTpc_3054 )
call RemoveDestructable( gg_dest_YTpc_3055 )
endif
if str == "-test 2" then
call SetDestructableAnimation(gg_dest_B00M_2596,"birth")
endif
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-test",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand2 initializer Init
private function Acts takes nothing returns nothing
local real a = 0.
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set SHADOW_ANIM_SLOW = a
call DisplayTextToForce( GetPlayersAll(), "Anim Slow Time set to: " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-st",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand3 initializer Init
private function Acts takes nothing returns nothing
local real a = 0
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set SHADOW_ANIM_PERIOD = a
call DisplayTextToForce( GetPlayersAll(), "Period Animation set to: " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-ap",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand3 initializer Init
private function Acts takes nothing returns nothing
local real a = 0
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set BARRAGE_HAND_H = a
call DisplayTextToForce( GetPlayersAll(), "BARRAGE_HAND_H: " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-ah",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand31 initializer Init
private function Acts takes nothing returns nothing
local real a = 0
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set BARRAGE_HEAD_H = a
call DisplayTextToForce( GetPlayersAll(), "BARRAGE_HEAD_H: " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-eh",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand311 initializer Init
private function Acts takes nothing returns nothing
local real a = 0
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set BARRAGE_HAND_OFFSET = a
call DisplayTextToForce( GetPlayersAll(), "BARRAGE_HAND_OFFSET : " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-ao",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand322 initializer Init
private function Acts takes nothing returns nothing
local real a = 0
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set BARRAGE_HEAD_OFFSET = a
call DisplayTextToForce( GetPlayersAll(), "BARRAGE_HEAD_OFFSET : " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-eo",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand3222 initializer Init
private function Acts takes nothing returns nothing
local real a = 0
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set BARRAGE_HAND_ANGLE = a
call DisplayTextToForce( GetPlayersAll(), "BARRAGE_HAND_ANGLE : " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-aa",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestCommand3ss initializer Init
private function Acts takes nothing returns nothing
local real a = 0
set a = S2R(SubStringBJ(GetEventPlayerChatString(), 5, 8))
set RECHARGE_H = a
call DisplayTextToForce( GetPlayersAll(), "H set to: " + R2S(a) )
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0),"-he",false)
call TriggerAddAction(t, function Acts)
set t = null
endfunction
endscope
scope TestAnim initializer onInit
private function Acts takes nothing returns nothing
local unit u = gg_unit_O00R_0145
local string str = GetEventPlayerChatString()
local integer i = -100
loop
exitwhen i > 100
if str == ("-anim " + I2S(i)) then
call SetUnitAnimationByIndex(u,i)
call BJDebugMsg("Set anim for " + GetUnitName(GetTriggerUnit()) + " to " + I2S(i))
endif
set i = i + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "-anim", false )
call TriggerAddAction( t, function Acts )
endfunction
endscope
function Trig_test_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call AdjustPlayerStateBJ( S2I(SubStringBJ(GetEventPlayerChatString(), 11, 16)), udg_Players[GetForLoopIndexA()], PLAYER_STATE_RESOURCE_GOLD )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_test takes nothing returns nothing
set gg_trg_test = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_test, Player(0), "-add gold", false )
call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction
function Trig_move_xar_Actions takes nothing returns nothing
local real x = GetDestructableX(gg_dest_B00K_4641)
local real y = GetDestructableY(gg_dest_B00K_4641)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPosition( udg_Heroes[GetForLoopIndexA()], x, y )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_xar takes nothing returns nothing
set gg_trg_move_xar = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_xar, Player(0), "-move xar", true )
call TriggerAddAction( gg_trg_move_xar, function Trig_move_xar_Actions )
endfunction
function Trig_move_0_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPositionLoc( udg_Heroes[GetForLoopIndexA()], GetRectCenter(gg_rct_Ressurect1) )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_0 takes nothing returns nothing
set gg_trg_move_0 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_0, Player(0), "-move 0", true )
call TriggerAddAction( gg_trg_move_0, function Trig_move_0_Actions )
endfunction
function Trig_move_1_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPositionLoc( udg_Heroes[GetForLoopIndexA()], GetRectCenter(gg_rct_AbyssalHeroComing) )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_1 takes nothing returns nothing
set gg_trg_move_1 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_1, Player(0), "-move 1", true )
call TriggerAddAction( gg_trg_move_1, function Trig_move_1_Actions )
endfunction
function Trig_move_2_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPositionLoc( udg_Heroes[GetForLoopIndexA()], GetRectCenter(gg_rct_MoltenCoreIN) )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_2 takes nothing returns nothing
set gg_trg_move_2 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_2, Player(0), "-move 2", true )
call TriggerAddAction( gg_trg_move_2, function Trig_move_2_Actions )
endfunction
function Trig_move_3_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPositionLoc( udg_Heroes[GetForLoopIndexA()], GetRectCenter(gg_rct_Act2Arrival) )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_3 takes nothing returns nothing
set gg_trg_move_3 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_3, Player(0), "-move 3", true )
call TriggerAddAction( gg_trg_move_3, function Trig_move_3_Actions )
endfunction
function Trig_move_4_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPositionLoc( udg_Heroes[GetForLoopIndexA()], GetRectCenter(gg_rct_ElvesStart) )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_4 takes nothing returns nothing
set gg_trg_move_4 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_4, Player(0), "-move 4", true )
call TriggerAddAction( gg_trg_move_4, function Trig_move_4_Actions )
endfunction
function Trig_move_5_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPositionLoc( udg_Heroes[GetForLoopIndexA()], GetRectCenter(gg_rct_EredarsStart) )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_5 takes nothing returns nothing
set gg_trg_move_5 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_5, Player(0), "-move 5", true )
call TriggerAddAction( gg_trg_move_5, function Trig_move_5_Actions )
endfunction
function Trig_move_6_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetUnitPositionLoc( udg_Heroes[GetForLoopIndexA()], GetRectCenter(gg_rct_IslandRespawn) )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_move_6 takes nothing returns nothing
set gg_trg_move_6 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_move_6, Player(0), "-move 6", true )
call TriggerAddAction( gg_trg_move_6, function Trig_move_6_Actions )
endfunction
function Trig_level_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = S2I(SubStringBJ(GetEventPlayerChatString(), 10, 11))
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
call SetHeroLevelBJ( udg_Heroes[GetForLoopIndexA()], ( GetHeroLevel(udg_Heroes[GetForLoopIndexA()]) + 1 ), true )
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_level takes nothing returns nothing
set gg_trg_level = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_level, Player(0), "-add lvl", false )
call TriggerAddAction( gg_trg_level, function Trig_level_Actions )
endfunction
library PlayerCameraBound
globals
integer PLAYER_RECT_HASH = 55
integer UNIT_RECT_HASH = 955
endglobals
function BoundPlayerUnitCameraToRect takes unit whichUnit, rect r, boolean PanCamera returns nothing
local unit u = whichUnit
local player p = GetOwningPlayer(u)
if IsUnitAPlayerHero(u) then
if (not (LoadRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH)==r)) or (not (LoadRectHandle(udg_hash,GetHandleId(u),UNIT_RECT_HASH)==r)) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A new CAMERA BOUND for << " + GetUnitName(u) + " >> ")
call SaveRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH,r)
call SaveRectHandle(udg_hash,GetHandleId(u),UNIT_RECT_HASH,r)
if (not IsMultiHeroes) or (IsMultiHeroes and MultiHeroesPicked>=MultiHeroesCounter) then
call SetCameraBoundsToRectForPlayerBJ( p, r )
if PanCamera then
set udg_LeakPoint[5] = GetUnitLoc(u)
call PanCameraToTimedLocForPlayer( p, udg_LeakPoint[5], 0 )
call RemoveLocation(udg_LeakPoint[5])
endif
endif
endif
endif
set u = null
set p = null
endfunction
endlibrary
library HeroSelectCameraBound initializer Init
private function Conds takes nothing returns boolean
local integer i = 1
local boolean flag = false
if IsMultiHeroes then
set flag = (MultiHeroesPicked>=MultiHeroesCounter)
else
set flag = not (udg_Heroes[LoadInteger(udg_hash,GetHandleId(GetTriggerPlayer()),PLAYER_ID_HASH)]==null)
endif
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return flag and (not IS_MULTIPLAYER)
endif
set i = i + 1
endloop
return false
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
local rect r = LoadRectHandle(udg_hash,GetHandleId(u),UNIT_RECT_HASH)
local rect playerR = LoadRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A hero << " + GetUnitName(u) + " >> clicked by <<" + GetPlayerName(p) + ">>.")
if not (r==playerR) and not(r == null) then
call SaveRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ(p,r)
set udg_LeakPoint[5] = GetUnitLoc(u)
call PanCameraToTimedLocForPlayer( p, udg_LeakPoint[5], 0 )
call RemoveLocation(udg_LeakPoint[5])
else
if r==null then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"RECT IS NULL.")
endif
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"They are in the same rect so do nothing.")
endif
set u = null
set p = null
set r = null
set playerR = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerSelectionEventBJ(t,Player(0),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(1),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(2),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(3),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(4),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(5),true)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endlibrary
scope Debug initializer onInit
private function Acts takes nothing returns nothing
local integer i = 1
//loop
//exitwhen i > udg_PlayerCount
//call SetUnitPosition(udg_Heroes[i],GetUnitX(udg_Heroes[1]),GetUnitY(udg_Heroes[1]))
//call BoundPlayerUnitCameraToRect(udg_Heroes[i],LoadRectHandle(udg_hash,GetHandleId(udg_Heroes[1]),UNIT_RECT_HASH),true)
//set i = i + 1
//endloop
call TimerStart(SUPREMUS_CHARGE_TIMER,1.,false,null)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "-debug", true )
call TriggerAddAction( t, function Acts )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BossCamera initializer onInit
private function Conds takes nothing returns boolean
return MAGMAW_BATTLE_INITIALIZED or SUPREMUS_BATTLE_INITIALIZED or EREDARS_BATTLE_INITIALIZED
endfunction
private function CondsClick takes nothing returns boolean
local integer j = 1
loop
exitwhen j > udg_PlayerCount or GetOwningPlayer(udg_Heroes[j])==GetTriggerPlayer()
set j = j + 1
endloop
return (not IsMultiHeroes) and (j <= udg_PlayerCount) and (GetTriggerUnit()==udg_Heroes[j])
endfunction
private function Acts takes nothing returns nothing
local string str = GetEventPlayerChatString()
local rect r = null
local player p = GetTriggerPlayer()
if MAGMAW_BATTLE_INITIALIZED then
set r = gg_rct_MagmawBattlefield
call SaveRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ(p,r)
set udg_LeakPoint[5] = GetUnitLoc(udg_Magmaw)
call PanCameraToTimedLocForPlayer( p, udg_LeakPoint[5], 0 )
call RemoveLocation(udg_LeakPoint[5])
endif
if SUPREMUS_BATTLE_INITIALIZED then
set r = gg_rct_AbyssalBattlefield
call SaveRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ(p,r)
set udg_LeakPoint[5] = GetUnitLoc(udg_Supremus)
call PanCameraToTimedLocForPlayer( p, udg_LeakPoint[5], 0 )
call RemoveLocation(udg_LeakPoint[5])
endif
if EREDARS_BATTLE_INITIALIZED then
set r = gg_rct_EredarBattlefield
call SaveRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ(p,r)
set udg_LeakPoint[5] = GetUnitLoc(ACTIVE_EREDAR)
call PanCameraToTimedLocForPlayer( p, udg_LeakPoint[5], 0 )
call RemoveLocation(udg_LeakPoint[5])
endif
set p = null
set r = null
endfunction
private function onClick takes nothing returns nothing
local integer j = 1
local player p = GetTriggerPlayer()
local unit u = null
local rect r = null
local rect playerR = LoadRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH)
loop
exitwhen j > udg_PlayerCount or GetOwningPlayer(udg_Heroes[j])==p
set j = j + 1
endloop
set u = udg_Heroes[j]
set r = LoadRectHandle(udg_hash,GetHandleId(u),UNIT_RECT_HASH)
if (not (r==playerR)) and not(r == null) then
call SaveRectHandle(udg_hash,GetHandleId(p),PLAYER_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ(p,r)
set udg_LeakPoint[5] = GetUnitLoc(u)
call PanCameraToTimedLocForPlayer( p, udg_LeakPoint[5], 0 )
call RemoveLocation(udg_LeakPoint[5])
endif
set u = null
set p = null
set r = null
set playerR = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterPlayerChatEvent( t, Player(0), "-bosscam", false )
call TriggerRegisterPlayerChatEvent( t, Player(1), "-bosscam", false )
call TriggerRegisterPlayerChatEvent( t, Player(2), "-bosscam", false )
call TriggerRegisterPlayerChatEvent( t, Player(3), "-bosscam", false )
call TriggerRegisterPlayerChatEvent( t, Player(4), "-bosscam", false )
call TriggerRegisterPlayerChatEvent( t, Player(5), "-bosscam", false )
call TriggerAddCondition( t, function Conds )
call TriggerAddAction( t, function Acts)
call TriggerRegisterPlayerSelectionEventBJ(t1,Player(0),true)
call TriggerRegisterPlayerSelectionEventBJ(t1,Player(1),true)
call TriggerRegisterPlayerSelectionEventBJ(t1,Player(2),true)
call TriggerRegisterPlayerSelectionEventBJ(t1,Player(3),true)
call TriggerRegisterPlayerSelectionEventBJ(t1,Player(4),true)
call TriggerRegisterPlayerSelectionEventBJ(t1,Player(5),true)
call TriggerAddCondition( t1, function CondsClick)
call TriggerAddAction( t1, function onClick )
set t = null
set t = null
endfunction
endlibrary
scope Chapter1Bounds initializer onInit
globals
group CHAPTER_ONE_GROUP = CreateGroup()
endglobals
private function HeroesOnly takes nothing returns boolean
local integer i = 1
if not (GetUnitAbilityLevel(GetTriggerUnit(),'Aloc')>0) then
call GroupAddUnit(CHAPTER_ONE_GROUP,GetTriggerUnit())
endif
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return not RectContainsUnit( gg_rct_MoltenCoreBOUNDS, GetTriggerUnit())
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r = gg_rct_StartBOUNDS
call BoundPlayerUnitCameraToRect(u,r,true)
set u = null
set r = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_StartBOUNDS )
call TriggerAddCondition( t, function HeroesOnly )
call TriggerAddAction( t, function onEnter )
endfunction
endscope
scope Chapter2Bounds initializer onInit
private function HeroesOnly takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r = gg_rct_Act2BOUNDS
call BoundPlayerUnitCameraToRect(u,r,true)
set u = null
set r = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_Act2BOUNDS )
call TriggerAddCondition( t, function HeroesOnly )
call TriggerAddAction( t, function onEnter )
endfunction
endscope
scope Chapter3Bounds initializer onInit
private function HeroesOnly takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r = gg_rct_Act3BOUNDS
call BoundPlayerUnitCameraToRect(u,r,true)
set u = null
set r = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_Act3BOUNDS )
call TriggerAddCondition( t, function HeroesOnly )
call TriggerAddAction( t, function onEnter )
endfunction
endscope
scope MoltenCoreBounds initializer onInit
private function HeroesOnly takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r = gg_rct_MoltenCoreBOUNDS
call BoundPlayerUnitCameraToRect(u,r,true)
set u = null
set r = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_MoltenCoreBOUNDS )
call TriggerAddCondition( t, function HeroesOnly )
call TriggerAddAction( t, function onEnter )
endfunction
endscope
scope StoneCoreBounds initializer onInit
private function HeroesOnly takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r = gg_rct_StoneCoreBOUNDS
call BoundPlayerUnitCameraToRect(u,r,true)
set u = null
set r = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_StoneCoreBOUNDS )
call TriggerAddCondition( t, function HeroesOnly )
call TriggerAddAction( t, function onEnter )
endfunction
endscope
scope EredarsBounds initializer onInit
private function HeroesOnly takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r = gg_rct_EredarsBounds
call BoundPlayerUnitCameraToRect(u,r,true)
set u = null
set r = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_EredarVision )
call TriggerAddCondition( t, function HeroesOnly )
call TriggerAddAction( t, function onEnter )
endfunction
endscope
scope IslandBounds initializer onInit
private function HeroesOnly takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r = gg_rct_IslandBounds
call BoundPlayerUnitCameraToRect(u,r,true)
set u = null
set r = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_IslandEnter )
call TriggerAddCondition( t, function HeroesOnly )
call TriggerAddAction( t, function onEnter )
endfunction
endscope
library PlayerMouseEvent initializer onInit
globals
private constant integer PLAYER_MOUSE_X_HASH = 50
private constant integer PLAYER_MOUSE_Y_HASH = 51
endglobals
function GetPlayerMouseX takes player whichPlayer returns real
return LoadReal(udg_hash,GetHandleId(whichPlayer),PLAYER_MOUSE_X_HASH)
endfunction
function GetPlayerMouseY takes player whichPlayer returns real
return LoadReal(udg_hash,GetHandleId(whichPlayer),PLAYER_MOUSE_Y_HASH)
endfunction
private function onMouseEvent takes nothing returns nothing
local real x = BlzGetTriggerPlayerMouseX()
local real y = BlzGetTriggerPlayerMouseY()
local player p = GetTriggerPlayer()
//call DisplayTimedTextToPlayer(Player(0),0,0,15.,"Mouse Moved to: (" + R2S(x)+","+R2S(y)+")")
call SaveReal(udg_hash,GetHandleId(p),PLAYER_MOUSE_X_HASH, x)
call SaveReal(udg_hash,GetHandleId(p),PLAYER_MOUSE_Y_HASH, y)
set p = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local integer j = 0
loop
exitwhen j>5
call TriggerRegisterPlayerMouseEventBJ( t, Player(j), bj_MOUSEEVENTTYPE_MOVE )
set j = j + 1
endloop
call TriggerAddAction( t, function onMouseEvent )
set t = null
endfunction
endlibrary
library HeroInitializer
globals
string array HERO_INFO_BASE
string array HERO_INFO_I1
string array HERO_INFO_I2
string array HERO_INFO_T
string array HERO_ENERGY
integer array HERO_WALK_INDEX[11]
integer HERO_ICON_HASH = 98
endglobals
function GetHeroClass takes unit whichUnit returns string
local integer i = 1
loop
exitwhen i > udg_HeroCount
if GetUnitTypeId(whichUnit)==udg_Hero[i] then
return udg_HeroClass[i]
endif
set i = i + 1
endloop
return ""
endfunction
function GetHeroEnergy takes unit whichUnit returns string
local integer i = 1
loop
exitwhen i > udg_HeroCount
if GetUnitTypeId(whichUnit)==udg_Hero[i] then
return HERO_ENERGY[i]
endif
set i = i + 1
endloop
return ""
endfunction
function Trig_Hero_ini_Actions takes nothing returns nothing
set udg_HeroCount = 12
set udg_Hero[1] = 'O002'
set udg_Hero[2] = 'H00A'
set udg_Hero[3] = 'O008'
set udg_Hero[4] = 'O003'
set udg_Hero[5] = 'O006'
set udg_Hero[6] = 'O005'
set udg_Hero[7] = 'H01C'
set udg_Hero[8] = 'H00O'
set udg_Hero[9] = 'H01I'
set udg_Hero[10] = 'H03J'
set udg_Hero[11] = 'O00C'
set udg_Hero[12] = 'O00R'
set HERO_WALK_INDEX[1] = 6
set HERO_WALK_INDEX[2] = 6
set HERO_WALK_INDEX[3] = 2
set HERO_WALK_INDEX[4] = 7
set HERO_WALK_INDEX[5] = 8
set HERO_WALK_INDEX[6] = 6
set HERO_WALK_INDEX[7] = 11
set HERO_WALK_INDEX[8] = 8
set HERO_WALK_INDEX[9] = 8
set HERO_WALK_INDEX[10] = 2
set HERO_WALK_INDEX[11] = 2
set HERO_WALK_INDEX[12] = 8
set udg_HeroIcon[1] = "ReplaceableTextures\\CommandButtons\\BTNHeroBlademaster.blp"
set udg_HeroIcon[2] = "ReplaceableTextures\\CommandButtons\\BTNJaina.blp"
set udg_HeroIcon[3] = "ReplaceableTextures\\CommandButtons\\BTNTauren.blp"
set udg_HeroIcon[4] = "ReplaceableTextures\\CommandButtons\\BTNShaman.blp"
set udg_HeroIcon[5] = "ReplaceableTextures\\CommandButtons\\BTNDruidOfTheClaw.blp"
set udg_HeroIcon[6] = "ReplaceableTextures\\CommandButtons\\BTNTheCaptain.blp"
set udg_HeroIcon[7] = "ReplaceableTextures\\CommandButtons\\BTNHeroDeathKnight.blp"
set udg_HeroIcon[8] = "ReplaceableTextures\\CommandButtons\\BTNSylvanusWindrunner.blp"
set udg_HeroIcon[9] = "ReplaceableTextures\\CommandButtons\\BTNChaplain.blp"
set udg_HeroIcon[10] = "ReplaceableTextures\\CommandButtons\\BTNHeretic.blp"
set udg_HeroIcon[11] = "ReplaceableTextures\\CommandButtons\\BTNDranaiAkama.blp"
set udg_HeroIcon[12] = "ReplaceableTextures\\CommandButtons\\BTNSiegeGolem.blp"
set udg_HeroClass[1] = "Damage Dealer"
set udg_HeroClass[2] = "Mage"
set udg_HeroClass[3] = "Mage"
set udg_HeroClass[4] = "Healer"
set udg_HeroClass[5] = "Healer"
set udg_HeroClass[6] = "Tanker"
set udg_HeroClass[7] = "Tanker"
set udg_HeroClass[8] = "Damage Dealer"
set udg_HeroClass[9] = "Healer"
set udg_HeroClass[10] = "Mage"
set udg_HeroClass[11] = "Damage Dealer"
set udg_HeroClass[12] = "Tanker"
set HERO_ENERGY[1] = "Rage"
set HERO_ENERGY[2] = "Mana"
set HERO_ENERGY[3] = "Mana"
set HERO_ENERGY[4] = "Mana"
set HERO_ENERGY[5] = "Mana"
set HERO_ENERGY[6] = "Rage"
set HERO_ENERGY[7] = "Runes"
set HERO_ENERGY[8] = "Focus"
set HERO_ENERGY[9] = "Mana"
set HERO_ENERGY[10] = "Mana"
set HERO_ENERGY[11] = "Combo"
set HERO_ENERGY[12] = "Charge"
set HERO_INFO_BASE[1] = "Your hero: |cff80ff80Horde Champion|r.\n\nHe specializes in dealing physical damage with his abilities as well as with attacks. Hero's energy is |cffc40000Rage|r, which is replenished in combat."
set HERO_INFO_I1[1] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Steel Sword|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Axe of Mayhem|r with |c00FF0303Berserker's Rage|r or |c00540081Corruption|r glyphs; |c007EBFF1Adamantite Dagger|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_I2[1] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Field Plate Armor|r with |c00FF0303Berserker's Rage|r glyph."
set HERO_INFO_T[1] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r and |c007EBFF1Elixir of Deadly Strikes|r, which may help you in difficult situations."
set HERO_INFO_BASE[2] = "Your hero: |cff80ff80Sorceress|r.\n\nShe specializes in dealing elemental damage with her spells."
set HERO_INFO_I1[2] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Mage's Scepter|r with |c000042FFDeep Freeze|r glyph; |c007EBFF1Iron-Bound Tome|r with |c00FF0303Berserker's Rage|r glyph."
set HERO_INFO_I2[2] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Broken Ring|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Coldwraith Plate|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_T[2] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r, |c007EBFF1Flask of Mana|r and |c007EBFF1Elixir of the Frost Wyrm|r, which may help you in difficult situations. Try to evade getting unnecessary damage."
set HERO_INFO_BASE[3] = "Your hero: |cff80ff80Stonebreaker|r.\n\nHe specializes in dealing elemental damage with his spells."
set HERO_INFO_I1[3] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Mage's Scepter|r with |c000042FFDeep Freeze|r glyph; |c007EBFF1Iron-Bound Tome|r with |c00FF0303Berserker's Rage|r glyph."
set HERO_INFO_I2[3] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Broken Ring|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Coldwraith Plate|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_T[3] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r, |c007EBFF1Flask of Mana|r and |c007EBFF1Elixir of the Frost Wyrm|r, which may help you in difficult situations. Try to evade getting unnecessary damage."
set HERO_INFO_BASE[4] = "Your hero: |cff80ff80Tribal Shaman|r.\n\nHe specializes in healing injured allies with direct and periodic healing spells, restoring their mana with |cff8080ffMana Totem|r and improving their combat abilities with |cff8080ffHeroism|r."
set HERO_INFO_I1[4] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Mage's Scepter|r with |c0020C000Tiger's Fury|r glyph; |c007EBFF1Iron-Bound Tome|r with |c0020C000Tiger's Fury|r glyph."
set HERO_INFO_I2[4] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Broken Ring|r with |c0020C000Tiger's Fury|r glyph; |c007EBFF1Helm of Kings|r with |c0020C000Tiger's Fury|r glyph."
set HERO_INFO_T[4] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r, |c007EBFF1Flask of Mana|r and |c007EBFF1Elixir of the Frost Wyrm|r, which may help you in difficult situations. Try to evade getting unnecessary damage."
set HERO_INFO_BASE[5] = "Your hero: |cff80ff80Druid of the Grove|r.\n\nHe specializes in healing injured allies with periodic healing spells, improving their combat abilities with |cff8080ffMark of the Wild|r."
set HERO_INFO_I1[5] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Mage's Scepter|r with |c0020C000Tiger's Fury|r glyph; |c007EBFF1Iron-Bound Tome|r with |c0020C000Tiger's Fury|r glyph."
set HERO_INFO_I2[5] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Broken Ring|r with |c0020C000Tiger's Fury|r glyph; |c007EBFF1Helm of Kings|r with |c0020C000Tiger's Fury|r glyph."
set HERO_INFO_T[5] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r, |c007EBFF1Flask of Mana|r and |c007EBFF1Elixir of the Frost Wyrm|r, which may help you in difficult situations. Try to evade getting unnecessary damage."
set HERO_INFO_BASE[6] = "Your hero: |cff80ff80Blodelf Captain|r.\n\nHe specializes in protecting his allies, provoking enemies to attack himself and dealing physical damage with his abilities. Hero's energy is |cffc40000Rage|r, which is replenished in combat."
set HERO_INFO_I1[6] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Wooden Shield|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Field Plate Armor|r with |c00540081Corruption|r glyph; |c007EBFF1Runed Gloves|r with |c00540081Corruption|r glyph; |c007EBFF1Helm of Kings|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_I2[6] = "|cff80ff80Appropriate weapon items|r:\n|c007EBFF1Axe of Mayhem|r with |c00540081Corruption|r glyph."
set HERO_INFO_T[6] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r and |c007EBFF1Elixir of Deep Earth|r, which may help you in difficult situations. Use |cff8080ffTaunt|r to take off enemy creeps from your party members."
set HERO_INFO_BASE[7] = "Your hero: |cff80ff80Death Knight|r.\n\nHe specializes in protecting his allies, provoking enemies to attack himself; dealing frost damage with his abilities; healing himself with |cff8080ffFrostmourne|r. Hero's energy is |cff6f2583Runes|r, which is replenished by the strikes with |cff8080ffFrostmourne|r and spend to improve the next spell."
set HERO_INFO_I1[7] = "|cff80ff80Appropriate weapon items|r:\n|c007EBFF1Axe of Mayhem|r with |c00540081Corruption|r glyph; |c007EBFF1Adamantite Dagger|r with |c00540081Corruption|r glyph; |c007EBFF1Steel Sword|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_I2[7] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Field Plate Armor|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Helm of Kings|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_T[7] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r and |c007EBFF1Elixir of the Frost Wyrm|r, which may help you in difficult situations. Use |cff8080ffDeath Grip|r to take off enemy creeps from your party members."
set HERO_INFO_BASE[8] = "Your hero: |cff80ff80Ranger of the Silver Covenant|r.\n\nShe specializes in dealing physical and magical damage with his abilities and the wolf companion. Hero's energy is |cffffff00Focus|r, which is replenished with time or with each |cff8080ffCobra Shot|r."
set HERO_INFO_I1[8] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Steel Sword|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Adamantite Dagger|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Axe of Mayhem|r with |c00FF0303Berserker's Rage|r or |c00540081Corruption|r glyphs."
set HERO_INFO_I2[8] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Field Plate Armor|r with |c00FF0303Berserker's Rage|r glyph. "
set HERO_INFO_T[8] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r and |c007EBFF1Elixir of Deadly Strikes|r, which may help you in difficult situations."
set HERO_INFO_BASE[9] = "Your hero: |cff80ff80Priest|r.\n\nHe specializes in healing injured allies with direct healing spells and protecting them with magical shields."
set HERO_INFO_I1[9] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Mage's Scepter|r with |c0020C000Tiger's Fury|r glyph; |c007EBFF1Iron-Bound Tome|r with |c0020C000Tiger's Fury|r glyph."
set HERO_INFO_I2[9] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Broken Ring|r with |c000042FFDeep Freeze|r glyph; |c007EBFF1Helm of Kings|r with |c0020C000Tiger's Fury|r glyph."
set HERO_INFO_T[9] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r, |c007EBFF1Flask of Mana|r and |c007EBFF1Elixir of the Frost Wyrm|r, which may help you in difficult situations. Try to evade getting unnecessary damage."
set HERO_INFO_BASE[10] = "Your hero: |cff80ff80Eretic|r.\n\nShe specializes in dealing death damage with his spells."
set HERO_INFO_I1[10] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Mage's Scepter|r with |c000042FFDeep Freeze|r glyph; |c007EBFF1Iron-Bound Tome|r with |c00540081Corruption|r glyph."
set HERO_INFO_I2[10] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Broken Ring|r with |c000042FFDeep Freeze|r glyph; |c007EBFF1Coldwraith Plate|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_T[10] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r, |c007EBFF1Flask of Mana|r and |c007EBFF1Elixir of the Frost Wyrm|r, which may help you in difficult situations. Try to evade getting unnecessary damage."
set HERO_INFO_BASE[11] = "Your hero: |cff80ff80Draenei Warlord|r.\n\nHe specializes in dealing physical damage with his abilities as well as with attacks. Hero's energy is |cffc40000Combo Points|r, which can be replenished from basic attack or Nether Bomb depending on target's Combo level. Target's Combo level is increased from normal attacks, hero's abilities, critical strikes and haste procs."
set HERO_INFO_I1[11] = "|cff80ff80Appropriate weapon items|r:\n |c007EBFF1Steel Sword|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Axe of Mayhem|r with |c00FF0303Berserker's Rage|r or |c00540081Corruption|r glyphs; |c007EBFF1Adamantite Dagger|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_I2[11] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Field Plate Armor|r with |c00FF0303Berserker's Rage|r glyph."
set HERO_INFO_T[11] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r and |c007EBFF1Elixir of Deadly Strikes|r, which may help you in difficult situations."
set HERO_INFO_BASE[12] = "Your hero: |cff80ff80Iron Golem|r.\n\nHe specializes in protecting his allies, provoking enemies to attack himself and dealing physical or magical damage with his abilities. Hero's energy is |cff00ffffCharge|r, which is replenished with time or on the use of Overcharge ability."
set HERO_INFO_I1[12] = "|cff80ff80Appropriate armor items|r:\n |c007EBFF1Field Plate Armor|r with |c00FF0303Berserker's Rage|r glyph; |c007EBFF1Helm of Kings|r with |c000042FFDeep Freeze|r glyph."
set HERO_INFO_I2[12] = "|cff80ff80Appropriate weapon items|r:\n|c007EBFF1Steel Sword|r with |c00540081Corruption|r glyph."
set HERO_INFO_T[12] = "|cff80ff80Gameplay tips:|r\n Do not hesitate to have some |c007EBFF1Flask of Healing|r and |c007EBFF1Elixir of Deep Earth|r, which may help you in difficult situations. Use |cff8080ffGround Slam|r to take off enemy creeps from your party members."
endfunction
//===========================================================================
function InitTrig_Hero_ini takes nothing returns nothing
set gg_trg_Hero_ini = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Hero_ini, 0.00 )
call TriggerAddAction( gg_trg_Hero_ini, function Trig_Hero_ini_Actions )
endfunction
endlibrary
library HeroPick initializer onInit requires LittleMultiboard, GamePreload
private function Conds takes nothing returns boolean
return IsUnitType(GetSoldUnit(), UNIT_TYPE_HERO)
endfunction
private function iniStats takes unit hero returns nothing
local integer k = GetRandomInt(1,3)
//Sorceress
if GetUnitTypeId(hero)=='H00A' then
call SorceressUnlearnTalents(null)
//Spell Crit
call SaveReal(udg_hash,GetHandleId(hero),GetSpellCritHash(),6.)
//SpellPower
call SaveReal(udg_hash,GetHandleId(hero),GetSpellPowerHash(),75.)
call SaveReal(udg_hash,GetHandleId(hero),GetSpellCritMultiplierHash(),-0.2)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_JainaPissed3, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_JainaPissed5, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_JainaWhat1, 100, hero )
endif
endif
//Stonebreaker
if GetUnitTypeId(hero)=='O008' then
call StonebreakerUnlearnTalents(null)
//Spell Crit
call SaveReal(udg_hash,GetHandleId(hero),GetSpellCritHash(),7.)
//SpellPower
call SaveReal(udg_hash,GetHandleId(hero),GetSpellPowerHash(),50.)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),'A01F',true)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_TaurenPissed2, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_TaurenPissed6, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_TaurenReady1, 100, hero )
endif
endif
//Bloodelf Captain
if GetUnitTypeId(hero)=='O005' then
call BloodElfCaptainUnlearnTalents(null)
//
call SaveReal(udg_hash,GetHandleId(hero),GetEnergyRegenBonusHash(),1.)
//Block chance
call SaveReal(udg_hash,GetHandleId(hero),14,10.)
//Block ammount
call SaveReal(udg_hash,GetHandleId(hero),3,50.)
//Aggro multiplier
call SaveReal(udg_hash,GetHandleId(hero),29,10.)
call SaveUnitHandle(udg_hash,GetHandleId(BLOODELF_CAPTAIN_TOOLTIPTIMER),1,hero)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_CaptainYes3, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_CaptainYes3, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_CaptainWarcry1, 100, hero )
endif
endif
//HordeChampion
if GetUnitTypeId(hero)=='O002' then
call HordeChampionUnlearnTalents(null)
//Crit
call SaveReal(udg_hash,GetHandleId(hero),2,4.)
//Haste
call SaveReal(udg_hash,GetHandleId(hero),GetHasteHash(),10.)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_HeroBladeMasterWarcry1, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_HeroBladeMasterPissed3, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_HeroBladeMasterPissed2, 100, hero )
endif
endif
//Death Knight
if GetUnitTypeId(hero)=='H01C' then
call DeathKnightUnlearnTalents(null)
//SpellPower
call SaveReal(udg_hash,GetHandleId(hero),GetSpellPowerHash(),100.)
//Aggro multiplier
call SaveReal(udg_hash,GetHandleId(hero),29,8.)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_DeathKnightPissed2, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_DeathKnightReady1, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_DeathKnightPissed6, 100, hero )
endif
endif
//Tribal Shaman
if GetUnitTypeId(hero)=='O003' then
call ShamanUnlearnTalents(null)
call UnitAddType(hero,UNIT_TYPE_PEON)
//Healing done
call SaveReal(udg_hash,GetHandleId(hero),11,0.1)
//Allow abilities (if restarted)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),'A010',true)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),'A00Z',true)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),'A026',true)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),'A012',true)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),FURY_SWIPES_WOLF_ABILCODE, false)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_ShamanPissed3, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_ShamanReady1, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_ShamanWarcry1, 100, hero )
endif
endif
//Druid of the Grove
if GetUnitTypeId(hero)=='O006' then
call DruidUnlearnTalents(null)
call UnitAddType(hero,UNIT_TYPE_PEON)
//Healing done
call SaveReal(udg_hash,GetHandleId(hero),11,0.1)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),MONSOON_ABILCODE, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),REBIRTH_ABILCODE, true)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_DruidOfTheClawReady1, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_DruidOfTheClawWarcry1, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_DruidOfTheClawPissed3, 100, hero )
endif
endif
//Ranger
if GetUnitTypeId(hero)=='H00O' then
call RangerUnlearnTalents(null)
call SaveReal(udg_hash,GetHandleId(hero),GetEvasionHash(),10.)
call SaveReal(udg_hash,GetHandleId(hero),GetCritHash(),5.)
call SaveReal(udg_hash,GetHandleId(hero),GetHasteHash(),5.)
//Allow abilities (if restarted)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),'A040',true)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),'A049',false)
set COBRA_SHOT_USER = hero
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_SylvanasPissed1, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_SylvanasPissed2, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_SylvanasPissed3, 100, hero )
endif
call SaveUnitHandle(udg_hash,GetHandleId(RANGER_CONCENTRATION_TIMER),1,hero)
call TimerStart(RANGER_CONCENTRATION_TIMER,0.0,false,null)
endif
//Priest
if GetUnitTypeId(hero)=='H01I' then
call PriestUnlearnTalents(null)
//Spell Crit
call SaveReal(udg_hash,GetHandleId(hero),GetSpellCritHash(),7.)
//SpellPower
call SaveReal(udg_hash,GetHandleId(hero),GetSpellPowerHash(),50.)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_PriestReady1, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_PriestWhat3, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_PriestPissed4, 100, hero )
endif
endif
//Eretic
if GetUnitTypeId(hero)=='H03J' then
call EreticUnlearnTalents(null)
//Spell Crit
call SaveReal(udg_hash,GetHandleId(hero),GetSpellCritHash(),8.)
//SpellPower
call SaveReal(udg_hash,GetHandleId(hero),GetSpellPowerHash(),40.)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_AcolytePissed1, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_AcolytePissed2, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_AcolytePissed3, 100, hero )
endif
endif
//Akama
if GetUnitTypeId(hero)=='O00C' then
call AkamaUnlearnTalents(null)
//Crit
call SaveReal(udg_hash,GetHandleId(hero),2,5.)
//Haste
call SaveReal(udg_hash,GetHandleId(hero),GetHasteHash(),15.)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_AkamaWhat4, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_AkamaYesAttack1, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_AkamaPissed6, 100, hero )
endif
endif
//Iron Golem
if GetUnitTypeId(hero)=='O00R' then
call IronGolemUnlearnTalents(null)
//SpellPower
call SaveReal(udg_hash,GetHandleId(hero),GetSpellPowerHash(),50.)
//Aggro multiplier
call SaveReal(udg_hash,GetHandleId(hero),29,8.)
call SaveReal(udg_hash,GetHandleId(hero),GetCritMultiplierHash(),-0.25)
call SaveReal(udg_hash,GetHandleId(hero),GetSpellCritMultiplierHash(),-0.25)
if k == 1 then
call PlaySoundOnUnitBJ( gg_snd_RockGolemWhat2, 100, hero )
endif
if k == 2 then
call PlaySoundOnUnitBJ( gg_snd_RockGolemYesAttack1, 100, hero )
endif
if k == 3 then
call PlaySoundOnUnitBJ( gg_snd_RockGolemYesAttack2, 100, hero )
endif
endif
endfunction
private function onPick takes nothing returns nothing
local integer i = 1
local integer j = 1
local integer iEND = udg_PlayerCount
local integer jEND = udg_HeroCount
local integer k = 1
call TurnWeatherEffectsForPlayer(GetOwningPlayer(GetSoldUnit()),false)
if GetLocalPlayer() == GetOwningPlayer(GetSoldUnit()) then
call SetCameraField(CAMERA_FIELD_ZOFFSET, 200., 0.25)
endif
call MAKE_UNIT_COMBAT(GetSoldUnit())
call FlushChildHashtable(udg_hash,GetHandleId(GetSoldUnit()))
if CURRENT_DIFFICULTY <= 2 then
call ModifyHeroSkillPoints( GetSoldUnit(), bj_MODIFYMETHOD_ADD, 4 - CURRENT_DIFFICULTY )
else
call ModifyHeroSkillPoints( GetSoldUnit(), bj_MODIFYMETHOD_ADD, 1 )
endif
if IsMultiHeroes then
set MultiHeroesPicked = MultiHeroesPicked + 1
set udg_PlayerCount = MultiHeroesPicked
set udg_Players[MultiHeroesPicked] = udg_Players[1]
endif
if IsMultiHeroes then
set i = MultiHeroesPicked
set iEND = MultiHeroesPicked
endif
loop
exitwhen i > iEND
//Checking which Player picked the hero
if GetOwningPlayer(GetSoldUnit()) == udg_Players[i] then
set udg_Heroes[i] = GetSoldUnit()
call InitializeMultiboard(i)
call RemoveUnit( udg_Selector[i] )
//Searching which hero is picked and initializing multiboards
set j = 1
loop
exitwhen j > jEND
if GetUnitTypeId(udg_Heroes[i]) == udg_Hero[j] then
call MultiboardSetItemIconBJ( udg_NBoard[i], 1, 1, udg_HeroIcon[j] )
call MultiboardSetItemIconBJ( udg_MBoard[i], 1, 1, udg_HeroIcon[j] )
set k = 1
loop
exitwhen k > udg_PlayerCount and k > MultiHeroesCounter
call MultiboardSetItemIconBJ( udg_ABoard[k], 1, i, udg_HeroIcon[j] )
set k = k + 1
endloop
call SaveStr(udg_hash,GetHandleId(GetSoldUnit()),HERO_ICON_HASH,udg_HeroIcon[j])
call ShowMboard(udg_Players[i],udg_MBoard[i], true)
call SaveBoolean(udg_hash,GetHandleId(udg_Players[i]),SHOW_STATS_SHOWED,true)
call SaveStr(udg_hash,GetHandleId(GetSoldUnit()),30,udg_HeroClass[j])
//Give the hero base stats
call iniStats(udg_Heroes[i])
endif
set j = j + 1
endloop
endif
set i = i + 1
endloop
set udg_LeakPoint[1] = GetRectCenter(gg_rct_Hero_Arrival)
call SetUnitPositionLoc( GetSoldUnit(), udg_LeakPoint[1] )
//call TriggerRegisterUnitEvent(HERO_NO_ATTACK_TRIGGER,GetSoldUnit(),EVENT_UNIT_ISSUED_TARGET_ORDER)
call ForceRemovePlayer(PLAYER_SELECTORS,GetOwningPlayer(GetSoldUnit()))
call SelectUnitForPlayerSingle( GetSoldUnit(), GetOwningPlayer(GetSoldUnit()) )
call RemoveLocation(udg_LeakPoint[1])
call SaveInteger(udg_hash,GetHandleId(GetSoldUnit()),100,1)
set i = 1
set iEND = udg_PlayerCount
//Disabling sold hero to pick for other players
loop
exitwhen i > iEND
call SetPlayerUnitAvailableBJ( GetUnitTypeId(GetSoldUnit()), false, udg_Players[i] )
set i = i + 1
endloop
if IsMultiHeroes and MultiHeroesCounter > MultiHeroesPicked then
call ClearSelection()
call SelectUnit(udg_Hall_of_Fame,true)
call ForceAddPlayer(PLAYER_SELECTORS,udg_Players[1])
call TimerStart(CreateTimer(),1.,true,function SelectUntil)
set udg_LeakPoint[1] = GetRectCenter(gg_rct_DummySelect)
call CreateNUnitsAtLoc( 1, 'h007', udg_Players[1], udg_LeakPoint[1], bj_UNIT_FACING )
set udg_Selector[1] = GetLastCreatedUnit()
call UnitAddAbility(GetLastCreatedUnit(),'Aloc')
call ShowUnitHide( GetLastCreatedUnit() )
call UnitRemoveAbility(GetLastCreatedUnit(),'Aloc')
call ShowUnitShow( GetLastCreatedUnit() )
endif
call AddHeroUnitsToPreloadQueue(GetSoldUnit())
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SELL )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onPick )
set t = null
endfunction
endlibrary
scope HeroLevelUp initializer onInit
private function Acts takes nothing returns nothing
local unit u = GetTriggerUnit()
if CURRENT_DIFFICULTY <= 2 and not (GetOwningPlayer(u)==INVADERS) then //Healing only for Easy and Normal difficulties
call SetUnitLifePercentBJ( GetTriggerUnit(), 100 )
call SetUnitManaPercentBJ( GetTriggerUnit(), 100 )
endif
call ModifyHeroSkillPoints( GetTriggerUnit(), bj_MODIFYMETHOD_ADD, 1 )
if GetHeroClass(GetTriggerUnit())=="Healer" or GetHeroClass(GetTriggerUnit())=="Mage" then
call UnitAddAbility(GetTriggerUnit(),'A02G')
call SetUnitAbilityLevel(GetTriggerUnit(),'A02G',2)
call UnitRemoveAbility(GetTriggerUnit(),'A02G')
call UnitAddAbility(GetTriggerUnit(),'A01V')
call SetUnitAbilityLevel(GetTriggerUnit(),'A01V',2)
call UnitRemoveAbility(GetTriggerUnit(),'A01V')
endif
//Sorceress
if GetUnitTypeId(u)=='H00A' then
//Spell Resist
call SaveReal(udg_hash,GetHandleId(u),16,LoadReal(udg_hash,GetHandleId(u),16) + 0.03)
//Spell Power
call SaveReal(udg_hash,GetHandleId(u),5,LoadReal(udg_hash,GetHandleId(u),5) + 10)
endif
//Stonebreaker
if GetUnitTypeId(u)=='O008' then
//Spell Crit
call SaveReal(udg_hash,GetHandleId(u),2,LoadReal(udg_hash,GetHandleId(u),GetSpellCritHash()) + 1.)
//Spell Power
call SaveReal(udg_hash,GetHandleId(u),5,LoadReal(udg_hash,GetHandleId(u),5) + 10)
endif
//Bloodelf Captain
if GetUnitTypeId(u)=='O005' then
//Block amount
call SaveReal(udg_hash,GetHandleId(u),3,LoadReal(udg_hash,GetHandleId(u),3) + 15)
//Block chance
call SaveReal(udg_hash,GetHandleId(u),14,LoadReal(udg_hash,GetHandleId(u),14) + 2.)
//Aggro multiplier
//call SaveReal(udg_hash,GetHandleId(u),GetAggroMultiplierHash(),LoadReal(udg_hash,GetHandleId(u),GetAggroMultiplierHash()) + 1.)
endif
//HordeChampion
if GetUnitTypeId(u)=='O002' then
//Haste
call SaveReal(udg_hash,GetHandleId(u),4,LoadReal(udg_hash,GetHandleId(u),4) + 1.5)
//Splash
call SaveReal(udg_hash,GetHandleId(u),7,LoadReal(udg_hash,GetHandleId(u),7) + 0.03)
endif
//Death Knight
if GetUnitTypeId(u)=='H01C' then
//SpellPower
call SaveReal(udg_hash,GetHandleId(u),5,LoadReal(udg_hash,GetHandleId(u),5) + 15)
//Healing done
call SaveReal(udg_hash,GetHandleId(u),11,LoadReal(udg_hash,GetHandleId(u),11) + 0.02)
endif
//Ranger
if GetUnitTypeId(u)=='H00O' then
call SaveReal(udg_hash,GetHandleId(u),GetEvasionHash(),LoadReal(udg_hash,GetHandleId(u),GetEvasionHash())+2.)
call SaveReal(udg_hash,GetHandleId(u),GetCritHash(), LoadReal(udg_hash,GetHandleId(u),GetCritHash())+0.5)
call SaveReal(udg_hash,GetHandleId(u),GetHasteHash(),LoadReal(udg_hash,GetHandleId(u),GetHasteHash())+0.5)
endif
//Heretic
if GetUnitTypeId(u)=='H03J' then
//Damage from DOTS
call SaveReal(udg_hash,GetHandleId(u),GetPeriodicDamageBonusHash(),LoadReal(udg_hash,GetHandleId(u),GetPeriodicDamageBonusHash()) + 0.03)
//Spell Power
call SaveReal(udg_hash,GetHandleId(u),5,LoadReal(udg_hash,GetHandleId(u),5) + 10)
endif
//Akama
if GetUnitTypeId(u)=='H00O' then
call SaveReal(udg_hash,GetHandleId(u),GetCritHash(), LoadReal(udg_hash,GetHandleId(u),GetCritHash())+1.)
call SaveReal(udg_hash,GetHandleId(u),GetHasteHash(),LoadReal(udg_hash,GetHandleId(u),GetHasteHash())+1.)
endif
//Iron Golem
if GetUnitTypeId(u)=='O00R' then
//SpellPower
call SaveReal(udg_hash,GetHandleId(u),5,LoadReal(udg_hash,GetHandleId(u),5) + 10)
endif
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddAction( t, function Acts )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function HeroExpirience_Conds takes nothing returns boolean
return IsUnitAlly(GetKillingUnit(),Player(6)) and GetUnitAbilityLevel(GetTriggerUnit(),'Aloc') <= 0
endfunction
function HeroExpirience_Acts takes nothing returns nothing
local real exp = GetUnitLevel(GetTriggerUnit())*GetRandomReal(10.,15.)
local real exptarget = exp / I2R(udg_PlayersInGame)
local integer i = 1
//Check if unit can give exp
if not LoadBoolean(udg_hash,GetHandleId(GetTriggerUnit()),311) then
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) then
set exptarget = 1000.
endif
loop
exitwhen i>udg_PlayerCount
call AddHeroXP(udg_Heroes[i], R2I(exptarget), true)
set i = i + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_HeroExperience takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent( t,Player(7), EVENT_PLAYER_UNIT_DEATH, null )
call TriggerAddCondition(t,Condition(function HeroExpirience_Conds))
call TriggerAddAction( t, function HeroExpirience_Acts )
set t = null
endfunction
scope HeroTalents initializer onInit
globals
private constant integer CRITICAL_STRIKE_ABILCODE = 'A01L'
private constant real CRITICAL_STRIKE_PER_LEVEL = 1.
private constant integer BLOCK_CHANCE_ABILCODE = 'A01M'
private constant real BLOCK_CHANCE_PER_LEVEL = 1.
private constant integer SPELL_POWER_ABILCODE = 'A01N'
private constant real SPELL_POWER_PER_LEVEL = 25.
private constant integer HEALING_DONE_ABILCODE = 'A01O'
private constant real HEALING_DONE_PER_LEVEL = 0.03
private constant integer SPELL_CRITICAL_STRIKE_ABILCODE = 'A04W'
private constant real SPELL_CRITICAL_STRIKE_PER_LEVEL = 1.
private constant integer ENERGY_REGENERATION_ABILCODE = 'A04X'
private constant real ENERGY_REGEN_PER_LEVEL = 0.1
endglobals
private function Conds takes nothing returns boolean
return IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)
endfunction
private function onLearn takes nothing returns nothing
local real a = 0.
local unit u = GetTriggerUnit()
if GetSpellAbilityId()==CRITICAL_STRIKE_ABILCODE then
call IssueImmediateOrder( u, "stop" )
if GetHeroSkillPoints(u) > 0 then
set a = LoadReal(udg_hash,GetHandleId(GetTriggerUnit()),GetCritHash())
call SaveReal(udg_hash,GetHandleId(GetTriggerUnit()),GetCritHash(),a + CRITICAL_STRIKE_PER_LEVEL)
call ModifyHeroSkillPoints( GetTriggerUnit(), bj_MODIFYMETHOD_SUB, 1 )
call AddSpecialEffectTargetUnitBJ( "chest", GetTriggerUnit(), "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
else
call SimError(GetOwningPlayer(GetTriggerUnit()),"Not enough skill points")
endif
endif
if GetSpellAbilityId()==BLOCK_CHANCE_ABILCODE then
call IssueImmediateOrder( u, "stop" )
if GetHeroSkillPoints(u) > 0 then
set a = LoadReal(udg_hash,GetHandleId(u),GetBlockChanceHash())
call SaveReal(udg_hash,GetHandleId(u),GetBlockChanceHash(),a + BLOCK_CHANCE_PER_LEVEL)
call ModifyHeroSkillPoints( u, bj_MODIFYMETHOD_SUB, 1 )
call AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
else
call SimError(GetOwningPlayer(u),"Not enough skill points")
endif
endif
if GetSpellAbilityId()== SPELL_POWER_ABILCODE then
call IssueImmediateOrder( u, "stop" )
if GetHeroSkillPoints(u) > 0 then
set a = LoadReal(udg_hash,GetHandleId(u),GetSpellPowerHash())
call SaveReal(udg_hash,GetHandleId(u),GetSpellPowerHash(),a + SPELL_POWER_PER_LEVEL)
call ModifyHeroSkillPoints( u, bj_MODIFYMETHOD_SUB, 1 )
call AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Items\\AIim\\AIimTarget.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
else
call SimError(GetOwningPlayer(GetTriggerUnit()),"Not enough skill points")
endif
endif
if GetSpellAbilityId()==HEALING_DONE_ABILCODE then
call IssueImmediateOrder( u, "stop" )
if GetHeroSkillPoints(u) > 0 then
set a = LoadReal(udg_hash,GetHandleId(u),GetHealingBonusHash())
call SaveReal(udg_hash,GetHandleId(u),GetHealingBonusHash(),a + HEALING_DONE_PER_LEVEL)
call ModifyHeroSkillPoints( u, bj_MODIFYMETHOD_SUB, 1 )
call AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
else
call SimError(GetOwningPlayer(GetTriggerUnit()),"Not enough skill points")
endif
endif
if GetSpellAbilityId()==SPELL_CRITICAL_STRIKE_ABILCODE then
call IssueImmediateOrder( u, "stop" )
if GetHeroSkillPoints(u) > 0 then
set a = LoadReal(udg_hash,GetHandleId(u),GetSpellCritHash())
call SaveReal(udg_hash,GetHandleId(u),GetSpellCritHash(),a + SPELL_CRITICAL_STRIKE_PER_LEVEL)
call ModifyHeroSkillPoints( u, bj_MODIFYMETHOD_SUB, 1 )
call AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
else
call SimError(GetOwningPlayer(GetTriggerUnit()),"Not enough skill points")
endif
endif
if GetSpellAbilityId()==ENERGY_REGENERATION_ABILCODE then
call IssueImmediateOrder( u, "stop" )
if GetHeroSkillPoints(u) > 0 then
set a = LoadReal(udg_hash,GetHandleId(u),GetEnergyRegenBonusHash())
call SaveReal(udg_hash,GetHandleId(u),GetEnergyRegenBonusHash(),a + ENERGY_REGEN_PER_LEVEL)
call ModifyHeroSkillPoints( u, bj_MODIFYMETHOD_SUB, 1 )
call AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
else
call SimError(GetOwningPlayer(GetTriggerUnit()),"Not enough skill points")
endif
endif
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endscope
scope MultiBoardOnClick initializer onInit
globals
integer PLAYER_HERO_CLICKED_INDEX = 0
endglobals
private function Conds takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and IsUnitEnemy(GetTriggerUnit(),Player(7))
endfunction
private function onClick takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
local integer i = 1
loop
exitwhen u == udg_Heroes[i] or i > udg_HeroCount
set i = i + 1
endloop
if i<= udg_HeroCount then
set PLAYER_HERO_CLICKED_INDEX = i
endif
if i <= udg_HeroCount and LoadBoolean(udg_hash,GetHandleId(p),SHOW_STATS_SHOWED) then
call ShowMboard(p,udg_MBoard[i],true)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerSelectionEventBJ(t,Player(0),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(1),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(2),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(3),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(4),true)
call TriggerRegisterPlayerSelectionEventBJ(t,Player(5),true)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onClick )
set t = null
endfunction
endscope
library LittleMultiboard requires HeroInitializer
function InitializeMultiboard takes integer number returns nothing
local integer i = 0
local integer iEnd = 0
local integer j = 0
local integer jEnd = 0
call MultiboardAllowDisplayBJ( true )
//set i = 1
//set iEnd = udg_PlayerCount
set i = number
set iEnd = number
loop
exitwhen i > iEnd
//call CreateMultiboardBJ( 3, 10, "TRIGSTR_1020" )
call CreateMultiboardBJ( 3, 10, "Hero Stats" )
set udg_MBoard[i] = GetLastCreatedMultiboard()
call MultiboardDisplay(udg_MBoard[i],false)
call MultiboardSetItemStyleBJ( udg_MBoard[i], 1, 1, false, true )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 2, 1, true, false )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 1, 2, false, false )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 2, 2, false, false )
call MultiboardSetItemWidthBJ( udg_MBoard[i], 1, 1, 1.50 )
call MultiboardSetItemWidthBJ( udg_MBoard[i], 2, 1, 11.00 )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 3, 1, false, false )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 3, 2, false, false )
set j = 3
set jEnd = 10
loop
exitwhen j > jEnd
call MultiboardSetItemStyleBJ( udg_MBoard[i], 1, j, false, true )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 2, j, true, false )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 3, j, true, false )
call MultiboardSetItemWidthBJ( udg_MBoard[i], 1, j, 1.00 )
call MultiboardSetItemWidthBJ( udg_MBoard[i], 2, j, 8.00 )
call MultiboardSetItemWidthBJ( udg_MBoard[i], 3, j, 4.00 )
set j = j + 1
endloop
call MultiboardSetItemStyleBJ( udg_MBoard[i], 1, 10, false, false )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 1, ( udg_ColorString[GetConvertedPlayerId(udg_Players[i])] + GetPlayerName(udg_Players[i]) ) )
if GetHeroClass(udg_Heroes[i])=="Mage" or GetHeroClass(udg_Heroes[i])=="Healer" then
call MultiboardSetItemIconBJ( udg_MBoard[i], 1, 3, "ReplaceableTextures\\CommandButtons\\BTNachievement_reputation_kirintor_offensive.blp" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 3, "Spell Crit" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 4, "Power" )
else
call MultiboardSetItemIconBJ( udg_MBoard[i], 1, 3, "ReplaceableTextures\\CommandButtons\\BTNCritStrike.blp" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 3, "Crit" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 4, "Power" )
endif
call MultiboardSetItemStyleBJ( udg_MBoard[i], 1, 4, false, false )
call MultiboardSetItemIconBJ( udg_MBoard[i], 1, 5, "ReplaceableTextures\\CommandButtons\\BTNBlockAmmount.blp" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 5, "TRIGSTR_1022" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 6, "TRIGSTR_1026" )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 1, 6, false, false )
call MultiboardSetItemIconBJ( udg_MBoard[i], 1, 7, "ReplaceableTextures\\CommandButtons\\BTNSpellPower.blp" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 7, "TRIGSTR_1023" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 8, "TRIGSTR_1027" )
call MultiboardSetItemStyleBJ( udg_MBoard[i], 1, 8, false, false )
call MultiboardSetItemIconBJ( udg_MBoard[i], 1, 9, "ReplaceableTextures\\CommandButtons\\BTNHaste.blp" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 9, "TRIGSTR_1028" )
call MultiboardSetItemValueBJ( udg_MBoard[i], 2, 10, "TRIGSTR_1024" )
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Hero_Stats_Little takes nothing returns nothing
// set gg_trg_Hero_Stats_Little = CreateTrigger( )
// call TriggerRegisterTimerEventSingle( gg_trg_Hero_Stats_Little, 0.50 )
// call TriggerAddAction( gg_trg_Hero_Stats_Little, function Trig_Hero_Stats_Little_Actions )
endfunction
endlibrary
function Trig_Hero_Stats_Big_Actions takes nothing returns nothing
call MultiboardAllowDisplayBJ( true )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateMultiboardBJ( 2, 19, "TRIGSTR_3248" )
set udg_NBoard[GetForLoopIndexA()] = GetLastCreatedMultiboard()
call MultiboardDisplayBJ( false, GetLastCreatedMultiboard() )
call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 1, 0, true, false )
call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 2, 0, true, false )
call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 0, 12.00 )
call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 0, 9.00 )
call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 1, 1, true, true )
call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 1, 1.00 )
call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 1, 15.00 )
call MultiboardSetItemValueBJ( udg_NBoard[GetForLoopIndexA()], 2, 1, ( udg_ColorString[GetConvertedPlayerId(udg_Players[GetForLoopIndexA()])] + GetPlayerName(udg_Players[GetForLoopIndexA()]) ) )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 3, "TRIGSTR_3250" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 4, "TRIGSTR_3252" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 5, "TRIGSTR_3253" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 6, "TRIGSTR_3254" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 7, "TRIGSTR_3255" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 8, "TRIGSTR_3249" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 9, "TRIGSTR_3256" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 10, "TRIGSTR_3257" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 11, "TRIGSTR_3258" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 12, "TRIGSTR_3259" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 13, "TRIGSTR_3251" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 14, "TRIGSTR_3260" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 15, "TRIGSTR_3261" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 16, "TRIGSTR_3262" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 17, "TRIGSTR_3263" )
call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 19, "TRIGSTR_3264" )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_Hero_Stats_Big takes nothing returns nothing
set gg_trg_Hero_Stats_Big = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Hero_Stats_Big, 0.25 )
call TriggerAddAction( gg_trg_Hero_Stats_Big, function Trig_Hero_Stats_Big_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope RefreshBoards initializer Init
globals
private multiboarditem mbitem = null
endglobals
private function MbSetItem takes multiboard mb, integer col, integer row, string val returns nothing
set mbitem = MultiboardGetItem(mb, row, col)
call MultiboardSetItemValue(mbitem, val)
call MultiboardReleaseItem(mbitem)
endfunction
private function RefreshMb takes nothing returns nothing
local real a = 0.
local integer i = 1
local integer id = 0
loop
exitwhen i > udg_PlayerCount
set id = GetHandleId(udg_Heroes[i])
set a = LoadReal(udg_hash,id,GetCritHash()) //Crit Strike
if GetHeroClass(udg_Heroes[i])=="Mage" or GetHeroClass(udg_Heroes[i])=="Healer" then
set a = LoadReal(udg_hash,id,GetSpellCritHash())
endif
call MbSetItem(udg_NBoard[i], 1, 3, I2S(R2I(a)) + "%")
call MbSetItem(udg_MBoard[i], 2, 2, I2S(R2I(a)) + "%")
set a = LoadReal(udg_hash,id,GetCritMultiplierHash()) //Crit Power
if GetHeroClass(udg_Heroes[i])=="Mage" or GetHeroClass(udg_Heroes[i])=="Healer" then
set a = LoadReal(udg_hash,id,GetSpellCritMultiplierHash())
endif
call MbSetItem( udg_NBoard[i],1, 4, SubString(R2S(2. + a),0,3))
call MbSetItem( udg_MBoard[i], 2, 3, SubString(R2S(2. + a),0,3))
set a = LoadReal(udg_hash,id,5) // Spell Power
call MbSetItem( udg_NBoard[i], 1, 5, I2S(R2I(a)))
call MbSetItem( udg_MBoard[i], 2, 6, I2S(R2I(a)))
set a = LoadReal(udg_hash,id,4) // Haste
call MbSetItem( udg_NBoard[i], 1, 6, I2S(R2I(a))+"%")
call MbSetItem( udg_MBoard[i], 2, 8, I2S(R2I(a)) + "%")
set a = LoadReal(udg_hash,id,14) // Block chance
call MbSetItem( udg_NBoard[i], 1, 8, I2S(R2I(a))+"%")
call MbSetItem( udg_MBoard[i], 2, 4, I2S(R2I(a)) + "%")
set a = LoadReal(udg_hash,id,3) // Block amount
call MbSetItem( udg_NBoard[i], 1, 9, I2S(R2I(a)))
call MbSetItem( udg_MBoard[i], 2, 5, I2S(R2I(a)))
set a = LoadReal(udg_hash,id,16) // Spell Resist
call MbSetItem( udg_NBoard[i], 1, 10, I2S(R2I(a*100))+"%")
set a = LoadReal(udg_hash,id,1) // Dodge Chance
call MbSetItem( udg_NBoard[i], 1, 11, I2S(R2I(a))+"%")
set a = LoadReal(udg_hash,id,11) // Healing done
call MbSetItem( udg_NBoard[i], 1, 13, I2S(R2I(a*100))+"%")
call MbSetItem( udg_MBoard[i], 2, 7, I2S(R2I(a*100)) + "%")
set a = LoadReal(udg_hash,id,9) // Healing received
call MbSetItem( udg_NBoard[i], 1, 14, I2S(R2I(a*100))+"%")
set a = LoadReal(udg_hash,id,30) // Healing crit
call MbSetItem( udg_NBoard[i], 1, 15, I2S(R2I(a))+"%")
set a = GetHeroInt(udg_Heroes[i],true)*(0.5+LoadReal(udg_hash,id,27)+LoadReal(udg_hash,id,28)) // Incombat manaregen
call MbSetItem( udg_NBoard[i], 1, 16, I2S(R2I(a)))
//-----------------------------------------------------
call MbSetItem( udg_NBoard[i], 1, 18, I2S(udg_Kills[i]))
call MbSetItem( udg_MBoard[i], 2, 9, I2S(udg_Kills[i]))
call MultiboardSetItemIconBJ( udg_MBoard[i], 1, 1, LoadStr(udg_hash,id,HERO_ICON_HASH))
set i = i + 1
endloop
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 1.0, true)
call TriggerAddAction( t, function RefreshMb )
set t = null
endfunction
endscope
scope AggroTableMb initializer onInit
globals
timer SHOW_AGGRO_MB_INITIALIZE_TIMER = CreateTimer() //Initialized in RegimeChoosing
endglobals
private function CreateAggroTableMb takes nothing returns nothing
local integer i = 0
local integer j = 0
local integer k = udg_PlayersInGame
//call BJDebugMsg("Initialized aggro MB with: " + I2S(udg_PlayersInGame) + " rows.")
loop
exitwhen i > k
call CreateMultiboardBJ(11, k, "TRIGSTR_3281" )
set udg_ABoard[i] = GetLastCreatedMultiboard()
call MultiboardDisplayBJ(false,udg_ABoard[i] )
set j = 2
loop
exitwhen j > 11
call MultiboardSetItemStyleBJ(udg_ABoard[i], j, 0, true, true )
set j = j + 1
endloop
call MultiboardSetItemIconBJ(udg_ABoard[i], 2, 0, "war3mapImported\\AggroL0.tga" )
call MultiboardSetItemIconBJ(udg_ABoard[i], 11, 0, "war3mapImported\\AggroR0.tga" )
set j = 3
loop
exitwhen j > 10
call MultiboardSetItemIconBJ(udg_ABoard[i], j, 0, "war3mapImported\\AggroM0.tga" )
set j = j + 1
endloop
call MultiboardSetItemStyleBJ(udg_ABoard[i], 1, 0, true, true )
call MultiboardSetItemWidthBJ(udg_ABoard[i], 1, 0, 2.00 )
set j = 2
loop
exitwhen j > 11
call MultiboardSetItemWidthBJ(udg_ABoard[i], j, 0, 1.00 )
set j = j + 1
endloop
set i = i + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent( t, SHOW_AGGRO_MB_INITIALIZE_TIMER )
call TriggerAddAction( t, function CreateAggroTableMb )
endfunction
endscope
scope RefreshAggroTable initializer onInit
private function Acts takes nothing returns nothing
local integer i = 1
local integer j = 1
local multiboarditem mbi = null
local real array a
local unit array u
local real p = 0.
local integer id = LoadInteger(udg_hash,GetHandleId(GetTriggerPlayer()),PLAYER_ID_HASH)
local unit un = GetTriggerUnit()
call MultiboardSetTitleText(udg_ABoard[id],GetUnitName(un)+"'s aggro")
loop
exitwhen i > udg_PlayerCount
call Table.remove(udg_ABoard[id],i-1)
set u[i] = udg_Heroes[i]
set a[i] = Aggro.get(un,u[i],true)
set i = i + 1
endloop
set i = 1
set un = null
loop
exitwhen i > udg_PlayerCount - 1
set j = 1
loop
exitwhen j > udg_PlayerCount - i
if a[j] < a[j+1] then
set p = a[j]
set a[j] = a[j+1]
set a[j+1] = p
set un = u[j]
set u[j] = u[j+1]
set u[j+1] = un
set un = null
endif
set j = j + 1
endloop
set i = i + 1
endloop
set i = 1
set un = GetTriggerUnit()
loop
exitwhen i > udg_PlayerCount
set mbi = MultiboardGetItem(udg_ABoard[id],i-1,0)
call MultiboardSetItemIcon(mbi,LoadStr(udg_hash,GetHandleId(u[i]),HERO_ICON_HASH))
call MultiboardReleaseItem(mbi)
set mbi = null
//call BJDebugMsg("Creating aggro row for " + GetUnitName(u[i]))
call Table.add(un,u[i],udg_ABoard[id],i-1,1,10)
set i = i + 1
endloop
set un = null
endfunction
private function Conds takes nothing returns boolean
return IsUnitEnemy(GetTriggerUnit(),GetTriggerPlayer()) and LoadBoolean(udg_hash,GetHandleId(GetTriggerPlayer()),SHOW_AGGRO_SHOWED)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerRegisterPlayerUnitEvent(t, Player(1), EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerRegisterPlayerUnitEvent(t, Player(2), EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerRegisterPlayerUnitEvent(t, Player(3), EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerRegisterPlayerUnitEvent(t, Player(4), EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerRegisterPlayerUnitEvent(t, Player(5), EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerAddAction( t, function Acts )
call TriggerAddCondition(t,Condition(function Conds))
set t = null
endfunction
endscope
library DDBossMb initializer onInit
globals
private timer MB_RECREATE_TIMER = CreateTimer()
multiboard DD_BOSS_MB = null
private integer array PLAYER_MB_NUMBER[7]
private real array PLAYER_DAMAGE_DONE[7]
private real ELAPSED_TIME = 0.
private integer LAST_PLAYER_COUNT = -1
boolean IS_HEROES_IN_COMBAT = true //See Out of Combat and Boss Defeat triggers, where this changes
endglobals
private function ShowMboard takes player plr, multiboard mb, boolean show returns nothing
if GetLocalPlayer() == plr then
call MultiboardDisplay(mb,show)
endif
endfunction
function AddDamageDoneMB takes player whichPlayer, real value returns nothing
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if udg_Players[i] == whichPlayer then
set PLAYER_DAMAGE_DONE[i] = PLAYER_DAMAGE_DONE[i] + value
endif
set i = i + 1
endloop
endfunction
function RefreshDamageDoneMB takes nothing returns nothing
local integer i = 1
loop
exitwhen i>6
set PLAYER_DAMAGE_DONE[i] = 0.
set i = i + 1
endloop
set ELAPSED_TIME = 0.
endfunction
private function onTimerUpdateTable takes nothing returns nothing
local integer k = udg_PlayersInGame
local integer i = 0
local integer p = 0
local real OVERALL = 0.
local integer tempI = 0
local string tempS = ""
local multiboarditem tempMBI = null
if udg_Singleplayer or IsMultiHeroes then
set k = 1
endif
if IS_HEROES_IN_COMBAT or IS_BOSS_BATTLE then
set ELAPSED_TIME = ELAPSED_TIME + 0.04
endif
if not (LAST_PLAYER_COUNT == k) then
set LAST_PLAYER_COUNT = k
call TimerStart(MB_RECREATE_TIMER,0.0,false,null)
else
set i = 1
loop
exitwhen i>k
set OVERALL = OVERALL + PLAYER_DAMAGE_DONE[PLAYER_MB_NUMBER[i]]
set i = i + 1
endloop
set i = 1
loop
exitwhen i > k
call MultiboardSetItemValueBJ(DD_BOSS_MB, 4, i, I2S(R2I(PLAYER_DAMAGE_DONE[PLAYER_MB_NUMBER[i]])))
if OVERALL > 0. and ELAPSED_TIME > 0. then
call MultiboardSetItemValueBJ(DD_BOSS_MB, 6, i, "(" + I2S(R2I(PLAYER_DAMAGE_DONE[PLAYER_MB_NUMBER[i]] / ELAPSED_TIME)) + "/sec. | " + R2SW(100*PLAYER_DAMAGE_DONE[PLAYER_MB_NUMBER[i]]/OVERALL,2,1) + "%)")
else
call MultiboardSetItemValueBJ(DD_BOSS_MB, 6, i, "" )
endif
set i = i + 1
endloop
set i = 1
loop
exitwhen i > k
call MultiboardSetItemValueBJ(DD_BOSS_MB, 2, i, udg_ColorString[GetConvertedPlayerId(udg_Players[PLAYER_MB_NUMBER[i]])] + GetPlayerName(udg_Players[PLAYER_MB_NUMBER[i]]))
set p = 1
loop
exitwhen p > udg_HeroCount
if GetUnitTypeId(udg_Heroes[PLAYER_MB_NUMBER[i]]) == udg_Hero[p] then
call MultiboardSetItemIconBJ(DD_BOSS_MB, 1, i, udg_HeroIcon[p] ) //test
endif
set p = p + 1
endloop
set i = i + 1
endloop
set i = 1
loop
exitwhen i>k
set p = i+1
loop
exitwhen p>k
if PLAYER_DAMAGE_DONE[PLAYER_MB_NUMBER[i]] < PLAYER_DAMAGE_DONE[PLAYER_MB_NUMBER[p]] then
set tempI = PLAYER_MB_NUMBER[i]
set PLAYER_MB_NUMBER[i] = PLAYER_MB_NUMBER[p]
set PLAYER_MB_NUMBER[p] = tempI
endif
set p = p + 1
endloop
set i = i + 1
endloop
endif
endfunction
private function FindLastPlayerAfterK takes integer k returns integer
local integer j = k+1
loop
exitwhen j > udg_PlayerCount
if GetPlayerSlotState(udg_Players[j]) == PLAYER_SLOT_STATE_PLAYING then
return j
endif
set j = j + 1
endloop
return -1
endfunction
private function CreateDDBossMb takes nothing returns nothing
local integer k = udg_PlayersInGame
local integer i = 0
local integer p = 0
call DestroyMultiboard(DD_BOSS_MB)
if udg_Singleplayer or IsMultiHeroes then
set k = 1
endif
set PLAYER_MB_NUMBER[1] = FindLastPlayerAfterK(0)
set i = 2
loop
exitwhen i > k
set PLAYER_MB_NUMBER[i] = FindLastPlayerAfterK(PLAYER_MB_NUMBER[i-1])
set i = i + 1
endloop
call CreateMultiboardBJ(6, k, "Damage Done" )
set DD_BOSS_MB = GetLastCreatedMultiboard()
call MultiboardDisplayBJ(false,DD_BOSS_MB)
set i = 1
loop
exitwhen i > k
call MultiboardSetItemStyleBJ(DD_BOSS_MB, 1, i, false, true )
call MultiboardSetItemStyleBJ(DD_BOSS_MB, 2, i, true, false)
call MultiboardSetItemStyleBJ(DD_BOSS_MB, 3, i, true, false)
call MultiboardSetItemStyleBJ(DD_BOSS_MB, 4, i, true, false)
call MultiboardSetItemStyleBJ(DD_BOSS_MB, 5, i, true, false)
call MultiboardSetItemStyleBJ(DD_BOSS_MB, 6, i, true, false)
call MultiboardSetItemWidthBJ(DD_BOSS_MB, 1, i, 2.00 )
call MultiboardSetItemWidthBJ(DD_BOSS_MB, 2, i, 8.00 )
call MultiboardSetItemWidthBJ(DD_BOSS_MB, 3, i, 0.50 )
call MultiboardSetItemWidthBJ(DD_BOSS_MB, 4, i, 4.00 )
call MultiboardSetItemWidthBJ(DD_BOSS_MB, 5, i, 0.50 )
call MultiboardSetItemWidthBJ(DD_BOSS_MB, 6, i, 10.00 )
call MultiboardSetItemValueBJ(DD_BOSS_MB, 2, i, udg_ColorString[GetConvertedPlayerId(udg_Players[PLAYER_MB_NUMBER[i+1]])] + GetPlayerName(udg_Players[PLAYER_MB_NUMBER[i+1]]))
set i = i + 1
endloop
set i = 1
loop
exitwhen i > udg_PlayerCount
if LoadBoolean(udg_hash,GetHandleId(udg_Players[i]),DD_MB_SHOWED) then
call ShowMboard(udg_Players[i],DD_BOSS_MB,true)
endif
set i = i + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent( t, MB_RECREATE_TIMER )
call TimerStart(CreateTimer(),0.25, true, function onTimerUpdateTable)
call TriggerAddAction( t, function CreateDDBossMb )
set t = null
endfunction
endlibrary
library HDBossMb initializer onInit
globals
private timer MB_RECREATE_TIMER = CreateTimer()
multiboard HD_BOSS_MB = null
private integer array PLAYER_MB_NUMBER[7] //number from udg_Player[] corresponding to i-th row in HD_BOSS_MB
private real array PLAYER_HEALING_DONE[7] //effective healing for udg_Player[i]
private real array PLAYER_HEALING_DONE_OVER[7] //overhealing for udg_Player[i]
private real ELAPSED_TIME = 0.
private integer LAST_PLAYER_COUNT = -1
//boolean IS_HEROES_IN_COMBAT = true // (Repeating) See Out of Combat and Boss Defeat triggers, where this changes
endglobals
private function ShowMboard takes player plr, multiboard mb, boolean show returns nothing
if GetLocalPlayer() == plr then
call MultiboardDisplay(mb,show)
endif
endfunction
function AddHealingDoneMB takes player whichPlayer, unit whichUnit, real value returns nothing
local integer i = 1
local real heal = value
local real overheal = 0
local real diff = GetUnitState(whichUnit,UNIT_STATE_MAX_LIFE)-GetWidgetLife(whichUnit)
if diff < heal then
set overheal = heal - diff
set heal = diff
endif
loop
exitwhen i>udg_PlayerCount
if udg_Players[i] == whichPlayer then
set PLAYER_HEALING_DONE_OVER[i] = PLAYER_HEALING_DONE_OVER[i] + overheal
set PLAYER_HEALING_DONE[i] = PLAYER_HEALING_DONE[i] + heal
endif
set i = i + 1
endloop
endfunction
function RefreshHealingDoneMB takes nothing returns nothing
local integer i = 1
loop
exitwhen i>6
set PLAYER_HEALING_DONE[i] = 0.
set PLAYER_HEALING_DONE_OVER[i] = 0.
set i = i + 1
endloop
set ELAPSED_TIME = 0.
endfunction
private function onTimerUpdateTable takes nothing returns nothing
local integer k = udg_PlayersInGame
local integer i = 0
local integer p = 0
local integer tempI = 0
local real OVERALL = 0.
if udg_Singleplayer or IsMultiHeroes then
set k = 1
endif
if IS_HEROES_IN_COMBAT or IS_BOSS_BATTLE then
set ELAPSED_TIME = ELAPSED_TIME + 0.04
endif
if not (LAST_PLAYER_COUNT == k) then
set LAST_PLAYER_COUNT = k
call TimerStart(MB_RECREATE_TIMER,1.,false,null)
else
set i = 1
loop
exitwhen i>k
set OVERALL = OVERALL + PLAYER_HEALING_DONE[PLAYER_MB_NUMBER[i]]
set i = i + 1
endloop
set i = 1
loop
exitwhen i > k
call MultiboardSetItemValueBJ(HD_BOSS_MB, 4, i, "|cff80ff80" + I2S(R2I(PLAYER_HEALING_DONE[PLAYER_MB_NUMBER[i]])) + "|r (|cffff0000" + I2S(R2I(PLAYER_HEALING_DONE_OVER[PLAYER_MB_NUMBER[i]])) + "|r)")
if OVERALL > 0. and ELAPSED_TIME > 0. then
call MultiboardSetItemValueBJ(HD_BOSS_MB, 6, i, "(" + I2S(R2I(PLAYER_HEALING_DONE[PLAYER_MB_NUMBER[i]] / ELAPSED_TIME)) + "/sec. | " + R2SW(100*PLAYER_HEALING_DONE[PLAYER_MB_NUMBER[i]]/OVERALL,2,1) + "%)")
else
call MultiboardSetItemValueBJ(HD_BOSS_MB, 6, i, "" )
endif
set i = i + 1
endloop
set i = 1
loop
exitwhen i > k
call MultiboardSetItemValueBJ(HD_BOSS_MB, 2, i, udg_ColorString[GetConvertedPlayerId(udg_Players[PLAYER_MB_NUMBER[i]])] + GetPlayerName(udg_Players[PLAYER_MB_NUMBER[i]]))
set p = 1
loop
exitwhen p > udg_HeroCount
if GetUnitTypeId(udg_Heroes[PLAYER_MB_NUMBER[i]]) == udg_Hero[p] then
call MultiboardSetItemIconBJ(HD_BOSS_MB, 1, i, udg_HeroIcon[p] ) //test
endif
set p = p + 1
endloop
set i = i + 1
endloop
set i = 1
loop
exitwhen i>k
set p = i+1
loop
exitwhen p>k
if PLAYER_HEALING_DONE[PLAYER_MB_NUMBER[i]] < PLAYER_HEALING_DONE[PLAYER_MB_NUMBER[p]] then
set tempI = PLAYER_MB_NUMBER[i]
set PLAYER_MB_NUMBER[i] = PLAYER_MB_NUMBER[p]
set PLAYER_MB_NUMBER[p] = tempI
endif
set p = p + 1
endloop
set i = i + 1
endloop
endif
endfunction
private function FindLastPlayerAfterK takes integer k returns integer
local integer j = k+1
loop
exitwhen j > udg_PlayerCount
if GetPlayerSlotState(udg_Players[j]) == PLAYER_SLOT_STATE_PLAYING then
return j
endif
set j = j + 1
endloop
return -1
endfunction
private function CreateHDBossMb takes nothing returns nothing
local integer k = udg_PlayersInGame
local integer i = 0
local integer lastP = 0
local integer p = 0
call DestroyMultiboard(HD_BOSS_MB)
if udg_Singleplayer or IsMultiHeroes then
set k = 1
endif
set PLAYER_MB_NUMBER[1] = FindLastPlayerAfterK(0)
set i = 2
loop
exitwhen i > k
set PLAYER_MB_NUMBER[i] = FindLastPlayerAfterK(PLAYER_MB_NUMBER[i-1])
set i = i + 1
endloop
call CreateMultiboardBJ(6, k, "Healing Done" )
set HD_BOSS_MB = GetLastCreatedMultiboard()
call MultiboardDisplayBJ(false,HD_BOSS_MB)
set i = 1
loop
exitwhen i > k
call MultiboardSetItemStyleBJ(HD_BOSS_MB, 1, i, false, true )
call MultiboardSetItemStyleBJ(HD_BOSS_MB, 2, i, true, false)
call MultiboardSetItemStyleBJ(HD_BOSS_MB, 3, i, true, false)
call MultiboardSetItemStyleBJ(HD_BOSS_MB, 4, i, true, false)
call MultiboardSetItemStyleBJ(HD_BOSS_MB, 5, i, true, false)
call MultiboardSetItemStyleBJ(HD_BOSS_MB, 6, i, true, false)
call MultiboardSetItemWidthBJ(HD_BOSS_MB, 1, i, 2.00 )
call MultiboardSetItemWidthBJ(HD_BOSS_MB, 2, i, 8.00 )
call MultiboardSetItemWidthBJ(HD_BOSS_MB, 3, i, 0.50 )
call MultiboardSetItemWidthBJ(HD_BOSS_MB, 4, i, 8.00 )
call MultiboardSetItemWidthBJ(HD_BOSS_MB, 5, i, 0.50 )
call MultiboardSetItemWidthBJ(HD_BOSS_MB, 6, i, 10.00 )
call MultiboardSetItemValueBJ(HD_BOSS_MB, 2, i, udg_ColorString[GetConvertedPlayerId(udg_Players[PLAYER_MB_NUMBER[i+1]])] + GetPlayerName(udg_Players[PLAYER_MB_NUMBER[i+1]]))
set i = i + 1
endloop
set i = 1
loop
exitwhen i > udg_PlayerCount
if LoadBoolean(udg_hash,GetHandleId(udg_Players[i]),HD_MB_SHOWED) then
call ShowMboard(udg_Players[i],HD_BOSS_MB,true)
endif
set i = i + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent( t, MB_RECREATE_TIMER )
call TimerStart(CreateTimer(),0.25, true, function onTimerUpdateTable)
call TriggerAddAction( t, function CreateHDBossMb )
set t = null
endfunction
endlibrary
library HeroRevival initializer onInit requires OutOfCombat,MapGameplayUtils
globals
integer CHAPTER_HERO_HASH = 100
endglobals
private function Conds takes nothing returns boolean
return (GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_USER) and ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true)
endfunction
private function GetHeroBack takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer i = LoadInteger(udg_hash,GetHandleId(u),CHAPTER_HERO_HASH)
local rect r = null
if IsUnitType(u,UNIT_TYPE_DEAD) and not EREDARS_BRIDGE_COLLAPSE_SCENE_STARTED and not ELVES_TELEPORT_CINEMATIC_STARTED then
call UnitRemoveType(u,UNIT_TYPE_DEAD)
call SetUnitTimeScale(u,1)
call ReviveHero(u,GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect),false)
//Direct Camera Bounds to prevent bugs
if i == 1 then
set r = gg_rct_StartBOUNDS
call SaveRectHandle(udg_hash,GetHandleId(GetOwningPlayer(u)),PLAYER_RECT_HASH,r)
call SaveRectHandle(udg_hash,GetHandleId(u),UNIT_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ( GetOwningPlayer(u), r )
endif
if i == 2 then
set r = gg_rct_Act2BOUNDS
call SaveRectHandle(udg_hash,GetHandleId(GetOwningPlayer(u)),PLAYER_RECT_HASH,r)
call SaveRectHandle(udg_hash,GetHandleId(u),UNIT_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ( GetOwningPlayer(u), r )
endif
if i == 3 then
set r = gg_rct_Act3BOUNDS
call SaveRectHandle(udg_hash,GetHandleId(GetOwningPlayer(u)),PLAYER_RECT_HASH,r)
call SaveRectHandle(udg_hash,GetHandleId(u),UNIT_RECT_HASH,r)
call SetCameraBoundsToRectForPlayerBJ( GetOwningPlayer(u), r )
endif
///
call SetUnitPosition(u,GetLocationX(udg_SpiritHealerLoc[i]),GetLocationY(udg_SpiritHealerLoc[i]))
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MAX_MANA))
call TimerStart(LoadTimerHandle(udg_hash,GetHandleId(u),OUT_OF_COMBAT_TIMER_HASH),1.,false,function OUT_OF_COMBAT)
call PanCameraToForPlayer(GetOwningPlayer(u),GetUnitX(u),GetUnitY(u))
if (MAGMAW_BATTLE_INITIALIZED or SUPREMUS_BATTLE_INITIALIZED or EREDARS_BATTLE_INITIALIZED) and (not IsMultiHeroes) then
call DisplayTimedTextToPlayer(GetOwningPlayer(u),0,0,10.,udg_Tips[23])
endif
if i==1 then
call OrkTown(GetOwningPlayer(u))
endif
endif
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function Acts takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local timer t = CreateTimer()
call UnitAddType(u,UNIT_TYPE_DEAD)
if IS_VICTORY then
set ISLAND_DEATHS_COUNT = ISLAND_DEATHS_COUNT + 1
call DisplayTimedTextToPlayer(p,0,0,15.,"Your hero has died and will be revived in |cff80ff805|r seconds...")
call TimerStart(t,5.,false,function GetHeroBack)
else
if TURBO_MODE then
call DisplayTimedTextToPlayer(p,0,0,15.,"Your hero has died and will be revived in |cff80ff8015|r seconds...")
call TimerStart(t,15.,false,function GetHeroBack)
else
call DisplayTimedTextToPlayer(p,0,0,15.,"Your hero has died and will be revived in |cff80ff8030|r seconds...")
call TimerStart(t,30.,false,function GetHeroBack)
endif
endif
call PauseTimer(LoadTimerHandle(udg_hash,GetHandleId(u),OUT_OF_COMBAT_TIMER_HASH))
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
set u = null
set p = null
set t = null
endfunction
function ImmediatelyReviveHero takes unit whichHero returns nothing
local timer t = CreateTimer()
call TimerStart(t,1.,false,function GetHeroBack)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichHero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function Acts )
set t = null
endfunction
endlibrary
function Trig_LeavetheGame_Func007A takes nothing returns nothing
call AdjustPlayerStateBJ( ( GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD) / CountPlayersInForceBJ(udg_Players_Group) ), GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction
function Trig_LeavetheGame_Actions takes nothing returns nothing
local integer j = 1
local integer i = 1
call ForceRemovePlayerSimple( GetTriggerPlayer(), udg_Players_Group )
call DisplayTextToForce( GetPlayersAll(), ( udg_ColorString[GetConvertedPlayerId(GetTriggerPlayer())] + ( GetPlayerName(GetTriggerPlayer()) + " |r|c00870509has left the game." ) ) )
//call ForForce( udg_Players_Group, function Trig_LeavetheGame_Func007A )
set udg_PlayersInGame = udg_PlayersInGame - 1
set i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Players[i] == GetTriggerPlayer() then
call UnitRemoveItemFromSlotSwapped( 1, udg_Heroes[i] )
call UnitRemoveItemFromSlotSwapped( 2, udg_Heroes[i] )
call UnitRemoveItemFromSlotSwapped( 3, udg_Heroes[i] )
call UnitRemoveItemFromSlotSwapped( 4, udg_Heroes[i] )
call UnitRemoveItemFromSlotSwapped( 5, udg_Heroes[i] )
call UnitRemoveItemFromSlotSwapped( 6, udg_Heroes[i] )
set j = 1
loop
exitwhen j > udg_PlayerCount
call SetPlayerUnitAvailableBJ( GetUnitTypeId(udg_Heroes[i]), true, udg_Players[j] )
set j = j + 1
endloop
call RemoveUnit( udg_Heroes[i] )
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_LeavetheGame takes nothing returns nothing
set gg_trg_LeavetheGame = CreateTrigger( )
call TriggerRegisterPlayerEventLeave( gg_trg_LeavetheGame, Player(0) )
call TriggerRegisterPlayerEventLeave( gg_trg_LeavetheGame, Player(1) )
call TriggerRegisterPlayerEventLeave( gg_trg_LeavetheGame, Player(2) )
call TriggerRegisterPlayerEventLeave( gg_trg_LeavetheGame, Player(3) )
call TriggerRegisterPlayerEventLeave( gg_trg_LeavetheGame, Player(4) )
call TriggerRegisterPlayerEventLeave( gg_trg_LeavetheGame, Player(5) )
call TriggerAddAction( gg_trg_LeavetheGame, function Trig_LeavetheGame_Actions )
endfunction
//TESH.scrollpos=2
//TESH.alwaysfold=0
scope AddGoldPlayers initializer Init
globals
private integer GEM_POINTS = 0
endglobals
private function Conditions takes nothing returns boolean
if GetTriggerUnit()==ARCHIMONDE or GetTriggerUnit()==KILJAEDEN then
return false
endif
return IsUnitEnemy(GetKillingUnit(),GetOwningPlayer(GetTriggerUnit())) and GetUnitAbilityLevel(GetTriggerUnit(),'Aloc') <= 0
endfunction
private function PlayerGoldAdd takes nothing returns nothing
call SetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD) + R2I(udg_temp_real))
call SetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_LUMBER) + GEM_POINTS)
endfunction
private function Actions takes nothing returns nothing
local integer i = 0
local integer j = 0
local unit u = GetTriggerUnit()
if GetUnitLevel(GetTriggerUnit()) > 0 then
set udg_temp_int = GetRandomInt(( GetUnitLevel(GetTriggerUnit()) * 10 ), ( ( GetUnitLevel(GetTriggerUnit()) * 10 ) * 2 ))
set udg_temp_real = ( I2R(udg_temp_int) / I2R(udg_PlayersInGame) )
if IsMultiHeroes then
set udg_temp_real = I2R(udg_temp_int)
endif
//Calculate GemDrop from Special Wave champion unit
set j = 6
loop
exitwhen j>10
if GetUnitTypeId(GetTriggerUnit())==udg_Spec_WaveUnits[j] then
call CalculateGemDropFromPoint(GetUnitX(u),GetUnitY(u))
endif
set j = j + 1
endloop
//
//Calculate GemDrop from Stonecore Guardian
if GetUnitTypeId(GetTriggerUnit())=='n00O' then
call CalculateGemDropFromPoint(GetUnitX(u),GetUnitY(u))
endif
if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) then
set udg_temp_real = 1000.
set GEM_POINTS = 1
if IsMultiHeroes then
set GEM_POINTS = udg_PlayerCount
endif
endif
if not LoadBoolean(udg_hash,GetHandleId(GetTriggerUnit()),310) then //Check if unit can give gold
call ForForce( udg_Players_Group, function PlayerGoldAdd )
call GoldTextTag("|c00CDAF00+" + I2S(R2I(udg_temp_real)),GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()))
endif
set GEM_POINTS = 0
endif
set i = 1
loop
exitwhen i > udg_PlayerCount
if GetOwningPlayer(GetKillingUnit()) == udg_Players[i] then
set udg_Kills[i] = udg_Kills[i] + 1
endif
set i = i + 1
endloop
set u = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent(t,Player(7),EVENT_PLAYER_UNIT_DEATH,null)
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope
library ItemsInitializer initializer onInit
globals
private constant string array ITEMS_TYPE[100]
private constant integer array BASE_ITEMS[100]
private constant integer array FIRE_ITEMS[100]
private constant integer array FROST_ITEMS[100]
private constant integer array CORRUPT_ITEMS[100]
private constant integer array TIGER_ITEMS[100]
private constant integer BASE_ITEMS_COUNT = 13 //CHANGE THIS NUMBER IF YOU ADD SOME NEW BASIC ITEM
private constant integer MAX_HASH_BONUSES = 25
private constant integer MAX_GEMS_HASH_BONUSES = 10
private constant integer ISINITIALIZED_HASH = 1 //boolean
private constant integer ORIGIN_TYPE_HASH = 2 //integer
private constant integer GLYPH_TYPE_HASH = 3 //integer
private constant integer ATTACK_POWER_BONUS_HASH = 4 //integer
private constant integer ARMOR_BONUS_HASH = 5 //integer
private constant integer STAMINA_BONUS_HASH = 6 //integer
private constant integer EXPERTISE_BONUS_HASH = 7 //integer
private constant integer SPIRIT_BONUS_HASH = 8 // integer
private constant integer UPGRADES_COUNTER_HASH = 9 // integer
private constant integer CUSTOMBONUSES_NUMBER_HASH = 10 //integer
private constant integer GEMS_CUSTOMBONUSES_NUMBER_HASH = 11 // integer
private constant integer GEMS_INSERTED_HASH = 12 // integer
private constant integer GEMS_SOCKETS_NUMBER_HASH = 13 // integer
private constant integer GEMS_ATTACK_POWER_BONUS_HASH = 14 //integer
private constant integer GEMS_ARMOR_BONUS_HASH = 15 //integer
private constant integer GEMS_STAMINA_BONUS_HASH = 16 //integer
private constant integer GEMS_EXPERTISE_BONUS_HASH = 17 //integer
private constant integer GEMS_SPIRIT_BONUS_HASH = 18 // integer
private constant integer ITEM_XARDAS_MARK_HASH = 19 // boolean
private constant integer START_FOR_ARRAYS = 200 // there will be 3 arrays of length START_FOR_ARRAYS + MAX_HASH_NUMBERS
private constant integer GEMS_START_FOR_ARRAYS = 300 // there will be 3 arrays of length GEMS_START_FOR_ARRAYS + MAX_GEMS_HASH_NUMBERS
endglobals
function ItemAddXardasMark takes item whichItem returns nothing
call SaveBoolean(udg_hash,GetHandleId(whichItem),ITEM_XARDAS_MARK_HASH, true)
endfunction
function GetItemXardasMarkType takes item whichItem returns integer
local boolean flag = LoadBoolean(udg_hash,GetHandleId(whichItem),ITEM_XARDAS_MARK_HASH)
if not flag then
return 0
else
return LoadInteger(udg_hash,GetHandleId(whichItem),GLYPH_TYPE_HASH)
endif
endfunction
function ItemHasFreeSocket takes item whichItem returns boolean
return LoadInteger(udg_hash,GetHandleId(whichItem),GEMS_SOCKETS_NUMBER_HASH) - LoadInteger(udg_hash,GetHandleId(whichItem),GEMS_INSERTED_HASH) > 0
endfunction
function IsItemGlyphed takes item whichItem returns boolean
return LoadInteger(udg_hash,GetHandleId(whichItem),GLYPH_TYPE_HASH)==-1
endfunction
function GetItemUpgradesCountHash takes nothing returns integer
return UPGRADES_COUNTER_HASH
endfunction
function GetItemSpiritBonusHash takes nothing returns integer
return SPIRIT_BONUS_HASH
endfunction
function GetItemExpertiseBonusHash takes nothing returns integer
return EXPERTISE_BONUS_HASH
endfunction
function GetItemStaminaBonusHash takes nothing returns integer
return STAMINA_BONUS_HASH
endfunction
function GetItemArmorBonusHash takes nothing returns integer
return ARMOR_BONUS_HASH
endfunction
function GetItemAttackPowerBonusHash takes nothing returns integer
return ATTACK_POWER_BONUS_HASH
endfunction
function GetItemGlyphHash takes nothing returns integer
return GLYPH_TYPE_HASH
endfunction
function GetItemGlyphType takes item whichItem returns integer
return LoadInteger(udg_hash, GetHandleId(whichItem), GLYPH_TYPE_HASH)
endfunction
function GetItemSpiritBonus takes item whichItem returns integer
return LoadInteger(udg_hash,GetHandleId(whichItem),SPIRIT_BONUS_HASH)
endfunction
function GetItemExpertiseBonus takes item whichItem returns integer
return LoadInteger(udg_hash,GetHandleId(whichItem),EXPERTISE_BONUS_HASH)
endfunction
function GetItemStaminaBonus takes item whichItem returns integer
return LoadInteger(udg_hash,GetHandleId(whichItem),STAMINA_BONUS_HASH)
endfunction
function GetItemArmorBonus takes item whichItem returns integer
return LoadInteger(udg_hash,GetHandleId(whichItem),ARMOR_BONUS_HASH)
endfunction
function GetItemAttackPowerBonus takes item whichItem returns integer
return LoadInteger(udg_hash,GetHandleId(whichItem),ATTACK_POWER_BONUS_HASH)
endfunction
function GetGlyphedItemId takes integer itemCode, integer glyphNumber returns integer
local integer i = 1
loop
exitwhen BASE_ITEMS[i]==itemCode or i > BASE_ITEMS_COUNT
set i = i + 1
endloop
if i <= BASE_ITEMS_COUNT then
if glyphNumber == 1 then
return FIRE_ITEMS[i]
endif
if glyphNumber == 2 then
return FROST_ITEMS[i]
endif
if glyphNumber == 3 then
return CORRUPT_ITEMS[i]
endif
if glyphNumber == 4 then
return TIGER_ITEMS[i]
endif
endif
return itemCode
endfunction
function IsItemInitialized takes item whichItem returns boolean
return LoadBoolean(udg_hash,GetHandleId(whichItem),ISINITIALIZED_HASH)
endfunction
struct itemBonuses
integer ATTACKPOWER
integer ARMOR
integer STAMINA
integer EXPERTISE
integer SPIRIT
integer CUSTOMBONUSES_NUMBER
boolean array ROI[MAX_HASH_BONUSES]
real array R[MAX_HASH_BONUSES]
integer array I[MAX_HASH_BONUSES]
integer array HASH[MAX_HASH_BONUSES]
integer GEMS_SOCKETS_NUMBER
integer GEMS_INSERTED
integer GEMS_ATTACKPOWER
integer GEMS_ARMOR
integer GEMS_STAMINA
integer GEMS_EXPERTISE
integer GEMS_SPIRIT
integer GEMS_CUSTOMBONUSES_NUMBER
boolean array GEMS_ROI[MAX_GEMS_HASH_BONUSES]
real array GEMS_R[MAX_GEMS_HASH_BONUSES]
integer array GEMS_I[MAX_GEMS_HASH_BONUSES]
integer array GEMS_HASH[MAX_GEMS_HASH_BONUSES]
endstruct
globals
//private constant integer ITEM_ARRAY_BOUND = BASE_ITEMS_COUNT+1
private itemBonuses array BONUSES
private itemBonuses array FIRE_BONUSES
private itemBonuses array FROST_BONUSES
private itemBonuses array CORRUPT_BONUSES
private itemBonuses array TIGER_BONUSES
endglobals
function GetItemBonuses takes item whichItem returns itemBonuses
local itemBonuses itB = itemBonuses.create()
local integer id = GetHandleId(whichItem)
local integer i = 1
set itB.CUSTOMBONUSES_NUMBER = LoadInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH)
set itB.ATTACKPOWER = LoadInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH)
set itB.ARMOR = LoadInteger(udg_hash,id,ARMOR_BONUS_HASH)
set itB.STAMINA = LoadInteger(udg_hash,id,STAMINA_BONUS_HASH)
set itB.EXPERTISE = LoadInteger(udg_hash,id,EXPERTISE_BONUS_HASH)
set itB.SPIRIT = LoadInteger(udg_hash,id,SPIRIT_BONUS_HASH)
set i = 1
loop
exitwhen i > itB.CUSTOMBONUSES_NUMBER
set itB.ROI[i] = LoadBoolean(udg_hash,id,START_FOR_ARRAYS+i-1)
if itB.ROI[i] then
set itB.R[i] = LoadReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i-1)
else
set itB.I[i] = LoadInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i-1)
endif
set itB.HASH[i] = LoadInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i-1)
set i = i + 1
endloop
set itB.GEMS_SOCKETS_NUMBER = LoadInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH)
set itB.GEMS_INSERTED = LoadInteger(udg_hash,id,GEMS_INSERTED_HASH)
set itB.GEMS_CUSTOMBONUSES_NUMBER = LoadInteger(udg_hash,id,GEMS_CUSTOMBONUSES_NUMBER_HASH)
set itB.GEMS_ATTACKPOWER = LoadInteger(udg_hash,id,GEMS_ATTACK_POWER_BONUS_HASH)
set itB.GEMS_ARMOR = LoadInteger(udg_hash,id,GEMS_ARMOR_BONUS_HASH)
set itB.GEMS_STAMINA = LoadInteger(udg_hash,id,GEMS_STAMINA_BONUS_HASH)
set itB.GEMS_EXPERTISE = LoadInteger(udg_hash,id,GEMS_EXPERTISE_BONUS_HASH)
set itB.GEMS_SPIRIT = LoadInteger(udg_hash,id,GEMS_SPIRIT_BONUS_HASH)
set i = 1
loop
exitwhen i > itB.GEMS_CUSTOMBONUSES_NUMBER
set itB.GEMS_ROI[i] = LoadBoolean(udg_hash,id,GEMS_START_FOR_ARRAYS+i-1)
if itB.GEMS_ROI[i] then
set itB.GEMS_R[i] = LoadReal(udg_hash,id,GEMS_START_FOR_ARRAYS+MAX_GEMS_HASH_BONUSES+i-1)
else
set itB.GEMS_I[i] = LoadInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+2*MAX_GEMS_HASH_BONUSES+i-1)
endif
set itB.GEMS_HASH[i] = LoadInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES+i-1)
set i = i + 1
endloop
return itB
endfunction
private function IsItemBasic takes item whichItem returns integer
local integer j = 1
loop
exitwhen GetItemTypeId(whichItem)==BASE_ITEMS[j] or j > BASE_ITEMS_COUNT
set j = j +1
endloop
return j
endfunction
private function ItemAddCustomGemBonusReal takes item whichItem, integer hash, real value returns nothing
local integer id = GetHandleId(whichItem)
local integer GEMS_N = LoadInteger(udg_hash,id,GEMS_CUSTOMBONUSES_NUMBER_HASH)
local integer i = 0
loop
exitwhen i>=GEMS_N or LoadInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES+i)==hash
set i = i + 1
endloop
if i>=GEMS_N then
call SaveInteger(udg_hash,id,GEMS_CUSTOMBONUSES_NUMBER_HASH,GEMS_N+1)
call SaveBoolean(udg_hash,id,GEMS_START_FOR_ARRAYS+GEMS_N,true)
call SaveReal(udg_hash,id,GEMS_START_FOR_ARRAYS+MAX_GEMS_HASH_BONUSES+GEMS_N,value)
call SaveInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES+GEMS_N,hash)
else
call SaveReal(udg_hash,id,GEMS_START_FOR_ARRAYS+MAX_GEMS_HASH_BONUSES+i, LoadReal(udg_hash,id,GEMS_START_FOR_ARRAYS+MAX_GEMS_HASH_BONUSES+i)+value)
endif
endfunction
private function ItemAddCustomGemBonusInteger takes item whichItem, integer hash, integer value returns nothing
local integer id = GetHandleId(whichItem)
local integer GEMS_N = LoadInteger(udg_hash,id,GEMS_CUSTOMBONUSES_NUMBER_HASH)
local integer i = 0
loop
exitwhen i>=GEMS_N or LoadInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES+i)==hash
set i = i + 1
endloop
if i>=GEMS_N then
call SaveInteger(udg_hash,id,GEMS_CUSTOMBONUSES_NUMBER_HASH,GEMS_N+1)
call SaveBoolean(udg_hash,id,GEMS_START_FOR_ARRAYS+GEMS_N,false)
call SaveInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+2*MAX_GEMS_HASH_BONUSES+GEMS_N,value)
call SaveInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES+GEMS_N,hash)
else
call SaveInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+2*MAX_GEMS_HASH_BONUSES+i,LoadInteger(udg_hash,id,GEMS_START_FOR_ARRAYS+2*MAX_GEMS_HASH_BONUSES+i)+value)
endif
endfunction
function ItemAddGemBonuses takes item whichItem, itemBonuses itB returns nothing
local integer id = GetHandleId(whichItem)
local integer GEMS_N = LoadInteger(udg_hash,id,GEMS_CUSTOMBONUSES_NUMBER_HASH)
local integer i = 1
local integer j = 1
call SaveInteger(udg_hash,id,GEMS_INSERTED_HASH,LoadInteger(udg_hash,id,GEMS_INSERTED_HASH)+1)
call SaveInteger(udg_hash,id,GEMS_ATTACK_POWER_BONUS_HASH, LoadInteger(udg_hash,id,GEMS_ATTACK_POWER_BONUS_HASH) + itB.GEMS_ATTACKPOWER )
call SaveInteger(udg_hash,id,GEMS_ARMOR_BONUS_HASH, LoadInteger(udg_hash,id,GEMS_ARMOR_BONUS_HASH) + itB.GEMS_ARMOR )
call SaveInteger(udg_hash,id,GEMS_EXPERTISE_BONUS_HASH, LoadInteger(udg_hash,id,GEMS_EXPERTISE_BONUS_HASH) + itB.GEMS_EXPERTISE )
call SaveInteger(udg_hash,id,GEMS_STAMINA_BONUS_HASH, LoadInteger(udg_hash,id,GEMS_STAMINA_BONUS_HASH) + itB.GEMS_STAMINA )
call SaveInteger(udg_hash,id,GEMS_SPIRIT_BONUS_HASH, LoadInteger(udg_hash,id,GEMS_SPIRIT_BONUS_HASH) + itB.GEMS_SPIRIT )
loop
exitwhen j > itB.GEMS_CUSTOMBONUSES_NUMBER
if itB.GEMS_ROI[j] then
call ItemAddCustomGemBonusReal(whichItem, itB.GEMS_HASH[j],itB.GEMS_R[j])
else
call ItemAddCustomGemBonusInteger(whichItem, itB.GEMS_HASH[j],itB.GEMS_I[j])
endif
set j = j + 1
endloop
endfunction
private function ItemAddCustomBonusReal takes item whichItem, integer hash, real value returns nothing
local integer id = GetHandleId(whichItem)
local integer N = LoadInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH)
local integer i = 0
loop
exitwhen i>N or LoadInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i)==hash
set i = i + 1
endloop
if i>N then
call SaveInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH,N+1)
call SaveBoolean(udg_hash,id,START_FOR_ARRAYS+N,true)
call SaveReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+N,value)
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+N,hash)
else
call SaveReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i, LoadReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i)+value)
endif
endfunction
private function ItemAddCustomBonusInteger takes item whichItem, integer hash, integer value returns nothing
local integer id = GetHandleId(whichItem)
local integer N = LoadInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH)
local integer i = 0
loop
exitwhen i>N or LoadInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i)==hash
set i = i + 1
endloop
if i>N then
call SaveInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH,N+1)
call SaveBoolean(udg_hash,id,START_FOR_ARRAYS+N,false)
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+N,value)
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+N,hash)
else
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i,LoadInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i)+value)
endif
endfunction
//Deletes it2 and adds its stats to it1
function MergeItems takes item it1, item it2 returns item
local integer id1 = GetHandleId(it1)
local integer id2 = GetHandleId(it2)
local integer N = LoadInteger(udg_hash,id2,CUSTOMBONUSES_NUMBER_HASH)
local integer GEMS_N = LoadInteger(udg_hash,id2,GEMS_CUSTOMBONUSES_NUMBER_HASH)
local integer ATTACKPOWER = LoadInteger(udg_hash,id2, ATTACK_POWER_BONUS_HASH)
local integer ARMOR = LoadInteger(udg_hash,id2, ARMOR_BONUS_HASH)
local integer STAMINA = LoadInteger(udg_hash,id2,STAMINA_BONUS_HASH)
local integer EXPERTISE = LoadInteger(udg_hash,id2,EXPERTISE_BONUS_HASH)
local integer SPIRIT = LoadInteger(udg_hash,id2,SPIRIT_BONUS_HASH)
local integer GEMS_ATTACKPOWER = LoadInteger(udg_hash,id2, GEMS_ATTACK_POWER_BONUS_HASH)
local integer GEMS_ARMOR = LoadInteger(udg_hash,id2, GEMS_ARMOR_BONUS_HASH)
local integer GEMS_STAMINA = LoadInteger(udg_hash,id2,GEMS_STAMINA_BONUS_HASH)
local integer GEMS_EXPERTISE = LoadInteger(udg_hash,id2,GEMS_EXPERTISE_BONUS_HASH)
local integer GEMS_SPIRIT = LoadInteger(udg_hash,id2,GEMS_SPIRIT_BONUS_HASH)
local integer j = 0
local integer i = 0
call SaveInteger(udg_hash,id1,ATTACK_POWER_BONUS_HASH,LoadInteger(udg_hash,id1,ATTACK_POWER_BONUS_HASH)+ATTACKPOWER)
call SaveInteger(udg_hash,id1,ARMOR_BONUS_HASH,LoadInteger(udg_hash,id1,ARMOR_BONUS_HASH)+ARMOR)
call SaveInteger(udg_hash,id1,STAMINA_BONUS_HASH,LoadInteger(udg_hash,id1,STAMINA_BONUS_HASH)+STAMINA)
call SaveInteger(udg_hash,id1,EXPERTISE_BONUS_HASH,LoadInteger(udg_hash,id1,EXPERTISE_BONUS_HASH)+EXPERTISE)
call SaveInteger(udg_hash,id1,SPIRIT_BONUS_HASH,LoadInteger(udg_hash,id1,SPIRIT_BONUS_HASH)+SPIRIT)
call SetItemCharges(it1,GetItemCharges(it1)+GetItemCharges(it2))
set i = 0
loop
exitwhen i>N
if LoadBoolean(udg_hash,id2,START_FOR_ARRAYS+i) then
call ItemAddCustomBonusReal(it1,LoadInteger(udg_hash,id2, START_FOR_ARRAYS+3*MAX_HASH_BONUSES + i), LoadReal(udg_hash,id2, START_FOR_ARRAYS+MAX_HASH_BONUSES + i) )
else
call ItemAddCustomBonusInteger(it1,LoadInteger(udg_hash,id2, START_FOR_ARRAYS+3*MAX_HASH_BONUSES + i), LoadInteger(udg_hash,id2, START_FOR_ARRAYS+2*MAX_HASH_BONUSES + i) )
endif
set i = i + 1
endloop
call SaveInteger(udg_hash,id1,GEMS_SOCKETS_NUMBER_HASH, LoadInteger(udg_hash,id1,GEMS_SOCKETS_NUMBER_HASH)+LoadInteger(udg_hash,id2,GEMS_SOCKETS_NUMBER_HASH))
call SaveInteger(udg_hash,id1,GEMS_INSERTED_HASH, LoadInteger(udg_hash,id1,GEMS_INSERTED_HASH)+LoadInteger(udg_hash,id2,GEMS_INSERTED_HASH))
call SaveInteger(udg_hash,id1,GEMS_ATTACK_POWER_BONUS_HASH,LoadInteger(udg_hash,id1,GEMS_ATTACK_POWER_BONUS_HASH)+GEMS_ATTACKPOWER)
call SaveInteger(udg_hash,id1,GEMS_ARMOR_BONUS_HASH,LoadInteger(udg_hash,id1,GEMS_ARMOR_BONUS_HASH)+GEMS_ARMOR)
call SaveInteger(udg_hash,id1,GEMS_STAMINA_BONUS_HASH,LoadInteger(udg_hash,id1,GEMS_STAMINA_BONUS_HASH)+GEMS_STAMINA)
call SaveInteger(udg_hash,id1,GEMS_EXPERTISE_BONUS_HASH,LoadInteger(udg_hash,id1,GEMS_EXPERTISE_BONUS_HASH)+GEMS_EXPERTISE)
call SaveInteger(udg_hash,id1,GEMS_SPIRIT_BONUS_HASH,LoadInteger(udg_hash,id1,GEMS_SPIRIT_BONUS_HASH)+GEMS_SPIRIT)
set i = 0
loop
exitwhen i>GEMS_N
if LoadBoolean(udg_hash,id2,GEMS_START_FOR_ARRAYS+i) then
call ItemAddCustomBonusReal(it1,LoadInteger(udg_hash,id2, GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES + i), LoadReal(udg_hash,id2, GEMS_START_FOR_ARRAYS+MAX_GEMS_HASH_BONUSES + i) )
else
call ItemAddCustomBonusInteger(it1,LoadInteger(udg_hash,id2, GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES + i), LoadInteger(udg_hash,id2, GEMS_START_FOR_ARRAYS+2*MAX_GEMS_HASH_BONUSES + i) )
endif
set i = i + 1
endloop
call FlushChildHashtable(udg_hash,id2)
call RemoveItem(it2)
return it1
endfunction
private function InitializeFireGlyphItem takes item whichItem returns boolean
local integer i = 1
local integer j = 1
local integer id = GetHandleId(whichItem)
loop
exitwhen j>BASE_ITEMS_COUNT or FIRE_ITEMS[j]==GetItemTypeId(whichItem)
set j = j + 1
endloop
if j <= BASE_ITEMS_COUNT then
call FlushChildHashtable(udg_hash,id)
call SaveBoolean(udg_hash,id,ISINITIALIZED_HASH,true)
call SaveInteger(udg_hash,id,ORIGIN_TYPE_HASH,j)
call SaveInteger(udg_hash,id,GLYPH_TYPE_HASH,1)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item ATTACKPOWER bonus: +" + I2S(BONUSES[j].ATTACKPOWER))
call SaveInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH, FIRE_BONUSES[j].ATTACKPOWER )
call SaveInteger(udg_hash,id,ARMOR_BONUS_HASH, FIRE_BONUSES[j].ARMOR )
call SaveInteger(udg_hash,id,STAMINA_BONUS_HASH, FIRE_BONUSES[j].STAMINA )
call SaveInteger(udg_hash,id,EXPERTISE_BONUS_HASH, FIRE_BONUSES[j].EXPERTISE )
call SaveInteger(udg_hash,id,SPIRIT_BONUS_HASH, FIRE_BONUSES[j].SPIRIT )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item CUSTOMNUMBER: +" + I2S(BONUSES[j].CUSTOMBONUSES_NUMBER))
call SaveInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH,FIRE_BONUSES[j].CUSTOMBONUSES_NUMBER)
set i = 0
loop
exitwhen i>FIRE_BONUSES[j].CUSTOMBONUSES_NUMBER-1
call SaveBoolean(udg_hash,id,START_FOR_ARRAYS+i,FIRE_BONUSES[j].ROI[i+1])
call SaveReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i,FIRE_BONUSES[j].R[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i,FIRE_BONUSES[j].I[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i,FIRE_BONUSES[j].HASH[i+1])
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item BONUS: " + R2S(BONUSES[j].R[i+1]) + " in HASH: " + I2S(BONUSES[j].HASH[i+1]))
set i = i +1
endloop
//call SaveInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH,0)
return true
else
return false
endif
endfunction
private function InitializeFrostGlyphItem takes item whichItem returns boolean
local integer i = 1
local integer j = 1
local integer id = GetHandleId(whichItem)
loop
exitwhen j>BASE_ITEMS_COUNT or FROST_ITEMS[j]==GetItemTypeId(whichItem)
set j = j + 1
endloop
if j <= BASE_ITEMS_COUNT then
call FlushChildHashtable(udg_hash,id)
call SaveBoolean(udg_hash,id,ISINITIALIZED_HASH,true)
call SaveInteger(udg_hash,id,ORIGIN_TYPE_HASH,j)
call SaveInteger(udg_hash,id,GLYPH_TYPE_HASH,2)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item ATTACKPOWER bonus: +" + I2S(BONUSES[j].ATTACKPOWER))
call SaveInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH, FROST_BONUSES[j].ATTACKPOWER )
call SaveInteger(udg_hash,id,ARMOR_BONUS_HASH, FROST_BONUSES[j].ARMOR )
call SaveInteger(udg_hash,id,STAMINA_BONUS_HASH, FROST_BONUSES[j].STAMINA )
call SaveInteger(udg_hash,id,EXPERTISE_BONUS_HASH, FROST_BONUSES[j].EXPERTISE )
call SaveInteger(udg_hash,id,SPIRIT_BONUS_HASH, FROST_BONUSES[j].SPIRIT )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item CUSTOMNUMBER: +" + I2S(BONUSES[j].CUSTOMBONUSES_NUMBER))
call SaveInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH,FROST_BONUSES[j].CUSTOMBONUSES_NUMBER)
set i = 0
loop
exitwhen i>FROST_BONUSES[j].CUSTOMBONUSES_NUMBER-1
call SaveBoolean(udg_hash,id,START_FOR_ARRAYS+i,FROST_BONUSES[j].ROI[i+1])
call SaveReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i,FROST_BONUSES[j].R[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i,FROST_BONUSES[j].I[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i,FROST_BONUSES[j].HASH[i+1])
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item BONUS: " + R2S(BONUSES[j].R[i+1]) + " in HASH: " + I2S(BONUSES[j].HASH[i+1]))
set i = i +1
endloop
//call SaveInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH,0)
return true
else
return false
endif
endfunction
private function InitializeCorruptGlyphItem takes item whichItem returns boolean
local integer i = 1
local integer j = 1
local integer id = GetHandleId(whichItem)
loop
exitwhen j>BASE_ITEMS_COUNT or CORRUPT_ITEMS[j]==GetItemTypeId(whichItem)
set j = j + 1
endloop
if j <= BASE_ITEMS_COUNT then
call FlushChildHashtable(udg_hash,id)
call SaveBoolean(udg_hash,id,ISINITIALIZED_HASH,true)
call SaveInteger(udg_hash,id,ORIGIN_TYPE_HASH,j)
call SaveInteger(udg_hash,id,GLYPH_TYPE_HASH,3)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item ATTACKPOWER bonus: +" + I2S(BONUSES[j].ATTACKPOWER))
call SaveInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH, CORRUPT_BONUSES[j].ATTACKPOWER )
call SaveInteger(udg_hash,id,ARMOR_BONUS_HASH, CORRUPT_BONUSES[j].ARMOR )
call SaveInteger(udg_hash,id,STAMINA_BONUS_HASH, CORRUPT_BONUSES[j].STAMINA )
call SaveInteger(udg_hash,id,EXPERTISE_BONUS_HASH, CORRUPT_BONUSES[j].EXPERTISE )
call SaveInteger(udg_hash,id,SPIRIT_BONUS_HASH, CORRUPT_BONUSES[j].SPIRIT )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item CUSTOMNUMBER: +" + I2S(BONUSES[j].CUSTOMBONUSES_NUMBER))
call SaveInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH,CORRUPT_BONUSES[j].CUSTOMBONUSES_NUMBER)
set i = 0
loop
exitwhen i>CORRUPT_BONUSES[j].CUSTOMBONUSES_NUMBER-1
call SaveBoolean(udg_hash,id,START_FOR_ARRAYS+i,CORRUPT_BONUSES[j].ROI[i+1])
call SaveReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i,CORRUPT_BONUSES[j].R[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i,CORRUPT_BONUSES[j].I[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i,CORRUPT_BONUSES[j].HASH[i+1])
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item BONUS: " + R2S(BONUSES[j].R[i+1]) + " in HASH: " + I2S(BONUSES[j].HASH[i+1]))
set i = i +1
endloop
//call SaveInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH,0)
return true
else
return false
endif
endfunction
private function InitializeTigerGlyphItem takes item whichItem returns boolean
local integer i = 1
local integer j = 1
local integer id = GetHandleId(whichItem)
loop
exitwhen j>BASE_ITEMS_COUNT or TIGER_ITEMS[j]==GetItemTypeId(whichItem)
set j = j + 1
endloop
if j <= BASE_ITEMS_COUNT then
call FlushChildHashtable(udg_hash,id)
call SaveBoolean(udg_hash,id,ISINITIALIZED_HASH,true)
call SaveInteger(udg_hash,id,ORIGIN_TYPE_HASH,j)
call SaveInteger(udg_hash,id,GLYPH_TYPE_HASH,4)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item ATTACKPOWER bonus: +" + I2S(BONUSES[j].ATTACKPOWER))
call SaveInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH, TIGER_BONUSES[j].ATTACKPOWER )
call SaveInteger(udg_hash,id,ARMOR_BONUS_HASH, TIGER_BONUSES[j].ARMOR )
call SaveInteger(udg_hash,id,STAMINA_BONUS_HASH, TIGER_BONUSES[j].STAMINA )
call SaveInteger(udg_hash,id,EXPERTISE_BONUS_HASH,TIGER_BONUSES[j].EXPERTISE )
call SaveInteger(udg_hash,id,SPIRIT_BONUS_HASH, TIGER_BONUSES[j].SPIRIT )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item CUSTOMNUMBER: +" + I2S(BONUSES[j].CUSTOMBONUSES_NUMBER))
call SaveInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH,TIGER_BONUSES[j].CUSTOMBONUSES_NUMBER)
set i = 0
loop
exitwhen i>CORRUPT_BONUSES[j].CUSTOMBONUSES_NUMBER-1
call SaveBoolean(udg_hash,id,START_FOR_ARRAYS+i,TIGER_BONUSES[j].ROI[i+1])
call SaveReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i,TIGER_BONUSES[j].R[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i,TIGER_BONUSES[j].I[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i,TIGER_BONUSES[j].HASH[i+1])
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item BONUS: " + R2S(BONUSES[j].R[i+1]) + " in HASH: " + I2S(BONUSES[j].HASH[i+1]))
set i = i +1
endloop
//call SaveInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH,0)
return true
else
return false
endif
endfunction
function InitializeGlyphItem takes item whichItem returns boolean
local integer i = 1
loop
exitwhen i > BASE_ITEMS_COUNT or FIRE_ITEMS[i]==GetItemTypeId(whichItem)
set i = i + 1
endloop
if i<=BASE_ITEMS_COUNT then
return InitializeFireGlyphItem(whichItem)
endif
set i = 1
loop
exitwhen i > BASE_ITEMS_COUNT or FROST_ITEMS[i]==GetItemTypeId(whichItem)
set i = i + 1
endloop
if i<=BASE_ITEMS_COUNT then
return InitializeFrostGlyphItem(whichItem)
endif
set i = 1
loop
exitwhen i > BASE_ITEMS_COUNT or CORRUPT_ITEMS[i]==GetItemTypeId(whichItem)
set i = i + 1
endloop
if i<=BASE_ITEMS_COUNT then
return InitializeCorruptGlyphItem(whichItem)
endif
set i = 1
loop
exitwhen i > BASE_ITEMS_COUNT or TIGER_ITEMS[i]==GetItemTypeId(whichItem)
set i = i + 1
endloop
if i<=BASE_ITEMS_COUNT then
return InitializeTigerGlyphItem(whichItem)
endif
return false
endfunction
function InitializeBaseItem takes item whichItem returns boolean
local integer j = IsItemBasic(whichItem)
local integer id = GetHandleId(whichItem)
local integer i = 0
if j <= BASE_ITEMS_COUNT then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Original item found: " + I2S(j) + " with ID: " + I2S(id))
call FlushChildHashtable(udg_hash,id)
call SaveBoolean(udg_hash,id,ISINITIALIZED_HASH,true)
call SaveInteger(udg_hash,id,ORIGIN_TYPE_HASH,j)
call SaveInteger(udg_hash,id,GLYPH_TYPE_HASH,-1)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item ATTACKPOWER bonus: +" + I2S(BONUSES[j].ATTACKPOWER))
call SaveInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH, BONUSES[j].ATTACKPOWER )
call SaveInteger(udg_hash,id,ARMOR_BONUS_HASH, BONUSES[j].ARMOR )
call SaveInteger(udg_hash,id,STAMINA_BONUS_HASH, BONUSES[j].STAMINA )
call SaveInteger(udg_hash,id,EXPERTISE_BONUS_HASH, BONUSES[j].EXPERTISE )
call SaveInteger(udg_hash,id,SPIRIT_BONUS_HASH, BONUSES[j].SPIRIT )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item CUSTOMNUMBER: +" + I2S(BONUSES[j].CUSTOMBONUSES_NUMBER))
call SaveInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH,BONUSES[j].CUSTOMBONUSES_NUMBER)
set i = 0
loop
exitwhen i>BONUSES[j].CUSTOMBONUSES_NUMBER-1
call SaveBoolean(udg_hash,id,START_FOR_ARRAYS+i,BONUSES[j].ROI[i+1])
call SaveReal(udg_hash,id,START_FOR_ARRAYS+MAX_HASH_BONUSES+i,BONUSES[j].R[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i,BONUSES[j].I[i+1])
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i,BONUSES[j].HASH[i+1])
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to item BONUS: " + R2S(BONUSES[j].R[i+1]) + " in HASH: " + I2S(BONUSES[j].HASH[i+1]))
set i = i +1
endloop
if j == 12 then //if key
call SaveInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH,2)
endif
return true
endif
return false
endfunction
function UnitApplyItemBonuses takes unit whichUnit, item whichItem returns nothing
local integer idPicker = GetHandleId(whichUnit)
local integer idItem = GetHandleId(whichItem)
local integer N = LoadInteger(udg_hash,idItem,CUSTOMBONUSES_NUMBER_HASH)
local integer GEMS_N = LoadInteger(udg_hash,idItem,GEMS_CUSTOMBONUSES_NUMBER_HASH)
local integer ATTACKPOWER = LoadInteger(udg_hash,idItem, ATTACK_POWER_BONUS_HASH)
local integer ARMOR = LoadInteger(udg_hash,idItem, ARMOR_BONUS_HASH)
local integer STAMINA = LoadInteger(udg_hash,idItem,STAMINA_BONUS_HASH)
local integer EXPERTISE = LoadInteger(udg_hash,idItem,EXPERTISE_BONUS_HASH)
local integer SPIRIT = LoadInteger(udg_hash,idItem,SPIRIT_BONUS_HASH)
local integer GEMS_ATTACKPOWER = LoadInteger(udg_hash,idItem, GEMS_ATTACK_POWER_BONUS_HASH)
local integer GEMS_ARMOR = LoadInteger(udg_hash,idItem, GEMS_ARMOR_BONUS_HASH)
local integer GEMS_STAMINA = LoadInteger(udg_hash,idItem,GEMS_STAMINA_BONUS_HASH)
local integer GEMS_EXPERTISE = LoadInteger(udg_hash,idItem,GEMS_EXPERTISE_BONUS_HASH)
local integer GEMS_SPIRIT = LoadInteger(udg_hash,idItem,GEMS_SPIRIT_BONUS_HASH)
local integer i =0
local real tempr = 0.
local integer tempi = 0
local integer HASH = 0
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Applying to UNIT ATTACKPOWER bonus: +" + I2S(ATTACKPOWER))
call BlzSetUnitBaseDamage(whichUnit,BlzGetUnitBaseDamage(whichUnit,0) + ATTACKPOWER+GEMS_ATTACKPOWER,0)
call BlzSetUnitArmor(whichUnit,BlzGetUnitArmor(whichUnit)+ARMOR+GEMS_ARMOR)
if IsUnitType(whichUnit,UNIT_TYPE_HERO) then
call SetHeroStr(whichUnit,GetHeroStr(whichUnit,false)+STAMINA+GEMS_STAMINA,true)
call SetHeroAgi(whichUnit,GetHeroAgi(whichUnit,false)+EXPERTISE+GEMS_EXPERTISE,true)
call SetHeroInt(whichUnit,GetHeroInt(whichUnit,false)+SPIRIT+GEMS_SPIRIT,true)
endif
set i = 0
loop
exitwhen i>N-1
set HASH = LoadInteger(udg_hash,idItem,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i)
if LoadBoolean(udg_hash,idItem,START_FOR_ARRAYS+i) then
set tempr = LoadReal(udg_hash,idPicker,HASH)
call SaveReal(udg_hash,idPicker,HASH,tempr+LoadReal(udg_hash,idItem,START_FOR_ARRAYS+MAX_HASH_BONUSES+i))
else
set tempi = LoadInteger(udg_hash,idPicker,HASH)
call SaveInteger(udg_hash,idPicker,HASH,tempi+LoadInteger(udg_hash,idItem,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i))
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i>GEMS_N-1
set HASH = LoadInteger(udg_hash,idItem,GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES+i)
if LoadBoolean(udg_hash,idItem,GEMS_START_FOR_ARRAYS+i) then
set tempr = LoadReal(udg_hash,idPicker,HASH)
call SaveReal(udg_hash,idPicker,HASH,tempr+LoadReal(udg_hash,idItem,GEMS_START_FOR_ARRAYS+MAX_GEMS_HASH_BONUSES+i))
else
set tempi = LoadInteger(udg_hash,idPicker,HASH)
call SaveInteger(udg_hash,idPicker,HASH,tempi+LoadInteger(udg_hash,idItem,GEMS_START_FOR_ARRAYS+2*MAX_GEMS_HASH_BONUSES+i))
endif
set i = i + 1
endloop
endfunction
function UnitRemoveItemBonuses takes unit whichUnit, item whichItem returns nothing
local integer idPicker = GetHandleId(whichUnit)
local integer idItem = GetHandleId(whichItem)
local integer N = LoadInteger(udg_hash,idItem,CUSTOMBONUSES_NUMBER_HASH)
local integer GEMS_N = LoadInteger(udg_hash,idItem,GEMS_CUSTOMBONUSES_NUMBER_HASH)
local integer ATTACKPOWER = LoadInteger(udg_hash,idItem, ATTACK_POWER_BONUS_HASH)
local integer ARMOR = LoadInteger(udg_hash,idItem, ARMOR_BONUS_HASH)
local integer STAMINA = LoadInteger(udg_hash,idItem,STAMINA_BONUS_HASH)
local integer EXPERTISE = LoadInteger(udg_hash,idItem,EXPERTISE_BONUS_HASH)
local integer SPIRIT = LoadInteger(udg_hash,idItem,SPIRIT_BONUS_HASH)
local integer GEMS_ATTACKPOWER = LoadInteger(udg_hash,idItem, GEMS_ATTACK_POWER_BONUS_HASH)
local integer GEMS_ARMOR = LoadInteger(udg_hash,idItem, GEMS_ARMOR_BONUS_HASH)
local integer GEMS_STAMINA = LoadInteger(udg_hash,idItem,GEMS_STAMINA_BONUS_HASH)
local integer GEMS_EXPERTISE = LoadInteger(udg_hash,idItem,GEMS_EXPERTISE_BONUS_HASH)
local integer GEMS_SPIRIT = LoadInteger(udg_hash,idItem,GEMS_SPIRIT_BONUS_HASH)
local integer i =0
local real tempr = 0.
local integer tempi = 0
local integer HASH = 0
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Removing to UNIT ATTACKPOWER bonus: -" + I2S(ATTACKPOWER))
call BlzSetUnitBaseDamage(whichUnit,BlzGetUnitBaseDamage(whichUnit,0) - ATTACKPOWER - GEMS_ATTACKPOWER,0)
call BlzSetUnitArmor(whichUnit,BlzGetUnitArmor(whichUnit)-ARMOR-GEMS_ARMOR)
if IsUnitType(whichUnit,UNIT_TYPE_HERO) then
call SetHeroStr(whichUnit,GetHeroStr(whichUnit,false)-STAMINA-GEMS_STAMINA,true)
call SetHeroAgi(whichUnit,GetHeroAgi(whichUnit,false)-EXPERTISE-GEMS_EXPERTISE,true)
call SetHeroInt(whichUnit,GetHeroInt(whichUnit,false)-SPIRIT-GEMS_SPIRIT,true)
endif
set i = 0
loop
exitwhen i>N-1
set HASH = LoadInteger(udg_hash,idItem,START_FOR_ARRAYS+3*MAX_HASH_BONUSES+i)
if LoadBoolean(udg_hash,idItem,START_FOR_ARRAYS+i) then
set tempr = LoadReal(udg_hash,idPicker,HASH)
call SaveReal(udg_hash,idPicker,HASH,tempr-LoadReal(udg_hash,idItem,START_FOR_ARRAYS+MAX_HASH_BONUSES+i))
else
set tempi = LoadInteger(udg_hash,idPicker,HASH)
call SaveInteger(udg_hash,idPicker,HASH,tempi-LoadInteger(udg_hash,idItem,START_FOR_ARRAYS+2*MAX_HASH_BONUSES+i))
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i>GEMS_N-1
set HASH = LoadInteger(udg_hash,idItem,GEMS_START_FOR_ARRAYS+3*MAX_GEMS_HASH_BONUSES+i)
if LoadBoolean(udg_hash,idItem,GEMS_START_FOR_ARRAYS+i) then
set tempr = LoadReal(udg_hash,idPicker,HASH)
call SaveReal(udg_hash,idPicker,HASH,tempr-LoadReal(udg_hash,idItem,GEMS_START_FOR_ARRAYS+MAX_GEMS_HASH_BONUSES+i))
else
set tempi = LoadInteger(udg_hash,idPicker,HASH)
call SaveInteger(udg_hash,idPicker,HASH,tempi-LoadInteger(udg_hash,idItem,GEMS_START_FOR_ARRAYS+2*MAX_GEMS_HASH_BONUSES+i))
endif
set i = i + 1
endloop
endfunction
function GetItemTypeString takes item whichItem returns string
if IsItemInitialized(whichItem) then
return ITEMS_TYPE[LoadInteger(udg_hash,GetHandleId(whichItem),ORIGIN_TYPE_HASH)]
endif
return ""
endfunction
function ItemsHasSameParent takes item it1, item it2 returns boolean
if IsItemInitialized(it1) and IsItemInitialized(it2) then
return LoadInteger(udg_hash,GetHandleId(it1),ORIGIN_TYPE_HASH)==LoadInteger(udg_hash,GetHandleId(it2),ORIGIN_TYPE_HASH)
endif
return false
endfunction
function ItemUpgradeStats takes item whichItem, real coeff, boolean withAbils, boolean levelIncrease returns nothing
local integer id = GetHandleId(whichItem)
local integer N = LoadInteger(udg_hash,id,CUSTOMBONUSES_NUMBER_HASH)
local integer ATTACKPOWER = LoadInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH)
local integer ARMOR = LoadInteger(udg_hash,id,ARMOR_BONUS_HASH)
local integer STAMINA = LoadInteger(udg_hash,id,STAMINA_BONUS_HASH)
local integer EXPERTISE = LoadInteger(udg_hash,id,EXPERTISE_BONUS_HASH)
local integer SPIRIT = LoadInteger(udg_hash,id,SPIRIT_BONUS_HASH)
local integer j = 0
call SaveInteger(udg_hash,id,ATTACK_POWER_BONUS_HASH,R2I(ATTACKPOWER*(1+coeff)))
call SaveInteger(udg_hash,id,ARMOR_BONUS_HASH,R2I(ARMOR*(1+coeff)))
call SaveInteger(udg_hash,id,STAMINA_BONUS_HASH,R2I(STAMINA*(1+coeff)))
call SaveInteger(udg_hash,id,EXPERTISE_BONUS_HASH,R2I(EXPERTISE*(1+coeff)))
call SaveInteger(udg_hash,id,SPIRIT_BONUS_HASH,R2I(SPIRIT*(1+coeff)))
if levelIncrease then
call SaveInteger(udg_hash,id,UPGRADES_COUNTER_HASH,LoadInteger(udg_hash,id,UPGRADES_COUNTER_HASH)+1)
endif
loop
exitwhen j>N-1
if LoadBoolean(udg_hash,id, START_FOR_ARRAYS+j) then
call SaveReal(udg_hash,id,START_FOR_ARRAYS+j+MAX_HASH_BONUSES, LoadReal(udg_hash,id,START_FOR_ARRAYS+j+MAX_HASH_BONUSES) * (1+coeff))
else
if withAbils then
call SaveInteger(udg_hash,id,START_FOR_ARRAYS+j+2*MAX_HASH_BONUSES, LoadInteger( udg_hash, id, START_FOR_ARRAYS+j+2*MAX_HASH_BONUSES ) + 1)
endif
endif
set j = j + 1
endloop
if levelIncrease then
call SetItemCharges(whichItem,GetItemCharges(whichItem)+1)
endif
call SaveInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH,LoadInteger(udg_hash,id,GEMS_SOCKETS_NUMBER_HASH)+1)
endfunction
private function onTimerCheck takes nothing returns nothing
if not (BONUSES[1].HASH[1] == GetCritHash()) then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Hash changed to : " + I2S(BONUSES[1].HASH[1]))
endif
endfunction
private function onInit takes nothing returns nothing
//Steel Sword
set ITEMS_TYPE[1] = "WEAPON"
set BASE_ITEMS[1] = 'I000'
set FIRE_ITEMS[1] = 'I005'
set FROST_ITEMS[1] = 'I006'
set CORRUPT_ITEMS[1] = 'I007'
set TIGER_ITEMS[1] = 'I008'
set BONUSES[1] = itemBonuses.create()
set BONUSES[1].ATTACKPOWER = 30
set BONUSES[1].CUSTOMBONUSES_NUMBER = 1
set BONUSES[1].ROI[1] = true
set BONUSES[1].R[1] = 2.
set BONUSES[1].HASH[1] = GetCritHash()
set FIRE_BONUSES[1] = itemBonuses.create()
set FIRE_BONUSES[1].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[1].ROI[1] = true
set FIRE_BONUSES[1].ROI[2] = true
set FIRE_BONUSES[1].R[1] = 2.
set FIRE_BONUSES[1].HASH[1] = GetCritHash()
set FIRE_BONUSES[1].R[2] = 0.1
set FIRE_BONUSES[1].HASH[2] = GetSplashHash()
set FROST_BONUSES[1] = itemBonuses.create()
set FROST_BONUSES[1].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[1].ROI[1] = true
set FROST_BONUSES[1].ROI[2] = false
set FROST_BONUSES[1].R[1] = 2.
set FROST_BONUSES[1].HASH[1] = GetCritHash()
set FROST_BONUSES[1].I[2] = 1
set FROST_BONUSES[1].HASH[2] = GetArcweaverSpellSwordHash()
set CORRUPT_BONUSES[1] = itemBonuses.create()
set CORRUPT_BONUSES[1].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[1].ROI[1] = true
set CORRUPT_BONUSES[1].ROI[2] = true
set CORRUPT_BONUSES[1].R[1] = 2.
set CORRUPT_BONUSES[1].HASH[1] = GetCritHash()
set CORRUPT_BONUSES[1].R[2] = 0.15
set CORRUPT_BONUSES[1].HASH[2] = GetEnergyRegenBonusHash()
set TIGER_BONUSES[1] = itemBonuses.create()
set TIGER_BONUSES[1].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[1].ROI[1] = true
set TIGER_BONUSES[1].ROI[2] = true
set TIGER_BONUSES[1].R[1] = 2.
set TIGER_BONUSES[1].HASH[1] = GetCritHash()
set TIGER_BONUSES[1].R[2] = 0.1
set TIGER_BONUSES[1].HASH[2] = GetSelfHealingBonusHash()
//Axe of Mayhem
set ITEMS_TYPE[2] = "WEAPON"
set BASE_ITEMS[2] = 'I00L'
set FIRE_ITEMS[2] = 'I00M'
set FROST_ITEMS[2] = 'I00T'
set CORRUPT_ITEMS[2] = 'I00P'
set TIGER_ITEMS[2] = 'I00W'
set BONUSES[2] = itemBonuses.create()
set BONUSES[2].ATTACKPOWER = 20
set BONUSES[2].STAMINA = 5
set BONUSES[2].CUSTOMBONUSES_NUMBER = 1
set BONUSES[2].ROI[1] = true
set BONUSES[2].R[1] = 2.
set BONUSES[2].HASH[1] = GetCritHash()
set FIRE_BONUSES[2] = itemBonuses.create()
set FIRE_BONUSES[2].ATTACKPOWER = 10
set FIRE_BONUSES[2].STAMINA = 5
set FIRE_BONUSES[2].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[2].ROI[1] = true
set FIRE_BONUSES[2].ROI[2] = false
set FIRE_BONUSES[2].R[1] = 2.
set FIRE_BONUSES[2].HASH[1] = GetCritHash()
set FIRE_BONUSES[2].I[2] = 1
set FIRE_BONUSES[2].HASH[2] = GetFlameBreatherHash()
set FROST_BONUSES[2] = itemBonuses.create()
set FROST_BONUSES[2].ATTACKPOWER = 10
set FROST_BONUSES[2].STAMINA = 5
set FROST_BONUSES[2].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[2].ROI[1] = true
set FROST_BONUSES[2].ROI[2] = false
set FROST_BONUSES[2].R[1] = 2.
set FROST_BONUSES[2].HASH[1] = GetCritHash()
set FROST_BONUSES[2].I[2] = 1
set FROST_BONUSES[2].HASH[2] = GetHungeringColdHash()
set CORRUPT_BONUSES[2] = itemBonuses.create()
set CORRUPT_BONUSES[2].STAMINA = 5
set CORRUPT_BONUSES[2].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[2].ROI[1] = true
set CORRUPT_BONUSES[2].R[1] = 2.
set CORRUPT_BONUSES[2].HASH[1] = GetCritHash()
set CORRUPT_BONUSES[2].ROI[2] = false
set CORRUPT_BONUSES[2].I[2] = 1
set CORRUPT_BONUSES[2].HASH[2] = GetTroggbaneHash()
set TIGER_BONUSES[2] = itemBonuses.create()
set TIGER_BONUSES[2].ATTACKPOWER = 20
set TIGER_BONUSES[2].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[2].ROI[1] = true
set TIGER_BONUSES[2].R[1] = 2.
set TIGER_BONUSES[2].HASH[1] = GetCritHash()
set TIGER_BONUSES[2].ROI[2] = false
set TIGER_BONUSES[2].I[2] = 1
set TIGER_BONUSES[2].HASH[2] = GetKangHash()
//Adamantite Dagger
set ITEMS_TYPE[3] = "WEAPON"
set BASE_ITEMS[3] = 'I01C'
set FIRE_ITEMS[3] = 'I01J'
set FROST_ITEMS[3] = 'I01M'
set CORRUPT_ITEMS[3] = 'I01D'
set TIGER_ITEMS[3] = 'I01G'
set BONUSES[3] = itemBonuses.create()
set BONUSES[3].ATTACKPOWER = 25
set BONUSES[3].CUSTOMBONUSES_NUMBER = 1
set BONUSES[3].ROI[1] = true
set BONUSES[3].R[1] = 2.
set BONUSES[3].HASH[1] = GetHasteHash()
set FIRE_BONUSES[3] = itemBonuses.create()
set FIRE_BONUSES[3].ATTACKPOWER = 5
set FIRE_BONUSES[3].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[3].ROI[1] = true
set FIRE_BONUSES[3].ROI[2] = false
set FIRE_BONUSES[3].R[1] = 2.
set FIRE_BONUSES[3].HASH[1] = GetHasteHash()
set FIRE_BONUSES[3].I[2] = 1
set FIRE_BONUSES[3].HASH[2] = GetBladebreakerHash()
set FROST_BONUSES[3] = itemBonuses.create()
set FROST_BONUSES[3].ATTACKPOWER = 5
set FROST_BONUSES[3].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[3].ROI[1] = true
set FROST_BONUSES[3].ROI[2] = false
set FROST_BONUSES[3].R[1] = 2.
set FROST_BONUSES[3].HASH[1] = GetHasteHash()
set FROST_BONUSES[3].I[2] = 1
set FROST_BONUSES[3].HASH[2] = GetHeavensFallHash()
set CORRUPT_BONUSES[3] = itemBonuses.create()
set CORRUPT_BONUSES[3].ATTACKPOWER = 5
set CORRUPT_BONUSES[3].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[3].ROI[1] = true
set CORRUPT_BONUSES[3].ROI[2] = true
set CORRUPT_BONUSES[3].R[1] = 2.
set CORRUPT_BONUSES[3].HASH[1] = GetHasteHash()
set CORRUPT_BONUSES[3].R[2] = 0.1
set CORRUPT_BONUSES[3].HASH[2] = GetLifestealingHash()
set TIGER_BONUSES[3] = itemBonuses.create()
set TIGER_BONUSES[3].ATTACKPOWER = 5
set TIGER_BONUSES[3].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[3].ROI[1] = true
set TIGER_BONUSES[3].ROI[2] = true
set TIGER_BONUSES[3].R[1] = 2.
set TIGER_BONUSES[3].HASH[1] = GetHasteHash()
set TIGER_BONUSES[3].R[2] = 0.1
set TIGER_BONUSES[3].HASH[2] = GetBleedingDamageBonusHash()
//Mage's Scepter
set ITEMS_TYPE[4] = "WEAPON"
set BASE_ITEMS[4] = 'I00Z'
set FIRE_ITEMS[4] = 'I010'
set FROST_ITEMS[4] = 'I013'
set CORRUPT_ITEMS[4] = 'I016'
set TIGER_ITEMS[4] = 'I019'
set BONUSES[4] = itemBonuses.create()
set BONUSES[4].SPIRIT = 10
set BONUSES[4].CUSTOMBONUSES_NUMBER = 1
set BONUSES[4].ROI[1] = true
set BONUSES[4].R[1] = 25.
set BONUSES[4].HASH[1] = GetSpellPowerHash()
set FIRE_BONUSES[4] = itemBonuses.create()
set FIRE_BONUSES[4].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[4].ROI[1] = true
set FIRE_BONUSES[4].ROI[2] = false
set FIRE_BONUSES[4].R[1] = 25.
set FIRE_BONUSES[4].HASH[1] = GetSpellPowerHash()
set FIRE_BONUSES[4].I[2] = 1
set FIRE_BONUSES[4].HASH[2] = GetIncineratusHash()
set FROST_BONUSES[4] = itemBonuses.create()
set FROST_BONUSES[4].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[4].ROI[1] = true
set FROST_BONUSES[4].ROI[2] = false
set FROST_BONUSES[4].R[1] = 25.
set FROST_BONUSES[4].HASH[1] = GetSpellPowerHash()
set FROST_BONUSES[4].I[2] = 1
set FROST_BONUSES[4].HASH[2] = GetIcecoreStaffHash()
set CORRUPT_BONUSES[4] = itemBonuses.create()
set CORRUPT_BONUSES[4].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[4].ROI[1] = true
set CORRUPT_BONUSES[4].ROI[2] = false
set CORRUPT_BONUSES[4].R[1] = 25.
set CORRUPT_BONUSES[4].HASH[1] = GetSpellPowerHash()
set CORRUPT_BONUSES[4].I[2] = 1
set CORRUPT_BONUSES[4].HASH[2] = GetMaghariHash()
set TIGER_BONUSES[4] = itemBonuses.create()
set TIGER_BONUSES[4].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[4].ROI[1] = true
set TIGER_BONUSES[4].ROI[2] = true
set TIGER_BONUSES[4].R[1] = 25.
set TIGER_BONUSES[4].HASH[1] = GetSpellPowerHash()
set TIGER_BONUSES[4].R[2] = 0.05
set TIGER_BONUSES[4].HASH[2] = GetHealingBonusHash()
//Wooden Shield
set ITEMS_TYPE[5] = "ARMOR"
set BASE_ITEMS[5] = 'I01P'
set FIRE_ITEMS[5] = 'I01Q'
set FROST_ITEMS[5] = 'I01T'
set CORRUPT_ITEMS[5] = 'I01W'
set TIGER_ITEMS[5] = 'I01Z'
set BONUSES[5] = itemBonuses.create()
set BONUSES[5].ARMOR = 5
set BONUSES[5].CUSTOMBONUSES_NUMBER = 1
set BONUSES[5].ROI[1] = true
set BONUSES[5].R[1] = 2.
set BONUSES[5].HASH[1] = GetBlockChanceHash()
set FIRE_BONUSES[5] = itemBonuses.create()
set FIRE_BONUSES[5].ARMOR = 5
set FIRE_BONUSES[5].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[5].ROI[1] = true
set FIRE_BONUSES[5].ROI[2] = false
set FIRE_BONUSES[5].R[1] = 2.
set FIRE_BONUSES[5].HASH[1] = GetBlockChanceHash()
set FIRE_BONUSES[5].I[2] = 1
set FIRE_BONUSES[5].HASH[2] = GetSkullflameHash()
set FROST_BONUSES[5] = itemBonuses.create()
set FROST_BONUSES[5].ARMOR = 5
set FROST_BONUSES[5].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[5].ROI[1] = true
set FROST_BONUSES[5].ROI[2] = false
set FROST_BONUSES[5].R[1] = 2.
set FROST_BONUSES[5].HASH[1] = GetBlockChanceHash()
set FROST_BONUSES[5].I[2] = 1
set FROST_BONUSES[5].HASH[2] = GetBarrierShieldHash()
set CORRUPT_BONUSES[5] = itemBonuses.create()
set CORRUPT_BONUSES[5].ARMOR = 5
set CORRUPT_BONUSES[5].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[5].ROI[1] = true
set CORRUPT_BONUSES[5].ROI[2] = false
set CORRUPT_BONUSES[5].R[1] = 2.
set CORRUPT_BONUSES[5].HASH[1] = GetBlockChanceHash()
set CORRUPT_BONUSES[5].I[2] = 1
set CORRUPT_BONUSES[5].HASH[2] = GetWallOfTheDeadHash()
set TIGER_BONUSES[5] = itemBonuses.create()
set TIGER_BONUSES[5].ARMOR = 5
set TIGER_BONUSES[5].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[5].ROI[1] = true
set TIGER_BONUSES[5].ROI[2] = false
set TIGER_BONUSES[5].R[1] = 2.
set TIGER_BONUSES[5].HASH[1] = GetBlockChanceHash()
set TIGER_BONUSES[5].I[2] = 1
set TIGER_BONUSES[5].HASH[2] = GetSacredProtectorHash()
//Field Plate Armor
set ITEMS_TYPE[6] = "ARMOR"
set BASE_ITEMS[6] = 'I022'
set FIRE_ITEMS[6] = 'I023'
set FROST_ITEMS[6] = 'I026'
set CORRUPT_ITEMS[6] = 'I029'
set TIGER_ITEMS[6] = 'I02C'
set BONUSES[6] = itemBonuses.create()
set BONUSES[6].STAMINA = 5
set BONUSES[6].CUSTOMBONUSES_NUMBER = 1
set BONUSES[6].ROI[1] = true
set BONUSES[6].R[1] = 2.
set BONUSES[6].HASH[1] = GetEvasionHash()
set FIRE_BONUSES[6] = itemBonuses.create()
set FIRE_BONUSES[6].STAMINA = 5
set FIRE_BONUSES[6].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[6].ROI[1] = true
set FIRE_BONUSES[6].ROI[2] = false
set FIRE_BONUSES[6].R[1] = 2.
set FIRE_BONUSES[6].HASH[1] = GetEvasionHash()
set FIRE_BONUSES[6].I[2] = 1
set FIRE_BONUSES[6].HASH[2] = GetMagmaBreastplateHash()
set FROST_BONUSES[6] = itemBonuses.create()
set FROST_BONUSES[6].STAMINA = 5
set FROST_BONUSES[6].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[6].ROI[1] = true
set FROST_BONUSES[6].ROI[2] = false
set FROST_BONUSES[6].R[1] = 2.
set FROST_BONUSES[6].HASH[1] = GetEvasionHash()
set FROST_BONUSES[6].I[2] = 1
set FROST_BONUSES[6].HASH[2] = GetColdwraithPlateHash()
set CORRUPT_BONUSES[6] = itemBonuses.create()
set CORRUPT_BONUSES[6].STAMINA = 5
set CORRUPT_BONUSES[6].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[6].ROI[1] = true
set CORRUPT_BONUSES[6].ROI[2] = false
set CORRUPT_BONUSES[6].R[1] = 2.
set CORRUPT_BONUSES[6].HASH[1] = GetEvasionHash()
set CORRUPT_BONUSES[6].I[2] = 1
set CORRUPT_BONUSES[6].HASH[2] = GetAbominationRibcageHash()
set TIGER_BONUSES[6] = itemBonuses.create()
set TIGER_BONUSES[6].STAMINA = 5
set TIGER_BONUSES[6].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[6].ROI[1] = true
set TIGER_BONUSES[6].ROI[2] = false
set TIGER_BONUSES[6].R[1] = 2.
set TIGER_BONUSES[6].HASH[1] = GetEvasionHash()
set TIGER_BONUSES[6].I[2] = 1
set TIGER_BONUSES[6].HASH[2] = GetLightbringerChestguardHash()
//Runed Gloves
set ITEMS_TYPE[7] = "ARMOR"
set BASE_ITEMS[7] = 'I02U'
set FIRE_ITEMS[7] = 'I02T'
set FROST_ITEMS[7] = 'I02X'
set CORRUPT_ITEMS[7] = 'I030'
set TIGER_ITEMS[7] = 'I033'
set BONUSES[7] = itemBonuses.create()
set BONUSES[7].STAMINA = 5
set BONUSES[7].CUSTOMBONUSES_NUMBER = 1
set BONUSES[7].ROI[1] = true
set BONUSES[7].R[1] = 0.25
set BONUSES[7].HASH[1] = GetOutCombatHpMpRegenHash()
set FIRE_BONUSES[7] = itemBonuses.create()
set FIRE_BONUSES[7].STAMINA = 5
set FIRE_BONUSES[7].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[7].ROI[1] = true
set FIRE_BONUSES[7].ROI[2] = false
set FIRE_BONUSES[7].R[1] = 0.25
set FIRE_BONUSES[7].HASH[1] = GetOutCombatHpMpRegenHash()
set FIRE_BONUSES[7].I[2] = 1
set FIRE_BONUSES[7].HASH[2] = GetFirehandGauntletsHash()
set FROST_BONUSES[7] = itemBonuses.create()
set FROST_BONUSES[7].STAMINA = 5
set FROST_BONUSES[7].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[7].ROI[1] = true
set FROST_BONUSES[7].ROI[2] = false
set FROST_BONUSES[7].R[1] = 0.25
set FROST_BONUSES[7].HASH[1] = GetOutCombatHpMpRegenHash()
set FROST_BONUSES[7].I[2] = 1
set FROST_BONUSES[7].HASH[2] = GetFrostgiantGlovesHash()
set CORRUPT_BONUSES[7] = itemBonuses.create()
set CORRUPT_BONUSES[7].STAMINA = 5
set CORRUPT_BONUSES[7].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[7].ROI[1] = true
set CORRUPT_BONUSES[7].ROI[2] = false
set CORRUPT_BONUSES[7].R[1] = 0.25
set CORRUPT_BONUSES[7].HASH[1] = GetOutCombatHpMpRegenHash()
set CORRUPT_BONUSES[7].I[2] = 1
set CORRUPT_BONUSES[7].HASH[2] = GetDemonStalkerGauntletsHash()
set TIGER_BONUSES[7] = itemBonuses.create()
set TIGER_BONUSES[7].STAMINA = 5
set TIGER_BONUSES[7].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[7].ROI[1] = true
set TIGER_BONUSES[7].ROI[2] = false
set TIGER_BONUSES[7].R[1] = 0.25
set TIGER_BONUSES[7].HASH[1] = GetOutCombatHpMpRegenHash()
set TIGER_BONUSES[7].I[2] = 1
set TIGER_BONUSES[7].HASH[2] = GetGlovesOfHolyMightHash()
//Helm of Kings
set ITEMS_TYPE[8] = "ARMOR"
set BASE_ITEMS[8] = 'I036'
set FIRE_ITEMS[8] = 'I037'
set FROST_ITEMS[8] = 'I03A'
set CORRUPT_ITEMS[8] = 'I03D'
set TIGER_ITEMS[8] = 'I03G'
set BONUSES[8] = itemBonuses.create()
set BONUSES[8].STAMINA = 5
set BONUSES[8].CUSTOMBONUSES_NUMBER = 1
set BONUSES[8].ROI[1] = true
set BONUSES[8].R[1] = 0.03
set BONUSES[8].HASH[1] = GetSpellResistHash()
set FIRE_BONUSES[8] = itemBonuses.create()
set FIRE_BONUSES[8].STAMINA = 5
set FIRE_BONUSES[8].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[8].ROI[1] = true
set FIRE_BONUSES[8].ROI[2] = false
set FIRE_BONUSES[8].R[1] = 0.03
set FIRE_BONUSES[8].HASH[1] = GetSpellResistHash()
set FIRE_BONUSES[8].I[2] = 1
set FIRE_BONUSES[8].HASH[2] = GetDaybreakerHelmHash()
set FROST_BONUSES[8] = itemBonuses.create()
set FROST_BONUSES[8].STAMINA = 5
set FROST_BONUSES[8].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[8].ROI[1] = true
set FROST_BONUSES[8].ROI[2] = false
set FROST_BONUSES[8].R[1] = 0.03
set FROST_BONUSES[8].HASH[1] = GetSpellResistHash()
set FROST_BONUSES[8].I[2] = 1
set FROST_BONUSES[8].HASH[2] = GetFrostforgedHelmHash()
set CORRUPT_BONUSES[8] = itemBonuses.create()
set CORRUPT_BONUSES[8].STAMINA = 5
set CORRUPT_BONUSES[8].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[8].ROI[1] = true
set CORRUPT_BONUSES[8].ROI[2] = false
set CORRUPT_BONUSES[8].R[1] = 0.03
set CORRUPT_BONUSES[8].HASH[1] = GetSpellResistHash()
set CORRUPT_BONUSES[8].I[2] = 1
set CORRUPT_BONUSES[8].HASH[2] = GetBrokenRamHelmHash()
set TIGER_BONUSES[8] = itemBonuses.create()
set TIGER_BONUSES[8].STAMINA = 5
set TIGER_BONUSES[8].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[8].ROI[1] = true
set TIGER_BONUSES[8].ROI[2] = false
set TIGER_BONUSES[8].R[1] = 0.03
set TIGER_BONUSES[8].HASH[1] = GetSpellResistHash()
set TIGER_BONUSES[8].I[2] = 1
set TIGER_BONUSES[8].HASH[2] = GetElderMoonHelmHash()
//Broken Ring
set ITEMS_TYPE[9] = "ARMOR"
set BASE_ITEMS[9] = 'I00D'
set FIRE_ITEMS[9] = 'I00E'
set FROST_ITEMS[9] = 'I00F'
set CORRUPT_ITEMS[9] = 'I00G'
set TIGER_ITEMS[9] = 'I00H'
set BONUSES[9] = itemBonuses.create()
set BONUSES[9].SPIRIT = 5
set BONUSES[9].CUSTOMBONUSES_NUMBER = 1
set BONUSES[9].ROI[1] = true
set BONUSES[9].R[1] = 0.1
set BONUSES[9].HASH[1] = GetEnergyRegenBonusHash()
set FIRE_BONUSES[9] = itemBonuses.create()
set FIRE_BONUSES[9].SPIRIT = 5
set FIRE_BONUSES[9].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[9].ROI[1] = true
set FIRE_BONUSES[9].ROI[2] = true
set FIRE_BONUSES[9].R[1] = 0.05
set FIRE_BONUSES[9].HASH[1] = GetEnergyRegenBonusHash()
set FIRE_BONUSES[9].R[2] = 0.1
set FIRE_BONUSES[9].HASH[2] = GetElementalDamageBonusHash()
set FROST_BONUSES[9] = itemBonuses.create()
set FROST_BONUSES[9].SPIRIT = 5
set FROST_BONUSES[9].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[9].ROI[1] = true
set FROST_BONUSES[9].ROI[2] = false
set FROST_BONUSES[9].R[1] = 0.05
set FROST_BONUSES[9].HASH[1] = GetEnergyRegenBonusHash()
set FROST_BONUSES[9].I[2] = 1
set FROST_BONUSES[9].HASH[2] = GetFrostbroodSapphireRingHash()
set CORRUPT_BONUSES[9] = itemBonuses.create()
set CORRUPT_BONUSES[9].SPIRIT = 5
set CORRUPT_BONUSES[9].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[9].ROI[1] = true
set CORRUPT_BONUSES[9].ROI[2] = true
set CORRUPT_BONUSES[9].R[1] = 0.05
set CORRUPT_BONUSES[9].HASH[1] = GetEnergyRegenBonusHash()
set CORRUPT_BONUSES[9].R[2] = 0.15
set CORRUPT_BONUSES[9].HASH[2] = GetPeriodicDamageBonusHash()
set TIGER_BONUSES[9] = itemBonuses.create()
set TIGER_BONUSES[9].SPIRIT = 5
set TIGER_BONUSES[9].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[9].ROI[1] = true
set TIGER_BONUSES[9].ROI[2] = true
set TIGER_BONUSES[9].R[1] = 0.05
set TIGER_BONUSES[9].HASH[1] = GetEnergyRegenBonusHash()
set TIGER_BONUSES[9].R[2] = 5.
set TIGER_BONUSES[9].HASH[2] = GetPeriodicHealingCritHash()
//Iron-Bound Tome
set ITEMS_TYPE[10] = "WEAPON"
set BASE_ITEMS[10] = 'I00I'
set FIRE_ITEMS[10] = 'I00N'
set FROST_ITEMS[10] = 'I00J'
set CORRUPT_ITEMS[10] = 'I00K'
set TIGER_ITEMS[10] = 'I00O'
set BONUSES[10] = itemBonuses.create()
set BONUSES[10].SPIRIT = 5
set BONUSES[10].CUSTOMBONUSES_NUMBER = 1
set BONUSES[10].ROI[1] = true
set BONUSES[10].R[1] = 2.
set BONUSES[10].HASH[1] = GetSpellCritHash()
set FIRE_BONUSES[10] = itemBonuses.create()
set FIRE_BONUSES[10].SPIRIT = 5
set FIRE_BONUSES[10].CUSTOMBONUSES_NUMBER = 2
set FIRE_BONUSES[10].ROI[1] = true
set FIRE_BONUSES[10].ROI[2] = true
set FIRE_BONUSES[10].R[1] = 2.
set FIRE_BONUSES[10].HASH[1] = GetSpellCritHash()
set FIRE_BONUSES[10].R[2] = 0.15
set FIRE_BONUSES[10].HASH[2] = GetDotedUnitsSpellDamageBonusHash()
set FROST_BONUSES[10] = itemBonuses.create()
set FROST_BONUSES[10].SPIRIT = 5
set FROST_BONUSES[10].CUSTOMBONUSES_NUMBER = 2
set FROST_BONUSES[10].ROI[1] = true
set FROST_BONUSES[10].ROI[2] = false
set FROST_BONUSES[10].R[1] = 2.
set FROST_BONUSES[10].HASH[1] = GetSpellCritHash()
set FROST_BONUSES[10].I[2] = 1
set FROST_BONUSES[10].HASH[2] = GetTomeOfTheIceLordHash()
set CORRUPT_BONUSES[10] = itemBonuses.create()
set CORRUPT_BONUSES[10].SPIRIT = 5
set CORRUPT_BONUSES[10].CUSTOMBONUSES_NUMBER = 2
set CORRUPT_BONUSES[10].ROI[1] = true
set CORRUPT_BONUSES[10].ROI[2] = false
set CORRUPT_BONUSES[10].R[1] = 2.
set CORRUPT_BONUSES[10].HASH[1] = GetSpellCritHash()
set CORRUPT_BONUSES[10].I[2] = 1
set CORRUPT_BONUSES[10].HASH[2] = GetBookOfBindingWillHash()
set TIGER_BONUSES[10] = itemBonuses.create()
set TIGER_BONUSES[10].SPIRIT = 5
set TIGER_BONUSES[10].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[10].ROI[1] = true
set TIGER_BONUSES[10].ROI[2] = false
set TIGER_BONUSES[10].R[1] = 2.
set TIGER_BONUSES[10].HASH[1] = GetSpellCritHash()
set TIGER_BONUSES[10].I[2] = 1
set TIGER_BONUSES[10].HASH[2] = GetBookOfHighborneHymnsHash()
//Clay Figurine
set ITEMS_TYPE[11] = "ARMOR"
set BASE_ITEMS[11] = 'I00V'
set FIRE_ITEMS[11] = 'I00X'
set FROST_ITEMS[11] = 'I00Y'
set CORRUPT_ITEMS[11] = 'I011'
set TIGER_ITEMS[11] = 'I012'
set BONUSES[11] = itemBonuses.create()
set BONUSES[11].STAMINA = 8
set BONUSES[11].CUSTOMBONUSES_NUMBER = 1
set BONUSES[11].ROI[1] = true
set BONUSES[11].R[1] = -0.1
set BONUSES[11].HASH[1] = GetAggroMultiplierHash()
set FIRE_BONUSES[11] = itemBonuses.create()
set FIRE_BONUSES[11].STAMINA = 5
set FIRE_BONUSES[11].ATTACKPOWER = 12
set FIRE_BONUSES[11].EXPERTISE = 7
set FIRE_BONUSES[11].CUSTOMBONUSES_NUMBER = 1
set FIRE_BONUSES[11].ROI[1] = true
set FIRE_BONUSES[11].R[1] = -0.05
set FIRE_BONUSES[11].HASH[1] = GetAggroMultiplierHash()
set FROST_BONUSES[11] = itemBonuses.create()
set FROST_BONUSES[11].STAMINA = 5
set FROST_BONUSES[11].CUSTOMBONUSES_NUMBER = 3
set FROST_BONUSES[11].ROI[1] = true
set FROST_BONUSES[11].R[1] = -0.05
set FROST_BONUSES[11].HASH[1] = GetAggroMultiplierHash()
set FROST_BONUSES[11].ROI[2] = true
set FROST_BONUSES[11].R[2] = 10
set FROST_BONUSES[11].HASH[2] = GetSpellPowerHash()
set FROST_BONUSES[11].ROI[3] = true
set FROST_BONUSES[11].R[3] = 0.05
set FROST_BONUSES[11].HASH[3] = GetSpellResistHash()
set CORRUPT_BONUSES[11] = itemBonuses.create()
set CORRUPT_BONUSES[11].STAMINA = 5
set CORRUPT_BONUSES[11].CUSTOMBONUSES_NUMBER = 3
set CORRUPT_BONUSES[11].ROI[1] = true
set CORRUPT_BONUSES[11].R[1] = -0.05
set CORRUPT_BONUSES[11].HASH[1] = GetAggroMultiplierHash()
set CORRUPT_BONUSES[11].ROI[2] = true
set CORRUPT_BONUSES[11].R[2] = 2.
set CORRUPT_BONUSES[11].HASH[2] = GetSpellCritHash()
set CORRUPT_BONUSES[11].ROI[3] = true
set CORRUPT_BONUSES[11].R[3] = 0.05
set CORRUPT_BONUSES[11].HASH[3] = GetReceivedHealingBonusHash()
set TIGER_BONUSES[11] = itemBonuses.create()
set TIGER_BONUSES[11].STAMINA = 5
set TIGER_BONUSES[11].SPIRIT = 8
set TIGER_BONUSES[11].CUSTOMBONUSES_NUMBER = 2
set TIGER_BONUSES[11].ROI[1] = true
set TIGER_BONUSES[11].R[1] = -0.05
set TIGER_BONUSES[11].HASH[1] = GetAggroMultiplierHash()
set TIGER_BONUSES[11].ROI[2] = true
set TIGER_BONUSES[11].R[2] = 0.05
set TIGER_BONUSES[11].HASH[2] = GetHealingBonusHash()
//Memorial Offering Key
set ITEMS_TYPE[12] = "WEAPON"
set BASE_ITEMS[12] = 'I015'
set FIRE_ITEMS[12] = 'I01H'
set FROST_ITEMS[12] = 'I01I'
set CORRUPT_ITEMS[12] = 'I01K'
set TIGER_ITEMS[12] = 'I01L'
set BONUSES[12] = itemBonuses.create()
set FIRE_BONUSES[12] = itemBonuses.create()
set FIRE_BONUSES[12].CUSTOMBONUSES_NUMBER = 1
set FIRE_BONUSES[12].ROI[1] = false
set FIRE_BONUSES[12].I[1] = 1
set FIRE_BONUSES[12].HASH[1] = GetScorchedScarletKeyHash()
set FROST_BONUSES[12] = itemBonuses.create()
set FROST_BONUSES[12].CUSTOMBONUSES_NUMBER = 1
set FROST_BONUSES[12].ROI[1] = false
set FROST_BONUSES[12].I[1] = 1
set FROST_BONUSES[12].HASH[1] = GetHollowSkeletonKeyHash()
set CORRUPT_BONUSES[12] = itemBonuses.create()
set CORRUPT_BONUSES[12].CUSTOMBONUSES_NUMBER = 1
set CORRUPT_BONUSES[12].ROI[1] = false
set CORRUPT_BONUSES[12].I[1] = 1
set CORRUPT_BONUSES[12].HASH[1] = GetTheNexusKeyHash()
set TIGER_BONUSES[12] = itemBonuses.create()
set TIGER_BONUSES[12].CUSTOMBONUSES_NUMBER = 1
set TIGER_BONUSES[12].ROI[1] = false
set TIGER_BONUSES[12].I[1] = 1
set TIGER_BONUSES[12].HASH[1] = GetInquisitionsMasterKeyHash()
//Empyrean Rune Fragment
set ITEMS_TYPE[13] = "WEAPON"
set BASE_ITEMS[13] = 'I027'
set FIRE_ITEMS[13] = 'I028'
set FROST_ITEMS[13] = 'I02A'
set CORRUPT_ITEMS[13] = 'I02B'
set TIGER_ITEMS[13] = 'I02D'
set BONUSES[13] = itemBonuses.create()
set BONUSES[13].EXPERTISE = 17
set FIRE_BONUSES[13] = itemBonuses.create()
set FIRE_BONUSES[13].CUSTOMBONUSES_NUMBER = 1
set FIRE_BONUSES[13].ROI[1] = false
set FIRE_BONUSES[13].I[1] = 1
set FIRE_BONUSES[13].HASH[1] = GetPulsingEarthRuneHash()
set FROST_BONUSES[13] = itemBonuses.create()
set FROST_BONUSES[13].CUSTOMBONUSES_NUMBER = 1
set FROST_BONUSES[13].ROI[1] = false
set FROST_BONUSES[13].I[1] = 1
set FROST_BONUSES[13].HASH[1] = GetMysteriousRuneHash()
set CORRUPT_BONUSES[13] = itemBonuses.create()
set CORRUPT_BONUSES[13].CUSTOMBONUSES_NUMBER = 1
set CORRUPT_BONUSES[13].ROI[1] = false
set CORRUPT_BONUSES[13].I[1] = 1
set CORRUPT_BONUSES[13].HASH[1] = GetSinisterRuneHash()
set TIGER_BONUSES[13] = itemBonuses.create()
set TIGER_BONUSES[13].CUSTOMBONUSES_NUMBER = 1
set TIGER_BONUSES[13].ROI[1] = false
set TIGER_BONUSES[13].I[1] = 1
set TIGER_BONUSES[13].HASH[1] = GetShimmeringRuneHash()
endfunction
endlibrary
library ItemsDescriptor initializer onInit requires ItemsInitializer
globals
private constant string GIVES_TEXT = "|c00804040Gives:|r"
private constant string ATTACK_POWER_TEXT = " Attack Power"
private constant string ARMOR_TEXT = " Armor"
private constant string STAMINA_TEXT = " Stamina"
private constant string EXPERTISE_TEXT = " Expertise"
private constant string SPIRIT_TEXT = " Spirit"
private constant string THREAT_GENERATION_TEXT = "% Threat generation"
private constant string DODGE_TEXT = "% Evasion"
private constant string SPLASH_TEXT = "% Splash"
private constant string CRIT_TEXT = "% Crit chance"
private constant string CRIT_MULTIPLIER_TEXT = "% Crit Power"
private constant string HASTE_TEXT = "% Haste"
private constant string BLOCK_CHANCE_TEXT = "% Block Chance"
private constant string BLOCK_AMOUNT_TEXT = " Block Amount"
private constant string SPELL_POWER_TEXT = " Spell Power"
private constant string SPELL_CRIT_TEXT = "% Spell Crit"
private constant string SPEL_RESIST_TEXT = "% Spell Resist"
private constant string LIFESTEALING_TEXT = "% Life-stealing"
private constant string ENERGY_REGENERATION_BONUS_TEXT = "% Energy Regen"
private constant string RAGE_REGENERATION_BONUS_TEXT = "% Rage Regen"
private constant string FOCUS_REGENERATION_BONUS_TEXT = "% Focus Regen"
private constant string RUNES_REGENERATION_BONUS_TEXT = "% Runes Regen"
private constant string MANA_REGENERATION_BONUS_TEXT = "% Mana Regen"
private constant string SELF_HEALING_BONUS_TEXT = "% Self-healing bonus"
private constant string HEALING_DONE_TEXT = "% Healing Done"
private constant string HEALING_RECEIVED_TEXT = "% Healing Received"
private constant string PERIODIC_HEALING_BONUS_TEXT = "% Periodic Healing Done"
private constant string HEALING_CRIT_MULTIPLIER_TEXT = "% Healing Crit Power"
private constant string PERIODIC_HEALING_CRIT_TEXT = "% Crit to periodic healing"
private constant string PERIODIC_DAMAGE_TEXT = "% Damage from DOTs"
private constant string OUT_COMBAT_HPMP_REGEN_TEXT = "% Out-combat HP/MP regen"
private constant string DOTED_UNITS_SPELL_DAMAGE_BONUS_TEXT = "% Spell damage to units with DOT effects"
private constant string FROST_DAMAGE_BONUS_TEXT = "% Frost damage"
private constant string FIRE_DAMAGE_BONUS_TEXT = "% Fire damage"
private constant string ARCANE_DAMAGE_BONUS_TEXT = "% Arcane damage"
private constant string WATER_DAMAGE_BONUS_TEXT = "% Water damage"
private constant string ELEMENTAL_DAMAGE_BONUS_TEXT = "% Elemental damage"
private constant string BLEEDING_DAMAGE_BONUS_TEXT = "% Bleeding damage"
endglobals
private function GetCustomParameterNameByHash takes integer hashId returns string
if hashId == GetCritHash() then
return CRIT_TEXT
endif
if hashId == GetEvasionHash() then
return DODGE_TEXT
endif
if hashId == GetHasteHash() then
return HASTE_TEXT
endif
if hashId == GetBlockChanceHash() then
return BLOCK_CHANCE_TEXT
endif
if hashId == GetBlockAmountHash() then
return BLOCK_AMOUNT_TEXT
endif
if hashId == GetSpellPowerHash() then
return SPELL_POWER_TEXT
endif
if hashId == GetSpellCritHash() then
return SPELL_CRIT_TEXT
endif
if hashId == GetSpellResistHash() then
return SPEL_RESIST_TEXT
endif
if hashId == GetSplashHash() then
return SPLASH_TEXT
endif
if hashId == GetOutCombatHpMpRegenHash() then
return OUT_COMBAT_HPMP_REGEN_TEXT
endif
if hashId == GetEnergyRegenBonusHash() then
return ENERGY_REGENERATION_BONUS_TEXT
endif
if hashId == GetRageRegenBonusHash() then
return RAGE_REGENERATION_BONUS_TEXT
endif
if hashId == GetRunesRegenBonusHash() then
return RUNES_REGENERATION_BONUS_TEXT
endif
if hashId == GetManaRegenBonusHash() then
return MANA_REGENERATION_BONUS_TEXT
endif
if hashId == GetSelfHealingBonusHash() then
return SELF_HEALING_BONUS_TEXT
endif
if hashId == GetHealingBonusHash() then
return HEALING_DONE_TEXT
endif
if hashId == GetReceivedHealingBonusHash() then
return HEALING_RECEIVED_TEXT
endif
if hashId == GetLifestealingHash() then
return LIFESTEALING_TEXT
endif
if hashId == GetFrostDamageBonusHash() then
return FROST_DAMAGE_BONUS_TEXT
endif
if hashId == GetFireDamageBonusHash() then
return FIRE_DAMAGE_BONUS_TEXT
endif
if hashId == GetArcaneDamageBonusHash() then
return ARCANE_DAMAGE_BONUS_TEXT
endif
if hashId == GetWaterDamageBonusHash() then
return WATER_DAMAGE_BONUS_TEXT
endif
if hashId == GetElementalDamageBonusHash() then
return ELEMENTAL_DAMAGE_BONUS_TEXT
endif
if hashId == GetBleedingDamageBonusHash() then
return BLEEDING_DAMAGE_BONUS_TEXT
endif
if hashId == GetPeriodicHealingCritHash() then
return PERIODIC_HEALING_CRIT_TEXT
endif
if hashId == GetPeriodicDamageBonusHash() then
return PERIODIC_DAMAGE_TEXT
endif
if hashId == GetDotedUnitsSpellDamageBonusHash() then
return DOTED_UNITS_SPELL_DAMAGE_BONUS_TEXT
endif
if hashId == GetAggroMultiplierHash() then
return THREAT_GENERATION_TEXT
endif
if hashId == GetCritMultiplierHash() then
return CRIT_MULTIPLIER_TEXT
endif
if hashId == GetPeriodicHealingBonusHash() then
return PERIODIC_HEALING_BONUS_TEXT
endif
if hashId == GetHealingCritMultiplierHash() then
return HEALING_CRIT_MULTIPLIER_TEXT
endif
return ""
endfunction
private function ConvertCustomParameterToInteger takes real value, integer hashId returns integer
if hashId == GetSplashHash() or hashId == GetLifestealingHash() or hashId == GetHealingBonusHash() or hashId == GetReceivedHealingBonusHash() or hashId == GetOutCombatHpMpRegenHash() or hashId == GetSpellResistHash() or hashId == GetCritMultiplierHash() or hashId == GetPeriodicHealingBonusHash() or hashId == GetHealingCritMultiplierHash() then
return R2I(value*100)
endif
if hashId == GetEnergyRegenBonusHash() or hashId == GetRageRegenBonusHash() or hashId == GetManaRegenBonusHash() or hashId == GetRunesRegenBonusHash() or hashId == GetSelfHealingBonusHash() then
return R2I(value*100)
endif
if hashId == GetFrostDamageBonusHash() or hashId == GetFireDamageBonusHash() or hashId == GetWaterDamageBonusHash() or hashId == GetArcaneDamageBonusHash() or hashId == GetElementalDamageBonusHash() or hashId == GetBleedingDamageBonusHash() then
return R2I(value*100)
endif
if hashId == GetDotedUnitsSpellDamageBonusHash() or hashId == GetPeriodicDamageBonusHash() or hashId == GetAggroMultiplierHash() then
return R2I(value*100)
endif
return R2I(value)
endfunction
private function GetAbilityDescriptionByHashAndLevel takes integer hashId, integer lvl returns string
if hashId==GetKangHash() then
return GetKangDescriptionByLevel(lvl)
endif
if hashId==GetFlameBreatherHash() then
return GetFlameBreatherDescriptionByLevel(lvl)
endif
if hashId==GetHungeringColdHash() then
return GetHungeringColdDescriptionByLevel(lvl)
endif
if hashId==GetTroggbaneHash() then
return GetTroggbaneDescriptionByLevel(lvl)
endif
if hashId==GetBladebreakerHash() then
return GetBladebreakerDescriptionByLevel(lvl)
endif
if hashId==GetHeavensFallHash() then
return GetHeavensFallDescriptionByLevel(lvl)
endif
if hashId==GetIncineratusHash() then
return GetIncineratusDescriptionByLevel(lvl)
endif
if hashId==GetMaghariHash() then
return GetMaghariDescriptionByLevel(lvl)
endif
if hashId==GetIcecoreStaffHash() then
return GetIcecoreStaffDescriptionByLevel(lvl)
endif
if hashId==GetSkullflameHash() then
return GetSkullflameDescriptionByLevel(lvl)
endif
if hashId==GetWallOfTheDeadHash() then
return GetWallOfTheDeadDescriptionByLevel(lvl)
endif
if hashId==GetBarrierShieldHash() then
return GetBarrierShieldDescriptionByLevel(lvl)
endif
if hashId==GetSacredProtectorHash() then
return GetSacredProtectorDescriptionByLevel(lvl)
endif
if hashId==GetMagmaBreastplateHash() then
return GetMagmaBreastplateDescriptionByLevel(lvl)
endif
if hashId==GetColdwraithPlateHash() then
return GetColdwraithPlateDescriptionByLevel(lvl)
endif
if hashId==GetAbominationRibcageHash() then
return GetAbominationRibcageDescriptionByLevel(lvl)
endif
if hashId==GetLightbringerChestguardHash() then
return GetLightbringerChestguardDescriptionByLevel(lvl)
endif
if hashId==GetFirehandGauntletsHash() then
return GetFirehandGauntletsDescriptionByLevel(lvl)
endif
if hashId==GetFrostgiantGlovesHash() then
return GetFrostgiantGlovesDescriptionByLevel(lvl)
endif
if hashId==GetDemonStalkerGauntletsHash() then
return GetDemonStalkerGauntletsDescriptionByLevel(lvl)
endif
if hashId==GetGlovesOfHolyMightHash() then
return GetGlovesOfHolyMightDescriptionByLevel(lvl)
endif
if hashId==GetDaybreakerHelmHash() then
return GetDaybreakerHelmDescriptionByLevel(lvl)
endif
if hashId==GetFrostforgedHelmHash() then
return GetFrostforgedHelmDescriptionByLevel(lvl)
endif
if hashId==GetBrokenRamHelmHash() then
return GetBrokenRamHelmDescriptionByLevel(lvl)
endif
if hashId==GetElderMoonHelmHash() then
return GetElderMoonHelmDescriptionByLevel(lvl)
endif
if hashId==GetFrostbroodSapphireRingHash() then
return GetFrostbroodSapphireRingDescriptionByLevel(lvl)
endif
if hashId==GetTomeOfTheIceLordHash() then
return GetTomeOfTheIceLordDescriptionByLevel(lvl)
endif
if hashId==GetBookOfBindingWillHash() then
return GetBookOfBindingWillDescriptionByLevel(lvl)
endif
if hashId==GetBookOfHighborneHymnsHash() then
return GetBookOfHighborneHymnsDescriptionByLevel(lvl)
endif
if hashId==GetScorchedScarletKeyHash() then
return GetScorchedScarletKeyDescriptionByLevel(lvl)
endif
if hashId==GetHollowSkeletonKeyHash() then
return GetHollowSkeletonKeyDescriptionByLevel(lvl)
endif
if hashId==GetTheNexusKeyHash() then
return GetTheNexusKeyDescriptionByLevel(lvl)
endif
if hashId==GetInquisitionsMasterKeyHash() then
return GetInquisitionsMasterKeyDescriptionByLevel(lvl)
endif
if hashId==GetArcweaverSpellSwordHash() then
return GetArcweaverSpellSwordDescriptionByLevel(lvl)
endif
if hashId==GetSinisterRuneHash() then
return GetSinisterRuneDescriptionByLevel(lvl)
endif
if hashId==GetShimmeringRuneHash() then
return GetShimmeringRuneDescriptionByLevel(lvl)
endif
if hashId==GetPulsingEarthRuneHash() then
return GetPulsingEarthRuneDescriptionByLevel(lvl)
endif
if hashId==GetMysteriousRuneHash() then
return GetMysteriousRuneDescriptionByLevel(lvl)
endif
return ""
endfunction
private function GetParameterString takes integer value, string text returns string
if value < 0. then
return "|n-" +I2S(-value) + text
endif
return "|n+" +I2S(value) + text
endfunction
private function GetParameterStringShort takes integer value, string text returns string
if value < 0. then
return "-" +I2S(-value) + text + ","
endif
return "+" +I2S(value) + text + ","
endfunction
function ResetItemDescription takes item whichItem returns nothing
local integer id = GetHandleId(whichItem)
local string tail = ""
local string head = GIVES_TEXT
local itemBonuses itB = GetItemBonuses(whichItem)
local integer i = 1
local string temp = ""
local boolean marked = (GetItemXardasMarkType(whichItem)>0)
if GetItemTypeString(whichItem)=="WEAPON" then
set temp = "|c00FF5551Weapon Tier "
endif
if GetItemTypeString(whichItem)=="ARMOR" then
set temp = "|c00FF8040Armor Tier "
endif
//if the item is non-glyphed we keep its description of glyphs from the object editor
if GetItemGlyphType(whichItem)==-1 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Found a non-glyphed item with text:" + BlzGetItemExtendedTooltip(whichItem))
//set tail = "|n|n" +BlzGetItemExtendedTooltip(whichItem)
endif
if itB.ATTACKPOWER > 0 then
set head = head + GetParameterString(itB.ATTACKPOWER,ATTACK_POWER_TEXT)
endif
if itB.ARMOR > 0 then
set head = head + GetParameterString(itB.ARMOR,ARMOR_TEXT)
endif
if itB.STAMINA > 0 then
set head = head + GetParameterString(itB.STAMINA ,STAMINA_TEXT)
endif
if itB.EXPERTISE > 0 then
set head = head + GetParameterString(itB.EXPERTISE,EXPERTISE_TEXT)
endif
if itB.SPIRIT > 0 then
set head = head + GetParameterString(itB.SPIRIT,SPIRIT_TEXT)
endif
set i = 1
loop
exitwhen i>itB.CUSTOMBONUSES_NUMBER
if itB.ROI[i] then
set head = head + GetParameterString( ConvertCustomParameterToInteger(itB.R[i],itB.HASH[i]), GetCustomParameterNameByHash(itB.HASH[i]))
else
set head = head + "|n|n|cff80ff80Special ability:|r|n" + GetAbilityDescriptionByHashAndLevel( itB.HASH[i], itB.I[i] )
endif
set i = i + 1
endloop
if itB.GEMS_SOCKETS_NUMBER > 0 then
if itB.GEMS_INSERTED == 0 then
set head = head + "|n|n|cff80ff80Gem Sockets|r (|cff808080" + I2S(itB.GEMS_INSERTED) + "|r/|cff80ff80" + I2S(itB.GEMS_SOCKETS_NUMBER) + "|r)"
else
if itB.GEMS_INSERTED < itB.GEMS_SOCKETS_NUMBER then
set head = head + "|n|n|cff80ff80Inserted Gems|r (|cff808080" + I2S(itB.GEMS_INSERTED) + "|r/|cff80ff80" + I2S(itB.GEMS_SOCKETS_NUMBER) + "|r):"
else
set head = head + "|n|n|cff80ff80Inserted Gems|r (|cff80ff80" + I2S(itB.GEMS_INSERTED) + "|r/|cff80ff80" + I2S(itB.GEMS_SOCKETS_NUMBER) + "|r):"
endif
endif
endif
if itB.GEMS_ATTACKPOWER > 0 then
set head = head + GetParameterString(itB.GEMS_ATTACKPOWER,ATTACK_POWER_TEXT)
endif
if itB.GEMS_ARMOR > 0 then
set head = head + GetParameterString(itB.GEMS_ARMOR,ARMOR_TEXT)
endif
if itB.GEMS_STAMINA > 0 then
set head = head + GetParameterString(itB.GEMS_STAMINA ,STAMINA_TEXT)
endif
if itB.GEMS_EXPERTISE > 0 then
set head = head + GetParameterString(itB.GEMS_EXPERTISE,EXPERTISE_TEXT)
endif
if itB.GEMS_SPIRIT > 0 then
set head = head + GetParameterString(itB.GEMS_SPIRIT,SPIRIT_TEXT)
endif
set i = 1
loop
exitwhen i>itB.GEMS_CUSTOMBONUSES_NUMBER
if itB.GEMS_ROI[i] then
set head = head + GetParameterString( ConvertCustomParameterToInteger(itB.GEMS_R[i],itB.GEMS_HASH[i]), GetCustomParameterNameByHash(itB.GEMS_HASH[i]))
else
set head = head + "|n|n|cff80ff80Special ability:|r|n" + GetAbilityDescriptionByHashAndLevel( itB.GEMS_HASH[i], itB.GEMS_I[i] )
endif
set i = i + 1
endloop
if IsItemGlyphed(whichItem) then
set tail = tail + "|n|n|cff80ff80Can be glyphed at Inscriptor|r"
else
if GetItemCharges(whichItem) < 3 then
set tail = tail + "|n|nBuy " + temp + I2S(GetItemCharges(whichItem)+1) + "|r at Inscriptor to upgrade"
endif
endif
if marked then
set tail = tail + "|n|n|c00FF0303Beliar Mark|r"
endif
call BlzSetItemDescription(whichItem,head)
call BlzSetItemExtendedTooltip(whichItem,head + tail)
call itB.destroy()
set itB = 0
endfunction
function GetGemStatsShort takes itemBonuses itB returns string
local string head = ""
local integer i = 1
if itB.GEMS_ATTACKPOWER > 0 then
set head = head + GetParameterStringShort(itB.GEMS_ATTACKPOWER,ATTACK_POWER_TEXT)
endif
if itB.GEMS_ARMOR > 0 then
set head = head + GetParameterStringShort(itB.GEMS_ARMOR,ARMOR_TEXT)
endif
if itB.GEMS_STAMINA > 0 then
set head = head + GetParameterStringShort(itB.GEMS_STAMINA ,STAMINA_TEXT)
endif
if itB.GEMS_EXPERTISE > 0 then
set head = head + GetParameterStringShort(itB.GEMS_EXPERTISE,EXPERTISE_TEXT)
endif
if itB.GEMS_SPIRIT > 0 then
set head = head + GetParameterStringShort(itB.GEMS_SPIRIT,SPIRIT_TEXT)
endif
set i = 1
loop
exitwhen i>itB.GEMS_CUSTOMBONUSES_NUMBER
if itB.GEMS_ROI[i] then
set head = head + GetParameterStringShort( ConvertCustomParameterToInteger(itB.GEMS_R[i],itB.GEMS_HASH[i]), GetCustomParameterNameByHash(itB.GEMS_HASH[i]))
else
endif
set i = i + 1
endloop
return SubString(head,1,StringLength(head)-1)
endfunction
private function onInit takes nothing returns nothing
endfunction
endlibrary
scope ItemPickup initializer onInit
private function Conds takes nothing returns boolean
return GetItemType(GetManipulatedItem()) != ITEM_TYPE_POWERUP and GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE and GetItemTypeId(GetManipulatedItem()) != SOULSTONE_ITEM_CODE
endfunction
private function onTimerRemoveAndFlushItem takes nothing returns nothing
local timer t = GetExpiredTimer()
local item it = LoadItemHandle(udg_hash,GetHandleId(t),1)
call FlushChildHashtable(udg_hash,GetHandleId(it))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call RemoveItem(it)
call DestroyTimer(t)
set t = null
set it = null
endfunction
private function onPickUp takes nothing returns nothing
local item it = GetManipulatedItem()
local unit PICKER = GetTriggerUnit()
local integer i = 0
local boolean WasBought = false
local boolean ShouldBeInitialized = true
local boolean ShouldAddStats = true
local timer t = null
if not IsItemInitialized(it) then
set WasBought = true
call InitializeBaseItem(it)
endif
loop
exitwhen i>5
if not(UnitItemInSlot(PICKER,i) == it) and ItemsHasSameParent(UnitItemInSlot(PICKER,i),it) then
set ShouldAddStats = false
if WasBought then
set LAST_DROPPED_ITEM_SHOULD_BE_IGNORED = true
call UnitRemoveItem(PICKER,it)
call AdjustPlayerStateBJ(GetItemLevel(it),GetOwningPlayer(PICKER),PLAYER_STATE_RESOURCE_GOLD)
set t = CreateTimer()
call SaveItemHandle(udg_hash,GetHandleId(t),1,it)
call TimerStart(t,0.0,false,function onTimerRemoveAndFlushItem)
set t = null
set ShouldBeInitialized = false
else
set LAST_DROPPED_ITEM_SHOULD_BE_IGNORED = true
call UnitRemoveItem(PICKER,it)
endif
call SimError(GetOwningPlayer(PICKER),"You cannot have two items of the same parent.")
endif
set i = i + 1
endloop
if ShouldBeInitialized then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Picked an uninitialized item. Initializing it...")
call ResetItemDescription(it)
endif
if ShouldAddStats then
call UnitApplyItemBonuses(PICKER, it)
endif
set it = null
set PICKER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction( t, function onPickUp )
set t = null
endfunction
endscope
scope UnitSellsItem initializer onInit
private function onTimerFlushItemId takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = LoadInteger(udg_hash,GetHandleId(t),1)
call FlushChildHashtable(udg_hash,id)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
endfunction
private function onSell takes nothing returns nothing
local item it = GetSoldItem()
local integer id = GetHandleId(it)
local timer t = CreateTimer()
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Item sold: " + GetItemName(it))
call SaveInteger(udg_hash,GetHandleId(t),1,GetHandleId(it))
call TimerStart(t,0.0,false,function onTimerFlushItemId)
set t = null
set it = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PAWN_ITEM )
call TriggerAddAction(t, function onSell)
set t = null
endfunction
endscope
scope ItemLose initializer onInit
globals
boolean LAST_DROPPED_ITEM_SHOULD_BE_IGNORED = false
endglobals
private function Conds takes nothing returns boolean
return GetItemType(GetManipulatedItem()) != ITEM_TYPE_POWERUP and GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE
endfunction
private function onItemLose takes nothing returns nothing
local item it = GetManipulatedItem()
local unit Loser = GetTriggerUnit()
if not LAST_DROPPED_ITEM_SHOULD_BE_IGNORED then
call UnitRemoveItemBonuses(Loser,it)
else
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Ignoring dropped item: " + GetItemName(it))
set LAST_DROPPED_ITEM_SHOULD_BE_IGNORED = false
endif
set it = null
set Loser = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction( t, function onItemLose )
set t = null
endfunction
endscope
library CreateGemItem initializer onInit requires ItemsInitializer, ItemsDescriptor
globals
private integer RED_BUFFS = 7
private integer YELLOW_BUFFS = 6
private integer PURPLE_BUFFS = 5
private integer GREEN_BUFFS = 5
private integer BLUE_BUFFS = 2
constant integer GEM_GOLD_COST = 300
constant integer GEM_LUMBER_COST = 1
private integer MAX_BUTTONS = 11
private itemBonuses array RED_GEMS[11]
private itemBonuses array YELLOW_GEMS[11]
private itemBonuses array PURPLE_GEMS[11]
private itemBonuses array GREEN_GEMS[11]
private itemBonuses array BLUE_GEMS[11]
endglobals
function onClick takes nothing returns nothing
local button b = GetClickedButton()
local dialog DIAG = GetClickedDialog()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(DIAG),1)
local item it = LoadItemHandle(udg_hash,GetHandleId(DIAG),2)
local integer slotNumber = LoadInteger(udg_hash,GetHandleId(DIAG),3)
local string gemType = LoadStr(udg_hash,GetHandleId(DIAG),4)
local button array BUTTONS
local integer j = 1
local integer i = 0
local integer MAX_BUFF
if gemType == "RED" then
set MAX_BUFF = RED_BUFFS
endif
if gemType == "YELLOW" then
set MAX_BUFF = YELLOW_BUFFS
endif
if gemType == "PURPLE" then
set MAX_BUFF = PURPLE_BUFFS
endif
if gemType == "GREEN" then
set MAX_BUFF = GREEN_BUFFS
endif
if gemType == "BLUE" then
set MAX_BUFF = BLUE_BUFFS
endif
set j = 1
loop
exitwhen j>MAX_BUFF+1
set BUTTONS[j] = LoadButtonHandle(udg_hash,GetHandleId(DIAG),4+j)
set j = j + 1
endloop
set j = 1
loop
exitwhen b==BUTTONS[j]
set j = j + 1
endloop
if j == MAX_BUFF+1 then //if canceled
call AdjustPlayerStateBJ(GEM_GOLD_COST,GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)
call AdjustPlayerStateBJ(GEM_LUMBER_COST,GetOwningPlayer(u),PLAYER_STATE_RESOURCE_LUMBER)
else //if buff is chosen
call UnitRemoveItem(u,it)
//call ItemUpgradeStats(slotIt,T3_UPGRADE_COEFFICIENT,true,true)
if gemType == "RED" then
call ItemAddGemBonuses(it,RED_GEMS[j])
endif
if gemType == "YELLOW" then
call ItemAddGemBonuses(it,YELLOW_GEMS[j])
endif
if gemType == "PURPLE" then
call ItemAddGemBonuses(it,PURPLE_GEMS[j])
endif
if gemType == "GREEN" then
call ItemAddGemBonuses(it,GREEN_GEMS[j])
endif
if gemType == "BLUE" then
call ItemAddGemBonuses(it,BLUE_GEMS[j])
endif
call ResetItemDescription(it)
call UnitAddItem(u,it)
call UnitDropItemSlot(u,it,slotNumber)
endif
call FlushChildHashtable(udg_hash,GetHandleId(DIAG))
call DialogDestroy(DIAG)
call DestroyTrigger(GetTriggeringTrigger())
set DIAG = null
set b = null
set u = null
set it = null
endfunction
function InitializeGemDialogForPlayerUnitItemUpgrade takes unit u, item whichItem, integer slotNumber, string gemType returns nothing
local dialog DIAG = DialogCreate()
local button array BUTTONS
local string array TEXT
local trigger t = CreateTrigger()
local integer i = 1
local integer j = 0
local integer MAX_BUFF = 0
if gemType == "RED" then
set MAX_BUFF = RED_BUFFS
endif
if gemType == "YELLOW" then
set MAX_BUFF = YELLOW_BUFFS
endif
if gemType == "PURPLE" then
set MAX_BUFF = PURPLE_BUFFS
endif
if gemType == "GREEN" then
set MAX_BUFF = GREEN_BUFFS
endif
if gemType == "BLUE" then
set MAX_BUFF = BLUE_BUFFS
endif
call DialogSetMessage(DIAG,"Choose Gem Buff")
set j = 1
loop
exitwhen j>MAX_BUFF
if gemType == "RED" then
set TEXT[j] = GetGemStatsShort(RED_GEMS[j])
endif
if gemType == "YELLOW" then
set TEXT[j] = GetGemStatsShort(YELLOW_GEMS[j])
endif
if gemType == "PURPLE" then
set TEXT[j] = GetGemStatsShort(PURPLE_GEMS[j])
endif
if gemType == "GREEN" then
set TEXT[j] = GetGemStatsShort(GREEN_GEMS[j])
endif
if gemType == "BLUE" then
set TEXT[j] = GetGemStatsShort(BLUE_GEMS[j])
endif
set j = j + 1
endloop
set j = 1
loop
exitwhen j>MAX_BUFF
set BUTTONS[j] = DialogAddButton(DIAG,TEXT[j], j)
set j = j + 1
endloop
call SaveUnitHandle(udg_hash,GetHandleId(DIAG),1,u)
call SaveItemHandle(udg_hash,GetHandleId(DIAG),2,whichItem)
call SaveInteger(udg_hash,GetHandleId(DIAG),3,slotNumber)
call SaveStr(udg_hash,GetHandleId(DIAG),4,gemType)
set BUTTONS[j] = DialogAddButton(DIAG,"Cancel",j)
set j = 1
loop
exitwhen j>MAX_BUFF+1
call SaveButtonHandle(udg_hash,GetHandleId(DIAG),4+j,BUTTONS[j])
set BUTTONS[j] = null
set j = j + 1
endloop
call TriggerRegisterDialogEvent(t,DIAG)
call TriggerAddAction(t,function onClick)
call DialogDisplay(GetOwningPlayer(u),DIAG,true)
set t = null
set DIAG = null
endfunction
private function onInit takes nothing returns nothing
set RED_GEMS[1] = itemBonuses.create()
set RED_GEMS[1].GEMS_ATTACKPOWER = 35
set RED_GEMS[2] = itemBonuses.create()
set RED_GEMS[2].GEMS_EXPERTISE = 15
set RED_GEMS[3] = itemBonuses.create()
set RED_GEMS[3].GEMS_CUSTOMBONUSES_NUMBER = 1
set RED_GEMS[3].GEMS_ROI[1] = true
set RED_GEMS[3].GEMS_R[1] = 3.
set RED_GEMS[3].GEMS_HASH[1] = GetCritHash()
set RED_GEMS[4] = itemBonuses.create()
set RED_GEMS[4].GEMS_CUSTOMBONUSES_NUMBER = 1
set RED_GEMS[4].GEMS_ROI[1] = true
set RED_GEMS[4].GEMS_R[1] = 3.
set RED_GEMS[4].GEMS_HASH[1] = GetHasteHash()
set RED_GEMS[5] = itemBonuses.create()
set RED_GEMS[5].GEMS_CUSTOMBONUSES_NUMBER = 1
set RED_GEMS[5].GEMS_ROI[1] = true
set RED_GEMS[5].GEMS_R[1] = 0.08
set RED_GEMS[5].GEMS_HASH[1] = GetSplashHash()
set RED_GEMS[6] = itemBonuses.create()
set RED_GEMS[6].GEMS_CUSTOMBONUSES_NUMBER = 1
set RED_GEMS[6].GEMS_ROI[1] = true
set RED_GEMS[6].GEMS_R[1] = 0.15
set RED_GEMS[6].GEMS_HASH[1] = GetCritMultiplierHash()
set RED_GEMS[7] = itemBonuses.create()
set RED_GEMS[7].GEMS_CUSTOMBONUSES_NUMBER = 1
set RED_GEMS[7].GEMS_ROI[1] = true
set RED_GEMS[7].GEMS_R[1] = 0.1
set RED_GEMS[7].GEMS_HASH[1] = GetBleedingDamageBonusHash()
set YELLOW_GEMS[1] = itemBonuses.create()
set YELLOW_GEMS[1].GEMS_ARMOR = 7
set YELLOW_GEMS[2] = itemBonuses.create()
set YELLOW_GEMS[2].GEMS_STAMINA = 10
set YELLOW_GEMS[3] = itemBonuses.create()
set YELLOW_GEMS[3].GEMS_CUSTOMBONUSES_NUMBER = 1
set YELLOW_GEMS[3].GEMS_ROI[1] = true
set YELLOW_GEMS[3].GEMS_R[1] = 0.07
set YELLOW_GEMS[3].GEMS_HASH[1] = GetSpellResistHash()
set YELLOW_GEMS[4] = itemBonuses.create()
set YELLOW_GEMS[4].GEMS_CUSTOMBONUSES_NUMBER = 1
set YELLOW_GEMS[4].GEMS_ROI[1] = true
set YELLOW_GEMS[4].GEMS_R[1] = 3.
set YELLOW_GEMS[4].GEMS_HASH[1] = GetBlockChanceHash()
set YELLOW_GEMS[5] = itemBonuses.create()
set YELLOW_GEMS[5].GEMS_CUSTOMBONUSES_NUMBER = 1
set YELLOW_GEMS[5].GEMS_ROI[1] = true
set YELLOW_GEMS[5].GEMS_R[1] = 30.
set YELLOW_GEMS[5].GEMS_HASH[1] = GetBlockAmountHash()
set YELLOW_GEMS[6] = itemBonuses.create()
set YELLOW_GEMS[6].GEMS_CUSTOMBONUSES_NUMBER = 1
set YELLOW_GEMS[6].GEMS_ROI[1] = true
set YELLOW_GEMS[6].GEMS_R[1] = 5
set YELLOW_GEMS[6].GEMS_HASH[1] = GetEvasionHash()
set PURPLE_GEMS[1] = itemBonuses.create()
set PURPLE_GEMS[1].GEMS_CUSTOMBONUSES_NUMBER = 1
set PURPLE_GEMS[1].GEMS_ROI[1] = true
set PURPLE_GEMS[1].GEMS_R[1] = 25
set PURPLE_GEMS[1].GEMS_HASH[1] = GetSpellPowerHash()
set PURPLE_GEMS[2] = itemBonuses.create()
set PURPLE_GEMS[2].GEMS_CUSTOMBONUSES_NUMBER = 1
set PURPLE_GEMS[2].GEMS_ROI[1] = true
set PURPLE_GEMS[2].GEMS_R[1] = 2
set PURPLE_GEMS[2].GEMS_HASH[1] = GetSpellCritHash()
set PURPLE_GEMS[3] = itemBonuses.create()
set PURPLE_GEMS[3].GEMS_CUSTOMBONUSES_NUMBER = 1
set PURPLE_GEMS[3].GEMS_ROI[1] = true
set PURPLE_GEMS[3].GEMS_R[1] = 0.05
set PURPLE_GEMS[3].GEMS_HASH[1] = GetElementalDamageBonusHash()
set PURPLE_GEMS[4] = itemBonuses.create()
set PURPLE_GEMS[4].GEMS_CUSTOMBONUSES_NUMBER = 1
set PURPLE_GEMS[4].GEMS_ROI[1] = true
set PURPLE_GEMS[4].GEMS_R[1] = 0.1
set PURPLE_GEMS[4].GEMS_HASH[1] = GetDotedUnitsSpellDamageBonusHash()
set PURPLE_GEMS[5] = itemBonuses.create()
set PURPLE_GEMS[5].GEMS_CUSTOMBONUSES_NUMBER = 1
set PURPLE_GEMS[5].GEMS_ROI[1] = true
set PURPLE_GEMS[5].GEMS_R[1] = 0.1
set PURPLE_GEMS[5].GEMS_HASH[1] = GetPeriodicDamageBonusHash()
set GREEN_GEMS[1] = itemBonuses.create()
set GREEN_GEMS[1].GEMS_CUSTOMBONUSES_NUMBER = 1
set GREEN_GEMS[1].GEMS_ROI[1] = true
set GREEN_GEMS[1].GEMS_R[1] = 0.06
set GREEN_GEMS[1].GEMS_HASH[1] = GetHealingBonusHash()
set GREEN_GEMS[2] = itemBonuses.create()
set GREEN_GEMS[2].GEMS_CUSTOMBONUSES_NUMBER = 1
set GREEN_GEMS[2].GEMS_ROI[1] = true
set GREEN_GEMS[2].GEMS_R[1] = 0.08
set GREEN_GEMS[2].GEMS_HASH[1] = GetReceivedHealingBonusHash()
set GREEN_GEMS[3] = itemBonuses.create()
set GREEN_GEMS[3].GEMS_CUSTOMBONUSES_NUMBER = 1
set GREEN_GEMS[3].GEMS_ROI[1] = true
set GREEN_GEMS[3].GEMS_R[1] = 0.1
set GREEN_GEMS[3].GEMS_HASH[1] = GetSelfHealingBonusHash()
set GREEN_GEMS[4] = itemBonuses.create()
set GREEN_GEMS[4].GEMS_CUSTOMBONUSES_NUMBER = 1
set GREEN_GEMS[4].GEMS_ROI[1] = true
set GREEN_GEMS[4].GEMS_R[1] = 0.1
set GREEN_GEMS[4].GEMS_HASH[1] = GetPeriodicHealingBonusHash()
set GREEN_GEMS[5] = itemBonuses.create()
set GREEN_GEMS[5].GEMS_CUSTOMBONUSES_NUMBER = 1
set GREEN_GEMS[5].GEMS_ROI[1] = true
set GREEN_GEMS[5].GEMS_R[1] = 0.15
set GREEN_GEMS[5].GEMS_HASH[1] = GetHealingCritMultiplierHash()
set BLUE_GEMS[1] = itemBonuses.create()
set BLUE_GEMS[1].GEMS_SPIRIT = 10
set BLUE_GEMS[2] = itemBonuses.create()
set BLUE_GEMS[2].GEMS_CUSTOMBONUSES_NUMBER = 1
set BLUE_GEMS[2].GEMS_ROI[1] = true
set BLUE_GEMS[2].GEMS_R[1] = 0.1
set BLUE_GEMS[2].GEMS_HASH[1] = GetEnergyRegenBonusHash()
endfunction
endlibrary
library ItemsUpgrade initializer onInit requires CreateGemItem
globals
private constant integer GLYPH_FIRE = 'I001'
private constant integer GLYPH_FROST = 'I002'
private constant integer GLYPH_CORRUPTION = 'I003'
private constant integer GLYPH_TIGER = 'I004'
private constant integer WEAPON_T1 = 'I009'
private constant integer WEAPON_T2 = 'I00A'
private constant integer WEAPON_T3 = 'I00Q'
private constant integer ARMOR_T1 = 'I00B'
private constant integer ARMOR_T2 = 'I00C'
private constant integer ARMOR_T3 = 'I00R'
private constant integer GEM_RED = 'I018'
private constant integer GEM_YELLOW = 'I01A'
private constant integer GEM_PURPLE = 'I01B'
private constant integer GEM_GREEN = 'I01E'
private constant integer GEM_BLUE = 'I01F'
private constant integer T1_MAX_LEVEL = 1
private constant integer T2_MAX_LEVEL = 2
private constant integer T2_MIN_LEVEL = 1
private constant integer T3_MAX_LEVEL = 3
private constant integer T3_MIN_LEVEL = 2
private constant real T1_UPGRADE_COEFFICIENT = 0.5
private constant real T2_UPGRADE_COEFFICIENT = 0.5
private constant real T3_UPGRADE_COEFFICIENT = 0.5
endglobals
private function Conds takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_POWERUP and GetItemLevel(GetManipulatedItem()) != 5 and GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE and GetItemTypeId(GetManipulatedItem()) != 'I017'
endfunction
private function onPickUpgrade takes nothing returns nothing
local integer itemId = GetItemTypeId(GetManipulatedItem())
local integer GlyphId = 0
local unit u = GetTriggerUnit()
local item slotIt = null
local item newIt = null
local integer whenexit = udg_Item_Count
local integer i = 1
local integer kconst = 0
local string itemType = ""
local integer slot = 0
local boolean bool = false
local boolean IsGem = false
local string GEM_TYPE = ""
local real addCoeff = 0.
local boolean flagM = false
call DisableTrigger(GetTriggeringTrigger())
//If Glyph was bought
if (itemId == GLYPH_FIRE) or (itemId == GLYPH_FROST) or (itemId == GLYPH_CORRUPTION) or (itemId == GLYPH_TIGER) then
//Which Glyph was used
if itemId == GLYPH_FIRE then
set kconst = 1
if IsUnitInGroup(u,BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP) then
set flagM = true
endif
elseif itemId == GLYPH_FROST then
set kconst = 2
if IsUnitInGroup(u,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) then
set flagM = true
endif
elseif itemId == GLYPH_CORRUPTION then
set kconst = 3
if IsUnitInGroup(u,BELIAR_SACRIFICE_CORRUPTION_GROUP) then
set flagM = true
endif
elseif itemId == GLYPH_TIGER then
set kconst = 4
if IsUnitInGroup(u,BELIAR_SACRIFICE_TIGERS_FURY_GROUP) then
set flagM = true
endif
endif
loop
exitwhen slot>5 or bool
//If there is no glyph in item in slot
if LoadInteger(udg_hash,GetHandleId(UnitItemInSlot(u,slot)),GetItemGlyphHash())==-1 then
set slotIt = UnitItemInSlot(u,slot)
set GlyphId = GetGlyphedItemId(GetItemTypeId(slotIt),kconst)
set newIt = CreateItem(GlyphId,0.,0.)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Found glyphed item: " + GetItemName(newIt))
call InitializeGlyphItem(newIt)
call UnitRemoveItemFromSlot(u,slot) //This makes the hero lose stats of the item
call MergeItems(newIt,slotIt)
if flagM then
set addCoeff = BELIAR_SACRIFICE_ITEM_BONUS_MULT
call ItemAddXardasMark(newIt)
call ItemUpgradeStats(newIt,addCoeff,true,false)
endif
call UnitAddItem(u,newIt)
call UnitDropItemSlot(u,newIt,slot)
set bool = true
endif
set slot = slot + 1
endloop
endif
if (itemId == WEAPON_T1) or (itemId== ARMOR_T1) then
if itemId == WEAPON_T1 then
set itemType = "WEAPON"
endif
if itemId == ARMOR_T1 then
set itemType = "ARMOR"
endif
loop
exitwhen slot > 5 or bool
set slotIt = UnitItemInSlot(u,slot)
if GetItemTypeString(slotIt)==itemType and not IsItemGlyphed(slotIt) and GetItemCharges(slotIt) < T1_MAX_LEVEL then
call UnitRemoveItem(u,slotIt)
if GetItemXardasMarkType(slotIt)>0 then
set addCoeff = BELIAR_SACRIFICE_ITEM_BONUS_MULT
endif
call ItemUpgradeStats(slotIt,T1_UPGRADE_COEFFICIENT+addCoeff,true,true)
call UnitAddItem(u,slotIt)
call UnitDropItemSlot(u,slotIt,slot)
set bool = true
endif
set slot = slot + 1
endloop
endif
if (itemId == WEAPON_T2) or (itemId== ARMOR_T2) then
if itemId == WEAPON_T2 then
set itemType = "WEAPON"
endif
if itemId == ARMOR_T2 then
set itemType = "ARMOR"
endif
loop
exitwhen slot > 5 or bool
set slotIt = UnitItemInSlot(u,slot)
if GetItemTypeString(slotIt)==itemType and not IsItemGlyphed(slotIt) and GetItemCharges(slotIt) >= T2_MIN_LEVEL and GetItemCharges(slotIt) < T2_MAX_LEVEL then
call UnitRemoveItem(u,slotIt)
if GetItemXardasMarkType(slotIt)>0 then
set addCoeff = BELIAR_SACRIFICE_ITEM_BONUS_MULT
endif
call ItemUpgradeStats(slotIt,T2_UPGRADE_COEFFICIENT+addCoeff,true,true)
call UnitAddItem(u,slotIt)
call UnitDropItemSlot(u,slotIt,slot)
set bool = true
endif
set slot = slot + 1
endloop
endif
if (itemId == WEAPON_T3) or (itemId== ARMOR_T3) then
if itemId == WEAPON_T3 then
set itemType = "WEAPON"
endif
if itemId == ARMOR_T3 then
set itemType = "ARMOR"
endif
loop
exitwhen slot > 5 or bool
set slotIt = UnitItemInSlot(u,slot)
if GetItemTypeString(slotIt)==itemType and not IsItemGlyphed(slotIt) and GetItemCharges(slotIt) >= T3_MIN_LEVEL and GetItemCharges(slotIt) < T3_MAX_LEVEL then
call UnitRemoveItem(u,slotIt)
if GetItemXardasMarkType(slotIt)>0 then
set addCoeff = BELIAR_SACRIFICE_ITEM_BONUS_MULT
endif
call ItemUpgradeStats(slotIt,T3_UPGRADE_COEFFICIENT+addCoeff,true,true)
call UnitAddItem(u,slotIt)
call UnitDropItemSlot(u,slotIt,slot)
set bool = true
endif
set slot = slot + 1
endloop
endif
if (itemId == GEM_RED) or (itemId == GEM_YELLOW) or (itemId == GEM_PURPLE) or (itemId == GEM_GREEN) or (itemId == GEM_BLUE) then
set IsGem = true
if itemId == GEM_RED then
set GEM_TYPE = "RED"
endif
if itemId == GEM_YELLOW then
set GEM_TYPE = "YELLOW"
endif
if itemId == GEM_PURPLE then
set GEM_TYPE = "PURPLE"
endif
if itemId == GEM_GREEN then
set GEM_TYPE = "GREEN"
endif
if itemId == GEM_BLUE then
set GEM_TYPE = "BLUE"
endif
loop
exitwhen slot > 5 or bool
set slotIt = UnitItemInSlot(u,slot)
if ItemHasFreeSocket(slotIt) then
call InitializeGemDialogForPlayerUnitItemUpgrade(u,slotIt,slot,GEM_TYPE)
set bool = true
endif
set slot = slot + 1
endloop
endif
if (not bool) and (not IsGem) then
call SimError(GetOwningPlayer(u),"There's nothing to upgrade")
call AdjustPlayerStateBJ(GetItemLevel(GetManipulatedItem()),GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)
endif
if (not bool) and IsGem then
call SimError(GetOwningPlayer(u),"No items to insert a gem")
call AdjustPlayerStateBJ(GEM_GOLD_COST,GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)
call AdjustPlayerStateBJ(GEM_LUMBER_COST,GetOwningPlayer(u),PLAYER_STATE_RESOURCE_LUMBER)
endif
call EnableTrigger(GetTriggeringTrigger())
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t, function onPickUpgrade)
set t = null
endfunction
endlibrary
scope ChargesOnActiveItems initializer onInit
private function Conds takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_PERMANENT or GetItemType(GetManipulatedItem()) == ITEM_TYPE_ARTIFACT
endfunction
function onUse takes nothing returns nothing
if LoadInteger(udg_hash,GetHandleId(GetManipulatedItem()),GetItemUpgradesCountHash()) > 0 then
call SetItemCharges( GetManipulatedItem(), ( GetItemCharges(GetManipulatedItem()) + 1 ) )
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onUse )
set t = null
endfunction
endscope
function Trig_itembaseitems_Actions takes nothing returns nothing
set udg_Item_Count = 286
set udg_Item_Main[1] = 'I000'
set udg_Item_Main[2] = 'I005'
set udg_Item_Main[3] = 'I006'
set udg_Item_Main[4] = 'I007'
set udg_Item_Main[5] = 'I008'
set udg_Item_Main[6] = 'I00D'
set udg_Item_Main[7] = 'I00F'
set udg_Item_Main[8] = 'I00E'
set udg_Item_Main[9] = 'I00G'
set udg_Item_Main[10] = 'I00H'
set udg_Item_Main[11] = 'I00J'
set udg_Item_Main[12] = 'I00I'
set udg_Item_Main[13] = 'I00K'
set udg_Item_Main[14] = 'I00L'
set udg_Item_Main[15] = 'I00M'
set udg_Item_Main[16] = 'I00T'
set udg_Item_Main[17] = 'I00P'
set udg_Item_Main[18] = 'I00W'
set udg_Item_Main[19] = 'I00N'
set udg_Item_Main[20] = 'I00V'
set udg_Item_Main[21] = 'I00Q'
set udg_Item_Main[22] = 'I00X'
set udg_Item_Main[23] = 'I00O'
set udg_Item_Main[24] = 'I00U'
set udg_Item_Main[25] = 'I00R'
set udg_Item_Main[26] = 'I00Y'
set udg_Item_Main[27] = 'I00Z'
set udg_Item_Main[28] = 'I010'
set udg_Item_Main[29] = 'I013'
set udg_Item_Main[30] = 'I016'
set udg_Item_Main[31] = 'I019'
set udg_Item_Main[32] = 'I011'
set udg_Item_Main[33] = 'I014'
set udg_Item_Main[34] = 'I017'
set udg_Item_Main[35] = 'I01A'
set udg_Item_Main[36] = 'I012'
set udg_Item_Main[37] = 'I015'
set udg_Item_Main[38] = 'I018'
set udg_Item_Main[39] = 'I01B'
set udg_Item_Main[40] = 'I01C'
set udg_Item_Main[41] = 'I01J'
set udg_Item_Main[42] = 'I01M'
set udg_Item_Main[43] = 'I01D'
set udg_Item_Main[44] = 'I01G'
set udg_Item_Main[45] = 'I01K'
set udg_Item_Main[46] = 'I01N'
set udg_Item_Main[47] = 'I01E'
set udg_Item_Main[48] = 'I01H'
set udg_Item_Main[49] = 'I01L'
set udg_Item_Main[50] = 'I01O'
set udg_Item_Main[51] = 'I01F'
set udg_Item_Main[52] = 'I01I'
set udg_Item_Main[144] = 'I01P'
set udg_Item_Main[145] = 'I01Q'
set udg_Item_Main[146] = 'I01T'
set udg_Item_Main[147] = 'I01W'
set udg_Item_Main[148] = 'I01Z'
set udg_Item_Main[149] = 'I01R'
set udg_Item_Main[150] = 'I01U'
set udg_Item_Main[151] = 'I01X'
set udg_Item_Main[152] = 'I020'
set udg_Item_Main[153] = 'I01S'
set udg_Item_Main[154] = 'I01V'
set udg_Item_Main[155] = 'I01Y'
set udg_Item_Main[156] = 'I021'
set udg_Item_Main[157] = 'I022'
set udg_Item_Main[158] = 'I023'
set udg_Item_Main[159] = 'I026'
set udg_Item_Main[160] = 'I029'
set udg_Item_Main[161] = 'I02C'
set udg_Item_Main[162] = 'I024'
set udg_Item_Main[163] = 'I027'
set udg_Item_Main[164] = 'I02A'
set udg_Item_Main[165] = 'I02D'
set udg_Item_Main[166] = 'I025'
set udg_Item_Main[167] = 'I028'
set udg_Item_Main[168] = 'I02B'
set udg_Item_Main[169] = 'I02E'
set udg_Item_Main[170] = 'I02U'
set udg_Item_Main[171] = 'I02T'
set udg_Item_Main[172] = 'I02X'
set udg_Item_Main[173] = 'I030'
set udg_Item_Main[174] = 'I033'
set udg_Item_Main[175] = 'I02V'
set udg_Item_Main[176] = 'I02Y'
set udg_Item_Main[177] = 'I031'
set udg_Item_Main[178] = 'I034'
set udg_Item_Main[179] = 'I02W'
set udg_Item_Main[180] = 'I02Z'
set udg_Item_Main[181] = 'I032'
set udg_Item_Main[182] = 'I035'
set udg_Item_Main[183] = 'I036'
set udg_Item_Main[184] = 'I037'
set udg_Item_Main[185] = 'I03A'
set udg_Item_Main[186] = 'I03D'
set udg_Item_Main[187] = 'I03G'
set udg_Item_Main[188] = 'I038'
set udg_Item_Main[189] = 'I03B'
set udg_Item_Main[190] = 'I03E'
set udg_Item_Main[191] = 'I03H'
set udg_Item_Main[192] = 'I039'
set udg_Item_Main[193] = 'I03C'
set udg_Item_Main[194] = 'I03F'
set udg_Item_Main[195] = 'I03I'
endfunction
//===========================================================================
function InitTrig_itembaseitems takes nothing returns nothing
set gg_trg_itembaseitems = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_itembaseitems, 0.00 )
call TriggerAddAction( gg_trg_itembaseitems, function Trig_itembaseitems_Actions )
endfunction
function Trig_itembasehashkeys_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 26
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Item_hashslot1[GetForLoopIndexA()] = 2
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopAIndex = 27
set bj_forLoopAIndexEnd = 39
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Item_hashslot1[GetForLoopIndexA()] = 5
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopAIndex = 40
set bj_forLoopAIndexEnd = 52
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Item_hashslot1[GetForLoopIndexA()] = 4
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopAIndex = 144
set bj_forLoopAIndexEnd = 156
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Item_hashslot1[GetForLoopIndexA()] = 14
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopAIndex = 157
set bj_forLoopAIndexEnd = 169
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Item_hashslot1[GetForLoopIndexA()] = 1
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopAIndex = 170
set bj_forLoopAIndexEnd = 182
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Item_hashslot1[GetForLoopIndexA()] = 25
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_forLoopAIndex = 183
set bj_forLoopAIndexEnd = 195
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_Item_hashslot1[GetForLoopIndexA()] = 16
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
// hashslots2
set udg_Item_hashslot2[2] = 7
set udg_Item_hashslot2[6] = 7
set udg_Item_hashslot2[10] = 7
set udg_Item_hashslot2[5] = 8
set udg_Item_hashslot2[9] = 8
set udg_Item_hashslot2[13] = 8
set udg_Item_hashslot2[16] = 56
set udg_Item_hashslot2[20] = 56
set udg_Item_hashslot2[24] = 56
set udg_Item_hashslot2[17] = 50
set udg_Item_hashslot2[21] = 50
set udg_Item_hashslot2[25] = 50
set udg_Item_hashslot2[18] = 51
set udg_Item_hashslot2[22] = 51
set udg_Item_hashslot2[26] = 51
set udg_Item_hashslot2[15] = 52
set udg_Item_hashslot2[19] = 52
set udg_Item_hashslot2[23] = 52
set udg_Item_hashslot2[28] = 53
set udg_Item_hashslot2[32] = 53
set udg_Item_hashslot2[36] = 53
set udg_Item_hashslot2[29] = 54
set udg_Item_hashslot2[33] = 54
set udg_Item_hashslot2[37] = 54
set udg_Item_hashslot2[30] = 55
set udg_Item_hashslot2[34] = 55
set udg_Item_hashslot2[38] = 55
set udg_Item_hashslot2[31] = 11
set udg_Item_hashslot2[35] = 11
set udg_Item_hashslot2[39] = 11
set udg_Item_hashslot2[41] = 57
set udg_Item_hashslot2[45] = 57
set udg_Item_hashslot2[49] = 57
set udg_Item_hashslot2[43] = 13
set udg_Item_hashslot2[47] = 13
set udg_Item_hashslot2[51] = 13
set udg_Item_hashslot2[145] = 58
set udg_Item_hashslot2[149] = 58
set udg_Item_hashslot2[153] = 58
set udg_Item_hashslot2[147] = 59
set udg_Item_hashslot2[151] = 59
set udg_Item_hashslot2[155] = 59
set udg_Item_hashslot2[148] = 60
set udg_Item_hashslot2[152] = 60
set udg_Item_hashslot2[156] = 60
set udg_Item_hashslot2[158] = 61
set udg_Item_hashslot2[162] = 61
set udg_Item_hashslot2[166] = 61
set udg_Item_hashslot2[174] = 62
set udg_Item_hashslot2[178] = 62
set udg_Item_hashslot2[182] = 62
set udg_Item_hashslot2[172] = 63
set udg_Item_hashslot2[176] = 63
set udg_Item_hashslot2[180] = 63
set udg_Item_hashslot2[185] = 65
set udg_Item_hashslot2[189] = 65
set udg_Item_hashslot2[193] = 65
endfunction
//===========================================================================
function InitTrig_itembasehashkeys takes nothing returns nothing
set gg_trg_itembasehashkeys = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_itembasehashkeys, 0.00 )
call TriggerAddAction( gg_trg_itembasehashkeys, function Trig_itembasehashkeys_Actions )
endfunction
function Trig_itembasehashadds_Actions takes nothing returns nothing
// adds1
set udg_Item_Adds1[1] = 2.00
set udg_Item_Adds1[2] = 4.00
set udg_Item_Adds1[3] = 4.00
set udg_Item_Adds1[4] = 4.00
set udg_Item_Adds1[5] = 4.00
set udg_Item_Adds1[6] = 6.00
set udg_Item_Adds1[7] = 6.00
set udg_Item_Adds1[8] = 6.00
set udg_Item_Adds1[9] = 6.00
set udg_Item_Adds1[10] = 8.00
set udg_Item_Adds1[11] = 8.00
set udg_Item_Adds1[12] = 8.00
set udg_Item_Adds1[13] = 8.00
set udg_Item_Adds1[14] = 2.00
set udg_Item_Adds1[15] = 4.00
set udg_Item_Adds1[16] = 4.00
set udg_Item_Adds1[17] = 4.00
set udg_Item_Adds1[18] = 4.00
set udg_Item_Adds1[19] = 6.00
set udg_Item_Adds1[20] = 6.00
set udg_Item_Adds1[21] = 6.00
set udg_Item_Adds1[22] = 6.00
set udg_Item_Adds1[23] = 8.00
set udg_Item_Adds1[24] = 8.00
set udg_Item_Adds1[25] = 8.00
set udg_Item_Adds1[26] = 8.00
set udg_Item_Adds1[27] = 50.00
set udg_Item_Adds1[28] = 75.00
set udg_Item_Adds1[29] = 75.00
set udg_Item_Adds1[30] = 75.00
set udg_Item_Adds1[31] = 75.00
set udg_Item_Adds1[32] = 150.00
set udg_Item_Adds1[33] = 150.00
set udg_Item_Adds1[34] = 150.00
set udg_Item_Adds1[35] = 150.00
set udg_Item_Adds1[36] = 300.00
set udg_Item_Adds1[37] = 300.00
set udg_Item_Adds1[38] = 300.00
set udg_Item_Adds1[39] = 300.00
set udg_Item_Adds1[40] = 2.00
set udg_Item_Adds1[41] = 4.00
set udg_Item_Adds1[42] = 4.00
set udg_Item_Adds1[43] = 4.00
set udg_Item_Adds1[44] = 4.00
set udg_Item_Adds1[45] = 6.00
set udg_Item_Adds1[46] = 6.00
set udg_Item_Adds1[47] = 6.00
set udg_Item_Adds1[48] = 6.00
set udg_Item_Adds1[49] = 8.00
set udg_Item_Adds1[50] = 8.00
set udg_Item_Adds1[51] = 8.00
set udg_Item_Adds1[52] = 8.00
set udg_Item_Adds1[144] = 2.00
set udg_Item_Adds1[145] = 4.00
set udg_Item_Adds1[146] = 4.00
set udg_Item_Adds1[147] = 4.00
set udg_Item_Adds1[148] = 4.00
set udg_Item_Adds1[149] = 6.00
set udg_Item_Adds1[150] = 6.00
set udg_Item_Adds1[151] = 6.00
set udg_Item_Adds1[152] = 6.00
set udg_Item_Adds1[153] = 8.00
set udg_Item_Adds1[154] = 8.00
set udg_Item_Adds1[155] = 8.00
set udg_Item_Adds1[156] = 8.00
set udg_Item_Adds1[157] = 2.00
set udg_Item_Adds1[158] = 4.00
set udg_Item_Adds1[159] = 4.00
set udg_Item_Adds1[160] = 4.00
set udg_Item_Adds1[161] = 4.00
set udg_Item_Adds1[162] = 6.00
set udg_Item_Adds1[163] = 6.00
set udg_Item_Adds1[164] = 6.00
set udg_Item_Adds1[165] = 6.00
set udg_Item_Adds1[166] = 8.00
set udg_Item_Adds1[167] = 8.00
set udg_Item_Adds1[168] = 8.00
set udg_Item_Adds1[169] = 8.00
set udg_Item_Adds1[170] = 0.25
set udg_Item_Adds1[171] = 0.50
set udg_Item_Adds1[172] = 0.50
set udg_Item_Adds1[173] = 0.50
set udg_Item_Adds1[174] = 0.50
set udg_Item_Adds1[175] = 0.75
set udg_Item_Adds1[176] = 0.75
set udg_Item_Adds1[177] = 0.75
set udg_Item_Adds1[178] = 0.75
set udg_Item_Adds1[179] = 1.00
set udg_Item_Adds1[180] = 1.00
set udg_Item_Adds1[181] = 1.00
set udg_Item_Adds1[182] = 1.00
set udg_Item_Adds1[183] = 0.03
set udg_Item_Adds1[184] = 0.06
set udg_Item_Adds1[185] = 0.06
set udg_Item_Adds1[186] = 0.06
set udg_Item_Adds1[187] = 0.06
set udg_Item_Adds1[188] = 0.12
set udg_Item_Adds1[189] = 0.12
set udg_Item_Adds1[190] = 0.12
set udg_Item_Adds1[191] = 0.12
set udg_Item_Adds1[192] = 0.24
set udg_Item_Adds1[193] = 0.24
set udg_Item_Adds1[194] = 0.24
set udg_Item_Adds1[195] = 0.24
// adds2
set udg_Item_Adds2[2] = 0.10
set udg_Item_Adds2[6] = 0.20
set udg_Item_Adds2[10] = 0.30
set udg_Item_Adds2[5] = 0.10
set udg_Item_Adds2[9] = 0.15
set udg_Item_Adds2[16] = 1.00
set udg_Item_Adds2[20] = 2.00
set udg_Item_Adds2[24] = 3.00
set udg_Item_Adds2[13] = 0.20
set udg_Item_Adds2[17] = 0.50
set udg_Item_Adds2[21] = 1.00
set udg_Item_Adds2[25] = 2.00
set udg_Item_Adds2[18] = 1.00
set udg_Item_Adds2[22] = 2.00
set udg_Item_Adds2[26] = 3.00
set udg_Item_Adds2[15] = 1.00
set udg_Item_Adds2[19] = 50.00
set udg_Item_Adds2[23] = 500.00
set udg_Item_Adds2[31] = 0.05
set udg_Item_Adds2[35] = 0.10
set udg_Item_Adds2[39] = 0.20
set udg_Item_Adds2[28] = 25.00
set udg_Item_Adds2[32] = 75.00
set udg_Item_Adds2[36] = 250.00
set udg_Item_Adds2[29] = 0.01
set udg_Item_Adds2[33] = 0.02
set udg_Item_Adds2[37] = 0.03
set udg_Item_Adds2[30] = 100.00
set udg_Item_Adds2[34] = 200.00
set udg_Item_Adds2[38] = 500.00
set udg_Item_Adds2[41] = 1.00
set udg_Item_Adds2[45] = 2.00
set udg_Item_Adds2[49] = 3.00
set udg_Item_Adds2[43] = 0.10
set udg_Item_Adds2[47] = 0.20
set udg_Item_Adds2[51] = 0.30
set udg_Item_Adds2[145] = 0.40
set udg_Item_Adds2[149] = 0.80
set udg_Item_Adds2[153] = 1.20
set udg_Item_Adds2[147] = 5.00
set udg_Item_Adds2[151] = 10.00
set udg_Item_Adds2[155] = 20.00
set udg_Item_Adds2[148] = 0.05
set udg_Item_Adds2[152] = 0.10
set udg_Item_Adds2[156] = 0.20
set udg_Item_Adds2[157] = 2.00
set udg_Item_Adds2[158] = 1.00
set udg_Item_Adds2[159] = 4.00
set udg_Item_Adds2[160] = 4.00
set udg_Item_Adds2[161] = 4.00
set udg_Item_Adds2[162] = 50.00
set udg_Item_Adds2[163] = 6.00
set udg_Item_Adds2[164] = 6.00
set udg_Item_Adds2[165] = 6.00
set udg_Item_Adds2[166] = 500.00
set udg_Item_Adds2[167] = 8.00
set udg_Item_Adds2[168] = 8.00
set udg_Item_Adds2[169] = 8.00
set udg_Item_Adds2[174] = 1.00
set udg_Item_Adds2[178] = 50.00
set udg_Item_Adds2[182] = 500.00
set udg_Item_Adds2[172] = 1.00
set udg_Item_Adds2[176] = 50.00
set udg_Item_Adds2[180] = 500.00
set udg_Item_Adds2[185] = 0.30
set udg_Item_Adds2[189] = 0.40
set udg_Item_Adds2[193] = 0.50
endfunction
//===========================================================================
function InitTrig_itembasehashadds takes nothing returns nothing
set gg_trg_itembasehashadds = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_itembasehashadds, 0.00 )
call TriggerAddAction( gg_trg_itembasehashadds, function Trig_itembasehashadds_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Itemget_Conds takes nothing returns boolean
return GetItemType(GetManipulatedItem()) != ITEM_TYPE_POWERUP and GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE
endfunction
function Itemget_Acts takes nothing returns nothing
local integer it = GetItemTypeId(GetManipulatedItem())
local unit u = GetTriggerUnit()
local real a
local real b
local integer i = 1
loop
exitwhen i>udg_Item_Count
if udg_Item_Main[i] == it then
set a = LoadReal(udg_hash,GetHandleId(u),udg_Item_hashslot1[i])
set b = LoadReal(udg_hash,GetHandleId(u),udg_Item_hashslot2[i])
call SaveReal(udg_hash,GetHandleId(u),udg_Item_hashslot1[i],a+udg_Item_Adds1[i])
call SaveReal(udg_hash,GetHandleId(u),udg_Item_hashslot2[i],b+udg_Item_Adds2[i])
set i = udg_Item_Count
endif
set i = i + 1
endloop
set u = null
endfunction
//===========================================================================
function InitTrig_itemget takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function Itemget_Conds))
call TriggerAddAction( t, function Itemget_Acts )
set t = null
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Itemlose_Conds takes nothing returns boolean
return GetItemType(GetManipulatedItem()) != ITEM_TYPE_POWERUP and GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE
endfunction
function Itemlose_Acts takes nothing returns nothing
local integer it = GetItemTypeId(GetManipulatedItem())
local unit u = GetTriggerUnit()
local real a
local real b
local integer i = 1
loop
exitwhen i>udg_Item_Count
if udg_Item_Main[i] == it then
set a = LoadReal(udg_hash,GetHandleId(u),udg_Item_hashslot1[i])
set b = LoadReal(udg_hash,GetHandleId(u),udg_Item_hashslot2[i])
call SaveReal(udg_hash,GetHandleId(u),udg_Item_hashslot1[i],a-udg_Item_Adds1[i])
call SaveReal(udg_hash,GetHandleId(u),udg_Item_hashslot2[i],b-udg_Item_Adds2[i])
set i = udg_Item_Count
endif
set i = i + 1
endloop
set u = null
endfunction
//===========================================================================
function InitTrig_itemlose takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddCondition(t,Condition(function Itemlose_Conds))
call TriggerAddAction( t, function Itemlose_Acts )
set t = null
endfunction
scope Troggbane initializer onInit
globals
private constant integer ABILCODE = 'A00L'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer id = GetHandleId(CASTER)
local integer LEVEL = LoadInteger(udg_hash,id,GetTroggbaneHash())
call AddHeroParameter(GetTriggerUnit(),GetTroggbaneLifeSteal()*LEVEL,GetTroggbaneDuration(),13,"Unholy Presence.mdx","overhead")
call AddHeroParameter(GetTriggerUnit(),GetTroggbaneDamageMult()*LEVEL,GetTroggbaneDuration(),10,"none","none")
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope HeavensFall initializer onInit
globals
private constant integer ABILCODE = 'A00U'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetHeavensFallHash())
call AddHeroParameter(GetTriggerUnit(),GetHeavensFallBaseHaste()+GetHeavensFallLvlHaste()*lvl,GetHeavensFallDuration(),GetHasteHash(),"Abilities\\Spells\\Human\\slow\\slowtarget.mdl","origin")
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope BarrierShield initializer onInit
globals
private constant integer ABILCODE = 'A019'
private constant string EFFECT = "Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetBarrierShieldHash())
call AddHeroParameter(u,GetBarrierShieldResist()*lvl,GetBarrierShieldDuration,GetSpellResistHash(),EFFECT,"chest")
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope ColdwraithPlate initializer onInit
globals
private constant integer ABILCODE = 'A01J'
private constant integer AURACODE = 'A070'
private constant integer BUFFCODE = 'B020'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetColdwraithPlateHash())
call UnitShield.Add(u,u,lvl*GetColdwraithPlateAbsorb(),GetColdwraithPlateDuration(),-1,0.5,AURACODE,BUFFCODE)
//call AddAbsorb(u,lvl*GetColdwraithPlateAbsorb(),GetColdwraithPlateDuration(),"Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorTarget.mdl","chest")
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope LightbringerChestguard initializer onInit
globals
private constant integer ABILCODE = 'A02H'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetLightbringerChestguardHash())
call AddHeroParameter(u,GetLightbringerChestguardReceivedHealing()*lvl,GetLightbringerChestguardDuration(),GetReceivedHealingBonusHash(),"","")
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope AbominationRibcage initializer onInit
globals
private constant integer ABILCODE = 'A02K'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetAbominationRibcageHash())
call AddHeroParameter(u,GetAbominationRibcageBlockAmount()*lvl,GetAbominationRibcageDuration(),GetBlockAmountHash(),"","")
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope FirehandGauntlets initializer onInit
globals
private constant integer ABILCODE = 'A02U'
private constant integer ABILBUFF = 'A02V'
private constant integer BUFFCODE = 'B00P'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onTimerRemoveExpertise takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer Expertise = LoadInteger(udg_hash,GetHandleId(t),2)
call UnitRemoveAbility(u,ABILBUFF)
call UnitRemoveAbility(u,BUFFCODE)
call SetHeroAgi(u,GetHeroAgi(u,false)-Expertise,true)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetFirehandGauntletsHash())
local integer Expertise = lvl * GetFirehandGauntletsExpertise()
call SetHeroAgi(u,GetHeroAgi(u,false)+Expertise,true)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveInteger(udg_hash,GetHandleId(t),2,Expertise)
call UnitAddAbility(u,ABILBUFF)
call TimerStart(t,GetFirehandGauntletsDuration(),false,function onTimerRemoveExpertise)
set t = null
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope DemonStalkerGauntlets initializer onInit
globals
private constant integer ABILCODE = 'A02W'
private constant integer ABILBUFF = 'A02X'
private constant integer BUFF = 'B00Q'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetDemonStalkerGauntletsHash())
set IHP_ABI = ABILBUFF
set IHP_BUFFER = BUFF
call AddHeroParameter(u,GetDemonStalkerGauntletsBlockChance(),GetDemonStalkerGauntletsDuration(),GetBlockChanceHash(),"","")
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope GlovesOfHolyMight initializer onInit
globals
private constant integer ABILCODE = 'A02Y'
private constant integer ABILBUFF = 'A02Z'
private constant integer BUFF = 'B00R'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
set IHP_ABI = ABILBUFF
set IHP_BUFFER = BUFF
call AddHeroParameter(u,0.,10.,0,"","")
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope HelmoftheElderMoon initializer onInit
globals
private constant integer ABILCODE = 'A032'
private constant integer ABILBUFF = 'A033'
private constant integer BUFF = 'B00T'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetElderMoonHelmHash())
set IHP_ABI = ABILBUFF
set IHP_BUFFER = BUFF
call AddHeroParameter(u,GetElderMoonHelmBonusInCombatRegen()*lvl,GetElderMoonHelmDuration(),GetInCombatManaRegenHash(),"","")
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope BrokenRamSkullHelm initializer onInit
globals
private constant integer ABILCODE = 'A034'
private constant integer ABILBUFF = 'A035'
private constant integer BUFF = 'B00U'
private constant integer DMGABI = 'A036'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function Release takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call UnitRemoveAbility(u,DMGABI)
set t = null
set u = null
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetBrokenRamHelmHash())
set IHP_ABI = ABILBUFF
set IHP_BUFFER = BUFF
call UnitAddAbility(u,DMGABI)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,GetBrokenRamHelmDuration(),false,function Release)
set u = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope DaybreakerHelm initializer onInit
globals
private constant integer ABILCODE = 'A039'
private constant integer ABILBUFF = 'A038'
private constant integer BUFF = 'B00W'
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) and not IsUnitInGroup(GetFilterUnit(),AFFECTED)
endfunction
private function Release takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = LoadGroupHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveGroup(g,AFFECTED)
call DestroyGroup(g)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set g = null
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(u),GetDaybreakerHelmHash())
local timer t = CreateTimer()
local group g = CreateGroup()
set udg_temp_unit = u
call DestroyEffect(AddSpecialEffect("effects\\FireNova.mdl",GetUnitX(u),GetUnitY(u)))
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(u),GetUnitY(u),300.,Filter(function GroupFilter))
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call GroupAddUnit(g,udg_temp_unit)
set IHP_ABI = ABILBUFF
set IHP_BUFFER = BUFF
call AddHeroParameter(udg_temp_unit,-lvl*GetDaybreakerHelmDamageAmplify(),GetDaybreakerHelmDuration(),GetSpellResistHash(),"","")
call AddHeroParameter(udg_temp_unit,-lvl*GetDaybreakerHelmDamageAmplify(),GetDaybreakerHelmDuration(),GetPhysDmgReduceHash(),"","")
endloop
call GroupAddGroup(g,AFFECTED)
call SaveGroupHandle(udg_hash,GetHandleId(t),1,g)
call TimerStart(t,GetDaybreakerHelmAffectDuration,false,function Release)
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope FrostbroodSapphireRing initializer onInit
globals
private constant integer ABILCODE = 'A05U'
private constant integer ABILBUFF = 'A05V'
private constant integer BUFF = 'B01J'
private constant string EFFECT = "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareMissile.mdl"
private constant string ATTACH = "hand left"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetFrostbroodSapphireRingHash())
set IHP_ABI = ABILBUFF
set IHP_BUFFER = BUFF
call AddHeroParameter(CASTER,GetFrostbroodSapphireRingSpellPower()*lvl,GetFrostbroodSapphireRingDuration(),GetSpellPowerHash(),EFFECT,ATTACH)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope TomeOfTheIceLord initializer onInit
globals
private constant integer ABILCODE = 'A05W'
private constant integer ABILBUFF = 'A05X'
private constant integer BUFF = 'B01K'
private constant string EFFECT = "Environment\\UndeadBuildingFire\\UndeadSmallBuildingFire2.mdl"
private constant string ATTACH = "hand right"
constant integer TOME_OF_THE_ICE_LORD_BUFF = BUFF
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetTomeOfTheIceLordHash())
set IHP_ABI = ABILBUFF
set IHP_BUFFER = BUFF
call AddHeroParameter(CASTER,GetTomeOfTheIceLordSpellCritPower()*lvl,GetTomeOfTheIceLordDuration(),GetSpellCritMultiplierHash(),EFFECT,ATTACH)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope BookOfBindingWill initializer onInit
globals
private constant integer ABILBUFF = 'A05Z'
private constant integer BUFF = 'B01M'
private constant string EFFECT = ""
private constant string ATTACH = ""
private constant real TIMER_PERIOD = 0.25
private constant integer ITEM_TYPE = 'I00K'
private group BOOK_USERS = CreateGroup()
endglobals
private function AddSpellCrit takes nothing returns nothing
local unit CASTER = GetEnumUnit()
local integer lvl = 0
if GetWidgetLife(CASTER)/GetUnitState(GetEnumUnit(),UNIT_STATE_MAX_LIFE) < GetBookOfBindingWillHpThreshold() then
if not (GetUnitAbilityLevel(CASTER,BUFF)>0) then
call UnitAddAbility(CASTER,ABILBUFF)
endif
set lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetBookOfBindingWillHash())
call AddHeroParameter(CASTER,GetBookOfBindingWillSpellCrit()*lvl,TIMER_PERIOD,GetSpellCritHash(),EFFECT,ATTACH)
else
call UnitRemoveAbility(CASTER,ABILBUFF)
call UnitRemoveAbility(CASTER,BUFF)
endif
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
call ForGroup(BOOK_USERS, function AddSpellCrit)
endfunction
private function Conds takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == ITEM_TYPE
endfunction
private function onBookPickUp takes nothing returns nothing
call GroupAddUnit(BOOK_USERS,GetTriggerUnit())
endfunction
private function onBookLose takes nothing returns nothing
call GroupRemoveUnit(BOOK_USERS,GetTriggerUnit())
if GetUnitAbilityLevel(GetTriggerUnit(),BUFF)>0 then
call UnitRemoveAbility(GetTriggerUnit(),ABILBUFF)
call UnitRemoveAbility(GetTriggerUnit(),BUFF)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction( t, function onBookPickUp )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddCondition(t1,Condition(function Conds))
call TriggerAddAction( t1, function onBookLose )
set t = null
set t1 = null
call TimerStart(CreateTimer(),TIMER_PERIOD,true,function onTimer)
endfunction
endscope
library BookOfHighborneHymns
globals
private integer ABILBUFF = 'A05Y'
private integer BUFF = 'B01L'
endglobals
function GetBookOfHighborneHymnsAbilBuff takes nothing returns integer
return ABILBUFF
endfunction
function GetBookOfHighborneHymnsBuff takes nothing returns integer
return BUFF
endfunction
endlibrary
scope ScorchedScarletKey initializer onInit
globals
private constant integer ABILCODE = 'A08J'
private constant integer ABILDUMMY_CODE = 'A08I'
private constant real DURATION = 5.
private constant real PHYS_DMG_REDUCE = 0.5
private constant real SPELL_DMG_REDUCE = 0.5
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetScorchedScarletKeyHash())
call DummyCastTarget(CASTER,CASTER,ABILDUMMY_CODE,lvl,"unholyfrenzy")
call AddHeroParameter(CASTER,-PHYS_DMG_REDUCE,DURATION,GetPhysDmgReduceHash(),"","")
call AddHeroParameter(CASTER,-SPELL_DMG_REDUCE,DURATION,GetSpellResistHash(),"","")
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope HollowSkeletonKey initializer onInit
globals
private constant integer ABILCODE = 'A08K'
private constant integer ABILDUMMY_CODE = 'A08L'
private constant integer LEVEL_CHANCE = 25
private constant string PROC_EFFECT = "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetHollowSkeletonKeyHash())
if GetWidgetLife(CASTER)/GetUnitState(CASTER,UNIT_STATE_MAX_LIFE) > 0.5 then
call SetUnitState(CASTER,UNIT_STATE_LIFE,GetWidgetLife(CASTER)-GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)*0.5)
else
call KillUnit(CASTER)
endif
call DummyCastTarget(CASTER,CASTER,ABILDUMMY_CODE,lvl,"cripple")
if GetRandomInt(1,100) <= LEVEL_CHANCE*lvl then
call MakeUnitOutOfCombat(CASTER)
call SetUnitAnimation(CASTER,"death")
call DestroyEffect(AddSpecialEffectTarget(PROC_EFFECT,CASTER,"origin"))
endif
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope TheNexusKey initializer onInit
globals
private constant integer ABILCODE = 'A08M'
private constant real AOE = 350
private constant real DURATION = 5
private constant real PERIOD = 1
private constant string DOT_EFFECT = "Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl"
private constant string DOT_ATTACH = "chest"
private constant string EFFECT = "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local integer lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetTheNexusKeyHash())
local group g = CreateGroup()
local unit tempu = null
local location loc = Location(x,y)
local effect eff = AddSpecialEffect(EFFECT,x,y)
call BlzSetSpecialEffectScale(eff,3.0)
call DestroyEffect(eff)
set eff = null
call PlaySoundAtPointBJ( gg_snd_TheBlackArrow, 100, loc, 0 )
call RemoveLocation(loc)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,AOE,function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call AUTODOT(CASTER,tempu,GetTheNexusKeyDamage()*lvl+GetUnitSpellPower(CASTER)*GetTheNexusKeySpellPower()*lvl,DURATION,PERIOD,6,DOT_EFFECT,DOT_ATTACH,false)
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=30
//TESH.alwaysfold=0
scope ArcweaverSpellSword initializer onInit
globals
private constant integer ABILBUFF = 'A09P'
private constant integer BUFF = 'B031'
private constant string EFFECT = ""
private constant string ATTACH = ""
private constant real TIMER_PERIOD = 0.25
private constant integer ITEM_TYPE = 'I006'
private group ITEM_USERS = CreateGroup()
private group ITEM_LOSERS = CreateGroup()
endglobals
private function CheckBonuses takes nothing returns nothing
local unit CASTER = GetEnumUnit()
local integer hash = GetArcweaverSpellSwordLastDamageBonusHash()
local integer lvl = LoadInteger(udg_hash,GetHandleId(CASTER),GetArcweaverSpellSwordHash())
local integer LAST_DMG = LoadInteger(udg_hash,GetHandleId(CASTER),hash)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local integer NEW_DMG = R2I( SPELLPOWER * ( GetArcweaverSpellSwordBonusBase() + (lvl-1)*GetArcweaverSpellSwordBonusLvl() ) )
if LAST_DMG > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)-LAST_DMG,0)
endif
if NEW_DMG > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)+NEW_DMG,0)
call SaveInteger(udg_hash,GetHandleId(CASTER),hash,NEW_DMG)
else
call SaveInteger(udg_hash,GetHandleId(CASTER),hash,0)
endif
if IsUnitInGroup(CASTER,ITEM_LOSERS) then
call GroupRemoveUnit(ITEM_USERS,GetTriggerUnit())
call UnitRemoveAbility(CASTER,ABILBUFF)
call UnitRemoveAbility(CASTER,BUFF)
endif
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
call ForGroup(ITEM_USERS, function CheckBonuses)
endfunction
private function Conds takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == ITEM_TYPE
endfunction
private function onItemPickUp takes nothing returns nothing
call UnitAddAbility(GetTriggerUnit(),ABILBUFF)
call GroupAddUnit(ITEM_USERS,GetTriggerUnit())
call GroupRemoveUnit(ITEM_LOSERS,GetTriggerUnit())
endfunction
private function onItemLose takes nothing returns nothing
call GroupAddUnit(ITEM_LOSERS, GetTriggerUnit())
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction( t, function onItemPickUp )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddCondition(t1,Condition(function Conds))
call TriggerAddAction( t1, function onItemLose )
set t = null
set t1 = null
call TimerStart(CreateTimer(),TIMER_PERIOD,true,function onTimer)
endfunction
endscope
function Trig_Potions_BASE_Actions takes nothing returns nothing
set udg_Potions_COUNT = 8
set udg_Potions_RUNE[1] = 'I03J'
set udg_Potions_RUNE[2] = 'I03K'
set udg_Potions_RUNE[3] = 'I03L'
set udg_Potions_RUNE[4] = 'I03S'
set udg_Potions_RUNE[5] = 'I03P'
set udg_Potions_RUNE[6] = 'I03M'
set udg_Potions_RUNE[7] = 'I03N'
set udg_Potions_RUNE[8] = 'I03O'
set udg_Potions_ORIGIN[1] = 'I02F'
set udg_Potions_ORIGIN[2] = 'I02G'
set udg_Potions_ORIGIN[3] = 'I02J'
set udg_Potions_ORIGIN[4] = 'I03Q'
set udg_Potions_ORIGIN[5] = 'I02L'
set udg_Potions_ORIGIN[6] = 'I02M'
set udg_Potions_ORIGIN[7] = 'I02O'
set udg_Potions_ORIGIN[8] = 'I02N'
set udg_Potions_DISABLED[1] = 'I02H'
set udg_Potions_DISABLED[2] = 'I02I'
set udg_Potions_DISABLED[3] = 'I02K'
set udg_Potions_DISABLED[4] = 'I03R'
set udg_Potions_DISABLED[5] = 'I02P'
set udg_Potions_DISABLED[6] = 'I02S'
set udg_Potions_DISABLED[7] = 'I02R'
set udg_Potions_DISABLED[8] = 'I02Q'
endfunction
//===========================================================================
function InitTrig_Potions_BASE takes nothing returns nothing
set gg_trg_Potions_BASE = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Potions_BASE, 0.00 )
call TriggerAddAction( gg_trg_Potions_BASE, function Trig_Potions_BASE_Actions )
endfunction
library PotionsUtils
function GetOriginPotion takes integer whichtype returns integer
local integer i = 1
loop
exitwhen i > udg_Potions_COUNT
if udg_Potions_DISABLED[i] == whichtype then
return udg_Potions_ORIGIN[i]
endif
set i = i + 1
endloop
return 0
endfunction
function GetDisabledPotion takes integer whichtype returns integer
local integer i = 1
loop
exitwhen i > udg_Potions_COUNT
if udg_Potions_ORIGIN[i] == whichtype then
return udg_Potions_DISABLED[i]
endif
set i = i + 1
endloop
return 0
endfunction
function ResetElixir takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_hash,id,1)
local integer hashkey = LoadInteger(udg_hash,id,2)
local integer spellid = LoadInteger(udg_hash,id,3)
local integer spellid2 = LoadInteger(udg_hash,id,4)
call UnitRemoveAbility(u,spellid)
if spellid2 != 0 then
call UnitRemoveAbility(u,spellid2)
endif
call SaveBoolean(udg_hash,GetHandleId(u),hashkey,false)
call FlushChildHashtable(udg_hash,id)
call DestroyTimer(t)
set t = null
set u = null
endfunction
endlibrary
library BookOfOblivion initializer onInit requires HordeChampionTalents,SorceressTalents,ShamanTalents,BloodelfCaptainTalents,StonebreakerTalents,DruidTalents,DeathKnightTalents,RangerTalents,PriestTalents,HereticTalents, AkamaTalents
private function MakeHeroUnlearnTalents takes nothing returns nothing
local unit hero = GetTriggerUnit()
if GetUnitTypeId(hero) == HORDE_CHAMPION_CODE then
call HordeChampionUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == SORCERESS_CODE then
call SorceressUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == SHAMAN_CODE or GetUnitTypeId(hero) == SHAMAN_WOLF_CODE then
call ShamanUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == BLOODELF_CAPTAIN_CODE then
call BloodElfCaptainUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == STONEBREAKER_CODE then
call StonebreakerUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == DRUID_CODE or GetUnitTypeId(hero) == DRUID_TREE_CODE then
call DruidUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == DEATH_KNIGHT_CODE then
call DeathKnightUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == RANGER_CODE then
call RangerUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == PRIEST_CODE then
call PriestUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == ERETIC_CODE then
call EreticUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == AKAMA_CODE then
call AkamaUnlearnTalents(hero)
endif
if GetUnitTypeId(hero) == IRON_GOLEM_CODE then
call IronGolemUnlearnTalents(hero)
endif
set hero = null
endfunction
private function Conds takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'I00U'
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerAddCondition(t,function Conds)
call TriggerAddAction(t,function MakeHeroUnlearnTalents)
set t = null
endfunction
endlibrary
//TESH.scrollpos=138
//TESH.alwaysfold=0
library POTIONS initializer Init requires PotionsUtils
globals
private constant integer LESSER_HEALING_POTION = 'I02F'
private constant integer LESSER_MANA_POTION = 'I02G'
private constant integer RESTORATION_POTION = 'I02J'
private constant integer GREAT_HEALING_POTION = 'I03Q'
private constant integer ELIXIR_WYRM = 'I02M'
private constant integer ELIXIR_DEADLY = 'I02L'
private constant integer ELIXIR_DEEP = 'I02N'
private constant integer ELIXIR_STONE = 'I02O'
private constant real ELIXIR_DURATION = 30.
endglobals
private function SimError takes player ForPlayer, string msg returns nothing
if udg_SimError==null then
set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
endif
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
call StartSound( udg_SimError )
endif
endfunction
private function Actions takes nothing returns nothing
local item it = GetManipulatedItem()
local item temp_item = null
local unit u = GetTriggerUnit()
local integer id = GetHandleId(u)
local integer HEALCOUNT = 0
local integer MANACOUNT = 0
local integer ELIXIRCOUNT = 0
local integer slot = 0
local integer rawcode = 0
local integer charges
local real restored = 0.
local string TXT
local timer t = null
local boolean IsB_elixirUsed = false
local boolean IsG_elixirUsed = false
local boolean UnitInCombat = IsUnitInCombat(GetTriggerUnit())
if GetItemTypeId(it) == LESSER_HEALING_POTION then // Check if Healing
set HEALCOUNT = LoadInteger(udg_hash,id,33)
if HEALCOUNT < 3 then
set restored = GetRandomReal(750.,1500.)
call HealUnit(u,u,restored)
//call SetWidgetLife(u,GetWidgetLife(u)+restored)
//set TXT = "+|c0000FF00" + I2S(R2I(restored))
//call AddTextTagUnit(TXT,u,GetForceOfPlayer(GetOwningPlayer(u)),225.,10.,1.5,0.)
endif
if UnitInCombat and not udg_Singleplayer then
set HEALCOUNT = HEALCOUNT + 1
call SaveInteger(udg_hash,id,33,HEALCOUNT)
endif
endif
if GetItemTypeId(it) == GREAT_HEALING_POTION then // Check if Great Healing
set HEALCOUNT = LoadInteger(udg_hash,id,33)
if HEALCOUNT < 3 then
set restored = GetRandomReal(3000.,6000.)
call HealUnit(u,u,restored)
//call SetWidgetLife(u,GetWidgetLife(u)+restored)
//set TXT = "+|c0000FF00" + I2S(R2I(restored))
//call AddTextTagUnit(TXT,u,GetForceOfPlayer(GetOwningPlayer(u)),225.,10.,1.5,0.)
endif
if UnitInCombat and not udg_Singleplayer then
set HEALCOUNT = HEALCOUNT + 1
call SaveInteger(udg_hash,id,33,HEALCOUNT)
endif
endif
if GetItemTypeId(it) == LESSER_MANA_POTION then // Check if MANA
set MANACOUNT = LoadInteger(udg_hash,id,34)
if MANACOUNT < 3 then
set restored = GetRandomReal(375.,750.)
call RegenerateMana(u,restored)
//call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)+restored)
//set TXT = "+|c000042FF" + I2S(R2I(restored))
//call AddTextTagUnit(TXT,u,GetForceOfPlayer(GetOwningPlayer(u)),315.,10.,1.5,0.)
endif
if UnitInCombat and not udg_Singleplayer then
set MANACOUNT = MANACOUNT + 1
call SaveInteger(udg_hash,id,34,MANACOUNT)
endif
endif
if GetItemTypeId(it) == RESTORATION_POTION then // Check if Restoration
set HEALCOUNT = LoadInteger(udg_hash,id,33)
set MANACOUNT = LoadInteger(udg_hash,id,34)
if MANACOUNT < 3 and HEALCOUNT < 3 then
//hit points
set restored = GetRandomReal(1500.,3000.)
call HealUnit(u,u,restored)
//call SetWidgetLife(u,GetWidgetLife(u)+restored)
//set TXT = "+|c0000FF00" + I2S(R2I(restored))
//call AddTextTagUnit(TXT,u,GetForceOfPlayer(GetOwningPlayer(u)),225.,10.,1.5,0.)
//if GetUnitState(u,UNIT_STATE_MAX_MANA) > 200. then
set restored = GetRandomReal(750.,1500.)
call RegenerateMana(u,restored)
//call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)+restored)
//set TXT = "+|c000042FF" + I2S(R2I(restored))
//call AddTextTagUnit(TXT,u,GetForceOfPlayer(GetOwningPlayer(u)),315.,10.,1.5,0.)
//endif
endif
if UnitInCombat and not udg_Singleplayer then
set HEALCOUNT = HEALCOUNT + 1
set MANACOUNT = MANACOUNT + 1
call SaveInteger(udg_hash,id,33,HEALCOUNT)
call SaveInteger(udg_hash,id,34,MANACOUNT)
endif
endif
if GetItemTypeId(it) == ELIXIR_WYRM then // Check if Elixir of the Frost Wyrm
set ELIXIRCOUNT = LoadInteger(udg_hash,id,35)
set IsB_elixirUsed = LoadBoolean(udg_hash,id,36)
if ELIXIRCOUNT < 1 and not IsB_elixirUsed then
call SaveBoolean(udg_hash,id,36,true)
call AddHeroParameter(u,150.,30.,5,"","")
call UnitAddAbility(u,'A00N')
call UnitMakeAbilityPermanent(u,true,'A00N')
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveInteger(udg_hash,GetHandleId(t),2,36)
call SaveInteger(udg_hash,GetHandleId(t),3,'A00N')
call TimerStart(t,ELIXIR_DURATION,false,function ResetElixir)
set t = null
else
call SetItemCharges(it,GetItemCharges(it)+1)
call SimError(GetOwningPlayer(u),"You cannot use a new elixir while the old one is active.")
endif
if UnitInCombat and not IsB_elixirUsed then
set ELIXIRCOUNT = ELIXIRCOUNT + 1
call SaveInteger(udg_hash,id,36,ELIXIRCOUNT)
endif
endif
if GetItemTypeId(it) == ELIXIR_DEADLY then // Check if Elixir of Deadly Strikes
set ELIXIRCOUNT = LoadInteger(udg_hash,id,35)
set IsB_elixirUsed = LoadBoolean(udg_hash,id,36)
if ELIXIRCOUNT < 1 and not IsB_elixirUsed then
call SaveBoolean(udg_hash,id,36,true)
call AddHeroParameter(u,10.,ELIXIR_DURATION,2,"","")
call UnitAddAbility(u,'A01Z')
call UnitMakeAbilityPermanent(u,true,'A01Z')
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveInteger(udg_hash,GetHandleId(t),2,36)
call SaveInteger(udg_hash,GetHandleId(t),3,'A01Z')
call TimerStart(t,ELIXIR_DURATION,false,function ResetElixir)
set t = null
else
call SetItemCharges(it,GetItemCharges(it)+1)
call SimError(GetOwningPlayer(u),"You cannot use a new elixir while the old one is active.")
endif
if UnitInCombat and not IsB_elixirUsed then
set ELIXIRCOUNT = ELIXIRCOUNT + 1
call SaveInteger(udg_hash,id,36,ELIXIRCOUNT)
endif
endif
if GetItemTypeId(it) == ELIXIR_DEEP then // Check if Elixir of Deep Earth
set ELIXIRCOUNT = LoadInteger(udg_hash,id,35)
set IsG_elixirUsed = LoadBoolean(udg_hash,id,37)
if ELIXIRCOUNT < 1 and not IsG_elixirUsed then
call SaveBoolean(udg_hash,id,37,true)
call UnitAddAbility(u,'A020')
call UnitMakeAbilityPermanent(u,true,'A020')
call UnitAddAbility(u,'A022')
call UnitMakeAbilityPermanent(u,true,'A022')
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveInteger(udg_hash,GetHandleId(t),2,37)
call SaveInteger(udg_hash,GetHandleId(t),3,'A020')
call SaveInteger(udg_hash,GetHandleId(t),4,'A022')
call TimerStart(t,ELIXIR_DURATION,false,function ResetElixir)
set t = null
else
call SetItemCharges(it,GetItemCharges(it)+1)
call SimError(GetOwningPlayer(u),"You cannot use a new elixir while the old one is active.")
endif
if UnitInCombat and not IsG_elixirUsed then
set ELIXIRCOUNT = ELIXIRCOUNT + 1
call SaveInteger(udg_hash,id,36,ELIXIRCOUNT)
endif
endif
if GetItemTypeId(it) == ELIXIR_STONE then // Check if Elixir of Stoneblood
set ELIXIRCOUNT = LoadInteger(udg_hash,id,35)
set IsG_elixirUsed = LoadBoolean(udg_hash,id,37)
if ELIXIRCOUNT < 1 and not IsG_elixirUsed then
call SaveBoolean(udg_hash,id,37,true)
call UnitAddAbility(u,'A021')
call UnitMakeAbilityPermanent(u,true,'A021')
call UnitAddAbility(u,'A023')
call UnitMakeAbilityPermanent(u,true,'A023')
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveInteger(udg_hash,GetHandleId(t),2,37)
call SaveInteger(udg_hash,GetHandleId(t),3,'A021')
call SaveInteger(udg_hash,GetHandleId(t),4,'A023')
call TimerStart(t,ELIXIR_DURATION,false,function ResetElixir)
set t = null
else
call SetItemCharges(it,GetItemCharges(it)+1)
call SimError(GetOwningPlayer(u),"You cannot use a new elixir while the old one is active.")
endif
if UnitInCombat and not IsG_elixirUsed then
set ELIXIRCOUNT = ELIXIRCOUNT + 1
call SaveInteger(udg_hash,id,36,ELIXIRCOUNT)
endif
endif
set slot = 0
//CHECKING POTIONS/ELIXIRS TO DISABLE
if MANACOUNT >= 3 then
loop
exitwhen slot>5
set rawcode = GetItemTypeId(UnitItemInSlot(u,slot))
if rawcode == LESSER_MANA_POTION and UnitItemInSlot(u,slot)!=null then
set charges = GetItemCharges(UnitItemInSlot(u,slot))
call RemoveItem(UnitItemInSlot(u,slot))
if charges > 0 then
call UnitAddItemToSlotById(u,udg_Potions_DISABLED[2],slot)
call SetItemCharges(UnitItemInSlot(u,slot),charges)
endif
endif
set slot = slot + 1
endloop
endif
set slot = 0
if MANACOUNT >= 3 or HEALCOUNT >=3 then
loop
exitwhen slot>5
set rawcode = GetItemTypeId(UnitItemInSlot(u,slot))
if rawcode == RESTORATION_POTION and UnitItemInSlot(u,slot)!=null then
set charges = GetItemCharges(UnitItemInSlot(u,slot))
call RemoveItem(UnitItemInSlot(u,slot))
if charges > 0 then
call UnitAddItemToSlotById(u,udg_Potions_DISABLED[3],slot)
call SetItemCharges(UnitItemInSlot(u,slot),charges)
endif
endif
set slot = slot + 1
endloop
endif
set slot = 0
if HEALCOUNT >= 3 then
loop
exitwhen slot>5
set rawcode = GetItemTypeId(UnitItemInSlot(u,slot))
if rawcode == LESSER_HEALING_POTION then
set charges = GetItemCharges(UnitItemInSlot(u,slot))
call RemoveItem(UnitItemInSlot(u,slot))
if charges > 0 then
call UnitAddItemToSlotById(u,udg_Potions_DISABLED[1],slot)
call SetItemCharges(UnitItemInSlot(u,slot),charges)
endif
endif
if rawcode == GREAT_HEALING_POTION then
set charges = GetItemCharges(UnitItemInSlot(u,slot))
call RemoveItem(UnitItemInSlot(u,slot))
if charges > 0 then
call UnitAddItemToSlotById(u,udg_Potions_DISABLED[4],slot)
call SetItemCharges(UnitItemInSlot(u,slot),charges)
endif
endif
set slot = slot + 1
endloop
endif
if ELIXIRCOUNT >= 1 then
loop
exitwhen slot>5
set rawcode = GetItemTypeId(UnitItemInSlot(u,slot))
if rawcode == ELIXIR_WYRM or rawcode == ELIXIR_DEADLY or rawcode == ELIXIR_DEEP or rawcode == ELIXIR_STONE then
set charges = GetItemCharges(UnitItemInSlot(u,slot))
call RemoveItem(UnitItemInSlot(u,slot))
if charges > 0 then
call UnitAddItemToSlotById(u,GetDisabledPotion(rawcode),slot)
call SetItemCharges(UnitItemInSlot(u,slot),charges)
endif
endif
set slot = slot + 1
endloop
endif
set it = null
set u = null
endfunction
private function Conditions takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_PURCHASABLE
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerAddCondition(t,Condition(function Conditions))
call TriggerAddAction(t,function Actions)
set t = null
endfunction
endlibrary
//TESH.scrollpos=120
//TESH.alwaysfold=0
library ChargesStacks initializer Init
function IsInventoryFull takes unit u returns integer
local integer slot = 0
loop
exitwhen slot > 5
if UnitItemInSlot(u,slot) == null then
return slot
endif
set slot = slot + 1
endloop
return -1
endfunction
function UnitHasItemId takes unit u,integer itemid returns boolean
local integer slot = 0
loop
exitwhen slot > 5
if GetItemTypeId(UnitItemInSlot(u,slot)) == itemid then
return true
endif
set slot = slot + 1
endloop
return false
endfunction
private function Actions takes nothing returns nothing
local item it = GetManipulatedItem()
local unit u = GetTriggerUnit()
local integer charges = 0
local integer id = GetHandleId(u)
local integer cur_charges = 0
local integer slot = 0
local integer i = 1
local item rune = null
local integer freeslot = IsInventoryFull(u)
local integer HEALCOUNT = LoadInteger(udg_hash,id,33)
local integer MANACOUNT = LoadInteger(udg_hash,id,34)
local integer ELIXIRCOUNT = LoadInteger(udg_hash,id,35)
call DisableTrigger(RUNE_DROP)
if freeslot == -1 then
loop
exitwhen i > udg_Potions_COUNT
set slot = 0
loop
exitwhen slot > 5
if (GetItemTypeId(it) == udg_Potions_RUNE[i]) and not (GetItemTypeId(UnitItemInSlot(u,slot)) == udg_Potions_ORIGIN[i] or GetItemTypeId(UnitItemInSlot(u,slot)) == udg_Potions_DISABLED[i]) then
if UnitHasItemId(u,udg_Potions_ORIGIN[i]) or UnitHasItemId(u,udg_Potions_DISABLED[i]) then
set rune = UnitRemoveItemFromSlot(u,slot)
call DisableTrigger(GetTriggeringTrigger())
if UnitHasItemId(u,udg_Potions_ORIGIN[i]) then
call UnitAddItemToSlotById(u,udg_Potions_ORIGIN[i],slot)
else
call UnitAddItemToSlotById(u,udg_Potions_DISABLED[i],slot)
endif
call SetItemCharges(UnitItemInSlot(u,slot),GetItemCharges(it))
call EnableTrigger(GetTriggeringTrigger())
call UnitAddItem(u,UnitRemoveItemFromSlot(u,slot))
call UnitAddItem(u,rune)
set rune = null
else
call SetItemCharges(CreateItem(udg_Potions_RUNE[i],GetUnitX(u),GetUnitY(u)),GetItemCharges(it))
endif
set i = udg_Potions_COUNT
set slot = 5
endif
set slot = slot + 1
endloop
set i = i + 1
endloop
else
set i = 1
loop
exitwhen i > udg_Potions_COUNT
if GetItemTypeId(it) == udg_Potions_RUNE[i]then
call DisableTrigger(GetTriggeringTrigger())
if (HEALCOUNT<3 and i==1 or i==4) or (MANACOUNT<3 and i==2) or (ELIXIRCOUNT<1 and i==5 or i==6 or i==7 or i==8) or (i==3 and HEALCOUNT<3 and MANACOUNT<3) then
call UnitAddItemToSlotById(u,udg_Potions_ORIGIN[i],freeslot)
else
call UnitAddItemToSlotById(u,udg_Potions_DISABLED[i],freeslot)
endif
call SetItemCharges(UnitItemInSlot(u,freeslot),GetItemCharges(it))
call EnableTrigger(GetTriggeringTrigger())
call UnitAddItem(u,UnitRemoveItemFromSlot(u,freeslot))
set i = udg_Potions_COUNT
endif
set i = i + 1
endloop
endif
call EnableTrigger(RUNE_DROP)
//Checking for LIMIT OF USES for picked item and then disabling it
if HEALCOUNT >= 3 and GetItemTypeId(it) == udg_Potions_ORIGIN[1] then
set charges = GetItemCharges(it)
call RemoveItem(it)
set it = null
set it = UnitAddItemById(u,udg_Potions_DISABLED[1])
call SetItemCharges(it,charges)
endif
if HEALCOUNT >= 3 and GetItemTypeId(it) == udg_Potions_ORIGIN[4] then
set charges = GetItemCharges(it)
call RemoveItem(it)
set it = null
set it = UnitAddItemById(u,udg_Potions_DISABLED[4])
call SetItemCharges(it,charges)
endif
if MANACOUNT >= 3 and GetItemTypeId(it) == udg_Potions_ORIGIN[2] then
set charges = GetItemCharges(it)
call RemoveItem(it)
set it = null
set it = UnitAddItemById(u,udg_Potions_DISABLED[2])
call SetItemCharges(it,charges)
endif
if (MANACOUNT >= 3 or HEALCOUNT >= 3) and GetItemTypeId(it) == udg_Potions_ORIGIN[3] then
set charges = GetItemCharges(it)
call RemoveItem(it)
set it = null
set it = UnitAddItemById(u,udg_Potions_DISABLED[3])
call SetItemCharges(it,charges)
endif
if ELIXIRCOUNT >=1 then
set i = 5
loop //Checking for Elixirs
exitwhen i > 8
if GetItemTypeId(it) == udg_Potions_ORIGIN[i] then
set charges = GetItemCharges(it)
call RemoveItem(it)
set it = null
set it = UnitAddItemById(u,udg_Potions_DISABLED[i])
call SetItemCharges(it,charges)
set i = 8
endif
set i = i + 1
endloop
endif
set slot = 0
loop
exitwhen slot > 5
if UnitItemInSlot(u,slot) != it and GetItemTypeId(UnitItemInSlot(u,slot)) == GetItemTypeId(it) then
set cur_charges = GetItemCharges(it)
call RemoveItem(it)
call SetItemCharges(UnitItemInSlot(u,slot),GetItemCharges(UnitItemInSlot(u,slot))+cur_charges)
set slot = 5
endif
set slot = slot + 1
endloop
set it = null
set u = null
endfunction
private function Conditions takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_PURCHASABLE
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerAddAction(t,function Actions)
call TriggerAddCondition(t,Condition(function Conditions))
set t = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DropItemToRune initializer onInit
globals
private item it = null
private unit u = null
trigger RUNE_DROP = null
endglobals
private function Actions2 takes nothing returns nothing
local item itm = GetEnumItem()
local integer i = 0
if itm == it then
loop
exitwhen i > udg_Potions_COUNT
if GetItemTypeId(it) == udg_Potions_ORIGIN[i] then
call SetItemCharges(CreateItem(udg_Potions_RUNE[i],GetWidgetX(it),GetWidgetY(it)),GetItemCharges(it))
call RemoveItem(it)
set i = udg_Potions_COUNT
endif
set i = i + 1
endloop
endif
set itm = null
endfunction
private function Actions1 takes nothing returns nothing
local integer i = 0
call EnumItemsInRect(bj_mapInitialPlayableArea,null,function Actions2)
call DestroyTimer(GetExpiredTimer())
endfunction
private function Actions takes nothing returns nothing
set it = GetManipulatedItem()
set u = GetTriggerUnit()
call TimerStart(CreateTimer(),0.,false,function Actions1)
endfunction
private function Conditions takes nothing returns boolean
local integer i = 0
if GetItemType(GetManipulatedItem()) == ITEM_TYPE_PURCHASABLE then
loop
exitwhen i > udg_Potions_COUNT
if GetItemTypeId(GetManipulatedItem()) == udg_Potions_ORIGIN[i] then
return true
endif
set i = i + 1
endloop
endif
return false
endfunction
private function onInit takes nothing returns nothing
set RUNE_DROP = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(RUNE_DROP,Player(0),EVENT_PLAYER_UNIT_DROP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(RUNE_DROP,Player(1),EVENT_PLAYER_UNIT_DROP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(RUNE_DROP,Player(2),EVENT_PLAYER_UNIT_DROP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(RUNE_DROP,Player(3),EVENT_PLAYER_UNIT_DROP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(RUNE_DROP,Player(4),EVENT_PLAYER_UNIT_DROP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(RUNE_DROP,Player(5),EVENT_PLAYER_UNIT_DROP_ITEM,null)
call TriggerAddCondition(RUNE_DROP,Condition(function Conditions))
call TriggerAddAction(RUNE_DROP,function Actions)
endfunction
endscope
scope XardasTower initializer onInit
globals
unit XARDAS = null //Creating in "unit ini" trigger
group BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP = CreateGroup()
group BELIAR_SACRIFICE_DEEP_FREEZE_GROUP = CreateGroup()
group BELIAR_SACRIFICE_CORRUPTION_GROUP = CreateGroup()
group BELIAR_SACRIFICE_TIGERS_FURY_GROUP = CreateGroup()
private timer CheckTimer = null
constant integer XARDAS_MARKED_ITEMS_COUNT_HASH = 70
private constant integer XARDAS_LAST_ARMOR_CHANGE_HASH = 71
private constant integer XARDAS_LAST_RESIST_CHANGE_HASH = 72
constant real BELIAR_SACRIFICE_ITEM_BONUS_MULT = 0.25
private boolean BELIAR_SACRIFICE_RESET_STATS_FLAG = false
private constant integer ITEM_BELIAR_SACRIFICE_BERSERKERS_RAGE = 'I01X'
private constant integer ABILBUFF_BELIAR_SACRIFICE_BERSERKERS_RAGE = 'A09Q'
private constant integer BUFF_BELIAR_SACRIFICE_BERSERKERS_RAGE = 'B032'
private constant real BERSERKER_RAGE_HP_THRESHOLD_PER_LEVEL = 0.07
private constant integer ITEM_BELIAR_SACRIFICE_DEEP_FREEZE = 'I01Y'
private constant integer ABILBUFF_BELIAR_SACRIFICE_DEEP_FREEZE = 'A09R'
private constant integer BUFF_BELIAR_SACRIFICE_DEEP_FREEZE = 'B033'
constant real BELIAR_SACRIFICE_DEEP_FREEZE_REGEN_REDUCE = 0.05
private constant integer ITEM_BELIAR_SACRIFICE_CORRUPTION = 'I020'
private constant integer ABILBUFF_BELIAR_SACRIFICE_CORRUPTION = 'A09T'
private constant integer BUFF_BELIAR_SACRIFICE_CORRUPTION = 'B035'
private constant real BELIAR_SACRIFICE_CORRUPTION_ARMOR_REDUCE_PER_LEVEL = 0.07
private constant real BELIAR_SACRIFICE_CORRUPTION_SPELL_RESIST_REDUCE_PER_LEVEL = 0.05
private constant integer ITEM_BELIAR_SACRIFICE_TIGERS_FURY = 'I021'
private constant integer ABILBUFF_BELIAR_SACRIFICE_TIGERS_FURY = 'A09S'
private constant integer BUFF_BELIAR_SACRIFICE_TIGERS_FURY = 'B034'
constant real BELIAR_SACRIFICE_TIGERS_FURY_HPMP_THRESHOLD_PER_LEVEL = 0.05
private constant integer ITEM_BELIAR_SACRIFICE_CANCEL = 'I024'
private constant integer ITEM_BELIAR_SACRIFICE_TELEPORT = 'I025'
endglobals
private function CondsSacrifice takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == ITEM_BELIAR_SACRIFICE_BERSERKERS_RAGE or GetItemTypeId(GetManipulatedItem()) == ITEM_BELIAR_SACRIFICE_DEEP_FREEZE or GetItemTypeId(GetManipulatedItem()) == ITEM_BELIAR_SACRIFICE_CORRUPTION or GetItemTypeId(GetManipulatedItem()) == ITEM_BELIAR_SACRIFICE_TIGERS_FURY or GetItemTypeId(GetManipulatedItem()) == ITEM_BELIAR_SACRIFICE_CANCEL or GetItemTypeId(GetManipulatedItem()) == ITEM_BELIAR_SACRIFICE_TELEPORT
endfunction
private function IsUnitXardasMarked takes unit u returns boolean
return IsUnitInGroup(u, BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP) or IsUnitInGroup(u, BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) or IsUnitInGroup(u, BELIAR_SACRIFICE_CORRUPTION_GROUP) or IsUnitInGroup(u, BELIAR_SACRIFICE_TIGERS_FURY_GROUP)
endfunction
private function CountMarkedItemsForUnit takes unit u, integer glyphType returns integer
local integer i = 0
local integer count = 0
local integer markType = 0
local item slotIt = null
loop
exitwhen i > 5
set slotIt = UnitItemInSlot(u,i)
set markType = GetItemXardasMarkType(slotIt)
if markType == glyphType then
set count = count + (GetItemCharges(slotIt)+1)
endif
set i = i +1
endloop
set slotIt = null
return count
endfunction
private function ForBerserkersRage takes nothing returns nothing
local unit u = GetEnumUnit()
local integer lvl = CountMarkedItemsForUnit(u,1)+1
local real maxP = 1.0 - BERSERKER_RAGE_HP_THRESHOLD_PER_LEVEL*(lvl-1)
if maxP <= 0.01 then
set maxP = 0.01
endif
if GetWidgetLife(u)>0. then
if not (GetUnitAbilityLevel(u, ABILBUFF_BELIAR_SACRIFICE_BERSERKERS_RAGE) > 0) then
call UnitAddAbility(u, ABILBUFF_BELIAR_SACRIFICE_BERSERKERS_RAGE)
endif
call SetUnitAbilityLevel(u,ABILBUFF_BELIAR_SACRIFICE_BERSERKERS_RAGE,lvl)
if GetWidgetLife(u)/GetUnitState(u,UNIT_STATE_MAX_LIFE) > maxP then
call SetWidgetLife(u, maxP*GetUnitState(u,UNIT_STATE_MAX_LIFE))
endif
endif
set u = null
endfunction
private function ForDeepFreeze takes nothing returns nothing
local unit u = GetEnumUnit()
local integer lvl = CountMarkedItemsForUnit(u,2)+1
call SaveReal(udg_hash,GetHandleId(u), XARDAS_MARKED_ITEMS_COUNT_HASH, lvl-1)
if not (GetUnitAbilityLevel(u, ABILBUFF_BELIAR_SACRIFICE_DEEP_FREEZE) > 0) then
call UnitAddAbility(u, ABILBUFF_BELIAR_SACRIFICE_DEEP_FREEZE)
endif
call SetUnitAbilityLevel(u,ABILBUFF_BELIAR_SACRIFICE_DEEP_FREEZE,lvl)
call SaveInteger(udg_hash,GetHandleId(u), XARDAS_MARKED_ITEMS_COUNT_HASH, lvl-1)
set u = null
endfunction
private function ForCorruption takes nothing returns nothing
local unit u = GetEnumUnit()
local integer lvl = CountMarkedItemsForUnit(u,3)+1
local integer lastArmor = LoadInteger(udg_hash,GetHandleId(u),XARDAS_LAST_ARMOR_CHANGE_HASH)
local integer curArmor = 0
local real curResist = 0.
local real lastResist = LoadReal(udg_hash,GetHandleId(u),XARDAS_LAST_RESIST_CHANGE_HASH)
call SaveReal(udg_hash,GetHandleId(u), XARDAS_MARKED_ITEMS_COUNT_HASH, lvl-1)
if not (GetUnitAbilityLevel(u, ABILBUFF_BELIAR_SACRIFICE_CORRUPTION) > 0) then
call UnitAddAbility(u, ABILBUFF_BELIAR_SACRIFICE_CORRUPTION)
endif
call SetUnitAbilityLevel(u,ABILBUFF_BELIAR_SACRIFICE_CORRUPTION,lvl)
if lastArmor > 0 then
call BlzSetUnitArmor(u,BlzGetUnitArmor(u)+lastArmor)
endif
set curArmor = R2I(BlzGetUnitArmor(u)*BELIAR_SACRIFICE_CORRUPTION_ARMOR_REDUCE_PER_LEVEL*(lvl-1))
if curArmor < 0 then
set curArmor = -(lvl-1)
endif
if not BELIAR_SACRIFICE_RESET_STATS_FLAG then
call BlzSetUnitArmor(u,BlzGetUnitArmor(u)-curArmor)
call SaveInteger(udg_hash,GetHandleId(u),XARDAS_LAST_ARMOR_CHANGE_HASH,curArmor)
else
call SaveInteger(udg_hash,GetHandleId(u),XARDAS_LAST_ARMOR_CHANGE_HASH,0)
endif
call SaveReal(udg_hash,GetHandleId(u),16,LoadReal(udg_hash,GetHandleId(u),16)+lastResist)
set curResist = BELIAR_SACRIFICE_CORRUPTION_SPELL_RESIST_REDUCE_PER_LEVEL*lvl
if not BELIAR_SACRIFICE_RESET_STATS_FLAG then
call SaveReal(udg_hash,GetHandleId(u),16,LoadReal(udg_hash,GetHandleId(u),16) - curResist )
call SaveReal(udg_hash,GetHandleId(u),XARDAS_LAST_RESIST_CHANGE_HASH,curResist)
else
call SaveReal(udg_hash,GetHandleId(u),XARDAS_LAST_RESIST_CHANGE_HASH,0.)
endif
set u = null
endfunction
private function ForTigersFury takes nothing returns nothing
local unit u = GetEnumUnit()
local integer lvl = CountMarkedItemsForUnit(u,4)+1
local real maxP = 1.0 - BELIAR_SACRIFICE_TIGERS_FURY_HPMP_THRESHOLD_PER_LEVEL*(lvl-1)
if maxP <= 0.01 then
set maxP = 0.01
endif
if GetWidgetLife(u)>0. then
if not (GetUnitAbilityLevel(u, ABILBUFF_BELIAR_SACRIFICE_TIGERS_FURY) > 0) then
call UnitAddAbility(u, ABILBUFF_BELIAR_SACRIFICE_TIGERS_FURY)
endif
call SetUnitAbilityLevel(u,ABILBUFF_BELIAR_SACRIFICE_TIGERS_FURY,lvl)
if GetWidgetLife(u)/GetUnitState(u,UNIT_STATE_MAX_LIFE) > maxP then
call SetWidgetLife(u, maxP*GetUnitState(u,UNIT_STATE_MAX_LIFE))
endif
if GetUnitState(u,UNIT_STATE_MANA)/GetUnitState(u,UNIT_STATE_MAX_MANA) > maxP then
call SetUnitState(u, UNIT_STATE_MANA, maxP*GetUnitState(u,UNIT_STATE_MAX_MANA))
endif
endif
set u = null
endfunction
private function onTimerCheckGroups takes nothing returns nothing
call ForGroup(BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP,function ForBerserkersRage)
call ForGroup(BELIAR_SACRIFICE_DEEP_FREEZE_GROUP,function ForDeepFreeze)
call ForGroup(BELIAR_SACRIFICE_CORRUPTION_GROUP,function ForCorruption)
call ForGroup(BELIAR_SACRIFICE_TIGERS_FURY_GROUP,function ForTigersFury)
endfunction
private function CancelSacrificeForUnit takes unit whichUnit returns nothing
local integer i = 0
local integer glyphType = 0
local item it = null
set BELIAR_SACRIFICE_RESET_STATS_FLAG = true
call onTimerCheckGroups()
set BELIAR_SACRIFICE_RESET_STATS_FLAG = false
if IsUnitInGroup(whichUnit, BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP) then
call GroupRemoveUnit(BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP,whichUnit)
call UnitRemoveAbility(whichUnit, ABILBUFF_BELIAR_SACRIFICE_BERSERKERS_RAGE)
call UnitRemoveAbility(whichUnit, BUFF_BELIAR_SACRIFICE_BERSERKERS_RAGE)
set glyphType = 1
endif
if IsUnitInGroup(whichUnit, BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) then
call GroupRemoveUnit(BELIAR_SACRIFICE_DEEP_FREEZE_GROUP,whichUnit)
call UnitRemoveAbility(whichUnit, ABILBUFF_BELIAR_SACRIFICE_DEEP_FREEZE)
call UnitRemoveAbility(whichUnit, BUFF_BELIAR_SACRIFICE_DEEP_FREEZE)
set glyphType = 2
endif
if IsUnitInGroup(whichUnit, BELIAR_SACRIFICE_CORRUPTION_GROUP) then
call GroupRemoveUnit(BELIAR_SACRIFICE_CORRUPTION_GROUP,whichUnit)
call UnitRemoveAbility(whichUnit, ABILBUFF_BELIAR_SACRIFICE_CORRUPTION)
call UnitRemoveAbility(whichUnit, BUFF_BELIAR_SACRIFICE_CORRUPTION)
set glyphType = 3
endif
if IsUnitInGroup(whichUnit, BELIAR_SACRIFICE_TIGERS_FURY_GROUP) then
call GroupRemoveUnit(BELIAR_SACRIFICE_TIGERS_FURY_GROUP,whichUnit)
call UnitRemoveAbility(whichUnit, ABILBUFF_BELIAR_SACRIFICE_TIGERS_FURY)
call UnitRemoveAbility(whichUnit, BUFF_BELIAR_SACRIFICE_TIGERS_FURY)
set glyphType = 4
endif
if glyphType>0 then
loop
exitwhen i>5
set it = UnitItemInSlot(whichUnit,i)
if GetItemXardasMarkType(it) == glyphType then
call UnitRemoveItem(whichUnit,it)
endif
set i = i + 1
endloop
set it = null
endif
endfunction
private function onSacrifice takes nothing returns nothing
local integer itemId = GetItemTypeId(GetManipulatedItem())
local unit u = GetTriggerUnit()
local boolean flag = false
local integer i = 1
local integer k = 0
local unit tempu = null
if itemId == ITEM_BELIAR_SACRIFICE_BERSERKERS_RAGE then
if not IsUnitXardasMarked(u) then
set flag = true
else
if not IsUnitInGroup(u,BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP) then
call CancelSacrificeForUnit(u)
set flag = true
else
call SimError(GetTriggerPlayer(),"You already have the same Beliar mark.")
endif
endif
if flag then
call GroupAddUnit(BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP, u)
endif
endif
if itemId == ITEM_BELIAR_SACRIFICE_DEEP_FREEZE then
if not IsUnitXardasMarked(u) then
set flag = true
else
if not IsUnitInGroup(u,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP) then
call CancelSacrificeForUnit(u)
set flag = true
else
call SimError(GetTriggerPlayer(),"You already have the same Beliar mark.")
endif
endif
if flag then
call GroupAddUnit(BELIAR_SACRIFICE_DEEP_FREEZE_GROUP, u)
endif
endif
if itemId == ITEM_BELIAR_SACRIFICE_CORRUPTION then
if not IsUnitXardasMarked(u) then
set flag = true
else
if not IsUnitInGroup(u,BELIAR_SACRIFICE_CORRUPTION_GROUP) then
call CancelSacrificeForUnit(u)
set flag = true
else
call SimError(GetTriggerPlayer(),"You already have the same Beliar mark.")
endif
endif
if flag then
call GroupAddUnit(BELIAR_SACRIFICE_CORRUPTION_GROUP, u)
endif
endif
if itemId == ITEM_BELIAR_SACRIFICE_TIGERS_FURY then
if not IsUnitXardasMarked(u) then
set flag = true
else
if not IsUnitInGroup(u,BELIAR_SACRIFICE_TIGERS_FURY_GROUP) then
call CancelSacrificeForUnit(u)
set flag = true
else
call SimError(GetTriggerPlayer(),"You already have the same Beliar mark.")
endif
endif
if flag then
call GroupAddUnit(BELIAR_SACRIFICE_TIGERS_FURY_GROUP, u)
endif
endif
if itemId == ITEM_BELIAR_SACRIFICE_CANCEL then
call CancelSacrificeForUnit(u)
endif
if itemId == ITEM_BELIAR_SACRIFICE_TELEPORT then
call SetUnitPosition( u, GetRectCenterX(gg_rct_Ressurect1), GetRectCenterY(gg_rct_Ressurect1) )
endif
if flag and CheckTimer==null then
set CheckTimer = CreateTimer()
call TimerStart(CheckTimer,0.04, true, function onTimerCheckGroups)
endif
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function CondsMarked takes nothing returns boolean
local item it = GetManipulatedItem()
local boolean flag = ((GetItemType(it) == ITEM_TYPE_ARTIFACT) or (GetItemType(it) == ITEM_TYPE_PERMANENT))
if flag then
return (GetItemXardasMarkType(it)>0)
endif
set it = null
return false
endfunction
private function onEnter takes nothing returns nothing
local real x = GetDestructableX(gg_dest_B00K_4641)
local real y = GetDestructableY(gg_dest_B00K_4641)
call SetUnitPosition( GetTriggerUnit(), x, y )
endfunction
private function onPickUpMarkedItem takes nothing returns nothing
local item it = GetManipulatedItem()
local unit u = GetTriggerUnit()
local integer glyphType = GetItemXardasMarkType(it)
if (glyphType == 1 and not IsUnitInGroup(u,BELIAR_SACRIFICE_BERSERKERS_RAGE_GROUP)) or (glyphType == 2 and not IsUnitInGroup(u,BELIAR_SACRIFICE_DEEP_FREEZE_GROUP)) or (glyphType == 3 and not IsUnitInGroup(u,BELIAR_SACRIFICE_CORRUPTION_GROUP)) or (glyphType == 4 and not IsUnitInGroup(u,BELIAR_SACRIFICE_TIGERS_FURY_GROUP)) then
call UnitRemoveItem(u,it)
call SimError(GetTriggerPlayer(),"You do not have a proper Beliar mark to carry the item.")
endif
set it = null
set u = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_XardasTowerEnter )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onEnter )
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function CondsSacrifice))
call TriggerAddAction(t, function onSacrifice)
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function CondsMarked))
call TriggerAddAction(t, function onPickUpMarkedItem)
set t = null
endfunction
endscope
globals
boolean array WavesOpened[6]
endglobals
scope JewelerChapter1 initializer onInit
globals
unit C1_JEWELER = null
timer C1_JEWELER_TIMER = CreateTimer()
private integer N0 = 0
private integer N1 = 0
private integer N2 = 0
private integer N3 = 0
private integer r_index = 0
private boolean ORDERED_MOVE = false
private boolean ORDERED_MAGMAW = false
private boolean ORDERED_END_ANIM_MAGMAW = false
endglobals
private function GroupFilter takes nothing returns boolean
if GetOwningPlayer(GetFilterUnit()) == INVADERS then
if r_index == 0 then
set N0 = N0+1
endif
if r_index == 1 then
set N1 = N1+1
endif
if r_index == 2 then
set N2 = N2+1
endif
if r_index == 3 then
set N3 = N3+1
endif
endif
return false
endfunction
private function onTimer takes nothing returns nothing
local group g = CreateGroup()
local real x0 = GetUnitX(C1_JEWELER)
local real y0 = GetUnitY(C1_JEWELER)
local real x1 = GetRectCenterX(gg_rct_C1Kobold1)
local real y1 = GetRectCenterY(gg_rct_C1Kobold1)
local real x2 = GetRectCenterX(gg_rct_C1Kobold2)
local real y2 = GetRectCenterY(gg_rct_C1Kobold2)
local real x3 = GetRectCenterX(gg_rct_C1Kobold3)
local real y3 = GetRectCenterY(gg_rct_C1Kobold3)
local integer min_index = 0
if not MAGMAW_DEFEATED then
set r_index = 0
set N0 = 0
call GroupEnumUnitsInRange(g,x0,y0,300, function GroupFilter)
set r_index = 1
set N1 = 0
call GroupEnumUnitsInRange(g,x1,y1,300, function GroupFilter)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"COUNTED N1: " + I2S(N1))
set r_index = 2
set N2 = 0
call GroupEnumUnitsInRange(g,x2,y2,300, function GroupFilter)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"COUNTED N2: " + I2S(N2))
set r_index = 3
set N3 = 0
call GroupEnumUnitsInRange(g,x3,y3,300, function GroupFilter)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"COUNTED N3: " + I2S(N3))
if IsUnitDeadBX(C1_JEWELER) then
call PauseTimer(C1_JEWELER_TIMER)
endif
if GetWidgetLife(C1_JEWELER)>0. then
if (N3 <= N1) and (N3<=N2) then
set min_index = 3
endif
if (N2 <= N1) and (N2<=N3) then
set min_index = 2
endif
if (N1 <= N2) and (N1<=N3) then
set min_index = 1
endif
if min_index == 1 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MIN : " + I2S(min_index))
if SquareRoot((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)) >= 25 then
call IssuePointOrder(C1_JEWELER,"move",x1,y1)
set ORDERED_MOVE = true
else
call SetUnitAnimation(C1_JEWELER,"stand")
call SetUnitFacing(C1_JEWELER,135.)
set ORDERED_MOVE = false
endif
endif
if min_index == 2 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MIN : " + I2S(min_index))
if SquareRoot((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)) >= 25 then
call IssuePointOrder(C1_JEWELER,"move",x2,y2)
set ORDERED_MOVE = true
else
call SetUnitAnimation(C1_JEWELER,"stand")
call SetUnitFacing(C1_JEWELER,225.)
set ORDERED_MOVE = false
endif
endif
if min_index == 3 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MIN : " + I2S(min_index))
if SquareRoot((x0-x3)*(x0-x3)+(y0-y3)*(y0-y3)) >= 25 then
call IssuePointOrder(C1_JEWELER,"move",x3,y3)
set ORDERED_MOVE = true
else
call SetUnitAnimation(C1_JEWELER,"stand")
call SetUnitFacing(C1_JEWELER,0.)
set ORDERED_MOVE = false
endif
endif
endif
else
if not ORDERED_MAGMAW then
set ORDERED_MAGMAW = true
call SetUnitX(C1_JEWELER,GetRectCenterX(gg_rct_C1KoboldBoss))
call SetUnitY(C1_JEWELER,GetRectCenterY(gg_rct_C1KoboldBoss))
call IssuePointOrder(C1_JEWELER,"move",GetRectCenterX(gg_rct_C1KoboldBossEnd),GetRectCenterY(gg_rct_C1KoboldBossEnd))
else
if not ORDERED_END_ANIM_MAGMAW then
if SquareRoot((x0-GetRectCenterX(gg_rct_C1KoboldBossEnd))*(x0-GetRectCenterX(gg_rct_C1KoboldBossEnd))+(y0-GetRectCenterY(gg_rct_C1KoboldBossEnd))*(y0-GetRectCenterY(gg_rct_C1KoboldBossEnd))) >= 25 then
call SetUnitFacing(C1_JEWELER,180.)
call SetUnitAnimationByIndex(C1_JEWELER,2)
set ORDERED_END_ANIM_MAGMAW = true
call SetCinematicScene('h045',null,"Kubb","Get over here!",10.,10.)
endif
endif
endif
endif
call DestroyGroup(g)
set g = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,C1_JEWELER_TIMER )
call TriggerAddAction(t, function onTimer)
set t = null
endfunction
endscope
library OgreGladiator initializer onInit
globals
unit OGRE_GLADIATOR = null
private constant integer ITEM_REINCARNATION = 'I01N'
private constant integer ITEM_REGENERATION = 'I01O'
private constant integer ITEM_BERSERK = 'I01R'
private constant integer ITEM_TOUGHNESS = 'I01S'
private constant integer ITEM_CANCEL = 'I01U'
private constant integer ITEM_CALL_FOR_GRUNTS = 'I01V'
constant integer REINCARNATION_CHALLENGE_ABILCODE = 'A09G'
constant integer REGENERATION_CHALLENGE_ABILCODE = 'A09I'
constant integer REGENERATION_CHALLENGE_AURA_ABILCODE = 'A09K'
constant integer BERSERK_CHALLENGE_ABILCODE = 'A09H'
constant integer TOUGHNESS_CHALLENGE_ABILCODE = 'A09J'
boolean REINCARNATION_CHALLENGE_ACTIVATED = false
boolean REGENERATION_CHALLENGE_ACTIVATED = false
boolean BERSERK_CHALLENGE_ACTIVATED = false
boolean TOUGHNESS_CHALLENGE_ACTIVATED = false
private unit TORCH_REINCARNATION = null
private unit TORCH_REGENERATION = null
private unit TORCH_BERSERK = null
private unit TORCH_TOUGHNESS = null
private unit TORCH_RUNE_REINCARNATION = null
private unit TORCH_RUNE_REGENERATION = null
private unit TORCH_RUNE_BERSERK = null
private unit TORCH_RUNE_TOUGHNESS = null
private real TIME_SINCE_LAST_ANIM = 0.
private constant real SLEEP_TRESHOLD = 30.
private constant real SLEEP_TIMER_PERIOD = 1.
private timer SLEEP_ANIM_TIMER = null
private boolean SLEEP_ANIM_PLAYED = false
endglobals
function ResetOgreGladiatorAnim takes nothing returns nothing
set TIME_SINCE_LAST_ANIM = 0.
endfunction
function ResetOgreGladiatorChallenges takes nothing returns nothing
call SetUnitAnimation(TORCH_REINCARNATION, "death")
call SetUnitAnimation(TORCH_REGENERATION, "death")
call SetUnitAnimation(TORCH_TOUGHNESS, "death")
call SetUnitAnimation(TORCH_BERSERK, "death")
if REINCARNATION_CHALLENGE_ACTIVATED then
call SetUnitAnimation(TORCH_RUNE_REINCARNATION, "death")
endif
if REGENERATION_CHALLENGE_ACTIVATED then
call SetUnitAnimation(TORCH_RUNE_REGENERATION, "death")
endif
if TOUGHNESS_CHALLENGE_ACTIVATED then
call SetUnitAnimation(TORCH_RUNE_TOUGHNESS, "death")
endif
if BERSERK_CHALLENGE_ACTIVATED then
call SetUnitAnimation(TORCH_RUNE_BERSERK, "death")
endif
set REINCARNATION_CHALLENGE_ACTIVATED = false
set REGENERATION_CHALLENGE_ACTIVATED = false
set TOUGHNESS_CHALLENGE_ACTIVATED = false
set BERSERK_CHALLENGE_ACTIVATED = false
endfunction
private function Conds takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_POWERUP and GetItemLevel(GetManipulatedItem()) == 5
endfunction
private function onTimerCheckSleep takes nothing returns nothing
if TIME_SINCE_LAST_ANIM <= SLEEP_TIMER_PERIOD*0.5 then
call SetUnitAnimation(OGRE_GLADIATOR,"stand")
set SLEEP_ANIM_PLAYED = false
endif
set TIME_SINCE_LAST_ANIM = TIME_SINCE_LAST_ANIM + SLEEP_TIMER_PERIOD
if TIME_SINCE_LAST_ANIM >= SLEEP_TRESHOLD and not SLEEP_ANIM_PLAYED then
set SLEEP_ANIM_PLAYED = true
call SetUnitAnimation(OGRE_GLADIATOR,"sleep")
endif
endfunction
private function onChallengeBuy takes nothing returns nothing
local integer itemId = GetItemTypeId(GetManipulatedItem())
local boolean flag = false
local integer i = 1
local integer k = 0
local unit tempu = null
if itemId == ITEM_REINCARNATION and not REINCARNATION_CHALLENGE_ACTIVATED then
set REINCARNATION_CHALLENGE_ACTIVATED = true
call SetUnitAnimation(TORCH_REINCARNATION, "stand")
call SetUnitAnimation(TORCH_RUNE_REINCARNATION, "stand")
call SetUnitAnimation(OGRE_GLADIATOR,"spell")
set flag = true
endif
if itemId == ITEM_REGENERATION and not REGENERATION_CHALLENGE_ACTIVATED then
set REGENERATION_CHALLENGE_ACTIVATED = true
call SetUnitAnimation(TORCH_REGENERATION, "stand")
call SetUnitAnimation(TORCH_RUNE_REGENERATION, "stand")
call SetUnitAnimation(OGRE_GLADIATOR,"spell")
set flag = true
endif
if itemId == ITEM_BERSERK and not BERSERK_CHALLENGE_ACTIVATED then
set BERSERK_CHALLENGE_ACTIVATED = true
call SetUnitAnimation(TORCH_BERSERK, "stand")
call SetUnitAnimation(TORCH_RUNE_BERSERK, "stand")
call SetUnitAnimation(OGRE_GLADIATOR,"spell")
set flag = true
endif
if itemId == ITEM_TOUGHNESS and not TOUGHNESS_CHALLENGE_ACTIVATED then
set TOUGHNESS_CHALLENGE_ACTIVATED = true
call SetUnitAnimation(TORCH_TOUGHNESS, "stand")
call SetUnitAnimation(TORCH_RUNE_TOUGHNESS, "stand")
call SetUnitAnimation(OGRE_GLADIATOR,"spell")
set flag = true
endif
if itemId == ITEM_CANCEL and (REINCARNATION_CHALLENGE_ACTIVATED or REGENERATION_CHALLENGE_ACTIVATED or TOUGHNESS_CHALLENGE_ACTIVATED or BERSERK_CHALLENGE_ACTIVATED) then
call ResetOgreGladiatorChallenges()
call SetUnitAnimation(OGRE_GLADIATOR,"spell")
set flag = true
endif
if flag then
set TIME_SINCE_LAST_ANIM = 0.
if (SLEEP_ANIM_TIMER == null) then
set SLEEP_ANIM_TIMER = CreateTimer()
call TimerStart(SLEEP_ANIM_TIMER,SLEEP_TIMER_PERIOD,true,function onTimerCheckSleep)
endif
endif
if itemId == ITEM_CALL_FOR_GRUNTS then
if udg_PlayersInGame == 1 then
set k = 2
endif
if udg_PlayersInGame == 2 then
set k = 3
endif
if udg_PlayersInGame == 3 then
set k = 5
endif
if udg_PlayersInGame == 4 then
set k = 6
endif
if udg_PlayersInGame == 5 then
set k = 8
endif
if udg_PlayersInGame == 6 then
set k = 9
endif
set i = 1
loop
exitwhen i>k
set tempu = CreateUnit(ORGRIMMAR,'o001',-9550.+GetRandomReal(-150.,150.),-7100.+GetRandomReal(-150,150),GetRandomReal(0.,360.))
call FadeUnitOut(tempu,2.,false)
call UnitApplyTimedLife(tempu,'BHwe',60.)
call SaveReal(udg_hash,GetHandleId(tempu),29,10.)
call SaveReal(udg_hash,GetHandleId(tempu),GetCritHash(), 20.)
call SaveReal(udg_hash,GetHandleId(tempu),GetSpellResistHash(),0.8)
call IssuePointOrder( tempu, "attack", GetRectCenterX(gg_rct_Healer_1),GetRectCenterY(gg_rct_Healer_1) )
set i = i + 1
endloop
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
set TORCH_REINCARNATION = gg_unit_h04F_0145
set TORCH_REGENERATION = gg_unit_h04F_0156
set TORCH_BERSERK = gg_unit_h04F_0157
set TORCH_TOUGHNESS = gg_unit_h04F_0155
set TORCH_RUNE_REINCARNATION = gg_unit_h04H_0159
set TORCH_RUNE_REGENERATION = gg_unit_h04I_0158
set TORCH_RUNE_BERSERK = gg_unit_h04K_0161
set TORCH_RUNE_TOUGHNESS = gg_unit_h04J_0160
call SetUnitAnimation(TORCH_RUNE_REINCARNATION, "death")
call SetUnitAnimation(TORCH_RUNE_REGENERATION, "death")
call SetUnitAnimation(TORCH_RUNE_TOUGHNESS, "death")
call SetUnitAnimation(TORCH_RUNE_BERSERK, "death")
call ResetOgreGladiatorChallenges()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t, function onChallengeBuy)
set t = null
endfunction
endlibrary
//TESH.scrollpos=7
//TESH.alwaysfold=0
library C1CreateWave initializer Init requires CreepAggro
globals
integer CURWAVE = 0
integer array WAVECOUNT[6]
integer CHAMPIONCOUNT = 0
//group C1UnitsGroup = CreateGroup()
group C1_UNIT_GROUP = CreateGroup()
private constant integer ORDER_HASH = 210
private constant real RESET_ORDER_PERIOD = 3.
private constant real STAMPEDE_CHARGE_DIST = 1000.
private constant real VORTEX_BARICENTER_SEARCH_DIST = 1000.
private real Vx = 0.
private real Vy = 0.
endglobals
function C1_CreateWave takes location loc returns nothing
local integer i = 1
local unit u = null
local integer j = GetRandomInt(1,3)
local integer ChampionLimit = 0
set CURWAVE = CURWAVE + 1
loop
exitwhen i>3
set u = CreateUnitAtLoc(Player(7),WAVECOUNT[CURWAVE],loc,270.)
call FadeUnitOut(u,2.,false)
call GroupAddUnit(C1_UNIT_GROUP,u)
call IssuePointOrderLoc(u,"attack",udg_C_Spawns[4])
call FlushChildHashtable(udg_hash,GetHandleId(u))
call SaveReal(udg_hash,GetHandleId(u),2,10.)
//call Aggro.new(u)
set u = null
set i = i + 1
endloop
if udg_PlayersInGame==1 or udg_PlayersInGame == 2 then
set ChampionLimit = 1
endif
if udg_PlayersInGame==3 or udg_PlayersInGame == 4 then
set ChampionLimit = 2
endif
if udg_PlayersInGame==5 or udg_PlayersInGame == 6 then
set ChampionLimit = 3
endif
if CHAMPIONCOUNT < ChampionLimit then
set u = CreateUnitAtLoc(Player(7),WAVECOUNT[j+3],loc,270.)
call FadeUnitOut(u,2.,false)
call GroupAddUnit(C1_UNIT_GROUP,u)
call IssuePointOrderLoc(u ,"attack",udg_C_Spawns[4])
call FlushChildHashtable(udg_hash,GetHandleId(u))
call SaveReal(udg_hash,GetHandleId(u),2,10.)
//call Aggro.new(u)
set u = null
endif
if CURWAVE >= 3 then
set CURWAVE = 0
endif
set CHAMPIONCOUNT = CHAMPIONCOUNT + 1
if CHAMPIONCOUNT >= udg_PlayersInGame then
set CHAMPIONCOUNT = 0
endif
endfunction
private function ForceAttack takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_Garrosh1)
if GetWidgetLife(GetEnumUnit())>0. then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Ordering to attack: " + GetUnitName(GetEnumUnit()))
call IssuePointOrderLoc(GetEnumUnit(),"attack",loc)
else
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Removing dying unit: " + GetUnitName(GetEnumUnit()))
//call GroupRemoveUnit(C1UnitsGroup,GetEnumUnit())
endif
call RemoveLocation(loc)
set loc = null
endfunction
private function onTimerResetOrder takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call SaveBoolean(udg_hash,GetHandleId(u),ORDER_HASH,false)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function GetHeroMaxDist takes unit u returns unit
local integer i = 1
local real dist = 0.
local real maxD = 0.
local unit hero = null
loop
exitwhen i>udg_PlayerCount
if not IsUnitDeadBX(udg_Heroes[i]) then
set dist = SquareRoot( (GetUnitX(u)-GetUnitX(udg_Heroes[i]))*(GetUnitX(u)-GetUnitX(udg_Heroes[i])) + (GetUnitY(u)-GetUnitY(udg_Heroes[i]))*(GetUnitY(u)-GetUnitY(udg_Heroes[i])) )
if (dist > maxD) and (dist <= STAMPEDE_CHARGE_DIST) then
set hero = udg_Heroes[i]
set maxD = dist
endif
endif
set i = i + 1
endloop
return hero
endfunction
//changes Vx,Vy - the coordinate of the baricenter of Heroes in 1000 AOE
private function CalculateBaricenterAround takes unit u returns nothing
local real xmiddle = 0.
local real ymiddle = 0.
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x1 = 0.
local real y1 = 0.
local real dist = 0.
local integer count = 0
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if not IsUnitDeadBX(udg_Heroes[i]) then
set x1 = GetUnitX(udg_Heroes[i])
set y1 = GetUnitY(udg_Heroes[i])
set dist = SquareRoot((x-x1)*(x-x1)+(y-y1)*(y-y1))
if dist <= VORTEX_BARICENTER_SEARCH_DIST then
set count = count + 1
set xmiddle = xmiddle + x1
set ymiddle = ymiddle + y1
endif
endif
set i = i + 1
endloop
set count = count + 1
set xmiddle = xmiddle + x
set ymiddle = ymiddle + y
set Vx = xmiddle/count
set Vy = ymiddle/count
endfunction
private function ForceCast takes nothing returns nothing
local unit u = GetEnumUnit()
local timer t = null
local boolean found = false
local unit hero = null
local location loc = null
if IsUnitDeadBX(u) then
call GroupRemoveUnit(C1_UNIT_GROUP,u)
else
if not LoadBoolean(udg_hash,GetHandleId(u),ORDER_HASH) then
if not(Aggro.target(u)==null) then
//Ignition
if GetUnitAbilityLevel(u,'A06F') > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,'A06F') <= 0. then
set found = true
call IssueImmediateOrder(u,"flamestrike")
endif
endif
//Punishment
if GetUnitAbilityLevel(u,'A06G') > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,'A06G') <= 0. then
set found = true
call IssueImmediateOrder(u,"flamestrike")
endif
endif
//Legion Strike
if GetUnitAbilityLevel(u,'A06K') > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,'A06K') <= 0. then
set found = true
call IssueImmediateOrder(u,"flamestrike")
endif
endif
//Mana Ejection
if GetUnitAbilityLevel(u,'A06P') > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,'A06P') <= 0. then
set found = true
call IssueImmediateOrder(u,"flamestrike")
endif
endif
//Stampede
if GetUnitAbilityLevel(u,'A06H') > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,'A06H') <= 0. then
set hero = GetHeroMaxDist(u)
if not(hero==null) then
set found = true
call IssueTargetOrder(u,"flamestrike",hero)
endif
endif
endif
//Vortex
if GetUnitAbilityLevel(u,'A06O') > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,'A06O') <= 0. then
set found = true
call CalculateBaricenterAround(u)
call IssuePointOrder(u,"blink",Vx,Vy)
//call BJDebugMsg(GetUnitName(u) + " coords: (" + R2S(GetUnitX(u)) +"," + R2S(GetUnitY(u))+").")
//call BJDebugMsg("Ordering Vortex cast to : (" + R2S(Vx) +"," + R2S(Vy)+").")
endif
endif
else
set loc = GetRectCenter(gg_rct_Garrosh1)
call IssuePointOrderLoc(u,"attack",loc)
call RemoveLocation(loc)
set loc = null
set found = true
endif
endif
endif
if found then
set t = CreateTimer()
call SaveBoolean(udg_hash,GetHandleId(u),ORDER_HASH,true)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,RESET_ORDER_PERIOD,false,function onTimerResetOrder)
set t = null
endif
set u = null
endfunction
private function onTimerAttack takes nothing returns nothing
//call ForGroup(C1UnitsGroup,function ForceAttack)
call ForGroup(C1_UNIT_GROUP,function ForceCast)
endfunction
private function Init takes nothing returns nothing
local timer t = CreateTimer()
call TimerStart(t,2.5,true,function onTimerAttack)
set WAVECOUNT[1] = 'n001'
set WAVECOUNT[2] = 'n004'
set WAVECOUNT[3] = 'n006'
set WAVECOUNT[4] = 'n000'
set WAVECOUNT[5] = 'n005'
set WAVECOUNT[6] = 'n007'
endfunction
endlibrary
function Trig_C1_defeat_Conditions takes nothing returns boolean
if ( not ( GetTriggerUnit() == udg_C1_Garrosh ) ) then
return false
endif
return true
endfunction
function Trig_C1_defeat_Actions takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 30, "TRIGSTR_3238" )
set udg_Votes = 0
call ForceClear( udg_Voting_Group )
call EnableTrigger( gg_trg_Voting_to_Restart )
call EnableTrigger( gg_trg_Failed_Voting )
call StartTimerBJ( udg_VotingTimer, false, 30 )
call PauseAllUnitsBJ(true)
call PauseTimerBJ( true, udg_LeftTimer )
call PauseTimerBJ( true, udg_MiddleTimer )
call PauseTimerBJ( true, udg_RightTimer )
call PauseTimerBJ( true, udg_Spec_WaveC1_Timer )
call DestroyTimerDialog( udg_C1_TWindow )
call DestroyTimerDialog( udg_Special_WaveC1_Window )
endfunction
//===========================================================================
function InitTrig_C1_defeat takes nothing returns nothing
set gg_trg_C1_defeat = CreateTrigger( )
call DisableTrigger( gg_trg_C1_defeat )
call TriggerRegisterAnyUnitEventBJ( gg_trg_C1_defeat, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_C1_defeat, Condition( function Trig_C1_defeat_Conditions ) )
call TriggerAddAction( gg_trg_C1_defeat, function Trig_C1_defeat_Actions )
endfunction
function Trig_Voting_to_Restart_Func001C takes nothing returns boolean
if ( not ( IsPlayerInForce(GetTriggerPlayer(), udg_Voting_Group) == false ) ) then
return false
endif
return true
endfunction
function Trig_Voting_to_Restart_Func002C takes nothing returns boolean
if ( not ( udg_Votes >= CountPlayersInForceBJ(udg_Players_Group) ) ) then
return false
endif
return true
endfunction
function Trig_Voting_to_Restart_Actions takes nothing returns nothing
if ( Trig_Voting_to_Restart_Func001C() ) then
call ForceAddPlayerSimple( GetTriggerPlayer(), udg_Voting_Group )
set udg_Votes = ( udg_Votes + 1 )
call DisplayTextToForce( GetPlayersAll(), ( "Restart votes: " + ( I2S(udg_Votes) + ( "/" + I2S(CountPlayersInForceBJ(udg_Players_Group)) ) ) ) )
else
endif
if ( Trig_Voting_to_Restart_Func002C() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_3247" )
call GameRestart(true)
call DisableTrigger( gg_trg_Failed_Voting )
else
endif
endfunction
//===========================================================================
function InitTrig_Voting_to_Restart takes nothing returns nothing
set gg_trg_Voting_to_Restart = CreateTrigger( )
call DisableTrigger( gg_trg_Voting_to_Restart )
call TriggerRegisterPlayerChatEvent( gg_trg_Voting_to_Restart, Player(0), "-restart", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Voting_to_Restart, Player(1), "-restart", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Voting_to_Restart, Player(2), "-restart", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Voting_to_Restart, Player(3), "-restart", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Voting_to_Restart, Player(4), "-restart", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Voting_to_Restart, Player(5), "-restart", true )
call TriggerAddAction( gg_trg_Voting_to_Restart, function Trig_Voting_to_Restart_Actions )
endfunction
function Trig_Failed_Voting_Actions takes nothing returns nothing
call GameRestart(false)
endfunction
//===========================================================================
function InitTrig_Failed_Voting takes nothing returns nothing
set gg_trg_Failed_Voting = CreateTrigger( )
call DisableTrigger( gg_trg_Failed_Voting )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Failed_Voting, udg_VotingTimer )
call TriggerAddAction( gg_trg_Failed_Voting, function Trig_Failed_Voting_Actions )
endfunction
scope Chapter1StartPreload initializer onInit
globals
private boolean CHAPTER1_PRELOADED = false
private integer array CHAPTER1_UNITS_PRELOAD
private integer MAX_N = 24
endglobals
private function onEnter takes nothing returns nothing
local integer i = 1
set CHAPTER1_PRELOADED = true
loop
exitwhen i>MAX_N
call AddUnitToPreloadQueueById(CHAPTER1_UNITS_PRELOAD[i])
set i = i + 1
endloop
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"Chapter I resources are added to the preload queue (required time: " + I2S(R2I(MAX_N*PRELOAD_TIMER_PERIOD)) + " seconds). Players may suffer freezes for a duration.")
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerUnit()==udg_Heroes[i] then
return not CHAPTER1_PRELOADED
endif
set i = i + 1
endloop
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_Chapter1StartPreloading )
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction( t, function onEnter )
set CHAPTER1_UNITS_PRELOAD[1] = 'O000' //Garrosh
set CHAPTER1_UNITS_PRELOAD[2] = 'o001' //Axebite Grunt
set CHAPTER1_UNITS_PRELOAD[3] = 'n001' //Chosen Warrior
set CHAPTER1_UNITS_PRELOAD[4] = 'n006' //Fel Tricker
set CHAPTER1_UNITS_PRELOAD[5] = 'n004' //Fel Stalker
set CHAPTER1_UNITS_PRELOAD[6] = 'n007' //Doom Bringer
set CHAPTER1_UNITS_PRELOAD[7] = 'n005' //Fel Warlock
set CHAPTER1_UNITS_PRELOAD[8] = 'n000' //Chosen Seer
set CHAPTER1_UNITS_PRELOAD[9] = 'n005' //Fel Warlock
set CHAPTER1_UNITS_PRELOAD[10] = 'n008' //Matron Mother Malevolence
set CHAPTER1_UNITS_PRELOAD[11] = 'n009' //Succubus
set CHAPTER1_UNITS_PRELOAD[12] = 'n00A' //Elder Salamander
set CHAPTER1_UNITS_PRELOAD[13] = 'n00B' //Salamander
set CHAPTER1_UNITS_PRELOAD[14] = 'n00C' //Felguard Annihilator
set CHAPTER1_UNITS_PRELOAD[15] = 'n00D' //Felguard
set CHAPTER1_UNITS_PRELOAD[16] = 'n00E' //Zar'Shuul the Devourer
set CHAPTER1_UNITS_PRELOAD[17] = 'n00F' //Voidwalker
set CHAPTER1_UNITS_PRELOAD[18] = 'n00G' //Death Revenant
set CHAPTER1_UNITS_PRELOAD[19] = 'n00H' //Fire Revenant
set CHAPTER1_UNITS_PRELOAD[20] = 'h01M' //Chosen Seer Meteor
set CHAPTER1_UNITS_PRELOAD[21] = 'h01O' //Chosen Seer Meteor part
set CHAPTER1_UNITS_PRELOAD[22] = 'h01D' //Salamander Stampede Small Boulders
set CHAPTER1_UNITS_PRELOAD[23] = 'h01E' //Zar'Shuul and Voidwalkers Mana Ejection Shards
set CHAPTER1_UNITS_PRELOAD[24] = 'h01H' //Zar'Shuul Vortex Effect
//set CHAPTER1_UNITS_PRELOAD[2] = 'o001' //Axebite Grunt
//set CHAPTER1_UNITS_PRELOAD[2] = 'o001' //Axebite Grunt
//set CHAPTER1_UNITS_PRELOAD[2] = 'o001' //Axebite Grunt
set MAX_N = 24
set t = null
endfunction
endscope
scope Chapter1Cinematic initializer onInit
globals
private constant string GRUNT_TALK = "For the Horde!"
trigger CHAPTER1_CINEMATIC_TRIGGER = null
boolean SPECIAL_WAVE_STOP_NEXT_LEFT = false
boolean SPECIAL_WAVE_STOP_NEXT_RIGHT = false
boolean SPECIAL_WAVE_STOP_NEXT_MIDDLE = false
endglobals
private function onEnter takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
set CHAPTER1_STARTED = true
set GAME_RESTARTED = false
call DisplayTextToForce(GetPlayersAll(), "Chapter 1: |c00804040Orgrimmar|r")
call SetCinematicScene('o001',null,"Grunt",GRUNT_TALK,10.,10.)
call StartTimerBJ( udg_ChapterTimer, false, 15.00 )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_Garrosh1)
call CreateNUnitsAtLoc( 1, 'O000', Player(6), udg_LeakPoint[1], 90.00 )
set udg_C1_Garrosh = GetLastCreatedUnit()
call SetUnitAnimation( udg_C1_Garrosh, "death" )
call SaveReal(udg_hash,GetHandleId(udg_C1_Garrosh),16,1.)
call PauseUnitBJ( true, udg_C1_Garrosh )
call PingMinimapLocForForceEx( GetPlayersAll(), udg_LeakPoint[1], 2.00, bj_MINIMAPPINGSTYLE_SIMPLE, 100, 0.00, 0.00 )
call SuspendHeroXPBJ( false, udg_C1_Garrosh )
call RemoveLocation(udg_LeakPoint[1])
call EnableTrigger( gg_trg_C1_defeat )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_Healer_1)
set udg_LeakPoint[2] = GetRectCenter(gg_rct_Healer_2)
call CreateNUnitsAtLoc( 1, 'o001', Player(6), udg_LeakPoint[1], bj_UNIT_FACING )
call PlaySoundOnUnitBJ( gg_snd_GruntWarcry1, 100, GetLastCreatedUnit() )
//call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, 'o001', Player(6), udg_LeakPoint[2], bj_UNIT_FACING )
//call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetLastCreatedUnit() )
call CreateNUnitsAtLoc( 1, 'n001', Player(7), udg_LeakPoint[1], bj_UNIT_FACING )
call CreateNUnitsAtLoc( 1, 'n001', Player(7), udg_LeakPoint[2], bj_UNIT_FACING )
set udg_LeakPoint[3] = GetRectCenter(gg_rct_Rect_007)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 10
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateFogModifierRadiusLocBJ( true, ConvertedPlayer(GetForLoopIndexA()), FOG_OF_WAR_VISIBLE, udg_LeakPoint[1], 2000.00 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
call RemoveLocation(udg_LeakPoint[3])
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerUnit()==udg_Heroes[i] then
return true
endif
set i = i + 1
endloop
return false
endfunction
function onInit takes nothing returns nothing
set CHAPTER1_CINEMATIC_TRIGGER = CreateTrigger()
call TriggerRegisterEnterRectSimple( CHAPTER1_CINEMATIC_TRIGGER, gg_rct_Chapter1Start )
call TriggerAddCondition(CHAPTER1_CINEMATIC_TRIGGER, Condition( function Conds ))
call TriggerAddAction( CHAPTER1_CINEMATIC_TRIGGER, function onEnter )
endfunction
endscope
function Trig_c1_battle_ini_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
if TURBO_MODE then
call StartTimerBJ( CHAPTER1_END_TIMER, false, 900./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( CHAPTER1_END_TIMER, false, 900.00 )
endif
call CreateTimerDialogBJ( CHAPTER1_END_TIMER, "Molten Core opens" )
set udg_C1_TWindow = GetLastCreatedTimerDialogBJ()
call TimerDialogDisplayBJ( true, udg_C1_TWindow )
call StartTimerBJ( udg_ChapterTimer, false, 1.00 )
call EnableTrigger( gg_trg_c1_sec_ini )
call EnableTrigger( gg_trg_Left_Waves_C1 )
call EnableTrigger( gg_trg_Middle_Waves_C1 )
call EnableTrigger( gg_trg_Right_Waves_C1 )
call EnableTrigger( Trigger_SpecWaves_C1 )
endfunction
//===========================================================================
function InitTrig_c1_battle_ini takes nothing returns nothing
set gg_trg_c1_battle_ini = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_c1_battle_ini, udg_ChapterTimer )
call TriggerAddAction( gg_trg_c1_battle_ini, function Trig_c1_battle_ini_Actions )
endfunction
function Trig_c1_sec_ini_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_armorerMOVE)
set udg_LeakPoint[2] = GetRectCenter(gg_rct_alchemistMOVE)
set udg_LeakPoint[3] = GetRectCenter(gg_rct_weaponerMOVE)
set udg_LeakPoint[4] = GetRectCenter(gg_rct_InscriptorMOVE)
call SetUnitPositionLocFacingBJ( udg_C1_Vendors[1], udg_LeakPoint[1], 90.00 )
call SetUnitPositionLocFacingBJ( udg_C1_Vendors[2], udg_LeakPoint[2], 90.00 )
call SetUnitPositionLocFacingBJ( udg_C1_Vendors[3], udg_LeakPoint[3], 90.00 )
call SetUnitPositionLocFacingBJ( udg_C1_Vendors[4], udg_LeakPoint[4], 90.00 )
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
call RemoveLocation(udg_LeakPoint[3])
call RemoveLocation(udg_LeakPoint[4])
set udg_Spec_WaveCount = 0
set udg_Spec_WaveUnits[1] = 'n009'
set udg_Spec_WaveUnits[2] = 'n00B'
set udg_Spec_WaveUnits[3] = 'n00D'
set udg_Spec_WaveUnits[4] = 'n00F'
set udg_Spec_WaveUnits[5] = 'n00H'
set udg_Spec_WaveUnits[6] = 'n008'
set udg_Spec_WaveUnits[7] = 'n00A'
set udg_Spec_WaveUnits[8] = 'n00C'
set udg_Spec_WaveUnits[9] = 'n00E'
set udg_Spec_WaveUnits[10] = 'n00G'
if TURBO_MODE then
call StartTimerBJ( udg_Spec_WaveC1_Timer, false, 180./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_Spec_WaveC1_Timer, false, 180.00 )
endif
call CreateTimerDialogBJ( udg_Spec_WaveC1_Timer, "TRIGSTR_3229" )
set udg_Special_WaveC1_Window = GetLastCreatedTimerDialogBJ()
if WavesOpened[1] or WavesOpened[4] then
call StartTimerBJ( udg_LeftTimer, false, 10.00 )
else
endif
if WavesOpened[2] or WavesOpened[5] then
call StartTimerBJ( udg_RightTimer, false, 10.00 )
else
endif
if WavesOpened[3] or WavesOpened[6] then
call StartTimerBJ( udg_MiddleTimer, false, 10.00 )
else
endif
endfunction
//===========================================================================
function InitTrig_c1_sec_ini takes nothing returns nothing
set gg_trg_c1_sec_ini = CreateTrigger( )
call DisableTrigger( gg_trg_c1_sec_ini )
call TriggerRegisterTimerExpireEventBJ( gg_trg_c1_sec_ini, udg_ChapterTimer )
call TriggerAddAction( gg_trg_c1_sec_ini, function Trig_c1_sec_ini_Actions )
endfunction
library Chapter1Ends initializer onInit
globals
timer CHAPTER1_END_TIMER = CreateTimer()
endglobals
private function onTimerExpires takes nothing returns nothing
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_3232" )
call SetUnitInvulnerable( udg_C1_Garrosh, true )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_LeftSpawn)
call PingMinimapLocForForceEx( GetPlayersAll(), udg_LeakPoint[1], 40.00, bj_MINIMAPPINGSTYLE_SIMPLE, 0.00, 0.00, 100 )
call PlaySoundBJ(gg_snd_Gates)
call RemoveLocation(udg_LeakPoint[1])
call DestroyTrigger( gg_trg_C1_defeat )
call DestroyTrigger( gg_trg_KnockUnitsC1 )
call DestroyTrigger( gg_trg_SpecWaves_C1 )
call DestroyTrigger( gg_trg_Left_Waves_C1 )
call DestroyTrigger( gg_trg_Right_Waves_C1 )
call DestroyTrigger( gg_trg_Middle_Waves_C1 )
call PauseTimerBJ( true, udg_LeftTimer )
call PauseTimerBJ( true, udg_MiddleTimer )
call PauseTimerBJ( true, udg_RightTimer )
call DestroyTimerDialog( udg_C1_TWindow )
call EnableTrigger( gg_trg_Molten_Core_Teleport )
call EnableTrigger( gg_trg_Molten_Core_Teleport_Back )
call TimerStart(REFRESH_COMBAT_TRIGGERS_TIMER,1.,false,null)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent( t, CHAPTER1_END_TIMER )
call TriggerAddAction( t, function onTimerExpires )
set t = null
endfunction
endlibrary
function Trig_Left_Waves_C1_Actions takes nothing returns nothing
if TURBO_MODE then
call StartTimerBJ( udg_LeftTimer, false, 30./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_LeftTimer, false, 30.00 )
endif
if not SPECIAL_WAVE_STOP_NEXT_LEFT then
if WavesOpened[1] then
call C1_CreateWave(udg_C_Spawns[1])
endif
if WavesOpened[4] then
call C1_CreateWave(udg_C_Spawns[1])
endif
else
set SPECIAL_WAVE_STOP_NEXT_LEFT = false
endif
endfunction
//===========================================================================
function InitTrig_Left_Waves_C1 takes nothing returns nothing
set gg_trg_Left_Waves_C1 = CreateTrigger( )
call DisableTrigger( gg_trg_Left_Waves_C1 )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Left_Waves_C1, udg_LeftTimer )
call TriggerAddAction( gg_trg_Left_Waves_C1, function Trig_Left_Waves_C1_Actions )
endfunction
function Trig_Right_Waves_C1_Actions takes nothing returns nothing
if TURBO_MODE then
call StartTimerBJ( udg_RightTimer, false, 30./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_RightTimer, false, 30.00 )
endif
if not SPECIAL_WAVE_STOP_NEXT_RIGHT then
if WavesOpened[2] then
call C1_CreateWave(udg_C_Spawns[2])
endif
if WavesOpened[5] then
call C1_CreateWave(udg_C_Spawns[2])
endif
else
set SPECIAL_WAVE_STOP_NEXT_RIGHT = false
endif
endfunction
//===========================================================================
function InitTrig_Right_Waves_C1 takes nothing returns nothing
set gg_trg_Right_Waves_C1 = CreateTrigger( )
call DisableTrigger( gg_trg_Right_Waves_C1 )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Right_Waves_C1, udg_RightTimer )
call TriggerAddAction( gg_trg_Right_Waves_C1, function Trig_Right_Waves_C1_Actions )
endfunction
function Trig_Middle_Waves_C1_Actions takes nothing returns nothing
if TURBO_MODE then
call StartTimerBJ( udg_MiddleTimer, false, 30./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_MiddleTimer, false, 30.00 )
endif
if not SPECIAL_WAVE_STOP_NEXT_MIDDLE then
if WavesOpened[3] then
call C1_CreateWave(udg_C_Spawns[3])
endif
if WavesOpened[6] then
call C1_CreateWave(udg_C_Spawns[3])
endif
else
set SPECIAL_WAVE_STOP_NEXT_MIDDLE = false
endif
endfunction
//===========================================================================
function InitTrig_Middle_Waves_C1 takes nothing returns nothing
set gg_trg_Middle_Waves_C1 = CreateTrigger( )
call DisableTrigger( gg_trg_Middle_Waves_C1 )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Middle_Waves_C1, udg_MiddleTimer )
call TriggerAddAction( gg_trg_Middle_Waves_C1, function Trig_Middle_Waves_C1_Actions )
endfunction
scope SpecialWavesChapter1 initializer onInit
globals
trigger Trigger_SpecWaves_C1 = null
timer udg_Spec_WaveC1_Timer = CreateTimer()
private boolean GROUP_DEAD_FLAG = false
endglobals
private function CheckChallengeAmplifiersForUnit takes unit u returns nothing
if REINCARNATION_CHALLENGE_ACTIVATED then
call UnitAddAbility(u,REINCARNATION_CHALLENGE_ABILCODE)
endif
if REGENERATION_CHALLENGE_ACTIVATED then
call UnitAddAbility(u,REGENERATION_CHALLENGE_ABILCODE)
call UnitAddAbility(u,REGENERATION_CHALLENGE_AURA_ABILCODE)
endif
if BERSERK_CHALLENGE_ACTIVATED then
call UnitAddAbility(u,BERSERK_CHALLENGE_ABILCODE)
endif
if TOUGHNESS_CHALLENGE_ACTIVATED then
call SaveReal(udg_hash,GetHandleId(u),GetSpellResistHash(),0.5)
call SaveReal(udg_hash,GetHandleId(u),GetPhysDmgReduceHash(),0.5)
call UnitAddAbility(u,TOUGHNESS_CHALLENGE_ABILCODE)
endif
endfunction
private function PlayerGoldAdd takes nothing returns nothing
call SetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetEnumPlayer(),PLAYER_STATE_RESOURCE_GOLD) + R2I(udg_temp_real))
endfunction
private function ChallengeFinish takes integer count returns nothing
local string MES = "Challenge finished! All players get +"
local integer gold = 0
if count == 1 then
set gold = 100
endif
if count == 2 then
set gold = 300
endif
if count == 3 then
set gold = 600
endif
if count == 4 then
set gold = 1000
endif
set MES = MES + "|c00CDAF00" + I2S(gold) + "|r."
if not GAME_RESTARTED then
call DisplayTextToForce( GetPlayersAll(), MES )
set udg_temp_real = gold
if IsMultiHeroes then
set udg_temp_real = gold * udg_PlayersInGame
endif
call ForForce( udg_Players_Group, function PlayerGoldAdd )
endif
endfunction
private function CheckDeadUnits takes nothing returns nothing
set GROUP_DEAD_FLAG = GROUP_DEAD_FLAG and (GetEnumUnit()==null or not (GetWidgetLife(GetEnumUnit())>0.) or IsUnitType(GetEnumUnit(), UNIT_TYPE_DEAD))
endfunction
private function onTimerCheckDeadWave takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = LoadGroupHandle(udg_hash,GetHandleId(t),1)
local integer CHAL_COUNT = LoadInteger(udg_hash,GetHandleId(t),2)
set GROUP_DEAD_FLAG = true
call ForGroup(g, function CheckDeadUnits)
if GROUP_DEAD_FLAG then
call ChallengeFinish(CHAL_COUNT)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call DestroyGroup(g)
endif
set t = null
set g = null
endfunction
private function Acts takes nothing returns nothing
local string MES = "|cffff8080Impossible Wave|r comes from East."
local boolean flag = REINCARNATION_CHALLENGE_ACTIVATED or REGENERATION_CHALLENGE_ACTIVATED or BERSERK_CHALLENGE_ACTIVATED or TOUGHNESS_CHALLENGE_ACTIVATED
local boolean firstFound = false
local timer t = null
local group g = null
local integer CHAL_COUNT = 0
if flag then
call SetUnitAnimation(OGRE_GLADIATOR,"attack slam")
set MES = MES + " Challenge amplifiers:"
if REINCARNATION_CHALLENGE_ACTIVATED then
set CHAL_COUNT = CHAL_COUNT + 1
if firstFound then
set MES = MES + ", |c00FFFF80Reincarnation|r"
else
set MES = MES + " |c00FFFF80Reincarnation|r"
set firstFound = true
endif
endif
if REGENERATION_CHALLENGE_ACTIVATED then
set CHAL_COUNT = CHAL_COUNT + 1
if firstFound then
set MES = MES + ", |cff00ff00Regeneration|r"
else
set MES = MES + " |cff00ff00Regeneration|r"
set firstFound = true
endif
endif
if TOUGHNESS_CHALLENGE_ACTIVATED then
set CHAL_COUNT = CHAL_COUNT + 1
if firstFound then
set MES = MES + ", |c00FF8040Toughness|r"
else
set MES = MES + " |c00FF8040Toughness|r"
set firstFound = true
endif
endif
if BERSERK_CHALLENGE_ACTIVATED then
set CHAL_COUNT = CHAL_COUNT + 1
if firstFound then
set MES = MES + ", |c00FF5551Berserk|r"
else
set MES = MES + " |c00FF5551Berserk|r"
set firstFound = true
endif
endif
set MES = MES + "."
set t = CreateTimer()
set g = CreateGroup()
call SaveGroupHandle(udg_hash,GetHandleId(t),1,g)
call SaveInteger(udg_hash,GetHandleId(t),2,CHAL_COUNT)
call TimerStart(t,0.5,true,function onTimerCheckDeadWave)
set t = null
endif
call DisplayTextToForce( GetPlayersAll(), MES )
set udg_Spec_WaveCount = ( udg_Spec_WaveCount + 1 )
call SetPlayerTechResearchedSwap( 'R002', ( udg_Spec_WaveCount + 1 ), Player(7) )
call SetPlayerTechResearched(ORGRIMMAR, 'R00J', udg_Spec_WaveCount)
set udg_LeakPoint[1] = GetRectCenter(gg_rct_Special_Waves)
set udg_LeakPoint[2] = GetRectCenter(gg_rct_Garrosh1)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayersInGame
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateNUnitsAtLoc( 1, udg_Spec_WaveUnits[udg_Spec_WaveCount], Player(7), udg_LeakPoint[1], bj_UNIT_FACING )
call FlushChildHashtable(udg_hash,GetHandleId(GetLastCreatedUnit()))
call ParKnock(GetLastCreatedUnit(),300.,400.,1.,225.+GetRandomReal(-10.,10.),false,"none")
call IssuePointOrderLoc( GetLastCreatedUnit(), "attack", udg_LeakPoint[2] )
call GroupAddUnit(C1_UNIT_GROUP,GetLastCreatedUnit())
call SaveReal(udg_hash,GetHandleId(GetLastCreatedUnit()),GetCritHash(),15.)
if udg_Spec_WaveCount == 2 then //If Lizards
call GroupAddUnit(DPS_GROUP,GetLastCreatedUnit())
call SaveReal(udg_hash,GetHandleId(GetLastCreatedUnit()),GetSpellPowerHash(),100.*(CURRENT_DIFFICULTY-1))
endif
if udg_Spec_WaveCount == 3 then //If felguards
call SaveReal(udg_hash,GetHandleId(GetLastCreatedUnit()),GetSplashHash(),0.25)
endif
call FadeUnitOut(GetLastCreatedUnit(),2.,false)
call CheckChallengeAmplifiersForUnit(GetLastCreatedUnit())
if flag then
call GroupAddUnit(g,GetLastCreatedUnit())
endif
//call Aggro.new(bj_lastCreatedUnit)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call CreateNUnitsAtLoc( 1, udg_Spec_WaveUnits[( udg_Spec_WaveCount + 5 )], Player(7), udg_LeakPoint[1], bj_UNIT_FACING )
call FlushChildHashtable(udg_hash,GetHandleId(bj_lastCreatedUnit))
call SaveReal(udg_hash,GetHandleId(GetLastCreatedUnit()),GetCritHash(),15.)
call IssuePointOrderLoc( GetLastCreatedUnit(), "attack", udg_LeakPoint[2] )
call ParKnock(GetLastCreatedUnit(),300.,400.,1.,225.+GetRandomReal(-10.,10.),false,"none")
call MakeUnitGiant(GetLastCreatedUnit(),true)
call Aggro.new(bj_lastCreatedUnit)
call GroupAddUnit(C1_UNIT_GROUP,bj_lastCreatedUnit)
call FadeUnitOut(GetLastCreatedUnit(),2.,false)
call CheckChallengeAmplifiersForUnit(GetLastCreatedUnit())
if flag then
call GroupAddUnit(g,GetLastCreatedUnit())
call ResetOgreGladiatorAnim()
call ResetOgreGladiatorChallenges()
endif
//Summon Jeweler at wave1
if udg_Spec_WaveCount == 1 then
set C1_JEWELER = CreateUnit(KOBOLDS,'h045',GetRectCenterX(gg_rct_C1Kobold1),GetRectCenterY(gg_rct_C1Kobold1),135.)
call TimerStart(C1_JEWELER_TIMER,0.5,true,null)
call FadeUnitOut(C1_JEWELER,3.,false)
call SetUnitPathing(C1_JEWELER,false)
endif
if udg_Spec_WaveCount < 5 then
set SPECIAL_WAVE_STOP_NEXT_LEFT = true
set SPECIAL_WAVE_STOP_NEXT_RIGHT = true
set SPECIAL_WAVE_STOP_NEXT_MIDDLE = true
if TURBO_MODE then
call StartTimerBJ( udg_Spec_WaveC1_Timer, false, 150./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_Spec_WaveC1_Timer, false, 150.00 )
endif
else
call DestroyTimer( udg_Spec_WaveC1_Timer )
call DestroyTimerDialog( udg_Special_WaveC1_Window )
//call DestroyTrigger( GetTriggeringTrigger() )
endif
set g = null
endfunction
private function onInit takes nothing returns nothing
set Trigger_SpecWaves_C1 = CreateTrigger( )
call DisableTrigger( Trigger_SpecWaves_C1 )
call TriggerRegisterTimerExpireEventBJ( Trigger_SpecWaves_C1, udg_Spec_WaveC1_Timer )
call TriggerAddAction( Trigger_SpecWaves_C1, function Acts)
endfunction
endscope
function Trig_KnockUnitsC1_Actions takes nothing returns nothing
set udg_LeakPoint[1] = GetUnitLoc(GetTriggerUnit())
set udg_LeakPoint[2] = GetRectCenter(gg_rct_C1CenterBattlefield)
set udg_temp_real = AngleBetweenPoints(udg_LeakPoint[1], udg_LeakPoint[2])
call ParKnock(GetTriggerUnit(),350.,450.,0.75,udg_temp_real+GetRandomReal(-15.,15.),false,"none")
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
endfunction
//===========================================================================
function InitTrig_KnockUnitsC1 takes nothing returns nothing
set gg_trg_KnockUnitsC1 = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_KnockUnitsC1, gg_rct_LeftSpawn )
call TriggerRegisterEnterRectSimple( gg_trg_KnockUnitsC1, gg_rct_MiddleSpawn )
call TriggerRegisterEnterRectSimple( gg_trg_KnockUnitsC1, gg_rct_RightSpawn )
call TriggerAddAction( gg_trg_KnockUnitsC1, function Trig_KnockUnitsC1_Actions )
endfunction
//TESH.scrollpos=22
//TESH.alwaysfold=0
globals
unit W_HEROISMCASTER
endglobals
function Trig_Heroism_Warlock_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03L'
endfunction
function W_HeroismGroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(W_HEROISMCASTER)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function Trig_Heroism_Warlock_Actions takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local group g = CreateGroup()
local unit TEMPUNIT
set W_HEROISMCASTER = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),500.,Condition(function W_HeroismGroupFilter))
loop
set TEMPUNIT = FirstOfGroup(g)
exitwhen TEMPUNIT == null
call DummyCastTarget(CASTER,TEMPUNIT,'A03K',1,"bloodlust")
call AddHeroParameter(TEMPUNIT,15.+10*I2R(GetUnitAbilityLevel(CASTER,'A03L')),15.,4,"none","none")
call AddHeroParameter(TEMPUNIT,0.5*I2R(GetUnitAbilityLevel(CASTER,'A03L')),15.,13,"none","none")
call GroupRemoveUnit(g,TEMPUNIT)
set TEMPUNIT = null
endloop
call DestroyGroup(g)
set CASTER = null
set g = null
endfunction
//===========================================================================
function InitTrig_Heroism_Warlock takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Heroism_Warlock_Conditions ) )
call TriggerAddAction( t, function Trig_Heroism_Warlock_Actions )
set t = null
endfunction
scope ChaosMeteorChosenSeer initializer onInit
globals
private constant integer ABILCODE = 'A03N'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),Player(7)) and GetWidgetLife(GetFilterUnit())>0. and not(GetUnitAbilityLevel(GetFilterUnit(),'B00B')>0)
endfunction
private function MeteorFalling takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolexpr GROUPFILTER = null
local integer i = 1
local real DAMAGE = 200+100*CURRENT_DIFFICULTY
if CHAPTER_3_STARTED then
set DAMAGE = 500 + 200*CURRENT_DIFFICULTY
endif
call SetUnitFlyHeight(u,GetUnitFlyHeight(u)-24.,0.)
if GetUnitFlyHeight(u)<=48 or not(GetWidgetLife(u) > 0.) then
if GetWidgetLife(u)>0. then
set GROUPFILTER = Condition(function GroupFilter)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",GetUnitX(u),GetUnitY(u)) )
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(u),GetUnitY(u),200.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call UnitDamageTarget(u,udg_temp_unit,DAMAGE,false,false,null,null,null)
endloop
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
endif
loop
exitwhen i > GetRandomInt(2,4)
set udg_temp_unit = CreateUnit(Player(7),'h01O',GetUnitX(u),GetUnitY(u),0.)
call ParKnock(udg_temp_unit,GetRandomReal(150.,600.),GetRandomReal(150.,600.),1.,GetRandomReal(1.,360.),false,"")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',1.)
set i = i + 1
endloop
call KillUnit(u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
private function FallMeteor takes nothing returns nothing
local timer tim = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(tim),1)
local timer t = CreateTimer()
call FlushChildHashtable(udg_hash,GetHandleId(tim))
call DestroyTimer(tim)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,0.04,true,function MeteorFalling)
set tim = null
set u = null
set t = null
endfunction
private function ChaosMeteorSeer takes real x,real y returns nothing
local unit u = CreateUnit(Player(7),'h01N',x,y,GetRandomReal(1.,360.))
local timer t = CreateTimer()
call UnitApplyTimedLife(CreateUnit(Player(7),'h01M',x,y,0.),'BHwe',2.5)
call SetUnitFlyHeight(u,1500.,0.)
call UnitApplyTimedLife(u,'BHwe',4.)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,1.5,true,function FallMeteor)
set u = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
call BlzSetUnitAbilityCooldown(CASTER,ABILCODE,0,15-CURRENT_DIFFICULTY)
call ChaosMeteorSeer(x,y)
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope IgnitionMatron initializer onInit
globals
private constant integer ABILCODE = 'A06F'
private constant real AOE = 1000.
private constant real DOT_DURATION = 5.
private constant real DOT_PERIOD = 1.
private constant real DOT_DAMAGE_BASE = 50.
private constant real DOT_DAMAGE_LEVEL_FACTOR = 0.5
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function HeroesFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() then
return IsUnitEnemy(udg_Heroes[i],GetOwningPlayer(udg_temp_unit)) and not IsUnitDeadBX(udg_Heroes[i])
endif
set i = i + 1
endloop
return false
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local group g = CreateGroup()
local unit tempu = null
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),AOE,function HeroesFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl",tempu,"chest"))
call DOT(CASTER,tempu,DOT_DAMAGE_BASE*(1+DOT_DAMAGE_LEVEL_FACTOR*(CURRENT_DIFFICULTY-1)),DOT_DURATION,DOT_PERIOD,1,"Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl","chest",true)
call GroupRemoveUnit(g,tempu)
endloop
set tempu = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope PunishmentSuccubus initializer onInit
globals
private constant integer ABILCODE = 'A06G'
constant integer PUNISHMENT_AURACODE = 'A06L'
constant integer PUNISHMENT_BUFFCODE = 'B01V'
private constant integer DEBUFF_ABI = 'A06M'
private constant integer DEBUFF_BUFFER = 'B01W'
timer PUNISHMENT_TIMER = CreateTimer()
private constant integer CHARGESHASH = 202
private constant real AOE = 200.
private constant real SPELL_RESIST_DEBUFF = 0.05
private constant real DEBUFF_DURATION = 10.
private constant real BUFFDURATION = 15.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0. and not (GetFilterUnit()==CENARIUS)
endfunction
//On attack
private function onTimerExpired takes nothing returns nothing
local timer t = PUNISHMENT_TIMER
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local group g = CreateGroup()
local unit tempu = null
local real dist = 0.
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local integer CHARGES = LoadInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH)
set CHARGES = CHARGES - 1
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set IHP_ABI = DEBUFF_ABI
set IHP_BUFFER = DEBUFF_BUFFER
call AddHeroParameter(tempu, -SPELL_RESIST_DEBUFF, DEBUFF_DURATION, GetSpellResistHash(),"","")
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if CHARGES <=0 then
call UnitRemoveAbility(CASTER,PUNISHMENT_AURACODE)
call UnitRemoveAbility(CASTER,PUNISHMENT_BUFFCODE)
else
call SaveInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
set t = null
set CASTER = null
set TARGET = null
set g = null
endfunction
private function onBuffExpires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local timer t1 = null
if GetUnitAbilityLevel(CASTER,PUNISHMENT_AURACODE) > 0 then
call UnitRemoveAbility(CASTER,PUNISHMENT_AURACODE)
call UnitRemoveAbility(CASTER,PUNISHMENT_BUFFCODE)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = null
local integer CHARGES = 2+2*(CURRENT_DIFFICULTY-1)
//Give attack charges
call SaveInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
//Give Buff
call UnitAddAbility(CASTER,PUNISHMENT_AURACODE)
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,BUFFDURATION,false,function onBuffExpires)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
call TriggerRegisterTimerExpireEvent(t1,PUNISHMENT_TIMER)
call TriggerAddAction(t1,function onTimerExpired)
set t = null
set t1 = null
endfunction
endscope
scope LegionStrikeFelguard initializer onInit
globals
private constant integer ABILCODE = 'A06K'
constant integer LEGION_STRIKE_AURACODE = 'A06N'
private constant integer SLAMANIM_CODE = 'A04C'
constant integer LEGION_STRIKE_BUFFCODE = 'B01X'
constant real LEGION_STRIKE_BONUSDAMAGE = 200.
constant real LEGION_STRIKE_SPLASH = 1.
timer LEGION_STRIKE_TIMER = CreateTimer()
private constant integer CHARGESHASH = 202
private constant real AOE = 250.
private constant real MAXKNOCKBACK = 250.
private constant real MAXHEIGHTKNOCKBACK = 75.
private constant real DURATIONKNOCKBACK = 0.15
private constant real BUFFDURATION = 15.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0. and not (GetFilterUnit()==CENARIUS)
endfunction
//On attack
private function onTimerExpired takes nothing returns nothing
local timer t = LEGION_STRIKE_TIMER
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local group g = CreateGroup()
local unit tempu = null
local real dist = 0.
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local integer CHARGES = LoadInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH)
set CHARGES = CHARGES - 1
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if (xt-x)*(GetUnitX(tempu)-x)+(yt-y)*(GetUnitY(tempu)-y) >= 0 then
set dist = SquareRoot( (x-GetUnitX(tempu))*(x-GetUnitX(tempu))+(y-GetUnitY(tempu))*(y-GetUnitY(tempu)) )
if dist <= MAXKNOCKBACK then
call ParKnock(tempu,MAXHEIGHTKNOCKBACK*(1-dist/MAXKNOCKBACK),MAXKNOCKBACK-dist,DURATIONKNOCKBACK,Rad2Deg(Atan2(GetUnitY(tempu)-y,GetUnitX(tempu)-x)),true,"Abilities\\Weapons\\DemonHunterMissile\\DemonHunterMissile.mdl")
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if CHARGES <=0 then
call UnitRemoveAbility(CASTER,LEGION_STRIKE_AURACODE)
call UnitRemoveAbility(CASTER,LEGION_STRIKE_BUFFCODE)
else
call SaveInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
set t = null
set CASTER = null
set TARGET = null
set g = null
endfunction
private function onBuffExpires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local timer t1 = null
if GetUnitAbilityLevel(CASTER,LEGION_STRIKE_AURACODE) > 0 then
call UnitRemoveAbility(CASTER,LEGION_STRIKE_AURACODE)
call UnitRemoveAbility(CASTER,LEGION_STRIKE_BUFFCODE)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = null
local integer CHARGES = 4+2*(CURRENT_DIFFICULTY-1)
//Give attack charges
call SaveInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
//Give Buff
call UnitAddAbility(CASTER,LEGION_STRIKE_AURACODE)
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,BUFFDURATION,false,function onBuffExpires)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
call TriggerRegisterTimerExpireEvent(t1,LEGION_STRIKE_TIMER)
call TriggerAddAction(t1,function onTimerExpired)
set t = null
set t1 = null
endfunction
endscope
scope StampedeSalamander initializer onInit
globals
private constant integer BOULDER_CODE = 'h01D'
private constant integer ABILCODE = 'A06H'
private constant real SPEED = 400
private constant real DAMAGE_BASE = 150.
private constant real DAMAGE_DIFFICULTY_FACTOR = 0.5
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and not(IsUnitInGroup(GetFilterUnit(),AFFECTED)) and not (GetFilterUnit()==udg_C1_Garrosh)
endfunction
private function onTimerWalk takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit CASTER = LoadUnitHandle(udg_hash,id,1)
local real XSpeed = LoadReal(udg_hash,id,2)
local real YSpeed = LoadReal(udg_hash,id,3)
local real duration = LoadReal(udg_hash,id,4)
local real TIMEOUT = LoadReal(udg_hash,id,5)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local real x1 = GetUnitX(CASTER)
local real y1 = GetUnitY(CASTER)
local real x2 = LoadReal(udg_hash,id,6)
local real y2 = LoadReal(udg_hash,id,7)
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local real lastX = LoadReal(udg_hash,id,8)
local real lastY = LoadReal(udg_hash,id,9)
local real lastD = SquareRoot((x1-lastX)*(x1-lastX)+(y1-lastY)*(y1-lastY))
local real DAMAGE = DAMAGE_BASE*(1+DAMAGE_DIFFICULTY_FACTOR*(CURRENT_DIFFICULTY-1))
local unit temp = null
local boolexpr GROUPFILTER = Condition(function GroupFilter)
set TIMEOUT = TIMEOUT + 0.04
call SaveReal(udg_hash,id,5,TIMEOUT)
if GetRandomInt(1,3) == 1 then
set udg_temp_unit = CreateUnit(GetOwningPlayer(CASTER),BOULDER_CODE,GetUnitX(CASTER)+GetRandomReal(-50.,50.),GetUnitY(CASTER)+GetRandomReal(-50.,50.),0.)
call UnitApplyTimedLife(udg_temp_unit,'BHwe',0.5)
//call ParKnock(udg_temp_unit,GetRandomReal(100.,200.),GetRandomReal(100.,200.),0.5,GetRandomReal(1.,360.),false,"none")
endif
call SetUnitX(CASTER,GetUnitX(CASTER)+XSpeed)
call SetUnitY(CASTER,GetUnitY(CASTER)+YSpeed)
call SetUnitFacing(CASTER,bj_RADTODEG*Atan2(y2-y1,x2-x1))
call IssuePointOrder(CASTER,"move",x2,y2)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(CASTER),GetUnitY(CASTER),250.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call DealEarthDamage(CASTER,udg_temp_unit,DAMAGE)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",udg_temp_unit,"chest"))
call ParKnock(udg_temp_unit,200.,200.,0.75,Atan2(GetUnitY(udg_temp_unit)-GetUnitY(CASTER),GetUnitX(udg_temp_unit)-GetUnitX(CASTER))*bj_RADTODEG,true,"")
call GroupAddUnit(AFFECTED,udg_temp_unit)
endloop
if TIMEOUT >= duration or dist <= 150. then
//call PauseUnit(CASTER,false)
call SetUnitTimeScale(CASTER,1.)
call SetUnitPathing(CASTER,true)
call GroupClear(AFFECTED)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local real x1 = GetUnitX(CASTER)
local real x2 = GetUnitX(TARGET)
local real y1 = GetUnitY(CASTER)
local real y2 = GetUnitY(TARGET)
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local real angle = Atan2(y2-y1,x2-x1)
local real XSpeed = (SPEED/25.) * Cos(angle)
local real YSpeed = (SPEED/25.) * Sin(angle)
local real duration = (dist - 150.) / 300.
call SetUnitPathing(CASTER,false)
call SetUnitTimeScale(CASTER,2.5)
call IssuePointOrder(CASTER,"move",x2,y2)
call SaveUnitHandle(udg_hash,id,1,CASTER)
call SaveReal(udg_hash,id,2,XSpeed)
call SaveReal(udg_hash,id,3,YSpeed)
call SaveReal(udg_hash,id,4,duration)
call SaveReal(udg_hash,id,6,x2)
call SaveReal(udg_hash,id,7,y2)
call SaveReal(udg_hash,id,8,x1)
call SaveReal(udg_hash,id,9,y1)
call TimerStart(t,0.04,true,function onTimerWalk)
set CASTER = null
set TARGET = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope ManaEjectionVoidwalker initializer onInit
globals
private constant integer ABILCODE = 'A06P'
private constant real AOE_SEARCH = 1000.
private constant real AOE_DAMAGE = 250.
private constant integer SHARD_DUMMY = 'h01E'
private constant real SHARD_FLY_DURATION = 4.
private constant real DAMAGE_BASE = 125.
private constant real DAMAGE_DIFFICULTY_FACTOR = 0.5
private constant real MANA_BASE = 100.
private constant real MANA_DIFFICULTY_FACTOR = 0.5
private constant string EXPLOSION_EFFECT = "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl"
private constant string EXPLOSION_ATTACH = "chest"
private constant string EFFECT_AOE_INDICATOR = "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBase.mdl"
private integer COUNTER = 0
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function HeroesFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() then
if IsUnitEnemy(udg_Heroes[i],GetOwningPlayer(udg_temp_unit)) and not IsUnitDeadBX(udg_Heroes[i]) then
set COUNTER = COUNTER + 1
return true
endif
endif
set i = i + 1
endloop
return false
endfunction
private function onTimerManaExplosion takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit SHARD = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local group g = CreateGroup()
local unit tempu = null
local real DAMAGE = DAMAGE_BASE * (1 + DAMAGE_DIFFICULTY_FACTOR*(CURRENT_DIFFICULTY-1))
local real MANA = MANA_BASE * (1 + MANA_DIFFICULTY_FACTOR*(CURRENT_DIFFICULTY-1))
set udg_temp_unit = SHARD
call GroupEnumUnitsInRange(g,GetUnitX(SHARD),GetUnitY(SHARD),AOE_DAMAGE, function HeroesFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DealArcaneDamage(SHARD,tempu,DAMAGE)
call RegenerateMana(tempu,-MANA)
call DestroyEffect(AddSpecialEffectTarget(EXPLOSION_EFFECT,tempu,EXPLOSION_ATTACH))
call GroupRemoveUnit(g,tempu)
endloop
call SetUnitTimeScale(SHARD,0.25)
//call SetUnitScale(SHARD,5.,5.,5.)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\AbsorbMana\\AbsorbManaBirthMissile.mdl",SHARD,"origin"))
call KillUnit(SHARD)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),2))
call DestroyGroup(g)
set g = null
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set SHARD = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local group g = CreateGroup()
local timer t = null
local unit tempu = null
local unit SHARD = null
local integer k = 0
local integer kEnd = 0
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real x1 = 0.
local real y1 = 0.
local real angle = 0.
local real dist = 0.
set COUNTER = 0
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,AOE_SEARCH,function HeroesFilter)
set kEnd = GetRandomInt(1,COUNTER)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null or k==kEnd
set k = k +1
if k == kEnd then
set x1 = GetUnitX(tempu)
set y1 = GetUnitY(tempu)
set SHARD = CreateUnit(GetOwningPlayer(CASTER),SHARD_DUMMY,x,y,0.)
set angle = Atan2(y1-y,x1-x)*bj_RADTODEG
set dist = SquareRoot((x-x1)*(x-x1)+(y-y1)*(y-y1))
call ParKnock(SHARD,GetRandomReal(350.,500.),dist,SHARD_FLY_DURATION,angle,false,"")
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,SHARD)
call SaveEffectHandle(udg_hash,GetHandleId(t),2,AddSpecialEffect(EFFECT_AOE_INDICATOR,x1,y1))
call TimerStart(t,SHARD_FLY_DURATION,false,function onTimerManaExplosion)
set t = null
endif
call GroupRemoveUnit(g,tempu)
endloop
set tempu = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope VortexZarshuul initializer onInit
globals
private constant integer ABILCODE = 'A06O'
private constant integer VORTEXCODE = 'h01H'
private constant real SUCKING_AOE = 1000.
private constant integer ISPREVENTED_HASH = 201
private constant string CASTER_EFFECT = "Abilities\\Spells\\Undead\\RegenerationAura\\ObsidianRegenAura.mdl"
private constant string CASTER_ATTACH = "origin"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function HeroesFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() then
if IsUnitEnemy(udg_Heroes[i],GetOwningPlayer(udg_temp_unit)) and not IsUnitDeadBX(udg_Heroes[i]) then
return true
endif
endif
set i = i + 1
endloop
return false
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit VORTEX = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local real x = GetUnitX(VORTEX)
local real y = GetUnitY(VORTEX)
local real dist = 0.
local real x2 = 0.
local real y2 = 0.
local real angle = 0.
local real h = 0.
local group g = null
local unit tempu = null
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
//suck heroes
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g, GetUnitX(VORTEX), GetUnitY(VORTEX) , SUCKING_AOE, function HeroesFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set x2 = GetUnitX(tempu)
set y2 = GetUnitY(tempu)
set angle = Atan2(y-y2,x - x2)
set dist = SquareRoot( (x-x2)*(x-x2)+(y-y2)*(y-y2) )
set h = GetUnitMoveSpeed(tempu)*(0.7 - 0.5 * (1-dist/SUCKING_AOE ))/25.
call SetUnitX(tempu,x2+h*Cos(angle))
call SetUnitY(tempu,y2+h*Sin(angle))
call GroupRemoveUnit(g,tempu)
endloop
if ISPREVENTED then
call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),2))
//call FadeUnitOut(VORTEX,2.,true)
call RemoveUnit(VORTEX)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
call DestroyGroup(g)
set g = null
set tempu = null
set t = null
set VORTEX = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local unit VORTEX = CreateUnit(GetOwningPlayer(CASTER),VORTEXCODE,GetSpellTargetX(),GetSpellTargetY(),0.)
call SaveReal(udg_hash,GetHandleId(VORTEX),GetSpellPowerHash(),GetUnitSpellPower(CASTER))
call GroupAddUnit(DPS_GROUP,VORTEX)
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveEffectHandle(udg_hash,GetHandleId(t),2,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveUnitHandle(udg_hash,GetHandleId(t),3,VORTEX)
call TimerStart(t,0.04,true,function onTimer)
set VORTEX = null
set CASTER = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope MeetingStone initializer onInit
globals
boolean CHAPTER2_STARTED = false
private boolean MEETINGSTONE_ACTIVATED = false
private constant real THRESHOLD_DIST = 500.
endglobals
private function Conds takes nothing returns boolean
return (not CHAPTER2_STARTED)
endfunction
private function SummonActs takes nothing returns nothing
local integer j = 1
local real d = 0.
local real x = GetRectCenterX(gg_rct_MeetingStone)
local real y = GetRectCenterY(gg_rct_MeetingStone)
local real x1 = 0.
local real y1 = 0.
loop
exitwhen j>6
if GetOwningPlayer(udg_Heroes[j])==GetTriggerPlayer() then
set x1 = GetUnitX(udg_Heroes[j])
set y1 = GetUnitY(udg_Heroes[j])
set d = SquareRoot( (x-x1)*(x-x1)+(y-y1)*(y-y1) )
if d > THRESHOLD_DIST then
if not (GetWidgetLife(udg_Heroes[j])>0.) then
call ReviveHero(udg_Heroes[j],GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect),false)
endif
call SetUnitPosition(udg_Heroes[j],x,y)
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", udg_Heroes[j], "origin" ))
endif
endif
set j = j + 1
endloop
endfunction
private function Acts takes nothing returns nothing
if not MEETINGSTONE_ACTIVATED then
set MEETINGSTONE_ACTIVATED = true
call SetUnitAnimation(gg_unit_h03Y_0032,"Stand Work")
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,25.,"Meeting Stone is activated. Type \"|c008080C0-summon|r\" to get summoned and ressurected.")
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_MeetingStone )
call TriggerAddCondition(t, Condition( function Conds ) )
call TriggerAddAction( t, function Acts )
call TriggerRegisterPlayerChatEvent( t1, Player(0), "-summon", true )
call TriggerRegisterPlayerChatEvent( t1, Player(1), "-summon", true )
call TriggerRegisterPlayerChatEvent( t1, Player(2), "-summon", true )
call TriggerRegisterPlayerChatEvent( t1, Player(3), "-summon", true )
call TriggerRegisterPlayerChatEvent( t1, Player(4), "-summon", true )
call TriggerRegisterPlayerChatEvent( t1, Player(5), "-summon", true )
call TriggerAddCondition(t1, Condition( function Conds ) )
call TriggerAddAction( t1, function SummonActs )
set t = null
set t1 = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library C2SPAWNS initializer C2SPAWNS_ini requires ParabolaMovement
globals
integer array GOLEMS[5]
boolean Gives_Gold = true
boolean Gives_Exp = true
integer CURRENT_SIEGE_GOLEMS = 0
integer MAX_SIEGE_GOLEMS = 3
endglobals
function C2WaveSpawnCont takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real angle
local integer i = 1
call FlushChildHashtable(udg_hash,GetHandleId(t))
loop
exitwhen i>3
set angle = GetRandomReal(1.,360.)
set udg_temp_unit = CreateUnit(Player(7),'h00V',x,y,angle)
call ParKnock(udg_temp_unit,GetRandomReal(150.,300.),GetRandomReal(150.,300.),0.5,angle,false,"")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',0.5)
set i = i + 1
endloop
call DestroyTimer(t)
set u = null
set t = null
endfunction
function C2WaveSpawn takes location loc returns nothing //MAIN FUNCTION
local real angle = AngleBetweenPoints(loc,udg_C_Spawns[8])
local real distance = DistanceBetweenPoints(loc,udg_C_Spawns[8])
local unit u = CreateUnitAtLoc(Player(7),'h00U',loc,angle)
local real time = GetRandomReal(1.25,2.)
local timer t = CreateTimer()
set CURRENT_SIEGE_GOLEMS = 0
if udg_PlayersInGame <= 2 then
set MAX_SIEGE_GOLEMS = 1
else
if udg_PlayersInGame <= 4 then
set MAX_SIEGE_GOLEMS = 2
else
if udg_PlayersInGame <=6 then
set MAX_SIEGE_GOLEMS = 3
endif
endif
endif
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,time,false,function C2WaveSpawnCont)
call ParKnock(u,GetRandomReal(400.,600.),GetRandomReal(distance-550.,distance-250.),time,GetRandomReal(angle-15.,angle+15.),false,"")
call UnitApplyTimedLife(u,'BHwe',time)
set t = null
set u = null
endfunction
function C2SpawnsConds takes nothing returns boolean
if GetUnitTypeId(GetTriggerUnit()) == 'h00V' then
return true
elseif GetUnitTypeId(GetTriggerUnit()) == 'h00U' then
//Siege Golem
if CURRENT_SIEGE_GOLEMS < MAX_SIEGE_GOLEMS then
set udg_temp_unit = CreateUnit(Player(7),'n00J',GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),GetRandomReal(1.,360.))
call FlushChildHashtable(udg_hash,GetHandleId(udg_temp_unit))
if not Gives_Gold then
call SaveBoolean(udg_hash,GetHandleId(udg_temp_unit),310,true)
endif
if not Gives_Exp then
call SaveBoolean(udg_hash,GetHandleId(udg_temp_unit),311,true)
endif
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),2,10.)
//call Aggro.new(udg_temp_unit)
call IssuePointOrderLoc(udg_temp_unit,"attack",udg_C_Spawns[8])
call TriggerRegisterUnitEvent(GOLEM_ABILITIES_TRG, udg_temp_unit, EVENT_UNIT_DAMAGED )
set CURRENT_SIEGE_GOLEMS = CURRENT_SIEGE_GOLEMS + 1
endif
endif
return false
endfunction
function C2SpawnWaveEnd takes nothing returns nothing
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
set udg_temp_unit = CreateUnit(Player(7),GOLEMS[GetRandomInt(1,5)],x,y,GetRandomReal(1.,360.))
call FlushChildHashtable(udg_hash,GetHandleId(udg_temp_unit))
if not Gives_Gold then
call SaveBoolean(udg_hash,GetHandleId(udg_temp_unit),310,true)
endif
if not Gives_Exp then
call SaveBoolean(udg_hash,GetHandleId(udg_temp_unit),311,true)
endif
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),2,10.)
//call Aggro.new(udg_temp_unit)
call SetUnitAnimation(udg_temp_unit,"birth")
call IssuePointOrderLoc(udg_temp_unit,"attack",udg_C_Spawns[8])
call TriggerRegisterUnitEvent( MUDGOLEM_ABILITIES_TRG, udg_temp_unit, EVENT_UNIT_DAMAGED )
endfunction
function C2SPAWNS_ini takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(7),EVENT_PLAYER_UNIT_DEATH,null)
call TriggerAddCondition(t,Condition(function C2SpawnsConds))
call TriggerAddAction(t,function C2SpawnWaveEnd)
//
set GOLEMS[1] = 'n00I'
set GOLEMS[2] = 'n00M'
set GOLEMS[3] = 'n00N'
set GOLEMS[4] = 'n00L'
set GOLEMS[5] = 'n00K'
set udg_C_Spawns[5] = GetRectCenter(gg_rct_StoneCoreEnter)
set udg_C_Spawns[6] = GetRectCenter(gg_rct_RightTopSpawn)
set udg_C_Spawns[7] = GetRectCenter(gg_rct_RightBotSpawn)
set udg_C_Spawns[8] = GetRectCenter(gg_rct_Act2Start)
set t = null
endfunction
endlibrary
//TESH.scrollpos=46
//TESH.alwaysfold=0
library MeteorStrike requires ParabolaMovement
private struct st
static st array data
static integer index = 0
static timer t = CreateTimer()
unit u = null
static method GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),Player(7)) and GetWidgetLife(GetFilterUnit())>0. and not(GetUnitAbilityLevel(GetFilterUnit(),'B00B')>0)
endmethod
static method onTimer takes nothing returns nothing
local integer i = 0
local integer j = 0
local boolexpr GROUPFILTER = null
loop
exitwhen i >= .index
call SetUnitFlyHeight(.data[i].u,GetUnitFlyHeight(.data[i].u)-80.,0.)
if GetUnitFlyHeight(.data[i].u)<=80 or not(GetWidgetLife(.data[i].u) > 0.) then
if GetWidgetLife(.data[i].u)>0. then
set GROUPFILTER = Condition(function st.GroupFilter)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",GetUnitX(.data[i].u),GetUnitY(.data[i].u)) )
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(.data[i].u),GetUnitY(.data[i].u),350.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call UnitDamageTarget(.data[i].u,udg_temp_unit,1500. + 500.*I2R(METEORCOUNT),false,false,null,null,null)
endloop
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
endif
loop
exitwhen j > GetRandomInt(0,1)
set udg_temp_unit = CreateUnit(Player(7),'h00Z',GetUnitX(.data[i].u),GetUnitY(.data[i].u),0.)
call ParKnock(udg_temp_unit,GetRandomReal(150.,600.),GetRandomReal(150.,600.),1.,GetRandomReal(1.,360.),false,"")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',1.)
set j = j + 1
endloop
set j = 0
call KillUnit(.data[i].u)
call .data[i].destroy()
set .index = .index - 1
if .index == 0 then
call PauseTimer(.t)
endif
set .data[i] = .data[.index]
set i = i - 1
endif
set i = i + 1
endloop
endmethod
static method onCast takes real x,real y returns nothing
local real x1 = GetUnitX(udg_KingOfStormwind)
local real y1 = GetUnitY(udg_KingOfStormwind)
local real dist = SquareRoot((x-x1)*(x-x1)+(y-y1)*(y-y1))
set .data[.index] = st.create()
set .data[.index].u = CreateUnit(Player(7),'h00X',x,y,GetRandomReal(1.,360.))
call SetUnitFlyHeight(.data[.index].u,1000.,0.)
if dist <= 275. then
call UnitApplyTimedLife(.data[.index].u,'BHwe',0.34)
else
call UnitApplyTimedLife(.data[.index].u,'BHwe',0.5)
endif
if .index == 0 then
call TimerStart(.t,0.04,true,function st.onTimer)
endif
set .index = .index + 1
endmethod
endstruct
function Meteor takes real x,real y returns nothing
call st.onCast(x,y)
endfunction
endlibrary
function Trig_chapter2_teleport_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_chapter2_teleport_Actions takes nothing returns nothing
set udg_LeakPoint[1] = GetRectCenter(gg_rct_Act2Arrival)
call SetUnitPositionLoc( GetTriggerUnit(), udg_LeakPoint[1] )
if C2_JEWELER == null then
set C2_JEWELER = CreateUnit(KOBOLDS,'h047',GetRectCenterX(gg_rct_C2KoboldApperance),GetRectCenterY(gg_rct_C2KoboldApperance),330.)
call TimerStart(C2_JEWELER_TIMER,0.5,true,null)
endif
call DisplayTimedTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,15.,"Chapter 2: |cff8080ffStormwind|r.")
call RemoveLocation(udg_LeakPoint[1])
endfunction
//===========================================================================
function InitTrig_chapter2_teleport takes nothing returns nothing
set gg_trg_chapter2_teleport = CreateTrigger( )
call DisableTrigger( gg_trg_chapter2_teleport )
call TriggerRegisterEnterRectSimple( gg_trg_chapter2_teleport, gg_rct_Act2Teleport )
call TriggerAddCondition( gg_trg_chapter2_teleport, Condition( function Trig_chapter2_teleport_Conditions ) )
call TriggerAddAction( gg_trg_chapter2_teleport, function Trig_chapter2_teleport_Actions )
endfunction
function Trig_C2_defeat_Conditions takes nothing returns boolean
if ( not ( GetTriggerUnit() == udg_KingOfStormwind ) ) then
return false
endif
return true
endfunction
function Trig_C2_defeat_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CustomDefeatBJ( ConvertedPlayer(GetForLoopIndexA()), "TRIGSTR_1615" )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_C2_defeat takes nothing returns nothing
set gg_trg_C2_defeat = CreateTrigger( )
call DisableTrigger( gg_trg_C2_defeat )
call TriggerRegisterAnyUnitEventBJ( gg_trg_C2_defeat, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_C2_defeat, Condition( function Trig_C2_defeat_Conditions ) )
call TriggerAddAction( gg_trg_C2_defeat, function Trig_C2_defeat_Actions )
endfunction
scope Chapter2StartPreload initializer onInit
globals
private boolean CHAPTER2_PRELOADED = false
private integer array CHAPTER2_UNITS_PRELOAD
private integer MAX_N = 29
endglobals
private function onEnter takes nothing returns nothing
local integer i = 1
set CHAPTER2_PRELOADED = true
loop
exitwhen i>MAX_N
call AddUnitToPreloadQueueById(CHAPTER2_UNITS_PRELOAD[i])
set i = i + 1
endloop
if CURRENT_DIFFICULTY == 1 or CURRENT_DIFFICULTY == 2 then
set GOLEM_LIMIT = 5
endif
if CURRENT_DIFFICULTY == 3 then
set GOLEM_LIMIT = 6
endif
if CURRENT_DIFFICULTY >= 4 then
set GOLEM_LIMIT = 7
endif
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"Chapter II resources are added to the preload queue (required time: " + I2S(R2I(MAX_N*PRELOAD_TIMER_PERIOD)) + " seconds). Players may suffer freezes for a duration.")
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerUnit()==udg_Heroes[i] then
return not CHAPTER2_PRELOADED
endif
set i = i + 1
endloop
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_Act2BOUNDS )
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction( t, function onEnter )
set CHAPTER2_UNITS_PRELOAD[1] = 'h013' //Weaponer
set CHAPTER2_UNITS_PRELOAD[2] = 'h012' //Inscriptor
set CHAPTER2_UNITS_PRELOAD[3] = 'h010' //Alchemist
set CHAPTER2_UNITS_PRELOAD[4] = 'h011' //Armorer
set CHAPTER2_UNITS_PRELOAD[5] = 'h024' //Devil Nova - Devil
set CHAPTER2_UNITS_PRELOAD[6] = 'h023' //Devil Nova - Fire
set CHAPTER2_UNITS_PRELOAD[7] = 'h025' //Devil Nova - Explosion
set CHAPTER2_UNITS_PRELOAD[8] = 'h01P' //Shield Merchants
set CHAPTER2_UNITS_PRELOAD[9] = 'h01T' //Felstone Remains
set CHAPTER2_UNITS_PRELOAD[10] = 'h026' //Bouncing rock (Mud Golem)
set CHAPTER2_UNITS_PRELOAD[11] = 'h027' //Bouncing rock Clap Dummy
set CHAPTER2_UNITS_PRELOAD[12] = 'h020' //Firestone Blow
set CHAPTER2_UNITS_PRELOAD[13] = 'h00Y' //Holy Shield
set CHAPTER2_UNITS_PRELOAD[14] = 'h01L' //Chapter 2 Portal
set CHAPTER2_UNITS_PRELOAD[15] = 'n00N' //Purestone Golem
set CHAPTER2_UNITS_PRELOAD[16] = 'n00I' //Mudstone Golem
set CHAPTER2_UNITS_PRELOAD[17] = 'n00M' //Lavastone Golem
set CHAPTER2_UNITS_PRELOAD[18] = 'n00L' //Firestone Golem
set CHAPTER2_UNITS_PRELOAD[19] = 'n00K' //Felstone Golem
set CHAPTER2_UNITS_PRELOAD[20] = 'h00J' //Siege Golem
set CHAPTER2_UNITS_PRELOAD[21] = 'h00O' //Stonecore Guardian
set CHAPTER2_UNITS_PRELOAD[22] = 'h01X' //Stonecore Guardian Summon BOMB
set CHAPTER2_UNITS_PRELOAD[23] = 'h01U' //Felstone Meteor Chopped
set CHAPTER2_UNITS_PRELOAD[24] = 'h022' //Firestone Meteor Chopped
set CHAPTER2_UNITS_PRELOAD[25] = 'h01V' //Purestone Meteor Chopped
set CHAPTER2_UNITS_PRELOAD[26] = 'h00Z' //Meteor Part
set CHAPTER2_UNITS_PRELOAD[27] = 'h00U' //Rock Main
set CHAPTER2_UNITS_PRELOAD[28] = 'h01S' //Rock chopped
set CHAPTER2_UNITS_PRELOAD[29] = 'h00V' //Rock SUM
set MAX_N = 29
set t = null
endfunction
endscope
function Trig_chapter_2_ini_Func001C takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_chapter_2_ini_Actions takes nothing returns nothing
if ( Trig_chapter_2_ini_Func001C() ) then
call SaveInteger(udg_hash,GetHandleId(GetTriggerUnit()),CHAPTER_HERO_HASH,2)
else
endif
endfunction
//===========================================================================
function InitTrig_chapter_2_ini takes nothing returns nothing
set gg_trg_chapter_2_ini = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_chapter_2_ini, gg_rct_Act2BOUNDS )
call TriggerAddAction( gg_trg_chapter_2_ini, function Trig_chapter_2_ini_Actions )
endfunction
globals
unit C2_Portal = null
endglobals
function Trig_C2_Units_ini_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function PortalOnTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local boolean back = LoadBoolean(udg_hash,GetHandleId(t),1)
if back then
call SetUnitTimeScale(C2_Portal,-0.55)
call SaveBoolean(udg_hash,GetHandleId(t),1,false)
else
call SetUnitTimeScale(C2_Portal,0.55)
call SaveBoolean(udg_hash,GetHandleId(t),1,true)
endif
call TimerStart(t,3.,false,function PortalOnTimer)
set t = null
endfunction
function Trig_C2_Units_ini_Actions takes nothing returns nothing
local timer t = CreateTimer()
call DisableTrigger( GetTriggeringTrigger() )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_KingSpawn)
call CreateNUnitsAtLoc( 1, 'H00T', Player(8), udg_LeakPoint[1], 315.00 )
set udg_KingOfStormwind = GetLastCreatedUnit()
call FlushChildHashtable(udg_hash,GetHandleId(udg_KingOfStormwind))
call SaveReal(udg_hash,GetHandleId(udg_KingOfStormwind),16,1.)
call SetUnitAnimation(udg_KingOfStormwind,"Stand Victory")
set C2_Portal = CreateUnit(Player(8),'h01L',GetRectCenterX(gg_rct_C2Alchemist)-100.,GetRectCenterY(gg_rct_C2Alchemist),0.)
call SetUnitAnimation(C2_Portal,"birth")
call SaveBoolean(udg_hash,GetHandleId(t),1,true)
call TimerStart(t,6.,false,function PortalOnTimer)
set t = null
call SuspendHeroXPBJ( false, udg_KingOfStormwind )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 5
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_LeakPoint[2] = PolarProjectionBJ(udg_LeakPoint[1], 500.00, ( 270.00 + ( I2R(GetForLoopIndexA()) * 15.00 ) ))
call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', Player(8), udg_LeakPoint[2], udg_LeakPoint[1] )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_C2_Footmans )
call SetUnitAnimation(GetLastCreatedUnit(),"Stand Victory")
set udg_LeakPoint[3] = PolarProjectionBJ(udg_LeakPoint[1], 700.00, ( 270.00 + ( I2R(GetForLoopIndexA()) * 15.00 ) ))
call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', Player(8), udg_LeakPoint[3], udg_LeakPoint[1] )
call GroupAddUnitSimple( GetLastCreatedUnit(), udg_C2_Footmans )
call SetUnitAnimation(GetLastCreatedUnit(),"Stand Victory")
call RemoveLocation(udg_LeakPoint[2])
call RemoveLocation(udg_LeakPoint[3])
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call EnableTrigger( gg_trg_C2_defeat )
call RemoveLocation(udg_LeakPoint[1])
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_C2_Units_ini takes nothing returns nothing
set gg_trg_C2_Units_ini = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_C2_Units_ini, gg_rct_Act2BOUNDS )
call TriggerAddCondition( gg_trg_C2_Units_ini, Condition( function Trig_C2_Units_ini_Conditions ) )
call TriggerAddAction( gg_trg_C2_Units_ini, function Trig_C2_Units_ini_Actions )
endfunction
//TESH.scrollpos=63
//TESH.alwaysfold=0
globals
unit LIGHTSHIELD = null
unit C2_Armorer = null
unit C2_Weaponer = null
unit C2_Inscriptor = null
unit C2_Alchemist = null
boolean CHAPTER2_INITIALIZED = false
boolean IS_METEORITE_RAIN = false
endglobals
function Trig_C2_Cinematic_Conditions takes nothing returns boolean
return IsUnitAlly(GetTriggerUnit(), Player(6))
endfunction
function ResetKingAfterFallCine takes nothing returns nothing
local timer t = GetExpiredTimer()
call PauseUnit(udg_KingOfStormwind,false)
call SetUnitAnimation(udg_KingOfStormwind,"stand")
call PlaySoundOnUnitBJ(gg_snd_WrynnStandUp,100.,udg_KingOfStormwind)
call DestroyTimer(t)
set t = null
endfunction
function GolemAutoCastGroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and (not IsUnitPaused(GetFilterUnit())) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function GolemAutoCastCheckOnTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local group g = CreateGroup()
local boolean found = false
local integer j = 0
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),900.,Condition(function GolemAutoCastGroupFilter))
loop
set udg_temp_unit = FirstOfGroup(g)
exitwhen found or udg_temp_unit == null
set j = 1
loop
exitwhen j>5
if GetUnitTypeId(udg_temp_unit) == GOLEMS[j] then
set found = true
endif
set j = j + 1
endloop
call GroupRemoveUnit(g,udg_temp_unit)
endloop
if found and LoadInteger(udg_hash,GetHandleId(CASTER), 200) < 4*udg_PlayersInGame then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Ordering the Golem to cast.")
call IssueImmediateOrder(CASTER,"roar")
call TimerStart(t,2.,false,function GolemAutoCastCheckOnTimer)
else
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Nothing to absorb or golem is fulled.")
call TimerStart(t,2.,false,function GolemAutoCastCheckOnTimer)
endif
if not (GetWidgetLife(CASTER)>0.) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Golem is dead. Removing this timer.")
set GOLEM_COUNT = GOLEM_COUNT + 1
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Stonecore Guardians killed: |c00804040" + I2S(GOLEM_COUNT) + "|r/" + I2S(GOLEM_LIMIT) + ".")
call UpgradeStonecoreGuardians()
if GOLEM_COUNT >= GOLEM_LIMIT then
call TimerStart(CHAPTER2_END_TIMER,1.,false,null)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
call DestroyGroup(g)
set t = null
set CASTER = null
set g = null
endfunction
function C2_SummonBigGolemUnpause takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call PauseUnit(u,false)
call SetUnitTimeScale(u,1.)
call SetUnitAnimation(u,"stand")
call UnitRemoveAbility(u,'A03P')
call IssuePointOrderLoc(u,"attack",udg_C_Spawns[8])
call SaveBoolean(udg_hash,GetHandleId(u),208,true)
call SaveEffectHandle(udg_hash,GetHandleId(u),209,AddSpecialEffectTarget("Abilities\\Spells\\Human\\AerialShackles\\AerialShacklesTarget.mdl",u,"chest"))
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,u)
call TimerStart(t1,2.0,false,function GolemAutoCastCheckOnTimer)
call SaveInteger(udg_hash,GetHandleId(u),210,udg_PlayersInGame)
if GOLEM_COUNT >= GOLEM_LIMIT-1 then
set Gives_Gold = false
set Gives_Exp = false
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
set t1 = null
endfunction
function C2_SummonBigGolemEnd takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit meteor = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real x = GetUnitX(meteor)
local real y = GetUnitY(meteor)
local timer t1 = CreateTimer()
local unit u = CreateUnit(Player(7),'n00O',x,y,0.)
call UnitAddAbility(u,'A03P')
call PauseUnit(u,true)
call SetUnitTimeScale(u,0.5)
call SetUnitAnimation(u,"birth")
call FlushChildHashtable(udg_hash,GetHandleId(u))
call SaveReal(udg_hash,GetHandleId(u),2,10.)
//call Aggro.new(u)
call TriggerRegisterUnitEvent(GOLEM_ABILITIES_TRG, u, EVENT_UNIT_DAMAGED )
call SaveReal(udg_hash,GetHandleId(u),16,1.)
call SaveReal(udg_hash,GetHandleId(u),22,1.)
call SaveReal(udg_hash,GetHandleId(u),7,1.)
call SaveReal(udg_hash,GetHandleId(u),10,3.*CURRENT_DIFFICULTY/5.)
call SaveBoolean(udg_hash,GetHandleId(u),300,true)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,u)
call TimerStart(t1,3.268,false,function C2_SummonBigGolemUnpause)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set t1 = null
set u = null
endfunction
function C2_SummonBigGolemIntro takes nothing returns nothing
local real x = GetRectCenterX(gg_rct_Act2Start)
local real y = GetRectCenterY(gg_rct_Act2Start)
local real x1 = GetRandomReal(x-300.,x+300.)
local real y1 = GetRandomReal(y-300.,y+300.)
local real x2 = GetRectCenterX(gg_rct_StonecoreGuardianStart)
local real y2 = GetRectCenterY(gg_rct_StonecoreGuardianStart)
local real angle = Rad2Deg(Atan2(y1-y2,x1-x2))
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local timer t = CreateTimer()
local unit u = CreateUnit(Player(7),'h01X',x2,y2,angle)
call ParKnock(u,700.,dist,3.,angle,false,"none")
call UnitApplyTimedLife(u,'BHwe',3.)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,3.,false,function C2_SummonBigGolemEnd)
set t = null
set u = null
endfunction
function MeteorBombing takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local timer t3 = null
local real TIMEOUT = LoadReal(udg_hash,GetHandleId(t),1)
local real x = GetRandomReal( GetRectMinX(gg_rct_Meteor),GetRectMaxX(gg_rct_Meteor) )
local real y = GetRandomReal( GetRectMinY(gg_rct_Meteor),GetRectMaxY(gg_rct_Meteor) )
local integer i = 1
local real DURATION = 15.
if TURBO_MODE then
set DURATION = DURATION / TURBO_TIMER_FACTOR
endif
set TIMEOUT = TIMEOUT + 0.1
call SaveReal(udg_hash,GetHandleId(t),1,TIMEOUT)
call Meteor(x,y)
if TIMEOUT >= DURATION then
set IS_METEORITE_RAIN = false
call FlushChildHashtable(udg_hash,GetHandleId(t))
call RemoveUnit(LIGHTSHIELD)
call SetUnitAnimation(udg_KingOfStormwind,"death")
call UnitRemoveAbility(udg_KingOfStormwind,'A01T')
set udg_LeakPoint[1] = GetRectCenter(gg_rct_C2Inscriptor)
set udg_LeakPoint[2] = GetRectCenter(gg_rct_C2Armorer)
set udg_LeakPoint[3] = GetRectCenter(gg_rct_C2Weaponer)
set udg_LeakPoint[4] = GetRectCenter(gg_rct_C2Alchemist)
set C2_Inscriptor = CreateUnitAtLoc( Player(8), 'h012', udg_LeakPoint[1], 0. )
set C2_Armorer = CreateUnitAtLoc(Player(8), 'h011', udg_LeakPoint[2], 0. )
set C2_Weaponer = CreateUnitAtLoc(Player(8), 'h013', udg_LeakPoint[3], 0. )
set C2_Alchemist = CreateUnitAtLoc(Player(8), 'h010', udg_LeakPoint[4], 0. )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",GetUnitX(C2_Inscriptor),GetUnitY(C2_Inscriptor)) )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",GetUnitX(C2_Armorer),GetUnitY(C2_Armorer)) )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",GetUnitX(C2_Weaponer),GetUnitY(C2_Weaponer)) )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",GetUnitX(C2_Alchemist),GetUnitY(C2_Alchemist)) )
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
call RemoveLocation(udg_LeakPoint[3])
call RemoveLocation(udg_LeakPoint[4])
set t3 = CreateTimer()
if TURBO_MODE then
call TimerStart(t3, 10./TURBO_TIMER_FACTOR, false, function C2_SummonBigGolemIntro)
else
call TimerStart(t3, 10., false, function C2_SummonBigGolemIntro)
endif
call DestroyTimer(t)
set t1 = CreateTimer()
if TURBO_MODE then
call TimerStart(t1,100./TURBO_TIMER_FACTOR,false,function ResetKingAfterFallCine)
else
call TimerStart(t1,100.,false,function ResetKingAfterFallCine)
endif
set t1 = null
call DestroyTrigger(gg_trg_C2_Cinematic)
loop
exitwhen i>udg_PlayerCount
call CameraClearNoiseForPlayer(udg_Players[i])
set i = i + 1
endloop
endif
set t = null
set t3 = null
endfunction
function C2_Cinematic_Begin takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer Spawn = CreateTimer()
local integer i = 1
call TimerStart(Spawn,0.1,true,function MeteorBombing)
set IS_METEORITE_RAIN = true
loop
exitwhen i>udg_PlayerCount
if TURBO_MODE then
call CameraSetEQNoiseForPlayer( udg_Players[i], 15./TURBO_TIMER_FACTOR )
else
call CameraSetEQNoiseForPlayer( udg_Players[i], 15. )
endif
set i = i + 1
endloop
set t = null
set Spawn = null
endfunction
function C2_Cinematic_Second takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
//call SetUnitTimeScale(LIGHTSHIELD,0.)
call TimerStart(t1,5.,false,function C2_Cinematic_Begin)
call DestroyTimer(t)
set t = null
set t1 = null
endfunction
function FOOTMANS_PANIC takes nothing returns nothing
local real x = GetRandomReal( GetRectMinX(gg_rct_Meteor),GetRectMaxX(gg_rct_Meteor) )
local real y = GetRandomReal( GetRectMinY(gg_rct_Meteor),GetRectMaxY(gg_rct_Meteor) )
call SetUnitPathing(GetEnumUnit(),false)
call IssuePointOrder(GetEnumUnit(),"move",x,y)
if TURBO_MODE then
call UnitApplyTimedLife(GetEnumUnit(),'BHwe',13./TURBO_TIMER_FACTOR+1.5)
else
call UnitApplyTimedLife(GetEnumUnit(),'BHwe',13.)
endif
endfunction
function GETPANICTOFOOTMAN takes nothing returns nothing
local timer t = GetExpiredTimer()
call ForGroup(udg_C2_Footmans,function FOOTMANS_PANIC)
set udg_temp_unit = FirstOfGroup(udg_C2_Footmans)
if not(GetWidgetLife(udg_temp_unit)>0.) then
call DestroyGroup(udg_C2_Footmans)
call DestroyTimer(t)
endif
set t = null
endfunction
function C2_Cinematic_First takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
local timer t2 = CreateTimer()
local real x = GetUnitX(udg_KingOfStormwind)
local real y = GetUnitY(udg_KingOfStormwind)
local real x1 = GetRectCenterX(gg_rct_Act2Start)
local real y1 = GetRectCenterY(gg_rct_Act2Start)
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",x,y) )
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",x1,y1) )
call SetUnitX(udg_KingOfStormwind,x1)
call SetUnitY(udg_KingOfStormwind,y1)
call PauseUnit(udg_KingOfStormwind,true)
call SetUnitFacing(udg_KingOfStormwind,270.)
call SetUnitAnimation(udg_KingOfStormwind,"stand channel")
call PlaySoundOnUnitBJ(gg_snd_WrynnDivineShield,100.,udg_KingOfStormwind)
call UnitAddAbility(udg_KingOfStormwind,'A01T')
set LIGHTSHIELD = CreateUnit(Player(7),'h00Y',x1,y1,0.)
call TimerStart(t2,2.5,true,function GETPANICTOFOOTMAN)
call ForGroup(udg_C2_Footmans,function FOOTMANS_PANIC)
call TimerStart(t1,1.,false,function C2_Cinematic_Second)
call DestroyTimer(t)
set CHAPTER2_STARTED = true
set CHAPTER2_INITIALIZED = true
call SetUnitAnimation( gg_unit_h03Y_0032, "Stand" )
set t = null
set t1 = null
set t2 = null
endfunction
function Trig_C2_Cinematic_Actions takes nothing returns nothing
local timer t = CreateTimer()
call DisableTrigger(GetTriggeringTrigger())
call StartTimerBJ(udg_C2_Timerini,false,10.)
call TimerStart(t,10.,false,function C2_Cinematic_First)
set t = null
endfunction
//===========================================================================
function InitTrig_C2_Cinematic takes nothing returns nothing
set gg_trg_C2_Cinematic = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_C2_Cinematic, gg_rct_Act2Cinematic )
call TriggerAddCondition( gg_trg_C2_Cinematic, Condition( function Trig_C2_Cinematic_Conditions ) )
call TriggerAddAction( gg_trg_C2_Cinematic, function Trig_C2_Cinematic_Actions )
endfunction
function Trig_C2_waves_ini_Actions takes nothing returns nothing
set udg_LeakPoint[5] = GetRectCenter(gg_rct_Act2Start)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateFogModifierRadiusLocBJ( true, udg_Players[GetForLoopIndexA()], FOG_OF_WAR_VISIBLE, udg_LeakPoint[5], 1500.00 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(udg_LeakPoint[5])
call EnableTrigger(GOLEM_ABILITIES_TRG)
call EnableTrigger(MUDGOLEM_ABILITIES_TRG)
call EnableTrigger( gg_trg_TOP_Waves_C2 )
call EnableTrigger( gg_trg_RIGHT_TOP_Waves_C2 )
call EnableTrigger( gg_trg_RIGHT_BOT_Waves_C2 )
call EnableTrigger( gg_trg_METEOR_RAIN )
//call StartTimerBJ( udg_C2_ENDTIMER, false, 930.00 )
//call CreateTimerDialogBJ( udg_C2_ENDTIMER, "TRIGSTR_1616" )
//set udg_C2_ENDTIMERWINDOW = GetLastCreatedTimerDialogBJ()
//call TimerDialogDisplayBJ( true, udg_C2_ENDTIMERWINDOW )
if TURBO_MODE then
call StartTimerBJ( udg_MeteorStrike_Timer, true, 150./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_MeteorStrike_Timer, true, 150.00 )
endif
call CreateTimerDialogBJ( udg_MeteorStrike_Timer, "TRIGSTR_1618" )
set udg_MeteorStrike_Window = GetLastCreatedTimerDialogBJ()
call TimerDialogDisplayBJ( true, udg_MeteorStrike_Window )
if WavesOpened[1] or WavesOpened[4] then
if TURBO_MODE then
call StartTimerBJ( udg_LeftTimer, true, 30./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_LeftTimer, true, 30.00 )
endif
endif
if WavesOpened[2] or WavesOpened[5] then
if TURBO_MODE then
call StartTimerBJ( udg_MiddleTimer, true, 30./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_MiddleTimer, true, 30.00 )
endif
endif
if WavesOpened[3] or WavesOpened[6] then
if TURBO_MODE then
call StartTimerBJ( udg_RightTimer, true, 30./TURBO_TIMER_FACTOR )
else
call StartTimerBJ( udg_RightTimer, true, 30.00 )
endif
endif
call DestroyTrigger(GetTriggeringTrigger())
endfunction
//===========================================================================
function InitTrig_C2_waves_ini takes nothing returns nothing
set gg_trg_C2_waves_ini = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_C2_waves_ini, udg_C2_Timerini )
call TriggerAddAction( gg_trg_C2_waves_ini, function Trig_C2_waves_ini_Actions )
endfunction
library Chapter2Ends initializer onInit
globals
integer GOLEM_COUNT = 0
integer GOLEM_LIMIT = 7
timer CHAPTER2_END_TIMER = CreateTimer()
endglobals
private function onTimerExpires takes nothing returns nothing
call SetUnitInvulnerable( udg_KingOfStormwind, true )
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1620" )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_StoneCoreEnter)
call PingMinimapLocForForceEx( GetPlayersAll(), udg_LeakPoint[1], 40.00, bj_MINIMAPPINGSTYLE_SIMPLE, 0.00, 0.00, 100 )
call PlaySoundBJ(gg_snd_Gates)
call RemoveLocation(udg_LeakPoint[1])
call DestroyTrigger( gg_trg_C2_defeat )
call DestroyTrigger( gg_trg_METEOR_RAIN )
call DestroyTrigger( gg_trg_TOP_Waves_C2 )
call DestroyTrigger( gg_trg_RIGHT_BOT_Waves_C2 )
call DestroyTrigger( gg_trg_RIGHT_TOP_Waves_C2 )
call DestroyTrigger(GOLEM_ABILITIES_TRG)
call DestroyTrigger(MUDGOLEM_ABILITIES_TRG)
call DestroyGroup(MUD_GOLEMS_GROUP)
call DestroyTimer( udg_C2_ENDTIMER )
call DestroyTimerDialog( udg_C2_ENDTIMERWINDOW )
call DestroyTimer( udg_C2_Timerini )
call DestroyTimer( udg_C2_TimerStart )
call PauseTimerBJ( true, udg_LeftTimer )
call PauseTimerBJ( true, udg_MiddleTimer )
call PauseTimerBJ( true, udg_RightTimer )
call EnableTrigger( gg_trg_Stonecore_Teleport )
call EnableTrigger( gg_trg_Stonecore_Teleport_Back )
call TimerStart(REFRESH_COMBAT_TRIGGERS_TIMER,1.,false,null)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEventBJ( t, CHAPTER2_END_TIMER )
call TriggerAddAction( t, function onTimerExpires )
set t = null
endfunction
endlibrary
scope JewelerChapter2 initializer onInit
//Kobold is created at JewelerC1 trigger
globals
unit C2_JEWELER = null
timer C2_JEWELER_TIMER = CreateTimer()
private integer N0 = 0
private integer N1 = 0
private integer N2 = 0
private integer N3 = 0
private integer r_index = 0
private boolean ORDERED_MOVE = false
private boolean BARREL_ANIMED = false
private constant integer BASE_SKIN = 'h047'
private constant integer BARREL_SKIN = 'h049'
endglobals
private function GroupFilter takes nothing returns boolean
if GetOwningPlayer(GetFilterUnit()) == INVADERS then
if r_index == 0 then
set N0 = N0+1
endif
if r_index == 1 then
set N1 = N1+1
endif
if r_index == 2 then
set N2 = N2+1
endif
if r_index == 3 then
set N3 = N3+1
endif
endif
return false
endfunction
private function onTimer takes nothing returns nothing
local group g = CreateGroup()
local real x0 = GetUnitX(C2_JEWELER)
local real y0 = GetUnitY(C2_JEWELER)
local real x1 = GetRectCenterX(gg_rct_C2Kobold1)
local real y1 = GetRectCenterY(gg_rct_C2Kobold1)
local real x2 = GetRectCenterX(gg_rct_C2Kobold2)
local real y2 = GetRectCenterY(gg_rct_C2Kobold2)
local real x3 = GetRectCenterX(gg_rct_C2Kobold3)
local real y3 = GetRectCenterY(gg_rct_C2Kobold3)
local integer min_index = 0
if CHAPTER2_INITIALIZED and (not IS_METEORITE_RAIN) then
if BARREL_ANIMED then
call BlzSetUnitSkin(C2_JEWELER,BASE_SKIN)
set BARREL_ANIMED = false
call DestroyEffect(AddSpecialEffect("Buildings\\Other\\BarrelsUnit0\\BarrelsUnit0.mdl",x0,y0))
endif
set r_index = 0
set N0 = 0
call GroupEnumUnitsInRange(g,x0,y0,300, function GroupFilter)
set r_index = 1
set N1 = 0
call GroupEnumUnitsInRange(g,x1,y1,300, function GroupFilter)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"COUNTED N1: " + I2S(N1))
set r_index = 2
set N2 = 0
call GroupEnumUnitsInRange(g,x2,y2,300, function GroupFilter)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"COUNTED N2: " + I2S(N2))
set r_index = 3
set N3 = 0
call GroupEnumUnitsInRange(g,x3,y3,300, function GroupFilter)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"COUNTED N3: " + I2S(N3))
if IsUnitDeadBX(C2_JEWELER) then
call PauseTimer(C2_JEWELER_TIMER)
endif
if GetWidgetLife(C2_JEWELER)>0. then
if (N3 <= N1) and (N3<=N2) then
set min_index = 3
endif
if (N2 <= N1) and (N2<=N3) then
set min_index = 2
endif
if (N1 <= N2) and (N1<=N3) then
set min_index = 1
endif
if min_index == 1 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MIN : " + I2S(min_index))
if SquareRoot((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)) >= 25 then
call IssuePointOrder(C2_JEWELER,"move",x1,y1)
set ORDERED_MOVE = true
else
call SetUnitAnimation(C2_JEWELER,"stand")
call SetUnitPathing(C2_JEWELER,false)
call SetUnitFacing(C2_JEWELER,290.)
set ORDERED_MOVE = false
endif
endif
if min_index == 2 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MIN : " + I2S(min_index))
if SquareRoot((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)) >= 25 then
call IssuePointOrder(C2_JEWELER,"move",x2,y2)
set ORDERED_MOVE = true
else
call SetUnitAnimation(C2_JEWELER,"stand")
call SetUnitPathing(C2_JEWELER,false)
call SetUnitFacing(C2_JEWELER,80.)
set ORDERED_MOVE = false
endif
endif
if min_index == 3 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MIN : " + I2S(min_index))
if SquareRoot((x0-x3)*(x0-x3)+(y0-y3)*(y0-y3)) >= 25 then
call IssuePointOrder(C2_JEWELER,"move",x3,y3)
set ORDERED_MOVE = true
else
call SetUnitAnimation(C2_JEWELER,"stand")
call SetUnitPathing(C2_JEWELER,false)
call SetUnitFacing(C2_JEWELER,135.)
set ORDERED_MOVE = false
endif
endif
endif
endif
if CHAPTER2_INITIALIZED and IS_METEORITE_RAIN then
if not BARREL_ANIMED then
call IssueImmediateOrder(C2_JEWELER,"stop")
call SetUnitAnimation(C2_JEWELER,"stand")
call BlzSetUnitSkin(C2_JEWELER,BARREL_SKIN)
set BARREL_ANIMED = true
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Polymorph\\PolyMorphTarget.mdl",x0,y0))
endif
endif
call DestroyGroup(g)
set g = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,C2_JEWELER_TIMER )
call TriggerAddAction(t, function onTimer)
set t = null
endfunction
endscope
//TESH.scrollpos=124
//TESH.alwaysfold=0
globals
group METEORITEGROUP = CreateGroup()
integer METEORCOUNT = 0
endglobals
function MeteorRainGroupFilter takes nothing returns boolean
return GetOwningPlayer(GetFilterUnit())==Player(7) and GetWidgetLife(GetFilterUnit())>0.
endfunction
function MeteorGroupBack takes nothing returns nothing
call ShowUnit(GetEnumUnit(),true)
if CURRENT_DIFFICULTY >= 3 then
call UnitAddAbility(GetEnumUnit(),'A03C')
endif
call SetUnitAnimation(GetEnumUnit(),"birth")
endfunction
function MeterGroupFullBack takes nothing returns nothing
call SetUnitInvulnerable(GetEnumUnit(),false)
call PauseUnit(GetEnumUnit(),false)
call IssuePointOrder(GetEnumUnit(),"attack",GetRectCenterX(gg_rct_Act2Start),GetRectCenterY(gg_rct_Act2Start))
call GroupRemoveUnit(METEORITEGROUP,GetEnumUnit())
endfunction
function ResetBattleUnits takes nothing returns nothing
local timer t = GetExpiredTimer()
call ForGroup(METEORITEGROUP,function MeterGroupFullBack)
call DestroyTimer(t)
set t = null
endfunction
function ResetKingAfterFall takes nothing returns nothing
local timer t = GetExpiredTimer()
call PauseUnit(udg_KingOfStormwind,false)
call SetUnitAnimation(udg_KingOfStormwind,"stand")
call PlaySoundOnUnitBJ(gg_snd_WrynnStandUp,100.,udg_KingOfStormwind)
call DestroyTimer(t)
set t = null
endfunction
/*function C2_SummonBigGolem takes nothing returns nothing
local real x = GetRectCenterX(gg_rct_Act2Start)
local real y = GetRectCenterY(gg_rct_Act2Start)
local unit u = CreateUnit(Player(7),'n00O',GetRandomReal(x-300,x+300),GetRandomReal(y-300,y+300),0.)
call SetUnitAnimation(u,"birth")
call SaveReal(udg_hash,GetHandleId(u),2,10.)
call Aggro.new(u)
call IssuePointOrderLoc(u,"attack",udg_C_Spawns[8])
call TriggerRegisterUnitEvent(GOLEM_ABILITIES_TRG, u, EVENT_UNIT_DAMAGED )
set u = null
endfunction
*/
function GroupFilterKingAlly takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_KingOfStormwind)) and (GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_USER) and (GetWidgetLife(GetFilterUnit())>0.) and (not BlzIsUnitInvulnerable(GetFilterUnit()))
endfunction
function MeteorRainBegins takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local timer t2 = null
local timer t3 = null
local group g = null
local unit tempu = null
local real TIMEOUT = LoadReal(udg_hash,GetHandleId(t),1)
local real x = GetRandomReal( GetRectMinX(gg_rct_Meteor),GetRectMaxX(gg_rct_Meteor) )
local real y = GetRandomReal( GetRectMinY(gg_rct_Meteor),GetRectMaxY(gg_rct_Meteor) )
local integer i = 1
local real DURATION = 15.
if TURBO_MODE then
set DURATION = DURATION/TURBO_TIMER_FACTOR
endif
set TIMEOUT = TIMEOUT + 0.1
call SaveReal(udg_hash,GetHandleId(t),1,TIMEOUT)
call Meteor(x,y)
if TIMEOUT >= DURATION then
set IS_METEORITE_RAIN = false
call FlushChildHashtable(udg_hash,GetHandleId(t))
call RemoveUnit(LIGHTSHIELD)
call SetUnitAnimation(udg_KingOfStormwind,"death")
call SetUnitAnimation(C2_Alchemist,"stand")
call SetUnitAnimation(C2_Armorer,"stand")
call SetUnitAnimation(C2_Weaponer,"stand")
call SetUnitAnimation(C2_Inscriptor,"stand")
call UnitRemoveAbility(udg_KingOfStormwind,'A01T')
call DestroyTimer(t)
set t1 = CreateTimer()
set g = CreateGroup()
call GroupEnumUnitsInRange(g,GetUnitX(udg_KingOfStormwind),GetUnitY(udg_KingOfStormwind),1000.,function GroupFilterKingAlly)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call UnitShield.Add(tempu,udg_KingOfStormwind,1000,10.,-1,0.5,'A09Z','B03A')
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
if TURBO_MODE then
call TimerStart(t1,100./TURBO_TIMER_FACTOR,false,function ResetKingAfterFall)
else
call TimerStart(t1,100.,false,function ResetKingAfterFall)
endif
call ForGroup(METEORITEGROUP,function MeteorGroupBack)
set t2 = CreateTimer()
call TimerStart(t2,1.6,false,function ResetBattleUnits)
set t3 = CreateTimer()
if TURBO_MODE then
call TimerStart(t3, 10./TURBO_TIMER_FACTOR, false, function C2_SummonBigGolemIntro)
else
call TimerStart(t3, 10., false, function C2_SummonBigGolemIntro)
endif
set t1 = null
set t2 = null
set t3 = null
loop
exitwhen i>udg_PlayerCount
call CameraClearNoiseForPlayer(udg_Players[i])
set i = i + 1
endloop
endif
set t = null
endfunction
function HideMeteorGroup takes nothing returns nothing
call ShowUnit(GetEnumUnit(),false)
endfunction
function TURN_METEORRAIN takes nothing returns nothing
call DestroyTimer(GetExpiredTimer())
call TimerStart(CreateTimer(),0.1,true,function MeteorRainBegins)
endfunction
function MakeLIGHTSHIELDSCALE takes nothing returns nothing
local timer t = GetExpiredTimer()
//call SetUnitTimeScale(LIGHTSHIELD,0.)
call DestroyTimer(t)
call ForGroup(METEORITEGROUP,function HideMeteorGroup)
call TimerStart(CreateTimer(),5.,false,function TURN_METEORRAIN)
set t = null
endfunction
function MeteorRainPreload takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t2 = CreateTimer()
local integer k = GetRandomInt(1,4)
local integer i = 1
local real x = GetRectCenterX(gg_rct_Act2Start)
local real y = GetRectCenterY(gg_rct_Act2Start)
local boolexpr GROUPFILTER = Condition(function MeteorRainGroupFilter)
set udg_LeakPoint[1] = GetRectCenter(gg_rct_DivineShield1)
set udg_LeakPoint[2] = GetRectCenter(gg_rct_DivineShield2)
set udg_LeakPoint[3] = GetRectCenter(gg_rct_DivineShield3)
set udg_LeakPoint[4] = GetRectCenter(gg_rct_Act2Start)
call UnitAddAbility(udg_KingOfStormwind,'A01T')
call PlaySoundOnUnitBJ(gg_snd_WrynnDivineShield,100.,udg_KingOfStormwind)
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",udg_LeakPoint[k]))
call SetUnitPositionLoc(udg_KingOfStormwind,udg_LeakPoint[k])
set LIGHTSHIELD = CreateUnitAtLoc(Player(8),'h00Y',udg_LeakPoint[k],0.)
call PauseUnit(udg_KingOfStormwind,true)
call SetUnitAnimation(udg_KingOfStormwind,"stand channel")
call TimerStart(t2,0.9,false,function MakeLIGHTSHIELDSCALE)
call DestroyTimer(t)
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
call RemoveLocation(udg_LeakPoint[3])
call RemoveLocation(udg_LeakPoint[4])
set IS_METEORITE_RAIN = true
call SetUnitAnimation(C2_Alchemist,"stand channel")
call SetUnitAnimation(C2_Armorer,"stand ready")
call SetUnitAnimation(C2_Weaponer,"stand ready")
call SetUnitAnimation(C2_Inscriptor,"stand defend")
call UnitApplyTimedLife(CreateUnit(Player(8),'h01P',GetUnitX(C2_Alchemist),GetUnitY(C2_Alchemist),0. ),'BHwe',21.)
call UnitApplyTimedLife(CreateUnit(Player(8),'h01P',GetUnitX(C2_Armorer),GetUnitY(C2_Armorer),0. ),'BHwe',21.)
call UnitApplyTimedLife(CreateUnit(Player(8),'h01P',GetUnitX(C2_Weaponer),GetUnitY(C2_Weaponer),0. ),'BHwe',21.)
call UnitApplyTimedLife(CreateUnit(Player(8),'h01P',GetUnitX(C2_Inscriptor),GetUnitY(C2_Inscriptor),0. ),'BHwe',21.)
call GroupEnumUnitsInRange(udg_temp_group,x,y,3000,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call GroupAddUnit(METEORITEGROUP,udg_temp_unit)
call PauseUnit(udg_temp_unit,true)
call SetUnitAnimation(udg_temp_unit,"death")
call SetUnitInvulnerable(udg_temp_unit,true)
endloop
loop
exitwhen i>udg_PlayerCount
if TURBO_MODE then
call CameraSetEQNoiseForPlayer( udg_Players[i], 15./TURBO_TIMER_FACTOR )
else
call CameraSetEQNoiseForPlayer( udg_Players[i], 15. )
endif
set i = i + 1
endloop
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
set t = null
set t2 = null
endfunction
function Trig_Meteor_Rain_Actions takes nothing returns nothing
local timer t = CreateTimer()
call DisplayTextToForce(GetPlayersAll(),"A huge |c00804040wave of meteorites|r falls down from the sky.")
call TimerStart(t,2.5,false,function MeteorRainPreload)
set METEORCOUNT = METEORCOUNT + 1
call SetPlayerTechResearched(Player(7),'R005',METEORCOUNT+1)
if METEORCOUNT >= GOLEM_LIMIT-1 then
call DestroyTimer(udg_MeteorStrike_Timer)
call DestroyTimerDialog(udg_MeteorStrike_Window)
endif
//
set t = null
endfunction
//===========================================================================
function InitTrig_METEOR_RAIN takes nothing returns nothing
set gg_trg_METEOR_RAIN = CreateTrigger( )
call DisableTrigger( gg_trg_METEOR_RAIN )
call TriggerRegisterTimerExpireEventBJ( gg_trg_METEOR_RAIN, udg_MeteorStrike_Timer )
call TriggerAddAction( gg_trg_METEOR_RAIN, function Trig_Meteor_Rain_Actions )
endfunction
function Trig_TOP_Waves_C2_Actions takes nothing returns nothing
if WavesOpened[1] then
call C2WaveSpawn(udg_C_Spawns[5])
else
endif
if WavesOpened[4] then
call C2WaveSpawn(udg_C_Spawns[5])
else
endif
endfunction
//===========================================================================
function InitTrig_TOP_Waves_C2 takes nothing returns nothing
set gg_trg_TOP_Waves_C2 = CreateTrigger( )
call DisableTrigger( gg_trg_TOP_Waves_C2 )
call TriggerRegisterTimerExpireEventBJ( gg_trg_TOP_Waves_C2, udg_LeftTimer )
call TriggerAddAction( gg_trg_TOP_Waves_C2, function Trig_TOP_Waves_C2_Actions )
endfunction
function Trig_RIGHT_TOP_Waves_C2_Actions takes nothing returns nothing
if WavesOpened[2] then
call C2WaveSpawn(udg_C_Spawns[6])
else
endif
if WavesOpened[5] then
call C2WaveSpawn(udg_C_Spawns[6])
else
endif
endfunction
//===========================================================================
function InitTrig_RIGHT_TOP_Waves_C2 takes nothing returns nothing
set gg_trg_RIGHT_TOP_Waves_C2 = CreateTrigger( )
call DisableTrigger( gg_trg_RIGHT_TOP_Waves_C2 )
call TriggerRegisterTimerExpireEventBJ( gg_trg_RIGHT_TOP_Waves_C2, udg_MiddleTimer )
call TriggerAddAction( gg_trg_RIGHT_TOP_Waves_C2, function Trig_RIGHT_TOP_Waves_C2_Actions )
endfunction
function Trig_RIGHT_BOT_Waves_C2_Actions takes nothing returns nothing
if WavesOpened[3] then
call C2WaveSpawn(udg_C_Spawns[7])
else
endif
if WavesOpened[6] then
call C2WaveSpawn(udg_C_Spawns[7])
else
endif
endfunction
//===========================================================================
function InitTrig_RIGHT_BOT_Waves_C2 takes nothing returns nothing
set gg_trg_RIGHT_BOT_Waves_C2 = CreateTrigger( )
call DisableTrigger( gg_trg_RIGHT_BOT_Waves_C2 )
call TriggerRegisterTimerExpireEventBJ( gg_trg_RIGHT_BOT_Waves_C2, udg_RightTimer )
call TriggerAddAction( gg_trg_RIGHT_BOT_Waves_C2, function Trig_RIGHT_BOT_Waves_C2_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
trigger GOLEM_ABILITIES_TRG
endglobals
function GOLEM_ABILITIES_CONDS takes nothing returns boolean
return (GetWidgetLife(GetTriggerUnit()) - GetEventDamage()) <= GetUnitState(GetTriggerUnit(),UNIT_STATE_MAX_LIFE)*0.75 and not(GetUnitAbilityLevel(GetTriggerUnit(),'A01R') > 0)
endfunction
function HurlBoulder_Filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),Player(7)) and GetWidgetLife(GetFilterUnit())>0. and GetOwningPlayer(GetFilterUnit())!=Player(8)
endfunction
function Trig_Golem_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real dist = 0.
local real maxdist = 0.
local unit target = null
local boolexpr GROUPFILTER = Condition(function HurlBoulder_Filter)
call GroupEnumUnitsInRange(udg_temp_group,x,y,750.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
set dist = SquareRoot( (x-GetUnitX(udg_temp_unit))*(x-GetUnitX(udg_temp_unit))+(y-GetUnitY(udg_temp_unit))*(y-GetUnitY(udg_temp_unit)) )
if dist > maxdist and dist > 150. then
set maxdist = dist
set target = udg_temp_unit
endif
endloop
if target != null then
call UnitAddAbility(u,'A01R')
call IssueTargetOrder(u,"creepthunderbolt",target)
endif
call DestroyBoolExpr(GROUPFILTER)
set u = null
set target = null
set GROUPFILTER = null
endfunction
//===========================================================================
function InitTrig_Rock_Golem takes nothing returns nothing
set GOLEM_ABILITIES_TRG = CreateTrigger()
call TriggerAddCondition(GOLEM_ABILITIES_TRG,Condition(function GOLEM_ABILITIES_CONDS))
call TriggerAddAction( GOLEM_ABILITIES_TRG, function Trig_Golem_Actions )
call DisableTrigger(GOLEM_ABILITIES_TRG)
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
globals
trigger MUDGOLEM_ABILITIES_TRG
group MUD_GOLEMS_GROUP = CreateGroup()
endglobals
function MUDGOLEM_ABILITIES_CONDS takes nothing returns boolean
return (GetWidgetLife(GetTriggerUnit()) - GetEventDamage() ) <= GetUnitState(GetTriggerUnit(),UNIT_STATE_MAX_LIFE)*0.50 and not IsUnitInGroup(GetTriggerUnit(),MUD_GOLEMS_GROUP)
endfunction
function Trig_Mud_Golem_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call DisableTrigger(GetTriggeringTrigger())
call GroupAddUnit(MUD_GOLEMS_GROUP,u)
if CURRENT_DIFFICULTY >=3 then
if GetUnitTypeId(u) == GOLEMS[1] then
call UnitAddAbility(GetTriggerUnit(),'A01S')
call SetUnitVertexColor(GetTriggerUnit(),150,100,255,255)
elseif GetUnitTypeId(u) == GOLEMS[2] then
call UnitAddAbility(u,'A03B')
elseif GetUnitTypeId(u) == GOLEMS[3] then
call AddHeroParameter(u,0.5,30.,7,"Abilities\\Spells\\Undead\\AbsorbMana\\AbsorbManaBirthMissile.mdl","weapon")
elseif GetUnitTypeId(u) == GOLEMS[4] then
call AddHeroParameter(u,10.,30.,2,"Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl","weapon")
elseif GetUnitTypeId(u) == GOLEMS[5] then
call AddHeroParameter(u,10.,30.,1,"Abilities\\Spells\\Items\\OrbVenom\\OrbVenomMissile.mdl","weapon")
endif
endif
call EnableTrigger(GetTriggeringTrigger())
set u = null
endfunction
//===========================================================================
function InitTrig_Mud_Golem takes nothing returns nothing
set MUDGOLEM_ABILITIES_TRG = CreateTrigger()
call TriggerAddAction( MUDGOLEM_ABILITIES_TRG, function Trig_Mud_Golem_Actions )
call TriggerAddCondition(MUDGOLEM_ABILITIES_TRG,Condition(function MUDGOLEM_ABILITIES_CONDS))
call DisableTrigger(MUDGOLEM_ABILITIES_TRG)
endfunction
//TESH.scrollpos=22
//TESH.alwaysfold=0
scope GOLEMGUARDIAN initializer onInit
globals
unit GolemAbsorber = null
private real PHYS_MAG_ABS = 500.
private constant real PHYS_MAG_ABS_DURATION = 15.
private constant real PHYS_MAG_ABS_MULT = 0.5
private constant integer PHYS_MAG_ABS_AURACODE = 'A073'
private constant integer PHYS_MAG_ABS_BUFFCODE = 'B024'
private real SpellPOWER = 50.
private real Splash = 0.10
private real Crit = 3.
private real SpellResist = 0.05
private constant real SIZE_CHANGE_BASE = 0.4
private constant real MOVESPEED_CHANGE_BASE = 0.3
private constant integer ABSORB_SLOW_CODE = 'A06T'
private constant integer ABILCODE = 'A03O'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GolemAbsorbGroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GolemAbsorber)) and (not IsUnitPaused(GetFilterUnit())) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function ChoppedGolemCreate takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer j = LoadInteger(udg_hash,GetHandleId(t),2)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
set udg_temp_unit = CreateUnit(Player(7),GOLEMS[j],x,y,GetRandomReal(1.,360.))
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),2,10.)
call Aggro.new(udg_temp_unit)
call SetUnitAnimation(udg_temp_unit,"birth")
call IssuePointOrderLoc(udg_temp_unit,"attack",udg_C_Spawns[8])
call TriggerRegisterUnitEvent( MUDGOLEM_ABILITIES_TRG, udg_temp_unit, EVENT_UNIT_DAMAGED )
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function FelAbyssCreate takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local unit v = CreateUnit(Player(7),'h01T',x,y,0.)
call GroupAddUnit(DPS_GROUP,v)
call FlushChildHashtable(udg_hash,GetHandleId(v))
call SaveReal(udg_hash,GetHandleId(v),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(t),2))
call UnitApplyTimedLife(v,'BHwe',30.)
call DestroyTimer(t)
set t = null
set u = null
set v = null
endfunction
private function ManaExplGroupFilter takes nothing returns boolean
return (IsUnitEnemy(GetFilterUnit(), Player(7))) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0) and ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction
private function PureManaExplosion takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real SPower = LoadReal(udg_hash,GetHandleId(t),2)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local group g = CreateGroup()
local unit tempu = CreateUnit(Player(7),'h01W',x,y,0.)
call SetUnitTimeScale(tempu,0.5)
call UnitApplyTimedLife(tempu,'BHwe',0.1)
call GroupAddUnit(DPS_GROUP,u)
call SaveReal(udg_hash,GetHandleId(u),5,SPower)
call GroupEnumUnitsInRange(g,x,y,250.,Condition(function ManaExplGroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call UnitDamageTarget(u,tempu,300,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
call RegenerateMana(tempu,-200.)
call GroupRemoveUnit(g,tempu)
endloop
set t = null
set u = null
set g = null
set tempu = null
endfunction
private function FireNovaCreate takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real SPower = LoadReal(udg_hash,GetHandleId(u),6)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local unit tempu = null
local group g = CreateGroup()
call GroupEnumUnitsInRange(g,x,y,700.,Condition(function ManaExplGroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DOT(u,tempu,100 + SPower*0.25,3.,1.,1,"Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl","chest",true)
call GroupRemoveUnit(g,tempu)
endloop
set t = null
set u = null
set g = null
set tempu = null
endfunction
private function DevilNovaActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local real SPower = LoadReal(udg_hash,GetHandleId(t),1)
local unit fire = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit devil = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local real x = GetUnitX(devil)
local real y = GetUnitY(devil)
local unit explode = CreateUnit(Player(7),'h025',x,y,0.)
local integer times = LoadInteger(udg_hash,GetHandleId(t),4)
local unit tempu = null
local group g = CreateGroup()
call SetUnitScale(fire,0.7+0.7*I2R(times),0.7+0.7*I2R(times),0.7+0.7*I2R(times))
call SetUnitScale(devil,1.5+1.5*I2R(times),1.5+1.5*I2R(times),1.5+1.5*I2R(times))
call SetUnitScale(explode, 1.+1.*I2R(times),1.+1.*I2R(times),1.+1.*I2R(times))
call KillUnit(explode)
//call SetUnitX(fire,GetUnitX(fire)+25.*I2R(times))
call GroupEnumUnitsInRange(g,x,y,150. + 100.* I2R(times),Condition(function ManaExplGroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call UnitDamageTarget(devil,tempu,300+SPower,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl",tempu,"overhead"))
call GroupRemoveUnit(g,tempu)
endloop
set times = times + 1
if times >=5 then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call RemoveUnit(fire)
call KillUnit(devil)
else
call SaveInteger(udg_hash,GetHandleId(t),4,times)
endif
call DestroyGroup(g)
set t = null
set fire = null
set devil = null
set explode = null
set g = null
endfunction
private function DevilNovaCreate takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real SPower = LoadReal(udg_hash,GetHandleId(t),2)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local unit fire = CreateUnit(Player(7),'h023',x,y,0.)
local unit devil = CreateUnit(Player(7),'h024',x,y,-90.)
call SaveReal(udg_hash,GetHandleId(t1),1,SPower)
call SaveUnitHandle(udg_hash,GetHandleId(t1),2,fire)
call SaveUnitHandle(udg_hash,GetHandleId(t1),3,devil)
call SaveInteger(udg_hash,GetHandleId(t1),4,0)
call TimerStart(t1,3.,true,function DevilNovaActs)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set t1 = null
set u = null
set fire = null
set devil = null
endfunction
private function BouncingBoulderOnTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit boulder = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real SPower = LoadReal(udg_hash,GetHandleId(t),2)
local integer times = LoadInteger(udg_hash,GetHandleId(t),3)
local real nextBounceTime = 0.
local real angle = 0.
set times = times + 1
call SaveInteger(udg_hash,GetHandleId(t),3,times)
call SetUnitScale(boulder,1.8-0.1*I2R(times),1.8-0.1*I2R(times),1.8-0.1*I2R(times))
set udg_temp_unit = CreateUnit(Player(7),'h027',GetUnitX(boulder),GetUnitY(boulder),0.)
call SetUnitScale(udg_temp_unit,1.1-0.1*I2R(times),1.1-0.1*I2R(times),1.1-0.1*I2R(times))
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),5,SPower)
call GroupAddUnit(DPS_GROUP,udg_temp_unit)
call UnitAddAbility(udg_temp_unit,'A03J')
call SetUnitAbilityLevel(udg_temp_unit,'A03J',times)
call IssueImmediateOrder(udg_temp_unit,"creepthunderclap")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',0.5)
if times >=6 then
call KillUnit(boulder)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
set nextBounceTime = GetRandomReal(1.,1.5)
set angle = GetRandomReal(0.,360.)
call SetUnitFacing(boulder,angle)
call ParKnock(boulder,GetRandomReal(250.,300.),GetRandomReal(150.,250.),nextBounceTime,angle,false,"")
call TimerStart(t,nextBounceTime,false,function BouncingBoulderOnTimer)
endif
set t = null
set boulder = null
endfunction
private function ChopOffAbsorbedGolem takes unit CASTER, integer j returns nothing
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local timer t = CreateTimer()
local timer t1 = CreateTimer()
local real angle = GetRandomReal(1.,360.)
local integer G_PLAYERS = LoadInteger(udg_hash,GetHandleId(CASTER),210)
local real coin = GetRandomInt(1,100)
local boolean PROC = (coin <= 113-13*G_PLAYERS)
set udg_temp_unit = CreateUnit(Player(7),'h01S',x,y,angle)
call ParKnock(udg_temp_unit,GetRandomReal(150.,300.)*(1+0.1*I2R(LoadInteger(udg_hash,GetHandleId(CASTER),200))),GetRandomReal(250.,450.),0.75,angle,false,"")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',0.75)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,udg_temp_unit)
call SaveInteger(udg_hash,GetHandleId(t),2,j)
call TimerStart(t,0.75,false,function ChoppedGolemCreate)
/////Effects depending on chopped golem type
//Mudstone Bouncing Boulder
if j==1 and PROC then
set udg_temp_unit = CreateUnit(Player(7),'h026',x,y,0.)
call SetUnitTimeScale(udg_temp_unit,1.5)
call ParKnock(udg_temp_unit,GetRandomReal(150.,300.)*(1+0.1*I2R(LoadInteger(udg_hash,GetHandleId(CASTER),200))),GetRandomReal(150.,250.),2.5,angle,false,"")
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,udg_temp_unit)
call SaveReal(udg_hash,GetHandleId(t1),2,LoadReal(udg_hash,GetHandleId(CASTER),5))
call SaveInteger(udg_hash,GetHandleId(t1),3,0)
call TimerStart(t1,2.5,false,function BouncingBoulderOnTimer)
endif
//Lavastone Firenova
if j==2 and PROC then
//set udg_temp_unit = CreateUnit(Player(7),'h020',x,y,0.)
//call SetUnitTimeScale(udg_temp_unit,0.33)
//call SetUnitAnimation(udg_temp_unit,"death")
//call UnitApplyTimedLife(udg_temp_unit,'BHwe',1.)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdl",CASTER,"origin"))
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,CASTER)
call TimerStart(t1,0.0,false,function FireNovaCreate)
endif
//Purestone ManaExplosion
if j==3 and PROC then
set udg_temp_unit = CreateUnit(Player(7),'h01V',x,y,0.)
call ParKnock(udg_temp_unit,GetRandomReal(150.,300.)*(1+0.1*I2R(LoadInteger(udg_hash,GetHandleId(CASTER),200))),GetRandomReal(250.,450.),1.5,angle,false,"")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',1.5)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,udg_temp_unit)
call SaveReal(udg_hash,GetHandleId(t1),2,LoadReal(udg_hash,GetHandleId(CASTER),5))
call TimerStart(t1,1.5,false,function PureManaExplosion)
endif
//Firestone FireDevil
if j==4 and PROC then
set udg_temp_unit = CreateUnit(Player(7),'h022',x,y,0.)
call ParKnock(udg_temp_unit,GetRandomReal(150.,300.)*(1+0.1*I2R(LoadInteger(udg_hash,GetHandleId(CASTER),200))),GetRandomReal(250.,550.),2.5,angle,false,"")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',2.5)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,udg_temp_unit)
call SaveReal(udg_hash,GetHandleId(t1),2,LoadReal(udg_hash,GetHandleId(CASTER),5))
call TimerStart(t1,2.5,false,function DevilNovaCreate)
endif
//Fellstone AcydVortex
if j==5 and PROC then
set udg_temp_unit = CreateUnit(Player(7),'h01U',x,y,0.)
call ParKnock(udg_temp_unit,GetRandomReal(150.,300.)*(1+0.1*I2R(LoadInteger(udg_hash,GetHandleId(CASTER),200))),GetRandomReal(350.,800.),2.,angle,false,"")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',2.)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,udg_temp_unit)
call SaveReal(udg_hash,GetHandleId(t1),2,LoadReal(udg_hash,GetHandleId(CASTER),5))
call TimerStart(t1,2.,false,function FelAbyssCreate)
endif
//////////
set t = null
set t1 = null
endfunction
private function GolemAbsorb_HPChecking takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer count = LoadInteger(udg_hash,GetHandleId(CASTER),200)
local integer count_SPEC = 0
local integer j = 0
local real r = 0.
local real ReleasePercent = LoadReal(udg_hash,GetHandleId(CASTER),207)
local real PercentHP = (GetWidgetLife(CASTER)/GetUnitState(CASTER,UNIT_STATE_MAX_LIFE))*100
local integer G_PLAYERS = LoadInteger(udg_hash,GetHandleId(CASTER),210)
if (I2R(count)*ReleasePercent >= PercentHP+ReleasePercent/2) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Hp " + R2S(PercentHP) + " is too low for " + I2S(count) + " golems" )
//Finding a random type of golem to release
set j = GetRandomInt(1,5)
loop
exitwhen LoadInteger(udg_hash,GetHandleId(CASTER),200+j)>0
set j = GetRandomInt(1,5)
endloop
//call SetUnitMoveSpeed(CASTER,GetUnitMoveSpeed(CASTER)+MOVESPEED_CHANGE_BASE/G_PLAYERS )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Found golem with number: " + I2S(j) + ". Releasing.")
set count = count - 1
set count_SPEC = LoadInteger(udg_hash,GetHandleId(CASTER),200+j) - 1
call SaveInteger(udg_hash,GetHandleId(CASTER),200,count)
call SaveInteger(udg_hash,GetHandleId(CASTER),200+j,count_SPEC)
call SetUnitAbilityLevel(CASTER,ABSORB_SLOW_CODE, R2I( (11*count)/4*G_PLAYERS ) )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Golems[j]: " + I2S(LoadInteger(udg_hash,GetHandleId(CASTER),100+j))+ ". All golems: " + I2S(count))
call ChopOffAbsorbedGolem(CASTER,j)
call SetUnitScale(CASTER,1.+(SIZE_CHANGE_BASE/G_PLAYERS)*I2R(count),1.+(SIZE_CHANGE_BASE/G_PLAYERS)*I2R(count),1.+(SIZE_CHANGE_BASE/G_PLAYERS)*I2R(count))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",CASTER,"chest"))
if j == 1 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Mudstone golem released. Remained golems: " + I2S(count))
endif
if j == 2 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Lavastone golem released. Remained golems: " + I2S(count))
call SaveReal(udg_hash,GetHandleId(CASTER),7,LoadReal(udg_hash,GetHandleId(CASTER),7)-Splash)
endif
if j == 3 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Purestone golem released. Remained golems: " + I2S(count))
set r = LoadReal(udg_hash,GetHandleId(CASTER),5)
call SaveReal(udg_hash,GetHandleId(CASTER),5,r-SpellPOWER)
endif
if j == 4 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Firestone golem released. Remained golems: " + I2S(count))
call SaveReal(udg_hash,GetHandleId(CASTER),2,LoadReal(udg_hash,GetHandleId(CASTER),2)-Crit)
endif
if j == 5 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Felstone golem released. Remained golems: " + I2S(count))
call SaveReal(udg_hash,GetHandleId(CASTER),16,LoadReal(udg_hash,GetHandleId(CASTER),16)-SpellResist)
endif
endif
if (not (GetWidgetLife(CASTER)>0.)) and (count == 0) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Guardian is dead, no golems absorbed")
call FlushChildHashtable(udg_hash,GetHandleId(t))
call RemoveSavedHandle(udg_hash,GetHandleId(CASTER),206)
call DestroyTimer(t)
endif
set t = null
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit GOLEM = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local integer j = 0
local integer count = 0
local integer count_SPEC = 0
local real x1 = GetUnitX(CASTER)
local real y1 = GetUnitY(CASTER)
local real x2 = GetUnitX(GOLEM)
local real y2 = GetUnitY(GOLEM)
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local real angle = Atan2(y2-y1,x2-x1)
local real XSpeed = -12.*Cos(angle)
local real YSpeed = -12.*Sin(angle)
local real REGENERATE = 0.
local integer G_PLAYERS = LoadInteger(udg_hash,GetHandleId(CASTER),210)
if dist < 100. then
if GetUnitState(GOLEM,UNIT_STATE_LIFE)>0. then
if GetUnitState(CASTER,UNIT_STATE_LIFE)>0. then
call SaveInteger(udg_hash,GetHandleId(CASTER),211,LoadInteger(udg_hash,GetHandleId(CASTER),211)+1)
set count = LoadInteger(udg_hash,GetHandleId(CASTER),200)
set count = count + 1
set j = LoadInteger(udg_hash,GetHandleId(t),3)
set count_SPEC = LoadInteger(udg_hash,GetHandleId(CASTER),200+j)
if LoadBoolean(udg_hash,GetHandleId(CASTER),208) and count >= 3*G_PLAYERS then
call SaveReal(udg_hash,GetHandleId(CASTER),16,LoadReal(udg_hash,GetHandleId(CASTER),16)- 1.)
call SaveReal(udg_hash,GetHandleId(CASTER),22,LoadReal(udg_hash,GetHandleId(CASTER),22)-1.)
call SaveReal(udg_hash,GetHandleId(CASTER),7,LoadReal(udg_hash,GetHandleId(CASTER),7)-1.)
call SaveReal(udg_hash,GetHandleId(CASTER),10,LoadReal(udg_hash,GetHandleId(CASTER),10)-3*CURRENT_DIFFICULTY/5.)
call SaveBoolean(udg_hash,GetHandleId(CASTER),208,false)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(CASTER),209))
call UnitAddAbility(CASTER,ABSORB_SLOW_CODE)
call SetUnitAbilityLevel(CASTER,ABSORB_SLOW_CODE, R2I( (11*count)/4*G_PLAYERS ) )
endif
set count_SPEC = count_SPEC+1
call SaveInteger(udg_hash,GetHandleId(CASTER),200,count)
call SaveInteger(udg_hash,GetHandleId(CASTER),200+j,count_SPEC)
//RegenerateLife and set Scale, Speed
set REGENERATE = GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)*( (0.1*CURRENT_DIFFICULTY)/(2*G_PLAYERS) )
call UnitDamageTarget(CASTER,CASTER,-1*REGENERATE,false,false,ATTACK_TYPE_NORMAL,null,null)
call SetUnitScale(CASTER,1.+(SIZE_CHANGE_BASE/G_PLAYERS)*I2R(count),1.+(SIZE_CHANGE_BASE/G_PLAYERS)*I2R(count),1.+(SIZE_CHANGE_BASE/G_PLAYERS)*I2R(count))
//call SetUnitMoveSpeed(CASTER,GetUnitMoveSpeed(CASTER)-MOVESPEED_CHANGE_BASE/G_PLAYERS)
//Recalculating <percentHP to release> for each absorbed golem
call SaveReal(udg_hash,GetHandleId(CASTER),207,(GetWidgetLife(CASTER)*100)/(GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)*I2R(count)))
//
call RemoveUnit(GOLEM)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",CASTER,"chest"))
if not HaveSavedHandle(udg_hash,GetHandleId(CASTER),206) then
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,CASTER)
call SaveTimerHandle(udg_hash,GetHandleId(CASTER),206,t1)
call TimerStart(t1,0.04,true,function GolemAbsorb_HPChecking)
endif
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Absorbed golem with number: " + I2S(j) + ". Number of absorbed golems: " + I2S(count))
if j == 1 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A " + I2S(count_SPEC) + " Mudstone golem absorbed")
call UnitShield.Add(CASTER,CASTER,PHYS_MAG_ABS,PHYS_MAG_ABS_DURATION,-1,PHYS_MAG_ABS_MULT,PHYS_MAG_ABS_AURACODE,PHYS_MAG_ABS_BUFFCODE)
endif
if j == 2 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A " + I2S(count_SPEC) + " Lavastone golem absorbed")
call SaveReal(udg_hash,GetHandleId(CASTER),7,LoadReal(udg_hash,GetHandleId(CASTER),7)+Splash)
endif
if j == 3 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A " + I2S(count_SPEC) + " Purestone golem absorbed")
call SaveReal(udg_hash,GetHandleId(CASTER),5,LoadReal(udg_hash,GetHandleId(CASTER),5)+SpellPOWER)
endif
if j == 4 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A " + I2S(count_SPEC) + " Firestone golem absorbed")
call SaveReal(udg_hash,GetHandleId(CASTER),2,LoadReal(udg_hash,GetHandleId(CASTER),2)+Crit)
endif
if j == 5 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A " + I2S(count_SPEC) + " Felstone golem absorbed")
call SaveReal(udg_hash,GetHandleId(CASTER),16,LoadReal(udg_hash,GetHandleId(CASTER),16)+SpellResist)
endif
else
call PauseUnit(GOLEM,false)
call SetUnitAnimation(GOLEM,"stand")
endif
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"A " + I2S(count) + " golem absorbed")
else
call SetUnitX(GOLEM,x2+XSpeed)
call SetUnitY(GOLEM,y2+YSpeed)
endif
set t = null
set t1 = null
set CASTER = null
set GOLEM = null
endfunction
private function ResetCooldownIfLowGolems takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer count = LoadInteger(udg_hash,GetHandleId(CASTER),211)
local integer G_PLAYERS = LoadInteger(udg_hash,GetHandleId(CASTER),210)
if LoadBoolean(udg_hash,GetHandleId(CASTER),208) then
call BlzEndUnitAbilityCooldown(CASTER,ABILCODE)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local group g = CreateGroup()
local timer t = null
local integer j = 1
local integer count = 0
local unit TEMPUNIT = null
local integer curCount = 0
local integer G_PLAYERS = LoadInteger(udg_hash,GetHandleId(CASTER),210)
local timer t1 = CreateTimer()
set GolemAbsorber = CASTER
//Set number of absorbed golems from last cast to 0
call SaveInteger(udg_hash,GetHandleId(CASTER),211,0)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,CASTER)
if TURBO_MODE then
call TimerStart(t1,10./TURBO_TIMER_FACTOR,false,function ResetCooldownIfLowGolems)
else
call TimerStart(t1,10.,false,function ResetCooldownIfLowGolems)
endif
set t1 = null
//Put bonuses depending on the chosed Difficulty
set PHYS_MAG_ABS = PHYS_MAG_ABS * (0.2*CURRENT_DIFFICULTY)
set SpellPOWER = SpellPOWER * (0.2*CURRENT_DIFFICULTY)
set Splash = Splash * (0.2*CURRENT_DIFFICULTY)
set Crit = Crit * (0.2*CURRENT_DIFFICULTY)
set SpellResist = SpellResist * (0.2*CURRENT_DIFFICULTY)
if not HaveSavedInteger(udg_hash,GetHandleId(CASTER),200) then
call SaveInteger(udg_hash,GetHandleId(CASTER),200,0)
else
set count = LoadInteger(udg_hash,GetHandleId(CASTER),200)
endif
if not HaveSavedInteger(udg_hash,GetHandleId(CASTER),201) then
call SaveInteger(udg_hash,GetHandleId(CASTER),201,0)
endif
if not HaveSavedInteger(udg_hash,GetHandleId(CASTER),202) then
call SaveInteger(udg_hash,GetHandleId(CASTER),202,0)
endif
if not HaveSavedInteger(udg_hash,GetHandleId(CASTER),203) then
call SaveInteger(udg_hash,GetHandleId(CASTER),203,0)
endif
if not HaveSavedInteger(udg_hash,GetHandleId(CASTER),204) then
call SaveInteger(udg_hash,GetHandleId(CASTER),204,0)
endif
if not HaveSavedInteger(udg_hash,GetHandleId(CASTER),205) then
call SaveInteger(udg_hash,GetHandleId(CASTER),205,0)
endif
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),1000.,Condition(function GolemAbsorbGroupFilter))
loop
set TEMPUNIT = FirstOfGroup(g)
exitwhen TEMPUNIT == null or count >= 4*G_PLAYERS or curCount >= 2*G_PLAYERS
set j = 1
loop
exitwhen j > 5
if GetUnitTypeId(TEMPUNIT)==GOLEMS[j] then
set t = CreateTimer()
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Found a golem to absorb")
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,TEMPUNIT)
call SaveInteger(udg_hash,GetHandleId(t),3,j)
call PauseUnit(TEMPUNIT,true)
call SetUnitAnimation(TEMPUNIT,"death")
call TimerStart(t,0.04,true,function onTimer)
set count = count + 1
set curCount = curCount + 1
endif
set j = j + 1
set t = null
endloop
call GroupRemoveUnit(g,TEMPUNIT)
set TEMPUNIT = null
endloop
call DestroyGroup(g)
set CASTER = null
set g = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope Chapter3StonecoreTeleport initializer onInit
globals
private boolean CINEMATIC_ACTIVATED = false
boolean ELVES_TELEPORT_CINEMATIC_STARTED = false
endglobals
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return not (CINEMATIC_ACTIVATED)
endif
set i = i + 1
endloop
return false
endfunction
private function onTimerTeleport takes nothing returns nothing
local integer i = 1
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 6.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
loop
exitwhen i > udg_PlayerCount
if IsUnitDeadBX(udg_Heroes[i]) then
call ReviveHero(udg_Heroes[i],GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect),false)
endif
//set CHAPTER3_ACTIVATED = true
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_ElvesStart),GetRectCenterY(gg_rct_ElvesStart))
set i = i + 1
endloop
set ELVES_TELEPORT_CINEMATIC_STARTED = false
endfunction
private function onEnter takes nothing returns nothing
set CINEMATIC_ACTIVATED = true
set ELVES_TELEPORT_CINEMATIC_STARTED = true
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 6.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call TimerStart(CreateTimer(),6.,false,function onTimerTeleport)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_StonecoreProceedChapter3 )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endscope
scope Chapter3StartPreload initializer onInit
globals
private boolean CHAPTER3_PRELOADED = false
private integer array CHAPTER3_UNITS_PRELOAD
private integer MAX_N = 16
endglobals
private function onEnter takes nothing returns nothing
local integer i = 1
set CHAPTER3_PRELOADED = true
loop
exitwhen i>MAX_N
call AddUnitToPreloadQueueById(CHAPTER3_UNITS_PRELOAD[i])
set i = i + 1
endloop
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"Chapter III resources are added to the preload queue (required time: " + I2S(R2I(MAX_N*PRELOAD_TIMER_PERIOD)) + " seconds). Players may suffer freezes for a duration.")
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerUnit()==udg_Heroes[i] then
return not CHAPTER3_PRELOADED
endif
set i = i + 1
endloop
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_Act3BOUNDS )
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction( t, function onEnter )
set CHAPTER3_UNITS_PRELOAD[1] = 'n00P' //Arsonist
set CHAPTER3_UNITS_PRELOAD[2] = 'n00Q' //Death Bringer
set CHAPTER3_UNITS_PRELOAD[3] = 'n00R' //Abyss Walker
set CHAPTER3_UNITS_PRELOAD[4] = 'n00T' //Hellfire Desolator (Pit Lord)
set CHAPTER3_UNITS_PRELOAD[5] = 'h02W' //Burn Tree Fire Blow (Walker)
set CHAPTER3_UNITS_PRELOAD[6] = 'h02V' //Burn Tree Before Fire (Walker)
set CHAPTER3_UNITS_PRELOAD[7] = 'h02U' //Burn Tree Fire (Faceless)
set CHAPTER3_UNITS_PRELOAD[8] = 'h02X' //Burn Tree Fire (Arsonist)
set CHAPTER3_UNITS_PRELOAD[9] = 'h036' //Fel Fire (Pit Lord)
set CHAPTER3_UNITS_PRELOAD[10] = 'h02Y' //Tree Fire
set CHAPTER3_UNITS_PRELOAD[11] = 'h02S' //Portal Orb Red
set CHAPTER3_UNITS_PRELOAD[12] = 'h033' //Portal Orb Green
set CHAPTER3_UNITS_PRELOAD[13] = 'h037' //Portal Orb Eredar
set CHAPTER3_UNITS_PRELOAD[14] = 'N00S' //Azgalor (Pit Lord 1)
set CHAPTER3_UNITS_PRELOAD[15] = 'N00V' //Magtheridon (Pit Lord 2)
set CHAPTER3_UNITS_PRELOAD[16] = 'N00U' //Mannoroth (Pit Lord 3)
set MAX_N = 16
set t = null
endfunction
endscope
scope Chapter3EnterLocation initializer onInit
globals
private unit C3_JEWELER = null
endglobals
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return not (LoadInteger(udg_hash,GetHandleId(GetTriggerUnit()),CHAPTER_HERO_HASH)==3)
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
call SaveInteger(udg_hash,GetHandleId(GetTriggerUnit()),CHAPTER_HERO_HASH,3)
call DisplayTimedTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,15.,"Chapter 3: |cff80ff80Darnassus|r.")
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
call SetWaterBaseColor(50,150,250,155)
endif
if C3_JEWELER == null then
set C3_JEWELER = CreateUnit(KOBOLDS,'h048',GetRectCenterX(gg_rct_C3KoboldApperance),GetRectCenterY(gg_rct_C3KoboldApperance),135.)
//call TimerStart(C2_JEWELER_TIMER,0.5,true,null)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_Act3BOUNDS )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endscope
library Chapter3Init initializer onInit
globals
unit CENARIUS = null
private constant real LorenzStep = 0.005
private constant real sigma = 10.
private constant real beta = 8./3.
private constant real rho = 28.
private constant real LAMBDA = 15.
private constant real PI1 = 3.141592
private constant real angleFirst = PI1/3.
private constant real angleSec = 2*PI1 - PI1/3.
hashtable C3_hash = InitHashtable()
endglobals
function GetRotatedX takes real x, real y, real angle returns real
return x * Cos(angle)-y*Sin(angle)
endfunction
function GetRotatedY takes real x, real y, real angle returns real
return x * Sin(angle)+y*Cos(angle)
endfunction
private function LorenzNextX takes real x, real y, real z returns real
return LorenzStep*sigma*(y-x)
endfunction
private function LorenzNextY takes real x, real y, real z returns real
return LorenzStep*( x*(rho-z) - y )
endfunction
private function LorenzNextZ takes real x, real y, real z returns real
return LorenzStep*( x*y - beta * z )
endfunction
function LorenzGetNextX takes real centX, real centY, real centZ, real x, real y, real z returns real
local real xnew = GetRotatedX((x-centX)/LAMBDA,(y-centY)/LAMBDA,angleFirst)
local real ynew = GetRotatedY((x-centX)/LAMBDA,(y-centY)/LAMBDA,angleFirst)
local real znew = (z-centZ)/LAMBDA
local real xnext = LAMBDA*(xnew + LorenzNextX(xnew,ynew,znew))
local real ynext = LAMBDA*(ynew + LorenzNextY(xnew,ynew,znew))
local real znext = LAMBDA*(znew + LorenzNextZ(xnew,ynew,znew))
return GetRotatedX(xnext, ynext, angleSec) + centX
endfunction
function LorenzGetNextY takes real centX, real centY, real centZ, real x, real y, real z returns real
local real xnew = GetRotatedX((x-centX)/LAMBDA,(y-centY)/LAMBDA,angleFirst)
local real ynew = GetRotatedY((x-centX)/LAMBDA,(y-centY)/LAMBDA,angleFirst)
local real znew = (z-centZ)/LAMBDA
local real xnext = LAMBDA*(xnew + LorenzNextX(xnew,ynew,znew))
local real ynext = LAMBDA*(ynew + LorenzNextY(xnew,ynew,znew))
local real znext = LAMBDA*(znew + LorenzNextZ(xnew,ynew,znew))
return GetRotatedY(xnext, ynext, angleSec) + centY
endfunction
function LorenzGetNextZ takes real centX, real centY, real centZ, real x, real y, real z returns real
local real xnew = GetRotatedX((x-centX)/LAMBDA,(y-centY)/LAMBDA,angleFirst)
local real ynew = GetRotatedY((x-centX)/LAMBDA,(y-centY)/LAMBDA,angleFirst)
local real znew = (z-centZ)/LAMBDA
local real xnext = LAMBDA*(xnew + LorenzNextX(xnew,ynew,znew))
local real ynext = LAMBDA*(ynew + LorenzNextY(xnew,ynew,znew))
local real znext = LAMBDA*(znew + LorenzNextZ(xnew,ynew,znew))
return znext + centZ
endfunction
private function onInit takes nothing returns nothing
endfunction
endlibrary
library Chapter3Start initializer onInit requires Chapter3Waves
globals
private boolean CHAPTER_INITIALIZED = false
boolean CHAPTER_3_STARTED = false
timer PORTAL_TIMER = CreateTimer()
timer MOONWELL_TIMER = CreateTimer()
timer C3SPECIAL_WAVES_TIMER = CreateTimer()
timerdialog C3SPECIAL_WAVES_DIALOG = null
private constant integer ABIL_BUFF = 'A063'
private constant integer BUFF_CODE = 'B01N'
private constant integer WATER_CODE = 'h032'
private constant real MOONWELL_MANA = 50.
private constant real MOONWELL_BUFF_MANA_THRESHOLD = 50.
private constant real MOONWELL_AOE_CHECK = 400.
private constant real TREE_AOE_CHECK = 900.
private constant real WATER_FIRE_DURATION_REMOVE = 180.
private constant real SPECIAL_WAVES_PERIOD = 250.
private constant real SPECIAL_WAVE_TIMEOUT = 60.
private constant real WATER_BUFF_DURATION = 30.
private constant integer WATER_TIMER_HASH = 1
integer SPECIAL_WAVES_COUNT = 0
integer SPECIAL_WAVES_MAX_COUNT = 3
private constant real WATER_FLOW_TIME = 3.
private constant group WATER_CARRIERS = CreateGroup()
//A Group For Dummies, which are removed if they deal damage to unit with BUFF_CODE
group WATER_CLEANSING_DUMMIES = CreateGroup()
private constant string TALK1 = "You are almost late! We barely survived the last attack and lost all the forces. The four elder trees are still keeping this place alive. You must protect them. I will redirect the powers of this well to help you extinguish fires. Demons are coming. Prepare for the battle!"
endglobals
function IsUnitCarriesWater takes unit whichUnit returns boolean
return GetUnitAbilityLevel(whichUnit,BUFF_CODE)>0
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return not CHAPTER_INITIALIZED
endif
set i = i + 1
endloop
return false
endfunction
private function MoonWellRegenMana takes nothing returns nothing
local integer k = GetMostDamageTree()
if not ALL_COMMANDERS_DEAD then
call SetUnitAnimation(CENARIUS,"Stand Channel")
if k == 1 or k == 2 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl",MOONWELL_LEFT,"head"))
call SetUnitState(MOONWELL_LEFT,UNIT_STATE_MANA,GetUnitState(MOONWELL_LEFT,UNIT_STATE_MANA)+MOONWELL_MANA)
call DisplayTextToForce( GetPlayersAll(), "Cenarius charges the |cff80ff80Western Moon Well|r" )
call PingMinimapForForceEx( GetPlayersAll(), GetUnitX(MOONWELL_LEFT), GetUnitY(MOONWELL_LEFT), 10., bj_MINIMAPPINGSTYLE_SIMPLE, 150,255,150)
endif
if k == 3 or k == 4 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl",MOONWELL_RIGHT,"head"))
call SetUnitState(MOONWELL_RIGHT,UNIT_STATE_MANA,GetUnitState(MOONWELL_RIGHT,UNIT_STATE_MANA)+MOONWELL_MANA)
call DisplayTextToForce( GetPlayersAll(), "Cenarius charges the |cff80ff80Eastern Moon Well|r" )
call PingMinimapForForceEx( GetPlayersAll(), GetUnitX(MOONWELL_RIGHT), GetUnitY(MOONWELL_RIGHT), 10., bj_MINIMAPPINGSTYLE_SIMPLE, 150,255,150)
endif
else
call DestroyTimer(GetExpiredTimer())
endif
endfunction
private function GroupFilterHeroes takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if GetFilterUnit()==udg_Heroes[i] then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onTimerRemoveFires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit water = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer k = LoadInteger(udg_hash,GetHandleId(t),2)
call TreeRemoveDot(k,WATER_FIRE_DURATION_REMOVE)
call SetUnitScale(water,5.,5.,5.)
call KillUnit(water)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set water = null
endfunction
private function onTimerRemoveWaterBuff takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(C3_hash,GetHandleId(t),1)
call UnitRemoveAbility(u, ABIL_BUFF)
call UnitRemoveAbility(u, BUFF_CODE)
call GroupRemoveUnit(WATER_CARRIERS,u)
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function CheckBuffsForCarriers takes nothing returns nothing
local unit tempu = GetEnumUnit()
if not (GetUnitAbilityLevel(tempu,ABIL_BUFF)>0) then
call UnitAddAbility(tempu,ABIL_BUFF)
endif
set tempu = null
endfunction
private function onTimerCheckMoonWell takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = CreateGroup()
local unit tempu = null
local integer j = 1
local unit tree = null
local unit water = null
local timer t1 = null
local timer waterTimer = null
local real dist = 0.
call GroupEnumUnitsInRange(g, GetUnitX(MOONWELL_LEFT), GetUnitY(MOONWELL_LEFT) , MOONWELL_AOE_CHECK, function GroupFilterHeroes)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not IsUnitInGroup(tempu,WATER_CARRIERS) then
if GetUnitState(MOONWELL_LEFT,UNIT_STATE_MANA) >= MOONWELL_BUFF_MANA_THRESHOLD then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl",MOONWELL_LEFT,"head"))
call GroupAddUnit(WATER_CARRIERS,tempu)
call UnitAddAbility(tempu,ABIL_BUFF)
call SetUnitState(MOONWELL_LEFT,UNIT_STATE_MANA,GetUnitState(MOONWELL_LEFT,UNIT_STATE_MANA)-MOONWELL_BUFF_MANA_THRESHOLD)
if LoadTimerHandle(C3_hash,GetHandleId(tempu),WATER_TIMER_HASH)==null then
set t1 = CreateTimer()
call SaveTimerHandle(C3_hash,GetHandleId(tempu),WATER_TIMER_HASH,t1)
else
set t1 = LoadTimerHandle(C3_hash,GetHandleId(tempu),WATER_TIMER_HASH)
endif
call TimerStart(t1,WATER_BUFF_DURATION,false, function onTimerRemoveWaterBuff)
call SaveUnitHandle(C3_hash,GetHandleId(t1),1,tempu)
set t1 = null
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
call GroupEnumUnitsInRange(g, GetUnitX(MOONWELL_RIGHT), GetUnitY(MOONWELL_RIGHT) , MOONWELL_AOE_CHECK, function GroupFilterHeroes)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not IsUnitInGroup(tempu,WATER_CARRIERS) then
if GetUnitState(MOONWELL_RIGHT,UNIT_STATE_MANA) >= MOONWELL_BUFF_MANA_THRESHOLD then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl",MOONWELL_RIGHT,"head"))
call GroupAddUnit(WATER_CARRIERS,tempu)
call UnitAddAbility(tempu,ABIL_BUFF)
call SetUnitState(MOONWELL_RIGHT,UNIT_STATE_MANA,GetUnitState(MOONWELL_RIGHT,UNIT_STATE_MANA)-MOONWELL_BUFF_MANA_THRESHOLD)
if LoadTimerHandle(C3_hash,GetHandleId(tempu),WATER_TIMER_HASH)==null then
set t1 = CreateTimer()
call SaveTimerHandle(C3_hash,GetHandleId(tempu),WATER_TIMER_HASH,t1)
else
set t1 = LoadTimerHandle(C3_hash,GetHandleId(tempu),WATER_TIMER_HASH)
endif
call TimerStart(t1,WATER_BUFF_DURATION,false, function onTimerRemoveWaterBuff)
call SaveUnitHandle(C3_hash,GetHandleId(t1),1,tempu)
set t1 = null
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
loop
exitwhen j>4
set tree = GetTreeByIndex(j)
call GroupEnumUnitsInRange(g, GetUnitX(tree)+GetShiftXForTree(j), GetUnitY(tree) + GetShiftYForTree(j), TREE_AOE_CHECK, function GroupFilterHeroes)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if GetUnitAbilityLevel(tempu,BUFF_CODE)>0 and IsTreeOnFire(j) then
call GroupRemoveUnit(WATER_CARRIERS,tempu)
call UnitRemoveAbility(tempu, ABIL_BUFF)
call UnitRemoveAbility(tempu, BUFF_CODE)
set water = CreateUnit(GetOwningPlayer(tempu),WATER_CODE,GetUnitX(tempu),GetUnitY(tempu),0.)
set dist = SquareRoot( (GetUnitX(tempu)- (GetUnitX(tree)+GetShiftXForTree(j)))*(GetUnitX(tempu)- (GetUnitX(tree)+GetShiftXForTree(j))) + (GetUnitY(tempu)- (GetUnitY(tree)+GetShiftYForTree(j)))*(GetUnitY(tempu)- (GetUnitY(tree)+GetShiftYForTree(j))) )
call ParKnock(water,dist,500.,WATER_FLOW_TIME,Atan2( (GetUnitY(tree)+GetShiftYForTree(j)) - GetUnitY(tempu), (GetUnitX(tree)+GetShiftXForTree(j)) - GetUnitX(tempu) )*bj_RADTODEG,false,"none")
set waterTimer = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(waterTimer),1,water)
call SaveInteger(udg_hash,GetHandleId(waterTimer),2,j)
call TimerStart(waterTimer,WATER_FLOW_TIME,false,function onTimerRemoveFires)
set waterTimer = null
endif
call GroupRemoveUnit(g,tempu)
endloop
set j = j + 1
endloop
call ForGroup(WATER_CARRIERS,function CheckBuffsForCarriers)
call DestroyGroup(g)
set t = null
set g = null
set tree = null
endfunction
private function onTimerResumeTimers takes nothing returns nothing
call ResumeTimer(PORTAL_TIMER)
call ResumeTimer(MOONWELL_TIMER)
call DestroyTimer(GetExpiredTimer())
endfunction
private function onTimerSpecialWaves takes nothing returns nothing
//call PauseTimer(PORTAL_TIMER)
//call PauseTimer(MOONWELL_TIMER)
set SPECIAL_WAVES_COUNT = SPECIAL_WAVES_COUNT + 1
set NEXT_WAVE_SPECIAL = true
//call TimerStart(CreateTimer(), SPECIAL_WAVE_TIMEOUT, false, function onTimerResumeTimers)
call TimerDialogDisplay(C3SPECIAL_WAVES_DIALOG,false)
call PauseTimer(C3SPECIAL_WAVES_TIMER)
if SPECIAL_WAVES_COUNT >= SPECIAL_WAVES_MAX_COUNT then
call DestroyTimerDialog(C3SPECIAL_WAVES_DIALOG)
call DestroyTimer(C3SPECIAL_WAVES_TIMER)
endif
endfunction
private function onEnter takes nothing returns nothing
local integer i = 1
set CHAPTER_INITIALIZED = true
call SetCinematicScene('E000',null,"Cenarius",TALK1,15.,15.)
call PauseUnit(CENARIUS,true)
loop
exitwhen i > udg_PlayerCount
call SetPlayerAlliance(DARNASSUS, udg_Players[i], ALLIANCE_SHARED_VISION, true)
call SetPlayerAlliance(udg_Players[i], DARNASSUS, ALLIANCE_SHARED_VISION, true)
set i = i + 1
endloop
call SaveReal(udg_hash,GetHandleId(CENARIUS),GetSpellResistHash(),1.)
if udg_PlayersInGame == 3 or udg_PlayersInGame == 5 then
call SetPlayerTechResearched( INVADERS,C3_PLAYER_HP_BALANCE, 2)
endif
if udg_PlayersInGame == 2 or udg_PlayersInGame == 6 then
call SetPlayerTechResearched( INVADERS,C3_PLAYER_HP_BALANCE, 3)
endif
if udg_PlayersInGame == 4 then
call SetPlayerTechResearched( INVADERS,C3_PLAYER_HP_BALANCE, 4)
endif
call SetPlayerTechResearched( INVADERS,'R00G', 1)
call SetPlayerTechResearched( INVADERS,'R00I', CURRENT_DIFFICULTY+1)
set CHAPTER_3_STARTED = true
if TURBO_MODE then
call TimerStart(PORTAL_TIMER,20./TURBO_TIMER_FACTOR,false, null)
call TimerStart(MOONWELL_TIMER,30./TURBO_TIMER_FACTOR,true,function MoonWellRegenMana)
call TimerStart(C3SPECIAL_WAVES_TIMER, SPECIAL_WAVES_PERIOD/TURBO_TIMER_FACTOR, true, function onTimerSpecialWaves)
else
call TimerStart(PORTAL_TIMER,20.,false, null)
call TimerStart(MOONWELL_TIMER,30.,true,function MoonWellRegenMana)
call TimerStart(C3SPECIAL_WAVES_TIMER, SPECIAL_WAVES_PERIOD, true, function onTimerSpecialWaves)
endif
set C3SPECIAL_WAVES_DIALOG = CreateTimerDialog(C3SPECIAL_WAVES_TIMER)
call TimerDialogSetTitle(C3SPECIAL_WAVES_DIALOG, "Outland Invasion")
call TimerDialogDisplay(C3SPECIAL_WAVES_DIALOG,true)
call TimerStart(CreateTimer(),0.5,true,function onTimerCheckMoonWell)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_ElvesStartChapter )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endlibrary
library Chapter3Waves initializer onInit requires IsUnitDead,Chapter3Init
globals
private constant integer ATTACK_TREE_ABILCODE = 'A060'
private constant integer ELDER_TREE_ID = 'h030'
private constant integer LEAVES_ID = 'h031'
private constant integer MOON_WELL_ID = 'h02Z'
private constant integer CENARIUS_SPEED_AURA = 'A07A'
private constant integer CHAPTER_3_WAVES_HP_UPGRADE = 'R00B'
private constant integer ORB_ID = 'h02S'
private constant integer EREDAR_ORB_ID = 'h037'
private constant integer ORB_SPECIAL_ID = 'h033'
private constant integer TREE_FIRE_ID = 'h02Y'
private constant integer MAX_ORBS = 10
private constant real PORTAL_CREATE_TIME = 10.
private constant real PORTAL_DELAY_AFTER_CREATION = 10.
private constant real PORTAL_DELAY_AFTER_CREATION_SPECIAL = 30.
private constant real PORTAL_SUMMON_PERIOD = 20.
private constant real PORTAL_DURATION = 61.
private integer PORTAL_OPENED_COUNT = 0
private constant real EREDAR_PORTAL_FORMATION_TIME = 25.
boolean EREDAR_PORTAL_INITIALIZED = false
private constant real TREE_DAMAGE_PER_TICK = 1.
private constant real TREE_DAMAGE_PERIOD = 1.
private constant real NEXT_PORTAL_COOLDOWN = 75.
private constant integer MAX_BASE_WAVES = 3
private constant integer MAX_CHAMP_WAVES = 6
private constant integer array WAVES_BASE
private constant integer array WAVES_CHAMP
private constant integer array WAVES_SPECIAL[SPECIAL_WAVES_MAX_COUNT]
private boolean WAVES_CAST_TIMER_INITIALIZED = false
private boolean DAMAGE_TIMER_INITIALIZED = false
boolean NEXT_WAVE_SPECIAL = false
boolean ALL_COMMANDERS_DEAD = false
string PREVIOUS_PORTAL_SIDE = ""
unit MOONWELL_LEFT = null
unit MOONWELL_RIGHT = null
private real tempX
private real tempY
private group CHAMPIONS_GROUP = CreateGroup()
private group BASEUNITS_GROUP = CreateGroup()
private group SPECIALUNITS_GROUP = CreateGroup()
private unit array TREE[4] // 1 - Left Top, 2 - Left Bot, 3 - Right Top, 4 - Right Bot
private unit array LEAVES[4] //leaves effect for trees
private constant integer MAX_CHAMP_ABILS = 3
private constant integer array CHAMP_ABILS[10]
private integer ORDER_HASH = 202
private integer CHAMP_ORDER_HASH = 203
private constant real RESET_ORDER_PERIOD = 5.
private real array TREE_HP[5]
private real array SHIFT_ANGLES[5]
private constant real TREE_INITIAL_HP = 2000
private constant real TREE_PLAYER_HP = 1000
private real TREE_CUR_MAX_HP = 2000
private integer LAST_PLAYER_UPDATE = 0
private real LAST_TREE_MAX_HP = TREE_INITIAL_HP
private constant integer MAX_DOTS = 100
private real array LEFT_TOP_TREE_DOTS
private real array LEFT_BOT_TREE_DOTS
private real array RIGHT_TOP_TREE_DOTS
private real array RIGHT_BOT_TREE_DOTS
private constant integer MAX_FIRES = 20
private unit array LEFT_TOP_FIRES[MAX_FIRES]
private unit array LEFT_BOT_FIRES[MAX_FIRES]
private unit array RIGHT_TOP_FIRES[MAX_FIRES]
private unit array RIGHT_BOT_FIRES[MAX_FIRES]
private boolean array LEFT_TOP_TREE_HP_MESSAGE[10]
private boolean array LEFT_BOT_TREE_HP_MESSAGE[10]
private boolean array RIGHT_TOP_TREE_HP_MESSAGE[10]
private boolean array RIGHT_BOT_TREE_HP_MESSAGE[10]
private boolean LEFT_TOP_TREE_DEAD_MESSAGE = false
private boolean LEFT_BOT_TREE_DEAD_MESSAGE = false
private boolean RIGHT_TOP_TREE_DEAD_MESSAGE = false
private boolean RIGHT_BOT_TREE_DEAD_MESSAGE = false
endglobals
private function CenariusGroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(CENARIUS))
endfunction
private function ApplyCenariusWrath takes nothing returns nothing
local group g = CreateGroup()
local real x = GetUnitX(CENARIUS)
local real y = GetUnitY(CENARIUS)
local unit tempu = null
call DisplayTextToForce( GetPlayersAll(), "Cenarius casts |cff80ff80Cenarius's Wrath|r." )
call GroupEnumUnitsInRange(g,x,y,20000, function CenariusGroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if ALL_COMMANDERS_DEAD then
call DummyCastTarget(CENARIUS,tempu,'A08O',6-CURRENT_DIFFICULTY+5,"entanglingroots")
else
call DummyCastTarget(CENARIUS,tempu,'A08O',6-CURRENT_DIFFICULTY,"entanglingroots")
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
endfunction
function GetTreeByIndex takes integer k returns unit
return TREE[k]
endfunction
function GetShiftXForTree takes integer k returns real
if k > 0 and k <=4 then
return 150*Cos(SHIFT_ANGLES[k])
endif
return 0.
endfunction
function GetShiftYForTree takes integer k returns real
if k > 0 and k <=4 then
return 150*Sin(SHIFT_ANGLES[k])
endif
return 0.
endfunction
function IsTreeOnFire takes integer k returns boolean
local integer j = 1
local real sum = 0.
loop
exitwhen j>MAX_DOTS
if k == 1 then
set sum = sum + LEFT_TOP_TREE_DOTS[j]
endif
if k == 2 then
set sum = sum + LEFT_BOT_TREE_DOTS[j]
endif
if k == 3 then
set sum = sum + RIGHT_TOP_TREE_DOTS[j]
endif
if k == 4 then
set sum = sum + RIGHT_BOT_TREE_DOTS[j]
endif
set j = j + 1
endloop
return sum > 0.
endfunction
function GetMostDamageTree takes nothing returns integer
local integer j = 1
local real sum1 = 0.
local real sum2 = 0.
local real sum3 = 0.
local real sum4 = 0.
local integer k = 0
loop
exitwhen j>MAX_DOTS
set sum1 = sum1 + LEFT_TOP_TREE_DOTS[j]
set sum2 = sum2 + LEFT_BOT_TREE_DOTS[j]
set sum3 = sum3 + RIGHT_TOP_TREE_DOTS[j]
set sum4 = sum4 + RIGHT_BOT_TREE_DOTS[j]
set j = j + 1
endloop
if sum1 >= sum2 and sum1>=sum3 and sum1>=sum4 then
set k = 1
endif
if sum2 >= sum1 and sum2>=sum3 and sum2>=sum4 then
set k = 2
endif
if sum3 >= sum1 and sum3>=sum2 and sum3>=sum4 then
set k = 3
endif
if sum4 >= sum1 and sum4>=sum2 and sum4>=sum3 then
set k = 4
endif
if sum1==sum2 and sum2==sum3 and sum3==sum4 then
set k = GetRandomInt(1,4)
endif
return k
endfunction
private function ResetTreeFires takes nothing returns nothing
local integer j = 1
local real sum1 = 0.
local real sum2 = 0.
local real sum3 = 0.
local real sum4 = 0.
local integer count1 = 0
local integer count2 = 0
local integer count3 = 0
local integer count4 = 0
loop
exitwhen j>MAX_DOTS
set sum1 = sum1 + LEFT_TOP_TREE_DOTS[j]
set sum2 = sum2 + LEFT_BOT_TREE_DOTS[j]
set sum3 = sum3 + RIGHT_TOP_TREE_DOTS[j]
set sum4 = sum4 + RIGHT_BOT_TREE_DOTS[j]
set j = j + 1
endloop
set count1 = R2I(sum1/40.)
set count2 = R2I(sum2/40.)
set count3 = R2I(sum3/40.)
set count4 = R2I(sum4/40.)
if sum1>0 and count1==0 then
set count1 = 1
endif
if sum2>0 and count2==0 then
set count2 = 1
endif
if sum3>0 and count3==0 then
set count3 = 1
endif
if sum4>0 and count4==0 then
set count4 = 1
endif
set j = 1
loop
exitwhen j>MAX_FIRES
if j<=count1 then
if LEFT_TOP_FIRES[j] == null then
set LEFT_TOP_FIRES[j] = CreateUnit(Player(7), TREE_FIRE_ID, GetUnitX(TREE[1])+GetShiftXForTree(1)+GetRandomReal(-300.,300.),GetUnitY(TREE[1])+GetShiftYForTree(1)+GetRandomReal(-200.,200.),0.)
call SetUnitFlyHeight(LEFT_TOP_FIRES[j],GetRandomReal(300.,600.),0.)
endif
else
call KillUnit(LEFT_TOP_FIRES[j])
set LEFT_TOP_FIRES[j] = null
endif
if j<=count2 then
if LEFT_BOT_FIRES[j] == null then
set LEFT_BOT_FIRES[j] = CreateUnit(Player(7), TREE_FIRE_ID, GetUnitX(TREE[2])+GetShiftXForTree(2)+GetRandomReal(-300.,300.),GetUnitY(TREE[2])+GetShiftYForTree(2)+GetRandomReal(-200.,200.),0.)
call SetUnitFlyHeight(LEFT_BOT_FIRES[j],GetRandomReal(300.,600.),0.)
endif
else
call KillUnit(LEFT_BOT_FIRES[j])
set LEFT_BOT_FIRES[j] = null
endif
if j<=count3 then
if RIGHT_TOP_FIRES[j] == null then
set RIGHT_TOP_FIRES[j] = CreateUnit(Player(7), TREE_FIRE_ID, GetUnitX(TREE[3])+GetShiftXForTree(3)+GetRandomReal(-300.,300.),GetUnitY(TREE[3])+GetShiftYForTree(3)+GetRandomReal(-200.,200.),0.)
call SetUnitFlyHeight(RIGHT_TOP_FIRES[j],GetRandomReal(300.,600.),0.)
endif
else
call KillUnit(RIGHT_TOP_FIRES[j])
set RIGHT_TOP_FIRES[j] = null
endif
if j<=count4 then
if RIGHT_BOT_FIRES[j] == null then
set RIGHT_BOT_FIRES[j] = CreateUnit(Player(7), TREE_FIRE_ID, GetUnitX(TREE[4])+GetShiftXForTree(4)+GetRandomReal(-300.,300.),GetUnitY(TREE[4])+GetShiftYForTree(4)+GetRandomReal(-200.,200.),0.)
call SetUnitFlyHeight(RIGHT_BOT_FIRES[j],GetRandomReal(300.,600.),0.)
endif
else
call KillUnit(RIGHT_BOT_FIRES[j])
set RIGHT_BOT_FIRES[j] = null
endif
set j = j + 1
endloop
endfunction
private function RefreshTreePlayerHp takes nothing returns nothing
local real NEW_MAX_HP = 0.
if not (LAST_PLAYER_UPDATE == udg_PlayersInGame) then
set LAST_PLAYER_UPDATE = udg_PlayersInGame
set NEW_MAX_HP = TREE_INITIAL_HP + TREE_PLAYER_HP * udg_PlayersInGame
set TREE_CUR_MAX_HP = NEW_MAX_HP
set TREE_HP[1] = NEW_MAX_HP * (TREE_HP[1]/LAST_TREE_MAX_HP)
set TREE_HP[2] = NEW_MAX_HP * (TREE_HP[2]/LAST_TREE_MAX_HP)
set TREE_HP[3] = NEW_MAX_HP * (TREE_HP[3]/LAST_TREE_MAX_HP)
set TREE_HP[4] = NEW_MAX_HP * (TREE_HP[4]/LAST_TREE_MAX_HP)
endif
endfunction
private function ShowTreeHpLeftMessage takes nothing returns nothing
local real hp1 = TREE_HP[1]/TREE_CUR_MAX_HP
local real hp2 = TREE_HP[2]/TREE_CUR_MAX_HP
local real hp3 = TREE_HP[3]/TREE_CUR_MAX_HP
local real hp4 = TREE_HP[4]/TREE_CUR_MAX_HP
local integer j = 1
local integer i = 1
loop
exitwhen j>9
if (j-1)*0.1<= hp1 and hp1 <= j *0.1 and not LEFT_TOP_TREE_HP_MESSAGE[j] then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80North-West Tree|r has " + I2S(j*10) +"% life left.")
set LEFT_TOP_TREE_HP_MESSAGE[j] = true
call SetUnitVertexColor(TREE[1],255,255-25*(10-j),255,255)
if j==5 then
call RemoveUnit(LEAVES[1])
call ApplyCenariusWrath()
endif
endif
if (j-1)*0.1<= hp2 and hp2 <= j *0.1 and not LEFT_BOT_TREE_HP_MESSAGE[j] then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80South-West Tree|r has " + I2S(j*10) +"% life left.")
set LEFT_BOT_TREE_HP_MESSAGE[j] = true
call SetUnitVertexColor(TREE[2],255,255-25*(10-j),255,255)
if j==5 then
call RemoveUnit(LEAVES[2])
call ApplyCenariusWrath()
endif
endif
if (j-1)*0.1<= hp3 and hp3 <= j *0.1 and not RIGHT_TOP_TREE_HP_MESSAGE[j] then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80North-East Tree|r has " + I2S(j*10) +"% life left.")
set RIGHT_TOP_TREE_HP_MESSAGE[j] = true
call SetUnitVertexColor(TREE[3],255,255-25*(10-j),255,255)
if j==5 then
call RemoveUnit(LEAVES[3])
call ApplyCenariusWrath()
endif
endif
if (j-1)*0.1<= hp4 and hp4 <= j *0.1 and not RIGHT_BOT_TREE_HP_MESSAGE[j] then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80South-East Tree|r has " + I2S(j*10) +"% life left.")
set RIGHT_BOT_TREE_HP_MESSAGE[j] = true
call SetUnitVertexColor(TREE[4],255,255-25*(10-j),255,255)
if j==5 then
call RemoveUnit(LEAVES[4])
call ApplyCenariusWrath()
endif
endif
set j = j + 1
endloop
if TREE_HP[1] <=0. and not LEFT_TOP_TREE_DEAD_MESSAGE then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80North-West Tree|r has been destroyed!")
set LEFT_TOP_TREE_DEAD_MESSAGE = true
endif
if TREE_HP[2] <=0. and not LEFT_BOT_TREE_DEAD_MESSAGE then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80South-West Tree|r has been destroyed!")
set LEFT_BOT_TREE_DEAD_MESSAGE = true
endif
if TREE_HP[3] <=0. and not RIGHT_TOP_TREE_DEAD_MESSAGE then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80North-East Tree|r has been destroyed!")
set RIGHT_TOP_TREE_DEAD_MESSAGE = true
endif
if TREE_HP[4] <=0. and not RIGHT_BOT_TREE_DEAD_MESSAGE then
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80South-East Tree|r has been destroyed!")
set RIGHT_BOT_TREE_DEAD_MESSAGE = true
endif
if TREE_HP[1] <= 0. and TREE_HP[2] <=0. and TREE_HP[3]<=0. and TREE_HP[4] <=0. then
set i = 1
loop
exitwhen i > udg_PlayerCount
call CustomDefeatBJ( udg_Players[i], "All elder trees are destroyed. You lost!" )
set i = i + 1
endloop
endif
endfunction
private function onTimerDamageTrees takes nothing returns nothing
local integer j = 1
call RefreshTreePlayerHp()
loop
exitwhen j > MAX_DOTS
if LEFT_TOP_TREE_DOTS[j]>0. then
set LEFT_TOP_TREE_DOTS[j] = LEFT_TOP_TREE_DOTS[j] - TREE_DAMAGE_PERIOD
if LEFT_TOP_TREE_DOTS[j] < 0. then
set LEFT_TOP_TREE_DOTS[j] = 0.
endif
if TREE_HP[1] > 0. then
set TREE_HP[1] = TREE_HP[1] - TREE_DAMAGE_PER_TICK
endif
endif
if LEFT_BOT_TREE_DOTS[j]>0. then
set LEFT_BOT_TREE_DOTS[j] = LEFT_BOT_TREE_DOTS[j] - TREE_DAMAGE_PERIOD
if LEFT_BOT_TREE_DOTS[j] < 0. then
set LEFT_BOT_TREE_DOTS[j] = 0.
endif
if TREE_HP[2] > 0. then
set TREE_HP[2] = TREE_HP[2] - TREE_DAMAGE_PER_TICK
endif
endif
if RIGHT_TOP_TREE_DOTS[j]>0. then
set RIGHT_TOP_TREE_DOTS[j] = RIGHT_TOP_TREE_DOTS[j] - TREE_DAMAGE_PERIOD
if RIGHT_TOP_TREE_DOTS[j] < 0. then
set RIGHT_TOP_TREE_DOTS[j] = 0.
endif
if TREE_HP[3] > 0. then
set TREE_HP[3] = TREE_HP[3] - TREE_DAMAGE_PER_TICK
endif
endif
if RIGHT_BOT_TREE_DOTS[j]>0. then
set RIGHT_BOT_TREE_DOTS[j] = RIGHT_BOT_TREE_DOTS[j] - TREE_DAMAGE_PERIOD
if RIGHT_BOT_TREE_DOTS[j] < 0. then
set RIGHT_BOT_TREE_DOTS[j] = 0.
endif
if TREE_HP[4] > 0. then
set TREE_HP[4] = TREE_HP[4] - TREE_DAMAGE_PER_TICK
endif
endif
set j = j + 1
endloop
if TREE_HP[1]<=0. and TREE_HP[2]<=0. and TREE_HP[3]<=0. and TREE_HP[4]<=0. then
call DestroyTimer(GetExpiredTimer())
else
call ResetTreeFires()
endif
call ShowTreeHpLeftMessage()
endfunction
function TreeDealDamage takes integer k,real damage returns nothing
call RefreshTreePlayerHp()
if k>0 and k<=4 then
if TREE_HP[k] >= damage then
set TREE_HP[k] = TREE_HP[k] - damage
else
set TREE_HP[k] = 0.
endif
call ShowTreeHpLeftMessage()
endif
endfunction
function TreeAddDot takes integer k, real duration returns nothing
local integer j = 1
local boolean found = false
loop
exitwhen j>MAX_DOTS or found
if k==1 and LEFT_TOP_TREE_DOTS[j] <= 0. then
set LEFT_TOP_TREE_DOTS[j] = duration
set found = true
endif
if k==2 and LEFT_BOT_TREE_DOTS[j] <= 0. then
set LEFT_BOT_TREE_DOTS[j] = duration
set found = true
endif
if k==3 and RIGHT_TOP_TREE_DOTS[j] <= 0. then
set RIGHT_TOP_TREE_DOTS[j] = duration
set found = true
endif
if k==4 and RIGHT_BOT_TREE_DOTS[j] <= 0. then
set RIGHT_BOT_TREE_DOTS[j] = duration
set found = true
endif
set j = j + 1
endloop
if not DAMAGE_TIMER_INITIALIZED then
set DAMAGE_TIMER_INITIALIZED = true
call TimerStart(CreateTimer(),TREE_DAMAGE_PERIOD,true,function onTimerDamageTrees)
endif
endfunction
function TreeRemoveDot takes integer k, real duration returns nothing
local integer j = 1
local real remained = duration
loop
exitwhen j>MAX_DOTS or remained <=0
if k==1 and LEFT_TOP_TREE_DOTS[j] > 0. then
if LEFT_TOP_TREE_DOTS[j] <= remained then
set remained = remained - LEFT_TOP_TREE_DOTS[j]
set LEFT_TOP_TREE_DOTS[j] = 0.
else
set LEFT_TOP_TREE_DOTS[j] = LEFT_TOP_TREE_DOTS[j] - remained
set remained = -1.
endif
endif
if k==2 and LEFT_BOT_TREE_DOTS[j] > 0. then
if LEFT_BOT_TREE_DOTS[j] <= remained then
set remained = remained - LEFT_BOT_TREE_DOTS[j]
set LEFT_BOT_TREE_DOTS[j] = 0.
else
set LEFT_BOT_TREE_DOTS[j] = LEFT_BOT_TREE_DOTS[j] - remained
set remained = -1.
endif
endif
if k==3 and RIGHT_TOP_TREE_DOTS[j] > 0. then
if RIGHT_TOP_TREE_DOTS[j] <= remained then
set remained = remained - RIGHT_TOP_TREE_DOTS[j]
set RIGHT_TOP_TREE_DOTS[j] = 0.
else
set RIGHT_TOP_TREE_DOTS[j] = RIGHT_TOP_TREE_DOTS[j] - remained
set remained = -1.
endif
endif
if k==4 and RIGHT_BOT_TREE_DOTS[j] > 0. then
if RIGHT_BOT_TREE_DOTS[j] <= remained then
set remained = remained - RIGHT_BOT_TREE_DOTS[j]
set RIGHT_BOT_TREE_DOTS[j] = 0.
else
set RIGHT_BOT_TREE_DOTS[j] = RIGHT_BOT_TREE_DOTS[j] - remained
set remained = -1.
endif
endif
set j = j + 1
endloop
call ResetTreeFires()
endfunction
private function GetCloserTreeAlive takes real x, real y returns integer
local integer i = 1
local integer k = 0
local real curdist = 0.
local real mindist = 0.
loop
exitwhen i > 4
if TREE_HP[i]>0 then
set k = i
set mindist = (x-GetUnitX(TREE[i]))*(x-GetUnitX(TREE[i])) + (y-GetUnitY(TREE[i]))*(y-GetUnitY(TREE[i]))
set i = 5
endif
set i = i + 1
endloop
set i = 1
loop
exitwhen i > 4
if TREE_HP[i]>0 then
set curdist = (x-GetUnitX(TREE[i]))*(x-GetUnitX(TREE[i])) + (y-GetUnitY(TREE[i]))*(y-GetUnitY(TREE[i]))
if curdist < mindist then
set k = i
set mindist = curdist
endif
endif
set i = i + 1
endloop
return k
endfunction
private function onTimerResetChampOrder takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(C3_hash,GetHandleId(t),1)
call SaveBoolean(C3_hash,GetHandleId(u),CHAMP_ORDER_HASH,false)
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimerResetOrder takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(C3_hash,GetHandleId(t),1)
call SaveBoolean(C3_hash,GetHandleId(u),ORDER_HASH,false)
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function MakeChampionsCast takes nothing returns nothing
local unit u = GetEnumUnit()
local integer k = GetCloserTreeAlive(GetUnitX(u),GetUnitY(u))
local timer t = null
local integer i = 1
local boolean found = false
//call DisplayTextToForce( GetPlayersAll(), "Ordering " + GetUnitName(u) +"|r")
if IsUnitDeadBX(u) then
call GroupRemoveUnit(CHAMPIONS_GROUP,u)
else
if k > 0 and not LoadBoolean(C3_hash,GetHandleId(u),CHAMP_ORDER_HASH) then
loop
exitwhen i > MAX_CHAMP_ABILS or found
if GetUnitAbilityLevel(u,CHAMP_ABILS[i])>0 then
if BlzGetUnitAbilityCooldownRemaining(u,CHAMP_ABILS[i])<=0. then
set found = true
//call DisplayTextToForce( GetPlayersAll(), "For " + GetUnitName(u) +"|r found ability to cast")
endif
endif
set i = i + 1
endloop
set i = i - 1
if found then
//call DisplayTextToForce( GetPlayersAll(), "Ordering " + GetUnitName(u) +"|r to cast ability " + BlzGetAbilityTooltip(CHAMP_ABILS[i],0))
call IssuePointOrder(u,"breathoffire",GetUnitX(TREE[k])+GetShiftXForTree(k),GetUnitY(TREE[k])+GetShiftYForTree(k))
//call UnitRemoveAbility(u,CHAMP_ABILS[i])
//call UnitAddAbility(u,CHAMP_ABILS[i])
//call IssuePointOrder(u,"breathoffire",GetUnitX(TREE[k])+GetShiftXForTree(k),GetUnitY(TREE[k])+GetShiftYForTree(k))
set t = CreateTimer()
call SaveBoolean(C3_hash,GetHandleId(u),CHAMP_ORDER_HASH,true)
call SaveUnitHandle(C3_hash,GetHandleId(t),1,u)
call TimerStart(t,RESET_ORDER_PERIOD,false,function onTimerResetChampOrder)
set t = null
endif
if not found and IsUnitDeadBX(Aggro.target(u)) then
call IssuePointOrder(u,"blizzard",GetUnitX(TREE[k])+GetShiftXForTree(k)+GetRandomReal(-75.,75.),GetUnitY(TREE[k])+GetShiftYForTree(k)+GetRandomReal(-75.,-75.))
set t = CreateTimer()
call SaveBoolean(C3_hash,GetHandleId(u),CHAMP_ORDER_HASH,true)
call SaveUnitHandle(C3_hash,GetHandleId(t),1,u)
call TimerStart(t,RESET_ORDER_PERIOD,false,function onTimerResetChampOrder)
set t = null
endif
endif
endif
set u = null
endfunction
private function MakeUnitsCast takes nothing returns nothing
local unit u = GetEnumUnit()
local integer k = GetCloserTreeAlive(GetUnitX(u),GetUnitY(u))
local timer t = null
if IsUnitDeadBX(u) then
call GroupRemoveUnit(BASEUNITS_GROUP,u)
else
if k > 0 then
if IsUnitDeadBX(Aggro.target(u)) and not LoadBoolean(C3_hash,GetHandleId(u),ORDER_HASH) then
call IssuePointOrder(u,"blizzard",GetUnitX(TREE[k])+GetShiftXForTree(k)+GetRandomReal(-75.,75.),GetUnitY(TREE[k])+GetShiftYForTree(k)+GetRandomReal(-75.,-75.))
set t = CreateTimer()
call SaveBoolean(C3_hash,GetHandleId(u),ORDER_HASH,true)
call SaveUnitHandle(C3_hash,GetHandleId(t),1,u)
call TimerStart(t,RESET_ORDER_PERIOD,false,function onTimerResetOrder)
set t = null
endif
endif
endif
set u = null
endfunction
private function onTimerMakeUnitsCast takes nothing returns nothing
/*
if CHAMPIONS_GROUP == null then
set CHAMPIONS_GROUP = CreateGroup()
endif
if BASEUNITS_GROUP == null then
set BASEUNITS_GROUP = CreateGroup()
endif
set CHAMP_ABILS[1] = 'A00O'
set CHAMP_ABILS[2] = 'A016'
set CHAMP_ABILS[3] = 'A00Q'
*/
call ForGroup(CHAMPIONS_GROUP, function MakeChampionsCast)
call ForGroup(BASEUNITS_GROUP, function MakeUnitsCast)
endfunction
private function onTimerSummon takes nothing returns nothing
local timer t = GetExpiredTimer()
local real x = LoadReal(udg_hash,GetHandleId(t),1)
local real y = LoadReal(udg_hash,GetHandleId(t),2)
local integer count = LoadInteger(udg_hash,GetHandleId(t),3)
local boolean CURRENT_WAVE_SPECIAL = LoadBoolean(udg_hash,GetHandleId(t),4)
local integer i = 1
local unit tempu = null
local real tmul = 1.
if TURBO_MODE then
set tmul = 1./TURBO_TIMER_FACTOR
endif
if not ALL_COMMANDERS_DEAD then
if CURRENT_WAVE_SPECIAL then
set tempu = CreateUnit(INVADERS,WAVES_SPECIAL[SPECIAL_WAVES_COUNT],x+GetRandomReal(-100.,100.),y+GetRandomReal(-100.,100.),0.)
call Aggro.new(tempu)
call GroupAddUnit(PIT_LORD_GROUP,tempu)
call FlushChildHashtable(udg_hash,GetHandleId(tempu))
call FlushChildHashtable(C3_hash,GetHandleId(tempu))
call SetHeroLevelBJ( tempu, 30, false )
call SaveReal(udg_hash,GetHandleId(tempu),GetCritHash(),15.)
call SaveReal(udg_hash,GetHandleId(tempu),GetSpellResistHash(), 0.05*CURRENT_DIFFICULTY)
call SaveReal(udg_hash,GetHandleId(tempu),GetSpellPowerHash(), 100.*(CURRENT_DIFFICULTY-1))
call BlzSetUnitArmor(tempu,BlzGetUnitArmor(tempu)+udg_PlayerCount*(CURRENT_DIFFICULTY))
call TimerStart(PIT_LORD_TIMER,1.,true,null)
call FadeUnitOut(tempu,2.,false)
call ResumeTimer(PORTAL_TIMER)
call TimerDialogDisplay(C3SPECIAL_WAVES_DIALOG,true)
call ResumeTimer(C3SPECIAL_WAVES_TIMER)
else
loop
exitwhen i>3
set tempu = CreateUnit(INVADERS,WAVES_BASE[GetRandomInt(1,MAX_BASE_WAVES)],x+GetRandomReal(-150.,150.),y+GetRandomReal(-150.,150.),0.)
call Aggro.new(tempu)
call FlushChildHashtable(udg_hash,GetHandleId(tempu))
call FlushChildHashtable(C3_hash,GetHandleId(tempu))
call GroupAddUnit(BASEUNITS_GROUP,tempu)
if not (GetUnitAbilityLevel(tempu,ATTACK_TREE_ABILCODE)>0) then
call UnitAddAbility(tempu,ATTACK_TREE_ABILCODE)
endif
call FadeUnitOut(tempu,2.,false)
set i = i + 1
endloop
set tempu = CreateUnit(INVADERS,WAVES_CHAMP[GetRandomInt(1,MAX_CHAMP_WAVES)],x+GetRandomReal(-150.,150.),y+GetRandomReal(-150.,150.),0.)
call Aggro.new(tempu)
call GroupAddUnit(CHAMPIONS_GROUP,tempu)
call FlushChildHashtable(udg_hash,GetHandleId(tempu))
call FlushChildHashtable(C3_hash,GetHandleId(tempu))
call SaveBoolean(C3_hash,GetHandleId(tempu),CHAMP_ORDER_HASH,false)
call FadeUnitOut(tempu,2.,false)
set count = count + 1
call SaveInteger(udg_hash,GetHandleId(t),3,count)
endif
endif
if (not ALL_COMMANDERS_DEAD) and PORTAL_DURATION*tmul - PORTAL_DELAY_AFTER_CREATION*tmul - (count-1)*PORTAL_SUMMON_PERIOD*tmul >= PORTAL_SUMMON_PERIOD*tmul and not CURRENT_WAVE_SPECIAL then
call TimerStart(t,PORTAL_SUMMON_PERIOD*tmul,false,function onTimerSummon)
else
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set tempu = null
endfunction
private function DestroyOrbs takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
private function MoveOrbs takes nothing returns nothing
local unit orb = GetEnumUnit()
local real x = GetUnitX(orb)
local real y = GetUnitY(orb)
local real z = GetUnitFlyHeight(orb)
local integer i = 1
local real xlast = x
local real ylast = y
local real zlast = z
local real xtemp
local real ytemp
local real ztemp
loop
exitwhen i>=5
set xtemp = xlast
set ytemp = ylast
set ztemp = zlast
set xlast = LorenzGetNextX(tempX,tempY,0.,xtemp,ytemp,ztemp)
set ylast = LorenzGetNextY(tempX,tempY,0.,xtemp,ytemp,ztemp)
set zlast = LorenzGetNextZ(tempX,tempY,0.,xtemp,ytemp,ztemp)
set i = i + 1
endloop
call SetUnitX(orb, xlast)
call SetUnitY(orb, ylast)
call SetUnitFlyHeight(orb, zlast,0.)
set orb = null
endfunction
private function onTimerCreatePortal takes nothing returns nothing
local timer t = GetExpiredTimer()
local real centX = LoadReal(udg_hash,GetHandleId(t),1)
local real centY = LoadReal(udg_hash,GetHandleId(t),2)
local integer OrbCount = LoadInteger(udg_hash,GetHandleId(t),3)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local group ORBS_GROUP = LoadGroupHandle(udg_hash,GetHandleId(t),5)
local real dur = LoadReal(udg_hash,GetHandleId(t),6)
local real xh = LoadReal(udg_hash,GetHandleId(t),7)
local real yh = LoadReal(udg_hash,GetHandleId(t),8)
local boolean CURRENT_WAVE_SPECIAL = LoadBoolean(udg_hash,GetHandleId(t),9)
local unit orb = null
local timer t1 = null
local real tmul = 1.
if TURBO_MODE then
set tmul = 1./TURBO_TIMER_FACTOR
endif
set dur = dur + 0.04
call SaveReal(udg_hash,GetHandleId(t),6,dur)
if OrbCount < MAX_ORBS then
set elapsed = elapsed + 0.04
if elapsed >= PORTAL_CREATE_TIME*tmul/MAX_ORBS then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Creating Orb...")
if CURRENT_WAVE_SPECIAL then
set orb = CreateUnit(Player(7), ORB_SPECIAL_ID, centX + xh,centY+yh,0.)
call SetUnitTimeScale(orb,0.1)
else
set orb = CreateUnit(Player(7), ORB_ID, centX + xh,centY+yh,0.)
call SetUnitTimeScale(orb,0.1)
endif
call SetUnitFlyHeight(orb,50.,0.)
call GroupAddUnit(ORBS_GROUP,orb)
set OrbCount = OrbCount+1
call SaveInteger(udg_hash,GetHandleId(t),3,OrbCount)
set elapsed = 0.
set orb = null
endif
call SaveReal(udg_hash,GetHandleId(t),4,elapsed)
if OrbCount == MAX_ORBS then
set t1 = CreateTimer()
call SaveReal(udg_hash,GetHandleId(t1),1,centX)
call SaveReal(udg_hash,GetHandleId(t1),2,centY)
call SaveInteger(udg_hash,GetHandleId(t1),3,0)
if CURRENT_WAVE_SPECIAL then
call SaveBoolean(udg_hash,GetHandleId(t1),4,true)
call TimerStart(t1,PORTAL_DELAY_AFTER_CREATION_SPECIAL*tmul, false, function onTimerSummon)
else
call SaveBoolean(udg_hash,GetHandleId(t1),4,false)
call TimerStart(t1,PORTAL_DELAY_AFTER_CREATION*tmul, false, function onTimerSummon)
endif
set t1 = null
endif
endif
set tempX = centX
set tempY = centY
call ForGroup(ORBS_GROUP,function MoveOrbs)
if dur >= PORTAL_DURATION*tmul or ALL_COMMANDERS_DEAD or (dur >= (PORTAL_CREATE_TIME+PORTAL_DELAY_AFTER_CREATION_SPECIAL)*tmul+5. and CURRENT_WAVE_SPECIAL) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Portal Destroyed")
call ForGroup(ORBS_GROUP,function DestroyOrbs)
call DestroyGroup(ORBS_GROUP)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set ORBS_GROUP = null
endfunction
private function onTimerRemoveAura takes nothing returns nothing
local timer t = GetExpiredTimer()
call UnitRemoveAbility(CENARIUS,CENARIUS_SPEED_AURA)
call DestroyTimer(t)
set t = null
endfunction
private function onTimerBuffHeroes takes nothing returns nothing
local timer t = GetExpiredTimer()
call DisplayTextToForce( GetPlayersAll(), "Cenarius grants you |cff80ff80Grove's Gift|r." )
call UnitAddAbility(CENARIUS,CENARIUS_SPEED_AURA)
call TimerStart(CreateTimer(),45.,false,function onTimerRemoveAura)
call DestroyTimer(t)
set t = null
endfunction
private function onTimerExpired takes nothing returns nothing
local timer t = CreateTimer()
local integer j = GetRandomInt(1,4)
local real centX = 0.
local real centY = 0.
local real centX1 = 0.
local real centY1 = 0.
local real centX2 = 0.
local real centY2 = 0.
local integer k = 0
local string CURRENT_PORTAL_SIDE = ""
local real tmul = 1.
if TURBO_MODE then
set tmul = 0.5
endif
call SetPlayerTechResearched(Player(7), CHAPTER_3_WAVES_HP_UPGRADE, PORTAL_OPENED_COUNT)
set PORTAL_OPENED_COUNT = PORTAL_OPENED_COUNT + 1
if TREE_HP[1]>0 then
set k = k + 1
endif
if TREE_HP[2]>0 then
set k = k + 1
endif
if TREE_HP[3]>0 then
set k = k + 1
endif
if TREE_HP[4]>0 then
set k = k + 1
endif
if k>0 then
loop
exitwhen TREE_HP[j] > 0
set j = GetRandomInt(1,4)
endloop
endif
if TREE_HP[j] > 0 then
if j == 1 then
set CURRENT_PORTAL_SIDE = "Left"
set centX = GetRectCenterX(gg_rct_Chapter3SpawnsLeftTop)
set centY = GetRectCenterY(gg_rct_Chapter3SpawnsLeftTop)
set centX1 = GetRectCenterX(gg_rct_AdditionalWaves1Left)
set centY1 = GetRectCenterY(gg_rct_AdditionalWaves1Left)
set centX2 = GetRectCenterX(gg_rct_AdditionalWaves2Left)
set centY2 = GetRectCenterY(gg_rct_AdditionalWaves2Left)
if NEXT_WAVE_SPECIAL then
call DisplayTextToForce( GetPlayersAll(), "A strange portal appears near the |cff80ff80North-West Elder Tree|r" )
else
call DisplayTextToForce( GetPlayersAll(), "A demonic portal appears near the |cff80ff80North-West Elder Tree|r" )
endif
endif
if j == 2 then
set CURRENT_PORTAL_SIDE = "Left"
set centX = GetRectCenterX(gg_rct_Chapter3SpawnsLeftBot)
set centY = GetRectCenterY(gg_rct_Chapter3SpawnsLeftBot)
set centX1 = GetRectCenterX(gg_rct_AdditionalWaves1Left)
set centY1 = GetRectCenterY(gg_rct_AdditionalWaves1Left)
set centX2 = GetRectCenterX(gg_rct_AdditionalWaves2Left)
set centY2 = GetRectCenterY(gg_rct_AdditionalWaves2Left)
if NEXT_WAVE_SPECIAL then
call DisplayTextToForce( GetPlayersAll(), "A strange portal appears near the |cff80ff80South-West Elder Tree|r" )
else
call DisplayTextToForce( GetPlayersAll(), "A demonic portal appears near the |cff80ff80South-West Elder Tree|r" )
endif
endif
if j == 3 then
set CURRENT_PORTAL_SIDE = "Right"
set centX = GetRectCenterX(gg_rct_Chapter3SpawnsRightTop)
set centY = GetRectCenterY(gg_rct_Chapter3SpawnsRightTop)
set centX1 = GetRectCenterX(gg_rct_AdditionalWaves1Right)
set centY1 = GetRectCenterY(gg_rct_AdditionalWaves1Right)
set centX2 = GetRectCenterX(gg_rct_AdditionalWaves2Right)
set centY2 = GetRectCenterY(gg_rct_AdditionalWaves2Right)
if NEXT_WAVE_SPECIAL then
call DisplayTextToForce( GetPlayersAll(), "A strange portal appears near the |cff80ff80North-East Elder Tree|r" )
else
call DisplayTextToForce( GetPlayersAll(), "A demonic portal appears near the |cff80ff80North-East Elder Tree|r" )
endif
endif
if j == 4 then
set CURRENT_PORTAL_SIDE = "Right"
set centX = GetRectCenterX(gg_rct_Chapter3SpawnsRightBot)
set centY = GetRectCenterY(gg_rct_Chapter3SpawnsRightBot)
set centX1 = GetRectCenterX(gg_rct_AdditionalWaves1Right)
set centY1 = GetRectCenterY(gg_rct_AdditionalWaves1Right)
set centX2 = GetRectCenterX(gg_rct_AdditionalWaves2Right)
set centY2 = GetRectCenterY(gg_rct_AdditionalWaves2Right)
if NEXT_WAVE_SPECIAL then
call DisplayTextToForce( GetPlayersAll(), "A strange portal appears near the |cff80ff80South-West Elder Tree|r" )
else
call DisplayTextToForce( GetPlayersAll(), "A demonic portal appears near the |cff80ff80South-West Elder Tree|r" )
endif
endif
if not (PREVIOUS_PORTAL_SIDE=="") then
if not (PREVIOUS_PORTAL_SIDE == CURRENT_PORTAL_SIDE) then
call TimerStart(CreateTimer(),5., false, function onTimerBuffHeroes)
endif
endif
set PREVIOUS_PORTAL_SIDE = CURRENT_PORTAL_SIDE
set centX = centX + GetRandomReal(-200.,200.)
set centY = centY + GetRandomReal(-200.,200.)
if not WAVES_CAST_TIMER_INITIALIZED then
set WAVES_CAST_TIMER_INITIALIZED = true
call TimerStart(CreateTimer(),.25,true,function onTimerMakeUnitsCast)
endif
if NEXT_WAVE_SPECIAL then
call PingMinimapForForceEx( GetPlayersAll(), centX, centY, PORTAL_DURATION*tmul, bj_MINIMAPPINGSTYLE_SIMPLE, 212,175,55)
else
call PingMinimapForForceEx( GetPlayersAll(), centX, centY, PORTAL_DURATION*tmul, bj_MINIMAPPINGSTYLE_SIMPLE, 255, 0, 0 )
endif
call SaveReal(udg_hash,GetHandleId(t),1,centX)
call SaveReal(udg_hash,GetHandleId(t),2,centY)
call SaveInteger(udg_hash,GetHandleId(t),3,0)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveGroupHandle(udg_hash,GetHandleId(t),5,CreateGroup())
call SaveReal(udg_hash,GetHandleId(t),6,0.)
call SaveReal(udg_hash,GetHandleId(t),7,GetRandomReal(25.,75.))
call SaveReal(udg_hash,GetHandleId(t),8,GetRandomReal(25.,75.))
if NEXT_WAVE_SPECIAL then
call SaveBoolean(udg_hash,GetHandleId(t),9,true)
else
call SaveBoolean(udg_hash,GetHandleId(t),9,false)
endif
call TimerStart(t,0.04,true,function onTimerCreatePortal)
if udg_PlayersInGame > 2 and not NEXT_WAVE_SPECIAL then
set t = CreateTimer()
call SaveReal(udg_hash,GetHandleId(t),1,centX1)
call SaveReal(udg_hash,GetHandleId(t),2,centY1)
call SaveInteger(udg_hash,GetHandleId(t),3,0)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveGroupHandle(udg_hash,GetHandleId(t),5,CreateGroup())
call SaveReal(udg_hash,GetHandleId(t),6,0.)
call SaveReal(udg_hash,GetHandleId(t),7,GetRandomReal(10.,25.))
call SaveReal(udg_hash,GetHandleId(t),8,GetRandomReal(10.,25.))
call SaveBoolean(udg_hash,GetHandleId(t),9,false)
call TimerStart(t,0.04,true,function onTimerCreatePortal)
if udg_PlayersInGame>4 then
set t = CreateTimer()
call SaveReal(udg_hash,GetHandleId(t),1,centX2)
call SaveReal(udg_hash,GetHandleId(t),2,centY2)
call SaveInteger(udg_hash,GetHandleId(t),3,0)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveGroupHandle(udg_hash,GetHandleId(t),5,CreateGroup())
call SaveReal(udg_hash,GetHandleId(t),6,0.)
call SaveReal(udg_hash,GetHandleId(t),7,GetRandomReal(10.,25.))
call SaveReal(udg_hash,GetHandleId(t),8,GetRandomReal(10.,25.))
call SaveBoolean(udg_hash,GetHandleId(t),9,false)
call TimerStart(t,0.04,true,function onTimerCreatePortal)
endif
endif
if TURBO_MODE then
call TimerStart(PORTAL_TIMER,NEXT_PORTAL_COOLDOWN/TURBO_TIMER_FACTOR,false,null)
else
call TimerStart(PORTAL_TIMER,NEXT_PORTAL_COOLDOWN,false,null)
endif
if NEXT_WAVE_SPECIAL then
call PauseTimer(PORTAL_TIMER)
endif
set NEXT_WAVE_SPECIAL = false
set t = null
else
call DestroyTimer(t)
endif
endfunction
private function onTimerCreateEredarPortal takes nothing returns nothing
local timer t = GetExpiredTimer()
local real centX = LoadReal(udg_hash,GetHandleId(t),1)
local real centY = LoadReal(udg_hash,GetHandleId(t),2)
local integer OrbCount = LoadInteger(udg_hash,GetHandleId(t),3)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local group ORBS_GROUP = LoadGroupHandle(udg_hash,GetHandleId(t),5)
local real dur = LoadReal(udg_hash,GetHandleId(t),6)
local real xh = LoadReal(udg_hash,GetHandleId(t),7)
local real yh = LoadReal(udg_hash,GetHandleId(t),8)
local unit orb = null
set dur = dur + 0.04
call SaveReal(udg_hash,GetHandleId(t),6,dur)
if OrbCount < MAX_ORBS then
set elapsed = elapsed + 0.04
if elapsed >= EREDAR_PORTAL_FORMATION_TIME/(2*MAX_ORBS) then
set orb = CreateUnit(Player(7), EREDAR_ORB_ID, centX + xh,centY+yh,0.)
call SetUnitTimeScale(orb,0.01)
call SetUnitFlyHeight(orb,50.,0.)
call GroupAddUnit(ORBS_GROUP,orb)
set OrbCount = OrbCount+1
call SaveInteger(udg_hash,GetHandleId(t),3,OrbCount)
set elapsed = 0.
set orb = null
endif
call SaveReal(udg_hash,GetHandleId(t),4,elapsed)
endif
set tempX = centX
set tempY = centY
call ForGroup(ORBS_GROUP,function MoveOrbs)
if dur >= EREDAR_PORTAL_FORMATION_TIME and not EREDAR_PORTAL_INITIALIZED then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"|cff80ff80Eredar Portal|r has been opened.")
call TimerStart(REFRESH_COMBAT_TRIGGERS_TIMER,1.,false,null)
set EREDAR_PORTAL_INITIALIZED = true
call PingMinimapForForceEx( GetPlayersAll(), centX, centY, 30., bj_MINIMAPPINGSTYLE_SIMPLE, 212,175,55)
//call ForGroup(ORBS_GROUP,function DestroyOrbs)
//call DestroyGroup(ORBS_GROUP)
//call FlushChildHashtable(udg_hash,GetHandleId(t))
//call DestroyTimer(t)
endif
set t = null
set ORBS_GROUP = null
endfunction
function CreateTreeLightnings takes nothing returns nothing
local integer i = 1
local lightning L = null
local real xt = 0.
local real yt = 0.
local real x = GetRectCenterX(gg_rct_ElvesFountain)
local real y = GetRectCenterY(gg_rct_ElvesFountain)
local timer t = CreateTimer()
call ApplyCenariusWrath()
loop
exitwhen i > 4
if TREE_HP[i]>0. then
set xt = GetUnitX(TREE[i])+GetShiftXForTree(i)
set yt = GetUnitY(TREE[i])+GetShiftYForTree(i)
set L = AddLightningEx("HLFX",false,xt,yt,GetTerrainZ(xt,yt)+600.,x,y,GetTerrainZ(x,y)+750.)
//call SetLightningColor(L,128,0,255,1.)
endif
set i = i + 1
endloop
set xt = GetRectCenterX(gg_rct_EredarsTeleport)
set yt = GetRectCenterY(gg_rct_EredarsTeleport)
set L = AddLightningEx("HLFX",false,x,y,GetTerrainZ(x,y)+750.,xt,yt,GetTerrainZ(xt,yt)+225.)
//call SetLightningColor(L,128,0,255,1.)
call SaveReal(udg_hash,GetHandleId(t),1,xt)
call SaveReal(udg_hash,GetHandleId(t),2,yt)
call SaveInteger(udg_hash,GetHandleId(t),3,0)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveGroupHandle(udg_hash,GetHandleId(t),5,CreateGroup())
call SaveReal(udg_hash,GetHandleId(t),6,0.)
call SaveReal(udg_hash,GetHandleId(t),7,10.)
call SaveReal(udg_hash,GetHandleId(t),8,10.)
call TimerStart(t,0.04,true,function onTimerCreateEredarPortal)
set L = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,PORTAL_TIMER)
call TriggerAddAction(t,function onTimerExpired)
set WAVES_BASE[1] = 'n001'
set WAVES_BASE[2] = 'n004'
set WAVES_BASE[3] = 'n006'
set WAVES_CHAMP[1] = 'n000'
set WAVES_CHAMP[2] = 'n005'
set WAVES_CHAMP[3] = 'n007'
set WAVES_CHAMP[4] = 'n00P'
set WAVES_CHAMP[5] = 'n00Q'
set WAVES_CHAMP[6] = 'n00R'
/*
set CHAMP_ABILS[1] = 'A00O'
set CHAMP_ABILS[2] = 'A016'
set CHAMP_ABILS[3] = 'A00Q'
*/
set CHAMP_ABILS[1] = 'A00O'
set CHAMP_ABILS[2] = 'A09N'
set CHAMP_ABILS[3] = 'A00Q'
set WAVES_SPECIAL[1] = 'N00S'
set WAVES_SPECIAL[2] = 'N00U'
set WAVES_SPECIAL[3] = 'N00V'
set TREE[1] = CreateUnit(Player(9),ELDER_TREE_ID,GetRectCenterX(gg_rct_ElderTreeLeftTop),GetRectCenterY(gg_rct_ElderTreeLeftTop),290.)
set TREE[2] = CreateUnit(Player(9),ELDER_TREE_ID,GetRectCenterX(gg_rct_ElderTreeLeftBot),GetRectCenterY(gg_rct_ElderTreeLeftBot),0.)
set TREE[3] = CreateUnit(Player(9),ELDER_TREE_ID,GetRectCenterX(gg_rct_ElderTreeRightTop),GetRectCenterY(gg_rct_ElderTreeRightTop),290.)
set TREE[4] = CreateUnit(Player(9),ELDER_TREE_ID,GetRectCenterX(gg_rct_ElderTreeRightBot),GetRectCenterY(gg_rct_ElderTreeRightBot),250.)
set SHIFT_ANGLES[1] = bj_DEGTORAD*290.
set SHIFT_ANGLES[2] = bj_DEGTORAD*0.
set SHIFT_ANGLES[3] = bj_DEGTORAD*290.
set SHIFT_ANGLES[4] = bj_DEGTORAD*250.
set LEAVES[1] = CreateUnit(Player(9),LEAVES_ID,GetRectCenterX(gg_rct_ElderTreeLeftTop),GetRectCenterY(gg_rct_ElderTreeLeftTop),0.)
set LEAVES[2] = CreateUnit(Player(9),LEAVES_ID,GetRectCenterX(gg_rct_ElderTreeLeftBot),GetRectCenterY(gg_rct_ElderTreeLeftBot),0.)
set LEAVES[3] = CreateUnit(Player(9),LEAVES_ID,GetRectCenterX(gg_rct_ElderTreeRightTop),GetRectCenterY(gg_rct_ElderTreeRightTop),0.)
set LEAVES[4] = CreateUnit(Player(9),LEAVES_ID,GetRectCenterX(gg_rct_ElderTreeRightBot),GetRectCenterY(gg_rct_ElderTreeRightBot),0.)
set MOONWELL_LEFT = CreateUnit(Player(9),MOON_WELL_ID,GetRectCenterX(gg_rct_MoonWellLeft),GetRectCenterY(gg_rct_MoonWellLeft),0.)
set MOONWELL_RIGHT = CreateUnit(Player(9),MOON_WELL_ID,GetRectCenterX(gg_rct_MoonWellRight),GetRectCenterY(gg_rct_MoonWellRight),250.)
set TREE_HP[1] = TREE_INITIAL_HP
set TREE_HP[2] = TREE_INITIAL_HP
set TREE_HP[3] = TREE_INITIAL_HP
set TREE_HP[4] = TREE_INITIAL_HP
set LAST_TREE_MAX_HP = TREE_INITIAL_HP
set TREE_CUR_MAX_HP = TREE_INITIAL_HP
set t = null
endfunction
endlibrary
scope Chapter3TeleportMechanics initializer onInit
globals
private constant real TELEPORT_COOLDOWN = 10.
private constant real JUMP_DURATION = 0.75
private constant integer ABILCODE = 'A08G'
private constant integer BUFFCODE = 'B02H'
private constant string EFFECT = "Windwalk Blue Soul.mdx"
private real array ANGLES[10]
private real array HEIGHTS[10]
private real array DIST[10]
private real array Xp[11]
private real array Yp[11]
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return ( (not EREDAR_PORTAL_INITIALIZED) or ( EREDAR_PORTAL_INITIALIZED and EREDARS_SUMMONED)) and (not IsUnitInGroup(udg_Heroes[i],AFFECTED))
endif
set i = i + 1
endloop
return false
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit HERO = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,HERO)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set HERO = null
endfunction
private function onTimerMoveHero takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit HERO = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer k = LoadInteger(udg_hash,GetHandleId(t),2)
local boolean FromLeft = LoadBoolean(udg_hash,GetHandleId(t),3)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),5)
local real h = 0.
local real hH = 0.
local real angle = 0.
if FromLeft then
set h = DIST[k] / (25*JUMP_DURATION)
set hH = HEIGHTS[k] / (25*JUMP_DURATION)
set angle = ANGLES[k]
else
set h = DIST[k] / (25*JUMP_DURATION)
set hH = -HEIGHTS[k] / (25*JUMP_DURATION)
if ANGLES[k] < 180. then
set angle = ANGLES[k] + 180.
else
set angle = ANGLES[k] - 180.
endif
endif
if Elapsed < 0.04 then
call SetUnitFacing(HERO,angle)
endif
call SetUnitX(HERO,GetUnitX(HERO)+h*Cos(Deg2Rad(angle)))
call SetUnitY(HERO,GetUnitY(HERO)+h*Sin(Deg2Rad(angle)))
call SetUnitFlyHeight(HERO,GetUnitFlyHeight(HERO)+hH,0.)
set Elapsed = Elapsed + 0.04
if Elapsed >= JUMP_DURATION then
if FromLeft then
set k = k + 1
else
set k = k - 1
endif
set Elapsed = 0.
endif
if k<=0 or k>= 10 then
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),4))
call UnitRemoveAbility(HERO,ABILCODE)
call UnitRemoveAbility(HERO,BUFFCODE)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call BlzPauseUnitEx(HERO,false)
call SetUnitAnimation(HERO,"stand")
call IssueImmediateOrder(HERO,"stop")
call SetUnitTimeScale(HERO,1.)
if (not (GetUnitAbilityLevel(HERO,'A085')>0.)) then
call SetUnitPathing(HERO,true)
endif
else
call SaveInteger(udg_hash,GetHandleId(t),2,k)
call SaveReal(udg_hash,GetHandleId(t),5,Elapsed)
endif
set HERO = null
set t = null
endfunction
private function onEnter takes nothing returns nothing
local unit HERO = GetTriggerUnit()
local timer t = CreateTimer()
local real d = SquareRoot( (GetUnitX(HERO)-GetRectCenterX(gg_rct_TeleportLeft))*(GetUnitX(HERO)-GetRectCenterX(gg_rct_TeleportLeft)) + (GetUnitY(HERO)-GetRectCenterY(gg_rct_TeleportLeft))*(GetUnitY(HERO)-GetRectCenterY(gg_rct_TeleportLeft)))
local boolean FromLeft = d < 500.
local integer k = 1
local integer p = 1
local timer t1 = CreateTimer()
call UnitAddAbility(HERO,'Aave')
call UnitRemoveAbility(HERO,'Aave')
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,HERO)
call GroupAddUnit(AFFECTED,HERO)
call UnitAddAbility(HERO,ABILCODE)
call TimerStart(t1,TELEPORT_COOLDOWN+9*JUMP_DURATION,false,function onTimerRemoveAffect)
if not FromLeft then
set k = 9
endif
call BlzPauseUnitEx(HERO,true)
call SetUnitTimeScale(HERO,0.5)
call SetUnitPathing(HERO,false)
loop
exitwhen p > udg_HeroCount
if GetUnitTypeId(HERO)==udg_Hero[p] then
call SetUnitAnimationByIndex(HERO,HERO_WALK_INDEX[p])
endif
set p = p + 1
endloop
call SaveUnitHandle(udg_hash,GetHandleId(t),1,HERO)
call SaveInteger(udg_hash,GetHandleId(t),2,k)
call SaveBoolean(udg_hash,GetHandleId(t),3,FromLeft)
call SaveEffectHandle(udg_hash,GetHandleId(t),4,AddSpecialEffectTarget(EFFECT, HERO, "chest"))
call SaveReal(udg_hash,GetHandleId(t),5,0.)
call TimerStart(t,0.04,true,function onTimerMoveHero)
set HERO = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
call TriggerRegisterEnterRectSimple( t, gg_rct_TeleportLeft )
call TriggerRegisterEnterRectSimple( t, gg_rct_TeleportRight )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set Xp[1] = -8212.9
set Xp[2] = -7868.6
set Xp[3] = -7402.3
set Xp[4] = -7052.3
set Xp[5] = -6742.2
set Xp[6] = -6565.9
set Xp[7] = -6269.6
set Xp[8] = -5930.1
set Xp[9] = -5552.0
set Xp[10] = -5207.8
set Yp[1] = 8735.4
set Yp[2] = 8802.1
set Yp[3] = 8748.7
set Yp[4] = 8940.9
set Yp[5] = 9136.1
set Yp[6] = 9475.0
set Yp[7] = 9753.2
set Yp[8] = 9948.7
set Yp[9] = 10041.3
set Yp[10] = 10166.4
set i = 1
loop
exitwhen i>=10
set ANGLES[i] = Rad2Deg(Atan2( Yp[i+1]-Yp[i],Xp[i+1]-Xp[i] ))
set DIST[i] = SquareRoot( (Xp[i+1]-Xp[i])*(Xp[i+1]-Xp[i]) + (Yp[i+1]-Yp[i])*(Yp[i+1]-Yp[i]) )
set i = i + 1
endloop
set HEIGHTS[1] = 600.
set HEIGHTS[2] = 0.
set HEIGHTS[3] = 0.
set HEIGHTS[4] = 0.
set HEIGHTS[5] = 0.
set HEIGHTS[6] = 0.
set HEIGHTS[7] = 0.
set HEIGHTS[8] = 0.
set HEIGHTS[9] = -600.
set t = null
endfunction
endscope
scope BurnTreeFaceless initializer onInit
globals
private constant integer ABILCODE = 'A00Q'
private constant integer DUMMY_CODE = 'h02U'
private constant integer ISPREVENTED_HASH = 201
private constant real TICK_PERIOD = 1.
private constant real DOT_DURATION = 30.
private constant string CASTER_EFFECT = "Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl"
private constant string CASTER_ATTACH = "hand right"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local integer k = LoadInteger(udg_hash,GetHandleId(t),5)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
set elapsed = elapsed + 0.04
if elapsed >= TICK_PERIOD and k>0 then
call TreeAddDot(k, DOT_DURATION)
set elapsed = 0.
endif
call SaveReal(udg_hash,GetHandleId(t),4,elapsed)
if ISPREVENTED then
//call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),2))
call KillUnit(LoadUnitHandle(udg_hash,GetHandleId(t),3))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local integer k = 0
local real dist = 0
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit tree = null
local integer j = 1
local unit FIRE = CreateUnit(GetOwningPlayer(CASTER),DUMMY_CODE,GetSpellTargetX(),GetSpellTargetY(),0.)
//call DisplayTextToForce( GetPlayersAll(), GetUnitName(CASTER) + " ordered id: " + I2S(GetUnitCurrentOrder(CASTER)))
loop
exitwhen j>4
set tree = GetTreeByIndex(j)
set dist = SquareRoot( (GetUnitX(tree)-x)*(GetUnitX(tree)-x) + (GetUnitY(tree)-y)*(GetUnitY(tree)-y) )
if dist < 500. then
set k = j
endif
set j = j + 1
endloop
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveEffectHandle(udg_hash,GetHandleId(t),2,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveUnitHandle(udg_hash,GetHandleId(t),3,FIRE)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveInteger(udg_hash,GetHandleId(t),5,k)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set FIRE = null
set tree = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope BurnTreeWalker initializer onInit
globals
private constant integer ABILCODE = 'A00O'
private constant integer DUMMY_CODE = 'h02V'
private constant integer BLOW_CODE = 'h02W'
private constant integer ISPREVENTED_HASH = 201
private constant real TICK_PERIOD = 0.9
private constant real DOT_DURATION = 60.
private constant string CASTER_EFFECT = "Abilities\\Spells\\Items\\OrbDarkness\\OrbDarkness.mdl"
private constant string CASTER_ATTACH = "hands"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local unit FIRE = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local integer k = LoadInteger(udg_hash,GetHandleId(t),5)
set elapsed = elapsed + 0.04
if elapsed >= TICK_PERIOD then
if k>0 then
call TreeAddDot(k, DOT_DURATION)
endif
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(CASTER),BLOW_CODE,GetUnitX(FIRE),GetUnitY(FIRE),0.), 'BHwe', 2.)
set elapsed = 0.
endif
call SaveReal(udg_hash,GetHandleId(t),4,elapsed)
if ISPREVENTED then
//call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),2))
call KillUnit(FIRE)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
set FIRE = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local unit FIRE = CreateUnit(GetOwningPlayer(CASTER),DUMMY_CODE,GetSpellTargetX(),GetSpellTargetY(),0.)
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local integer j = 1
local integer k = 0
local unit tree = null
local real dist = 0.
//call DisplayTextToForce( GetPlayersAll(), GetUnitName(CASTER) + " ordered id: " + I2S(GetUnitCurrentOrder(CASTER)))
loop
exitwhen j>4
set tree = GetTreeByIndex(j)
set dist = SquareRoot( (GetUnitX(tree)-x)*(GetUnitX(tree)-x) + (GetUnitY(tree)-y)*(GetUnitY(tree)-y) )
if dist < 500. then
set k = j
endif
set j = j + 1
endloop
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveEffectHandle(udg_hash,GetHandleId(t),2,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveUnitHandle(udg_hash,GetHandleId(t),3,FIRE)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveInteger(udg_hash,GetHandleId(t),5,k)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set FIRE = null
set t = null
set tree = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope BurnTreeArsonist initializer onInit
globals
private constant integer ABILCODE = 'A09N'//'A016'
private constant integer DUMMY_CODE = 'h02X'
private constant integer BLOW_CODE = 'h025'
private constant real FIRE_DURATION = 15.
private constant real GROWTH_MAX_MULTIPLIER = 2.
private constant real PROJECTIVE_FLYING_TIME = 2.
private constant real TIMER_TICK_PER_SECOND = 5.
private constant real DOT_DURATION = 60.
private constant real BLOW_TREE_DAMAGE = 10.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real ST_X = LoadReal(udg_hash,GetHandleId(t),2)
local real ST_Y = LoadReal(udg_hash,GetHandleId(t),3)
local real curScale = LoadReal(udg_hash,GetHandleId(t),4)
local real speed = LoadReal(udg_hash,GetHandleId(t),5)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),6) + 1./TIMER_TICK_PER_SECOND
local real scale = GROWTH_MAX_MULTIPLIER/(PROJECTIVE_FLYING_TIME*TIMER_TICK_PER_SECOND) * elapsed * TIMER_TICK_PER_SECOND
local real C_X = LoadReal(udg_hash,GetHandleId(t),7)
local real C_Y = LoadReal(udg_hash,GetHandleId(t),8)
local integer k = LoadInteger(udg_hash,GetHandleId(t),9)
local real h = speed * (elapsed * TIMER_TICK_PER_SECOND)
local real angle = Atan2( ST_Y-C_Y, ST_X-C_X )
local unit tempu = null
set tempu = CreateUnit(GetOwningPlayer(CASTER),BLOW_CODE,C_X+h*Cos(angle),C_Y+h*Sin(angle),0.)
call SetUnitScale(tempu,1+scale,1+scale,1+scale)
call KillUnit(tempu)
call SaveReal(udg_hash,GetHandleId(t),6,elapsed)
if elapsed >= PROJECTIVE_FLYING_TIME then
//call SetUnitTimeScale(CASTER,1.)
if k>0 then
call TreeDealDamage(k,BLOW_TREE_DAMAGE)
call TreeAddDot(k, DOT_DURATION)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
set tempu = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local unit FIRE = CreateUnit(GetOwningPlayer(CASTER),DUMMY_CODE,GetUnitX(CASTER),GetUnitY(CASTER),0.)
local real dist = SquareRoot((GetUnitX(CASTER)-GetSpellTargetX())*(GetUnitX(CASTER)-GetSpellTargetX()) + (GetUnitY(CASTER)-GetSpellTargetY())*(GetUnitY(CASTER)-GetSpellTargetY()))
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local integer j = 1
local integer k = 0
local unit tree = null
local real distT = 0.
call GroupAddUnit(WATER_CLEANSING_DUMMIES,FIRE)
//call DisplayTextToForce( GetPlayersAll(), GetUnitName(CASTER) + " ordered id: " + I2S(GetUnitCurrentOrder(CASTER)))
loop
exitwhen j>4
set tree = GetTreeByIndex(j)
set distT = SquareRoot( (GetUnitX(tree)-x)*(GetUnitX(tree)-x) + (GetUnitY(tree)-y)*(GetUnitY(tree)-y) )
if distT < 500. then
set k = j
endif
set j = j + 1
endloop
call UnitApplyTimedLife(FIRE, 'BHwe', FIRE_DURATION)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2, GetSpellTargetX())
call SaveReal(udg_hash,GetHandleId(t),3, GetSpellTargetY())
call SaveReal(udg_hash,GetHandleId(t),4, 1.)
call SaveReal(udg_hash,GetHandleId(t),5, dist/(PROJECTIVE_FLYING_TIME*TIMER_TICK_PER_SECOND))
call SaveReal(udg_hash,GetHandleId(t),6,0.)
call SaveReal(udg_hash,GetHandleId(t),7,GetUnitX(CASTER))
call SaveReal(udg_hash,GetHandleId(t),8,GetUnitY(CASTER))
call SaveInteger(udg_hash,GetHandleId(t),9,k)
call TimerStart(t,1/TIMER_TICK_PER_SECOND,true,function onTimer)
set CASTER = null
set FIRE = null
set tree = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope AttackTreeMelee initializer onInit
globals
private constant integer ABILCODE = 'A060'
private constant integer ISPREVENTED_HASH = 201
private constant real ATTACK_PERIOD = 1.
private constant real TREE_DAMAGE_PER_ATTACK = 2.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),2)
local integer k = LoadInteger(udg_hash,GetHandleId(t),3)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
set elapsed = elapsed + 0.04
if elapsed >= ATTACK_PERIOD and k>0 then
call TreeDealDamage(k,TREE_DAMAGE_PER_ATTACK)
set elapsed = 0.
endif
call SaveReal(udg_hash,GetHandleId(t),2,elapsed)
if ISPREVENTED then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local integer k = 0
local real dist = 0
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit tree = null
local integer j = 1
//call DisplayTextToForce( GetPlayersAll(), GetUnitName(CASTER) + " ordered id: " + I2S(GetUnitCurrentOrder(CASTER)))
loop
exitwhen j>4
set tree = GetTreeByIndex(j)
set dist = SquareRoot( (GetUnitX(tree)-x)*(GetUnitX(tree)-x) + (GetUnitY(tree)-y)*(GetUnitY(tree)-y) )
if dist < 500. then
set k = j
endif
set j = j + 1
endloop
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call SaveInteger(udg_hash,GetHandleId(t),3,k)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set tree = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope AttackTreeRanged initializer onInit
globals
private constant integer ABILCODE = 'A061'
private constant integer ISPREVENTED_HASH = 201
private constant real ATTACK_PERIOD = 1.
private constant real TREE_DAMAGE_PER_ATTACK = 2.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),2)
local integer k = LoadInteger(udg_hash,GetHandleId(t),3)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
set elapsed = elapsed + 0.04
if elapsed >= ATTACK_PERIOD and k>0 then
call TreeDealDamage(k,TREE_DAMAGE_PER_ATTACK)
set elapsed = 0.
endif
call SaveReal(udg_hash,GetHandleId(t),2,elapsed)
if ISPREVENTED then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local integer k = 0
local real dist = 0
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit tree = null
local integer j = 1
//call DisplayTextToForce( GetPlayersAll(), GetUnitName(CASTER) + " ordered id: " + I2S(GetUnitCurrentOrder(CASTER)))
loop
exitwhen j>4
set tree = GetTreeByIndex(j)
set dist = SquareRoot( (GetUnitX(tree)-x)*(GetUnitX(tree)-x) + (GetUnitY(tree)-y)*(GetUnitY(tree)-y) )
if dist < 500. then
set k = j
endif
set j = j + 1
endloop
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call SaveInteger(udg_hash,GetHandleId(t),3,k)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set tree = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
library Chapter3Defeat initializer onInit requires EredarsVoid
private function Conds takes nothing returns boolean
return GetTriggerUnit() == CENARIUS
endfunction
private function Acts takes nothing returns nothing
local integer i = 1
loop
exitwhen i > udg_PlayerCount
call CustomDefeatBJ( udg_Players[i], "Cenarius is dead. You lost!" )
set i = i + 1
endloop
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function Acts )
set t = null
endfunction
endlibrary
scope PitLordsActions initializer onInit
globals
group PIT_LORD_GROUP = CreateGroup()
timer PIT_LORD_TIMER = CreateTimer()
private constant integer ORDER_HASH = 210
private constant real RESET_ORDER_PERIOD = 3.
private constant integer HELLFIRE_PORTAL = 'A068'
private constant string HELLFIRE_ORDER = "flare"
private constant integer CHARGE = 'A064'
private constant string CHARGE_ORDER = "firebolt"
private constant integer FELHAMMER = 'A066'
private constant string FELHAMMER_ORDER = "flamestrike"
private integer PIT_LORDS_KILLED = 0
private constant real CHARGE_DIST = 1200.
private constant real HERO_LOOKING_AOE = 3000.
private constant string TALK2 = "We have survived the invasion. Now it is our chance to smash the Eredar commanders in their lair, before the Legion forces regroup for the new strike. I will use the remainded powers of this place to open the portal."
endglobals
private function onTimerResetOrder takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call SaveBoolean(udg_hash,GetHandleId(u),ORDER_HASH,false)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function GetHeroMaxDist takes unit u returns unit
local integer i = 1
local real dist = 0.
local real maxD = 0.
local unit hero = null
loop
exitwhen i>udg_PlayerCount
if not IsUnitDeadBX(udg_Heroes[i]) then
set dist = SquareRoot( (GetUnitX(u)-GetUnitX(udg_Heroes[i]))*(GetUnitX(u)-GetUnitX(udg_Heroes[i])) + (GetUnitY(u)-GetUnitY(udg_Heroes[i]))*(GetUnitY(u)-GetUnitY(udg_Heroes[i])) )
if (dist > maxD) and (dist <= CHARGE_DIST) then
set hero = udg_Heroes[i]
set maxD = dist
endif
endif
set i = i + 1
endloop
return hero
endfunction
private function GetHeroMinDist takes unit u returns unit
local integer i = 1
local real dist = 0.
local real minD = HERO_LOOKING_AOE
local unit hero = null
loop
exitwhen i>udg_PlayerCount
if not IsUnitDeadBX(udg_Heroes[i]) then
set dist = SquareRoot( (GetUnitX(u)-GetUnitX(udg_Heroes[i]))*(GetUnitX(u)-GetUnitX(udg_Heroes[i])) + (GetUnitY(u)-GetUnitY(udg_Heroes[i]))*(GetUnitY(u)-GetUnitY(udg_Heroes[i])) )
if (dist < minD) then
set hero = udg_Heroes[i]
set minD = dist
endif
endif
set i = i + 1
endloop
return hero
endfunction
private function MakePitLordsCast takes nothing returns nothing
local unit u = GetEnumUnit()
local timer t = null
local boolean found = false
local unit hero = null
if IsUnitDeadBX(u) then
call GroupRemoveUnit(PIT_LORD_GROUP,u)
if IsUnitType(u,UNIT_TYPE_HERO) then
set PIT_LORDS_KILLED = PIT_LORDS_KILLED + 1
call DisplayTextToForce( GetPlayersAll(), "|cff80ff80High Commanders|r killed: |cff80ff80" + I2S(PIT_LORDS_KILLED) +"|r/"+ I2S(SPECIAL_WAVES_MAX_COUNT))
if PIT_LORDS_KILLED >= SPECIAL_WAVES_MAX_COUNT then
set ALL_COMMANDERS_DEAD = true
call DestroyTimer(PORTAL_TIMER)
call CreateTreeLightnings()
call SetCinematicScene('E000',null,"Cenarius",TALK2,15.,15.)
endif
endif
else
if not LoadBoolean(udg_hash,GetHandleId(u),ORDER_HASH) then
if GetUnitAbilityLevel(u,HELLFIRE_PORTAL) > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,HELLFIRE_PORTAL) <= 0. then
set found = true
call IssueImmediateOrder(u,HELLFIRE_ORDER)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Order found: Hellfire Portal")
endif
endif
if GetUnitAbilityLevel(u,CHARGE) > 0 and not found then
if BlzGetUnitAbilityCooldownRemaining(u,CHARGE) <= 0. then
set hero = GetHeroMaxDist(u)
if not (IsUnitDeadBX(hero)) then
set found = true
call IssueTargetOrder(u,CHARGE_ORDER,hero)
set hero = null
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Order found: Charge")
endif
endif
endif
if GetUnitAbilityLevel(u,FELHAMMER) > 0 and not found and not(Aggro.target(u)==null) then
if BlzGetUnitAbilityCooldownRemaining(u,FELHAMMER) <= 0. then
set found = true
call IssueImmediateOrder(u,FELHAMMER_ORDER)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Order found: Felhammer")
endif
endif
if not found then
if IsUnitDeadBX(Aggro.target(u)) then
set hero = GetHeroMinDist(u)
if not (IsUnitDeadBX(hero)) then
call IssueTargetOrder(u,"attack",hero)
set hero = null
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Order found: Attack player hero")
else
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Order found: Attack Cenarius")
call IssueTargetOrder(u,"attack",CENARIUS)
endif
set found = true
endif
endif
if found then
set t = CreateTimer()
call SaveBoolean(udg_hash,GetHandleId(u),ORDER_HASH,true)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,RESET_ORDER_PERIOD,false,function onTimerResetOrder)
set t = null
endif
endif
endif
set u = null
endfunction
private function onTimerExpired takes nothing returns nothing
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Ordering Pit Lords to Cast")
call ForGroup(PIT_LORD_GROUP,function MakePitLordsCast)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,PIT_LORD_TIMER)
call TriggerAddAction(t,function onTimerExpired)
set t = null
endfunction
endscope
//TESH.scrollpos=23
//TESH.alwaysfold=0
scope PitLordCharge initializer onInit
globals
private constant integer FEL_GROUND_CODE = 'h036'
private constant integer BOULDER_CODE = 'h035'
private constant integer ABILCODE = 'A064'
private constant real FEL_GROUND_DIFFICULTY_DURATION = 30.
private constant real FEL_GROUND_DURATION = 30.
private constant real FEL_GROUND_DIST = 190.
private constant real SPEED = 400
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and not(IsUnitInGroup(GetFilterUnit(),AFFECTED)) and not (GetFilterUnit()==CENARIUS)
endfunction
private function onTimerWalk takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit CASTER = LoadUnitHandle(udg_hash,id,1)
local real XSpeed = LoadReal(udg_hash,id,2)
local real YSpeed = LoadReal(udg_hash,id,3)
local real duration = LoadReal(udg_hash,id,4)
local real TIMEOUT = LoadReal(udg_hash,id,5)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local real x1 = GetUnitX(CASTER)
local real y1 = GetUnitY(CASTER)
local real x2 = LoadReal(udg_hash,id,6)
local real y2 = LoadReal(udg_hash,id,7)
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local real lastX = LoadReal(udg_hash,id,8)
local real lastY = LoadReal(udg_hash,id,9)
local real lastD = SquareRoot((x1-lastX)*(x1-lastX)+(y1-lastY)*(y1-lastY))
local real DAMAGE = 300. + SPELLPOWER
local unit temp = null
local boolexpr GROUPFILTER = Condition(function GroupFilter)
set TIMEOUT = TIMEOUT + 0.04
call SaveReal(udg_hash,id,5,TIMEOUT)
if GetRandomInt(1,3) == 1 then
set udg_temp_unit = CreateUnit(GetOwningPlayer(CASTER),BOULDER_CODE,GetUnitX(CASTER),GetUnitY(CASTER),0.)
call UnitApplyTimedLife(udg_temp_unit,'BHwe',0.5)
call ParKnock(udg_temp_unit,GetRandomReal(100.,200.),GetRandomReal(100.,200.),0.5,GetRandomReal(1.,360.),false,"none")
endif
call SetUnitX(CASTER,GetUnitX(CASTER)+XSpeed)
call SetUnitY(CASTER,GetUnitY(CASTER)+YSpeed)
call SetUnitFacing(CASTER,bj_RADTODEG*Atan2(y2-y1,x2-x1))
call IssuePointOrder(CASTER,"move",x2,y2)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(CASTER),GetUnitY(CASTER),250.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call DealEarthDamage(CASTER,udg_temp_unit,DAMAGE)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",udg_temp_unit,"chest"))
call ParKnock(udg_temp_unit,200.,200.,0.75,Atan2(GetUnitY(udg_temp_unit)-GetUnitY(CASTER),GetUnitX(udg_temp_unit)-GetUnitX(CASTER))*bj_RADTODEG,true,"")
call GroupAddUnit(AFFECTED,udg_temp_unit)
endloop
if lastD >= FEL_GROUND_DIST then
call SaveReal(udg_hash,id,8,x1)
call SaveReal(udg_hash,id,9,y1)
set temp = CreateUnit(GetOwningPlayer(CASTER),FEL_GROUND_CODE,x1,y1,0.)
call UnitApplyTimedLife(temp,'BHwe',FEL_GROUND_DURATION + CURRENT_DIFFICULTY*FEL_GROUND_DIFFICULTY_DURATION)
call GroupAddUnit(WATER_CLEANSING_DUMMIES,temp)
call GroupAddUnit(DPS_GROUP,temp)
call FlushChildHashtable(udg_hash,GetHandleId(temp))
call SaveReal(udg_hash,GetHandleId(temp),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash()))
set temp = null
endif
if TIMEOUT >= duration or dist <= 150. then
//call PauseUnit(CASTER,false)
call SetUnitTimeScale(CASTER,1.)
call SetUnitPathing(CASTER,true)
call GroupClear(AFFECTED)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local real x1 = GetUnitX(CASTER)
local real x2 = GetUnitX(TARGET)
local real y1 = GetUnitY(CASTER)
local real y2 = GetUnitY(TARGET)
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local real angle = Atan2(y2-y1,x2-x1)
local real XSpeed = (SPEED/25.) * Cos(angle)
local real YSpeed = (SPEED/25.) * Sin(angle)
local real duration = (dist - 150.) / 300.
call SetUnitPathing(CASTER,false)
call SetUnitTimeScale(CASTER,2.5)
call IssuePointOrder(CASTER,"move",x2,y2)
//call PauseUnit(CASTER,true)
call SaveUnitHandle(udg_hash,id,1,CASTER)
call SaveReal(udg_hash,id,2,XSpeed)
call SaveReal(udg_hash,id,3,YSpeed)
call SaveReal(udg_hash,id,4,duration)
call SaveReal(udg_hash,id,6,x2)
call SaveReal(udg_hash,id,7,y2)
call SaveReal(udg_hash,id,8,x1)
call SaveReal(udg_hash,id,9,y1)
call TimerStart(t,0.04,true,function onTimerWalk)
set CASTER = null
set TARGET = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope PitLordFelHammer initializer onInit
globals
private constant integer ABILCODE = 'A066'
constant integer FELHAMMER_AURACODE = 'A067'
private constant integer SLAMANIM_CODE = 'A04C'
constant integer FELHAMMER_BUFFCODE = 'B01O'
constant real FELHAMMER_BONUSDAMAGE = 100.
constant real FELHAMMER_SPLASH = 1.
private constant integer WOLFSTUNCODE = 'A04E'
timer FELHAMMER_TIMER = CreateTimer()
private constant integer CHARGESHASH = 202
private constant integer DUMMY = 'h009'
private constant real AOE = 250.
private constant real WOLF_BONUS_MOVESPEED = 100.
private constant real MAXKNOCKBACK = 250.
private constant real MAXHEIGHTKNOCKBACK = 75.
private constant real DURATIONKNOCKBACK = 0.15
private constant real BUFFDURATION = 10.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0. and not (GetFilterUnit()==CENARIUS)
endfunction
//On Pit Lord's attack
private function onTimerExpired takes nothing returns nothing
local timer t = FELHAMMER_TIMER
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local group g = CreateGroup()
local unit tempu = null
local real dist = 0.
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local integer CHARGES = LoadInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH)
//local unit udummy = CreateUnit(GetOwningPlayer(CASTER),DUMMY,xt,yt,0.)
set CHARGES = CHARGES - 1
//call UnitAddAbility(udummy,WOLFSTUNCODE)
//call IssueImmediateOrder(udummy,"stomp")
//call UnitApplyTimedLife(udummy,'BHwe',0.5)
//set udummy = null
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if (xt-x)*(GetUnitX(tempu)-x)+(yt-y)*(GetUnitY(tempu)-y) >= 0 then
set dist = SquareRoot( (x-GetUnitX(tempu))*(x-GetUnitX(tempu))+(y-GetUnitY(tempu))*(y-GetUnitY(tempu)) )
if dist <= MAXKNOCKBACK then
//call SetUnitAnimation(tempu,"death")
call ParKnock(tempu,MAXHEIGHTKNOCKBACK*(1-dist/MAXKNOCKBACK),MAXKNOCKBACK-dist,DURATIONKNOCKBACK,Rad2Deg(Atan2(GetUnitY(tempu)-y,GetUnitX(tempu)-x)),true,"Abilities\\Weapons\\DemonHunterMissile\\DemonHunterMissile.mdl")
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if CHARGES <=0 then
call UnitRemoveAbility(CASTER,SLAMANIM_CODE)
call UnitRemoveAbility(CASTER,FELHAMMER_AURACODE)
call UnitRemoveAbility(CASTER,FELHAMMER_BUFFCODE)
else
call SaveInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
set t = null
set CASTER = null
set TARGET = null
set g = null
endfunction
private function onBuffExpires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local timer t1 = null
if GetUnitAbilityLevel(CASTER,FELHAMMER_AURACODE) > 0 then
call UnitRemoveAbility(CASTER,SLAMANIM_CODE)
call UnitRemoveAbility(CASTER,FELHAMMER_AURACODE)
call UnitRemoveAbility(CASTER,FELHAMMER_BUFFCODE)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = null
local integer CHARGES = 3
//Give Pit Lord attack charges
call SaveInteger(udg_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
//Give Pit Lord attack slam animation
call UnitAddAbility(CASTER,SLAMANIM_CODE)
//Give Pit Lord Buff
call UnitAddAbility(CASTER,FELHAMMER_AURACODE)
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,BUFFDURATION,false,function onBuffExpires)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
call TriggerRegisterTimerExpireEvent(t1,FELHAMMER_TIMER)
call TriggerAddAction(t1,function onTimerExpired)
set t = null
set t1 = null
endfunction
endscope
scope PitLordHellfirePortal initializer onInit
globals
private constant integer ABILCODE = 'A068'
private constant integer SUMMON_CODE = 'n00T'
private constant real AOE = 200.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer i = 1
local real angle = 0.
local unit tempu = null
loop
exitwhen i>udg_PlayersInGame
set angle = GetRandomReal(0., 2*3.14)
set tempu = CreateUnit(GetOwningPlayer(CASTER),SUMMON_CODE, GetUnitX(CASTER)+AOE*Cos(angle), GetUnitY(CASTER)+AOE*Sin(angle),0.)
call Aggro.new(tempu)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DarkSummoning\\DarkSummonMissile.mdl", tempu, "chest"))
call FadeUnitOut(tempu,2.,false)
call GroupAddUnit(PIT_LORD_GROUP,tempu)
set i = i + 1
endloop
set tempu = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope IslandEnterLocation initializer onInit
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return not (LoadInteger(udg_hash,GetHandleId(GetTriggerUnit()),CHAPTER_HERO_HASH)==4)
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
call SaveInteger(udg_hash,GetHandleId(GetTriggerUnit()),CHAPTER_HERO_HASH,4)
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
//call SetWaterBaseColor(240,230,140,255)
call SetWaterBaseColor(88,77,130,190)
//call SetWaterBaseColor(163,82,90,190)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_IslandBounds )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endscope
scope IslandDoorTrigger initializer onInit
globals
integer ISLAND_DEATHS_COUNT = 0
private constant integer DEATHS_LIMIT = 10
private boolean DOOR_OPENED = false
endglobals
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return (not DOOR_OPENED) and (ISLAND_DEATHS_COUNT >= DEATHS_LIMIT)
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
call SetDestructableAnimation(gg_dest_B00M_2596,"death")
call RemoveDestructable( gg_dest_YTpc_3053 )
call RemoveDestructable( gg_dest_YTpc_3054 )
call RemoveDestructable( gg_dest_YTpc_3055 )
set DOOR_OPENED = true
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_IslandDoor )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endscope
function Trig_Molten_Core_Teleport_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_Molten_Core_Teleport_Actions takes nothing returns nothing
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MoltenCoreIN)
call SetUnitPositionLoc( GetTriggerUnit(), udg_LeakPoint[1] )
call IssueImmediateOrder( GetTriggerUnit(), "stop" )
call RemoveLocation(udg_LeakPoint[1])
endfunction
//===========================================================================
function InitTrig_Molten_Core_Teleport takes nothing returns nothing
set gg_trg_Molten_Core_Teleport = CreateTrigger( )
call DisableTrigger( gg_trg_Molten_Core_Teleport )
call TriggerRegisterEnterRectSimple( gg_trg_Molten_Core_Teleport, gg_rct_LeftSpawn )
call TriggerAddCondition( gg_trg_Molten_Core_Teleport, Condition( function Trig_Molten_Core_Teleport_Conditions ) )
call TriggerAddAction( gg_trg_Molten_Core_Teleport, function Trig_Molten_Core_Teleport_Actions )
endfunction
function Trig_Molten_Core_Teleport_Back_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_Molten_Core_Teleport_Back_Actions takes nothing returns nothing
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MolterCoreOUT)
//call BoundPlayerUnitCameraToRect(GetTriggerUnit(),gg_rct_StartBOUNDS,true)
call SetUnitPosition(GetTriggerUnit(),GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect))
call SetUnitPositionLoc( GetTriggerUnit(), udg_LeakPoint[1] )
call IssueImmediateOrder( GetTriggerUnit(), "stop" )
call RemoveLocation(udg_LeakPoint[1])
endfunction
//===========================================================================
function InitTrig_Molten_Core_Teleport_Back takes nothing returns nothing
set gg_trg_Molten_Core_Teleport_Back = CreateTrigger( )
call DisableTrigger( gg_trg_Molten_Core_Teleport_Back )
call TriggerRegisterEnterRectSimple( gg_trg_Molten_Core_Teleport_Back, gg_rct_Molten_Core )
call TriggerAddCondition( gg_trg_Molten_Core_Teleport_Back, Condition( function Trig_Molten_Core_Teleport_Back_Conditions ) )
call TriggerAddAction( gg_trg_Molten_Core_Teleport_Back, function Trig_Molten_Core_Teleport_Back_Actions )
endfunction
scope MoltenCoreStartPreload initializer onInit
globals
private boolean MOLTEN_CORE_PRELOADED = false
private integer array MOLTEN_CORE_UNITS_PRELOAD
private integer MAX_N = 7
endglobals
private function onEnter takes nothing returns nothing
local integer i = 1
set MOLTEN_CORE_PRELOADED = true
loop
exitwhen i>MAX_N
call AddUnitToPreloadQueueById(MOLTEN_CORE_UNITS_PRELOAD[i])
set i = i + 1
endloop
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"Molten Core resources are added to the preload queue (required time: " + I2S(R2I(MAX_N*PRELOAD_TIMER_PERIOD)) + " seconds). Players may suffer freezes for a duration.")
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerUnit()==udg_Heroes[i] then
return not MOLTEN_CORE_PRELOADED
endif
set i = i + 1
endloop
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_MoltenCoreIN )
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction( t, function onEnter )
set MOLTEN_CORE_UNITS_PRELOAD[1] = 'h01Y' //Volcano
set MOLTEN_CORE_UNITS_PRELOAD[2] = 'h00K' //Magma Summoner
set MOLTEN_CORE_UNITS_PRELOAD[3] = 'h01Z' //Volcano Boulder
set MOLTEN_CORE_UNITS_PRELOAD[4] = 'h00G' //Magma Stone
set MOLTEN_CORE_UNITS_PRELOAD[5] = 'h00L' //Magma Fire
set MOLTEN_CORE_UNITS_PRELOAD[6] = 'h00J' //Magma Explosion
set MOLTEN_CORE_UNITS_PRELOAD[7] = 'n003' //Magma Elemental
set MAX_N = 7
set t = null
endfunction
endscope
function Trig_molten_core_ini_Actions takes nothing returns nothing
call MoltenCore(GetOwningPlayer(GetTriggerUnit()),255,94,54)
call EnableTrigger( gg_trg_magmaw_preload )
call EnableTrigger( gg_trg_magmaw_sumtimer )
endfunction
//===========================================================================
function InitTrig_molten_core_ini takes nothing returns nothing
set gg_trg_molten_core_ini = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_molten_core_ini, gg_rct_MoltenCoreIN )
call TriggerAddAction( gg_trg_molten_core_ini, function Trig_molten_core_ini_Actions )
endfunction
function Trig_magmaw_preload_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_magmaw_preload_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSum)
call EnablePreSelect(false,false)
call CreateNUnitsAtLoc( 1, 'U000', Player(7), udg_LeakPoint[1], 270.00 )
set udg_Magmaw = GetLastCreatedUnit()
call SaveReal(udg_hash,GetHandleId(udg_Magmaw),GetCritHash(),15.)
if CURRENT_DIFFICULTY >= 3 then
call SaveReal(udg_hash,GetHandleId(udg_Magmaw),GetSpellResistHash(),(CURRENT_DIFFICULTY-2)*0.1)
call SaveReal(udg_hash,GetHandleId(udg_Magmaw),GetSpellPowerHash(),(CURRENT_DIFFICULTY-2)*200.)
endif
call Aggro.new(udg_Magmaw)
call SetHeroLevelBJ( udg_Magmaw, 30, false )
call PauseUnitBJ( true, udg_Magmaw )
call SetUnitInvulnerable( udg_Magmaw, true )
call SetUnitTimeScalePercent( udg_Magmaw, 1000000000.00 )
call SetUnitFlyHeightBJ( udg_Magmaw, 2500.00, 0.00 )
call RemoveLocation(udg_LeakPoint[1])
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_magmaw_preload takes nothing returns nothing
set gg_trg_magmaw_preload = CreateTrigger( )
call DisableTrigger( gg_trg_magmaw_preload )
call TriggerRegisterEnterRectSimple( gg_trg_magmaw_preload, gg_rct_MagmawEnter )
call TriggerAddCondition( gg_trg_magmaw_preload, Condition( function Trig_magmaw_preload_Conditions ) )
call TriggerAddAction( gg_trg_magmaw_preload, function Trig_magmaw_preload_Actions )
endfunction
function Trig_magmaw_sumtimer_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_magmaw_sumtimer_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
call StartTimerBJ( udg_Magmawini_timer, false, 10.00 )
call ShowUnitHide( udg_Magmaw )
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_magmaw_sumtimer takes nothing returns nothing
set gg_trg_magmaw_sumtimer = CreateTrigger( )
call DisableTrigger( gg_trg_magmaw_sumtimer )
call TriggerRegisterEnterRectSimple( gg_trg_magmaw_sumtimer, gg_rct_MagmawBattlefield )
call TriggerAddCondition( gg_trg_magmaw_sumtimer, Condition( function Trig_magmaw_sumtimer_Conditions ) )
call TriggerAddAction( gg_trg_magmaw_sumtimer, function Trig_magmaw_sumtimer_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Magmaw_Ini_Wait4 takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
call SetUnitAnimation(udg_Magmaw, "stand")
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSum)
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
call ResetToGameCameraForPlayer(udg_Players[i],0.)
call BoundPlayerUnitCameraToRect(udg_Heroes[i],gg_rct_MagmawBattlefield,false)
call CreateFogModifierRadiusLocBJ( true, udg_Players[i], FOG_OF_WAR_VISIBLE, udg_LeakPoint[1], 2000.00 )
call PauseUnitBJ( false, udg_Heroes[i] )
call SetCameraFieldForPlayer(udg_Players[i],CAMERA_FIELD_ZOFFSET,LoadReal(udg_hash,GetHandleId(udg_Players[i]),1),1.)
//call SetCameraFieldForPlayer(udg_Players[i],CAMERA_FIELD_ROTATION,LoadReal(udg_hash,GetHandleId(udg_Players[i]),2),1.)
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 5
call PauseUnit(camera_u[i],false)
set i = i + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
call PauseUnit( udg_Magmaw, false )
call SetUnitInvulnerable( udg_Magmaw, false )
call SetUnitMoveSpeed( udg_Magmaw, -1.00 )
call DisableTrigger( gg_trg_Molten_Core_Teleport )
call StartTimerBJ( udg_Magmaw_Firebreath, false, 10.00 )
call StartTimerBJ( udg_Magmaw_Slam, false, 25.00 )
call StartTimerBJ( udg_Magmaw_Burrow, false, 60.00 )
set MAGMAW_BATTLE_INITIALIZED = true
set MAGMAW_SUMMONED = true
call EnableTrigger( gg_trg_Damage_Stone )
call DestroyTimer(t)
call EnablePreSelect(true,true)
set t = null
endfunction
function Magmaw_Ini_Wait3 takes nothing returns nothing
local timer t1 = GetExpiredTimer()
local timer t = CreateTimer()
call SetUnitAnimation( udg_Magmaw, "stand ready" )
call DestroyTimer(t1)
call TimerStart(t,5.00,false,function Magmaw_Ini_Wait4)
set t1 = null
set t = null
endfunction
function Magmaw_Ini_Wait2 takes nothing returns nothing
local timer t1 = GetExpiredTimer()
local timer t = CreateTimer()
call DisableTrigger( gg_trg_magmaw_summon_effect )
call PlaySoundOnUnitBJ( gg_snd_FrostwyrmPissed4, 100, udg_Magmaw )
call DestroyTimer(t1)
call TimerStart(t,3.50,false,function Magmaw_Ini_Wait3)
set t1 = null
set t = null
endfunction
function Magmaw_Ini_Wait1 takes nothing returns nothing
local timer t1 = GetExpiredTimer()
local timer t = CreateTimer()
local integer i = 1
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSum)
call EnableTrigger( gg_trg_magmaw_summon_effect )
loop
exitwhen i > udg_PlayerCount
call ResetToGameCameraForPlayer(udg_Players[i],0.)
call SetCameraTargetControllerNoZForPlayer( udg_Players[i], udg_Magmaw, 0, 125.00, false )
call CameraSetEQNoiseForPlayer( udg_Players[i], 6.00 )
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 5
call PauseUnit(camera_u[i],true)
set i = i + 1
endloop
call SetUnitTimeScale( udg_Magmaw, 0.40 )
call SetUnitAnimation( udg_Magmaw, "morph alternate" )
call RemoveLocation(udg_LeakPoint[1])
call DestroyTimer(t1)
call TimerStart(t,3.30,false,function Magmaw_Ini_Wait2)
set t = null
set t1 = null
endfunction
function Trig_magmaw_ini_Actions takes nothing returns nothing
local timer t = CreateTimer()
local integer i = 1
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 3.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSum)
loop
exitwhen i > udg_PlayerCount
set udg_LeakPoint[2] = PolarProjectionBJ(udg_LeakPoint[1], 400.00, ( 60.00 * I2R(i) ))
call SetUnitPositionLocFacingLocBJ( udg_Heroes[i], udg_LeakPoint[2], udg_LeakPoint[1] )
call PauseUnitBJ( true, udg_Heroes[i] )
call RemoveLocation(udg_LeakPoint[2])
set i = i + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
call ShowUnit( udg_Magmaw, true)
call SetUnitFlyHeightBJ( udg_Magmaw, -75.00, 0.00 )
call SetUnitAnimation( udg_Magmaw, "morph" )
call TimerStart(t,1.0,false,function Magmaw_Ini_Wait1)
set t = null
endfunction
//===========================================================================
function InitTrig_magmaw_ini takes nothing returns nothing
set gg_trg_magmaw_ini = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_magmaw_ini, udg_Magmawini_timer )
call TriggerAddAction( gg_trg_magmaw_ini, function Trig_magmaw_ini_Actions )
endfunction
function Trig_magmaw_summon_effect_Actions takes nothing returns nothing
set udg_MagS_Degree = ( udg_MagS_Degree + 20.00 )
set udg_MagS_Int = ( udg_MagS_Int + 100 )
set udg_LeakPoint[5] = GetUnitLoc(udg_Magmaw)
set udg_LeakPoint[6] = PolarProjectionBJ(udg_LeakPoint[5], I2R(udg_MagS_Int), udg_MagS_Degree)
set udg_LeakPoint[7] = PolarProjectionBJ(udg_LeakPoint[5], I2R(udg_MagS_Int), ( 180.00 + udg_MagS_Degree ))
set udg_LeakPoint[8] = PolarProjectionBJ(udg_LeakPoint[5], I2R(udg_MagS_Int), ( 90.00 + udg_MagS_Degree ))
set udg_LeakPoint[9] = PolarProjectionBJ(udg_LeakPoint[5], I2R(udg_MagS_Int), ( -90.00 + udg_MagS_Degree ))
call SetUnitFlyHeightBJ( udg_Magmaw, -75.00, 0.00 )
call AddSpecialEffectLocBJ( udg_LeakPoint[6], "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl" )
call DestroyEffectTimed(bj_lastCreatedEffect,6.)
call AddSpecialEffectLocBJ( udg_LeakPoint[7], "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl" )
call DestroyEffectTimed(bj_lastCreatedEffect,6.)
call AddSpecialEffectLocBJ( udg_LeakPoint[8], "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl" )
call DestroyEffectTimed(bj_lastCreatedEffect,6.)
call AddSpecialEffectLocBJ( udg_LeakPoint[9], "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl" )
call DestroyEffectTimed(bj_lastCreatedEffect,6.)
call SetTerrainTypeBJ( udg_LeakPoint[6], 'Dlvc', -1, 1, 0 )
call SetTerrainTypeBJ( udg_LeakPoint[7], 'Dlvc', -1, 1, 0 )
call SetTerrainTypeBJ( udg_LeakPoint[8], 'Dlvc', -1, 1, 0 )
call SetTerrainTypeBJ( udg_LeakPoint[9], 'Dlvc', -1, 1, 0 )
call RemoveLocation(udg_LeakPoint[5])
call RemoveLocation(udg_LeakPoint[6])
call RemoveLocation(udg_LeakPoint[7])
call RemoveLocation(udg_LeakPoint[8])
call RemoveLocation(udg_LeakPoint[9])
endfunction
//===========================================================================
function InitTrig_magmaw_summon_effect takes nothing returns nothing
set gg_trg_magmaw_summon_effect = CreateTrigger( )
call DisableTrigger( gg_trg_magmaw_summon_effect )
call TriggerRegisterTimerEventPeriodic( gg_trg_magmaw_summon_effect, 0.50 )
call TriggerAddAction( gg_trg_magmaw_summon_effect, function Trig_magmaw_summon_effect_Actions )
endfunction
scope StonecoreStartPreload initializer onInit
globals
private boolean STONECORE_PRELOADED = false
private integer array STONECORE_UNITS_PRELOAD
private integer MAX_N = 4
endglobals
private function onEnter takes nothing returns nothing
local integer i = 1
set STONECORE_PRELOADED = true
loop
exitwhen i>MAX_N
call AddUnitToPreloadQueueById(STONECORE_UNITS_PRELOAD[i])
set i = i + 1
endloop
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"Molten Core resources are added to the preload queue (required time: " + I2S(R2I(MAX_N*PRELOAD_TIMER_PERIOD)) + " seconds). Players may suffer freezes for a duration.")
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerUnit()==udg_Heroes[i] then
return not STONECORE_PRELOADED
endif
set i = i + 1
endloop
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_AbyssalHeroComing )
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction( t, function onEnter )
set STONECORE_UNITS_PRELOAD[1] = 'h03G' //Stonecore Jumber
set STONECORE_UNITS_PRELOAD[2] = 'h028' //Abyss Call Supremus
set STONECORE_UNITS_PRELOAD[3] = 'h01A' //Supremus Meteor Detector
set STONECORE_UNITS_PRELOAD[4] = 'h00S' //Supremus Bomb
set MAX_N = 4
set t = null
endfunction
endscope
function Trig_Stonecore_Teleport_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_Stonecore_Teleport_Actions takes nothing returns nothing
set udg_LeakPoint[1] = GetRectCenter(gg_rct_AbyssalHeroComing)
call SetUnitPositionLoc( GetTriggerUnit(), udg_LeakPoint[1] )
call RemoveLocation(udg_LeakPoint[1])
endfunction
//===========================================================================
function InitTrig_Stonecore_Teleport takes nothing returns nothing
set gg_trg_Stonecore_Teleport = CreateTrigger( )
call DisableTrigger( gg_trg_Stonecore_Teleport )
call TriggerRegisterEnterRectSimple( gg_trg_Stonecore_Teleport, gg_rct_StoneCoreEnter )
call TriggerAddCondition( gg_trg_Stonecore_Teleport, Condition( function Trig_Stonecore_Teleport_Conditions ) )
call TriggerAddAction( gg_trg_Stonecore_Teleport, function Trig_Stonecore_Teleport_Actions )
endfunction
function Trig_Stonecore_Teleport_Back_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_Stonecore_Teleport_Back_Actions takes nothing returns nothing
set udg_LeakPoint[1] = GetRectCenter(gg_rct_StoneCoreOUT)
call SetUnitPositionLoc( GetTriggerUnit(), udg_LeakPoint[1] )
call BoundPlayerUnitCameraToRect(GetTriggerUnit(),gg_rct_Act2BOUNDS,true)
call RemoveLocation(udg_LeakPoint[1])
endfunction
//===========================================================================
function InitTrig_Stonecore_Teleport_Back takes nothing returns nothing
set gg_trg_Stonecore_Teleport_Back = CreateTrigger( )
call DisableTrigger( gg_trg_Stonecore_Teleport_Back )
call TriggerRegisterEnterRectSimple( gg_trg_Stonecore_Teleport_Back, gg_rct_AbyssalBackTel )
call TriggerAddCondition( gg_trg_Stonecore_Teleport_Back, Condition( function Trig_Stonecore_Teleport_Back_Conditions ) )
call TriggerAddAction( gg_trg_Stonecore_Teleport_Back, function Trig_Stonecore_Teleport_Back_Actions )
endfunction
function Trig_stonecore_ini_Actions takes nothing returns nothing
call MoltenCore(GetOwningPlayer(GetTriggerUnit()),255,94,54)
call EnableTrigger( gg_trg_supremus_sumtimer )
endfunction
//===========================================================================
function InitTrig_stonecore_ini takes nothing returns nothing
set gg_trg_stonecore_ini = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_stonecore_ini, gg_rct_AbyssalHeroComing )
call TriggerAddAction( gg_trg_stonecore_ini, function Trig_stonecore_ini_Actions )
endfunction
function Trig_supremus_preload_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_supremus_preload_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
call EnablePreSelect(false,false)
set udg_Supremus = CreateUnit(Player(7),'U001',GetRectCenterX(gg_rct_AbyssalSummoning),GetRectCenterY(gg_rct_AbyssalSummoning),270.)
set udg_Catapult = CreateUnit(Player(7),'o009',GetRectCenterX(gg_rct_AbbysalBalista),GetRectCenterY(gg_rct_AbbysalBalista),0.)
call SaveReal(udg_hash,GetHandleId(udg_Supremus),2,15.)
if CURRENT_DIFFICULTY >= 3 then
call SaveReal(udg_hash,GetHandleId(udg_Supremus),GetSpellResistHash(),(CURRENT_DIFFICULTY-2)*0.1)
call SaveReal(udg_hash,GetHandleId(udg_Supremus),GetSpellPowerHash(),(CURRENT_DIFFICULTY-2)*500.)
endif
call Aggro.new(udg_Supremus)
call PauseUnitBJ( true, udg_Catapult )
call SetHeroLevelBJ( udg_Supremus, 30, false )
call SaveReal(udg_hash,GetHandleId(udg_Supremus),90,GetUnitX(udg_Supremus))
call SaveReal(udg_hash,GetHandleId(udg_Supremus),91,GetUnitY(udg_Supremus))
call SetUnitInvulnerable( udg_Supremus, true )
call PauseUnitBJ( true, udg_Supremus )
call SetUnitTimeScale(udg_Supremus,1000.)
call SetUnitAnimation( udg_Supremus, "death" )
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_supremus_preload takes nothing returns nothing
set gg_trg_supremus_preload = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_supremus_preload, gg_rct_AbyssalHeroComing )
call TriggerAddCondition( gg_trg_supremus_preload, Condition( function Trig_supremus_preload_Conditions ) )
call TriggerAddAction( gg_trg_supremus_preload, function Trig_supremus_preload_Actions )
endfunction
function Trig_supremus_sumtimer_Conditions takes nothing returns boolean
if ( not ( IsUnitAlly(GetTriggerUnit(), Player(6)) == true ) ) then
return false
endif
return true
endfunction
function Trig_supremus_sumtimer_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
call StartTimerBJ( udg_SupremusTimer, false, 10.00 )
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_supremus_sumtimer takes nothing returns nothing
set gg_trg_supremus_sumtimer = CreateTrigger( )
call DisableTrigger( gg_trg_supremus_sumtimer )
call TriggerRegisterEnterRectSimple( gg_trg_supremus_sumtimer, gg_rct_AbyssalBattlefield )
call TriggerAddCondition( gg_trg_supremus_sumtimer, Condition( function Trig_supremus_sumtimer_Conditions ) )
call TriggerAddAction( gg_trg_supremus_sumtimer, function Trig_supremus_sumtimer_Actions )
endfunction
//TESH.scrollpos=10
//TESH.alwaysfold=0
globals
fogmodifier array SUPRE_FOG[8]
real SUPREMUS_DEATH_ANIMATION_TIME = 0.35*4.867
endglobals
function SupremusStartBattle takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
loop
exitwhen i>udg_PlayerCount
call PauseUnit(udg_Heroes[i],false)
call SetUnitInvulnerable( udg_Supremus, false )
call CameraClearNoiseForPlayer( udg_Players[i] )
call ResetToGameCameraForPlayer(udg_Players[i],0.)
call BoundPlayerUnitCameraToRect(udg_Heroes[i],gg_rct_AbyssalBattlefield,false)
call SetCameraFieldForPlayer(udg_Players[i],CAMERA_FIELD_ZOFFSET,LoadReal(udg_hash,GetHandleId(udg_Players[i]),1),1.)
//call SetCameraFieldForPlayer(udg_Players[i],CAMERA_FIELD_ROTATION,LoadReal(udg_hash,GetHandleId(udg_Players[i]),2),1.)
set i = i+1
endloop
set i = 0
loop
exitwhen i > 5
call PauseUnit(camera_u[i],false)
set i = i + 1
endloop
call DisableTrigger( gg_trg_Stonecore_Teleport )
call EnablePreSelect(true, true)
call SetUnitTimeScale(udg_Supremus,1.)
call SetUnitAnimation(udg_Supremus,"Stand")
call PauseUnit(udg_Supremus,false)
call TimerStart(AbyssCall_Timer,50.,false,null)
call StartTimerBJ(udg_Meteor_Timer,false,20.)
//call StartTimerBJ(udg_ColCharge_Timer,false,30.)
call TimerStart(SUPREMUS_CHARGE_TIMER,30.,false,null)
call StartTimerBJ(udg_Abysal_Catapult,false,40.)
//call TimerDialogDisplay(CreateTimerDialog(udg_ColCharge_Timer),true)
set SUPREMUS_BATTLE_INITIALIZED = true
set SUPREMUS_SUMMONED = true
call EnableTrigger(STEPCLAPTRG)
call EnablePreSelect(true,true)
set udg_LeakPoint[1] = GetUnitLoc(udg_Supremus)
set i = 0
loop
exitwhen i > 7
set SUPRE_FOG[i] = CreateFogModifierRadiusLoc(Player(i),FOG_OF_WAR_VISIBLE,udg_LeakPoint[1],1500.,true,false)
call FogModifierStart(SUPRE_FOG[i])
set i = i + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
call DestroyTimer(t)
set t = null
endfunction
function KillSupremusSound takes nothing returns nothing
local timer t = GetExpiredTimer()
local sound s = LoadSoundHandle(udg_hash,GetHandleId(t),1)
call StopSound(s,true,true)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set s = null
endfunction
function SupremusSecondAnimSound takes nothing returns nothing
local timer t = CreateTimer()
call PlaySoundOnUnitBJ( gg_snd_InfernalDeath, 100, udg_Supremus )
call SaveSoundHandle(udg_hash,GetHandleId(t),1,gg_snd_InfernalDeath)
call TimerStart(t,2.,false,function KillSupremusSound)
set t = null
endfunction
function SupremusSecondAnum takes nothing returns nothing
call DestroyTimer(GetExpiredTimer())
call SetUnitTimeScale(udg_Supremus,0.65)
call SetUnitAnimationByIndex(udg_Supremus,2)
call TimerStart(CreateTimer(),1.25,false, function SupremusSecondAnimSound)
call TimerStart(CreateTimer(),5.,false,function SupremusStartBattle)
endfunction
function SupremusEffect takes nothing returns nothing
call DestroyTimer(GetExpiredTimer())
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",udg_Supremus,"hand left"))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",udg_Supremus,"hand right"))
endfunction
function StartSummoningSupremus takes nothing returns nothing
call DestroyTimer(GetExpiredTimer())
call SetUnitTimeScale(udg_Supremus,-0.25)
call TimerStart(CreateTimer(),SUPREMUS_DEATH_ANIMATION_TIME*4.,false,function SupremusSecondAnum )
call TimerStart(CreateTimer(),SUPREMUS_DEATH_ANIMATION_TIME*2,false,function SupremusEffect)
call TimerStart(CreateTimer(),SUPREMUS_DEATH_ANIMATION_TIME*3,false,function SupremusEffect)
call TimerStart(CreateTimer(),SUPREMUS_DEATH_ANIMATION_TIME*3.6,false,function SupremusEffect)
call TimerStart(CreateTimer(),SUPREMUS_DEATH_ANIMATION_TIME*3.95,false,function SupremusEffect)
endfunction
function Trig_supremus_ini_Actions takes nothing returns nothing
local timer t = CreateTimer()
local integer i = 1
set udg_LeakPoint[1] = GetRectCenter(gg_rct_AbyssalSummoning)
loop
exitwhen i > udg_PlayerCount
call ResetToGameCameraForPlayer(udg_Players[i],0.)
call CameraSetupApplyForPlayer( true, gg_cam_Camera_002, udg_Players[i], 0 )
set udg_LeakPoint[2] = PolarProjectionBJ(udg_LeakPoint[1], 600.00, ( 60.00 * I2R(i) ))
call SetUnitPositionLocFacingLocBJ( udg_Heroes[i], udg_LeakPoint[2], udg_LeakPoint[1] )
call PauseUnit(udg_Heroes[i], true )
call SetCameraTargetControllerNoZForPlayer( udg_Players[i], udg_Supremus, 0, 250., false )
call CameraSetEQNoiseForPlayer( udg_Players[i], 6.00 )
call RemoveLocation(udg_LeakPoint[2])
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 5
call PauseUnit(camera_u[i],true)
set i = i + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
call TimerStart(CreateTimer(),3.,false,function StartSummoningSupremus)
set t = null
endfunction
//===========================================================================
function InitTrig_supremus_ini takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEventBJ( t, udg_SupremusTimer )
call TriggerAddAction( t, function Trig_supremus_ini_Actions )
set t = null
endfunction
scope EredarsAbyssStartPreload initializer onInit
globals
private boolean EREDARS_ABYSS_PRELOADED = false
private integer array EREDARS_ABYSS_UNITS_PRELOAD
private integer MAX_N = 8
endglobals
private function onEnter takes nothing returns nothing
local integer i = 1
set EREDARS_ABYSS_PRELOADED = true
loop
exitwhen i>MAX_N
call AddUnitToPreloadQueueById(EREDARS_ABYSS_UNITS_PRELOAD[i])
set i = i + 1
endloop
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"Molten Core resources are added to the preload queue (required time: " + I2S(R2I(MAX_N*PRELOAD_TIMER_PERIOD)) + " seconds). Players may suffer freezes for a duration.")
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i>udg_PlayerCount
if GetTriggerUnit()==udg_Heroes[i] then
return not EREDARS_ABYSS_PRELOADED
endif
set i = i + 1
endloop
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_EredarsStart )
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction( t, function onEnter )
set EREDARS_ABYSS_UNITS_PRELOAD[1] = 'N00W' //Kil'jaeden
set EREDARS_ABYSS_UNITS_PRELOAD[2] = 'U003' //Archimonde
set EREDARS_ABYSS_UNITS_PRELOAD[3] = 'h038' //Void Zone Kil'jaeden
set EREDARS_ABYSS_UNITS_PRELOAD[4] = 'h039' //Void Zone Archomonde
set EREDARS_ABYSS_UNITS_PRELOAD[5] = 'h03A' //Vortex Explosion Archimonde
set EREDARS_ABYSS_UNITS_PRELOAD[6] = 'h03B' //Eye of Sargeras
set EREDARS_ABYSS_UNITS_PRELOAD[7] = 'h03C' //Sargeras Beam
set EREDARS_ABYSS_UNITS_PRELOAD[8] = 'h03D' //Bridge Explosion
set MAX_N = 8
set t = null
endfunction
endscope
scope EredarsAbyssTeleport initializer onInit
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return EREDAR_PORTAL_INITIALIZED and not EREDARS_BATTLE_INITIALIZED
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
call SetUnitPosition(GetTriggerUnit(), GetRectCenterX(gg_rct_EredarsStart), GetRectCenterY(gg_rct_EredarsStart))
call IssueImmediateOrder( GetTriggerUnit(), "stop" )
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_EredarsTeleportEnter )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endscope
scope EredarsAbyssEnterLocation initializer onInit
globals
unit ARCHIMONDE = null
unit KILJAEDEN = null
destructable EREDAR_BARRIER = null
private constant real ARCHIMONDE_TALK_DURATION = 8.
private constant real KILJAEDEN_TALK_DURATION = 7.5
private constant string TALK_ARCHIMONDE = ""
private constant string TALK_KILJAEDEN = ""
constant real EREDAR_VOID_ZONE_COOLDOWN = 15.
constant real EREDAR_CHANGE_COOLDOWN = 70.
constant real EREDAR_CAST_COOLDOWN = 25.
constant real EREDAR_SARGERAS_COOLDOWN = 40.
integer EREDARS_CHANGES_COUNT = 0
boolean EREDARS_SARGERAS_ACTIVATED = false
integer EREDARS_SARGERAS_CHANGES_COUNT_ACTIVATE = 1
unit ACTIVE_EREDAR = null
unit PASSIVE_EREDAR = null
timer EREDAR_VOID_TIMER = CreateTimer()
timer EREDAR_CHANGE_TIMER = CreateTimer()
timer EREDAR_CAST_TIMER = CreateTimer()
timer EREDAR_SARGERAS_TIMER = CreateTimer()
endglobals
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onTimerStartBattle takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
call PauseUnit(ACTIVE_EREDAR,false)
call SetUnitX(ACTIVE_EREDAR,GetRectCenterX(gg_rct_EredarVortexCenter))
call SetUnitY(ACTIVE_EREDAR,GetRectCenterY(gg_rct_EredarVortexCenter))
//call DestroyEffect(AddSpecialEffectTarget("Void Disc.mdx", ACTIVE_EREDAR,"origin"))
call SetUnitAnimation(ACTIVE_EREDAR,"Stand")
call FadeUnitOut(ACTIVE_EREDAR,2.,false)
call SetUnitInvulnerable(ACTIVE_EREDAR,false)
call SetUnitInvulnerable(PASSIVE_EREDAR,true)
call DestroyTimer(t)
set t = null
endfunction
private function onTimerResetCamera takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
loop
exitwhen i > udg_PlayerCount
call ResetToGameCameraForPlayer(udg_Players[i],0.)
call PauseUnit(udg_Heroes[i],false)
//if LoadReal(udg_hash,GetHandleId(udg_Players[i]),1) >= 500. then
call SetCameraFieldForPlayer(udg_Players[i],CAMERA_FIELD_ZOFFSET,LoadReal(udg_hash,GetHandleId(udg_Players[i]),1)+200.,0.)
//endif
if GetLocalPlayer()==udg_Players[i] then
call PanCameraToTimed(GetUnitX(udg_Heroes[i]),GetUnitY(udg_Heroes[i]),1.)
endif
//call SetCameraFieldForPlayer(udg_Players[i],CAMERA_FIELD_ROTATION,LoadReal(udg_hash,GetHandleId(udg_Players[i]),2),0.)
set i = i + 1
endloop
call DestroyTimer(t)
set t = null
endfunction
private function onTimerTeleportEredar takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
local integer k = GetRandomInt(1,2)
call SetUnitAnimation(KILJAEDEN,"Stand")
set EREDAR_BARRIER = CreateDestructable('B00G',GetRectCenterX(gg_rct_EredarBarrier),GetRectCenterY(gg_rct_EredarBarrier),0.,2.,1)
if k==1 then
set ACTIVE_EREDAR = ARCHIMONDE
set PASSIVE_EREDAR = KILJAEDEN
else
set ACTIVE_EREDAR = KILJAEDEN
set PASSIVE_EREDAR = ARCHIMONDE
endif
call TimerStart(EREDAR_VOID_TIMER,EREDAR_VOID_ZONE_COOLDOWN,false,null)
call TimerStart(EREDAR_CHANGE_TIMER,EREDAR_CHANGE_COOLDOWN,false,null)
call TimerStart(EREDAR_CAST_TIMER,EREDAR_CAST_COOLDOWN,false,null)
call SetUnitAnimation(ACTIVE_EREDAR,"Spell Slam")
set EREDARS_SUMMONED = true
set EREDARS_BATTLE_INITIALIZED = true
call TimerStart(CreateTimer(), 3., false, function onTimerStartBattle)
call TimerStart(CreateTimer(),1.,false, function onTimerResetCamera)
call DestroyTimer(t)
set t = null
endfunction
private function onTimerKilJaedenTalk takes nothing returns nothing
local timer t = GetExpiredTimer()
call PlaySoundOnUnitBJ( gg_snd_O02Mannoroth34, 100, KILJAEDEN )
call SetCinematicScene('N00W',null,"Kil'jaeden",TALK_KILJAEDEN,KILJAEDEN_TALK_DURATION,KILJAEDEN_TALK_DURATION)
call SetUnitAnimation(ARCHIMONDE,"Stand")
call SetUnitAnimation(KILJAEDEN,"Spell")
call TimerStart(CreateTimer(),KILJAEDEN_TALK_DURATION,false,function onTimerTeleportEredar)
call DestroyTimer(t)
set t = null
endfunction
private function onTimerArchimondeTalk takes nothing returns nothing
local timer t = GetExpiredTimer()
call PlaySoundOnUnitBJ( gg_snd_N07Archimonde16B, 100, ARCHIMONDE )
call SetCinematicScene('U003',null,"Archimonde",TALK_ARCHIMONDE,ARCHIMONDE_TALK_DURATION,ARCHIMONDE_TALK_DURATION)
call SetUnitAnimation(ARCHIMONDE,"Spell")
call SetUnitAnimation(KILJAEDEN,"stand")
call TimerStart(CreateTimer(),ARCHIMONDE_TALK_DURATION,false,function onTimerKilJaedenTalk)
call DestroyTimer(t)
set t = null
endfunction
private function onTimerCreateEredars takes nothing returns nothing
local timer t = GetExpiredTimer()
set ARCHIMONDE = CreateUnit(Player(7),'U003',GetRectCenterX(gg_rct_EredarsPlatformLeft),GetRectCenterY(gg_rct_EredarsPlatformLeft),270.)
set KILJAEDEN = CreateUnit(Player(7),'N00W',GetRectCenterX(gg_rct_EredarsPlatformRight),GetRectCenterY(gg_rct_EredarsPlatformRight),270.)
call PauseUnit(ARCHIMONDE,true)
call PauseUnit(KILJAEDEN,true)
call Aggro.new(ARCHIMONDE)
call Aggro.new(KILJAEDEN)
call SetUnitAnimation(ARCHIMONDE,"Spell Slam")
call SetUnitAnimation(KILJAEDEN,"Spell Slam")
//call DestroyEffect(AddSpecialEffectTarget("Void Disc.mdx", ARCHIMONDE,"origin"))
//call DestroyEffect(AddSpecialEffectTarget("Void Disc.mdx", KILJAEDEN,"origin"))
call FadeUnitOut(ARCHIMONDE,3.,false)
call FadeUnitOut(KILJAEDEN,3.,false)
call FlushChildHashtable(udg_hash,GetHandleId(ARCHIMONDE))
call FlushChildHashtable(udg_hash,GetHandleId(KILJAEDEN))
call SaveReal(udg_hash,GetHandleId(ARCHIMONDE),GetCritHash(),15.)
call SaveReal(udg_hash,GetHandleId(KILJAEDEN),GetCritHash(),15.)
if CURRENT_DIFFICULTY >= 3 then
call SaveReal(udg_hash,GetHandleId(ARCHIMONDE),GetSpellResistHash(),(CURRENT_DIFFICULTY-2)*0.1)
call SaveReal(udg_hash,GetHandleId(ARCHIMONDE),GetSpellPowerHash(),(CURRENT_DIFFICULTY-2)*200.)
call SaveReal(udg_hash,GetHandleId(KILJAEDEN),GetSpellResistHash(),(CURRENT_DIFFICULTY-2)*0.1)
call SaveReal(udg_hash,GetHandleId(KILJAEDEN),GetSpellPowerHash(),(CURRENT_DIFFICULTY-2)*200.)
endif
call SetHeroLevelBJ( ARCHIMONDE, 30, false )
call SetHeroLevelBJ( KILJAEDEN, 30, false )
call TimerStart(CreateTimer(),3.25,false,function onTimerArchimondeTalk)
call DestroyTimer(t)
set t = null
endfunction
private function onTimerSummonEredars takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
local real x = GetRectCenterX(gg_rct_EredarVortexCenter)
local real y = GetRectCenterY(gg_rct_EredarVortexCenter)
local real x1 = GetRectCenterX(gg_rct_EredarFacingRect)
local real y1 = GetRectCenterY(gg_rct_EredarFacingRect)
local real angle = 0.
local unit dummy = CreateUnit(Player(7),'h009',x1,y1,0)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 3.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
loop
exitwhen i > udg_PlayerCount
call PauseUnit(udg_Heroes[i],true)
if i==1 then
call SetUnitX(udg_Heroes[i],x)
call SetUnitY(udg_Heroes[i],y)
endif
if i==2 then
call SetUnitX(udg_Heroes[i],x-150.)
call SetUnitY(udg_Heroes[i],y)
endif
if i==3 then
call SetUnitX(udg_Heroes[i],x+150.)
call SetUnitY(udg_Heroes[i],y)
endif
if i==4 then
call SetUnitX(udg_Heroes[i],x-300.)
call SetUnitY(udg_Heroes[i],y)
endif
if i==5 then
call SetUnitX(udg_Heroes[i],x+300.)
call SetUnitY(udg_Heroes[i],y)
endif
if i==6 then
call SetUnitX(udg_Heroes[i],x)
call SetUnitY(udg_Heroes[i],y-150.)
endif
set angle = Atan2( y1 - GetUnitY(udg_Heroes[i]), x1 - GetUnitX(udg_Heroes[i]) )
call SetUnitFacing(udg_Heroes[i],angle*bj_RADTODEG)
call CameraSetupApplyForPlayer( true, gg_cam_EredarCamera, udg_Players[i], 0 )
if GetLocalPlayer()==udg_Players[i] then
call SetCameraTargetController(dummy, 0.,0.,false)
endif
set i = i + 1
endloop
call TimerStart(CreateTimer(),3.,false,function onTimerCreateEredars)
call DestroyTimer(t)
set t = null
set dummy = null
endfunction
private function onEnter takes nothing returns nothing
call TimerStart(CreateTimer(),10.,false,function onTimerSummonEredars)
call DestroyTrigger(GetTriggeringTrigger())
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_EredarBattlefield )
call TriggerAddCondition(t,function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endscope
library AbilityDescriptor
globals
private constant string TypeColor = "|c000080FF"
private constant string DescriptionColor = "|c000080FF"
private constant string CooldownColor = "|c000080FF"
private constant string ParameterColor = "|c008080C0"
private constant string PhysicalColor = "|cffc0c0c0"
endglobals
function GetPhysicalColor takes nothing returns string
return PhysicalColor
endfunction
function GetAbilityParametersColor takes nothing returns string
return ParameterColor
endfunction
function GetAbilityDescriptionText takes string text returns string
return DescriptionColor + "|nDescription:|r|n" + text
endfunction
function GetAbilityCooldownText takes real cooldown returns string
return "|n" + CooldownColor + "Cooldown:|r " + I2S(R2I(cooldown)) + " seconds"
endfunction
function GetAbilityTypeChannelingText takes nothing returns string
return TypeColor + "Type:|r active (channeling)"
endfunction
function GetAbilityTypeInstantText takes nothing returns string
return TypeColor + "Type:|r active (instant)"
endfunction
function GetAbilityTypeTargetUnitText takes boolean IsChanneling, boolean IsMouseFollowing returns string
local string tail = "active (target unit"
if IsChanneling then
set tail = tail + ", channeling"
endif
if IsMouseFollowing then
set tail = tail + ", |cffff0000mouse following|r"
endif
set tail = tail + ")"
return TypeColor + "Type:|r " + tail
endfunction
endlibrary
library HordeChampionTalents initializer onInit requires MapGameplayUtils
globals
constant integer HORDE_CHAMPION_CODE = 'O002'
private constant integer MAX_TALENTS = 10
private constant integer WAR_BANNER_CODE = 'A04N'
private constant integer DEEP_WOUNDS_CODE = 'A04O'
private constant integer COLOSSUS_SMASH_CODE = 'A04K'
private constant integer CARNAGE_CODE = 'A04P'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer WAR_BANNER_LEVEL_HASH = 250
constant real WAR_BANNER_BLEEDING_BONUS = 0.1
constant integer DEEP_WOUNDS_LEVEL_HASH = 251
constant real DEEP_WOUNDS_BLEED_DAMAGE = 0.25
constant real DEEP_WOUNDS_BLEED_PERIOD = 1.
constant real DEEP_WOUNDS_BLEED_DURATION = 4.
constant integer COLOSSUS_SMASH_LEVEL_HASH = 252
constant real COLOSSUS_SMASH_EXPERTISE_MULTIPLIER = 0.1
constant real COLOSSUS_SMASH_DAMAGE_MULTIPLIER = 0.1
constant integer CARNAGE_LEVEL_HASH = 253
constant real CARNAGE_BONUS_DAMAGE = 0.2
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == HORDE_CHAMPION_CODE
endfunction
private function GetWarBannerDescriptionByLevel takes integer lvl returns string
return "Increases the attack damage bonus granted by Battle Standard by |c008080C0" + I2S(5*lvl) +"%|r and improves the bleeding effects done by affected allies by |c008080C0"+ I2S(R2I(WAR_BANNER_BLEEDING_BONUS*100)*lvl) +"%|r."
endfunction
private function GetDeepWoundsDescriptionByLevel takes integer lvl returns string
return "Champion's critical strikes cause the target to bleed, dealing |c008080C0" + I2S(R2I(DEEP_WOUNDS_BLEED_DAMAGE*100*lvl)) + "%|r of caused damage per " + I2S(R2I(DEEP_WOUNDS_BLEED_PERIOD)) + " sec. over " + I2S(R2I(DEEP_WOUNDS_BLEED_DURATION)) + " sec. "
endfunction
private function GetColossusSmashDescriptionByLevel takes integer lvl returns string
return "You Heroic Leap smashes the enemy's armor, dealing |c008080C0" + I2S(R2I(COLOSSUS_SMASH_DAMAGE_MULTIPLIER*100*lvl)) + "%|r additional damage and reducing the armor value by |c008080C0" + I2S(R2I(COLOSSUS_SMASH_EXPERTISE_MULTIPLIER*100*lvl)) + "%|r of the hero expertise as an armor penetration effect."
endfunction
private function GetCarnageDescriptionByLevel takes integer lvl returns string
return "Increases the damage done by Massacre upto |c008080C0" + I2S(R2I(CARNAGE_BONUS_DAMAGE*100*lvl)) + "%|r depending on the ability duration."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),WAR_BANNER_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(WAR_BANNER_CODE, GetWarBannerDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetWarBannerDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(WAR_BANNER_CODE, GetWarBannerDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),DEEP_WOUNDS_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(DEEP_WOUNDS_CODE, GetDeepWoundsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetDeepWoundsDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(DEEP_WOUNDS_CODE, GetDeepWoundsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),COLOSSUS_SMASH_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(COLOSSUS_SMASH_CODE, GetColossusSmashDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetColossusSmashDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(COLOSSUS_SMASH_CODE, GetColossusSmashDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),CARNAGE_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(CARNAGE_CODE, GetCarnageDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetCarnageDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(CARNAGE_CODE, GetCarnageDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == WAR_BANNER_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"WAR BANNER CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == DEEP_WOUNDS_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"DEEP WOUNDS CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),DEEP_WOUNDS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),DEEP_WOUNDS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),DEEP_WOUNDS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),DEEP_WOUNDS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == COLOSSUS_SMASH_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"COLOSSUS SMASH CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),COLOSSUS_SMASH_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),COLOSSUS_SMASH_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),COLOSSUS_SMASH_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),COLOSSUS_SMASH_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == CARNAGE_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CARNAGE CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),CARNAGE_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),CARNAGE_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),CARNAGE_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),CARNAGE_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function HordeChampionUnlearnTalents takes unit hero returns nothing
local integer WAR_BANNER_LEVEL = LoadInteger(udg_hash,GetHandleId(hero), WAR_BANNER_LEVEL_HASH)
local integer DEEP_WOUNDS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),DEEP_WOUNDS_LEVEL_HASH)
local integer COLOSSUS_SMASH_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),COLOSSUS_SMASH_LEVEL_HASH)
local integer CARNAGE_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),CARNAGE_LEVEL_HASH)
local integer sum = WAR_BANNER_LEVEL+DEEP_WOUNDS_LEVEL+COLOSSUS_SMASH_LEVEL+CARNAGE_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),WAR_BANNER_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),DEEP_WOUNDS_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),COLOSSUS_SMASH_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),CARNAGE_LEVEL_HASH,0)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope BattleStandard initializer onInit
globals
private constant integer ABILCODE = 'A04I'
private constant integer AURA_DAMAGE_CODE = 'A04J'
private constant integer STANDARD_CODE = 'h02K'
private constant integer AURA_CODE = 'h02L'
private constant real AOE = 800.
private constant real DURATION = 30.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerApplyBleedingAura takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit STANDARD = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local integer WAR_BANNER = LoadInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH)
local group g = CreateGroup()
local unit tempu = null
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(STANDARD),GetUnitY(STANDARD),AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call AddHeroParameter(tempu,WAR_BANNER_BLEEDING_BONUS*WAR_BANNER,1.,GetBleedingDamageBonusHash(),"","")
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if not (GetWidgetLife(STANDARD)>0.) then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set g = null
set STANDARD = null
set CASTER = null
endfunction
private function onTimerResetFlag takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit STANDARD = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit AURA = CreateUnit(GetOwningPlayer(STANDARD),AURA_CODE,GetUnitX(STANDARD),GetUnitY(STANDARD),0.)
local integer WAR_BANNER = LoadInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH)
local timer t1 = null
call SetUnitAnimation(STANDARD,"stand")
call UnitAddAbility(STANDARD,AURA_DAMAGE_CODE)
call SetUnitAbilityLevel(STANDARD,AURA_DAMAGE_CODE,WAR_BANNER+1)
call UnitApplyTimedLife(STANDARD,'BHwe',DURATION)
call UnitApplyTimedLife(AURA,'BHwe',DURATION-1.)
if WAR_BANNER > 0 then
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,STANDARD)
call SaveUnitHandle(udg_hash,GetHandleId(t1),2,CASTER)
call TimerStart(t1,1.,true,function onTimerApplyBleedingAura)
set t1 = null
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set STANDARD = null
set CASTER = null
set AURA = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit STANDARD = CreateUnit(GetOwningPlayer(CASTER),STANDARD_CODE,x,y,270.)
local timer t = CreateTimer()
call SetUnitAnimation(STANDARD,"birth")
call SaveUnitHandle(udg_hash,GetHandleId(t),1,STANDARD)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,CASTER)
call TimerStart(t,1.,false,function onTimerResetFlag)
set t = null
set CASTER = null
set STANDARD = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope Massacre initializer onInit
globals
private constant integer ABILCODE = 'A04M'
private constant real AOE = 250.
private constant real BASE_DMG_MULT = 0.5
private constant real LEVEL_DMG_MULT = 0.25
private constant real AFFECTED_PERIOD = 0.5
private constant real RAGECOST = 5.
private constant real DURATION = 5.
private constant real MAXSPEED = 600.
private constant real MINMOUSEDIST = 50.
private constant real MAXMOUSEDIST = 1500.
private constant string EFFECT = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodWolfrider.mdl"
//private constant string SLASH_EFFECT = "EphemeralSlashSilver.mdx"
private constant string ATTACH = "chest"
private constant integer ISPREVENTED_HASH = 201
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),2)
local integer CARNAGE = LoadInteger(udg_hash,GetHandleId(CASTER),CARNAGE_LEVEL_HASH)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xp = GetPlayerMouseX(GetOwningPlayer(CASTER))
local real yp = GetPlayerMouseY(GetOwningPlayer(CASTER))
local real dist = SquareRoot( (x-xp)*(x-xp) + (y-yp)*(y-yp) )
local real h = 0.
local real angle = 0.
local real xnew = 0.
local real ynew = 0.
local real rage = RAGECOST/25.
local group g = CreateGroup()
local unit tempu = null
local timer t1 = null
//local effect eff = AddSpecialEffect(SLASH_EFFECT,x,y)
local real ATTACKPOWER = BlzGetUnitBaseDamage(CASTER,0)
local real DAMAGE = ATTACKPOWER * ( BASE_DMG_MULT+LEVEL_DMG_MULT*GetUnitAbilityLevel(CASTER,ABILCODE) ) * (1+ Elapsed/DURATION * CARNAGE*CARNAGE_BONUS_DAMAGE)
//call BlzSetSpecialEffectHeight(eff,GetRandomReal(30.,100.))
//call BlzSetSpecialEffectTimeScale(eff, GetRandomReal(0.8,1.3))
//call BlzSetSpecialEffectOrientation(eff, GetRandomReal(0.,6.28), 0., 0.)
//call DestroyEffect(eff)
//set eff = null
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),2,Elapsed)
if GetUnitState(CASTER,UNIT_STATE_MANA)>=rage then
if dist <= MAXMOUSEDIST and dist >= MINMOUSEDIST then
set angle = Atan2( yp-y,xp-x )
set h = (MAXSPEED/MAXMOUSEDIST)*dist/25. + 100./25.
set xnew = x+h*Cos(angle)
set ynew = y+h*Sin(angle)
if IsPointPathable(xnew,ynew) then
call SetUnitX(CASTER,xnew)
call SetUnitY(CASTER,ynew)
endif
endif
call SetUnitState(CASTER,UNIT_STATE_MANA, GetUnitState(CASTER,UNIT_STATE_MANA)-rage)
else
call IssueImmediateOrder(CASTER,"stop")
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g, x, y , AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
if not IsUnitInGroup(tempu,AFFECTED) then
call DealPhysicalDamage(CASTER,tempu,DAMAGE)
call GroupAddUnit(AFFECTED,tempu)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,tempu,ATTACH))
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,AFFECTED_PERIOD, false, function onTimerRemoveAffect)
set t1 = null
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if ISPREVENTED then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
set g = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call TimerStart(t,0.04,true,function onTimer)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
//TESH.scrollpos=40
//TESH.alwaysfold=0
scope BloodHurricane initializer Init
/*
Blood Hurricane v0.4 vJass
Created by Helpmeplz aka GodLike special for XGM Spell Contest 3
How to import:
1.Copy this trigger into you map
2.Copy BH Dummy unit and Blood Hurricane ability from Object Editor
3.Change its rawcodes in trigger settings
*/
globals
//Settings
private constant integer ABILITY_RAWCODE = 'A000' //Rawcode of Blood Hurricane ability
private constant integer DUMMY_RAWCODE = 'h008' //Rawcode of dummy unit
private constant real AOE = 230. //Area of effect
private constant real DURATION = 5. //Duration. set it as well as DURATION of ability in object editor
private constant real ATTACK_POWER_BASE = 0.25 // Base Attack Power Multiplier
private constant real ATTACK_POWER_LEVEL = 0.30 //Attack Power Multiplier per level
private constant real SPINSPEED = 275. //Degrees unit spins per second
private constant real MAXHEIGHT = 220. //Maximum height of spining units
private constant real MINHEIGHT = 30. //Minimum height of spining units
private constant integer MAXUNITS = 10 // Maximum count of spining units
private constant real PI_CONST = 3.14159
private constant real DUMMY_ANGLE_SPEED = 2*PI_CONST/25.
private constant real DUMMY_MAX_HEIGHT = 100.
private constant real DUMMY_MIN_HEIGHT = 25.
private constant real DUMMY_HEIGHT_SPEED = 0./25.
private constant real DUMMY_RADIUS = 0.
boolean IS_BLOOD_HURRICANE_DAMAGE = false
//
//Do not change this formulas
private constant real SPIN_AOE = AOE / 1.53
private constant real DUMMY_SIZE = AOE / 230.
private constant real RAD_SPIN_SPEED = SPINSPEED / 25. * bj_DEGTORAD
private integer g_i = 0
private boolean path = true
endglobals
private struct st
static st array data
static integer index = 0
static timer t = CreateTimer()
static group gr = CreateGroup()
unit CASTER = null
unit DUMMY = null
integer UNITS = 0
group AFFECTED = null
real DAMAGE = 0.
real DUMMY_ANGLE = 0.
boolean DUMMY_TOPWARDS = false
static method GROUP_FILTER takes nothing returns boolean
local unit u = GetFilterUnit()
if GetWidgetLife(u)>0. and IsUnitEnemy(u,GetOwningPlayer(.data[g_i].CASTER)) and not IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) then
set IS_BLOOD_HURRICANE_DAMAGE = true
call DealPhysicalDamage(.data[g_i].CASTER,u,.data[g_i].DAMAGE)
set IS_BLOOD_HURRICANE_DAMAGE = false
if not IsUnitInGroup(u,.data[g_i].AFFECTED) and .data[g_i].UNITS < MAXUNITS then
if IsUnitKnockbackable(u) then
set .data[g_i].UNITS = .data[g_i].UNITS + 1
call GroupAddUnit(.data[g_i].AFFECTED,u)
call UnitAddAbility(u,'Aave')
call UnitRemoveAbility(u,'Aave')
call SetUnitPathing(u,false)
call SaveInteger(udg_hash,GetHandleId(u),102,1)
call PauseUnit(u,true)
endif
endif
if IsUnitType(u,UNIT_TYPE_HERO) then
//call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",u,"chest"))
endif
endif
set u = null
return false
endmethod
static method FOR_GROUP_MAIN takes nothing returns nothing
local unit u = GetEnumUnit()
local real x1 = GetUnitX(u)
local real y1 = GetUnitY(u)
local real x2 = GetUnitX(.data[g_i].CASTER)
local real y2 = GetUnitY(.data[g_i].CASTER)
local real angle = Atan2(y1-y2,x1-x2) + RAD_SPIN_SPEED
if not IsUnitType(u,UNIT_TYPE_HERO) then
call SetUnitX(u,x2 + SPIN_AOE*Cos(angle) )
call SetUnitY(u,y2 + SPIN_AOE*Sin(angle) )
call SetUnitFacing(u,angle*bj_RADTODEG)
if LoadInteger(udg_hash,GetHandleId(u),102) == 1 then
call SetUnitFlyHeight(u,GetUnitFlyHeight(u) + GetRandomReal(10.,20.),0.)
if GetUnitFlyHeight(u) >= MAXHEIGHT then
call SaveInteger(udg_hash,GetHandleId(u),102,2)
endif
else
call SetUnitFlyHeight(u,GetUnitFlyHeight(u) - GetRandomReal(10.,20.),0.)
if GetUnitFlyHeight(u) <= MINHEIGHT then
call SaveInteger(udg_hash,GetHandleId(u),102,1)
endif
endif
if not (GetWidgetLife(u) > 0) then
call DestroyEffect(AddSpecialEffectTarget("BigBloodEX-NoSplat-NoGutz.mdl",u,"chest"))
call GroupRemoveUnit(.data[g_i].AFFECTED,u)
call SetUnitVertexColor(u,255,150,150,150)
call SetUnitFlyHeight(u,GetUnitFlyHeight(u)+100.,0.)
call SaveInteger(udg_hash,GetHandleId(u),102,R2I(GetUnitFlyHeight(u) / 25.))
call GroupAddUnit(.gr,u)
endif
endif
set u = null
endmethod
static method FOR_GROUP_END takes nothing returns nothing
local unit u = GetEnumUnit()
call SetUnitFlyHeight(u,GetUnitDefaultFlyHeight(u),0.)
call PauseUnit(u,false)
call SaveInteger(udg_hash,GetHandleId(u),102,0)
call SetUnitPathing(u,true)
call GroupRemoveUnit(.data[g_i].AFFECTED,u)
set u = null
endmethod
static method KNOCKBACK takes nothing returns nothing
local unit u = GetEnumUnit()
call SetUnitX(u,GetUnitX(u) + 25.*Cos(GetUnitFacing(u)*bj_DEGTORAD))
call SetUnitY(u,GetUnitY(u) + 25.*Sin(GetUnitFacing(u)*bj_DEGTORAD))
call SetUnitFlyHeight(u,GetUnitFlyHeight(u)-I2R(LoadInteger(udg_hash,GetHandleId(u),102)),0.)
if GetUnitFlyHeight(u)<=10. then
call GroupRemoveUnit(.gr,u)
call SaveInteger(udg_hash,GetHandleId(u),102,0)
call SetUnitFlyHeight(u,GetUnitDefaultFlyHeight(u),0.)
if .index == 0 and FirstOfGroup(.gr) == null then
call PauseTimer(.t)
endif
endif
set u = null
endmethod
static method PathabilityCheck takes nothing returns nothing
if GetDestructableTypeId(GetEnumDestructable()) == 'YTpb' or GetDestructableTypeId(GetEnumDestructable()) == 'YTpc' then
set path = false
endif
endmethod
static method Pathability takes real x, real y returns boolean
local rect rct = Rect(x - 50,y - 50,x + 50,y + 50)
set path = true
call EnumDestructablesInRect(rct,null,function st.PathabilityCheck)
call RemoveRect(rct)
set rct = null
return path and not IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY)
endmethod
static method onTimer takes nothing returns nothing
local group g = CreateGroup()
local boolexpr GROUPFILTER = Filter(function st.GROUP_FILTER)
local integer i = 0
loop
exitwhen i>=.index
//st.Pathability(GetUnitX(.data[i].CASTER),GetUnitY(.data[i].CASTER))
if not IsPointPathable(GetUnitX(.data[i].CASTER),GetUnitY(.data[i].CASTER)) then
if (not (GetUnitAbilityLevel(.data[i].CASTER,'A08G')>0.)) then
call SetUnitX(.data[i].CASTER,GetUnitX(.data[i].DUMMY))
call SetUnitY(.data[i].CASTER,GetUnitY(.data[i].DUMMY))
endif
else
call SetUnitX(.data[i].DUMMY,GetUnitX(.data[i].CASTER))
call SetUnitY(.data[i].DUMMY,GetUnitY(.data[i].CASTER))
endif
/*
set .data[i].DUMMY_ANGLE = .data[i].DUMMY_ANGLE+DUMMY_ANGLE_SPEED
if .data[i].DUMMY_ANGLE >= 2*PI_CONST then
set .data[i].DUMMY_ANGLE = .data[i].DUMMY_ANGLE - 2*PI_CONST
endif
call SetUnitX(.data[i].DUMMY,GetUnitX(.data[i].CASTER) + DUMMY_RADIUS*Cos(.data[i].DUMMY_ANGLE))
call SetUnitY(.data[i].DUMMY,GetUnitY(.data[i].CASTER) + DUMMY_RADIUS*Sin(.data[i].DUMMY_ANGLE))
if .data[.index].DUMMY_TOPWARDS then
call SetUnitFlyHeight(.data[i].DUMMY,GetUnitFlyHeight(.data[i].DUMMY) + DUMMY_HEIGHT_SPEED,0.)
if GetUnitFlyHeight(.data[i].DUMMY) >= DUMMY_MAX_HEIGHT then
set .data[i].DUMMY_TOPWARDS = false
endif
else
call SetUnitFlyHeight(.data[i].DUMMY,GetUnitFlyHeight(.data[i].DUMMY) - DUMMY_HEIGHT_SPEED,0.)
if GetUnitFlyHeight(.data[i].DUMMY) <= DUMMY_MIN_HEIGHT then
set .data[i].DUMMY_TOPWARDS = true
endif
endif
*/
set g_i = i
call GroupEnumUnitsInRange(g,GetUnitX(.data[i].CASTER),GetUnitY(.data[i].CASTER),AOE,GROUPFILTER)
call ForGroup(.data[i].AFFECTED,function st.FOR_GROUP_MAIN)
if IsUnitDeadBX(.data[i].DUMMY) or IsUnitDeadBX(.data[i].CASTER) then
call SetUnitPathing(.data[i].CASTER,true)
call ForGroup(.data[i].AFFECTED,function st.FOR_GROUP_END)
call DestroyGroup(.data[i].AFFECTED)
call GroupRemoveUnit(udg_Dummy_Group,.data[i].CASTER)
call .data[i].destroy()
set .index = .index - 1
set .data[i] = .data[.index]
set i = i - 1
endif
call GroupClear(g)
set i = i + 1
endloop
call ForGroup(.gr,function st.KNOCKBACK)
call DestroyGroup(g)
call DestroyBoolExpr(GROUPFILTER)
set g = null
set GROUPFILTER = null
endmethod
static method onCast takes nothing returns boolean
if GetSpellAbilityId() == ABILITY_RAWCODE then
set .data[.index] = st.create()
set .data[.index].CASTER = GetTriggerUnit()
call SetUnitPathing(.data[.index].CASTER,false)
set .data[.index].DUMMY = CreateUnit(GetOwningPlayer(.data[.index].CASTER),DUMMY_RAWCODE,GetUnitX(.data[.index].CASTER),GetUnitY(.data[.index].CASTER),0.)
call SetUnitTimeScale(.data[.index].DUMMY,1.5)
call UnitApplyTimedLife(.data[.index].DUMMY,'BHwe',DURATION)
call SetUnitScale(.data[.index].DUMMY,DUMMY_SIZE,DUMMY_SIZE,DUMMY_SIZE)
//call GroupAddUnit(udg_Dummy_Group,.data[.index].CASTER)
set .data[.index].AFFECTED = CreateGroup()
set .data[.index].DAMAGE = (BlzGetUnitBaseDamage(.data[.index].CASTER,0) / 25.)*(ATTACK_POWER_BASE + ATTACK_POWER_LEVEL * GetUnitAbilityLevel(.data[.index].CASTER,ABILITY_RAWCODE))
set .data[.index].UNITS = 0
set .data[.index].DUMMY_ANGLE = 0.
set .data[.index].DUMMY_TOPWARDS = true
if .index == 0 then
call TimerStart(.t,0.04,true,function st.onTimer)
endif
set .index = .index + 1
endif
return false
endmethod
endstruct
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(6),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(7),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(8),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(9),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(10),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(11),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function st.onCast))
set t = null
endfunction
endscope
scope Berserk initializer onInit
globals
private constant integer ABILCODE = 'A003'
private constant real CRIT_CHANCE = 10.
private constant real CRIT_MULT_PER_LEVEL = 0.1
private constant real DURATION = 15.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call AddHeroParameter(CASTER,CRIT_CHANCE,DURATION,GetCritHash(),"","")
call AddHeroParameter(CASTER,CRIT_MULT_PER_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE),DURATION,GetCritMultiplierHash(),"","")
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conds ) )
call TriggerAddAction(t, function onCast )
set t = null
endfunction
endscope
scope HeroicLeap initializer onInit
globals
private constant integer ABILCODE = 'A00B'
private constant real AP_MULTIPLIER = 0.75
private constant real AP_MULTIPLIED_PER_LEVEL = 0.15
private constant real DMG_BASE_PER_LEVEL = 250.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local integer COLOSSUS_SMASH = LoadInteger(udg_hash,GetHandleId(GetTriggerUnit()),COLOSSUS_SMASH_LEVEL_HASH)
set udg_HL_Caster = GetTriggerUnit()
set udg_HL_Points[1] = GetUnitLoc(GetTriggerUnit())
set udg_HL_Points[2] = GetUnitLoc(GetSpellTargetUnit())
set udg_HL_Distance = DistanceBetweenPoints(udg_HL_Points[1], udg_HL_Points[2])
set udg_HL_Speed = ( udg_HL_Distance / 25.00 )
set udg_HL_FlySpeed = 33.00
set udg_HL_Damage = (1+COLOSSUS_SMASH*COLOSSUS_SMASH_DAMAGE_MULTIPLIER)*( DMG_BASE_PER_LEVEL * GetUnitAbilityLevel(udg_HL_Caster, GetSpellAbilityId()) + BlzGetUnitBaseDamage(GetTriggerUnit(),0)*(AP_MULTIPLIER+AP_MULTIPLIED_PER_LEVEL*GetUnitAbilityLevel(udg_HL_Caster, GetSpellAbilityId())) )
set udg_HL_Angle = AngleBetweenPoints(udg_HL_Points[1], udg_HL_Points[2])
//set udg_HL_Effect = AddSpecialEffectTarget("effects\\JuggernautAghanims.mdx", udg_HL_Caster, "weapon")
//set udg_HL_Effect = AddSpecialEffectTarget("effects\\Blood Missile.mdl", udg_HL_Caster, "weapon")
set udg_HL_Effect = AddSpecialEffectTarget("war3mapImported\\Sweep_Chaos_Small.mdx", udg_HL_Caster, "weapon")
call SetUnitPathing( udg_HL_Caster, false )
call UnitAddAbilityBJ( 'Aave', udg_HL_Caster )
call UnitRemoveAbilityBJ( 'Aave', udg_HL_Caster )
call SetUnitTimeScalePercent( udg_HL_Caster, 55.00 )
call RemoveLocation(udg_HL_Points[1])
call RemoveLocation(udg_HL_Points[2])
call EnableTrigger( gg_trg_Heroic_Leap_Loop )
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
function Trig_Heroic_Leap_Loop_Func006C takes nothing returns boolean
if ( not ( GetUnitFlyHeight(udg_HL_Caster) >= 400.00 ) ) then
return false
endif
return true
endfunction
function Trig_Heroic_Leap_Loop_Func009Func012001003001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Heroic_Leap_Loop_Func009Func012001003002001 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_HL_Caster)) == true )
endfunction
function Trig_Heroic_Leap_Loop_Func009Func012001003002002 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction
function Trig_Heroic_Leap_Loop_Func009Func012001003002 takes nothing returns boolean
return GetBooleanAnd( Trig_Heroic_Leap_Loop_Func009Func012001003002001(), Trig_Heroic_Leap_Loop_Func009Func012001003002002() )
endfunction
function Trig_Heroic_Leap_Loop_Func009Func012001003 takes nothing returns boolean
return GetBooleanAnd( Trig_Heroic_Leap_Loop_Func009Func012001003001(), Trig_Heroic_Leap_Loop_Func009Func012001003002() )
endfunction
function Trig_Heroic_Leap_Loop_Func009Func012Func002C takes nothing returns boolean
if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == false ) ) then
return false
endif
return true
endfunction
function Trig_Heroic_Leap_Loop_Func009Func012A takes nothing returns nothing
local integer COLOSSUS_SMASH = LoadInteger(udg_hash,GetHandleId(udg_HL_Caster),COLOSSUS_SMASH_LEVEL_HASH)
call DealPhysicalDamage(udg_HL_Caster, GetEnumUnit(), udg_HL_Damage )
if COLOSSUS_SMASH > 0 then
call ApplyArmorPenetration(GetEnumUnit(), COLOSSUS_SMASH_EXPERTISE_MULTIPLIER * GetHeroAgi(udg_HL_Caster,true))
endif
if ( Trig_Heroic_Leap_Loop_Func009Func012Func002C() ) then
call SetUnitAnimation( GetEnumUnit(), "death" )
else
endif
endfunction
function Trig_Heroic_Leap_Loop_Func009C takes nothing returns boolean
if ( not ( udg_HL_Distance < 100.00 ) ) then
return false
endif
return true
endfunction
function Trig_Heroic_Leap_Loop_Actions takes nothing returns nothing
local timer t = null
set udg_LeakPoint[5] = GetUnitLoc(udg_HL_Caster)
set udg_HL_Points[1] = PolarProjectionBJ(udg_LeakPoint[5], udg_HL_Speed, udg_HL_Angle)
call SetUnitPositionLoc( udg_HL_Caster, udg_HL_Points[1] )
call SetUnitFlyHeightBJ( udg_HL_Caster, ( GetUnitFlyHeight(udg_HL_Caster) + udg_HL_FlySpeed ), 0.00 )
if ( Trig_Heroic_Leap_Loop_Func006C() ) then
set udg_HL_FlySpeed = -33.00
else
endif
call RemoveLocation(udg_LeakPoint[5])
set udg_HL_Distance = ( udg_HL_Distance - udg_HL_Speed )
if ( Trig_Heroic_Leap_Loop_Func009C() ) then
call SetUnitTimeScalePercent( udg_HL_Caster, 100.00 )
call SetUnitFlyHeightBJ( udg_HL_Caster, 0.00, 0.00 )
call SetUnitPathing( udg_HL_Caster, true )
call PauseUnitBJ( false, udg_HL_Caster )
call DestroyEffect(udg_HL_Effect)
call CameraSetEQNoiseForPlayer( GetOwningPlayer(udg_HL_Caster), 15.00 )
set t = CreateTimer()
call TimerStart(t,1.,false,function StopCameraShake)
call SavePlayerHandle(udg_hash,GetHandleId(t),1,GetOwningPlayer(udg_HL_Caster))
set t = null
set bj_wantDestroyGroup = true
call ForGroupBJ( GetUnitsInRangeOfLocMatching(275.00, udg_HL_Points[1], Condition(function Trig_Heroic_Leap_Loop_Func009Func012001003)), function Trig_Heroic_Leap_Loop_Func009Func012A )
call DisableTrigger( GetTriggeringTrigger() )
else
endif
call RemoveLocation(udg_HL_Points[1])
endfunction
//===========================================================================
function InitTrig_Heroic_Leap_Loop takes nothing returns nothing
set gg_trg_Heroic_Leap_Loop = CreateTrigger( )
call DisableTrigger( gg_trg_Heroic_Leap_Loop )
call TriggerRegisterTimerEventPeriodic( gg_trg_Heroic_Leap_Loop, 0.04 )
call TriggerAddAction( gg_trg_Heroic_Leap_Loop, function Trig_Heroic_Leap_Loop_Actions )
endfunction
library SorceressTalents initializer onInit requires MapGameplayUtils
globals
constant integer SORCERESS_CODE = 'H00A'
private constant integer MAX_TALENTS = 10
private constant integer FROZEN_ORB_CODE = 'A04S'
private constant integer CHILLED_BONE_CODE = 'A04T'
private constant integer GALVANIZING_SPARK_CODE = 'A04U'
private constant integer FLAMESTRIKE_CODE = 'A04V'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer FROZEN_ORB_LEVEL_HASH = 250
constant real FROZEN_ORB_DAMAGE_BONUS = 0.1
constant integer CHILLED_BONE_LEVEL_HASH = 251
constant real CHILLED_BONE_CRIT_RECEIVED_BONUS = 3.
constant real CHILLED_BONE_DURATION = 6.
constant integer GALVANIZING_SPARK_LEVEL_HASH = 252
constant real GALVANIZING_SPARK_MANA_CONSUME = 0.1
constant real GALVANIZING_SPARK_AOE = 800.
constant integer FLAMESTRIKE_LEVEL_HASH = 253
constant real FLAMESTRIKE_DAMAGE = 75.
constant real FLAMESTRIKE_DOT_PERIOD = 1.
constant real FLAMESTRIKE_DOT_DURATION = 4.
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == SORCERESS_CODE
endfunction
private function GetFrozenOrbDescriptionByLevel takes integer lvl returns string
return "Increases the damage of Icy Disaster by |c008080C0" + I2S(R2I(FROZEN_ORB_DAMAGE_BONUS*100*lvl)) +"%|r and makes it slow affected units for " + I2S(2+lvl) + " seconds."
endfunction
private function GetChilledBoneDescriptionByLevel takes integer lvl returns string
return "Enemies, which enters Crystal Impale has increased chance to get a spell critical hit by |c008080C0" + I2S(R2I(CHILLED_BONE_CRIT_RECEIVED_BONUS*lvl)) + "%|r for "+ I2S(R2I(CHILLED_BONE_DURATION)) +" seconds."
endfunction
private function GetGalvanizingSparkDescriptionByLevel takes integer lvl returns string
return "Consumes |c008080C0" + I2S(R2I(GALVANIZING_SPARK_MANA_CONSUME*100*lvl)) + "%|r of the mana spent while casting Arcane Beam to heal allies in " + I2S(R2I(GALVANIZING_SPARK_AOE)) + " AOE around the hero."
endfunction
private function GetFlamestrikeDescriptionByLevel takes integer lvl returns string
return "Dragon's Roar burns the affected enemies, dealing |c008080C0" + I2S(R2I(FLAMESTRIKE_DAMAGE*lvl)) + "|r |cffd45e19fire|r damage per " + I2S(R2I(FLAMESTRIKE_DOT_PERIOD)) + " sec. over "+ I2S(R2I(FLAMESTRIKE_DOT_DURATION)) +" sec."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),FROZEN_ORB_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(FROZEN_ORB_CODE, GetFrozenOrbDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetFrozenOrbDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(FROZEN_ORB_CODE, GetFrozenOrbDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),CHILLED_BONE_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(CHILLED_BONE_CODE, GetChilledBoneDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetChilledBoneDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(CHILLED_BONE_CODE, GetChilledBoneDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),GALVANIZING_SPARK_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(GALVANIZING_SPARK_CODE, GetGalvanizingSparkDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetGalvanizingSparkDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(GALVANIZING_SPARK_CODE, GetGalvanizingSparkDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),FLAMESTRIKE_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(FLAMESTRIKE_CODE, GetFlamestrikeDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetFlamestrikeDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(FLAMESTRIKE_CODE, GetFlamestrikeDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == FROZEN_ORB_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"FROZEN ORB CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),FROZEN_ORB_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),FROZEN_ORB_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),FROZEN_ORB_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),FROZEN_ORB_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == CHILLED_BONE_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CHILLED BONE CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),CHILLED_BONE_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),CHILLED_BONE_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),CHILLED_BONE_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),CHILLED_BONE_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == GALVANIZING_SPARK_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"GALVANIZING SPARK CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),GALVANIZING_SPARK_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),GALVANIZING_SPARK_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),GALVANIZING_SPARK_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),GALVANIZING_SPARK_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == FLAMESTRIKE_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"FLAMESTRIKE CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),FLAMESTRIKE_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),FLAMESTRIKE_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),FLAMESTRIKE_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),FLAMESTRIKE_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function SorceressUnlearnTalents takes unit hero returns nothing
local integer FROZEN_ORB_LEVEL = LoadInteger(udg_hash,GetHandleId(hero), FROZEN_ORB_LEVEL_HASH)
local integer CHILLED_BONE_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),CHILLED_BONE_LEVEL_HASH)
local integer GALVANIZING_SPARK_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),GALVANIZING_SPARK_LEVEL_HASH)
local integer FLAMESTRIKE_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),FLAMESTRIKE_LEVEL_HASH)
local integer sum = FROZEN_ORB_LEVEL+CHILLED_BONE_LEVEL+GALVANIZING_SPARK_LEVEL+FLAMESTRIKE_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),FROZEN_ORB_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),CHILLED_BONE_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),GALVANIZING_SPARK_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),FLAMESTRIKE_LEVEL_HASH,0)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope DragonsRoar initializer onInit
globals
private constant integer ABILCODE = 'A00T'
private constant real AOE = 250.
private constant string EFFECT = ""
private constant string ATTACH = ""
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local integer FLAMESTRIKE_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),FLAMESTRIKE_LEVEL_HASH)
local group g = null
local unit tempu = null
if FLAMESTRIKE_LEVEL > 0 then
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g, x,y, AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DOT(CASTER,tempu,FLAMESTRIKE_DAMAGE*FLAMESTRIKE_LEVEL,FLAMESTRIKE_DOT_DURATION,FLAMESTRIKE_DOT_PERIOD,1,EFFECT,ATTACH,true)
call GroupRemoveUnit(g,tempu)
endloop
endif
call DestroyGroup(g)
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope ArcaneBeam initializer onInit
globals
private constant integer ABILCODE = 'A04Q'
private constant integer BEAMCODE = 'h02M'
private constant real BEAM_AOE = 125.
private constant real BASE_DAMAGE_PER_LEVEL = 50.
private constant real MANA_PERCENT_COST = 0.06
private constant real SPELL_POWER_EFFECT = 0.35
private constant real SPELL_POWER_PER_LEVEL = 0.05
private constant real AFFECTED_PERIOD = 0.5
private constant real BEAM_SPEED = 8000.
private constant real RAY_DIST = 1000.
private constant real BEAM_CREATE_PERIOD = 0.05
private constant integer ISPREVENTED_HASH = 201
private constant real ANGLE_SPEED = 1.57
private constant string EFFECT = "Abilities\\Spells\\Human\\SpellSteal\\SpellStealMissile.mdl"
private constant string EXPLOSION_EFFECT = "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl"
private constant string EXPLOSION_ATTACH = "chest"
private constant string CASTER_EFFECT = "Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl"
private constant string CASTER_ATTACH = "origin"
private constant real CHANGE_ANIM_PERIOD = 0.28
private group AFFECTED = CreateGroup()
private group TEMP_GROUP = null
private constant real PI_CONST = 3.1416
private constant real ANGLE_SMALL = 0.1
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function GroupFilterAlly takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and (GetWidgetLife(GetFilterUnit())>0.) and (not BlzIsUnitInvulnerable(GetFilterUnit()))
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function KillBeams takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
private function MoveBeams takes nothing returns nothing
local unit BEAM = GetEnumUnit()
if GetWidgetLife(BEAM)>0. then
call SetUnitX(BEAM,GetUnitX(BEAM)+(BEAM_SPEED/25.)*Cos(Deg2Rad(GetUnitFacing(BEAM))))
call SetUnitY(BEAM,GetUnitY(BEAM)+(BEAM_SPEED/25.)*Sin(Deg2Rad(GetUnitFacing(BEAM))))
else
call GroupRemoveUnit(TEMP_GROUP,BEAM)
endif
set BEAM = null
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
//angles between 0..2pi
private function AnglesIsClose takes real a1, real a2 returns boolean
local real diff = a1 - a2
if diff < 0. then
set diff = -diff
endif
return (diff < ANGLE_SMALL) or ((2*PI_CONST-diff) < ANGLE_SMALL)
endfunction
private function IsUnitCloseToRay takes unit u, unit CASTER, real rayAngle returns boolean
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real xc = GetUnitX(CASTER)
local real yc = GetUnitY(CASTER)
local real Xc = xc + 10*Cos(rayAngle)
local real Yc = yc + 10*Sin(rayAngle)
local real cosa = 0.
local real dist = SquareRoot( (x-xc)*(x-xc)+(y-yc)*(y-yc) )
local real Sprod = (Xc-xc) * (x-xc) + (Yc-yc)*(y-yc)
local real angle = Atan2(y-yc,x-xc)
if Sprod>=0 then
if dist <= BEAM_AOE then
return false
else
set cosa = ( Sprod) / ( SquareRoot( (Xc-xc)*(Xc-xc)+(Yc-yc)*(Yc-yc) ) * SquareRoot((x-xc)*(x-xc)+(y-yc)*(y-yc)) )
return (dist*SquareRoot(1-cosa*cosa) ) <= BEAM_AOE
endif
else
return false
endif
return false
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local group g = LoadGroupHandle(udg_hash,GetHandleId(t),2)
local real SinceLastBeam = LoadReal(udg_hash,GetHandleId(t),3)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real x1 = GetPlayerMouseX(GetOwningPlayer(CASTER))
local real y1 = GetPlayerMouseY(GetOwningPlayer(CASTER))
local real angle = Atan2(y1-y,x1-x)
local real newAngle = 0.
local unit tempu = null
local group tempGroup = CreateGroup()
local real lastAngle = Deg2Rad(GetUnitFacing(CASTER))
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local real ElapsedAnim = LoadReal(udg_hash,GetHandleId(t),4)
local boolean DirectAnim = LoadBoolean(udg_hash,GetHandleId(t),5)
local real MANA_CONSUMED = LoadReal(udg_hash,GetHandleId(t),6)
local integer GALVANIZING_SPARK_LEVEL = 0
local real DAMAGE = BASE_DAMAGE_PER_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)+(SPELL_POWER_EFFECT+SPELL_POWER_PER_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE))*GetUnitSpellPower(CASTER)
local real manacost = GetUnitState(CASTER,UNIT_STATE_MAX_MANA) * MANA_PERCENT_COST / 25.
set ElapsedAnim = ElapsedAnim + 0.04
if ElapsedAnim >= CHANGE_ANIM_PERIOD then
if not DirectAnim then
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,CASTER,"hand left"))
call SetUnitTimeScale(CASTER,1.)
call SaveBoolean(udg_hash,GetHandleId(t),5,true)
else
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,CASTER,"hand left"))
call SetUnitTimeScale(CASTER,-1.)
call SaveBoolean(udg_hash,GetHandleId(t),5,false)
endif
else
call SaveReal(udg_hash,GetHandleId(t),4,ElapsedAnim)
endif
//dealing dmg
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(tempGroup, x, y , RAY_DIST+200., function GroupFilter)
loop
set tempu = FirstOfGroup(tempGroup)
exitwhen tempu==null
if not IsUnitInGroup(tempu,AFFECTED) and IsUnitCloseToRay(tempu,CASTER,lastAngle) then
call DealArcaneDamage(CASTER,tempu,DAMAGE)
call GroupAddUnit(AFFECTED,tempu)
call DestroyEffect(AddSpecialEffectTarget(EXPLOSION_EFFECT,tempu,EXPLOSION_ATTACH))
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,AFFECTED_PERIOD, false, function onTimerRemoveAffect)
set t1 = null
endif
call GroupRemoveUnit(tempGroup,tempu)
endloop
call DestroyGroup(tempGroup)
//moving ray
if not (angle >= 0.) and (angle < PI_CONST) then
set angle = angle + 2*PI_CONST
endif
set newAngle = lastAngle
if not AnglesIsClose(lastAngle,angle) then
if lastAngle<angle then
if lastAngle + (2*PI_CONST-angle) > angle-lastAngle then
set newAngle = lastAngle + ANGLE_SPEED/25.
else
set newAngle = lastAngle - ANGLE_SPEED/25.
endif
else
if angle + (2*PI_CONST-lastAngle) < lastAngle-angle then
set newAngle = lastAngle + ANGLE_SPEED/25.
else
set newAngle = lastAngle - ANGLE_SPEED/25.
endif
endif
endif
call SetUnitFacing(CASTER,Rad2Deg(newAngle))
set TEMP_GROUP = g
call ForGroup(g,function MoveBeams)
set TEMP_GROUP = null
set SinceLastBeam = SinceLastBeam + 0.04
if SinceLastBeam >= BEAM_CREATE_PERIOD then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Creating Beam")
set tempu = CreateUnit(GetOwningPlayer(CASTER),BEAMCODE,x+65*Cos(newAngle),y+65*Sin(newAngle),Rad2Deg(newAngle))
call UnitApplyTimedLife(tempu,'BHwe',RAY_DIST/BEAM_SPEED)
call GroupAddUnit(g,tempu)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
set tempu = null
else
call SaveReal(udg_hash,GetHandleId(t),3,SinceLastBeam)
endif
if GetUnitState(CASTER,UNIT_STATE_MANA) >= manacost then
set MANA_CONSUMED = MANA_CONSUMED + manacost
call SaveReal(udg_hash,GetHandleId(t),6,MANA_CONSUMED)
call SetUnitState(CASTER,UNIT_STATE_MANA, GetUnitState(CASTER,UNIT_STATE_MANA)-manacost)
else
call IssueImmediateOrder(CASTER,"stop")
endif
if ISPREVENTED then
call ForGroup(g,function KillBeams)
call DestroyGroup(g)
set GALVANIZING_SPARK_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),GALVANIZING_SPARK_LEVEL_HASH)
if GALVANIZING_SPARK_LEVEL>0 then
set udg_temp_unit = CASTER
set g = CreateGroup()
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),GALVANIZING_SPARK_AOE,function GroupFilterAlly)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call HealUnit(CASTER,tempu,MANA_CONSUMED*GALVANIZING_SPARK_LEVEL*GALVANIZING_SPARK_MANA_CONSUME)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl",tempu,"chest"))
call GroupRemoveUnit(g,tempu)
endloop
endif
call DestroyGroup(g)
call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),6))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set g = null
set CASTER = null
set tempGroup = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveGroupHandle(udg_hash,GetHandleId(t),2,CreateGroup())
call SaveEffectHandle(udg_hash,GetHandleId(t),6,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveReal(udg_hash,GetHandleId(t),3,0.)
//for animation
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveBoolean(udg_hash,GetHandleId(t),5,false)
//for galvanizing spark mana consumed counter
call SaveReal(udg_hash,GetHandleId(t),6,0.)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope IcyDisaster initializer onInit
globals
private constant integer ABILCODE = 'A00K'
private constant integer NOVACODE = 'A03V'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
function IDEnums takes nothing returns boolean
return (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_ID_Caster))) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0) and ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit a = LoadUnitHandle(udg_hash,id,2)
local real height = LoadReal(udg_hash,id,3)
local real angle = LoadReal(udg_hash,id,4)
local integer i = 1
local real spellpower = 0.
local real damage = 0.
local group g = null
local unit tempunit = null
local unit caster = null
local integer FROZEN_ORB_LEVEL = 0
set height = height - 60.
call SetUnitX(a,GetUnitX(a)+40.*Cos(angle))
call SetUnitY(a,GetUnitY(a)+40.*Sin(angle))
call SetUnitFlyHeight(a,height,0)
call SaveReal(udg_hash,id,3,height)
if (height <= 0.) then
set g = CreateGroup()
set caster = LoadUnitHandle(udg_hash,id,1)
set FROZEN_ORB_LEVEL = LoadInteger(udg_hash,GetHandleId(caster),FROZEN_ORB_LEVEL_HASH)
set spellpower = LoadReal(udg_hash,GetHandleId(caster),5)
set damage = (GetUnitAbilityLevel(caster,ABILCODE) * 250. + spellpower)*(1+FROZEN_ORB_DAMAGE_BONUS*FROZEN_ORB_LEVEL)
set udg_ID_Point = GetUnitLoc(a)
set udg_ID_Caster = caster
call PlaySoundAtPointBJ( gg_snd_FrostBoltHit1, 100, udg_ID_Point, 0. )
call GroupEnumUnitsInRange(g,GetUnitX(a),GetUnitY(a),250.,Condition(function IDEnums))
loop
set tempunit = FirstOfGroup(g)
exitwhen tempunit == null
set angle = bj_RADTODEG * Atan2(GetUnitY(tempunit)-GetLocationY(udg_ID_Point),GetUnitX(tempunit)-GetLocationX(udg_ID_Point))
if IsUnitType(tempunit,UNIT_TYPE_HERO) == false and not LoadBoolean(udg_hash,GetHandleId(tempunit),300) then
call ParKnock(tempunit,0.,200.,0.65,angle,true,"none")
call SetUnitAnimation( tempunit, "death" )
endif
call DealMagicalDamageOfType(caster,tempunit,damage,"FROST")
call DummyCastTarget(caster,tempunit,NOVACODE,FROZEN_ORB_LEVEL+1,"frostnova")
call GroupRemoveUnit(g,tempunit)
set tempunit = null
endloop
loop
exitwhen i>3
set tempunit = CreateUnit(GetOwningPlayer(caster),'h00C',GetUnitX(a),GetUnitY(a),36.*I2R(i))
call UnitApplyTimedLife(tempunit,'BHwe',1.)
call ParKnock(tempunit,300.,300.,1.,angle*bj_RADTODEG + 45.*I2R(i-1),false,"none")
set tempunit = null
set i = i + 1
endloop
call KillUnit(a)
call RemoveLocation(udg_ID_Point)
call DestroyGroup(g)
call FlushChildHashtable(udg_hash,id)
call DestroyTimer(t)
endif
set t = null
set a = null
set caster = null
set g = null
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local real angle = GetRandomReal(1.,360.)
local unit a = CreateUnitAtLoc(GetOwningPlayer(u),'h00B',loc,0)
local timer t = CreateTimer()
local real anglenew = 0.
call SetUnitX(a,GetUnitX(a)+1000.*Cos(angle*bj_DEGTORAD))
call SetUnitY(a,GetUnitY(a)+1000.*Sin(angle*bj_DEGTORAD))
set anglenew = Atan2(GetLocationY(loc)-GetUnitY(a),GetLocationX(loc)-GetUnitX(a))
call SetUnitTimeScale(a,3.)
call PlaySoundAtPointBJ(gg_snd_FrostBoltLaunch1, 100, loc, 0 )
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,a)
call SaveReal(udg_hash,GetHandleId(t),3,1500.)
call SaveReal(udg_hash,GetHandleId(t),4,anglenew)
call TimerStart(t,0.04,true,function onTimer)
call RemoveLocation(loc)
set loc = null
set u = null
set a = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope IcyImpale initializer onInit
globals
private constant integer ABILCODE = 'A01H'
group CRYSTAL_IMPALE_AFFECTED_UNITS = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
function CRYSTAL_IMPALE_GROUPFILTER takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and not IsUnitInGroup(GetFilterUnit(),CRYSTAL_IMPALE_AFFECTED_UNITS)
endfunction
function CRYSTAL_IMPALE_REMOVEGROUPSCALE takes nothing returns nothing
//call SetUnitTimeScale(GetEnumUnit(),-0.25)
call SetUnitTimeScale(GetEnumUnit(),1.)
//call SetUnitAnimation(GetEnumUnit(),"death")
endfunction
function CRYSTAL_IMPALE_GROUPSCALE takes nothing returns nothing
//call SetUnitTimeScale(GetEnumUnit(),0.)
call SetUnitAnimation(GetEnumUnit(),"stand")
endfunction
function CRYSTAL_IMPALE_ENDS takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local group g = null
local unit CASTER = LoadUnitHandle(udg_hash,id,2)
local real x = LoadReal(udg_hash,id,3)
local real y = LoadReal(udg_hash,id,4)
local real TIMEOUT = LoadReal(udg_hash,id,5)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local real DAMAGE = 125.*I2R(GetUnitAbilityLevel(CASTER,'A01H')) + SPELLPOWER*0.33
local integer CHILLED_BONE_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),CHILLED_BONE_LEVEL_HASH)
local boolexpr GROUPFILTER = Condition(function CRYSTAL_IMPALE_GROUPFILTER)
local unit temp = null
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(udg_temp_group,x,y,350.,GROUPFILTER)
set udg_temp_unit = FirstOfGroup(udg_temp_group)
loop
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call GroupAddUnit(CRYSTAL_IMPALE_AFFECTED_UNITS,udg_temp_unit)
if not IsUnitType(udg_temp_unit,UNIT_TYPE_HERO) then
set temp = CreateUnit(GetOwningPlayer(CASTER),'h02B',GetUnitX(udg_temp_unit),GetUnitY(udg_temp_unit),0.)
call UnitAddAbility(temp,'A00P')
call SetUnitAbilityLevel(temp,'A00P',GetUnitAbilityLevel(CASTER,'A01H')+2)
call IssueTargetOrder(temp,"attackonce",udg_temp_unit)
call UnitApplyTimedLife(temp,'BHwe',0.5)
call GroupAddUnit(udg_Dummy_Group,temp)
set temp = null
endif
call DOT(CASTER,udg_temp_unit,DAMAGE,3.,1.,3,"effects\\Crystal Impale Hit.mdx","origin",false)
if CHILLED_BONE_LEVEL > 0 then
call AddHeroParameter(udg_temp_unit, CHILLED_BONE_CRIT_RECEIVED_BONUS*CHILLED_BONE_LEVEL,CHILLED_BONE_DURATION, GetSpellCritReceivedBonusHash(), "","")
endif
set udg_temp_unit = FirstOfGroup(udg_temp_group)
endloop
set TIMEOUT = TIMEOUT + 1.
call SaveReal(udg_hash,id,5,TIMEOUT)
if TIMEOUT >= 8. then
set g = LoadGroupHandle(udg_hash,id,1)
call ForGroup(g,function CRYSTAL_IMPALE_REMOVEGROUPSCALE)
call DestroyGroup(g)
set g = null
call FlushChildHashtable(udg_hash,id)
call DestroyTimer(t)
call GroupClear(CRYSTAL_IMPALE_AFFECTED_UNITS)
endif
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
set CASTER = null
set t = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = LoadGroupHandle(udg_hash,GetHandleId(t),1)
call ForGroup(g,function CRYSTAL_IMPALE_GROUPSCALE)
call TimerStart(t,1.,true,function CRYSTAL_IMPALE_ENDS)
set t = null
set g = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local player OWNER = GetOwningPlayer(CASTER)
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local group g = CreateGroup()
local timer t = CreateTimer()
local integer i = 0
local boolexpr GROUPFILTER = Condition(function CRYSTAL_IMPALE_GROUPFILTER)
local real angle = 0.
loop
exitwhen (i > 7)
set udg_temp_unit = CreateUnit(OWNER,'h017',x,y,0.)
call SetUnitX(udg_temp_unit,x + 350.*Cos(45.*I2R(i)*bj_DEGTORAD))
call SetUnitY(udg_temp_unit,y + 350.*Sin(45.*I2R(i)*bj_DEGTORAD))
set angle = Atan2(y-GetUnitY(udg_temp_unit),x-GetUnitX(udg_temp_unit))
call SetUnitFacing(udg_temp_unit,angle*bj_RADTODEG)
//call SetUnitTimeScale(udg_temp_unit,0.25)
call SetUnitAnimation(udg_temp_unit,"birth")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',10.)
call GroupAddUnit(g,udg_temp_unit)
set i = i + 1
endloop
call SaveGroupHandle(udg_hash,GetHandleId(t),1,g)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,CASTER)
call SaveReal(udg_hash,GetHandleId(t),3,x)
call SaveReal(udg_hash,GetHandleId(t),4,y)
call TimerStart(t,0.75,false,function onTimer)
call DestroyBoolExpr(GROUPFILTER)
set CASTER = null
set OWNER = null
set GROUPFILTER = null
set t = null
set g = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen (i >= 5)
call TriggerRegisterPlayerUnitEvent( t,Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT,null )
set i = i + 1
endloop
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
library ChillEffects
globals
group ChilledUnits = CreateGroup()
endglobals
function ReleaseChillEffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local effect e = LoadEffectHandle(udg_hash,GetHandleId(t),2)
local real k = LoadReal(udg_hash,GetHandleId(t),3)
local real a = LoadReal(udg_hash,GetHandleId(u),12)
call GroupRemoveUnit(ChilledUnits,u)
call SaveReal(udg_hash,GetHandleId(u),12,a-k)
call DestroyEffect(e)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
set e = null
endfunction
function MakeUnitChillEffect takes unit whichUnit,real critimp, real duration returns nothing
local timer t = null
local effect e = null
local real a = 0.
if IsUnitInGroup(whichUnit,ChilledUnits)==false then
set a = LoadReal(udg_hash,GetHandleId(whichUnit),12)
set e = AddSpecialEffectTarget("effects\\FrostAura.mdx",whichUnit,"origin")
set t = CreateTimer()
call GroupAddUnit(ChilledUnits,whichUnit)
call SaveReal(udg_hash,GetHandleId(whichUnit),12,a+critimp)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichUnit)
call SaveEffectHandle(udg_hash,GetHandleId(t),2,e)
call SaveReal(udg_hash,GetHandleId(t),3,critimp)
call TimerStart(t,duration,false,function ReleaseChillEffect)
endif
set t = null
set e = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope GlobalAnnihilation initializer onInit
globals
private constant integer ABILCODE = 'A00R'
private constant integer ISPREVENTED_HASH = 202
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Setting time limit to 0 due to prevented or finished cast")
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real duration = LoadReal(udg_hash,GetHandleId(t),2)
local real curduration = LoadReal(udg_hash,GetHandleId(t),3)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real angle = GetRandomReal(0.,360.)
local real r = GetRandomReal(100.,900.)
local unit tempu = null
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local integer FROZEN_ORB_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),FROZEN_ORB_LEVEL_HASH)
local location loc = null
if not ISPREVENTED then
set tempu = CreateUnit(GetOwningPlayer(CASTER),'h009',x,y,0.)
call UnitAddAbility(tempu,'A00K')
call SetUnitAbilityLevel(tempu, 'A00K', GetUnitAbilityLevel(CASTER,'A00K') )
call UnitAddAbility(tempu, 'A00Q')
call SetUnitAbilityLevel(tempu,'A00Q', GetUnitAbilityLevel(CASTER,'A00Q') )
call UnitApplyTimedLife(tempu, 'BHwe', 5.)
call SaveReal(udg_hash,GetHandleId(tempu),2,LoadReal(udg_hash,GetHandleId(CASTER),2))
call SaveReal(udg_hash,GetHandleId(tempu),5,LoadReal(udg_hash,GetHandleId(CASTER),5))
call SaveReal(udg_hash,GetHandleId(tempu),GetElementalDamageBonusHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetElementalDamageBonusHash()))
call SaveReal(udg_hash,GetHandleId(tempu),GetFrostDamageBonusHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetFrostDamageBonusHash()))
call SaveReal(udg_hash,GetHandleId(tempu),FROZEN_ORB_LEVEL_HASH,FROZEN_ORB_LEVEL)
//call IssuePointOrder(tempu,"blizzard",x+r*Cos(Deg2Rad(angle)),y+r*Sin(Deg2Rad(angle)))
set loc = Location(x+r*Cos(Deg2Rad(angle)),y+r*Sin(Deg2Rad(angle)))
call IssuePointOrderLoc(tempu,"blizzard",loc)
call RemoveLocation(loc)
set loc = null
endif
set curduration = curduration + 0.30
if duration - curduration <= 0. or ISPREVENTED then
call IssueImmediateOrder(CASTER,"stop")
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),3,curduration)
endif
set t = null
set CASTER = null
set tempu = null
endfunction
private function onCast takes nothing returns nothing
local timer t = CreateTimer()
local unit CASTER = GetTriggerUnit()
local real duration = ( 2.00 + ( 1.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(),CASTER)) ) )
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,duration)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call TimerStart(t,0.3,true,function onTimer)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
library ShamanTalents initializer onInit
globals
constant integer SHAMAN_CODE = 'O003'
constant integer SHAMAN_WOLF_CODE = 'O004'
private constant integer MAX_TALENTS = 10
private constant integer ANCESTRAL_HEALING_CODE = 'A056'
private constant integer DOWNPOUR_CODE = 'A057'
private constant integer TOTEM_MASTERY_CODE = 'A058'
private constant integer BLOODLUST_CODE = 'A059'
private constant integer FURY_SWIPES_CODE = 'A07K'
private constant integer STORM_ADEPT_CODE = 'A07M'
private constant integer HEROISM_ABILCODE = 'A012'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer ANCESTRAL_HEALING_LEVEL_HASH = 250
constant real ANCESTRAL_HEALING_PROC_CHANCE = 30.
constant real ANCESTRAL_HEALING_BONUS_HEALING = 0.15
constant real ANCESTRAL_HEALING_DURATION = 8.
constant integer DOWNPOUR_LEVEL_HASH = 251
constant real DOWNPOUR_AOE_BONUS = 50.
constant real DOWNPOUR_INSTANT_HEALING = 100.
constant real DOWNPOUR_SPELLPOWER_EFFECT = 0.05
constant integer TOTEM_MASTERY_LEVEL_HASH = 252
constant real TOTEM_MASTERY_SPREAD_TIME_REDUCE = 0.15
constant real TOTEM_MASTERY_RESTORED_HEALING = 0.2
constant integer BLOODLUST_LEVEL_HASH = 253
constant integer BLOODLUST_COOLDOWN_REDUCE = 2
constant real BLOODLUST_DURATION_INCREASE = 1.
constant integer FURY_SWIPES_LEVEL_HASH = 254
constant real FURY_SWIPES_DAMAGE_BASE = 75
constant real FURY_SWIPES_DAMAGE_LVL = 125
constant integer FURY_SWIPES_ARMOR_BASE = 3
constant real FURY_SWIPES_AOE = 250
constant integer FURY_SWIPES_ARMOR_LVL = 2
constant integer FURY_SWIPES_WOLF_ABILCODE = 'A07L'
constant integer STORM_ADEPT_LEVEL_HASH = 255
constant real STORM_ADEPT_AOE = 200
constant real STORM_ADEPT_DAMAGE_BASE = 50.
constant real STORM_ADEPT_DAMAGE_LVL = 25.
constant real STORM_ADEPT_SPELLPOWER_PERCENT_BASE = 0.2
constant real STORM_ADEPT_SPELLPOWER_PERCENT_LVL = 0.3
constant integer STORM_ADEPT_DUMMY_ABILCODE = 'A07N'
timer STORM_ADEPT_TIMER = CreateTimer()
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == SHAMAN_CODE
endfunction
private function GetAncestralHealingDescriptionByLevel takes integer lvl returns string
return "Chain heal has a " + I2S(R2I(ANCESTRAL_HEALING_PROC_CHANCE)) +"% chance to increase healing effects on its targets by |c008080C0"+ I2S(R2I(ANCESTRAL_HEALING_BONUS_HEALING*100*lvl)) + "%|r for " + I2S(R2I(ANCESTRAL_HEALING_DURATION)) + " seconds."
endfunction
private function GetDownpourDescriptionByLevel takes integer lvl returns string
return "Increases the area of effect of Healing Rain by " + I2S(R2I(DOWNPOUR_AOE_BONUS*lvl)) +" and makes it immediately restore [|c008080C0" + I2S(R2I(DOWNPOUR_INSTANT_HEALING*lvl)) + "|r + |c008080C0" + I2S(R2I(DOWNPOUR_SPELLPOWER_EFFECT*100*lvl)) +"%|r of Spellpower] hit points to affected allies after the cast."
endfunction
private function GetTotemMasteryDescriptionByLevel takes integer lvl returns string
return "Reduces the period of mana spread for Mana totem by |c008080C0" + R2S(TOTEM_MASTERY_SPREAD_TIME_REDUCE*lvl) +"|r sec. and makes it heal the target for |c008080C0" + I2S(R2I(TOTEM_MASTERY_RESTORED_HEALING*100*lvl)) + "%|r of the restored mana."
endfunction
private function GetBloodlustDescriptionByLevel takes integer lvl returns string
return "Increases the duration of Heroism by |c008080C0"+ I2S(lvl) +"|r second and reduces its cooldown by |c008080C0"+ I2S(2*lvl) + "|r seconds."
endfunction
private function GetFurySwipesDescriptionByLevel takes integer lvl returns string
return "Unlocks the ghost wolf form ability. Slams the targeted enemy, dealing |c008080C0" + I2S(R2I(FURY_SWIPES_DAMAGE_BASE+FURY_SWIPES_DAMAGE_LVL*lvl)) + "|r |cffc0c0c0physical|r damage in " + I2S(R2I(FURY_SWIPES_AOE)) + " AOE and temporarily reducing armor by |c008080C0" + I2S(FURY_SWIPES_ARMOR_BASE+FURY_SWIPES_ARMOR_LVL*lvl) + "|r as an armor penetration effect."
endfunction
private function GetStormAdeptDescriptionByLevel takes integer lvl returns string
return "Basic attacks apply a purge effect to the target, slowing it, removing positive buffs and dealing |c008080C0" + I2S(R2I(STORM_ADEPT_DAMAGE_BASE+STORM_ADEPT_DAMAGE_LVL*lvl)) + "|r [|c008080C0" + I2S(R2I( (STORM_ADEPT_SPELLPOWER_PERCENT_BASE+STORM_ADEPT_SPELLPOWER_PERCENT_LVL*lvl)*100 )) +"%|r of SPELLPOWER] as elemental damage in " + I2S(R2I(STORM_ADEPT_AOE)) + " AOE."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
local integer i = 0
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),ANCESTRAL_HEALING_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(ANCESTRAL_HEALING_CODE, GetAncestralHealingDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetAncestralHealingDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(ANCESTRAL_HEALING_CODE, GetAncestralHealingDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),DOWNPOUR_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(DOWNPOUR_CODE, GetDownpourDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetDownpourDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(DOWNPOUR_CODE, GetDownpourDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),TOTEM_MASTERY_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(TOTEM_MASTERY_CODE, GetTotemMasteryDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetTotemMasteryDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(TOTEM_MASTERY_CODE, GetTotemMasteryDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),BLOODLUST_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(BLOODLUST_CODE, GetBloodlustDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetBloodlustDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(BLOODLUST_CODE, GetBloodlustDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),FURY_SWIPES_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(FURY_SWIPES_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetFurySwipesDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(FURY_SWIPES_CODE, GetFurySwipesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetFurySwipesDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(FURY_SWIPES_CODE, GetFurySwipesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
loop
exitwhen i>9
set i = i + 1
call BlzSetAbilityExtendedTooltip(FURY_SWIPES_WOLF_ABILCODE, "Slams the targeted enemy, dealing " + I2S(R2I(FURY_SWIPES_DAMAGE_BASE+FURY_SWIPES_DAMAGE_LVL*i)) + " |cffc0c0c0physical|r damage in " + I2S(R2I(FURY_SWIPES_AOE)) + " AOE and temporarily reducing armor by " + I2S(FURY_SWIPES_ARMOR_BASE+FURY_SWIPES_ARMOR_LVL*i) + " as an armor penetration effect.",i-1)
endloop
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),STORM_ADEPT_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(STORM_ADEPT_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetStormAdeptDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(STORM_ADEPT_CODE, GetStormAdeptDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetStormAdeptDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(STORM_ADEPT_CODE, GetStormAdeptDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == ANCESTRAL_HEALING_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Ancestral Healing CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),ANCESTRAL_HEALING_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),ANCESTRAL_HEALING_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),ANCESTRAL_HEALING_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),ANCESTRAL_HEALING_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == DOWNPOUR_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Downpour CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),DOWNPOUR_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),DOWNPOUR_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),DOWNPOUR_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),DOWNPOUR_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == TOTEM_MASTERY_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Totem Mastery CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),TOTEM_MASTERY_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),TOTEM_MASTERY_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),TOTEM_MASTERY_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),TOTEM_MASTERY_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == BLOODLUST_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Bloodlust CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and (GetUnitAbilityLevel(CASTER,HEROISM_ABILCODE)>0) and LoadInteger(udg_hash,GetHandleId(CASTER),BLOODLUST_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),BLOODLUST_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),BLOODLUST_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
set j = 0
loop
exitwhen j>5
call BlzSetUnitAbilityCooldown(CASTER,HEROISM_ABILCODE,j,BlzGetUnitAbilityCooldown(CASTER,HEROISM_ABILCODE,j)-BLOODLUST_COOLDOWN_REDUCE)
set j = j + 1
endloop
else
if LoadInteger(udg_hash,GetHandleId(CASTER),BLOODLUST_LEVEL_HASH) < MAX_TALENTS then
if GetUnitAbilityLevel(CASTER,HEROISM_ABILCODE)>0 then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"You have to learn Heroism first")
endif
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == FURY_SWIPES_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"FURY_SWIPES CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),FURY_SWIPES_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),FURY_SWIPES_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),FURY_SWIPES_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),FURY_SWIPES_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == STORM_ADEPT_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"FURY_SWIPES CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),STORM_ADEPT_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),STORM_ADEPT_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),STORM_ADEPT_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),STORM_ADEPT_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function ShamanUnlearnTalents takes unit hero returns nothing
local integer j = 0
local integer ANCESTRAL_HEALING_LEVEL = LoadInteger(udg_hash,GetHandleId(hero), ANCESTRAL_HEALING_LEVEL_HASH)
local integer DOWNPOUR_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),DOWNPOUR_LEVEL_HASH)
local integer TOTEM_MASTERY_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),TOTEM_MASTERY_LEVEL_HASH)
local integer BLOODLUST_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),BLOODLUST_LEVEL_HASH)
local integer FURY_SWIPES_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),FURY_SWIPES_LEVEL_HASH)
local integer STORM_ADEPT_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),STORM_ADEPT_LEVEL_HASH)
local integer sum = ANCESTRAL_HEALING_LEVEL+DOWNPOUR_LEVEL+TOTEM_MASTERY_LEVEL+BLOODLUST_LEVEL+FURY_SWIPES_LEVEL+STORM_ADEPT_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),ANCESTRAL_HEALING_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),DOWNPOUR_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),TOTEM_MASTERY_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),BLOODLUST_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),FURY_SWIPES_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),STORM_ADEPT_LEVEL_HASH,0)
if GetUnitAbilityLevel(hero,HEROISM_ABILCODE) > 0 then
set j = 0
loop
exitwhen j>5
call BlzSetUnitAbilityCooldown(hero,HEROISM_ABILCODE,j,BlzGetAbilityCooldown(HEROISM_ABILCODE,j))
set j = j + 1
endloop
endif
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),FURY_SWIPES_WOLF_ABILCODE, false)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope AdeptOfTheStorm initializer onInit
globals
private constant integer PURGE_ABILCODE = 'A07N'
endglobals
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onTimerExpired takes nothing returns nothing
local timer t = STORM_ADEPT_TIMER
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local group g = CreateGroup()
local unit tempu = null
local integer STORM_ADEPT_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),STORM_ADEPT_LEVEL_HASH)
local real DAMAGE = STORM_ADEPT_DAMAGE_BASE +STORM_ADEPT_DAMAGE_LVL*STORM_ADEPT_LEVEL + (STORM_ADEPT_SPELLPOWER_PERCENT_BASE+STORM_ADEPT_SPELLPOWER_PERCENT_LVL*STORM_ADEPT_LEVEL)*GetUnitSpellPower(CASTER)
call DummyCastTarget(CASTER,TARGET,PURGE_ABILCODE,STORM_ADEPT_LEVEL,"purge")
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),STORM_ADEPT_AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DealMagicalDamageOfType(CASTER,tempu,DAMAGE, "ELEMENTAL")
if not (tempu == TARGET) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl",tempu,"chest"))
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set CASTER = null
set TARGET = null
set g = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,STORM_ADEPT_TIMER)
call TriggerAddAction(t,function onTimerExpired)
set t = null
endfunction
endscope
scope FurySwipes initializer onInit
globals
private constant integer ABILCODE = FURY_SWIPES_WOLF_ABILCODE //Defined at Shaman Talents trigger
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local group g = CreateGroup()
local unit tempu = null
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local integer FURY_SWIPES_LEVEL = GetUnitAbilityLevel(CASTER,ABILCODE)
local integer ARMOR_PENETRATION = FURY_SWIPES_ARMOR_BASE + FURY_SWIPES_ARMOR_LVL * FURY_SWIPES_LEVEL
local real DAMAGE = FURY_SWIPES_DAMAGE_BASE + FURY_SWIPES_DAMAGE_LVL * FURY_SWIPES_LEVEL
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),FURY_SWIPES_AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if (xt-x)*(GetUnitX(tempu)-x)+(yt-y)*(GetUnitY(tempu)-y) >= 0 then
if IsUnitKnockbackable(tempu) then
call SetUnitAnimation(tempu,"death")
endif
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\HydraliskImpact\\HydraliskImpact.mdl",tempu,"chest"))
call DealPhysicalDamage(CASTER,tempu,DAMAGE)
call ApplyArmorPenetration(tempu, ARMOR_PENETRATION)
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set CASTER = null
set TARGET = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conds )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=10
//TESH.alwaysfold=0
function Wolf_Form_Actions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit CASTER = GetTriggerUnit()
local integer FURY_SWIPES_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),FURY_SWIPES_LEVEL_HASH)
local timer t = null
if GetIssuedOrderId() == OrderId("bearform") then
call MakeUnitPassive(GetTriggerUnit())
call SetPlayerAbilityAvailable(p,'A010',false)
call SetPlayerAbilityAvailable(p,'A00Z',false)
call SetPlayerAbilityAvailable(p,'A026',false)
call SetPlayerAbilityAvailable(p,'A012',false)
call SetPlayerAbilityAvailable(p,FURY_SWIPES_WOLF_ABILCODE, false)
if FURY_SWIPES_LEVEL > 0 then
call SetPlayerAbilityAvailable(p,FURY_SWIPES_WOLF_ABILCODE, true)
call SetUnitAbilityLevel(CASTER,FURY_SWIPES_WOLF_ABILCODE,FURY_SWIPES_LEVEL)
endif
elseif GetIssuedOrderId() == OrderId("unbearform") then
call MakeUnitPassive(GetTriggerUnit())
call SetPlayerAbilityAvailable(p,'A010',true)
call SetPlayerAbilityAvailable(p,'A00Z',true)
call SetPlayerAbilityAvailable(p,'A026',true)
call SetPlayerAbilityAvailable(p,'A012',true)
call SetPlayerAbilityAvailable(p,FURY_SWIPES_WOLF_ABILCODE, false)
endif
set p = null
endfunction
function Wolf_Form_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'O003' or GetUnitTypeId(GetTriggerUnit()) == 'O004'
endfunction
//===========================================================================
function InitTrig_Wolf_Form_NO_CAST takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddAction( t, function Wolf_Form_Actions )
call TriggerAddCondition(t,Condition(function Wolf_Form_Conditions))
set t = null
endfunction
//TESH.scrollpos=65
//TESH.alwaysfold=0
globals
unit HR_CASTER
endglobals
function Trig_Healing_Rain_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00Z'
endfunction
function HealingRainConds takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(HR_CASTER)) and not(IsUnitDeadBX(GetFilterUnit())) and not BlzIsUnitInvulnerable(GetFilterUnit())
endfunction
function HealingRainActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit EFFECT = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real BASEHEAL = LoadReal(udg_hash,GetHandleId(t),3)
//local real HEALINGDONE = LoadReal(udg_hash,GetHandleId(CASTER),11)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5) / 5.
local real CURHEAL =(BASEHEAL + SPELLPOWER)
//local real HEALINGBONUS
local integer TIMEOUT = LoadInteger(udg_hash,GetHandleId(t),4)
local integer DOWNPOUR = LoadInteger(udg_hash,GetHandleId(CASTER),DOWNPOUR_LEVEL_HASH)
local group g = CreateGroup()
local unit TEMPUNIT = null
set HR_CASTER = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(EFFECT),GetUnitY(EFFECT),480+DOWNPOUR_AOE_BONUS*DOWNPOUR,Condition(function HealingRainConds))
loop
set TEMPUNIT = FirstOfGroup(g)
exitwhen TEMPUNIT == null
call HealUnitPeriodic(CASTER,TEMPUNIT,CURHEAL)
call GroupRemoveUnit(g,TEMPUNIT)
set TEMPUNIT = null
endloop
set TIMEOUT = TIMEOUT + 2
call SaveInteger(udg_hash,GetHandleId(t),4,TIMEOUT)
if TIMEOUT>=10 then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call RemoveUnit(EFFECT)
endif
call DestroyGroup(g)
set t = null
set CASTER = null
set EFFECT = null
set g = null
endfunction
function Healing_Rain_SlowEffect takes nothing returns nothing
call SetUnitTimeScale(LoadUnitHandle(udg_hash,GetHandleId(GetExpiredTimer()),1),0.15)
call FlushChildHashtable(udg_hash,GetHandleId(GetExpiredTimer()))
call DestroyTimer(GetExpiredTimer())
endfunction
function Trig_Healing_Rain_Actions takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local timer t1 = CreateTimer()
local integer DOWNPOUR = LoadInteger(udg_hash,GetHandleId(CASTER),DOWNPOUR_LEVEL_HASH)
local unit EFFECT = CreateUnit(GetOwningPlayer(CASTER),'h00E',GetSpellTargetX(),GetSpellTargetY(),0.)
local real BASEHEAL = 100.*I2R(GetUnitAbilityLevel(CASTER,'A00Z'))
local real DOWNPOUR_HEAL = 0.
local group g = null
local unit TEMPUNIT = null
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,EFFECT)
call SaveReal(udg_hash,GetHandleId(t),3,BASEHEAL)
call TimerStart(t,2.,true,function HealingRainActs)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,EFFECT)
call TimerStart(t1,0.75,false,function Healing_Rain_SlowEffect)
if DOWNPOUR > 0 then
set DOWNPOUR_HEAL = DOWNPOUR_INSTANT_HEALING*DOWNPOUR + DOWNPOUR*DOWNPOUR_SPELLPOWER_EFFECT*LoadReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash())
set g = CreateGroup()
set HR_CASTER = CASTER
call GroupEnumUnitsInRange(g,GetSpellTargetX(),GetSpellTargetY(),480+DOWNPOUR_AOE_BONUS*DOWNPOUR,Condition(function HealingRainConds))
loop
set TEMPUNIT = FirstOfGroup(g)
exitwhen TEMPUNIT == null
call HealUnit(CASTER,TEMPUNIT,DOWNPOUR_HEAL)
call GroupRemoveUnit(g,TEMPUNIT)
set TEMPUNIT = null
endloop
call DestroyGroup(g)
set g = null
endif
set CASTER = null
set t = null
set t1 = null
set EFFECT = null
endfunction
//===========================================================================
function InitTrig_Healing_Rain takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Healing_Rain_Conditions ) )
call TriggerAddAction( t, function Trig_Healing_Rain_Actions )
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
unit CH_CASTER = null
group CH_Affected = CreateGroup()
endglobals
function Trig_Chain_Heal_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A010'
endfunction
function CHGroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(CH_CASTER)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0 and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)<GetUnitState(GetFilterUnit(),UNIT_STATE_MAX_LIFE) and not(IsUnitInGroup(GetFilterUnit(),CH_Affected))
endfunction
function FadeLightning takes nothing returns nothing
local timer t = GetExpiredTimer()
local real TIMEOUT = LoadReal(udg_hash,GetHandleId(t),2)
local lightning LG = LoadLightningHandle(udg_hash,GetHandleId(t),1)
call SetLightningColor(LG,100.,100.,100.,GetLightningColorA(LG)+10.)
set TIMEOUT = TIMEOUT + 0.1
call SaveReal(udg_hash,GetHandleId(t),2,TIMEOUT)
if TIMEOUT >=1. then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call DestroyLightning(LG)
endif
set t = null
set LG = null
endfunction
function TakeLightningToFade takes lightning LG returns nothing
local timer t = CreateTimer()
call SaveLightningHandle(udg_hash,GetHandleId(t),1,LG)
call TimerStart(t,0.1,true,function FadeLightning)
set t = null
endfunction
function Trig_Chain_Heal_Actions takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local integer JUMPS = 1 + GetUnitAbilityLevel(CASTER,'A010')
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local integer ANCESTRAL_HEALING = LoadInteger(udg_hash,GetHandleId(CASTER),ANCESTRAL_HEALING_LEVEL_HASH)
local real CURHEAL = 0.
local real BASEHEAL = 0.
local real x1 = GetUnitX(CASTER)
local real x2 = GetUnitX(TARGET)
local real y1 = GetUnitY(CASTER)
local real y2 = GetUnitY(TARGET)
local real z1 = GetTerrainZ(x1,y1) + 70. + GetUnitFlyHeight(CASTER)
local real z2 = GetTerrainZ(x2,y2) + 70. + GetUnitFlyHeight(TARGET)
local integer i = 1
local group g = CreateGroup()
set CH_CASTER = CASTER
set BASEHEAL = 100. + I2R(GetUnitAbilityLevel(CASTER,'A010') - 1)*150.
set CURHEAL = (BASEHEAL + SPELLPOWER)*(1.)
if ANCESTRAL_HEALING > 0 and GetRandomInt(0,100) <= ANCESTRAL_HEALING_PROC_CHANCE then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\EtherealForm\\SpiritWalkerChange.mdl",TARGET,"chest"))
call AddHeroParameter(TARGET,ANCESTRAL_HEALING_BONUS_HEALING*ANCESTRAL_HEALING,ANCESTRAL_HEALING_DURATION,GetReceivedHealingBonusHash(),"","")
endif
call DestroyEffect(AddSpecialEffectTarget("effects\\s_Nature'sBloom Effect.mdx",TARGET,"origin"))
call TakeLightningToFade(AddLightningEx("DRAL",false,x1,y1,z1,x2,y2,z2))
call HealUnit(CASTER,TARGET,CURHEAL)
set x1 = x2
set y1 = y2
set z1 = z2
call GroupAddUnit(CH_Affected,TARGET)
set TARGET = null
loop
call GroupEnumUnitsInRange(g,x2,y2,500.,Condition(function CHGroupFilter))
set TARGET = FirstOfGroup(g)
exitwhen i>JUMPS or TARGET == null
set x2=GetUnitX(TARGET)
set y2=GetUnitY(TARGET)
set z2=GetTerrainZ(x2,y2) + 70. + GetUnitFlyHeight(TARGET)
call DestroyEffect(AddSpecialEffectTarget("effects\\s_Nature'sBloom Effect.mdx",TARGET,"origin"))
call TakeLightningToFade(AddLightningEx("DRAL",false,x1,y1,z1,x2,y2,z2))
if ANCESTRAL_HEALING > 0 and GetRandomInt(0,100) <= ANCESTRAL_HEALING_PROC_CHANCE then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\EtherealForm\\SpiritWalkerChange.mdl",TARGET,"chest"))
call AddHeroParameter(TARGET,ANCESTRAL_HEALING_BONUS_HEALING*ANCESTRAL_HEALING,ANCESTRAL_HEALING_DURATION,GetReceivedHealingBonusHash(),"","")
endif
call HealUnit(CASTER,TARGET,CURHEAL)
set x1 = x2
set y1 = y2
set z1 = z2
call GroupAddUnit(CH_Affected,TARGET)
call GroupClear(g)
set TARGET = null
set i = i + 1
endloop
call GroupClear(CH_Affected)
call DestroyGroup(g)
set CASTER = null
set g = null
endfunction
//===========================================================================
function InitTrig_Chain_Heal takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Trig_Chain_Heal_Conditions ) )
call TriggerAddAction(t, function Trig_Chain_Heal_Actions )
set t = null
endfunction
//TESH.scrollpos=77
//TESH.alwaysfold=0
globals
unit MST_CASTER
endglobals
function Trig_Mana_Spring_Totem_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A026'
endfunction
function MSTGroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(MST_CASTER)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0 and GetUnitTypeId(GetFilterUnit())!='O002' and GetUnitState(GetFilterUnit(),UNIT_STATE_MANA)<GetUnitState(GetFilterUnit(),UNIT_STATE_MAX_MANA)
endfunction
function ManaTotemTicker takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit TOTEM_AURA = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local real tick = LoadReal(udg_hash,GetHandleId(t),1) + 0.990
call SetUnitTimeScale(TOTEM_AURA, 0.33)
call SetUnitAnimation(TOTEM_AURA,"Death Large")
call SaveReal(udg_hash,GetHandleId(t),1,tick)
if tick >= 10. then
call DestroyTimer(t)
endif
set TOTEM_AURA = null
set t = null
endfunction
function ManaSpringActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TOTEM = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit TOTEM_AURA = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local real TIMEOUT = LoadReal(udg_hash,GetHandleId(t),3)
local group g = CreateGroup()
local unit TEMPUNIT = null
local timer q = null
local real MANAREGENERATED = 0.
local integer TOTEM_MASTERY = LoadInteger(udg_hash,GetHandleId(CASTER),TOTEM_MASTERY_LEVEL_HASH)
set MST_CASTER = CASTER
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Items\\AIma\\AImaTarget.mdl",GetUnitX(TOTEM),GetUnitY(TOTEM)))
call GroupEnumUnitsInRange(g,GetUnitX(TOTEM),GetUnitY(TOTEM),500.,Condition(function MSTGroupFilter))
loop
set TEMPUNIT = FirstOfGroup(g)
exitwhen TEMPUNIT == null
set MANAREGENERATED = 35.*I2R(GetUnitAbilityLevel(CASTER,'A026'))
call RegenerateMana( TEMPUNIT, MANAREGENERATED)
if TOTEM_MASTERY > 0 then
call HealUnitPeriodic(CASTER,TEMPUNIT,MANAREGENERATED*TOTEM_MASTERY*TOTEM_MASTERY_RESTORED_HEALING)
endif
if GetUnitState(TEMPUNIT,UNIT_STATE_MAX_MANA)>200. then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl",TEMPUNIT,"overhead") )
endif
call GroupRemoveUnit(g,TEMPUNIT)
set TEMPUNIT = null
endloop
set TIMEOUT = TIMEOUT + 5.
call SaveReal(udg_hash,GetHandleId(t),3,TIMEOUT)
if (TIMEOUT>=20.) and (TIMEOUT<=21.) then
set q = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(q),4,TOTEM_AURA)
call TimerStart(q,0.990,true,function ManaTotemTicker)
set q = null
endif
if TIMEOUT>=30. then
call KillUnit(TOTEM_AURA)
call KillUnit(TOTEM)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set TOTEM_AURA = null
endif
call DestroyGroup(g)
set t = null
set CASTER = null
set TOTEM = null
set g = null
endfunction
function Trig_Mana_Spring_Totem_Actions takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local integer TOTEM_MASTERY = LoadInteger(udg_hash,GetHandleId(CASTER),TOTEM_MASTERY_LEVEL_HASH)
local unit TOTEM_AURA = null
local unit TOTEM = CreateUnit(GetOwningPlayer(CASTER),'h00F',GetUnitX(CASTER) + 100.*Cos(GetUnitFacing(CASTER)*bj_DEGTORAD),GetUnitY(CASTER) + 100.*Sin(GetUnitFacing(CASTER)*bj_DEGTORAD),0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,TOTEM)
set TOTEM_AURA = CreateUnit(GetOwningPlayer(CASTER),'h01F',GetUnitX(TOTEM),GetUnitY(TOTEM),0.)
call SetUnitAnimation(TOTEM_AURA,"Stand Large")
call FadeUnitIn(TOTEM_AURA,45.)
call SetUnitPosition(TOTEM_AURA,GetUnitX(TOTEM),GetUnitY(TOTEM))
call SaveUnitHandle(udg_hash,GetHandleId(t),4,TOTEM_AURA)
call TimerStart(t,5.-TOTEM_MASTERY*TOTEM_MASTERY_SPREAD_TIME_REDUCE,true,function ManaSpringActs)
set CASTER = null
set TOTEM = null
set t = null
set TOTEM_AURA = null
endfunction
//===========================================================================
function InitTrig_Mana_Spring_Totem takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Mana_Spring_Totem_Conditions ) )
call TriggerAddAction( t, function Trig_Mana_Spring_Totem_Actions )
set t = null
endfunction
//TESH.scrollpos=22
//TESH.alwaysfold=0
globals
unit HEROISMCASTER
endglobals
function Trig_Heroism_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A012'
endfunction
function HeroismGroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(HEROISMCASTER)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function Trig_Heroism_Actions takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local group g = CreateGroup()
local integer BLOODLUST = LoadInteger(udg_hash,GetHandleId(CASTER),BLOODLUST_LEVEL_HASH)
local unit TEMPUNIT
set HEROISMCASTER = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),1000.,Condition(function HeroismGroupFilter))
loop
set TEMPUNIT = FirstOfGroup(g)
exitwhen TEMPUNIT == null
call DummyCastTarget(CASTER,TEMPUNIT,'A013',BLOODLUST+1,"bloodlust")
call AddHeroParameter(TEMPUNIT,15.+10*I2R(GetUnitAbilityLevel(CASTER,'A012')),15.+BLOODLUST_DURATION_INCREASE*BLOODLUST,GetHasteHash(),"none","none")
call AddHeroParameter(TEMPUNIT,150.*I2R(GetUnitAbilityLevel(CASTER,'A012')),15.+BLOODLUST_DURATION_INCREASE*BLOODLUST,GetSpellPowerHash(),"none","none")
call GroupRemoveUnit(g,TEMPUNIT)
set TEMPUNIT = null
endloop
call DestroyGroup(g)
set CASTER = null
set g = null
endfunction
//===========================================================================
function InitTrig_Heroism takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Heroism_Conditions ) )
call TriggerAddAction( t, function Trig_Heroism_Actions )
set t = null
endfunction
library BloodelfCaptainTalents initializer onInit requires MapGameplayUtils
globals
constant integer BLOODELF_CAPTAIN_CODE = 'O005'
private constant integer MAX_TALENTS = 10
private constant integer JUGGERNAUT_CODE = 'A05O'
private constant integer SHATTER_BONES_CODE = 'A05P'
private constant integer THUNDER_CLAP_CODE = 'A05Q'
private constant integer HEAVY_REPERCUSSIONS_CODE = 'A05R'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer JUGGERNAUT_LEVEL_HASH = 250
constant real JUGGERNAUT_CRIT_BONUS = 10.
constant real JUGGERNAUT_DURATION = 8.
constant integer JUGGERNAUT_AURACODE = 'A05T'
constant integer JUGGERNAUT_BUFFCODE = 'B01I'
constant integer SHATTER_BONES_LEVEL_HASH = 251
constant real SHATTER_BONES_SHIELD_SLAM_DAMAGE = 0.05
constant integer SHATTER_BONES_ARMOR_REDUCTION = 2
constant integer THUNDER_CLAP_LEVEL_HASH = 252
constant real THUNDER_CLAP_DAMAGE_INCREASE = 0.1
constant real THUNDER_CLAP_MISS_CHANCE = 4.
constant real THUNDER_CLAP_DURATION = 8.
constant integer HEAVY_REPERCUSSIONS_LEVEL_HASH = 253
constant real HEAVY_REPERCUSSIONS_PROC_CHANCE = 3
constant real HEAVY_REPERCUSSIONS_SHIELD_SLAM_DAMAGE = 0.20
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == BLOODELF_CAPTAIN_CODE
endfunction
private function GetJuggernautDescriptionByLevel takes integer lvl returns string
return "Intervene increases the critical strike chance of Shield Slam by |c008080C0" + I2S(R2I(JUGGERNAUT_CRIT_BONUS*lvl)) + "%|r for "+ I2S(R2I(JUGGERNAUT_DURATION)) + " seconds. "
endfunction
private function GetShatterBonesDescriptionByLevel takes integer lvl returns string
return "Increases the damage done by Shield Slam by |c008080C0" + I2S(R2I(SHATTER_BONES_SHIELD_SLAM_DAMAGE*100*lvl)) + "%|r and makes it reduce the affected enemies' armor by |c008080C0" + I2S(SHATTER_BONES_ARMOR_REDUCTION*lvl) + "|r as an armor penetration effect."
endfunction
private function GetThunderClapDescriptionByLevel takes integer lvl returns string
return "Improves Weapon Clap damage by |c008080C0" + I2S(R2I(THUNDER_CLAP_DAMAGE_INCREASE*100*lvl)) + "%|r and makes it increase the chance to miss for affected enemies by |c008080C0" + I2S(R2I(THUNDER_CLAP_MISS_CHANCE*lvl)) + "%|r for " + I2S(R2I(THUNDER_CLAP_DURATION)) + " seconds."
endfunction
private function GetHeavyRepercussionsDescriptionByLevel takes integer lvl returns string
return "Gives a |c008080C0" + I2S(R2I(HEAVY_REPERCUSSIONS_PROC_CHANCE*lvl)) + "%|r chance on attack to immediately reset the cooldown of Shield Slam. Increases the damage of Shield Slam by |c008080C0" + I2S(R2I(HEAVY_REPERCUSSIONS_SHIELD_SLAM_DAMAGE*100*lvl)) + "%|r while Shield Wall is active."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),JUGGERNAUT_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(JUGGERNAUT_CODE, GetJuggernautDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetJuggernautDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(JUGGERNAUT_CODE, GetJuggernautDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),SHATTER_BONES_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(SHATTER_BONES_CODE, GetShatterBonesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetShatterBonesDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(SHATTER_BONES_CODE, GetShatterBonesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),THUNDER_CLAP_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(THUNDER_CLAP_CODE, GetThunderClapDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetThunderClapDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(THUNDER_CLAP_CODE, GetThunderClapDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),HEAVY_REPERCUSSIONS_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(HEAVY_REPERCUSSIONS_CODE, GetHeavyRepercussionsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetHeavyRepercussionsDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(HEAVY_REPERCUSSIONS_CODE, GetHeavyRepercussionsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == JUGGERNAUT_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"JUGGERNAUT CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),JUGGERNAUT_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),JUGGERNAUT_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),JUGGERNAUT_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),JUGGERNAUT_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == SHATTER_BONES_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"SHATTER BONES CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),SHATTER_BONES_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),SHATTER_BONES_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),SHATTER_BONES_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SHATTER_BONES_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == THUNDER_CLAP_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"THUNDER CLAP CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),THUNDER_CLAP_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),THUNDER_CLAP_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),THUNDER_CLAP_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),THUNDER_CLAP_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == HEAVY_REPERCUSSIONS_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"HEAVY REPERCUSSIONS CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_REPERCUSSIONS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),HEAVY_REPERCUSSIONS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_REPERCUSSIONS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_REPERCUSSIONS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function BloodElfCaptainUnlearnTalents takes unit hero returns nothing
local integer JUGGERNAUT_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),JUGGERNAUT_LEVEL_HASH)
local integer SHATTER_BONES_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),SHATTER_BONES_LEVEL_HASH)
local integer THUNDER_CLAP_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),THUNDER_CLAP_LEVEL_HASH)
local integer HEAVY_REPERCUSSIONS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),HEAVY_REPERCUSSIONS_LEVEL_HASH)
local integer sum = JUGGERNAUT_LEVEL+SHATTER_BONES_LEVEL+THUNDER_CLAP_LEVEL+HEAVY_REPERCUSSIONS_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),JUGGERNAUT_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),SHATTER_BONES_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),THUNDER_CLAP_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),HEAVY_REPERCUSSIONS_LEVEL_HASH,0)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
//TESH.scrollpos=14
//TESH.alwaysfold=0
scope Taunt initializer Init
globals
private constant integer ABILCODE = 'A02L'
private constant real AGGRO_IGNORE_DURATION = 3.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
local unit u = GetFilterUnit()
local real threatD = 0.
if IsUnitEnemy(u,GetOwningPlayer(udg_temp_unit)) and not IsUnitDeadBX(u) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\AncestralGuardianMissile\\AncestralGuardianMissile.mdl",u,"overhead"))
if not (Aggro.target(u)==udg_temp_unit) then
set threatD = Aggro.Targetaggro(u) - Aggro.get(u,udg_temp_unit,false)
if threatD >=0. then
call Aggro.add(u,udg_temp_unit,threatD)
endif
endif
call Aggro.ignoreAggro(u,AGGRO_IGNORE_DURATION,udg_temp_unit,false)
endif
set u = null
return false
endfunction
private function onCast takes nothing returns nothing
local group g = CreateGroup()
local unit CASTER = GetTriggerUnit()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(GetSpellTargetUnit()),GetUnitY(GetSpellTargetUnit()),200., function GroupFilter)
call DestroyGroup(g)
set g = null
set CASTER = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=36
//TESH.alwaysfold=0
scope ShieldWall initializer Init
globals
private constant integer ABILCODE = 'A025'
private constant integer AURACODE = 'h02O'
private constant real DURATION = 10.
private constant real REDUCTION_LEVEL_FACTOR = 0.05
private constant real REDUCTION_BASE = 0.2
private constant real AOE = 200.
constant integer SHIELD_WALL_EFFECT_HASH = 202
private constant string AURA_EFFECT = "Abilities\\Spells\\Human\\DevotionAura\\DevotionAura.mdl"
private real tempr
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
function GetShieldWallAbilcode takes nothing returns integer
return ABILCODE
endfunction
private function GetReductionForUnitByLevel takes unit caster, integer level returns real
return REDUCTION_BASE + level * REDUCTION_LEVEL_FACTOR
endfunction
private function GetDurationForUnitByLevel takes unit caster, integer level returns real
return DURATION
endfunction
function GetShieldWallDescriptionForUnitByLevel takes unit whichUnit, integer lvl returns string
return GetAbilityTypeInstantText() + GetAbilityDescriptionText("Garithos takes on the shield in front of himself, reducing physical and magical damage taken by himself and nearby allies by " + GetAbilityParametersColor() + I2S(R2I(GetReductionForUnitByLevel(whichUnit,lvl+1)*100.)) + "%|r. Lasts for " + I2S(R2I(GetDurationForUnitByLevel(whichUnit,lvl+1))) + "seconds.") + GetAbilityCooldownText(BlzGetAbilityCooldown(ABILCODE,lvl))
endfunction
function IsShieldWallActive takes unit CASTER returns boolean
return LoadBoolean(udg_hash,GetHandleId(CASTER),SHIELD_WALL_EFFECT_HASH)
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function UnitAddResistances takes unit whichUnit, real value returns nothing
call SaveReal(udg_hash,GetHandleId(whichUnit),GetSpellResistHash(), LoadReal(udg_hash,GetHandleId(whichUnit),GetSpellResistHash()) + value)
call SaveReal(udg_hash,GetHandleId(whichUnit),GetPhysDmgReduceHash(), LoadReal(udg_hash,GetHandleId(whichUnit),GetPhysDmgReduceHash()) + value)
endfunction
private function ForGroupRemoveResist takes nothing returns nothing
call UnitAddResistances(GetEnumUnit(),-tempr)
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real reduction = LoadReal(udg_hash,GetHandleId(t),2)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local group g = null
local unit tempu = null
set Elapsed = Elapsed + 0.04
if Elapsed >= GetDurationForUnitByLevel(CASTER,GetUnitAbilityLevel(CASTER,ABILCODE)) then
call UnitRemoveAbility(CASTER,'A017')
call UnitRemoveAbility(CASTER,'B00G')
call AddUnitAnimationProperties(CASTER,"defend",false)
call SaveBoolean(udg_hash,GetHandleId(CASTER),SHIELD_WALL_EFFECT_HASH,false)
set tempr = reduction
call ForGroup(AFFECTED,function ForGroupRemoveResist)
call GroupClear(AFFECTED)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),3))
call UnitAddResistances(CASTER,-reduction)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),4,Elapsed)
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),AOE,function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if (not (tempu == CASTER)) and (not IsUnitInGroup(tempu,AFFECTED)) then
call GroupAddUnit(AFFECTED,tempu)
call UnitAddResistances(tempu,reduction)
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
endif
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real reduction = GetReductionForUnitByLevel(CASTER,GetUnitAbilityLevel(CASTER,ABILCODE))
call UnitAddAbility(CASTER,'A017')
call AddUnitAnimationProperties(CASTER,"defend",true)
call SaveBoolean(udg_hash,GetHandleId(CASTER),SHIELD_WALL_EFFECT_HASH,true)
call UnitAddResistances(CASTER,reduction)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,reduction)
call SaveEffectHandle(udg_hash,GetHandleId(t),3,AddSpecialEffectTarget(AURA_EFFECT,CASTER,"origin"))
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set t = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function onCast)
set t = null
endfunction
endscope
scope Intervene initializer onInit
globals
private player InterveneCaster = null
private group InterveneAffected = CreateGroup()
private constant integer ABILCODE = 'A014'
private constant real DAMAGE_PER_LEVEL = 150.
private constant real DURATION_BASE = 2.
private constant real DURATION_LEVEL_FACTOR = 1.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
function GetInterveneAbilcode takes nothing returns integer
return ABILCODE
endfunction
private function GetDamageForUnitByLevel takes unit caster, integer level returns real
return level * DAMAGE_PER_LEVEL
endfunction
private function GetDurationForUnitByLevel takes unit caster, integer level returns real
return DURATION_BASE+DURATION_LEVEL_FACTOR*level
endfunction
function GetInterveneDescriptionForUnitByLevel takes unit whichUnit, integer lvl returns string
return GetAbilityTypeTargetUnitText(false,false) + GetAbilityDescriptionText("Runs at high speed towards the target, dealing " + GetAbilityParametersColor() + I2S(R2I(GetDamageForUnitByLevel(whichUnit,lvl+1))) + "|r" + GetPhysicalColor() + " physical|r damage to all enemies on his way. If the target is an ally, Garithos protects it for " + GetAbilityParametersColor() + I2S(R2I(GetDurationForUnitByLevel(whichUnit,lvl+1))) + "|r seconds from all incoming physical damage, which will be redirected to himself.") + GetAbilityCooldownText(BlzGetAbilityCooldown(ABILCODE,lvl))
endfunction
private function InterveneGroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),InterveneCaster) and GetWidgetLife(GetFilterUnit())>0 and not(IsUnitInGroup(GetFilterUnit(),InterveneAffected))
endfunction
private function RemoveInterveneBuff takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call UnitRemoveAbility(u,'A018')
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function RemoveJuggernautBuff takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call UnitRemoveAbility(CASTER,JUGGERNAUT_AURACODE)
call UnitRemoveAbility(CASTER,JUGGERNAUT_BUFFCODE)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer tt = null
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real timeout = LoadReal(udg_hash,GetHandleId(t),2)
local real duration = LoadReal(udg_hash,GetHandleId(t),4)
local group g = CreateGroup()
local real angle = 0.
local real DAMAGE = GetDamageForUnitByLevel(u,GetUnitAbilityLevel(u,ABILCODE))
local unit a = null
local integer JUGGERNAUT = 0
local timer JUGG_TIMER = null
set timeout = timeout + 0.04
call SaveReal(udg_hash,GetHandleId(t),2,timeout)
set a = CreateUnit(GetOwningPlayer(u),'o00A',GetUnitX(u),GetUnitY(u),GetUnitFacing(u))
call SetUnitX(a,GetUnitX(u))
call SetUnitY(a,GetUnitY(u))
call PauseUnit(a,true)
call SetUnitAnimation(a,"attack")
call FadeUnitIn(a,.5)
set InterveneCaster = GetOwningPlayer(u)
set a = null
call GroupEnumUnitsInRange(g,GetUnitX(u),GetUnitY(u),180,Condition(function InterveneGroupFilter))
loop
set a = FirstOfGroup(g)
exitwhen a == null
call DealPhysicalDamage(u,a,DAMAGE)
call GroupAddUnit(InterveneAffected,a)
call GroupRemoveUnit(g,a)
set a = null
endloop
if timeout>=duration then
if GetUnitAbilityLevel(u,'A016') > 0 then
call AddHeroParameter(u,50.*I2R(GetUnitAbilityLevel(u,'A016')),8.,3,"none","none")
endif
set JUGGERNAUT = LoadInteger(udg_hash,GetHandleId(u),JUGGERNAUT_LEVEL_HASH)
if JUGGERNAUT > 0 then
call UnitAddAbility(u,JUGGERNAUT_AURACODE)
set JUGG_TIMER = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(JUGG_TIMER),1,u)
call TimerStart(JUGG_TIMER,JUGGERNAUT_DURATION,false,function RemoveJuggernautBuff)
set JUGG_TIMER = null
endif
set a = LoadUnitHandle(udg_hash,GetHandleId(t),3)
if not IsUnitEnemy(a,GetOwningPlayer(u)) then
call UnitAddAbility(a,'A018')
call SaveUnitHandle(udg_hash,GetHandleId(a),99,u)
set tt = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(tt),1,a)
call TimerStart(tt,GetDurationForUnitByLevel(u,GetUnitAbilityLevel(u,ABILCODE)),false,function RemoveInterveneBuff)
endif
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),5))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call GroupClear(InterveneAffected)
set a = null
endif
set t = null
set tt = null
set u = null
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit a = GetSpellTargetUnit()
local timer t = CreateTimer()
local real angle = bj_RADTODEG * Atan2(GetUnitY(a) - GetUnitY(u), GetUnitX(a) - GetUnitX(u))
local real dist = SquareRoot( Pow(GetUnitY(a)-GetUnitY(u),2) + Pow(GetUnitX(a)-GetUnitX(u),2) )
call ParKnock(u,0.,dist-110,dist/2000.,angle,true,"null")
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,a)
call SaveReal(udg_hash,GetHandleId(t),4,dist/2000.)
call SaveEffectHandle(udg_hash,GetHandleId(t),5,AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl",u,"chest"))
call TimerStart(t,0.04,true,function onTimer)
set u = null
set a = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope ShieldSlam initializer onInit
globals
unit SSlamCaster
constant integer SHIELD_SLAM_ABILCODE = 'A015'
private constant integer ABILCODE = 'A015'
private constant real AOE = 350
private constant real BASE_DAMAGE = 200.
private constant real BLOCK_FULL_DAMAGE = 500.
endglobals
function GetShieldSlamAbilcode takes nothing returns integer
return ABILCODE
endfunction
private function GetDamageForUnitByLevel takes unit whichUnit, integer lvl returns real
local real Block = LoadReal(udg_hash,GetHandleId(whichUnit),GetBlockAmountHash())
local real baseDMG = BASE_DAMAGE*lvl
local real blockDMG = baseDMG*(1.+Block/BLOCK_FULL_DAMAGE)
local integer SHATTER_BONES = LoadInteger(udg_hash,GetHandleId(whichUnit),SHATTER_BONES_LEVEL_HASH)
return blockDMG * (1. + SHATTER_BONES_SHIELD_SLAM_DAMAGE*SHATTER_BONES)
endfunction
function GetShieldSlamDescriptionForUnitByLevel takes unit whichUnit, integer lvl returns string
return GetAbilityTypeTargetUnitText(false,false) + GetAbilityDescriptionText("Uses his shield to slam surrounding enemies, dealing " + GetAbilityParametersColor() + I2S(R2I(GetDamageForUnitByLevel(whichUnit,lvl+1))) + "|r " + GetPhysicalColor() + "physical|r damage and causing them to attack Garithos.") + GetAbilityCooldownText(BlzGetAbilityCooldown(ABILCODE,lvl))
endfunction
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(SSlamCaster)) and GetWidgetLife(GetFilterUnit())>0
endfunction
private function onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
local group g = CreateGroup()
local unit tempunit = null
local integer i = 1
local unit a
local location p = GetUnitLoc(u)
local location p1
local real angle
local real DAMAGE = GetDamageForUnitByLevel(u,GetUnitAbilityLevel(u,ABILCODE))
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real tempr = 0.
local integer JUGGERNAUT = LoadInteger(udg_hash,GetHandleId(u),JUGGERNAUT_LEVEL_HASH)
local integer SHATTER_BONES = LoadInteger(udg_hash,GetHandleId(u),SHATTER_BONES_LEVEL_HASH)
local integer HEAVY_REPERCUSSIONS = LoadInteger(udg_hash,GetHandleId(u),HEAVY_REPERCUSSIONS_LEVEL_HASH)
call PlaySoundOnUnitBJ( gg_snd_ThunderBoltMissileDeath, 100, u )
loop
exitwhen i>3
set p1 = PolarProjectionBJ(p,75.,GetUnitFacing(u)+90.*I2R(i))
set a = CreateUnitAtLoc(Player(15),GetUnitTypeId(u),p1,GetUnitFacing(u)+90.*I2R(i))
call SetUnitColor(a,GetPlayerColor(GetOwningPlayer(u)))
call UnitAddAbility(a,'Aloc')
call SetUnitPositionLoc(a,p1)
//call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl",a,"chest"))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl",tempunit,"overhead"))
call PauseUnit(a,true)
call SetUnitAnimation(a,"defend")
call FadeUnitIn(a,.5)
set a = null
call RemoveLocation(p1)
set p1 = null
set i = i + 1
endloop
set SSlamCaster = u
call GroupEnumUnitsInRange(g,x,y,AOE,Condition(function GroupFilter))
if JUGGERNAUT > 0 and GetUnitAbilityLevel(u,JUGGERNAUT_BUFFCODE)>0 then
set tempr = JUGGERNAUT * JUGGERNAUT_CRIT_BONUS
call SaveReal(udg_hash,GetHandleId(u),GetCritHash(),GetUnitCritChancePercent(u)+tempr)
endif
if HEAVY_REPERCUSSIONS > 0 and IsShieldWallActive(u) then
set DAMAGE = DAMAGE * (1. + HEAVY_REPERCUSSIONS * HEAVY_REPERCUSSIONS_SHIELD_SLAM_DAMAGE)
endif
loop
set tempunit = FirstOfGroup(g)
exitwhen tempunit == null
call DealPhysicalDamage(u,tempunit,DAMAGE)
call IssueTargetOrder(tempunit,"attack",u)
if SHATTER_BONES > 0 then
call ApplyArmorPenetration(tempunit, SHATTER_BONES*SHATTER_BONES_ARMOR_REDUCTION)
endif
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl",tempunit,"chest"))
call GroupRemoveUnit(g,tempunit)
set tempunit = null
endloop
if tempr > 0 then
call SaveReal(udg_hash,GetHandleId(u),GetCritHash(),GetUnitCritChancePercent(u)-tempr)
endif
call DestroyGroup(g)
call RemoveLocation(p)
set p = null
set g = null
set u = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope WeaponClap initializer onInit
globals
private constant integer ABILCODE = 'A05M'
private constant integer STUN_ABILCODE = 'A05N'
private constant integer DUMMY_ATTACKER = 'h02B'
private constant real AOE = 400.
private constant real DAMAGE_BASE = 200.
private constant real ATTACK_POWER_BASE = 0.8
private constant real ATTACK_POWER_LEVEL_FACTOR = 0.2
private constant real AGGRO_INC = 0.1
private constant real AGGRO_DURATION = 5.
private constant string DAMAGE_EFFECT = "Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl"
private constant string DAMAGE_ATTACH = "origin"
private constant real SKIP_TIME = 0.65
private constant integer ISPREVENTED_HASH = 201
endglobals
function GetWeaponClapAbilcode takes nothing returns integer
return ABILCODE
endfunction
private function GetDamageForUnitByLevel takes unit CASTER, integer lvl returns real
local integer THUNDER_CLAP = LoadInteger(udg_hash,GetHandleId(CASTER),THUNDER_CLAP_LEVEL_HASH)
return (DAMAGE_BASE * lvl + BlzGetUnitBaseDamage(CASTER,0)*(ATTACK_POWER_BASE+ATTACK_POWER_LEVEL_FACTOR*lvl))*(1. + THUNDER_CLAP*THUNDER_CLAP_DAMAGE_INCREASE)
endfunction
private function GetThreatForUnitByLevel takes unit CASTER, integer lvl returns real
return AGGRO_INC*lvl
endfunction
function GetWeaponClapDescriptionForUnitByLevel takes unit whichUnit, integer lvl returns string
return GetAbilityTypeChannelingText() + GetAbilityDescriptionText("Captain claps his weapons to deal " + GetAbilityParametersColor() + I2S(R2I(GetDamageForUnitByLevel(whichUnit,lvl+1))) + "|r " + GetPhysicalColor() + "physical|r damage and stun all enemies around. Increases the threat generation of Garithos by " + GetAbilityParametersColor() + I2S(R2I(GetThreatForUnitByLevel(whichUnit,lvl+1)*100)) + "%|r for " + I2S(R2I(AGGRO_DURATION)) + " seconds. Can be interrupted during casting time. Cannot be casted while Shield Wall is active.") + GetAbilityCooldownText(BlzGetAbilityCooldown(ABILCODE,lvl))
endfunction
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolean PREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local group g = null
local unit dummy = null
local unit tempu = null
local real DAMAGE = GetDamageForUnitByLevel(CASTER,GetUnitAbilityLevel(CASTER,ABILCODE))
local integer THUNDER_CLAP = 0
if not PREVENTED then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl",CASTER,"weapon"))
call AddHeroParameter(CASTER,GetThreatForUnitByLevel(CASTER,GetUnitAbilityLevel(CASTER,ABILCODE)),AGGRO_DURATION,GetAggroMultiplierHash(),"","")
set THUNDER_CLAP = LoadInteger(udg_hash,GetHandleId(CASTER),THUNDER_CLAP_LEVEL_HASH)
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if IsUnitKnockbackable(tempu) then
if THUNDER_CLAP > 0 then
call AddHeroParameter(tempu,THUNDER_CLAP_MISS_CHANCE*THUNDER_CLAP,THUNDER_CLAP_DURATION,GetMissChanceHash(),"Abilities\\Spells\\Orc\\StasisTrap\\StasisTotemTarget.mdl","overhead")
endif
set dummy = CreateUnit(GetOwningPlayer(CASTER),DUMMY_ATTACKER,GetUnitX(CASTER),GetUnitY(CASTER),GetUnitFacing(tempu)+180.)
call UnitAddAbility(dummy,STUN_ABILCODE)
call UnitApplyTimedLife(dummy,'BHwe',0.5)
call GroupAddUnit(ONE_ATTACK_REMOVE_GROUP,dummy)
call IssueTargetOrder(dummy,"attackonce",tempu)
call SetUnitAnimation(tempu,"death")
endif
call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT,tempu,DAMAGE_ATTACH))
call DealPhysicalDamage(CASTER,tempu,DAMAGE)
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
set dummy = null
endif
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function PreventCastIfShieldWall takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
if IsShieldWallActive(CASTER) then
call IssueImmediateOrder(CASTER,"stop")
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
call SetUnitState(CASTER,UNIT_STATE_MANA,GetUnitState(CASTER,UNIT_STATE_MANA)+10.)
call SimError(GetOwningPlayer(CASTER),"You cannot cast Weapon Clap while Shield Wall is active")
else
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
endif
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,SKIP_TIME,false,function onTimer)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
call TriggerRegisterAnyUnitEventBJ(t2, EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(t2, Condition( function Conds ))
call TriggerAddAction(t2, function PreventCastIfShieldWall)
set t = null
set t1 = null
set t2 = null
endfunction
endscope
scope CaptainAbilityTooltips initializer onInit
globals
timer BLOODELF_CAPTAIN_TOOLTIPTIMER = CreateTimer()
endglobals
private function UpdateTooltips takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CAPTAIN = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer j = 0
if not (CAPTAIN == null) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CAPTAIN INITIALIZED. UPDATING TOOLTIPS")
set j = 0
loop
exitwhen j>7
call BlzSetAbilityExtendedTooltip(GetShieldSlamAbilcode(),GetShieldSlamDescriptionForUnitByLevel(CAPTAIN,j),j)
call BlzSetAbilityExtendedTooltip(GetWeaponClapAbilcode(),GetWeaponClapDescriptionForUnitByLevel(CAPTAIN,j),j)
call BlzSetAbilityExtendedTooltip(GetInterveneAbilcode(),GetInterveneDescriptionForUnitByLevel(CAPTAIN,j),j)
call BlzSetAbilityExtendedTooltip(GetShieldWallAbilcode(),GetShieldWallDescriptionForUnitByLevel(CAPTAIN,j),j)
set j = j + 1
endloop
else
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CAPTAIN NOT INITIALIZED")
endif
set t = null
set CAPTAIN = null
endfunction
private function onInit takes nothing returns nothing
call TimerStart(BLOODELF_CAPTAIN_TOOLTIPTIMER,2.5,true,function UpdateTooltips)
endfunction
endscope
library StonebreakerTalents initializer onInit requires MapGameplayUtils
globals
constant integer STONEBREAKER_CODE = 'O008'
private constant integer MAX_TALENTS = 10
private constant integer VOLCANIC_BOULDERS_CODE = 'A050'
private constant integer FLAMING_RODEO_CODE = 'A051'
private constant integer SOLID_STONES_CODE = 'A052'
private constant integer ERUPTION_CODE = 'A053'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer VOLCANIC_BOULDERS_LEVEL_HASH = 250
constant real VOLCANIC_BOULDERS_PROC_CHANCE = 40.
constant real VOLCANIC_BOULDERS_DOT_DAMAGE = 75.
constant real VOLCANIC_BOULDERS_DOT_PERIOD = 1.
constant real VOLCANIC_BOULDERS_DOT_DURATION = 3.
constant integer FLAMING_RODEO_LEVEL_HASH = 251
constant integer SOLID_STONES_LEVEL_HASH = 252
constant real SOLID_STONES_RESIST_BONUS = 0.05
constant real SOLID_STONES_RODEO_DURATION_BONUS = 2.
constant integer ERUPTION_LEVEL_HASH = 253
constant real ERUPTION_ELEMENTAL_DAMAGE_BONUS = 0.1
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == STONEBREAKER_CODE
endfunction
private function GetVolcanicBouldersDescriptionByLevel takes integer lvl returns string
return "Gives a "+ I2S(R2I(VOLCANIC_BOULDERS_PROC_CHANCE)) +"% chance on Boulder Falls cast to create volcanic boulders, which burns the affected enemies over "+ I2S(R2I(VOLCANIC_BOULDERS_DOT_DURATION)) +" seconds for |c008080C0" + I2S(R2I(VOLCANIC_BOULDERS_DOT_DAMAGE*lvl)) + "|r |cff800000fire|r damage per "+ I2S(R2I(VOLCANIC_BOULDERS_DOT_PERIOD)) +" sec."
endfunction
private function GetFlamingRodeoDescriptionByLevel takes integer lvl returns string
return "While moving the Rodeo boulder disrupts the earth, burning enemies for |c008080C0" + I2S(R2I(100.*lvl)) + "|r |cff800000fire|r damage per second for 2 seconds."
endfunction
private function GetSolidStonesDescriptionByLevel takes integer lvl returns string
return "Rodeo now grants |c008080C0"+ I2S(R2I(SOLID_STONES_RESIST_BONUS*100*lvl)) +"%|r of physical and magical resistance. Ragging charge while Rodeo is active increases Rodeo duration by "+ I2S(R2I(SOLID_STONES_RODEO_DURATION_BONUS*lvl)) +" seconds."
endfunction
private function GetEruptionDescriptionByLevel takes integer lvl returns string
return "Increases |cff0000ffe|r|cff1e0fefl|r|cff3e1fdfe|r|cff5e2fcfm|r|cff7e3fbfe|r|cff9e4fb0n|r|cffbe5fa0t|r|cffde6f90a|r|cfffe7f80l|r damage taken by the enemies that are under the effect of Earthquake by |c008080C0"+ I2S(R2I(ERUPTION_ELEMENTAL_DAMAGE_BONUS*100*lvl)) +"|r%."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),VOLCANIC_BOULDERS_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(VOLCANIC_BOULDERS_CODE, GetVolcanicBouldersDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetVolcanicBouldersDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(VOLCANIC_BOULDERS_CODE, GetVolcanicBouldersDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),FLAMING_RODEO_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(FLAMING_RODEO_CODE, GetFlamingRodeoDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetFlamingRodeoDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(FLAMING_RODEO_CODE, GetFlamingRodeoDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),SOLID_STONES_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(SOLID_STONES_CODE, GetSolidStonesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetSolidStonesDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(SOLID_STONES_CODE, GetSolidStonesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),ERUPTION_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(ERUPTION_CODE, GetEruptionDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetEruptionDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(ERUPTION_CODE, GetEruptionDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == VOLCANIC_BOULDERS_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Volcanic Boulders CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),VOLCANIC_BOULDERS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),VOLCANIC_BOULDERS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),VOLCANIC_BOULDERS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),VOLCANIC_BOULDERS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == FLAMING_RODEO_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Flaming Rodeo CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),FLAMING_RODEO_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),FLAMING_RODEO_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),FLAMING_RODEO_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),FLAMING_RODEO_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == SOLID_STONES_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Solid Stones CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),SOLID_STONES_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),SOLID_STONES_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),SOLID_STONES_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SOLID_STONES_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == ERUPTION_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Eruption CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),ERUPTION_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),ERUPTION_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),ERUPTION_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),ERUPTION_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function StonebreakerUnlearnTalents takes unit hero returns nothing
local integer VOLCANIC_BOULDERS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),VOLCANIC_BOULDERS_LEVEL_HASH)
local integer FLAMING_RODEO_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),FLAMING_RODEO_LEVEL_HASH)
local integer SOLID_STONES_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),SOLID_STONES_LEVEL_HASH)
local integer ERUPTION_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),ERUPTION_LEVEL_HASH)
local integer sum = VOLCANIC_BOULDERS_LEVEL+FLAMING_RODEO_LEVEL+SOLID_STONES_LEVEL+ERUPTION_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),VOLCANIC_BOULDERS_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),FLAMING_RODEO_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),SOLID_STONES_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),ERUPTION_LEVEL_HASH,0)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope Earthquake initializer onInit
globals
private constant integer ABILCODE = 'A04Y'
private constant integer EARTHCODE = 'h02N'
private constant integer SLOWCODE = 'A04Z'
private constant integer ISPREVENTED_HASH = 201
private constant real AOE = 500.
private constant real MIN_AFFECT_DURATION = 0.75
private constant real MAX_AFFECT_DURATION = 1.5
private constant real BASE_DAMAGE_PER_LEVEL = 250.
private constant real MANA_PERCENT_COST = 0.05
private constant real ANIM_REFRESH_PERIOD = 0.33
private constant real SKIP_ANIM_TIME = 1.
private constant string KNOCKBACK_EFFECT = "Abilities\\Spells\\Other\\Volcano\\VolcanoMissile.mdl"
private constant string CASTER_EFFECT = "Abilities\\Spells\\Orc\\StasisTrap\\StasisTotemTarget.mdl"
private constant string CASTER_ATTACH = "overhead"
private constant string ERUPTION_EFFECT = "Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkTarget.mdl"
private constant string ERUPTION_ATTACH = "chest"
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolean AnimInverse = LoadBoolean(udg_hash,GetHandleId(t),2)
local real AnimElapsed = LoadReal(udg_hash,GetHandleId(t),3)
local unit EARTH = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),5)
local boolean INITIALIZED = LoadBoolean(udg_hash,GetHandleId(t),6)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local integer ERUPTION = LoadInteger(udg_hash,GetHandleId(CASTER),ERUPTION_LEVEL_HASH)
local group g = CreateGroup()
local real x = GetUnitX(EARTH)
local real y = GetUnitY(EARTH)
local real dur = 0.
local unit tempu = null
local timer t1 = null
local real DAMAGE = BASE_DAMAGE_PER_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)+GetUnitSpellPower(CASTER)/2.
local real manacost = GetUnitState(CASTER,UNIT_STATE_MAX_MANA) * MANA_PERCENT_COST / 25.
set Elapsed = Elapsed + 0.04
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,R2S(Elapsed))
call SaveReal(udg_hash,GetHandleId(t),5,Elapsed)
if Elapsed >= SKIP_ANIM_TIME then
if not INITIALIZED then
call SaveBoolean(udg_hash,GetHandleId(t),6,true)
call SetUnitAnimation(EARTH,"stand")
call UnitAddAbility(EARTH,SLOWCODE)
endif
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,AOE,function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not IsUnitInGroup(tempu,AFFECTED) then
call GroupAddUnit(AFFECTED,tempu)
set dur = GetRandomReal(MIN_AFFECT_DURATION,MAX_AFFECT_DURATION)
if ERUPTION > 0 then
call AddHeroParameter(tempu,ERUPTION_ELEMENTAL_DAMAGE_BONUS*ERUPTION,dur,GetElementalDamageReceivedBonusHash(),ERUPTION_EFFECT,ERUPTION_ATTACH)
endif
if not(IsUnitType(tempu,UNIT_TYPE_HERO)) then
call ParKnock(tempu,GetRandomReal(50.,125.),GetRandomReal(50.,125.),0.3,GetRandomReal(0.,360.),true,KNOCKBACK_EFFECT)
call DealEarthDamage(CASTER,tempu,DAMAGE)
endif
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,dur,false,function onTimerRemoveAffect)
set t1 = null
endif
call GroupRemoveUnit(g,tempu)
endloop
if AnimElapsed >= ANIM_REFRESH_PERIOD then
if AnimInverse then
call SaveBoolean(udg_hash,GetHandleId(t),2,false)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call SetUnitTimeScale(CASTER,1.)
else
call SaveBoolean(udg_hash,GetHandleId(t),2,true)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call SetUnitTimeScale(CASTER,-1.)
endif
else
set AnimElapsed = AnimElapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),3,AnimElapsed)
endif
endif
if GetUnitState(CASTER,UNIT_STATE_MANA) >= manacost then
call SetUnitState(CASTER,UNIT_STATE_MANA, GetUnitState(CASTER,UNIT_STATE_MANA)-manacost)
else
call IssueImmediateOrder(CASTER,"stop")
endif
if ISPREVENTED then
call KillUnit(EARTH)
call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),5))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
set EARTH = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit EARTH = CreateUnit(GetOwningPlayer(CASTER),EARTHCODE,x,y,0.)
call SetUnitAnimation(EARTH,"birth")
call SaveEffectHandle(udg_hash,GetHandleId(t),5,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveBoolean(udg_hash,GetHandleId(t),2,false)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),4,EARTH)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
call SaveBoolean(udg_hash,GetHandleId(t),6,false)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set EARTH = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Boulder_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01E'
endfunction
function BoulderGroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0
endfunction
function BoulderAfterFall takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real x = LoadReal(udg_hash,GetHandleId(t),2)
local real y = LoadReal(udg_hash,GetHandleId(t),3)
local boolean PROC = LoadBoolean(udg_hash,GetHandleId(t),4)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local real DAMAGE = 200.*I2R(GetUnitAbilityLevel(CASTER,'A01E')) + SPELLPOWER
local boolexpr GROUPFILTER = Condition(function BoulderGroupFilter)
local integer VOLCANIC_BOULDERS = LoadInteger(udg_hash,GetHandleId(CASTER),VOLCANIC_BOULDERS_LEVEL_HASH)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(udg_temp_group,x,y,250.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call DealEarthDamage(CASTER,udg_temp_unit,DAMAGE)
if PROC then
call DOT(CASTER,udg_temp_unit,VOLCANIC_BOULDERS_DOT_DAMAGE*VOLCANIC_BOULDERS+SPELLPOWER*VOLCANIC_BOULDERS_DOT_PERIOD/VOLCANIC_BOULDERS_DOT_DURATION,VOLCANIC_BOULDERS_DOT_DURATION,VOLCANIC_BOULDERS_DOT_PERIOD,1,"Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl","chest",true)
endif
endloop
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
function Boulder_Actions takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TEMP = null
local timer t = CreateTimer()
local integer i = 0
local integer BOULDERTYPE = 'h00M'
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real x1 = GetSpellTargetX()
local real y1 = GetSpellTargetY()
local real x2 = 0.
local real y2 = 0.
local real dist = 0.
local real angle = 0.
local integer VOLCANIC_BOULDERS = LoadInteger(udg_hash,GetHandleId(CASTER),VOLCANIC_BOULDERS_LEVEL_HASH)
local boolean PROC = false
if VOLCANIC_BOULDERS > 0 and GetRandomInt(0,100) <= VOLCANIC_BOULDERS_PROC_CHANCE then
set BOULDERTYPE = 'h00W'
set PROC = true
endif
loop
exitwhen i>=5
set i = i + 1
set x2 = x1 + 150.*Cos((GetUnitFacing(CASTER) - 90. + 45.*I2R(i-1))*bj_DEGTORAD)
set y2 = y1 + 150.*Sin((GetUnitFacing(CASTER) - 90. + 45.*I2R(i-1))*bj_DEGTORAD)
set dist = SquareRoot((x-x2)*(x-x2) + (y-y2)*(y-y2))
set angle = bj_RADTODEG*Atan2(y2-y,x2-x)
set TEMP = CreateUnit(GetOwningPlayer(CASTER),BOULDERTYPE,x,y,0.)
call UnitApplyTimedLife(TEMP,'BHwe',1.25)
call ParKnock(TEMP,400.,dist,1.25,angle,false,"none")
set TEMP = null
endloop
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,x1)
call SaveReal(udg_hash,GetHandleId(t),3,y1)
call SaveBoolean(udg_hash,GetHandleId(t),4,PROC)
call TimerStart(t,1.25,false,function BoulderAfterFall)
set t = null
set CASTER = null
endfunction
//===========================================================================
function InitTrig_Boulder_Falls takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Boulder_Conditions ))
call TriggerAddAction(t, function Boulder_Actions)
set t = null
endfunction
scope Rodeo initializer onInit
globals
private constant integer ABILCODE = 'A01F'
private constant integer FIRECODE = 'h015'
private constant integer FIREABILCODE = 'A01W'
group BR_AffectedGroup = CreateGroup()
real LAST_FIRE_X = 0.
real LAST_FIRE_Y = 0.
timer RODEO_TIMER = null
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit CASTER = LoadUnitHandle(udg_hash,id,1)
local unit BOULDER = LoadUnitHandle(udg_hash,id,2)
local real FACINGBUG = LoadReal(udg_hash,id,3)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real TIMEOUT = LoadReal(udg_hash,id,4)
local real CRITCHANCE = 0.
local real SPELLPOWER = 0.
local real DAMAGE = 0.
local boolexpr GROUPFILTER = null
local real distance = SquareRoot((x-GetUnitX(BOULDER))*(x-GetUnitX(BOULDER))+(y-GetUnitY(BOULDER))*(y-GetUnitY(BOULDER)))
local integer FLAMING_RODEO = LoadInteger(udg_hash,GetHandleId(CASTER),FLAMING_RODEO_LEVEL_HASH)
local integer SOLID_STONES = LoadInteger(udg_hash,GetHandleId(t),5)
if GetWidgetLife(BOULDER)>0 then
if distance <= GetUnitMoveSpeed(CASTER) * 0.04 - 2. then
call SetUnitTimeScale(BOULDER,0.)
else
call SetUnitTimeScale(BOULDER,0.4)
if CASTER == CURRENT_RODEO_CASTER then
call SetUnitTimeScale(BOULDER,1.)
endif
if FLAMING_RODEO>0 and SquareRoot((LAST_FIRE_X-x)*(LAST_FIRE_X-x)+(LAST_FIRE_Y-y)*(LAST_FIRE_Y-y) )>=200. then
set SPELLPOWER = GetUnitSpellPower(CASTER)*0.3
set CRITCHANCE = GetUnitSpellCrit(CASTER)*0.5
set LAST_FIRE_X = x
set LAST_FIRE_Y = y
set udg_temp_unit = CreateUnit(GetOwningPlayer(CASTER),FIRECODE,x,y,GetUnitFacing(CASTER))
call UnitAddAbility(udg_temp_unit,FIREABILCODE)
call SetUnitAbilityLevel(udg_temp_unit,FIREABILCODE,FLAMING_RODEO)
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),GetSpellCritHash(),CRITCHANCE)
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),GetSpellPowerHash(),SPELLPOWER*0.5)
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),GetFireDamageBonusHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetFireDamageBonusHash()))
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),GetElementalDamageBonusHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetElementalDamageBonusHash()))
call GroupAddUnit(DPS_GROUP,udg_temp_unit)
call GroupAddUnit(FIRE_DPS_GROUP,udg_temp_unit)
call GroupAddUnit(ELEMENTAL_DPS_GROUP,udg_temp_unit)
call SetUnitTimeScale(udg_temp_unit,1.)
call UnitApplyTimedLife(udg_temp_unit,'BHwe',2.)
endif
endif
call SetUnitX(BOULDER,x)
call SetUnitY(BOULDER,y)
call SetUnitFacing(BOULDER,GetUnitFacing(CASTER)-FACINGBUG)
//if GetUnitFlyHeight(CASTER)<125 then
// call SetUnitFlyHeight(CASTER,125.,0.)
//endif
set udg_temp_unit = CASTER
set GROUPFILTER = Condition(function GroupFilter)
call GroupEnumUnitsInRange(udg_temp_group,x,y,150.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
set udg_temp_real = bj_RADTODEG*Atan2(GetUnitY(udg_temp_unit)-y,GetUnitX(udg_temp_unit)-x)
if not IsUnitInGroup(udg_temp_unit,BR_AffectedGroup) then
if not(IsUnitType(udg_temp_unit,UNIT_TYPE_HERO)) then
call ParKnock(udg_temp_unit,0.,125.,0.3,udg_temp_real,true,"Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl")
endif
call GroupAddUnit(BR_AffectedGroup,udg_temp_unit)
endif
endloop
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
set TIMEOUT = TIMEOUT + 0.04
call SaveReal(udg_hash,id,4,TIMEOUT)
if TIMEOUT >= 15. or GetUnitAbilityLevel(CASTER,'A01G')==0 or GetWidgetLife(CASTER) <= 0 then
if SOLID_STONES > 0 then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash(), LoadReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash()) - SOLID_STONES_RESIST_BONUS*SOLID_STONES)
call SaveReal(udg_hash,GetHandleId(CASTER),GetPhysDmgReduceHash(), LoadReal(udg_hash,GetHandleId(CASTER),GetPhysDmgReduceHash()) - SOLID_STONES_RESIST_BONUS*SOLID_STONES)
endif
set SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
set DAMAGE = 500. + 500.*I2R(GetUnitAbilityLevel(CASTER,'A01F') - 1) + SPELLPOWER
call UnitRemoveAbility(CASTER,'A01G')
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),'A01F',true)
call KillUnit(BOULDER)
set udg_temp_unit = CASTER
set GROUPFILTER = Condition(function GroupFilter)
call GroupEnumUnitsInRange(udg_temp_group,x,y,500.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call DealEarthDamage(CASTER,udg_temp_unit,DAMAGE)
set distance = SquareRoot((x-GetUnitX(udg_temp_unit))*(x-GetUnitX(udg_temp_unit))+(y-GetUnitY(udg_temp_unit))*(y-GetUnitY(udg_temp_unit)))
set udg_temp_real = bj_RADTODEG*Atan2(GetUnitY(udg_temp_unit)-y,GetUnitX(udg_temp_unit)-x)
if IsUnitKnockbackable(udg_temp_unit) then
call ParKnock(udg_temp_unit,0.,500.-distance,0.5,udg_temp_real,true,"Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl")
endif
endloop
call RemoveUnit(BOULDER)
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
call SetUnitFlyHeight(CASTER,0.,500.)
call FlushChildHashtable(udg_hash,id)
call DestroyTimer(t)
endif
endif
set t = null
set CASTER = null
set BOULDER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local integer BOULDERTYPE = 'h00N'
local unit BOULDER = null
local real FACINGBUG = 60.
local integer SOLID_STONES = LoadInteger(udg_hash,GetHandleId(CASTER),SOLID_STONES_LEVEL_HASH)
if SOLID_STONES > 0 then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash(), LoadReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash()) + SOLID_STONES_RESIST_BONUS*SOLID_STONES)
call SaveReal(udg_hash,GetHandleId(CASTER),GetPhysDmgReduceHash(), LoadReal(udg_hash,GetHandleId(CASTER),GetPhysDmgReduceHash()) + SOLID_STONES_RESIST_BONUS*SOLID_STONES)
endif
set LAST_FIRE_X = GetUnitX(CASTER)
set LAST_FIRE_Y = GetUnitY(CASTER)
set BOULDER = CreateUnit(GetOwningPlayer(CASTER),BOULDERTYPE,GetUnitX(CASTER),GetUnitY(CASTER),GetUnitFacing(CASTER))
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),'A01F',false)
call UnitAddAbility(CASTER,'A01G')
call SetUnitTimeScale(BOULDER,0.4)
call UnitAddAbility(CASTER,'Arav')
call UnitRemoveAbility(CASTER,'Arav')
call UnitAddAbility(BOULDER,'Arav')
call UnitRemoveAbility(BOULDER,'Arav')
call SetUnitFlyHeight(CASTER,155.,0.)
call SetUnitFlyHeight(BOULDER,55.,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,BOULDER)
call SaveReal(udg_hash,GetHandleId(t),3,FACINGBUG)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveInteger(udg_hash,GetHandleId(t),5,SOLID_STONES)
call TimerStart(t,0.04,true,function onTimer)
set RODEO_TIMER = t
set t = null
set CASTER = null
set BOULDER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conds ) )
call TriggerAddAction(t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Boulder_Ride_Cancel_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01G'
endfunction
function Boulder_Ride_Cancel_Acts takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call UnitRemoveAbility(CASTER,'A01G')
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),'A01F',true)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl",GetUnitX(CASTER),GetUnitY(CASTER)))
set CASTER = null
endfunction
//===========================================================================
function InitTrig_Rodeo_Cancel takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( t, Condition( function Boulder_Ride_Cancel_Conditions))
call TriggerAddAction( t, function Boulder_Ride_Cancel_Acts)
set t = null
endfunction
//TESH.scrollpos=23
//TESH.alwaysfold=0
globals
real TARGET_RODEO_X = 0.
real TARGET_RODEO_Y = 0.
unit CURRENT_RODEO_CASTER = null
group RODEO_DAMAGE_GROUP = CreateGroup()
endglobals
function Rodeo_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01X'
endfunction
function Rode_Group_Filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and not(IsUnitInGroup(GetFilterUnit(),RODEO_DAMAGE_GROUP))
endfunction
function Rodeo_Walk takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit CASTER = LoadUnitHandle(udg_hash,id,1)
local real XSpeed = LoadReal(udg_hash,id,2)
local real YSpeed = LoadReal(udg_hash,id,3)
local real duration = LoadReal(udg_hash,id,4)
local real TIMEOUT = LoadReal(udg_hash,id,5)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local real x1 = GetUnitX(CASTER)
local real y1 = GetUnitY(CASTER)
local real x2 = LoadReal(udg_hash,id,6)
local real y2 = LoadReal(udg_hash,id,7)
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local real DAMAGE = 300. + 250.*I2R(GetUnitAbilityLevel(CASTER,'A01X') - 1) + SPELLPOWER
local unit temp = null
local boolexpr GROUPFILTER = Condition(function Rode_Group_Filter)
set TIMEOUT = TIMEOUT + 0.04
call SaveReal(udg_hash,id,5,TIMEOUT)
if GetRandomInt(1,3) == 1 then
set udg_temp_unit = CreateUnit(GetOwningPlayer(CASTER),'h016',GetUnitX(CASTER),GetUnitY(CASTER),0.)
call UnitApplyTimedLife(udg_temp_unit,'BHwe',0.5)
call ParKnock(udg_temp_unit,GetRandomReal(100.,200.),GetRandomReal(100.,200.),0.5,GetRandomReal(1.,360.),false,"none")
endif
call SetUnitX(CASTER,GetUnitX(CASTER)+XSpeed)
call SetUnitY(CASTER,GetUnitY(CASTER)+YSpeed)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(CASTER),GetUnitY(CASTER),175.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call DealEarthDamage(CASTER,udg_temp_unit,DAMAGE)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",udg_temp_unit,"chest"))
if IsUnitKnockbackable(udg_temp_unit) then
call ParKnock(udg_temp_unit,200.,200.,0.75,Atan2(GetUnitY(udg_temp_unit)-GetUnitY(CASTER),GetUnitX(udg_temp_unit)-GetUnitX(CASTER))*bj_RADTODEG,true,"")
endif
call GroupAddUnit(RODEO_DAMAGE_GROUP,udg_temp_unit)
endloop
if TIMEOUT >= duration or dist <= 150. then
call SetUnitTimeScale(CASTER,1.)
call SetUnitPathing(CASTER,true)
set CURRENT_RODEO_CASTER = null
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
set t = null
set CASTER = null
endfunction
function Rodeo_Prevent_Click takes nothing returns nothing
if (GetTriggerUnit() == CURRENT_RODEO_CASTER) then
call DisableTrigger(GetTriggeringTrigger())
call IssuePointOrder(CURRENT_RODEO_CASTER,"move",TARGET_RODEO_X,TARGET_RODEO_Y)
call EnableTrigger(GetTriggeringTrigger())
endif
endfunction
function Rodeo_Start_Acts takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local real x1 = GetUnitX(CASTER)
local real x2 = GetUnitX(TARGET)
local real y1 = GetUnitY(CASTER)
local real y2 = GetUnitY(TARGET)
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
local real angle = Atan2(y2-y1,x2-x1)
local real XSpeed = 12.*Cos(angle)
local real YSpeed = 12.*Sin(angle)
local real duration = (dist - 150.) / 300.
local real RODEO_TIMEOUT = 0.
local integer SOLID_STONES = LoadInteger(udg_hash,GetHandleId(CASTER),SOLID_STONES_LEVEL_HASH)
call SetUnitPathing(CASTER,false)
call SetUnitTimeScale(CASTER,2.)
call IssuePointOrder(CASTER,"move",x2,y2)
call GroupClear(RODEO_DAMAGE_GROUP)
set CURRENT_RODEO_CASTER = GetTriggerUnit()
set TARGET_RODEO_X = x2
set TARGET_RODEO_Y = y2
call SaveUnitHandle(udg_hash,id,1,CASTER)
call SaveReal(udg_hash,id,2,XSpeed)
call SaveReal(udg_hash,id,3,YSpeed)
call SaveReal(udg_hash,id,4,duration)
call SaveReal(udg_hash,id,6,x2)
call SaveReal(udg_hash,id,7,y2)
call TimerStart(t,0.04,true,function Rodeo_Walk)
if SOLID_STONES > 0 then
set RODEO_TIMEOUT = LoadReal(udg_hash,GetHandleId(RODEO_TIMER),4)
if RODEO_TIMEOUT > 0. then
call SaveReal(udg_hash,GetHandleId(RODEO_TIMER),4,RODEO_TIMEOUT - SOLID_STONES*SOLID_STONES_RODEO_DURATION_BONUS)
endif
endif
set CASTER = null
set TARGET = null
set t = null
endfunction
function InitTrig_Ragging_Charge takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t2 = CreateTrigger()
local integer i = 0
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Rodeo_Conditions ) )
call TriggerAddAction( t, function Rodeo_Start_Acts )
loop
exitwhen(i>= 5)
call TriggerRegisterPlayerUnitEvent(t2,Player(i),EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,null)
call TriggerRegisterPlayerUnitEvent(t2,Player(i),EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null)
call TriggerRegisterPlayerUnitEvent(t2,Player(i),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
set i = i + 1
endloop
call TriggerAddAction(t2,function Rodeo_Prevent_Click)
set t = null
set t2 = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Burning_Totem_Effect_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A01V' ) ) then
return false
endif
return true
endfunction
function Trig_Burning_Totem_Effect_Actions takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "weapon", GetTriggerUnit(), "Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl" )
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_Burning_Totem_Effect takes nothing returns nothing
set gg_trg_Burning_Totem_Effect = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Burning_Totem_Effect, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Burning_Totem_Effect, Condition( function Trig_Burning_Totem_Effect_Conditions ) )
call TriggerAddAction( gg_trg_Burning_Totem_Effect, function Trig_Burning_Totem_Effect_Actions )
endfunction
library DruidTalents initializer onInit requires MapGameplayUtils
globals
constant integer DRUID_CODE = 'O006'
constant integer DRUID_TREE_CODE = 'O007'
private constant integer MAX_TALENTS = 10
private constant integer PHOTOSYNTHESIS_CODE = 'A05C'
private constant integer GERMINATION_CODE = 'A05F'
private constant integer STONEBARK_CODE = 'A05E'
private constant integer SOUL_FOREST_CODE = 'A05D'
private constant integer MONSOON_CODE = 'A07O'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer PHOTOSYNTHESIS_LEVEL_HASH = 250
constant real PHOTOSYNTHESIS_INCREASED_HEALING = 0.15
constant integer GERMINATION_LEVEL_HASH = 251
constant real GERMINATION_HP_THRESHOLD = 0.35
constant real GERMINATION_HEALING_INCREASE = 0.25
constant integer STONEBARK_LEVEL_HASH = 252
constant real STONEBARK_DURATION_INCREASE = 5
constant integer STONEBARK_ATTACK_POWER_BONUS = 10
constant integer STONEBARK_ARMOR_BONUS = 3
constant integer SOUL_FOREST_LEVEL_HASH = 253
constant real SOUL_FOREST_PERIODIC_HEALING_BONUS = 0.1
constant integer MONSOON_LEVEL_HASH = 254
constant real MONSOON_AOE = 500.
constant real MONSOON_DURATION = 15.
constant real MONSOON_STRIKE_PERIOD = 0.2
constant real MONSOON_AFFECT_DURATION = 1.
constant real MONSOON_DAMAGE_BASE = 40
constant real MONSOON_DAMAGE_LVL = 60
constant real MONSOON_SPELL_POWER_BASE = 0.3
constant real MONSOON_SPELL_POWER_LVL = 0.4
constant integer MONSOON_ABILCODE = 'A07P'
constant integer REBIRTH_ABILCODE = 'A02F'
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == DRUID_CODE or GetUnitTypeId(GetTriggerUnit()) == DRUID_TREE_CODE
endfunction
private function GetPhotosynthesisDescriptionByLevel takes integer lvl returns string
return "If the Druid has Lifebloom buff on himself, increases the healing effect of his abilities by |c008080C0"+ I2S(R2I(PHOTOSYNTHESIS_INCREASED_HEALING*100*lvl)) +"%|r."
endfunction
private function GetGerminationDescriptionByLevel takes integer lvl returns string
return "Regrowth periodic healing has |c008080C0" + I2S(R2I(GERMINATION_HEALING_INCREASE*100*lvl)) + "%|r increased effect on targets with hp below " + I2S(R2I(GERMINATION_HP_THRESHOLD*100)) + "%."
endfunction
private function GetStonebarkDescriptionByLevel takes integer lvl returns string
return "Increases the duration of Mark of the Wild by |c008080C0" + I2S(R2I(STONEBARK_DURATION_INCREASE*lvl)) + "|r seconds and makes it additionally increase the attack power by |c008080C0" + I2S(STONEBARK_ATTACK_POWER_BONUS*lvl) + "|r and armor by |c008080C0" + I2S(STONEBARK_ARMOR_BONUS*lvl) + "|r."
endfunction
private function GetSoulForestDescriptionByLevel takes integer lvl returns string
return "Tree of Life increases the effects of periodic healing received by affected units by |c008080C0" + I2S(R2I(SOUL_FOREST_PERIODIC_HEALING_BONUS*100*lvl)) + "%|r."
endfunction
private function GetMonsoonDescriptionByLevel takes integer lvl returns string
return "Causes a monsoon into the target area and a destructive tornado, which slows enemies by |c008080C0" + I2S(25+5*lvl) + "%|r and causes lightning strikes, dealing |c008080C0" + I2S(R2I(MONSOON_DAMAGE_BASE+MONSOON_DAMAGE_LVL*lvl)) + "|r + [|c008080C0" + I2S(R2I((MONSOON_SPELL_POWER_BASE+MONSOON_SPELL_POWER_LVL*lvl)*100)) + "%|r of SPELLPOWER] elemental damage per strike. Lasts for " + I2S(R2I(MONSOON_DURATION)) + " seconds."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
local integer i = 0
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),PHOTOSYNTHESIS_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(PHOTOSYNTHESIS_CODE, GetPhotosynthesisDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetPhotosynthesisDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(PHOTOSYNTHESIS_CODE, GetPhotosynthesisDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),GERMINATION_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(GERMINATION_CODE, GetGerminationDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetGerminationDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(GERMINATION_CODE, GetGerminationDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),STONEBARK_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(STONEBARK_CODE, GetStonebarkDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetStonebarkDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(STONEBARK_CODE, GetStonebarkDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),SOUL_FOREST_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(SOUL_FOREST_CODE, GetSoulForestDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetSoulForestDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(SOUL_FOREST_CODE, GetSoulForestDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),MONSOON_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(MONSOON_CODE, "|cffff0000Talent is not learned. Replaces Rebirth ability.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetMonsoonDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(MONSOON_CODE, GetMonsoonDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetMonsoonDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(MONSOON_CODE, GetMonsoonDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
loop
exitwhen i>9
set i = i + 1
call BlzSetAbilityExtendedTooltip(MONSOON_ABILCODE, "Causes a monsoon into the target area and a destructive tornado, which slows enemies by |c008080C0" + I2S(25+5*i) + "%|r and causes lightning strikes, dealing |c008080C0" + I2S(R2I(MONSOON_DAMAGE_BASE+MONSOON_DAMAGE_LVL*i)) + "|r + [|c008080C0" + I2S(R2I((MONSOON_SPELL_POWER_BASE+MONSOON_SPELL_POWER_LVL*i)*100)) + "%|r of SPELLPOWER] elemental damage per strike. Lasts for " + I2S(R2I(MONSOON_DURATION)) + " seconds.",i-1)
endloop
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == PHOTOSYNTHESIS_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Photosynthesis CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),PHOTOSYNTHESIS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),PHOTOSYNTHESIS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),PHOTOSYNTHESIS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),PHOTOSYNTHESIS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == GERMINATION_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Germination CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),GERMINATION_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),GERMINATION_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),GERMINATION_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),GERMINATION_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == STONEBARK_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Stonebark CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),STONEBARK_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),STONEBARK_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),STONEBARK_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),STONEBARK_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == SOUL_FOREST_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Soul Forest CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),SOUL_FOREST_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),SOUL_FOREST_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),SOUL_FOREST_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SOUL_FOREST_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == MONSOON_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MONSOON CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),MONSOON_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),MONSOON_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),MONSOON_LEVEL_HASH) + 1 )
if LoadInteger(udg_hash,GetHandleId(CASTER),MONSOON_LEVEL_HASH) == 1 then
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),REBIRTH_ABILCODE, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),MONSOON_ABILCODE, true)
endif
call SetUnitAbilityLevel(CASTER,MONSOON_ABILCODE,LoadInteger(udg_hash,GetHandleId(CASTER),MONSOON_LEVEL_HASH))
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SOUL_FOREST_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function DruidUnlearnTalents takes unit hero returns nothing
local integer PHOTOSYNTHESIS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),PHOTOSYNTHESIS_LEVEL_HASH)
local integer GERMINATION_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),GERMINATION_LEVEL_HASH)
local integer STONEBARK_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),STONEBARK_LEVEL_HASH)
local integer SOUL_FOREST_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),SOUL_FOREST_LEVEL_HASH)
local integer MONSOON_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),MONSOON_LEVEL_HASH)
local integer sum = PHOTOSYNTHESIS_LEVEL+GERMINATION_LEVEL+STONEBARK_LEVEL+SOUL_FOREST_LEVEL+MONSOON_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),PHOTOSYNTHESIS_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),GERMINATION_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),STONEBARK_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),SOUL_FOREST_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),MONSOON_LEVEL_HASH,0)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),MONSOON_ABILCODE, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(hero),REBIRTH_ABILCODE, true)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope Monsoon initializer onInit
globals
private constant integer ABILCODE = 'A07P'
private constant integer TORNADO_CODE = 'h03S'
private constant integer RAIN_CODE = 'h03T'
private constant integer CLOUD_CODE = 'h03U'
private constant integer SLOW_ABILCODE = 'A07R'
private constant integer LIGHTNING_ABILCODE = 'A07Q'
private constant real AOE = MONSOON_AOE
private constant real DURATION = MONSOON_DURATION
private constant real AFFECT_DURATION = MONSOON_AFFECT_DURATION
private constant real STRIKE_PERIOD = MONSOON_STRIKE_PERIOD
private constant real TORNADO_DISTANCE = AOE/2.5
private constant real ANGLE_SPEED = (3.14)/50.
private constant real H_SPEED = 2*TORNADO_DISTANCE / (25.*DURATION)
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TORNADO = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit RAIN = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local unit CLOUD = LoadUnitHandle(udg_hash,GetHandleId(t),6)
local real ELAPSED = LoadReal(udg_hash,GetHandleId(t),4)
local real ELAPSED_FROM_LAST_STRIKE = LoadReal(udg_hash,GetHandleId(t),5)
local integer LEVEL = GetUnitAbilityLevel(CASTER,ABILCODE)
local real DAMAGE = MONSOON_DAMAGE_BASE+MONSOON_DAMAGE_LVL*LEVEL + (MONSOON_SPELL_POWER_BASE+MONSOON_SPELL_POWER_LVL*LEVEL)*GetUnitSpellPower(CASTER)
local group g = null
local timer t1 = null
local unit tempu = null
local unit dummy = null
local real x = GetUnitX(TORNADO)
local real y = GetUnitY(TORNADO)
local real x0 = GetUnitX(RAIN)
local real y0 = GetUnitY(RAIN)
local real angle = Atan2(y-GetUnitY(RAIN),x-GetUnitX(RAIN))
if ELAPSED <= 0.5*DURATION then
call SetUnitX(TORNADO,x+H_SPEED*Cos(angle))
call SetUnitY(TORNADO,y+H_SPEED*Sin(angle))
else
call SetUnitX(TORNADO,x-H_SPEED*Cos(angle))
call SetUnitY(TORNADO,y-H_SPEED*Sin(angle))
endif
set x = GetUnitX(TORNADO)
set y = GetUnitY(TORNADO)
call SetUnitX(TORNADO,(x-x0)*Cos(ANGLE_SPEED)-(y-y0)*Sin(ANGLE_SPEED)+x0)
call SetUnitY(TORNADO,(x-x0)*Sin(ANGLE_SPEED)+(y-y0)*Cos(ANGLE_SPEED)+y0)
set x = GetUnitX(TORNADO)
set y = GetUnitY(TORNADO)
call SetUnitX(CLOUD,x)
call SetUnitY(CLOUD,y)
if ELAPSED_FROM_LAST_STRIKE >= STRIKE_PERIOD then
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,MONSOON_AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not IsUnitInGroup(tempu,AFFECTED) then
set dummy = CreateUnit(GetOwningPlayer(CASTER),'h009',x,y,0.)
call SetUnitFlyHeight(dummy,GetRandomReal(150.,350.),0.)
call UnitAddAbility(dummy,LIGHTNING_ABILCODE)
//call SetUnitAbilityLevel(a,abilid,abillvl)
call IssueTargetOrder(dummy,"forkedlightning",tempu)
call UnitApplyTimedLife(dummy,'BHwe',0.5)
call DealMagicalDamageOfType(CASTER,tempu,DAMAGE, "ELEMENTAL")
call GroupAddUnit(AFFECTED,tempu)
set t1 = CreateTimer()
call FlushChildHashtable(udg_hash,GetHandleId(t1))
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,AFFECT_DURATION, false, function onTimerRemoveAffect)
call GroupClear(g)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set t1 = null
set g = null
else
set ELAPSED_FROM_LAST_STRIKE = ELAPSED_FROM_LAST_STRIKE + 0.04
call SaveReal(udg_hash,GetHandleId(t),5,ELAPSED_FROM_LAST_STRIKE)
endif
set ELAPSED = ELAPSED + 0.04
if ELAPSED >= DURATION then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call KillUnit(TORNADO)
call KillUnit(RAIN)
call KillUnit(CLOUD)
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),4,ELAPSED)
endif
set CASTER = null
set TORNADO = null
set RAIN = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit TORNADO = CreateUnit(GetOwningPlayer(CASTER),TORNADO_CODE,x,y,0.)
local unit RAIN = CreateUnit(GetOwningPlayer(CASTER),RAIN_CODE,x,y,0.)
local unit CLOUD = CreateUnit(GetOwningPlayer(CASTER),CLOUD_CODE,x,y,0.)
local timer t = CreateTimer()
call FadeUnitOut(TORNADO,2.,false)
call UnitAddAbility(TORNADO,SLOW_ABILCODE)
call SetUnitAbilityLevel(TORNADO,SLOW_ABILCODE,GetUnitAbilityLevel(CASTER,ABILCODE))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,TORNADO)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,RAIN)
call SaveUnitHandle(udg_hash,GetHandleId(t),6,CLOUD)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveReal(udg_hash,GetHandleId(t),5,STRIKE_PERIOD)
call TimerStart(t,0.04, true,function onTimer)
set CASTER = null
set TORNADO = null
set RAIN = null
set CLOUD = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, function Conds )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Rebirth initializer Init
globals
private effect e = null
private unit target = null
private unit caster = null
private boolean interupted = false
endglobals
private function GFilter takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) and GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_USER and IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
endfunction
private function Ressurect takes nothing returns nothing
local timer tr = GetExpiredTimer()
local trigger t = LoadTriggerHandle(udg_hash,GetHandleId(tr),1)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call FlushChildHashtable(udg_hash,GetHandleId(tr))
call TriggerClearActions(t)
call DestroyTrigger(t)
if not interupted then
call ResumeTimer(LoadTimerHandle(udg_hash,GetHandleId(target),31))
call SetUnitTimeScale(target,1)
call UnitRemoveType(target,UNIT_TYPE_DEAD)
call ReviveHero(target,GetUnitX(caster) + 100.*Cos(GetUnitFacing(caster)*bj_DEGTORAD),GetUnitY(caster) + 100.*Sin(GetUnitFacing(caster)*bj_DEGTORAD),false)
call TimerStart(LoadTimerHandle(udg_hash,GetHandleId(target),31),0.,false,function OUT_OF_COMBAT)
call SetUnitState(target,UNIT_STATE_MANA,GetUnitState(target,UNIT_STATE_MAX_MANA)*0.35)
call SetUnitState(target,UNIT_STATE_LIFE,GetUnitState(target,UNIT_STATE_MAX_LIFE)*0.35)
call PanCameraToForPlayer(GetOwningPlayer(target),GetUnitX(target),GetUnitY(target))
call DestroyEffect(e)
endif
set interupted = false
call DestroyTimer(tr)
set tr = null
set t = null
endfunction
private function Interupted takes nothing returns nothing
set interupted = true
call TimerStart(LoadTimerHandle(udg_hash,GetHandleId(GetTriggeringTrigger()),1),0.,false,function Ressurect)
call DestroyEffect(e)
call SetUnitTimeScale(target,0.85)
call UnitRemoveAbility(caster,'A02F')
call UnitAddAbility(caster,'A02F')
endfunction
private function Actions takes nothing returns nothing
local trigger t = null
local timer tr = null
set caster = GetTriggerUnit()
call GroupEnumUnitsInRange(udg_temp_group,GetSpellTargetX(),GetSpellTargetY(),125.,Filter(function GFilter))
set udg_temp_unit = FirstOfGroup(udg_temp_group)
if udg_temp_unit != null then
set t = CreateTrigger()
set tr = CreateTimer()
set target = udg_temp_unit
call SetUnitTimeScale(target,-0.85)
set e = AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Reincarnation\\ReincarnationTarget.mdl",target,"origin")
set interupted = false
call TriggerRegisterUnitEvent(t,caster,EVENT_UNIT_SPELL_ENDCAST)
call TriggerAddAction(t,function Interupted)
call TimerStart(tr,3.90,false,function Ressurect)
call SaveTriggerHandle(udg_hash,GetHandleId(tr),1,t)
call SaveTimerHandle(udg_hash,GetHandleId(t),1,tr)
set tr = null
set t = null
else
call IssueImmediateOrder(caster,"stop")
call UnitRemoveAbility(caster,'A02F')
call UnitAddAbility(caster,'A02F')
call SimError(GetOwningPlayer(caster),"There's no heroes to resurrect")
call TriggerSleepAction(0.0)
call SetUnitState(caster,UNIT_STATE_MANA,GetUnitState(caster,UNIT_STATE_MANA) + 200.)
endif
call GroupClear(udg_temp_group)
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A02F'
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent( t,Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT,null )
call TriggerRegisterPlayerUnitEvent( t,Player(1), EVENT_PLAYER_UNIT_SPELL_EFFECT,null )
call TriggerRegisterPlayerUnitEvent( t,Player(2), EVENT_PLAYER_UNIT_SPELL_EFFECT,null )
call TriggerRegisterPlayerUnitEvent( t,Player(3), EVENT_PLAYER_UNIT_SPELL_EFFECT,null )
call TriggerRegisterPlayerUnitEvent( t,Player(4), EVENT_PLAYER_UNIT_SPELL_EFFECT,null )
call TriggerRegisterPlayerUnitEvent( t,Player(5), EVENT_PLAYER_UNIT_SPELL_EFFECT,null )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope
//TESH.scrollpos=35
//TESH.alwaysfold=0
scope Lifebloom initializer Init
globals
private constant integer abilcode = 'A01A'
private constant integer a_buffcode = 'A011'
private constant integer b_buffcode = 'B00H'
endglobals
private struct st
static st array data
static timer t = CreateTimer()
static integer index = 0
unit CASTER = null
unit TARGET = null
real TARGETHEAL = 0.
real PERIOD = 0.
integer STACK = 0
integer TICK = 0
static method onTimer takes nothing returns nothing
local integer i = 0
local real SPELLPOWER = 0.
local real HEALINGBONUS = 0.
local real HEALINGSELF = 0.
local real MAINHEAL = 0.
local integer PHOTOSYNTHESIS = 0
loop
exitwhen i>=.index
set .data[i].PERIOD = .data[i].PERIOD + 0.04
if .data[i].PERIOD >= 1. then
set .data[i].PERIOD = 0.
set .data[i].TICK = .data[i].TICK + 1
set SPELLPOWER = LoadReal(udg_hash,GetHandleId(.data[i].CASTER),5) / 8.
set MAINHEAL = (.data[i].TARGETHEAL + SPELLPOWER)*(1.)
set PHOTOSYNTHESIS = LoadInteger(udg_hash,GetHandleId(.data[i].CASTER),PHOTOSYNTHESIS_LEVEL_HASH)
if PHOTOSYNTHESIS > 0 and GetUnitAbilityLevel(.data[i].CASTER,a_buffcode)>0 then
set MAINHEAL = MAINHEAL *(1 + PHOTOSYNTHESIS*PHOTOSYNTHESIS_INCREASED_HEALING)
endif
call HealUnitPeriodic(data[i].CASTER,.data[i].TARGET,MAINHEAL)
if (MAINHEAL > 0.) and (GetWidgetLife(.data[i].TARGET) > 0.) then
call DestroyEffect(AddSpecialEffectTarget("effects\\LifeBloom.mdx",.data[i].TARGET,"origin"))
endif
if .data[i].TICK >= 8 or IsUnitDeadBX(.data[i].TARGET) then
call UnitRemoveAbility(.data[i].TARGET,a_buffcode)
call UnitRemoveAbility(.data[i].TARGET,b_buffcode)
call .data[i].destroy()
set .index = .index - 1
set .data[i] = .data[.index]
if .index == 0 then
call PauseTimer(.t)
endif
set i = i - 1
endif
endif
set i = i + 1
endloop
endmethod
static method onCast takes nothing returns boolean
local integer i = 0
if GetSpellAbilityId() == abilcode then
if not (GetUnitAbilityLevel(GetSpellTargetUnit(),a_buffcode) > 0) then
set .data[.index] = st.create()
set .data[.index].CASTER = GetTriggerUnit()
set .data[.index].TARGET = GetSpellTargetUnit()
set .data[.index].TARGETHEAL = 20.*I2R(GetUnitAbilityLevel(.data[.index].CASTER,abilcode))
set .data[.index].PERIOD = 0.
set .data[.index].STACK = 1
call UnitAddAbility(.data[.index].TARGET,a_buffcode)
call UnitMakeAbilityPermanent(.data[.index].TARGET,true,a_buffcode)
if .index == 0 then
call TimerStart(.t,0.04,true,function st.onTimer)
endif
set .index = .index + 1
else
loop
exitwhen i >= .index
if .data[i].TARGET == GetSpellTargetUnit() then
if .data[i].STACK < 3 then
set .data[i].TARGETHEAL = .data[i].TARGETHEAL * 1.5
set .data[i].STACK = .data[i].STACK + 1
endif
set .data[i].TICK = 0
set .data[i].PERIOD = 0.
set i = .index
endif
set i = i + 1
endloop
endif
endif
return false
endmethod
endstruct
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function st.onCast))
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Regrowth initializer Init
globals
private constant integer a_code = 'A027'
private constant integer a_buffcode = 'A028'
private constant integer LIFEBLOOM_buffcode = 'A011'
private constant integer b_buffcode = 'B00I'
endglobals
private struct st
static st array data
static integer index = 0
static timer t = CreateTimer()
unit CASTER = null
group AFFECTED = null
real TARGETHEAL = 0.
real PERIOD = 0.
integer TICK = 0
static method RemoveBuff takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(),a_buffcode)
call UnitRemoveAbility(GetEnumUnit(),b_buffcode)
endmethod
static method onTimer takes nothing returns nothing
local integer i = 0
local real SPELLPOWER = 0.
local real HEALINGBONUS = 0.
local real HEALINGSELF = 0.
local real MAINHEAL = 0.
local integer PHOTOSYNTHESIS = 0
local integer GERMINATION = 0
loop
exitwhen i >= .index
set .data[i].PERIOD = .data[i].PERIOD + 0.25
if .data[i].PERIOD >= 1.5 then
set .data[i].PERIOD = 0.
set .data[i].TICK = .data[i].TICK + 1
set SPELLPOWER = LoadReal(udg_hash,GetHandleId(.data[i].CASTER),5) / 6.
call GroupAddGroup(.data[i].AFFECTED,udg_temp_group)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
if GetWidgetLife(udg_temp_unit) <= 0 then
call GroupRemoveUnit(.data[i].AFFECTED,udg_temp_unit)
endif
call DestroyEffect(AddSpecialEffectTarget("effects\\Healing Touch.mdl",udg_temp_unit,"origin"))
set MAINHEAL = .data[i].TARGETHEAL + SPELLPOWER
set PHOTOSYNTHESIS = LoadInteger(udg_hash,GetHandleId(.data[i].CASTER),PHOTOSYNTHESIS_LEVEL_HASH)
if PHOTOSYNTHESIS > 0 and GetUnitAbilityLevel(.data[i].CASTER,LIFEBLOOM_buffcode)>0 then
set MAINHEAL = MAINHEAL * (1. + PHOTOSYNTHESIS*PHOTOSYNTHESIS_INCREASED_HEALING)
endif
set GERMINATION = LoadInteger(udg_hash,GetHandleId(.data[i].CASTER),GERMINATION_LEVEL_HASH)
if GERMINATION > 0 and GetWidgetLife(udg_temp_unit)/GetUnitState(udg_temp_unit,UNIT_STATE_MAX_LIFE) < GERMINATION_HP_THRESHOLD then
set MAINHEAL = MAINHEAL * (1. + GERMINATION*GERMINATION_HEALING_INCREASE)
endif
call HealUnitPeriodic(.data[i].CASTER,udg_temp_unit,MAINHEAL)
endloop
if .data[i].TICK >= 6 then
call ForGroup(.data[i].AFFECTED,function st.RemoveBuff)
call DestroyGroup(.data[i].AFFECTED)
call .data[i].destroy()
set .index = .index - 1
set .data[i] = .data[.index]
if .index == 0 then
call PauseTimer(.t)
endif
set i = i - 1
endif
endif
set i = i + 1
endloop
endmethod
static method GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(.data[.index].CASTER)) and not(IsUnitDeadBX(GetFilterUnit())) and not BlzIsUnitInvulnerable(GetFilterUnit())
endmethod
static method AddBuff takes nothing returns nothing
call UnitAddAbility(GetEnumUnit(),a_buffcode)
call UnitMakeAbilityPermanent(GetEnumUnit(),true,a_buffcode)
call DestroyEffect(AddSpecialEffectTarget("effects\\Healing Touch.mdl",GetEnumUnit(),"origin"))
endmethod
static method onCast takes nothing returns boolean
if GetSpellAbilityId() == a_code then
set .data[.index] = st.create()
set .data[.index].CASTER = GetTriggerUnit()
set .data[.index].AFFECTED = CreateGroup()
set .data[.index].TICK = 0
set .data[.index].PERIOD = 0.
set .data[.index].TARGETHEAL = 50. + 75.*I2R(GetUnitAbilityLevel(.data[.index].CASTER,a_code) - 1)
call GroupEnumUnitsInRange(.data[.index].AFFECTED,GetSpellTargetX(),GetSpellTargetY(),600.,Condition(function st.GroupFilter))
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(.data[.index].CASTER),'h00D',GetSpellTargetX(),GetSpellTargetY(),0.),'BHwe',3.)
call ForGroup(.data[.index].AFFECTED,function st.AddBuff)
if .index == 0 then
call TimerStart(.t,0.25,true,function st.onTimer)
endif
set .index = .index + 1
endif
return false
endmethod
endstruct
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function st.onCast))
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope MarkOfTheWild initializer Init
//uses 101 key of hash
globals
private constant integer a_code = 'A029'
private constant integer a_buffcode = 'A02B'
private constant integer b_buffcode = 'B00J'
endglobals
private function SpellEffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit TARGET = LoadUnitHandle(udg_hash,id,1)
local unit EFFECT = LoadUnitHandle(udg_hash,id,2)
local real TIMEOUT = LoadReal(udg_hash,id,3)
local integer addattack = LoadInteger(udg_hash,id,6)
local integer addarmor = LoadInteger(udg_hash,id,7)
local real DURATION = LoadReal(udg_hash,id,8)
local integer addstats = 0
local real addresist = 0.
set TIMEOUT = TIMEOUT + 0.04
call SaveReal(udg_hash,id,3,TIMEOUT)
call SetUnitX(EFFECT,GetUnitX(TARGET))
call SetUnitY(EFFECT,GetUnitY(TARGET))
call SetUnitFlyHeight(EFFECT,GetUnitFlyHeight(TARGET) + 125.,0.)
call SetUnitFacing(EFFECT,GetUnitFacing(TARGET))
if TIMEOUT >= DURATION then
set addresist = LoadReal(udg_hash,id,4)
set addstats = LoadInteger(udg_hash,id,5)
call SetHeroInt(TARGET,GetHeroInt(TARGET,false) - addstats,false)
call SetHeroAgi(TARGET,GetHeroAgi(TARGET,false) - addstats,false)
call SetHeroStr(TARGET,GetHeroStr(TARGET,false) - addstats,false)
call BlzSetUnitBaseDamage(TARGET,BlzGetUnitBaseDamage(TARGET,0)-addattack,0)
call BlzSetUnitArmor(TARGET,BlzGetUnitArmor(TARGET)-addarmor)
call SaveReal(udg_hash,GetHandleId(TARGET),16, LoadReal(udg_hash,GetHandleId(TARGET),16) - addresist)
call FlushChildHashtable(udg_hash,id)
call DestroyTimer(t)
if TIMEOUT < 999. then
call RemoveSavedHandle(udg_hash,GetHandleId(TARGET),101)
call UnitRemoveAbility(TARGET,a_buffcode)
call UnitRemoveAbility(TARGET,b_buffcode)
endif
endif
set t = null
set TARGET = null
set EFFECT = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local integer STONEBARK = LoadInteger(udg_hash,GetHandleId(CASTER),STONEBARK_LEVEL_HASH)
local integer addstats = 8*GetUnitAbilityLevel(CASTER,a_code)
local real addresist = 0.03*I2R(GetUnitAbilityLevel(CASTER,a_code))
local real duration = 60.
local integer addarmor = 0
local integer addattack = 0
if LoadTimerHandle(udg_hash,GetHandleId(TARGET),101) != null then
call SaveReal(udg_hash,GetHandleId(LoadTimerHandle(udg_hash,GetHandleId(TARGET),101)),3,1000.)
call RemoveSavedHandle(udg_hash,GetHandleId(TARGET),101)
call UnitRemoveAbility(TARGET,a_buffcode)
call UnitRemoveAbility(TARGET,b_buffcode)
endif
set udg_temp_unit = CreateUnit(Player(15),'h018',GetUnitX(TARGET),GetUnitY(TARGET),GetUnitFacing(TARGET))
call SetUnitFlyHeight(udg_temp_unit,GetUnitFlyHeight(TARGET) + 125.,0.)
call SetUnitAnimation(udg_temp_unit,"morph")
call FadeUnitIn(udg_temp_unit,1.5)
call SaveUnitHandle(udg_hash,id,1,TARGET)
call SaveUnitHandle(udg_hash,id,2,udg_temp_unit)
call UnitAddAbility(TARGET,a_buffcode)
call SaveReal(udg_hash,id,4,addresist)
call SetHeroInt(TARGET,GetHeroInt(TARGET,false) + addstats,false)
call SetHeroAgi(TARGET,GetHeroAgi(TARGET,false) + addstats,false)
call SetHeroStr(TARGET,GetHeroStr(TARGET,false) + addstats,false)
call SaveInteger(udg_hash,id,5,addstats)
call SaveReal(udg_hash,GetHandleId(TARGET),16,LoadReal(udg_hash,GetHandleId(TARGET),16) + addresist)
if STONEBARK > 0 then
set duration = duration + STONEBARK_DURATION_INCREASE * STONEBARK
set addarmor = STONEBARK_ARMOR_BONUS * STONEBARK
set addattack = STONEBARK_ATTACK_POWER_BONUS * STONEBARK
call BlzSetUnitBaseDamage(TARGET,BlzGetUnitBaseDamage(TARGET,0)+addattack,0)
call BlzSetUnitArmor(TARGET,BlzGetUnitArmor(TARGET)+addarmor)
call SaveInteger(udg_hash,id,6,addattack)
call SaveInteger(udg_hash,id,7,addarmor)
endif
call SaveReal(udg_hash,id,8,duration)
call TimerStart(t,0.04,true,function SpellEffect)
call SaveTimerHandle(udg_hash,GetHandleId(TARGET),101,t)
set CASTER = null
set TARGET = null
set t = null
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == a_code
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Conditions))
call TriggerAddAction(t,function onCast)
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TreeOfLife initializer Init requires MakeUnitPassive
globals
private boolean IsTurnedOn = false
endglobals
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit()) > 0. and GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_USER
endfunction
private function LivingAura takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real bonus = 0.1*I2R(GetUnitAbilityLevel(u,'A01B'))
local integer SOUL_FOREST = LoadInteger(udg_hash,GetHandleId(u),SOUL_FOREST_LEVEL_HASH)
local integer i = 0
if IsTurnedOn then
call SetUnitX(LoadUnitHandle(udg_hash,GetHandleId(t),2),GetUnitX(u))
call SetUnitY(LoadUnitHandle(udg_hash,GetHandleId(t),2),GetUnitY(u))
set udg_temp_unit = u
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(u),GetUnitY(u),600.,Filter(function GroupFilter))
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call AddHeroParameter(udg_temp_unit,bonus,1.,9,"","")
if SOUL_FOREST > 0 then
call AddHeroParameter(udg_temp_unit,SOUL_FOREST_PERIODIC_HEALING_BONUS*SOUL_FOREST,1.,GetPeriodicHealingReceivedBonusHash(),"","")
endif
endloop
else
call KillUnit(LoadUnitHandle(udg_hash,GetHandleId(t),2))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
private function RemoveEffects takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
private function MoveEffects takes nothing returns nothing
local real angle = Atan2(GetUnitY(GetEnumUnit()) - GetUnitY(udg_temp_unit),GetUnitX(GetEnumUnit()) - GetUnitX(udg_temp_unit))
call SetUnitX(GetEnumUnit(),GetUnitX(udg_temp_unit) + 600.*Cos(angle + 10.*bj_DEGTORAD))
call SetUnitY(GetEnumUnit(),GetUnitY(udg_temp_unit) + 600.*Sin(angle + 10.*bj_DEGTORAD))
endfunction
private function AuraEffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local group g = LoadGroupHandle(udg_hash,GetHandleId(t),2)
set udg_temp_unit = u
call ForGroup(g,function MoveEffects)
if GetWidgetLife(u) <= 0 or not IsTurnedOn then
call ForGroup(g,function RemoveEffects)
call DestroyGroup(g)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set u = null
set g = null
endfunction
private function onTimerApplyTreeOfLife takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
local timer t2 = CreateTimer()
local group g = CreateGroup()
local integer i = 1
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call AddUnitAnimationProperties(CASTER,"alternate",false)
call MakeUnitPassive(CASTER)
set IsTurnedOn = true
loop
exitwhen i >= 3
call GroupAddUnit(g,CreateUnit(GetOwningPlayer(CASTER),'h019',GetUnitX(CASTER) + 600.*Cos((120.*I2R(i)) *bj_DEGTORAD),GetUnitY(CASTER) + 600.*Sin((120.*I2R(i)) *bj_DEGTORAD),0.))
set i = i + 1
endloop
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,CASTER)
call SaveGroupHandle(udg_hash,GetHandleId(t1),2,g)
call SaveUnitHandle(udg_hash,GetHandleId(t2),1,CASTER)
call TimerStart(t2,1.,true,function LivingAura)
call TimerStart(t1,0.04,true,function AuraEffect)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set t1 = null
set t2 = null
set g = null
endfunction
private function onCast takes nothing returns nothing
local timer t = null
local unit CASTER = GetTriggerUnit()
local integer i = 0
if GetIssuedOrderId() == OrderId("bearform") then
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,0.0,false,function onTimerApplyTreeOfLife)
set t = null
elseif GetIssuedOrderId() == OrderId("unbearform") then
call AddUnitAnimationProperties(CASTER,"alternate",true)
call MakeUnitPassive(CASTER)
set IsTurnedOn = false
endif
set CASTER = null
endfunction
private function Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'O006' or GetUnitTypeId(GetTriggerUnit()) == 'O007'
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
call TriggerAddAction(t, function onCast)
call TriggerAddCondition(t,Condition(function Conditions))
set t = null
endfunction
endlibrary
library DeathKnightTalents initializer onInit requires MapGameplayUtils
globals
constant integer DEATH_KNIGHT_CODE = 'H01C'
private constant integer MAX_TALENTS = 10
private constant integer BREATH_SINDRAGOSA_CODE = 'A05I'
private constant integer INEXORABLE_ASSAULT_CODE = 'A05J'
private constant integer ICY_TALONS_CODE = 'A05K'
private constant integer SOULBITER_CODE = 'A05L'
private constant integer RUNIC_POWER_CODE = 'A07I'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer BREATH_SINDRAGOSA_LEVEL_HASH = 250
constant real BREATH_SINDRAGOSA_DURATION = 10.
constant real BREATH_SINDRAGOSA_RESISTS_REDUCE = 0.04
constant integer INEXORABLE_ASSAULT_LEVEL_HASH = 251
constant real INEXORABLE_ASSAULT_SPELLPOWER_EFFECT_BONUS = 0.1
constant real INEXORABLE_ASSAULT_CRIT_INCREASE = 5.
constant integer ICY_TALONS_LEVEL_HASH = 252
constant real ICY_TALONS_SPELLCRIT_BONUS = 1.
constant real ICY_TALONS_DURATION = 10.
constant integer SOULBITER_LEVEL_HASH = 253
constant integer SOULBITER_BONUS_DAMAGE = 5
constant integer RUNIC_POWER_LEVEL_HASH = 254
constant real RUNIC_POWER_BASE_SPELLPOWER_EFFECT = 0.
constant real RUNIC_POWER_LEVEL_SPELLPOWER_EFFECT = 0.0075
constant real RUNIC_POWER_BASE_AOE = 300
constant real RUNIC_POWER_LEVEL_AOE = 50
constant real RUNIC_POWER_BASE_DMG = 0
constant real RUNIC_POWER_LVL_DMG = 2.
constant real RUNIC_POWER_DMG_PERIOD = 2. //1.75
constant string RUNIC_POWER_EFFECT = "Abilities\\Spells\\Other\\BreathOfFrost\\BreathOfFrostTarget.mdl"
constant string RUNIC_POWER_ATTACH = "chest"
constant integer RUNIC_POWER_AURACODE = 'A07J'
constant integer RUNIC_POWER_BUFFCODE = 'B027'
private timer SOULBITER_TIMER = CreateTimer()
private timer RUNIC_POWER_TIMER = CreateTimer()
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == DEATH_KNIGHT_CODE
endfunction
private function GetBreathSyndragosaDescriptionByLevel takes integer lvl returns string
return "Enemies affected by the Frostwyrm's Fury receive increased by |c008080C0" + I2S(R2I(BREATH_SINDRAGOSA_RESISTS_REDUCE*100*lvl)) + "%|r damage from physical and magical attacks for " + I2S(R2I(BREATH_SINDRAGOSA_DURATION)) + " seconds."
endfunction
private function GetInexorableAssaultDescriptionByLevel takes integer lvl returns string
return "Increases the effect of Spell Power for the strike of Frostmourne by |c008080C0" + I2S(R2I(INEXORABLE_ASSAULT_SPELLPOWER_EFFECT_BONUS*100*lvl)) + "%|r and improves its chance to crit by |c008080C0" + I2S(R2I(INEXORABLE_ASSAULT_CRIT_INCREASE*lvl)) + "%|r."
endfunction
private function GetIcyTalonsDescriptionByLevel takes integer lvl returns string
return "When the Death Knight spends a rune, he gets increased by |c008080C0" + I2S(R2I(ICY_TALONS_SPELLCRIT_BONUS*lvl)) + "%|r spell critical chance for " + I2S(R2I(ICY_TALONS_DURATION)) + " seconds."
endfunction
private function GetSoulbiterDescriptionByLevel takes integer lvl returns string
return "Each missing rune increases the attack power by |c008080C0" + I2S(SOULBITER_BONUS_DAMAGE*lvl) + "|r."
endfunction
private function GetRunicPowerDescriptionByLevel takes integer lvl returns string
return "Every " + R2S(RUNIC_POWER_DMG_PERIOD) + " seconds causes a blast, dealing |c008080C0" + I2S(R2I(RUNIC_POWER_BASE_DMG + RUNIC_POWER_LVL_DMG*lvl)) + "|r + [|c008080C0" + R2S((RUNIC_POWER_BASE_SPELLPOWER_EFFECT+RUNIC_POWER_LEVEL_SPELLPOWER_EFFECT*lvl)*100) + "%|r of SPELLPOWER] |cff0000fffrost|r damage for each missing |cff6f2583Rune|r in |c008080C0"+ I2S(R2I(RUNIC_POWER_BASE_AOE+RUNIC_POWER_LEVEL_AOE*lvl)) + "|r AOE."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),BREATH_SINDRAGOSA_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(BREATH_SINDRAGOSA_CODE, GetBreathSyndragosaDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetBreathSyndragosaDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(BREATH_SINDRAGOSA_CODE, GetBreathSyndragosaDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),INEXORABLE_ASSAULT_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(INEXORABLE_ASSAULT_CODE, GetInexorableAssaultDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetInexorableAssaultDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(INEXORABLE_ASSAULT_CODE, GetInexorableAssaultDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),ICY_TALONS_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(ICY_TALONS_CODE, GetIcyTalonsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetIcyTalonsDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(ICY_TALONS_CODE, GetIcyTalonsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),SOULBITER_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(SOULBITER_CODE, GetSoulbiterDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetSoulbiterDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(SOULBITER_CODE, GetSoulbiterDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),RUNIC_POWER_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(RUNIC_POWER_CODE, GetRunicPowerDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetRunicPowerDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(RUNIC_POWER_CODE, GetRunicPowerDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onTimerSoulbiter takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer LAST_DMG = LoadInteger(udg_hash,GetHandleId(t),2)
local integer NEW_DMG = R2I(GetUnitState(CASTER,UNIT_STATE_MAX_MANA)-GetUnitState(CASTER,UNIT_STATE_MANA)) * LoadInteger(udg_hash,GetHandleId(CASTER),SOULBITER_LEVEL_HASH)*SOULBITER_BONUS_DAMAGE
if GetWidgetLife(CASTER) > 0. then
if LAST_DMG > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)-LAST_DMG,0)
endif
if NEW_DMG > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)+NEW_DMG,0)
call SaveInteger(udg_hash,GetHandleId(t),2,NEW_DMG)
else
call SaveInteger(udg_hash,GetHandleId(t),2,0)
endif
endif
set t = null
set CASTER = null
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and not BlzIsUnitInvulnerable(GetFilterUnit())
endfunction
private function onTimerRunicPower takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer RUNIC_POWER_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),RUNIC_POWER_LEVEL_HASH)
local group g = null
local unit tempu = null
local integer RUNES = 10-R2I(GetUnitState(CASTER,UNIT_STATE_MANA))
local real DMG = (RUNIC_POWER_BASE_DMG + RUNIC_POWER_LVL_DMG*RUNIC_POWER_LEVEL + (RUNIC_POWER_BASE_SPELLPOWER_EFFECT+RUNIC_POWER_LEVEL_SPELLPOWER_EFFECT*RUNIC_POWER_LEVEL)*GetUnitSpellPower(CASTER))*RUNES
if RUNIC_POWER_LEVEL > 0 and GetWidgetLife(CASTER)>0. and DMG>0. then
set udg_temp_unit = CASTER
set g = CreateGroup()
call GroupEnumUnitsInRange(g, GetUnitX(CASTER), GetUnitY(CASTER) , RUNIC_POWER_BASE_AOE+RUNIC_POWER_LEVEL_AOE*RUNIC_POWER_LEVEL, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
call DealFrostDamage(CASTER,tempu,DMG)
call DestroyEffect(AddSpecialEffectTarget(RUNIC_POWER_EFFECT,tempu,RUNIC_POWER_ATTACH))
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
endif
set t = null
set CASTER = null
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == BREATH_SINDRAGOSA_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Breath of Sindragosa CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),BREATH_SINDRAGOSA_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),BREATH_SINDRAGOSA_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),BREATH_SINDRAGOSA_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),BREATH_SINDRAGOSA_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == INEXORABLE_ASSAULT_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Inexorable Assault CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),INEXORABLE_ASSAULT_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),INEXORABLE_ASSAULT_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),INEXORABLE_ASSAULT_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),INEXORABLE_ASSAULT_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == ICY_TALONS_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Icy Talons CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),ICY_TALONS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),ICY_TALONS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),ICY_TALONS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),ICY_TALONS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == SOULBITER_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Soulbiter CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),SOULBITER_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),SOULBITER_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),SOULBITER_LEVEL_HASH) + 1 )
if LoadInteger(udg_hash,GetHandleId(CASTER),SOULBITER_LEVEL_HASH) == 1 then
call SaveUnitHandle(udg_hash,GetHandleId(SOULBITER_TIMER),1,CASTER)
call SaveInteger(udg_hash,GetHandleId(SOULBITER_TIMER),2,0)
call TimerStart(SOULBITER_TIMER,0.5,true,function onTimerSoulbiter)
endif
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SOULBITER_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == RUNIC_POWER_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"RUNIC_POWER CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),RUNIC_POWER_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),RUNIC_POWER_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),RUNIC_POWER_LEVEL_HASH) + 1 )
if LoadInteger(udg_hash,GetHandleId(CASTER),RUNIC_POWER_LEVEL_HASH) == 1 then
call SaveUnitHandle(udg_hash,GetHandleId(RUNIC_POWER_TIMER),1,CASTER)
call UnitAddAbility(CASTER,RUNIC_POWER_AURACODE)
call TimerStart(RUNIC_POWER_TIMER,RUNIC_POWER_DMG_PERIOD,true,function onTimerRunicPower)
endif
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),RUNIC_POWER_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function DeathKnightUnlearnTalents takes unit hero returns nothing
local integer BREATH_SINDRAGOSA_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),BREATH_SINDRAGOSA_LEVEL_HASH)
local integer INEXORABLE_ASSAULT_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),INEXORABLE_ASSAULT_LEVEL_HASH)
local integer ICY_TALONS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),ICY_TALONS_LEVEL_HASH)
local integer SOULBITER_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),SOULBITER_LEVEL_HASH)
local integer RUNIC_POWER_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),RUNIC_POWER_LEVEL_HASH)
local integer sum = BREATH_SINDRAGOSA_LEVEL+INEXORABLE_ASSAULT_LEVEL+ICY_TALONS_LEVEL+SOULBITER_LEVEL+RUNIC_POWER_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
if RUNIC_POWER_LEVEL > 0 then
call UnitRemoveAbility(hero,RUNIC_POWER_AURACODE)
call UnitRemoveAbility(hero,RUNIC_POWER_BUFFCODE)
endif
call SaveInteger(udg_hash,GetHandleId(hero),BREATH_SINDRAGOSA_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),INEXORABLE_ASSAULT_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),ICY_TALONS_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),SOULBITER_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),RUNIC_POWER_LEVEL_HASH,0)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope DeathGrip initializer onInit
globals
private constant integer ABILCODE = 'A03T'
private constant real DURATION = 1.
private constant integer MAXUNITS = 10
private constant real AGGRO_IGNORE_DURATION = 3.
private real tempX
private real tempY
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function MoveLight takes nothing returns nothing
local real x = tempX
local real y = tempY
local unit tempu = GetEnumUnit()
local real x1 = GetUnitX(tempu)
local real y1 = GetUnitY(tempu)
local lightning L = LoadLightningHandle(udg_hash,GetHandleId(tempu),103)
call MoveLightningEx(L,true,x1,y1,GetTerrainZ(x1,y1)+GetUnitFlyHeight(tempu)+70.,x,y,GetTerrainZ(x,y)+70.)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Moving Lighting")
set L = null
set tempu = null
endfunction
private function DestroyLight takes nothing returns nothing
local unit tempu = GetEnumUnit()
local lightning L = LoadLightningHandle(udg_hash,GetHandleId(tempu),103)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"LightningDestroyed")
call DestroyLightning(L)
call ResetUnitAnimation(tempu)
call PauseUnit(tempu,false)
set tempu = null
set L = null
endfunction
private function onTimerMoveLightning takes nothing returns nothing
local timer t = GetExpiredTimer()
local group LG = LoadGroupHandle(udg_hash,GetHandleId(t),1)
local real x = LoadReal(udg_hash,GetHandleId(t),2)
local real y = LoadReal(udg_hash,GetHandleId(t),3)
local real curDur = LoadReal(udg_hash,GetHandleId(t),4)
local unit tempu = null
local unit CASTER = null
local lightning L = null
set curDur = curDur + 0.04
call SaveReal(udg_hash,GetHandleId(t),4,curDur)
if curDur < DURATION then
set tempX = x
set tempY = y
call ForGroup(LG, function MoveLight)
else
call ForGroup(LG, function DestroyLight)
call DestroyGroup(LG)
call DestroyTimer(t)
endif
set t = null
set LG = null
set L = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real x1 = GetSpellTargetX()
local real y1 = GetSpellTargetY()
local integer j = 0
local unit tempu = null
local real x2 = 0.
local real y2 = 0.
local group g = CreateGroup()
local group LightningGroup = CreateGroup()
local real angle = 0.
local real dist = 0.
local real threatD = 0.
local lightning L = null
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x1,y1,250.,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not (Aggro.target(tempu)==CASTER) then
set threatD = Aggro.Targetaggro(tempu) - Aggro.get(tempu,CASTER,false)
if threatD >=0. then
call Aggro.add(tempu,CASTER,threatD)
endif
endif
call Aggro.ignoreAggro(tempu,AGGRO_IGNORE_DURATION,CASTER,false)
if IsUnitKnockbackable(tempu) then
if j < MAXUNITS then
set x2 = GetUnitX(tempu)
set y2 = GetUnitY(tempu)
set angle = Atan2(y-y2,x - x2)
set dist = SquareRoot( (x-x2)*(x-x2) + (y-y2)*(y-y2) )
call ParKnock(tempu,400.,dist,DURATION,Rad2Deg(angle),false,"none")
set L = AddLightningEx("MYNL",true,x2,y2,GetTerrainZ(x2,y2)+GetUnitFlyHeight(tempu)+70.,x,y,GetTerrainZ(x,y)+70.)
call SetLightningColor(L,128,0,128,1.)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl",tempu,"head"))
call SaveLightningHandle(udg_hash,GetHandleId(tempu),103,L)
call GroupAddUnit(LightningGroup,tempu)
call PauseUnit(tempu,true)
call SetUnitAnimation(tempu,"death")
set j = j + 1
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
if j>0 then
call SaveGroupHandle(udg_hash,GetHandleId(t),1,LightningGroup)
call SaveReal(udg_hash,GetHandleId(t),2,x)
call SaveReal(udg_hash,GetHandleId(t),3,y)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),5,CASTER)
call TimerStart(t,0.04,true,function onTimerMoveLightning)
endif
call DestroyGroup(g)
set g = null
set t = null
set CASTER = null
set L = null
set LightningGroup = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conditions ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope FrostWyrmFury initializer onInit
globals
private constant integer ABILCODE = 'A03S'
private constant integer NOVACODE = 'A03U'
private constant integer DRAGONCODE = 'u002'
private constant integer MISSILECODE = 'h029'
private constant real DRAGONSPEED = 600.
private constant real DISTACT = 200.
private constant real SHARD_AOE = 200.
private constant real BASE_DAMAGE = 350.
private constant real STARTFLYHEIGHT = 900.
private constant real ENDFLYHEIGHT = 400.
private constant real FLYHEIGHTSPEED = 150.
private constant real STARTBACKDISTANCE = 1500.
private constant real DURATION = 3.5
private group AFFECTED = CreateGroup()
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onFall takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit shard = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real x = GetUnitX(shard)
local real y = GetUnitY(shard)
local real angle = LoadReal(udg_hash,GetHandleId(t),2)
local real speedX = LoadReal(udg_hash,GetHandleId(t),3)
local real speedH = LoadReal(udg_hash,GetHandleId(t),4)
local integer RUNES = LoadInteger(udg_hash,GetHandleId(t),5)
local unit CASTER = null
local real height = GetUnitFlyHeight(shard)
local real damage = 0.
local group g = null
local unit tempu = null
local integer BREATH_SINDRAGOSA = 0
call SetUnitX(shard, x + speedX * Cos(angle))
call SetUnitY(shard, y + speedX * Sin(angle))
call SetUnitFlyHeight(shard,height-speedH,0.)
if not (GetWidgetLife(shard)>0.) then
set CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),5)
set BREATH_SINDRAGOSA = LoadInteger(udg_hash,GetHandleId(CASTER),BREATH_SINDRAGOSA_LEVEL_HASH)
set damage = (BASE_DAMAGE*GetUnitAbilityLevel(CASTER,ABILCODE)+GetUnitSpellPower(CASTER))*(1+RUNES/10)
//call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", x, y))
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,SHARD_AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not IsUnitInGroup(tempu,AFFECTED) then
call GroupAddUnit(AFFECTED,tempu)
if BREATH_SINDRAGOSA > 0 then
call AddHeroParameter(tempu, BREATH_SINDRAGOSA*BREATH_SINDRAGOSA_RESISTS_REDUCE,BREATH_SINDRAGOSA_DURATION,GetPhysDmgReduceHash(),"","")
call AddHeroParameter(tempu, BREATH_SINDRAGOSA*BREATH_SINDRAGOSA_RESISTS_REDUCE,BREATH_SINDRAGOSA_DURATION,GetSpellResistHash(),"","")
endif
call DealMagicalDamageOfType(CASTER,tempu,damage,"FROST")
call DummyCastTarget(CASTER,tempu,NOVACODE,1,"frostnova")
endif
call GroupRemoveUnit(g,tempu)
endloop
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call DestroyGroup(g)
set g = null
set CASTER = null
endif
set t = null
set shard = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit dragon = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real angle = LoadReal(udg_hash,GetHandleId(t),2)
local real dist = LoadReal(udg_hash,GetHandleId(t),3)
local real DURATION = LoadReal(udg_hash,GetHandleId(t),4)
local real curDURATION = LoadReal(udg_hash,GetHandleId(t),5)
local boolean FADED = LoadBoolean(udg_hash,GetHandleId(t),6)
local integer RUNES = LoadInteger(udg_hash,GetHandleId(t),8)
local unit CASTER = null
local real d = DRAGONSPEED/25.
local real height = GetUnitFlyHeight(dragon)
local unit temp = null
set curDURATION = curDURATION + 0.04
call SaveReal(udg_hash,GetHandleId(t),5,curDURATION)
call SetUnitX(dragon, GetUnitX(dragon) + d * Cos(angle))
call SetUnitY(dragon, GetUnitY(dragon) + d * Sin(angle))
if curDURATION < DURATION then
if height > ENDFLYHEIGHT then
call SetUnitFlyHeight(dragon, height - FLYHEIGHTSPEED/25.,0.)
endif
set dist = dist + d
if dist >= DISTACT then
set dist = 0.
//call SetUnitAnimation(dragon,"attack")
set temp = CreateUnit(GetOwningPlayer(dragon),MISSILECODE,GetUnitX(dragon)+ 150.*Cos(angle),GetUnitY(dragon)+150*Sin(angle),0.)
call SetUnitFlyHeight(temp,height+50.,0.)
call UnitApplyTimedLife(temp,'BHwe',1.)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,temp)
call SaveReal(udg_hash,GetHandleId(t1),2,angle+GetRandomReal(-0.3,0.3))
call SaveReal(udg_hash,GetHandleId(t1),3,DRAGONSPEED/25.)
call SaveReal(udg_hash,GetHandleId(t1),4,height/25.)
call SaveInteger(udg_hash,GetHandleId(t1),5,RUNES)
set CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),7)
call SaveUnitHandle(udg_hash,GetHandleId(t1),5,CASTER)
call TimerStart(t1,0.04,true, function onFall)
set temp = null
set t1 = null
set CASTER = null
endif
else
if not FADED then
call FadeUnitIn(dragon,2.)
call SaveBoolean(udg_hash,GetHandleId(t),5,true)
endif
call SetUnitFlyHeight(dragon, height + FLYHEIGHTSPEED/25.,0.)
endif
if not (GetWidgetLife(dragon) > 0.) then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),3,dist)
endif
set dragon = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real x1 = GetSpellTargetX()
local real y1 = GetSpellTargetY()
local real angle = Atan2(y1 - y,x1 - x)
local integer RUNES = R2I(GetUnitState(CASTER,UNIT_STATE_MANA))
local force play = null
local integer ICY_TALONS = LoadInteger(udg_hash,GetHandleId(CASTER),ICY_TALONS_LEVEL_HASH)
local unit dragon = CreateUnit(GetOwningPlayer(CASTER),DRAGONCODE,GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect), Rad2Deg(angle))
call SetUnitX(dragon,x-STARTBACKDISTANCE*Cos(angle))
call SetUnitY(dragon,y-STARTBACKDISTANCE*Sin(angle) )
//
call SaveInteger(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_CHARGES,0)
//
call GroupClear(AFFECTED)
if RUNES > 0 then
call SetUnitState(CASTER,UNIT_STATE_MANA,0.)
if ICY_TALONS > 0 then
call AddHeroParameter(CASTER,RUNES*ICY_TALONS_SPELLCRIT_BONUS*ICY_TALONS,ICY_TALONS_DURATION,GetSpellCritHash(),"","")
endif
set play = CreateForce()
call ForceAddPlayer(play,GetOwningPlayer(CASTER))
call AddTextTagUnit("-" + I2S(RUNES) + " |cff008080runes|r",CASTER,play,GetRandomReal(0.,0.),12.,2.,0.)
call DestroyForce(play)
set play = null
endif
call SaveUnitHandle(udg_hash,GetHandleId(t),1,dragon)
call SaveReal(udg_hash,GetHandleId(t),2,angle)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call SaveReal(udg_hash,GetHandleId(t),4,DURATION)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
call SaveBoolean(udg_hash,GetHandleId(t),6,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),7,CASTER)
call SaveInteger(udg_hash,GetHandleId(t),8,RUNES)
call SetUnitFlyHeight(dragon,STARTFLYHEIGHT,0.)
call SetUnitTimeScale(dragon,1.)
call SetUnitAnimationByIndex(dragon,-2)
//call UnitApplyTimedLife(dragon,'BHwe',DURATION)
call FadeUnitOut(dragon,DURATION/3.,false)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set dragon = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conditions ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope Frostmourne initializer onInit
globals
timer FROSTMOURNE_TIMER = CreateTimer()
constant integer FROSTMOURNE_ABILCODE = 'A03W'
constant integer FROSTMOURNE_BUFFCODE = 'B016'
constant integer FROSTMOURNE_HASHKEY_DAMAGE = 201
constant integer FROSTMOURNE_HASHKEY_FLAG = 202
constant integer FROSTMOURNE_HASHKEY_CHARGES = 200
endglobals
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0 and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)<GetUnitState(GetFilterUnit(),UNIT_STATE_MAX_LIFE)
endfunction
private function onTimerExpired takes nothing returns nothing
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(FROSTMOURNE_TIMER),1)
local real DAMAGE_TOTAL = LoadReal(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_DAMAGE)
//local real HEALING_DONE_BONUS = LoadReal(udg_hash,GetHandleId(CASTER),GetHealingBonusHash())
local integer CHARGES = 0
local unit tempu = null
local group g = CreateGroup()
//local real HEALINGBONUS = 0.
local real CURHEAL = 0.
local real HP_DIFFERENCE = 0.
local real REMAINING_HEALING = DAMAGE_TOTAL * (1.)
if HaveSavedInteger(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_CHARGES) then
set CHARGES = LoadInteger(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_CHARGES)
endif
call UnitRemoveAbility(CASTER,FROSTMOURNE_BUFFCODE)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Total Frostmourne DAMAGE: " + R2S(DAMAGE_TOTAL))
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),700,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen (tempu == null) or (REMAINING_HEALING <= 0.)
//set HEALINGBONUS = LoadReal(udg_hash,GetHandleId(tempu),GetHealingReceiveBonusHash())
set HP_DIFFERENCE = GetUnitState(tempu,UNIT_STATE_MAX_LIFE) - GetWidgetLife(tempu)
if HP_DIFFERENCE <= REMAINING_HEALING then
set CURHEAL = HP_DIFFERENCE
set REMAINING_HEALING = REMAINING_HEALING - HP_DIFFERENCE
call HealUnit(CASTER,tempu,CURHEAL)
else
set CURHEAL = REMAINING_HEALING
call HealUnit(CASTER,tempu,CURHEAL)
set REMAINING_HEALING = -1.
endif
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl",tempu,"chest"))
call GroupRemoveUnit(g,tempu)
endloop
set CHARGES = CHARGES + 1
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CHARGES: " + I2S(CHARGES))
if CHARGES <= 2 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Adding +2 mana")
call RegenerateEnergy(CASTER,1)
endif
if (CHARGES > 2) and (CHARGES <= 4) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Adding +3 mana")
call RegenerateEnergy(CASTER,2)
endif
if CHARGES >= 5 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Reseting Charges")
//call SetUnitState(CASTER,UNIT_STATE_MANA,0)
set CHARGES = 0
endif
call SaveBoolean(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_FLAG,false)
call SaveReal(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_DAMAGE,0.)
call SaveInteger(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_CHARGES,CHARGES)
call DestroyGroup(g)
set g = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,FROSTMOURNE_TIMER)
call TriggerAddAction(t,function onTimerExpired)
set t = null
endfunction
endscope
scope PresenceOfTheLichKing initializer onInit
globals
constant integer PRESENCE_ABILCODE = 'A03X'
constant integer PRESENCE_BUFFCODE = 'B017'
private constant integer PRESENCE_DUMMYCODE = 'A009'
private constant integer PRESENCE_FREEZECODE = 'A03Y'
constant integer PRESENCE_HASH_CHARGES = 104
constant integer PRESENCE_HASH_CASTER = 105
private constant real DURATION_BASE = 0.75
private constant real DURATION_LEVEL_FACTOR = 0.25
constant real PRESENCE_DOT_DURATION = 6.
constant real PRESENCE_DOT_PERIOD = 1.5
timer PRESENCE_TIMER = CreateTimer()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == PRESENCE_ABILCODE
endfunction
private function Unfreeze takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real DURATION = LoadReal(udg_hash,GetHandleId(t),2)
local real EXPIRED = LoadReal(udg_hash,GetHandleId(t),3)
set EXPIRED = EXPIRED + 0.04
if (EXPIRED >= DURATION) or (not (GetWidgetLife(TARGET)>0.)) then
call SetUnitTimeScale(TARGET,1.)
call PauseUnit(TARGET,false)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
//call SetUnitTimeScale(TARGET,EXPIRED*100/DURATION)
call SaveReal(udg_hash,GetHandleId(t),3,EXPIRED)
endif
set t = null
set TARGET = null
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerAfterAttack takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
local unit ATTACKER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(TARGET),PRESENCE_HASH_CASTER)
local integer CHARGES = LoadInteger(udg_hash,GetHandleId(TARGET),PRESENCE_HASH_CHARGES)
local real DURATION = DURATION_BASE + DURATION_LEVEL_FACTOR*GetUnitAbilityLevel(CASTER,PRESENCE_ABILCODE)
local real DAMAGE = (200.*GetUnitAbilityLevel(CASTER,PRESENCE_ABILCODE)+LoadReal(udg_hash,GetHandleId(TARGET),5))/(PRESENCE_DOT_DURATION/PRESENCE_DOT_PERIOD)
local group g = CreateGroup()
local unit tempu = null
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"ATTACK RECEIVED WITH: " + I2S(CHARGES) + " CHARGES")
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl",ATTACKER,"origin"))
if IsUnitKnockbackable(ATTACKER) then
call PauseUnit(ATTACKER,true)
call SetUnitTimeScale(ATTACKER,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,ATTACKER)
call SaveReal(udg_hash,GetHandleId(t1),2,DURATION)
call SaveReal(udg_hash,GetHandleId(t1),3,0.)
call TimerStart(t1,0.04,true,function Unfreeze)
endif
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(ATTACKER),GetUnitY(ATTACKER),200.,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DOT(CASTER,ATTACKER,DAMAGE,PRESENCE_DOT_DURATION,PRESENCE_DOT_PERIOD,3,"Abilities\\Spells\\Other\\BreathOfFrost\\BreathOfFrostTarget.mdl","overhead",false)
call GroupRemoveUnit(g,tempu)
endloop
set CHARGES = CHARGES - 1
if CHARGES > 0 then
call SaveInteger(udg_hash,GetHandleId(TARGET),PRESENCE_HASH_CHARGES,CHARGES)
else
call UnitRemoveAbility(TARGET,PRESENCE_BUFFCODE)
endif
call DestroyGroup(g)
set g = null
set t = null
set t1 = null
set ATTACKER = null
set TARGET = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local integer CHARGES = 3*GetUnitAbilityLevel(CASTER,PRESENCE_ABILCODE)
local integer RUNES = R2I(GetUnitState(CASTER,UNIT_STATE_MANA))
local force play = null
local integer ICY_TALONS = LoadInteger(udg_hash,GetHandleId(CASTER),ICY_TALONS_LEVEL_HASH)
//
call SaveInteger(udg_hash,GetHandleId(CASTER),FROSTMOURNE_HASHKEY_CHARGES,0)
//
if RUNES>0 then
set CHARGES = CHARGES + RUNES
call SetUnitState(CASTER,UNIT_STATE_MANA,0)
if ICY_TALONS > 0 then
call AddHeroParameter(CASTER,RUNES*ICY_TALONS_SPELLCRIT_BONUS*ICY_TALONS,ICY_TALONS_DURATION,GetSpellCritHash(),"","")
endif
set play = CreateForce()
call ForceAddPlayer(play,GetOwningPlayer(CASTER))
call AddTextTagUnit("-" + I2S(RUNES) + " |cff008080runes|r",CASTER,play,GetRandomReal(0.,0.),12.,2.,0.)
call DestroyForce(play)
set play = null
endif
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"PRESENCE CASTED")
call SaveInteger(udg_hash,GetHandleId(TARGET),PRESENCE_HASH_CHARGES,CHARGES)
call SaveUnitHandle(udg_hash,GetHandleId(TARGET),PRESENCE_HASH_CASTER,CASTER)
set CASTER = null
set TARGET = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
call TriggerRegisterTimerExpireEvent(t1,PRESENCE_TIMER)
call TriggerAddAction(t1,function onTimerAfterAttack)
set t = null
set t1 = null
endfunction
endscope
scope Obliteration initializer onInit
globals
private constant integer ABILCODE = 'A03Z'
private constant integer FROSTMOURNE_CODE = 'h02A'
private constant integer AURA_CODE = 'A03Y'
private weathereffect array weather[50]
private constant real DURATION = 16.
private constant real TICKPERIOD = 2.
private constant real DAMAGEAOE = 500.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilterEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function GroupFilterAlly takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local rect reg = null
local integer WEATHER_INDEX = 0
local unit FROSTMOURNE = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local real ELAPSED = LoadReal(udg_hash,GetHandleId(t),4)
local real FROMLASTTICK = LoadReal(udg_hash,GetHandleId(t),5)
local boolean DEATHANIM = LoadBoolean(udg_hash,GetHandleId(t),6)
local unit CASTER = null
local group g = null
local unit tempu = null
local real DAMAGE = 0.
local real CURHEAL = 0.
set ELAPSED = ELAPSED + 0.04
set FROMLASTTICK = FROMLASTTICK + 0.04
if ELAPSED >= DURATION then
set reg = LoadRectHandle(udg_hash,GetHandleId(t),1)
set WEATHER_INDEX = LoadInteger(udg_hash,GetHandleId(t),2)
call RemoveWeatherEffect(weather[WEATHER_INDEX])
set weather[WEATHER_INDEX] = null
call RemoveRect(reg)
call SetUnitAnimation(FROSTMOURNE,"death")
call FadeUnitIn(FROSTMOURNE,3.)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),4,ELAPSED)
call SaveReal(udg_hash,GetHandleId(t),5,FROMLASTTICK)
endif
if FROMLASTTICK >= TICKPERIOD then
call SetUnitAnimation(FROSTMOURNE,"death")
call SaveBoolean(udg_hash,GetHandleId(t),6,true)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
endif
//When it is 1 second after "death" animation
if FROMLASTTICK>=1 and DEATHANIM then
call SetUnitAnimation(FROSTMOURNE,"stand")
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl",GetUnitX(FROSTMOURNE),GetUnitY(FROSTMOURNE)))
call SaveBoolean(udg_hash,GetHandleId(t),6,false)
set CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),7)
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(FROSTMOURNE),GetUnitY(FROSTMOURNE),DAMAGEAOE,Condition(function GroupFilterEnemy))
set DAMAGE = 100. * GetUnitAbilityLevel(CASTER,ABILCODE) + LoadReal(udg_hash,GetHandleId(CASTER),5)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DealMagicalDamageOfType(CASTER,tempu,DAMAGE,"FROST")
call AddHeroParameter(tempu, -0.02*GetUnitAbilityLevel(CASTER,ABILCODE),5.,GetPhysDmgReduceHash(),"","")
call AddHeroParameter(tempu, -0.02*GetUnitAbilityLevel(CASTER,ABILCODE),5.,GetSpellResistHash(),"","")
//call DummyCastTarget(CASTER,tempu,NOVACODE,1,"frostnova")
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\FrostBolt\\FrostBoltMissile.mdl",tempu,"chest"))
call GroupRemoveUnit(g,tempu)
endloop
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(FROSTMOURNE),GetUnitY(FROSTMOURNE),DAMAGEAOE,Condition(function GroupFilterAlly))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set CURHEAL = GetUnitState(tempu,UNIT_STATE_MAX_LIFE)*(0.01+0.02*GetUnitAbilityLevel(CASTER,ABILCODE))
call UnitDamageTarget(CASTER,tempu,-1*CURHEAL,false,false,ATTACK_TYPE_NORMAL,null,null)
//call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\FrostBolt\\FrostBoltMissile.mdl",tempu,"chest"))
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
endif
set t = null
set reg = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local real angle = -Atan2( y-GetUnitY(CASTER), x-GetUnitX(CASTER) )
local integer j = 0
local unit FROSTMOURNE = CreateUnit(GetOwningPlayer(CASTER),FROSTMOURNE_CODE,x,y,Rad2Deg(angle))
local rect reg = Rect(x - 250*Cos(0.785), y - 250*Sin(0.785), x + 250*Cos(0.785), y+250*Sin(0.785))
local timer t = CreateTimer()
local integer ICY_TALONS = LoadInteger(udg_hash,GetHandleId(CASTER),ICY_TALONS_LEVEL_HASH)
call AddHeroParameter(CASTER,3*ICY_TALONS_SPELLCRIT_BONUS*ICY_TALONS,ICY_TALONS_DURATION,GetSpellCritHash(),"","")
call UnitAddAbility(FROSTMOURNE,AURA_CODE)
call SetUnitAbilityLevel(FROSTMOURNE,AURA_CODE,GetUnitAbilityLevel(CASTER,ABILCODE))
loop
exitwhen weather[j] == null or j>49
set j = j + 1
endloop
set weather[j] = AddWeatherEffect(reg,'SNbs')
call EnableWeatherEffect(weather[j],true)
call FadeUnitOut(FROSTMOURNE,2.5,false)
call SaveRectHandle(udg_hash,GetHandleId(t),1,reg)
call SaveInteger(udg_hash,GetHandleId(t),2,j)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,FROSTMOURNE)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
call SaveBoolean(udg_hash,GetHandleId(t),6,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),7,CASTER)
call TimerStart(t,0.04,true,function onTimer)
call SetUnitAnimation(CASTER,"stand")
set CASTER = null
set FROSTMOURNE = null
set reg = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
//TESH.scrollpos=131
//TESH.alwaysfold=0
globals
real HOD_HAND_RADIUS = 50.
real HOD_HAND_AOE = 150.
real HOD_HANDS_HALFANIMATION_PERIOD = 0.65
real HOD_DAMAGE_PERIOD = 1.3
integer HOD_MAX_DAMAGE_TICKS = 15
endglobals
function Hands_of_Death_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03H'
endfunction
function Hands_of_Death_GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0
endfunction
function Hands_of_Death_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real x = LoadReal(udg_hash,GetHandleId(t),2)
local real y = LoadReal(udg_hash,GetHandleId(t),3)
local boolean IsBoulderJump = LoadBoolean(udg_hash,GetHandleId(t),4)
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local real DAMAGE = 300.*I2R(GetUnitAbilityLevel(CASTER,'A01E')) + SPELLPOWER
local boolexpr GROUPFILTER = Condition(function BoulderGroupFilter)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(udg_temp_group,x,y,250.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call UnitDamageTarget(CASTER,udg_temp_unit,DAMAGE,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
if GetUnitAbilityLevel(CASTER,'A01V') > 0 then
call DOT(CASTER,udg_temp_unit,I2R(GetUnitAbilityLevel(CASTER,'A01V'))*75.+SPELLPOWER*0.1,3.,1.,1,"Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl","chest",true)
endif
endloop
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
function Hand_of_Death_Damage_OverTime takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hand1 = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit hand2 = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit hand3 = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local unit hand4 = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local unit crystal = LoadUnitHandle(udg_hash,GetHandleId(t),5)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),6)
local integer ticknumber = LoadInteger(udg_hash,GetHandleId(t),7)
set ticknumber = ticknumber + 1
call SaveInteger(udg_hash,GetHandleId(t),7,ticknumber)
if ticknumber >= HOD_MAX_DAMAGE_TICKS then
call DestroyTimer(t)
endif
set t = null
set crystal = null
set CASTER = null
set hand1 = null
set hand2 = null
set hand3 = null
set hand4 = null
endfunction
function Hands_of_Death_EndTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hand1 = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit hand2 = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit hand3 = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local unit hand4 = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local unit crystal = LoadUnitHandle(udg_hash,GetHandleId(t),5)
call RemoveUnit(hand1)
call RemoveUnit(hand2)
call RemoveUnit(hand3)
call RemoveUnit(hand4)
call RemoveUnit(crystal)
call DestroyTimer(t)
set t = null
set hand1 = null
set hand2 = null
set hand3 = null
set hand4 = null
set crystal = null
endfunction
function Hand_of_Death_TimerMovement takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hand1 = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit hand2 = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit hand3 = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local unit hand4 = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local unit crystal = LoadUnitHandle(udg_hash,GetHandleId(t),5)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),6)
local boolean tick = LoadBoolean(udg_hash,GetHandleId(t),7)
local integer ticknumber = LoadInteger(udg_hash,GetHandleId(t),8)
local unit u1 = null
local unit u2 = null
local unit u3 = null
local unit u4 = null
local timer q = null
if tick then
call SetUnitTimeScale(hand1,-1.)
call SetUnitTimeScale(hand2,-1.)
call SetUnitTimeScale(hand3,-1.)
call SetUnitTimeScale(hand4,-1.)
set u1 = CreateUnit(GetOwningPlayer(CASTER),'h01I',GetUnitX(crystal)+HOD_HAND_AOE,GetUnitY(crystal),GetUnitFacing(hand1))
set u2 = CreateUnit(GetOwningPlayer(CASTER),'h01I',GetUnitX(crystal),GetUnitY(crystal)+HOD_HAND_AOE,GetUnitFacing(hand2))
set u3 = CreateUnit(GetOwningPlayer(CASTER),'h01I',GetUnitX(crystal)-HOD_HAND_AOE,GetUnitY(crystal),GetUnitFacing(hand3))
set u4 = CreateUnit(GetOwningPlayer(CASTER),'h01I',GetUnitX(crystal),GetUnitY(crystal)-HOD_HAND_AOE,GetUnitFacing(hand4))
call UnitApplyTimedLife(u1,'BHwe',1.7)
call UnitApplyTimedLife(u2,'BHwe',1.7)
call UnitApplyTimedLife(u3,'BHwe',1.7)
call UnitApplyTimedLife(u4,'BHwe',1.7)
call SetUnitTimeScale(u1,1.80)
call SetUnitTimeScale(u2,1.80)
call SetUnitTimeScale(u3,1.80)
call SetUnitTimeScale(u4,1.80)
set tick = false
else
call SetUnitTimeScale(hand1,1.)
call SetUnitTimeScale(hand2,1.)
call SetUnitTimeScale(hand3,1.)
call SetUnitTimeScale(hand4,1.)
set tick = true
endif
set ticknumber = ticknumber + 1
call SaveBoolean(udg_hash,GetHandleId(t),7,tick)
call SaveInteger(udg_hash,GetHandleId(t),8,ticknumber)
if ticknumber>2*HOD_MAX_DAMAGE_TICKS then
call DestroyTimer(t)
set q = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(q),1,hand1)
call SaveUnitHandle(udg_hash,GetHandleId(q),2,hand2)
call SaveUnitHandle(udg_hash,GetHandleId(q),3,hand3)
call SaveUnitHandle(udg_hash,GetHandleId(q),4,hand4)
call SaveUnitHandle(udg_hash,GetHandleId(q),5,crystal)
call TimerStart(q,2.,false,function Hands_of_Death_EndTimer)
call SetUnitTimeScale(hand1,0.8)
call SetUnitTimeScale(hand2,0.8)
call SetUnitTimeScale(hand3,0.8)
call SetUnitTimeScale(hand4,0.8)
call SetUnitTimeScale(crystal,1.)
call RemoveUnit(u1)
call RemoveUnit(u2)
call RemoveUnit(u3)
call RemoveUnit(u4)
set q = null
endif
set t = null
set u1 = null
set u2 = null
set u3 = null
set u4 = null
set hand1 = null
set hand2 = null
set hand3 = null
set hand4 = null
set crystal = null
endfunction
function Hands_Timer_Expires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hand1 = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit hand2 = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit hand3 = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local unit hand4 = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local unit crystal = LoadUnitHandle(udg_hash,GetHandleId(t),5)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),6)
local timer q = null
local timer r = null
call SetUnitTimeScale(hand1,0.)
call SetUnitTimeScale(hand2,0.)
call SetUnitTimeScale(hand3,0.)
call SetUnitTimeScale(hand4,0.)
call SetUnitTimeScale(crystal,0.)
call DestroyTimer(t)
set q = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(q),1,hand1)
call SaveUnitHandle(udg_hash,GetHandleId(q),2,hand2)
call SaveUnitHandle(udg_hash,GetHandleId(q),3,hand3)
call SaveUnitHandle(udg_hash,GetHandleId(q),4,hand4)
call SaveUnitHandle(udg_hash,GetHandleId(q),5,crystal)
call SaveUnitHandle(udg_hash,GetHandleId(q),6,CASTER)
call SaveBoolean(udg_hash,GetHandleId(q),7,true)
call SaveInteger(udg_hash,GetHandleId(q),8,0)
call TimerStart(q,HOD_HANDS_HALFANIMATION_PERIOD,true,function Hand_of_Death_TimerMovement)
set r = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(r),1,hand1)
call SaveUnitHandle(udg_hash,GetHandleId(r),2,hand2)
call SaveUnitHandle(udg_hash,GetHandleId(r),3,hand3)
call SaveUnitHandle(udg_hash,GetHandleId(r),4,hand4)
call SaveUnitHandle(udg_hash,GetHandleId(r),5,crystal)
call SaveUnitHandle(udg_hash,GetHandleId(r),6,CASTER)
call SaveInteger(udg_hash,GetHandleId(r),7,0)
call TimerStart(r,HOD_DAMAGE_PERIOD,true,function Hand_of_Death_Damage_OverTime)
set t = null
set r = null
set q = null
set hand1 = null
set hand2 = null
set hand3 = null
set hand4 = null
set crystal = null
set CASTER = null
endfunction
function Hands_Reverse_Animation_Timer_Expires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hand1 = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit hand2 = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit hand3 = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local unit hand4 = LoadUnitHandle(udg_hash,GetHandleId(t),4)
call UnitRemoveAbility(hand1,'Aloc')
call UnitRemoveAbility(hand2,'Aloc')
call UnitRemoveAbility(hand3,'Aloc')
call UnitRemoveAbility(hand4,'Aloc')
call ShowUnit(hand1,true)
call ShowUnit(hand2,true)
call ShowUnit(hand3,true)
call ShowUnit(hand4,true)
call UnitAddAbility(hand1,'Aloc')
call UnitAddAbility(hand2,'Aloc')
call UnitAddAbility(hand3,'Aloc')
call UnitAddAbility(hand4,'Aloc')
call SetUnitTimeScale(hand1,-0.10)
call SetUnitTimeScale(hand2,-0.10)
call SetUnitTimeScale(hand3,-0.10)
call SetUnitTimeScale(hand4,-0.10)
call DestroyTimer(t)
set t = null
set hand1 = null
set hand2 = null
set hand3 = null
set hand4 = null
endfunction
function Hands_of_Death_Actions takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer i = 0
local integer HandsUnit = 'h01D'
local integer CrystalUnit = 'h01H'
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit crystal = CreateUnit(GetOwningPlayer(CASTER),CrystalUnit,x,y,0.)
local unit hand1 = CreateUnit(GetOwningPlayer(CASTER),HandsUnit,x+HOD_HAND_RADIUS,y,0.)
local unit hand2 = CreateUnit(GetOwningPlayer(CASTER),HandsUnit,x,y+HOD_HAND_RADIUS,90.)
local unit hand3 = CreateUnit(GetOwningPlayer(CASTER),HandsUnit,x-HOD_HAND_RADIUS,y,180.)
local unit hand4 = CreateUnit(GetOwningPlayer(CASTER),HandsUnit,x,y-HOD_HAND_RADIUS,270.)
local timer t = null
local timer q = null
call SetUnitTimeScale(crystal,0.5)
call SetUnitTimeScale(hand1, 100.)
call SetUnitTimeScale(hand2, 100.)
call SetUnitTimeScale(hand3, 100.)
call SetUnitTimeScale(hand4, 100.)
call ShowUnit(hand1,false)
call ShowUnit(hand2,false)
call ShowUnit(hand3,false)
call ShowUnit(hand4,false)
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,hand1)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,hand2)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,hand3)
call SaveUnitHandle(udg_hash,GetHandleId(t),4,hand4)
call TimerStart(t,0.1,false,function Hands_Reverse_Animation_Timer_Expires)
set q = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(q),1,hand1)
call SaveUnitHandle(udg_hash,GetHandleId(q),2,hand2)
call SaveUnitHandle(udg_hash,GetHandleId(q),3,hand3)
call SaveUnitHandle(udg_hash,GetHandleId(q),4,hand4)
call SaveUnitHandle(udg_hash,GetHandleId(q),5,crystal)
call SaveUnitHandle(udg_hash,GetHandleId(q),6,CASTER)
call TimerStart(q,3.,false,function Hands_Timer_Expires)
set q = null
set t = null
set hand1 = null
set hand2 = null
set hand3 = null
set hand4 = null
set crystal = null
set CASTER = null
endfunction
//===========================================================================
function InitTrig_Hands_of_Death takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Hands_of_Death_Conditions ))
call TriggerAddAction(t, function Hands_of_Death_Actions)
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope DeathCoil initializer onInit
globals
private constant integer abil = 'A03F'
endglobals
private struct Coil
static Coil array st
static timer t = CreateTimer()
static integer index = 0
static integer j = 0
static real a = 0.
unit dummy = null
unit caster = null
trigger trg = null
static method Group takes nothing returns boolean
if not IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(.st[.j].caster)) then
set .a = .a + GetUnitState(GetFilterUnit(),UNIT_STATE_MAX_LIFE)*0.01
call TriggerRegisterUnitEvent(.st[.j].trg,GetFilterUnit(),EVENT_UNIT_DEATH)
set IHP_ABI = 'A03G'
set IHP_BUFFER = 'B00Z'
call AddHeroParameter(GetFilterUnit(),-0.05*GetUnitAbilityLevel(.st[.j].caster,abil),8,22,"Abilities\\Spells\\Undead\\PlagueCloud\\PlagueCloudCaster.mdl","head")
endif
return false
endmethod
static method trgDestroy takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = LoadInteger(udg_hash,GetHandleId(t),1)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call FlushChildHashtable(udg_hash,GetHandleId(.st[i].trg))
call TriggerClearActions(.st[i].trg)
call DestroyTrigger(.st[i].trg)
call DestroyTimer(t)
call .st[i].destroy()
set .index = .index - 1
set .st[i] = .st[.index]
if .index == 0 then
call PauseTimer(.t)
endif
set t = null
endmethod
static method onTrigger takes nothing returns nothing
local integer i = LoadInteger(udg_hash,GetHandleId(GetTriggeringTrigger()),1)
set .a = GetUnitState(.st[i].caster,UNIT_STATE_MAX_LIFE)*0.01*GetUnitAbilityLevel(.st[i].caster,abil)
set .a = .a*(1.+LoadReal(udg_hash,GetHandleId(.st[i].caster),9)+LoadReal(udg_hash,GetHandleId(.st[i].caster),11))
call UnitDamageTarget(.st[i].caster,.st[i].caster,.a,false,false,ATTACK_TYPE_NORMAL,null,null)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl",.st[i].caster,"origin"))
endmethod
static method onTimer takes nothing returns nothing
local integer i = 0
local timer t = null
loop
exitwhen i >= .index
if IsUnitType(.st[i].dummy,UNIT_TYPE_DEAD) then
set .j = i
set .st[i].trg = CreateTrigger()
call TriggerAddAction(.st[i].trg,function Coil.onTrigger)
set t = CreateTimer()
call SaveInteger(udg_hash,GetHandleId(t),1,i)
call SaveInteger(udg_hash,GetHandleId(.st[i].trg),1,i)
call TimerStart(t,8.,false,function Coil.trgDestroy)
set .a = 0.
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(.st[i].dummy),GetUnitY(.st[i].dummy),200.,Filter(function Coil.Group))
set .a = .a*(1.+LoadReal(udg_hash,GetHandleId(.st[i].caster),9)+LoadReal(udg_hash,GetHandleId(.st[i].caster),11))
call UnitDamageTarget(.st[i].caster,.st[i].caster,.a,false,false,ATTACK_TYPE_NORMAL,null,null)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl",.st[i].caster,"origin"))
set .st[i].dummy = null
endif
set i = i + 1
endloop
endmethod
static method onCast takes nothing returns boolean
local real angle = 0.
local real dist = 0.
if GetSpellAbilityId() == abil then
set .st[.index] = Coil.create()
set .st[.index].caster = GetTriggerUnit()
set .st[.index].dummy = CreateUnit(GetOwningPlayer(GetTriggerUnit()),'h01E',GetUnitX(.st[.index].caster),GetUnitY(.st[.index].caster),0.)
set angle = Atan2(GetSpellTargetY()-GetUnitY(.st[.index].caster),GetSpellTargetX()-GetUnitX(.st[.index].caster))*bj_RADTODEG
set dist = SquareRoot( (GetSpellTargetX()-GetUnitX(.st[.index].caster))*(GetSpellTargetX()-GetUnitX(.st[.index].caster))+(GetSpellTargetY()-GetUnitY(.st[.index].caster))*(GetSpellTargetY()-GetUnitY(.st[.index].caster)) )
call SetUnitFacing(.st[.index].dummy,angle)
call UnitApplyTimedLife(.st[.index].dummy,'BHwe',dist/700.)
call ParKnock(.st[.index].dummy,0,dist,dist/700.,angle,false,"")
if .index == 0 then
call TimerStart(.t,0.04,true,function Coil.onTimer)
endif
set .index = .index + 1
endif
return false
endmethod
endstruct
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Coil.onCast))
set t = null
endfunction
endscope
//TESH.scrollpos=66
//TESH.alwaysfold=0
scope BoneBarrier initializer onInit
globals
private constant integer abil = 'A03D'
endglobals
private struct Bone
static Bone array st
static timer t = CreateTimer()
static integer index = 0
static integer j = 0
group AFFECTED = null
real TIMER = 0.
unit CASTER = null
unit DUMMY = null
real DAMAGE = 0.
static method Group takes nothing returns boolean
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(.st[.j].CASTER)) and not IsUnitInGroup(GetFilterUnit(),.st[.j].AFFECTED) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) then
call GroupAddUnit(.st[.j].AFFECTED,GetFilterUnit())
call DOT(.st[.j].CASTER,GetFilterUnit(),.st[.j].DAMAGE,3.,1.,4,"Abilities\\Spells\\Human\\Banish\\BanishTarget.mdl","chest",true)
endif
return false
endmethod
static method Back takes nothing returns nothing
local real x = GetUnitX(GetEnumUnit())
local real y = GetUnitY(GetEnumUnit())
local real x1 = GetUnitX(.st[.j].DUMMY)
local real y1 = GetUnitY(.st[.j].DUMMY)
local real dist = SquareRoot((x-x1)*(x-x1)+(y-y1)*(y-y1))
local real angle = 0.
if dist > 150. then
set angle = Atan2(y1-y,x1-x)
call SetUnitX(GetEnumUnit(),x + (dist - 175.)*Cos(angle))
call SetUnitY(GetEnumUnit(),y + (dist - 175.)*Sin(angle))
endif
endmethod
static method onTimer takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= .index
set .j = i
set .st[i].TIMER = .st[i].TIMER + 0.04
if .st[i].TIMER >= 3. then
set .st[i].TIMER = -10.
call SetUnitAnimation(.st[i].DUMMY,"stand")
endif
if .st[i].TIMER >= -4. and .st[i].TIMER <= 0. then
call SetUnitAnimation(.st[i].DUMMY,"death")
set .st[i].TIMER = -10.
endif
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(.st[i].DUMMY),GetUnitY(.st[i].DUMMY),150.,Filter(function Bone.Group))
call ForGroup(.st[i].AFFECTED,function Bone.Back)
if IsUnitType(.st[i].DUMMY,UNIT_TYPE_DEAD) or GetWidgetLife(.st[i].DUMMY) <= 0 then
call RemoveUnit(.st[i].DUMMY)
call DestroyGroup(.st[i].AFFECTED)
call .st[i].destroy()
set .index = .index - 1
set .st[i] = .st[.index]
if .index == 0 then
call PauseTimer(.t)
endif
set i = i - 1
endif
set i = i + 1
endloop
endmethod
static method onCast takes nothing returns boolean
if GetSpellAbilityId() == abil then
set .st[.index] = Bone.create()
set .st[.index].AFFECTED = CreateGroup()
set .st[.index].CASTER = GetTriggerUnit()
set .st[.index].DAMAGE = 50.*GetUnitAbilityLevel(.st[.index].CASTER,abil) + LoadReal(udg_hash,GetHandleId(.st[.index].CASTER),5)/3.
set .st[.index].DUMMY = CreateUnit(GetOwningPlayer(.st[.index].CASTER),'h01K',GetUnitX(.st[.index].CASTER),GetUnitY(.st[.index].CASTER),0.)
set .st[.index].TIMER = 0.
call SetUnitAnimation(.st[.index].DUMMY,"stand")
call UnitApplyTimedLife(.st[.index].DUMMY,'BHwe',10.)
if .index == 0 then
call TimerStart(.t,0.04,true,function Bone.onTimer)
endif
set .index = .index + 1
endif
return false
endmethod
endstruct
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Bone.onCast))
set t = null
endfunction
endscope
library RangerTalents initializer onInit
globals
constant integer RANGER_CODE = 'H00O'
private constant integer MAX_TALENTS = 10
private constant integer SMELL_OF_BLOOD_CODE = 'A041'
private constant integer ACID_BITE_CODE = 'A04F'
private constant integer KILLER_INSTINCT_CODE = 'A04G'
private constant integer TRAP_MASTERY_CODE = 'A04H'
private constant integer TOXIC_ARROWS_CODE = 'A08P'
private constant integer IMPROVED_CHIMAERA_CODE = 'A08S'
private constant integer KNOW_YOUR_ENEMY_CODE = 'A08T'
private constant integer CHAKRAM_TRAP_ABILCODE = 'A046'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer ACID_BITE_LEVEL_HASH = 250
constant real ACID_BITE_AOE_BONUS = 50.
constant real ACID_BITE_DAMAGE_INC = 0.15
constant integer TRAP_MASTERY_LEVEL_HASH = 251
constant integer TRAP_MASTERY_COOLDOWN_LOWERING = 1
constant real TRAP_MASTERY_DAMAGE = 75.
constant integer SMELL_OF_BLOOD_LEVEL_HASH = 252
constant real SMELL_OF_BLOOD_DAMAGE_INC = 0.20
constant integer KILLER_INSTINCT_LEVEL_HASH = 253
constant integer KILLER_INSTINCT_CRIT_BONUS = 5
constant real KILLER_INSTINCT_HP_THRESHOLD = 0.35
constant integer TOXIC_ARROWS_LEVEL_HASH = 254
constant real TOXIC_ARROWS_SPELL_POWER_DAMAGE_LEVEL = 0.1
constant real TOXIC_ARROWS_DURATION_BASE = 2.
constant real TOXIC_ARROWS_DURATION_LEVEL = 1.5
constant real TOXIC_ARROWS_HASTE_TO_AS_LEVEL = 0.25
constant integer IMPROVED_CHIMAERA_LEVEL_HASH = 255
constant real IMPROVED_CHIMAERA_SPEED_LEVEL = 0.15
constant real IMPROVED_CHIMAERA_DAMAGE_LEVEL = 0.15
constant integer KNOW_YOUR_ENEMY_LEVEL_HASH = 256
constant real KNOW_YOUR_ENEMY_CONC_LEVEL = 0.1
constant real KNOW_YOUR_ENEMY_SPELL_CRIT_LEVEL = 3.
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == RANGER_CODE
endfunction
private function GetAcidBiteDescriptionByLevel takes integer lvl returns string
return "Increases AOE of Cobra Shot by |c008080C0" + I2S(R2I(ACID_BITE_AOE_BONUS*lvl)) + "|r and its periodic damage by |c008080C0" + I2S(R2I(ACID_BITE_DAMAGE_INC*100*lvl)) + "%|r."
endfunction
private function GetTrapMasteryDescriptionByLevel takes integer lvl returns string
return "Lowers the cooldown of Chakram Trap by |c008080C0" + I2S(TRAP_MASTERY_COOLDOWN_LOWERING*lvl) + "|r second and make it deal |c008080C0" + I2S(R2I(TRAP_MASTERY_DAMAGE*lvl)) + "|r magical damage each 2 seconds to catched enemies in 150 AOE."
endfunction
private function GetSmellOfBloodDescriptionByLevel takes integer lvl returns string
return "Increases the wolf damage for targets with a bleeding effect by |c008080C0" + I2S(R2I(SMELL_OF_BLOOD_DAMAGE_INC*100*lvl)) + "%|r."
endfunction
private function GetKillerInstinctDescriptionByLevel takes integer lvl returns string
return "Increases the critical strike chance of the hero and his wolf by |c008080C0" + I2S(R2I(KILLER_INSTINCT_CRIT_BONUS*lvl)) + "%|r if they attack the target with health below " + I2S(R2I(KILLER_INSTINCT_HP_THRESHOLD*100)) + "%."
endfunction
private function GetToxicArrowsDescriptionByLevel takes integer lvl returns string
return "When Cobra Shot reaches its target, the Ranger temporarily gets an ability to shot multiple targets, dealing magical damage. Improves attack speed by |c008080C0" + I2S(R2I(TOXIC_ARROWS_HASTE_TO_AS_LEVEL*lvl*100)) + "%|r of Haste. Lasts for |c008080C0" + I2S(R2I(TOXIC_ARROWS_DURATION_BASE+TOXIC_ARROWS_DURATION_LEVEL*lvl)) + "|r seconds. Passively increases Attack Power by |c008080C0" + I2S(R2I(TOXIC_ARROWS_SPELL_POWER_DAMAGE_LEVEL*lvl*100)) + "%|r of Spell Power under Concentration."
endfunction
private function GetImprovedChimaeraDescriptionByLevel takes integer lvl returns string
return "Improves the cast speed of Chimaera Shot by |c008080C0" + I2S(R2I(IMPROVED_CHIMAERA_SPEED_LEVEL*lvl*100)) + "%|r and its damage by |c008080C0"+ I2S(R2I(IMPROVED_CHIMAERA_DAMAGE_LEVEL*lvl*100)) + "%|r."
endfunction
private function GetKnowYourEnemyDescriptionByLevel takes integer lvl returns string
return "Improves Focus regeneration by |c008080C0" + I2S(R2I(KNOW_YOUR_ENEMY_CONC_LEVEL*lvl*100)) + "%|r and Spell Crit by |c008080C0"+ I2S(R2I(KNOW_YOUR_ENEMY_SPELL_CRIT_LEVEL*lvl)) + "%|r under Concentration."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),ACID_BITE_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(ACID_BITE_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetAcidBiteDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(ACID_BITE_CODE, GetAcidBiteDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetAcidBiteDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(ACID_BITE_CODE, GetAcidBiteDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),TRAP_MASTERY_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(TRAP_MASTERY_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetTrapMasteryDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(TRAP_MASTERY_CODE, GetTrapMasteryDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetTrapMasteryDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(TRAP_MASTERY_CODE, GetTrapMasteryDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),SMELL_OF_BLOOD_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(SMELL_OF_BLOOD_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetSmellOfBloodDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(SMELL_OF_BLOOD_CODE, GetSmellOfBloodDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetSmellOfBloodDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(SMELL_OF_BLOOD_CODE, GetSmellOfBloodDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),KILLER_INSTINCT_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(KILLER_INSTINCT_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetKillerInstinctDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(KILLER_INSTINCT_CODE, GetKillerInstinctDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetKillerInstinctDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(KILLER_INSTINCT_CODE, GetKillerInstinctDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),TOXIC_ARROWS_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(TOXIC_ARROWS_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetToxicArrowsDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(TOXIC_ARROWS_CODE, GetToxicArrowsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetToxicArrowsDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(TOXIC_ARROWS_CODE, GetToxicArrowsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),IMPROVED_CHIMAERA_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(IMPROVED_CHIMAERA_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetImprovedChimaeraDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(IMPROVED_CHIMAERA_CODE, GetImprovedChimaeraDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetImprovedChimaeraDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(IMPROVED_CHIMAERA_CODE, GetImprovedChimaeraDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),KNOW_YOUR_ENEMY_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(KNOW_YOUR_ENEMY_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetKnowYourEnemyDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(KNOW_YOUR_ENEMY_CODE, GetKnowYourEnemyDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetKnowYourEnemyDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(KNOW_YOUR_ENEMY_CODE, GetKnowYourEnemyDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == SMELL_OF_BLOOD_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"SMELL OF BLOOD CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),SMELL_OF_BLOOD_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),SMELL_OF_BLOOD_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),SMELL_OF_BLOOD_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SMELL_OF_BLOOD_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == ACID_BITE_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"ACID BITE CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),ACID_BITE_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),ACID_BITE_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),ACID_BITE_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),ACID_BITE_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == KILLER_INSTINCT_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"KILLER INSTINCT CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),KILLER_INSTINCT_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),KILLER_INSTINCT_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),KILLER_INSTINCT_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),KILLER_INSTINCT_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == TOXIC_ARROWS_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"TOXIC_ARROWS CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),TOXIC_ARROWS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),TOXIC_ARROWS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),TOXIC_ARROWS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),TOXIC_ARROWS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == IMPROVED_CHIMAERA_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"IMPROVED_CHIMAERA CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_CHIMAERA_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),IMPROVED_CHIMAERA_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_CHIMAERA_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_CHIMAERA_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == KNOW_YOUR_ENEMY_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"KNOW_YOUR_ENEMY CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),KNOW_YOUR_ENEMY_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),KNOW_YOUR_ENEMY_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),KNOW_YOUR_ENEMY_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),KNOW_YOUR_ENEMY_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == TRAP_MASTERY_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"TRAP MASTERY CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and (GetUnitAbilityLevel(CASTER,CHAKRAM_TRAP_ABILCODE)>0) and (LoadInteger(udg_hash,GetHandleId(CASTER),TRAP_MASTERY_LEVEL_HASH) < MAX_TALENTS) then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),TRAP_MASTERY_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),TRAP_MASTERY_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
set j = 0
loop
exitwhen j>7
call BlzSetUnitAbilityCooldown(CASTER,CHAKRAM_TRAP_ABILCODE,j,BlzGetUnitAbilityCooldown(CASTER,CHAKRAM_TRAP_ABILCODE,j)-TRAP_MASTERY_COOLDOWN_LOWERING)
set j = j + 1
endloop
else
if LoadInteger(udg_hash,GetHandleId(CASTER),TRAP_MASTERY_LEVEL_HASH) < MAX_TALENTS then
if GetUnitAbilityLevel(CASTER,CHAKRAM_TRAP_ABILCODE)>0 then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"You have to learn Chakram Trap first")
endif
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function RangerUnlearnTalents takes unit hero returns nothing
local integer j = 0
local integer ACID_BITE_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),ACID_BITE_LEVEL_HASH)
local integer SMELL_OF_BLOOD_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),SMELL_OF_BLOOD_LEVEL_HASH)
local integer KILLER_INSTINCT_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),KILLER_INSTINCT_LEVEL_HASH)
local integer TRAP_MASTERY_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),TRAP_MASTERY_LEVEL_HASH)
local integer TOXIC_ARROWS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),TOXIC_ARROWS_LEVEL_HASH)
local integer IMPROVED_CHIMAERA_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),IMPROVED_CHIMAERA_LEVEL_HASH)
local integer KNOW_YOUR_ENEMY_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),KNOW_YOUR_ENEMY_LEVEL_HASH)
local integer sum = ACID_BITE_LEVEL+SMELL_OF_BLOOD_LEVEL+KILLER_INSTINCT_LEVEL+TRAP_MASTERY_LEVEL+TOXIC_ARROWS_LEVEL+IMPROVED_CHIMAERA_LEVEL+KNOW_YOUR_ENEMY_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),ACID_BITE_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),SMELL_OF_BLOOD_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),KILLER_INSTINCT_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),TRAP_MASTERY_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),TOXIC_ARROWS_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),IMPROVED_CHIMAERA_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),KNOW_YOUR_ENEMY_LEVEL_HASH,0)
if GetUnitAbilityLevel(hero,CHAKRAM_TRAP_ABILCODE)>0 then
set j = 0
loop
exitwhen j>7
call BlzSetUnitAbilityCooldown(hero,CHAKRAM_TRAP_ABILCODE,j,BlzGetAbilityCooldown(CHAKRAM_TRAP_ABILCODE,j))
set j = j + 1
endloop
endif
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope RangerConcentration initializer onInit
globals
timer RANGER_CONCENTRATION_TIMER = CreateTimer()
private constant real TIMER_PERIOD = 0.04
private constant real DIST_THRESHOLD = 5.
private constant real BASE_SPIRIT_REGEN = 0.03
private constant real CONCENTRATION_START_TIME = 3.
private constant real CONCENTRATION_FOCUS_RESTORE_PERIOD = 1.
private constant integer ABIL_BUFF = 'A08U'
private constant integer BUFF = 'B02M'
private constant integer KNOW_YOUR_ENEMY_ABIL_BUFF = 'A08V'
private constant integer KNOW_YOUR_ENEMY_BUFF = 'B02N'
endglobals
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real lastX = LoadReal(udg_hash,GetHandleId(t),2)
local real lastY = LoadReal(udg_hash,GetHandleId(t),3)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real dist = SquareRoot((lastX-x)*(lastX-x)+(lastY-y)*(lastY-y))
local real DURATION = LoadReal(udg_hash,GetHandleId(t),4)
local real SPREAD_ELAPSED = LoadReal(udg_hash,GetHandleId(t),5)
local real LAST_CRIT = LoadReal(udg_hash,GetHandleId(t),6)
local integer KNOW_YOUR_ENEMY_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),KNOW_YOUR_ENEMY_LEVEL_HASH)
local real FocusValue = (GetHeroInt(CASTER,true)*BASE_SPIRIT_REGEN)*(1.+KNOW_YOUR_ENEMY_LEVEL*KNOW_YOUR_ENEMY_CONC_LEVEL)
local real SpellCrit = KNOW_YOUR_ENEMY_LEVEL*KNOW_YOUR_ENEMY_SPELL_CRIT_LEVEL
local integer TOXIC_ARROWS_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),TOXIC_ARROWS_LEVEL_HASH)
local integer LAST_DAMAGE = LoadInteger(udg_hash,GetHandleId(t),7)
local integer new_DMG = R2I(LoadReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash())*TOXIC_ARROWS_SPELL_POWER_DAMAGE_LEVEL*TOXIC_ARROWS_LEVEL)
call SaveReal(udg_hash,GetHandleId(t),2,x)
call SaveReal(udg_hash,GetHandleId(t),3,y)
if (dist > DIST_THRESHOLD) or (IsUnitDeadBX(CASTER)) then
set DURATION = 0.
set SPREAD_ELAPSED = 0.
call UnitRemoveAbility(CASTER,ABIL_BUFF)
call UnitRemoveAbility(CASTER,BUFF)
call UnitRemoveAbility(CASTER,KNOW_YOUR_ENEMY_ABIL_BUFF)
call UnitRemoveAbility(CASTER,KNOW_YOUR_ENEMY_BUFF)
else
set DURATION = DURATION + 0.04
if DURATION >= CONCENTRATION_START_TIME then
set SPREAD_ELAPSED = SPREAD_ELAPSED + 0.04
if not (GetUnitAbilityLevel(CASTER,BUFF)>0.) then
call UnitAddAbility(CASTER,ABIL_BUFF)
call UnitAddAbility(CASTER,BUFF)
endif
if not (GetUnitAbilityLevel(CASTER,KNOW_YOUR_ENEMY_BUFF)>0.) then
call UnitAddAbility(CASTER,KNOW_YOUR_ENEMY_ABIL_BUFF)
call UnitAddAbility(CASTER,KNOW_YOUR_ENEMY_BUFF)
endif
endif
endif
if (KNOW_YOUR_ENEMY_LEVEL <= 0) and (GetUnitAbilityLevel(CASTER,KNOW_YOUR_ENEMY_BUFF)>0.) then
call UnitRemoveAbility(CASTER,KNOW_YOUR_ENEMY_ABIL_BUFF)
call UnitRemoveAbility(CASTER,KNOW_YOUR_ENEMY_BUFF)
endif
if SPREAD_ELAPSED >= CONCENTRATION_FOCUS_RESTORE_PERIOD then
set SPREAD_ELAPSED = 0.
call RegenerateFocus(CASTER,FocusValue)
endif
call SaveReal(udg_hash,GetHandleId(t),4,DURATION)
call SaveReal(udg_hash,GetHandleId(t),5,SPREAD_ELAPSED)
if DURATION < CONCENTRATION_START_TIME then
set new_DMG = 0
set SpellCrit = 0.
endif
if ((LAST_CRIT-SpellCrit) > 0) or ( (SpellCrit-LAST_CRIT) > 0 ) then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellCritHash(), LoadReal(udg_hash,GetHandleId(CASTER),GetSpellCritHash()) - LAST_CRIT)
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellCritHash(), LoadReal(udg_hash,GetHandleId(CASTER),GetSpellCritHash()) + SpellCrit)
call SaveReal(udg_hash,GetHandleId(t),6,SpellCrit)
endif
if not (LAST_DAMAGE == new_DMG) then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)-LAST_DAMAGE,0)
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)+new_DMG,0)
call SaveInteger(udg_hash,GetHandleId(t),7,new_DMG)
endif
if CASTER == null then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CONC TIMER REMOVED")
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
endfunction
private function onConcentrationTimer takes nothing returns nothing
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(RANGER_CONCENTRATION_TIMER),1)
local timer t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,GetUnitX(CASTER))
call SaveReal(udg_hash,GetHandleId(t),3,GetUnitY(CASTER))
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
call TimerStart(t,TIMER_PERIOD,true,function onTimer)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,RANGER_CONCENTRATION_TIMER)
call TriggerAddAction(t,function onConcentrationTimer)
set t = null
endfunction
endscope
library SummonWolf initializer onInit requires OutOfCombat,HashtableUtils
globals
private constant integer ABILCODE = 'A040'
private constant integer RETURNCODE = 'A049'
private constant integer WOLFCODE = 'o00B'
constant integer SUMMON_WOLF_WOLFCASTERHASH = 201
constant integer SUMMON_WOLF_COMBATHASH = 202
private constant integer WOLFTIMERHASH = 203
constant integer SUMMON_WOLF_WOLFTARGETHASH = 204
constant integer SUMMON_WOLF_LASTRANGERTARGETHASH = 205
private trigger WOLFDEATHTRIG = CreateTrigger()
private constant real TELEPORTDIST = 300.
private constant real RETURNDISTCOMBAT = 1500.
private constant real RETURNDISTANCEIMMEDIATE = 2000.
private constant real RETURNDISTNONCOMBAT = 600.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function DeathConds takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == WOLFCODE
endfunction
private function ReturnConds takes nothing returns boolean
return GetSpellAbilityId() == RETURNCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function WolfClearTargets takes unit WOLF returns nothing
call SaveUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFTARGETHASH,null)
call SaveUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_LASTRANGERTARGETHASH,null)
endfunction
private function ReturnonCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit WOLF = LoadUnitHandle(udg_hash,GetHandleId(CASTER),SUMMON_WOLF_WOLFCASTERHASH)
local real xw = GetUnitX(WOLF)
local real yw = GetUnitY(WOLF)
local real xc = GetUnitX(CASTER)
local real yc = GetUnitY(CASTER)
local real dist = SquareRoot( (xw-xc)*(xw-xc)+(yw-yc)*(yw-yc))
if not (GetUnitAbilityLevel(WOLF,KILLCOMMAND_WOLFABILCODE)>0) then
if dist < TELEPORTDIST then
call IssuePointOrder(WOLF,"move",GetUnitX(CASTER),GetUnitY(CASTER)+75.)
else
call SetUnitX(WOLF,GetUnitX(CASTER))
call SetUnitY(WOLF,GetUnitY(CASTER)+75.)
call DestroyEffect( AddSpecialEffectTarget("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",WOLF, "chest") )
endif
endif
set CASTER = null
set WOLF = null
endfunction
private function DeathActs takes nothing returns nothing
local unit WOLF = GetTriggerUnit()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFCASTERHASH)
local timer t = LoadTimerHandle(udg_hash,GetHandleId(WOLF),WOLFTIMERHASH)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Wolf Dead")
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),ABILCODE,true)
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),RETURNCODE,false)
call FlushChildHashtable(udg_hash,GetHandleId(WOLF))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set WOLF = null
set CASTER = null
set t = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit WOLF = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFCASTERHASH)
local unit CURTARGET = LoadUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFTARGETHASH)
local unit RANGERTARGET = LoadUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_LASTRANGERTARGETHASH)
local group g = null
local boolean ISCOMBAT = LoadBoolean(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_COMBATHASH)
local real xw = GetUnitX(WOLF)
local real yw = GetUnitY(WOLF)
local real xc = GetUnitX(CASTER)
local real yc = GetUnitY(CASTER)
local real dist = SquareRoot( (xw-xc)*(xw-xc)+(yw-yc)*(yw-yc))
local real tempdist = 0.
local real mindist = 0.
local unit tempu = null
local unit minu = null
local real angle = 0.
local integer ID_WOLF = GetHandleId(WOLF)
local integer ID_CASTER = GetHandleId(CASTER)
//ResetWolfStats
call SaveReal(udg_hash,ID_WOLF,GetCritHash(),GetUnitCritChancePercent(CASTER))
call SaveReal(udg_hash,ID_WOLF,GetSplashHash(),GetUnitSplashValue(CASTER))
call SaveReal(udg_hash,ID_WOLF,GetHasteHash(),GetUnitHastePercent(CASTER))
call SaveReal(udg_hash,ID_WOLF,GetCritMultiplierHash(),GetUnitCritMultiplier(CASTER))
call SaveReal(udg_hash,ID_WOLF,GetAttackDamageMultiplierHash(),GetUnitAttackDamageMultiplier(CASTER))
call SaveReal(udg_hash,ID_WOLF,GetHealingAttackReduceHash(),GetUnitHealingAttackReduceValue(CASTER))
call SaveInteger(udg_hash,ID_WOLF,KILLER_INSTINCT_LEVEL_HASH,LoadInteger(udg_hash,ID_CASTER,KILLER_INSTINCT_LEVEL_HASH))
call SaveInteger(udg_hash,ID_WOLF,SMELL_OF_BLOOD_LEVEL_HASH,LoadInteger(udg_hash,ID_CASTER,SMELL_OF_BLOOD_LEVEL_HASH))
call BlzSetUnitBaseDamage(WOLF,R2I(BlzGetUnitBaseDamage(CASTER,0)*0.6),0)
if dist >= RETURNDISTANCEIMMEDIATE then
set angle = GetRandomReal(0.,6.)
call SetUnitX(WOLF,GetUnitX(CASTER)+100*Cos(angle))
call SetUnitY(WOLF,GetUnitY(CASTER)+100.*Sin(angle))
call DestroyEffect( AddSpecialEffectTarget("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",WOLF, "chest") )
call WolfClearTargets(WOLF)
endif
if ISCOMBAT then
if dist >= RETURNDISTCOMBAT then
set angle = GetRandomReal(0.,6.)
call WolfClearTargets(WOLF)
call IssuePointOrder(WOLF,"move",GetUnitX(CASTER)+100*Cos(angle),GetUnitY(CASTER)+100.*Sin(angle))
else
if (not (GetUnitAbilityLevel(WOLF,KILLCOMMAND_WOLFABILCODE)>0)) or (not (GetWidgetLife(CURTARGET)>0.)) or (CURTARGET==null) then
//Changing the target for Ranger's target if it is alive
if GetWidgetLife(RANGERTARGET)>0. then
if (not (CURTARGET == RANGERTARGET)) then
call SaveUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFTARGETHASH,RANGERTARGET)
call IssueTargetOrder(WOLF,"attack",RANGERTARGET)
endif
else
// Or searching for the closest unit in 1000 AOE and attack him
set g = CreateGroup()
set udg_temp_unit = WOLF
call GroupEnumUnitsInRange(g,xw,yw,1000,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set tempdist = SquareRoot( (xw-GetUnitX(tempu))*(xw-GetUnitX(tempu)) + (yw-GetUnitY(tempu))*(yw-GetUnitY(tempu)) )
if (tempdist < mindist) or (minu == null) then
set minu = tempu
set mindist = tempdist
endif
call GroupRemoveUnit(g,tempu)
endloop
if not (minu==null) then
call SaveUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFTARGETHASH,minu)
call IssueTargetOrder(WOLF,"attack",minu)
endif
call DestroyGroup(g)
set g = null
set minu = null
endif
endif
endif
else
if dist >= RETURNDISTNONCOMBAT then
set angle = GetRandomReal(0.,6.)
call IssuePointOrder(WOLF,"move",GetUnitX(CASTER)+100*Cos(angle),GetUnitY(CASTER)+100.*Sin(angle))
endif
endif
if not (GetWidgetLife(CASTER)>0.) then
call KillUnit(WOLF)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set WOLF = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real angle = GetUnitFacing(CASTER)
local unit WOLF = CreateUnit(GetOwningPlayer(CASTER),WOLFCODE,GetUnitX(CASTER)+75*Cos(angle),GetUnitY(CASTER)+75*Sin(angle),angle)
local timer t = CreateTimer()
call UnitAddAbility(WOLF,'Aloc')
call SetUnitPathing(WOLF,false)
//call SetUnitInvulnerable(WOLF,false)
set WOLF_ACTIVE_SKIN_NUMBER = 1
call SetUnitAnimation(WOLF,"birth")
call SaveUnitHandle(udg_hash,GetHandleId(CASTER),SUMMON_WOLF_WOLFCASTERHASH,WOLF)
call SaveUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFCASTERHASH,CASTER)
call WolfClearTargets(WOLF)
call TriggerRegisterDeathEvent(WOLFDEATHTRIG,WOLF)
call SaveBoolean(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_COMBATHASH,IsUnitInCombat(CASTER))
call SaveTimerHandle(udg_hash,GetHandleId(WOLF),WOLFTIMERHASH,t)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,WOLF)
call TimerStart(t,0.1,true,function onTimer)
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),ABILCODE,false)
if not(GetUnitAbilityLevel(CASTER,RETURNCODE)>0) then
call UnitAddAbility(CASTER,RETURNCODE)
endif
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),RETURNCODE,true)
set CASTER = null
set WOLF = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
call TriggerRegisterAnyUnitEventBJ(t1, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t1, Condition( function ReturnConds ))
call TriggerAddAction(t1, function ReturnonCast)
call TriggerAddCondition(WOLFDEATHTRIG,Condition( function DeathConds ))
call TriggerAddAction(WOLFDEATHTRIG, function DeathActs)
set t = null
set t1 = null
endfunction
endlibrary
scope CobraShot initializer onInit
globals
constant integer BASE_ABILITY_MAX_LEVEL = 8
private constant integer ABILCODE = 'A044'
constant integer CHIMAERASHOT_BUFFCODE = 'B01C'
constant integer CHIMAERASHOT_VENOMCODE = 'A045'
private constant integer SLOWCODE = 'A047'
private constant integer DUMMY = 'h009'
timer CHIMAERASHOT_TIMER = CreateTimer()
//constant integer CHIMAERASHOT_VENOMCODE = 'Alcb'
private constant integer DAMAGE_DETECTOR_CODE = 'A001'
private constant real BASE_DAMAGE = 300.
private constant real BONUS_FOCUS = 8.
private constant real DURATION = 10.
private constant real DOT_DURATION = 5.
private constant real DOT_PERIOD = 1.
private constant real AOE = 250.
//For ability Tooltip
unit COBRA_SHOT_USER = null
//For Toxic Arrows talent
private constant integer TOXIC_ARROWS_SPEED_ABILCODE = 'A08W'
private constant integer TOXIC_ARROWS_MULTISHOT = 'A08Q'
private constant integer TOXIC_ARROWS_ABILBUFF = 'A08R'
private constant integer TOXIC_ARROWS_BUFFCODE = 'B02L'
private timer TOXIC_ARROWS_TIMER = null
private constant real TOXIC_ARROWS_TIMER_CHECK_PERIOD = 0.1
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerCheckToxicArrows takes nothing returns nothing
local timer t = TOXIC_ARROWS_TIMER
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real ELAPSED = LoadReal(udg_hash,GetHandleId(t),2)
local real DURATION = LoadReal(udg_hash,GetHandleId(t),3)
local integer TOXIC_ARROWS_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),TOXIC_ARROWS_LEVEL_HASH)
local integer AS_LVL = R2I(LoadReal(udg_hash,GetHandleId(CASTER),GetHasteHash())*TOXIC_ARROWS_HASTE_TO_AS_LEVEL*TOXIC_ARROWS_LEVEL)
set ELAPSED = ELAPSED + TOXIC_ARROWS_TIMER_CHECK_PERIOD
call SaveReal(udg_hash,GetHandleId(t),2,ELAPSED)
if AS_LVL > 99 then
set AS_LVL = 99
endif
call SetUnitAbilityLevel(CASTER,TOXIC_ARROWS_MULTISHOT,TOXIC_ARROWS_LEVEL)
call SetUnitAbilityLevel(CASTER,TOXIC_ARROWS_SPEED_ABILCODE,AS_LVL+1)
if ELAPSED >= DURATION then
call UnitRemoveAbility(CASTER,TOXIC_ARROWS_MULTISHOT)
call UnitRemoveAbility(CASTER,TOXIC_ARROWS_ABILBUFF)
call UnitRemoveAbility(CASTER,TOXIC_ARROWS_BUFFCODE)
call SetUnitAbilityLevel(CASTER,TOXIC_ARROWS_SPEED_ABILCODE,1)
if not (GetUnitAbilityLevel(CASTER, DAMAGE_DETECTOR_CODE)>0) then
call UnitAddAbility(CASTER,DAMAGE_DETECTOR_CODE)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set TOXIC_ARROWS_TIMER = null
endif
set CASTER = null
set t = null
endfunction
private function onChimaeraTimer takes nothing returns nothing
local timer t = CHIMAERASHOT_TIMER
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real PENETRATION = I2R(GetHeroAgi(CASTER,true))*(0.2*GetUnitAbilityLevel(CASTER,ABILCODE))
local real SPELLPOWER = LoadReal(udg_hash,GetHandleId(CASTER),5)
local integer ACID_BITE_LEVEL = 0
local real DAMAGE = (BASE_DAMAGE*GetUnitAbilityLevel(CASTER,ABILCODE)+SPELLPOWER)*DOT_PERIOD/DOT_DURATION
local group g = CreateGroup()
local unit tempu = null
local unit udummy = null
local integer TOXIC_ARROWS_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),TOXIC_ARROWS_LEVEL_HASH)
local real ARROWS_TIME = TOXIC_ARROWS_DURATION_BASE + TOXIC_ARROWS_DURATION_LEVEL * TOXIC_ARROWS_LEVEL
if HaveSavedInteger(udg_hash,GetHandleId(CASTER),ACID_BITE_LEVEL_HASH) then
set ACID_BITE_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),ACID_BITE_LEVEL_HASH)
endif
set DAMAGE = DAMAGE * (1 + ACID_BITE_DAMAGE_INC*ACID_BITE_LEVEL)
call RegenerateEnergy(CASTER,BONUS_FOCUS)
call UnitRemoveAbility(CASTER,CHIMAERASHOT_VENOMCODE)
call UnitRemoveAbility(CASTER,CHIMAERASHOT_BUFFCODE)
set udg_temp_unit = CASTER
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\AcidBomb\\BottleMissile.mdl",TARGET,"chest"))
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),AOE+ACID_BITE_AOE_BONUS*ACID_BITE_LEVEL,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
call ApplyArmorPenetration(tempu, R2I(PENETRATION * 0.2))
call DOT(CASTER,tempu,DAMAGE,DOT_DURATION,DOT_PERIOD,5,"","",false)
//set udummy = CreateUnit(GetOwningPlayer(CASTER),DUMMY,GetUnitX(TARGET),GetUnitY(TARGET),0.)
//call UnitAddAbility(udummy,SLOWCODE)
//call SetUnitAbilityLevel(udummy,SLOWCODE,GetUnitAbilityLevel(CASTER,ABILCODE))
//call IssueTargetOrder(udummy,"slow",tempu)
//call UnitApplyTimedLife(udummy,'BHwe',0.5)
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if TOXIC_ARROWS_LEVEL > 0 then
if TOXIC_ARROWS_TIMER == null then
call UnitAddAbility(CASTER,TOXIC_ARROWS_MULTISHOT)
call UnitAddAbility(CASTER,TOXIC_ARROWS_ABILBUFF)
set TOXIC_ARROWS_TIMER = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(TOXIC_ARROWS_TIMER),1,CASTER)
call SaveReal(udg_hash,GetHandleId(TOXIC_ARROWS_TIMER),2,0.)
call SaveReal(udg_hash,GetHandleId(TOXIC_ARROWS_TIMER),3,ARROWS_TIME)
call TimerStart(TOXIC_ARROWS_TIMER, TOXIC_ARROWS_TIMER_CHECK_PERIOD, true, function onTimerCheckToxicArrows)
else
call SaveReal(udg_hash,GetHandleId(TOXIC_ARROWS_TIMER),3, LoadReal(udg_hash,GetHandleId(TOXIC_ARROWS_TIMER),3) +ARROWS_TIME)
endif
else
if not (GetUnitAbilityLevel(CASTER, DAMAGE_DETECTOR_CODE)>0) then
call UnitAddAbility(CASTER,DAMAGE_DETECTOR_CODE)
endif
endif
set t = null
set CASTER = null
set TARGET = null
set tempu = null
set g = null
set udummy = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call UnitRemoveAbility(CASTER,CHIMAERASHOT_VENOMCODE)
call UnitRemoveAbility(CASTER,CHIMAERASHOT_BUFFCODE)
if not (GetUnitAbilityLevel(CASTER, DAMAGE_DETECTOR_CODE)>0) then
call UnitAddAbility(CASTER,DAMAGE_DETECTOR_CODE)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set CASTER = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
call UnitRemoveAbility(CASTER, DAMAGE_DETECTOR_CODE)
call UnitAddAbility(CASTER,CHIMAERASHOT_VENOMCODE)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,DURATION,false,function onTimer)
set CASTER = null
set t = null
endfunction
/*
private function updateTooltip takes nothing returns nothing
local integer j = 1
if not (COBRA_SHOT_USER == null) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Updating Cobra Tooltip")
loop
exitwhen j > BASE_ABILITY_MAX_LEVEL
call BlzSetAbilityTooltip(ABILCODE,"Test tooltip level: " + I2S(j),j)
call BlzSetAbilityResearchTooltip(ABILCODE,"Test tooltip RESEARCH level: " + I2S(j),j)
set j = j + 1
endloop
endif
endfunction
*/
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
//local timer tim = CreateTimer()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
call TriggerRegisterTimerExpireEvent(t1,CHIMAERASHOT_TIMER)
call TriggerAddAction(t1,function onChimaeraTimer)
//call TimerStart(tim,2.,true,function updateTooltip)
//set tim = null
set t = null
set t1 = null
endfunction
endscope
scope ChakramTrap initializer onInit
globals
private constant integer ABILCODE = 'A046'
private constant integer NETCODE = 'h02C'
private constant integer ROTORCODE = 'h02D'
private constant integer LASSOCODE = 'A048'
private constant integer COLUMNCODE = 'h02J'
private constant integer DUMMY = 'h009'
private constant integer LASSOBUFFCODE = 'B01D'
private constant real SLICE_BASE_DAMAGE = TRAP_MASTERY_DAMAGE
private constant integer MAX_UNITS = 20
private constant real BLOWUP_BASE_DAMAGE = 300.
private constant real BLEED_BASE_DAMAGE = 200.
private constant real DURATION = 11.
private constant real LASSODURATION = 4.
private constant real AFFECTDURATION = 11.
private constant real KNOCKTIME = 2.
private constant real KNOCKRANGE = 0.
private constant real AOE = 500.
private constant real CATCHINGSPEED = 50.
private constant real UPPERBLOWDISTANCE = 550.
private constant real LOWERBLOWDISTANCE = 145.
private constant real AOE_BLEED = 150.
private constant real TRAPBEFOREACTIVATION = 2.
private constant string BLEED_EFFECT = "Objects\\Spawnmodels\\Orc\\Orcblood\\OrcBloodWitchDoctor.mdl"
private constant real BLEED_DURATION = 4.
private constant real BLEED_PERIOD = 1.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function RemoveLasso takes nothing returns nothing
call UnitRemoveAbility(GetEnumUnit(),LASSOBUFFCODE)
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local group g = LoadGroupHandle(udg_hash,GetHandleId(t),2)
call GroupRemoveUnit(g,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
set g = null
endfunction
private function onTimerMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit NET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local boolean ISKNOCKED = LoadBoolean(udg_hash,GetHandleId(t),4)
local real knockTime = LoadReal(udg_hash,GetHandleId(t),5)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),6)
local timer tmain = LoadTimerHandle(udg_hash,GetHandleId(t),7)
local real x1 = GetUnitX(u)
local real y1 = GetUnitY(u)
local real x = GetUnitX(NET)
local real y = GetUnitY(NET)
local real angle = Atan2(y-y1,x-x1)
local real h = CATCHINGSPEED / 25.
local real dist = SquareRoot( (x-x1)*(x-x1) + (y-y1)*(y-y1))
local real DAMAGE = 0.
local real BLEED_DAMAGE = 0.
local integer TRAP_MASTERY_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),TRAP_MASTERY_LEVEL_HASH)
call SaveReal(udg_hash,GetHandleId(t),6,Elapsed+0.04)
if GetWidgetLife(u)>0. then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Checking unit buff")
if GetUnitAbilityLevel(u,LASSOBUFFCODE)>0 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Moving unit")
if ISKNOCKED then
set knockTime = knockTime + 0.04
if knockTime >=KNOCKTIME then
call SaveBoolean(udg_hash,GetHandleId(t),4,false)
else
call SaveReal(udg_hash,GetHandleId(t),5,knockTime)
endif
else
call SetUnitX(u,x1 + h*Cos(angle))
call SetUnitY(u,y1 + h*Sin(angle))
endif
//If unit come closer
if dist <= LOWERBLOWDISTANCE and not ISKNOCKED then
if TRAP_MASTERY_LEVEL>0 then
set DAMAGE = SLICE_BASE_DAMAGE*TRAP_MASTERY_LEVEL+GetUnitSpellPower(CASTER)/5.
call DealMagicalDamage(CASTER,u,DAMAGE)
call ParKnock(u,0.,KNOCKRANGE,KNOCKTIME,Rad2Deg(Atan2(GetUnitY(u)-y,GetUnitX(u)-x)),true,"none")
call SaveBoolean(udg_hash,GetHandleId(t),4,true)
call SaveReal(udg_hash,GetHandleId(t),5,0.)
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodSmall1.mdl",u,"chest"))
endif
endif
if dist >= UPPERBLOWDISTANCE then
set DAMAGE = BLOWUP_BASE_DAMAGE*GetUnitAbilityLevel(CASTER,ABILCODE)+LoadReal(udg_hash,GetHandleId(CASTER),5)
call DealMagicalDamage(CASTER,u,DAMAGE)
call UnitRemoveAbility(u,LASSOBUFFCODE)
endif
else
if not (tmain == null) then
call SaveInteger(udg_hash,GetHandleId(tmain),7,LoadInteger(udg_hash,GetHandleId(tmain),7)-1)
set tmain = null
endif
if Elapsed>=0.5 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"No buff removing timer")
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
endif
else
//If unit dies
if dist >= UPPERBLOWDISTANCE or dist <= LOWERBLOWDISTANCE then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl",u,"chest"))
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set tmain = null
set t = null
set u = null
set NET = null
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local timer t2 = null
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit NET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit ROTOR = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local group ENSNARED_UNIT_GROUP = LoadGroupHandle(udg_hash,GetHandleId(t),5)
local unit COLUMN = LoadUnitHandle(udg_hash,GetHandleId(t),6)
local integer TRAPPED = LoadInteger(udg_hash,GetHandleId(t),7)
local unit tempu = null
local unit udummy = null
local group g = CreateGroup()
local real x = GetUnitX(NET)
local real y = GetUnitY(NET)
local real BLEED_DAMAGE = 0.
set Elapsed = Elapsed + 0.04
if Elapsed >= TRAPBEFOREACTIVATION then
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if SquareRoot( (GetUnitX(tempu)-x)*(GetUnitX(tempu)-x) + (GetUnitY(tempu)-y)*(GetUnitY(tempu)-y) ) <= AOE_BLEED then
set BLEED_DAMAGE = BLEED_BASE_DAMAGE*GetUnitAbilityLevel(CASTER,ABILCODE)*(BLEED_PERIOD/BLEED_DURATION)
call DOT(CASTER,tempu,BLEED_DAMAGE,BLEED_DURATION,BLEED_PERIOD,2,BLEED_EFFECT,"head",false)
endif
if not IsUnitInGroup(tempu,ENSNARED_UNIT_GROUP) then
if IsUnitKnockbackable(tempu) and (TRAPPED<MAX_UNITS) then
call GroupAddUnit(ENSNARED_UNIT_GROUP,tempu)
set TRAPPED = TRAPPED + 1
call SaveInteger(udg_hash,GetHandleId(t),7,TRAPPED)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call SaveGroupHandle(udg_hash,GetHandleId(t1),2,ENSNARED_UNIT_GROUP)
call TimerStart(t1,AFFECTDURATION,false,function onTimerRemoveAffect)
set t2 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t2),1,tempu)
call SaveUnitHandle(udg_hash,GetHandleId(t2),2,NET)
call SaveUnitHandle(udg_hash,GetHandleId(t2),3,CASTER)
call SaveBoolean(udg_hash,GetHandleId(t2),4,false)
call SaveReal(udg_hash,GetHandleId(t2),5,0.)
call SaveReal(udg_hash,GetHandleId(t2),6,0.)
call SaveTimerHandle(udg_hash,GetHandleId(t2),7,t)
call TimerStart(t2,0.04,true,function onTimerMove)
set udummy = CreateUnit(GetOwningPlayer(CASTER),DUMMY,x,y,0.)
call UnitAddAbility(udummy,LASSOCODE)
call SetUnitAbilityLevel(udummy,LASSOCODE,GetUnitAbilityLevel(CASTER,ABILCODE))
call SetUnitFlyHeight(udummy,200.,0.)
call IssueTargetOrder(udummy,"magicleash",tempu)
call UnitApplyTimedLife(udummy,'BHwe',LASSODURATION)
set t1 = null
set t2 = null
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
endif
if Elapsed >= DURATION then
call FadeUnitIn(NET,2.5)
call FadeUnitIn(ROTOR,2.5)
call FadeUnitIn(COLUMN,2.5)
call ForGroup(ENSNARED_UNIT_GROUP,function RemoveLasso)
call DestroyGroup(ENSNARED_UNIT_GROUP)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),4,Elapsed)
endif
set t = null
set CASTER = null
set NET = null
set ROTOR = null
set ENSNARED_UNIT_GROUP = null
set udummy = null
set tempu = null
set g = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local timer t = CreateTimer()
local unit NET = CreateUnit(GetOwningPlayer(CASTER),NETCODE,x,y,0)
local unit ROTOR = CreateUnit(GetOwningPlayer(CASTER),ROTORCODE,x,y,0.)
local unit COLUMN = CreateUnit(GetOwningPlayer(CASTER),COLUMNCODE,x,y,0.)
call FadeUnitOut(NET,TRAPBEFOREACTIVATION,false)
call FadeUnitOut(ROTOR,TRAPBEFOREACTIVATION,false)
call FadeUnitOut(COLUMN,TRAPBEFOREACTIVATION,false)
call SetUnitTimeScale(NET,-1.)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,NET)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,ROTOR)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveGroupHandle(udg_hash,GetHandleId(t),5,CreateGroup())
call SaveUnitHandle(udg_hash,GetHandleId(t),6,COLUMN)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set NET = null
set ROTOR = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope KillCommand initializer onInit
globals
private constant integer ABILCODE = 'A042'
constant integer KILLCOMMAND_WOLFABILCODE = 'A04B'
private constant integer WOLFSLAMCODE = 'A04C'
constant integer KILLCOMMAND_WOLFBUFFCODE = 'B01F'
constant integer KILLCOMMAND_WOLFBONUSDAMAGE = 75
constant real KILLCOMMAND_SPLASH = 0.20
private constant integer WOLFSTUNCODE = 'A04E'
timer KILLCOMMAND_TIMER = CreateTimer()
private constant integer WOLFCHARGESHASH = 202
private constant integer DUMMY = 'h009'
private constant integer WOLFSAVEDHASH = 201
private constant real AOE = 250.
private constant real WOLF_BONUS_MOVESPEED = 100.
private constant real MAXKNOCKBACK = 250.
private constant real MAXHEIGHTKNOCKBACK = 75.
private constant real DURATIONKNOCKBACK = 0.15
private constant real GROWDURATION = 1.25
//private constant real SIZEBASE = 1.3
//private constant real SIZEBONUS = 0.8
private constant real SIZETIMERPERIOD = 0.1
private constant real WOLFBUFFDURATION = 10.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerGrow takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit WOLF = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),2) + SIZETIMERPERIOD
local boolean GROW = LoadBoolean(udg_hash,GetHandleId(t),3)
local real size_BASE = WOLF_NORMAL_SIZES[WOLF_ACTIVE_SKIN_NUMBER]
local real sizeBonus = WOLF_BONUS_SIZES[WOLF_ACTIVE_SKIN_NUMBER]
local real SIZEChange = sizeBonus*(Elapsed/GROWDURATION)
if GROW then
call SetUnitScale(WOLF, size_BASE + SIZEChange,size_BASE + SIZEChange, size_BASE + SIZEChange)
else
call SetUnitScale(WOLF, size_BASE + sizeBonus - SIZEChange,size_BASE + sizeBonus - SIZEChange, size_BASE + sizeBonus - SIZEChange)
endif
if Elapsed >= GROWDURATION then
call DestroyTimer(t)
call FlushChildHashtable(udg_hash,GetHandleId(t))
else
call SaveReal(udg_hash,GetHandleId(t),2,Elapsed)
endif
set t = null
set WOLF = null
endfunction
//On Wolf's attack
private function onTimerExpired takes nothing returns nothing
local timer t = KILLCOMMAND_TIMER
local timer t1 = null
local unit WOLF = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local group g = CreateGroup()
local unit tempu = null
local real dist = 0.
local real x = GetUnitX(WOLF)
local real y = GetUnitY(WOLF)
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local integer CHARGES = LoadInteger(udg_hash,GetHandleId(WOLF),WOLFCHARGESHASH)
local unit udummy = CreateUnit(GetOwningPlayer(WOLF),DUMMY,xt,yt,0.)
set CHARGES = CHARGES - 1
call UnitAddAbility(udummy,WOLFSTUNCODE)
call IssueImmediateOrder(udummy,"stomp")
call UnitApplyTimedLife(udummy,'BHwe',0.5)
set udummy = null
set udg_temp_unit = WOLF
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if (xt-x)*(GetUnitX(tempu)-x)+(yt-y)*(GetUnitY(tempu)-y) >= 0 then
set dist = SquareRoot( (x-GetUnitX(tempu))*(x-GetUnitX(tempu))+(y-GetUnitY(tempu))*(y-GetUnitY(tempu)) )
if dist <= MAXKNOCKBACK and IsUnitKnockbackable(tempu) then
call SetUnitAnimation(tempu,"death")
call ParKnock(tempu,MAXHEIGHTKNOCKBACK*(1-dist/MAXKNOCKBACK),MAXKNOCKBACK-dist,DURATIONKNOCKBACK,Rad2Deg(Atan2(GetUnitY(tempu)-y,GetUnitX(tempu)-x)),true,"Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl")
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if CHARGES <=0 then
call UnitRemoveAbility(WOLF,WOLFSLAMCODE)
call UnitRemoveAbility(WOLF,KILLCOMMAND_WOLFABILCODE)
call UnitRemoveAbility(WOLF,KILLCOMMAND_WOLFBUFFCODE)
call SetUnitMoveSpeed(WOLF,GetUnitMoveSpeed(WOLF)-WOLF_BONUS_MOVESPEED)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,WOLF)
call SaveReal(udg_hash,GetHandleId(t1),2,0.)
call SaveBoolean(udg_hash,GetHandleId(t1),3,false)
call TimerStart(t1,SIZETIMERPERIOD,true,function onTimerGrow)
set t1 = null
else
call SaveInteger(udg_hash,GetHandleId(WOLF),WOLFCHARGESHASH,CHARGES)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
set t = null
set WOLF = null
set TARGET = null
set g = null
endfunction
private function onBuffExpires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit WOLF = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local timer t1 = null
if GetUnitAbilityLevel(WOLF,KILLCOMMAND_WOLFABILCODE) > 0 then
call UnitRemoveAbility(WOLF,WOLFSLAMCODE)
call UnitRemoveAbility(WOLF,KILLCOMMAND_WOLFABILCODE)
call UnitRemoveAbility(WOLF,KILLCOMMAND_WOLFBUFFCODE)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,WOLF)
call SaveReal(udg_hash,GetHandleId(t1),2,0.)
call SaveBoolean(udg_hash,GetHandleId(t1),3,false)
call TimerStart(t1,SIZETIMERPERIOD,true,function onTimerGrow)
call SetUnitMoveSpeed(WOLF,GetUnitMoveSpeed(WOLF)-WOLF_BONUS_MOVESPEED)
set t1 = null
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set WOLF = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = null
local timer t1 = null
local unit WOLF = LoadUnitHandle(udg_hash,GetHandleId(CASTER),WOLFSAVEDHASH)
local integer CHARGES = 3 + GetUnitAbilityLevel(CASTER,ABILCODE)
if (not (WOLF == null)) and (GetWidgetLife(WOLF)>0.) then
//Give Wolf attack charges
call SaveInteger(udg_hash,GetHandleId(WOLF),WOLFCHARGESHASH,CHARGES)
//Give Wolf attack slam animation
call UnitAddAbility(WOLF,WOLFSLAMCODE)
//Give Wolf Buff
call UnitAddAbility(WOLF,KILLCOMMAND_WOLFABILCODE)
call SetUnitAbilityLevel(WOLF,KILLCOMMAND_WOLFABILCODE,GetUnitAbilityLevel(CASTER,ABILCODE))
call MAKE_UNIT_COMBAT(CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(WOLF),SUMMON_WOLF_WOLFTARGETHASH,TARGET)
call IssueTargetOrder(WOLF,"attack",TARGET)
call SetUnitMoveSpeed(WOLF,GetUnitMoveSpeed(WOLF)+WOLF_BONUS_MOVESPEED)
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,WOLF)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call SaveBoolean(udg_hash,GetHandleId(t),3,true)
call TimerStart(t,SIZETIMERPERIOD,true,function onTimerGrow)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,WOLF)
call TimerStart(t1,WOLFBUFFDURATION,false,function onBuffExpires)
set t = null
set t1 = null
endif
set CASTER = null
set TARGET = null
set WOLF = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
call TriggerRegisterTimerExpireEvent(t1,KILLCOMMAND_TIMER)
call TriggerAddAction(t1,function onTimerExpired)
set t = null
set t1 = null
endfunction
endscope
scope ChimaeraShot initializer onInit
globals
private constant integer ABILCODE = 'A04A'
private constant integer ACIDCODE = 'h02F'
private constant integer FIRECODE = 'h02E'
private constant integer FROSTCODE = 'h02G'
private constant integer FIREEXPLODECODE = 'h02H'
private constant integer ACIDEXPLODECODE = 'h02I'
private constant real FIRE_DAMAGE = 400.
private constant real FIRE_DOT_DURATION = 3.
private constant real FIRE_DOT_PERIOD = 1.
private constant real FIRE_DOT_AOE = 175.
private constant integer MAX_FIRES = 12
private constant real ACID_BASE_DAMAGE = 200.
private constant integer MAX_ACIDS = 12
private constant real FIRE_FOCUS = 10.
private constant real ACID_FOCUS = 10.
private constant real ARCANE_FOCUS = 10.
private constant real ELLIPSOID_b = 250.
private constant real MAXHEIGHT = 350.
private constant real PI_VALUE = 3.142
private constant string FIREEFFECT = "Abilities\\Weapons\\SearingArrow\\SearingArrowMissile.mdl"
private constant real EFECTFIRSTSHOTTIME = 0.3
private constant real FIRSTSHOTTIME = 0.7
private constant string ACIDEFFECT = "Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl"
private constant real EFECTSECONDSHOTTIME = 1.2
private constant real SECONDSHOTTIME = 1.65
private constant string FROSTEFFECT = "Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl"
private constant real EFECTTHIRDSHOTTIME = 2.1
private constant real THIRDSHOTTIME = 3.
private constant real FIRSTFLYTIME = 2.7
private constant real SECONDFLYTIME = FIRSTFLYTIME - (SECONDSHOTTIME-FIRSTSHOTTIME)
private constant real THIRDFLYTIME = SECONDFLYTIME - (THIRDSHOTTIME-SECONDSHOTTIME)
private constant integer CASTPREVENTED_HASH = 206
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onFinish takes nothing returns nothing
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Shot Finished or Prevented")
call SaveBoolean(udg_hash,GetHandleId(GetTriggerUnit()),CASTPREVENTED_HASH,true)
call SetUnitTimeScale(GetTriggerUnit(),1.)
endfunction
//takes a center (x0,y0) of the ellipsoid, semi-axes a,b, the angle between new coordinate orts (xnew,ynew) and (x,y) and time t
private function GetFirstPositionX takes real x0, real y0, real a, real b, real angle, real time returns real
local real tnew = PI_VALUE*( 1 - time / FIRSTFLYTIME)
local real xnew = a * Cos(tnew)
local real ynew = b * Sin(tnew)
return xnew * Cos(angle) - ynew*Sin(angle) + x0
endfunction
private function GetFirstPositionY takes real x0, real y0, real a, real b, real angle, real time returns real
local real tnew = PI_VALUE*( 1 - time / FIRSTFLYTIME)
local real xnew = a * Cos(tnew)
local real ynew = b * Sin(tnew)
return xnew * Sin(angle) + ynew*Cos(angle) + y0
endfunction
private function GetSecondPositionX takes real x0, real y0, real a, real b, real angle, real time returns real
local real tnew = PI_VALUE + PI_VALUE*(time / SECONDFLYTIME)
local real xnew = a * Cos(tnew)
local real ynew = b * Sin(tnew)
return xnew * Cos(angle) - ynew*Sin(angle) + x0
endfunction
private function GetSecondPositionY takes real x0, real y0, real a, real b, real angle, real time returns real
local real tnew = PI_VALUE + PI_VALUE*(time / SECONDFLYTIME)
local real xnew = a * Cos(tnew)
local real ynew = b * Sin(tnew)
return xnew * Sin(angle) + ynew*Cos(angle) + y0
endfunction
//takes normalized time from [0..1]
private function GetMissileHeight takes real time returns real
return -MAXHEIGHT*time*(time-2) + 50.
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerMissile takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit MISSILE = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real h = LoadReal(udg_hash,GetHandleId(t),3)
local real angle = LoadReal(udg_hash,GetHandleId(t),4)
local real DUR = LoadReal(udg_hash,GetHandleId(t),5)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),6)
local integer MISTYPE = LoadInteger(udg_hash,GetHandleId(t),7)
local boolean ISARCANED = LoadBoolean(udg_hash,GetHandleId(t),8)
local group g = null
local unit tempu = null
local real DAMAGE = 0.
local integer IMPROVED_CHIMAERA_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_CHIMAERA_LEVEL_HASH)
set Elapsed = Elapsed + 0.04
call SetUnitX(MISSILE,GetUnitX(MISSILE)+h*Cos(angle))
call SetUnitY(MISSILE,GetUnitY(MISSILE)+h*Sin(angle))
call SetUnitFlyHeight(MISSILE, GetUnitFlyHeight(MISSILE) - GetUnitFlyHeight(MISSILE)/((DUR-Elapsed)*25), 0. )
if Elapsed >= DUR then
call KillUnit(MISSILE)
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(MISSILE),GetUnitY(MISSILE),FIRE_DOT_AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
//Fire missile
if MISTYPE == 1 then
set DAMAGE = (FIRE_DAMAGE*GetUnitAbilityLevel(CASTER,ABILCODE)+GetUnitSpellPower(CASTER))*(FIRE_DOT_PERIOD/FIRE_DOT_DURATION)
if ISARCANED then
set DAMAGE = DAMAGE*(1.+0.5)*(1.+IMPROVED_CHIMAERA_LEVEL*IMPROVED_CHIMAERA_DAMAGE_LEVEL)
endif
call DOT(CASTER,tempu,DAMAGE,FIRE_DOT_DURATION,FIRE_DOT_PERIOD,1,"Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl","chest",false)
endif
//Acid missile
if MISTYPE == 2 then
set DAMAGE = ACID_BASE_DAMAGE*GetUnitAbilityLevel(CASTER,ABILCODE)+GetUnitSpellPower(CASTER)/3.
if ISARCANED then
set DAMAGE = DAMAGE*(1.+0.5)*(1.+IMPROVED_CHIMAERA_LEVEL*IMPROVED_CHIMAERA_DAMAGE_LEVEL)
endif
call DealMagicalDamage(CASTER,tempu,DAMAGE)
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set g = null
else
call SaveReal(udg_hash,GetHandleId(t),6,Elapsed)
endif
set t = null
set CASTER = null
set MISSILE = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),2)
local unit FIRE = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local unit ACID = LoadUnitHandle(udg_hash,GetHandleId(t),4)
local unit FROST = LoadUnitHandle(udg_hash,GetHandleId(t),11)
local unit udummy = null
local boolean PREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),CASTPREVENTED_HASH)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real ELLIPSOID_a = LoadReal(udg_hash,GetHandleId(t),7)
local real x0 = LoadReal(udg_hash,GetHandleId(t),8)
local real y0 = LoadReal(udg_hash,GetHandleId(t),9)
local real angle = LoadReal(udg_hash,GetHandleId(t),10)
local real time = 0.
local unit tempu = null
local integer j = 0
local integer IMPROVED_CHIMAERA_LEVEL = 0
local real CAST_SPEED_COEFF = LoadReal(udg_hash,GetHandleId(t),20)
if PREVENTED and CAST_SPEED_COEFF*Elapsed < FIRSTSHOTTIME then
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),5))
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Shot Prevented too early")
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
set Elapsed = Elapsed + 0.02
call SaveReal(udg_hash,GetHandleId(t),2,Elapsed)
if not PREVENTED and CAST_SPEED_COEFF*Elapsed >= EFECTFIRSTSHOTTIME then
if LoadEffectHandle(udg_hash,GetHandleId(t),5)==null then
if GetUnitState(CASTER,UNIT_STATE_MANA) >= FIRE_FOCUS then
call SaveEffectHandle(udg_hash,GetHandleId(t),5, AddSpecialEffectTarget(FIREEFFECT,CASTER,"hand") )
call SetUnitState(CASTER,UNIT_STATE_MANA,GetUnitState(CASTER,UNIT_STATE_MANA)-FIRE_FOCUS)
else
call IssueImmediateOrder(CASTER,"stop")
endif
endif
endif
if not PREVENTED and CAST_SPEED_COEFF*Elapsed >= EFECTSECONDSHOTTIME then
if LoadEffectHandle(udg_hash,GetHandleId(t),6)==null then
if GetUnitState(CASTER,UNIT_STATE_MANA) >= ACID_FOCUS then
call SaveEffectHandle(udg_hash,GetHandleId(t),6, AddSpecialEffectTarget(ACIDEFFECT,CASTER,"hand") )
call SetUnitState(CASTER,UNIT_STATE_MANA,GetUnitState(CASTER,UNIT_STATE_MANA)-ACID_FOCUS)
else
call IssueImmediateOrder(CASTER,"stop")
endif
endif
endif
if not PREVENTED and CAST_SPEED_COEFF*Elapsed >= EFECTTHIRDSHOTTIME then
if LoadEffectHandle(udg_hash,GetHandleId(t),12)==null then
if GetUnitState(CASTER,UNIT_STATE_MANA) >= ARCANE_FOCUS then
call SaveEffectHandle(udg_hash,GetHandleId(t),12, AddSpecialEffectTarget(FROSTEFFECT,CASTER,"hand") )
call SetUnitState(CASTER,UNIT_STATE_MANA,GetUnitState(CASTER,UNIT_STATE_MANA)-ARCANE_FOCUS)
else
call IssueImmediateOrder(CASTER,"stop")
endif
endif
endif
if (FIRE == null) and (CAST_SPEED_COEFF*Elapsed >= FIRSTSHOTTIME) and (not PREVENTED) then
set FIRE = CreateUnit(GetOwningPlayer(CASTER),FIRECODE,x,y,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,FIRE)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),5))
endif
if (ACID == null) and (CAST_SPEED_COEFF*Elapsed >= SECONDSHOTTIME) and (not PREVENTED) then
set ACID = CreateUnit(GetOwningPlayer(CASTER),ACIDCODE,x,y,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),4,ACID)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),6))
endif
if (FROST==null) and (CAST_SPEED_COEFF*Elapsed >= THIRDSHOTTIME) and (not PREVENTED) then
set FROST = CreateUnit(GetOwningPlayer(CASTER),FROSTCODE,x,y,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),11,FROST)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),12))
endif
if PREVENTED and (EFECTSECONDSHOTTIME < Elapsed*CAST_SPEED_COEFF) then
if not (LoadEffectHandle(udg_hash,GetHandleId(t),6)==null) then
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),6))
endif
endif
if PREVENTED and (EFECTTHIRDSHOTTIME < Elapsed*CAST_SPEED_COEFF) then
if not (LoadEffectHandle(udg_hash,GetHandleId(t),12)==null) then
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),12))
endif
endif
if GetWidgetLife(FIRE) > 0. then
set time = CAST_SPEED_COEFF*Elapsed-FIRSTSHOTTIME
call SetUnitX(FIRE, GetFirstPositionX(x0,y0,ELLIPSOID_a,ELLIPSOID_b,angle,time))
call SetUnitY(FIRE, GetFirstPositionY(x0,y0,ELLIPSOID_a,ELLIPSOID_b,angle,time))
call SetUnitFlyHeight(FIRE, GetMissileHeight(time/FIRSTFLYTIME),0.)
endif
if GetWidgetLife(ACID) > 0. then
set time = CAST_SPEED_COEFF*Elapsed-SECONDSHOTTIME
call SetUnitX(ACID, GetSecondPositionX(x0,y0,ELLIPSOID_a,ELLIPSOID_b,angle,time))
call SetUnitY(ACID, GetSecondPositionY(x0,y0,ELLIPSOID_a,ELLIPSOID_b,angle,time))
call SetUnitFlyHeight(ACID, GetMissileHeight(time/SECONDFLYTIME)+65.,0.)
endif
if GetWidgetLife(FROST) > 0. then
set time = CAST_SPEED_COEFF*Elapsed-THIRDSHOTTIME
call SetUnitX(FROST, x0 + ELLIPSOID_a*(2 * time /THIRDFLYTIME - 1)*Cos(angle) )
call SetUnitY(FROST, y0 + ELLIPSOID_a*(2 * time /THIRDFLYTIME - 1)*Sin(angle) )
call SetUnitFlyHeight(FROST,MAXHEIGHT*time/THIRDFLYTIME+50.,0.)
endif
if CAST_SPEED_COEFF*Elapsed - FIRSTSHOTTIME >= FIRSTFLYTIME then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl",FIRE,"origin"))
call KillUnit(FIRE)
endif
if CAST_SPEED_COEFF*Elapsed - SECONDSHOTTIME >= SECONDFLYTIME then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\AcidBomb\\BottleMissile.mdl",ACID,"origin"))
call KillUnit(ACID)
endif
if CAST_SPEED_COEFF*Elapsed - THIRDSHOTTIME >= THIRDFLYTIME then
call DestroyEffect(AddSpecialEffectTarget("AAbilities\\Spells\\Items\\AIre\\AIreTarget.mdl",FROST,"origin"))
call KillUnit(FROST)
endif
//Checking wheter elements are blowed
if (not (FIRE==null)) and (not(GetWidgetLife(FIRE) > 0.)) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Shot Prevented after summon and orb finished")
if not PREVENTED then
call IssueImmediateOrder(CASTER,"stop")
endif
//The effect of Fire element
if not (FIRE == null) then
set j = 1
loop
exitwhen j>MAX_FIRES
set tempu = CreateUnit(GetOwningPlayer(CASTER),FIREEXPLODECODE,GetUnitX(FIRE),GetUnitY(FIRE),0.)
call SetUnitFlyHeight(tempu,GetUnitFlyHeight(FIRE)+50.,0.)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call SaveUnitHandle(udg_hash,GetHandleId(t1),2,CASTER)
call SaveReal(udg_hash,GetHandleId(t1),3,GetRandomReal(50/(1.*25),400/(1.*25)))
call SaveReal(udg_hash,GetHandleId(t1),4,GetRandomReal(0.,2*PI_VALUE))
call SaveReal(udg_hash,GetHandleId(t1),5,GetRandomReal(0.75,1.))
call SaveReal(udg_hash,GetHandleId(t1),6,0.)
call SaveInteger(udg_hash,GetHandleId(t1),7,1)
if not (FROST == null) then
call SaveBoolean(udg_hash,GetHandleId(t1),8,true)
endif
call TimerStart(t1,0.04,true,function onTimerMissile)
set t1 = null
set j = j + 1
endloop
endif
//The effect of Acid element
if not (ACID == null) then
set j = 1
loop
exitwhen j>MAX_ACIDS
set tempu = CreateUnit(GetOwningPlayer(CASTER),ACIDEXPLODECODE,GetUnitX(ACID),GetUnitY(ACID),0.)
call SetUnitFlyHeight(tempu,GetUnitFlyHeight(ACID)+50.,0.)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call SaveUnitHandle(udg_hash,GetHandleId(t1),2,CASTER)
call SaveReal(udg_hash,GetHandleId(t1),3,GetRandomReal(50/(1.*25),400/(1.*25)))
call SaveReal(udg_hash,GetHandleId(t1),4,GetRandomReal(0.,2*PI_VALUE))
call SaveReal(udg_hash,GetHandleId(t1),5,GetRandomReal(0.75,1.))
call SaveReal(udg_hash,GetHandleId(t1),6,0.)
call SaveInteger(udg_hash,GetHandleId(t1),7,2)
if not (FROST == null) then
call SaveBoolean(udg_hash,GetHandleId(t1),8,true)
endif
call TimerStart(t1,0.04,true,function onTimerMissile)
set t1 = null
set j = j + 1
endloop
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
endif
set CASTER = null
set FIRE = null
set ACID = null
set FROST = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real xc = GetUnitX(CASTER)
local real yc = GetUnitY(CASTER)
local real xt = GetSpellTargetX()
local real yt = GetSpellTargetY()
local real ELLIPSOID_a = SquareRoot( (xc-xt)*(xc-xt) + (yc-yt)*(yc-yt) ) / 2.
local real x0 = (xc+xt) / 2.
local real y0 = (yc+yt) / 2.
local real angle = Atan2( yt-yc,xt-xc )
local integer IMPROVED_CHIMAERA_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_CHIMAERA_LEVEL_HASH)
local real CAST_SPEED_COEFF = 1. + IMPROVED_CHIMAERA_LEVEL*IMPROVED_CHIMAERA_SPEED_LEVEL
call SetUnitTimeScale(CASTER,CAST_SPEED_COEFF)
//Adding a bit offset
set x0 = x0 + 50*Cos(angle)
set y0 = y0 + 50*Sin(angle)
call SaveBoolean(udg_hash,GetHandleId(CASTER),CASTPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,null)
call SaveUnitHandle(udg_hash,GetHandleId(t),4,null)
call SaveUnitHandle(udg_hash,GetHandleId(t),11,null)
call SaveEffectHandle(udg_hash,GetHandleId(t),5,null)
call SaveEffectHandle(udg_hash,GetHandleId(t),6,null)
call SaveEffectHandle(udg_hash,GetHandleId(t),12,null)
call SaveReal(udg_hash,GetHandleId(t),7,ELLIPSOID_a)
call SaveReal(udg_hash,GetHandleId(t),8,x0)
call SaveReal(udg_hash,GetHandleId(t),9,y0)
call SaveReal(udg_hash,GetHandleId(t),10,angle)
call SaveReal(udg_hash,GetHandleId(t),20,CAST_SPEED_COEFF)
call TimerStart(t,0.02,true, function onTimer)
set CASTER = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
library PriestTalents initializer onInit
globals
constant integer PRIEST_CODE = 'H01I'
private constant integer MAX_TALENTS = 10
private constant integer SURGE_OF_LIGHT_CODE = 'A076'
private constant integer DIVINE_STAR_CODE = 'A077'
private constant integer LUMINOUS_BARRIER_CODE = 'A078'
private constant integer GUARDIAN_OF_THE_LIGHT_CODE = 'A079'
private constant integer GUARDIAN_SPIRIT_ABILCODE = 'A06Z'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer SURGE_OF_LIGHT_LEVEL_HASH = 250
constant real SURGE_OF_LIGHT_CRIT_BONUS = 3
constant integer DIVINE_STAR_LEVEL_HASH = 251
constant real DIVINE_STAR_DURATION_BONUS = 0.25
constant real DIVINE_STAR_DURABILITY_BONUS = 0.05
constant integer LUMINOUS_BARRIER_LEVEL_HASH = 252
constant real LUMINOUS_BARRIER_ENERGY_REGEN = 0.05
constant integer GUARDIAN_OF_THE_LIGHT_LEVEL_HASH = 253
constant integer GUARDIAN_OF_THE_LIGHT_COOLDOWN_LOWERING = 2
constant real GUARDIAN_OF_THE_LIGHT_ENERGY_RESTORE = 0.01
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == PRIEST_CODE
endfunction
private function GetSurgeOfLightDescriptionByLevel takes integer lvl returns string
return "Flash Heal has increased by |c008080C0" + I2S(R2I(SURGE_OF_LIGHT_CRIT_BONUS*lvl)) + "%|r critical healing chance on the targets under Shield of Faith."
endfunction
private function GetDivineStarDescriptionByLevel takes integer lvl returns string
return "Each healing effect of Prayer of Healing on the targets under Shield of Faith increases the duration of existing shields by |c008080C0" + R2S(DIVINE_STAR_DURATION_BONUS*lvl) + "|r sec. and their durability by |c008080C0" + I2S(R2I(DIVINE_STAR_DURABILITY_BONUS*100*lvl)) + "%|r of its maximal value."
endfunction
private function GetLuminousBarrierDescriptionByLevel takes integer lvl returns string
return "Shield of Faith increases energy regeneration on its targets by |c008080C0" + I2S(R2I(LUMINOUS_BARRIER_ENERGY_REGEN*100*lvl)) + "%|r. Effects from different shields do not stack."
endfunction
private function GetGuardianOfTheLightDescriptionByLevel takes integer lvl returns string
return "Lowers the cooldown of Guardian Spirit by |c008080C0" + I2S(GUARDIAN_OF_THE_LIGHT_COOLDOWN_LOWERING*lvl) + "|r sec. and and makes it restore |c008080C0" + I2S(R2I(GUARDIAN_OF_THE_LIGHT_ENERGY_RESTORE*100*lvl)) +"%|r of the maximal energy every second to its target."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),SURGE_OF_LIGHT_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(SURGE_OF_LIGHT_CODE, GetSurgeOfLightDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetSurgeOfLightDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(SURGE_OF_LIGHT_CODE, GetSurgeOfLightDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),DIVINE_STAR_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(DIVINE_STAR_CODE, GetDivineStarDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetDivineStarDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(DIVINE_STAR_CODE, GetDivineStarDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),LUMINOUS_BARRIER_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(LUMINOUS_BARRIER_CODE, GetLuminousBarrierDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetLuminousBarrierDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(LUMINOUS_BARRIER_CODE, GetLuminousBarrierDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(GUARDIAN_OF_THE_LIGHT_CODE, GetGuardianOfTheLightDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetGuardianOfTheLightDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(GUARDIAN_OF_THE_LIGHT_CODE, GetGuardianOfTheLightDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
if whichUnit==null then
call BlzSetAbilityExtendedTooltip(GUARDIAN_SPIRIT_ABILCODE, "Calls upon a guardian spirit to watch over the friendly target for 10 sec, increasing healing received by 10% and preventing the target from dying by sacrificing itself. This sacrifice terminates the effect and heals the target for 40% of maximum health. |n|c000080FFCooldown:|r " + I2S(R2I(BlzGetAbilityCooldown(GUARDIAN_SPIRIT_ABILCODE,0))) + " seconds",0)
else
call BlzSetAbilityExtendedTooltip(GUARDIAN_SPIRIT_ABILCODE, "Calls upon a guardian spirit to watch over the friendly target for 10 sec, increasing healing received by 10% and preventing the target from dying by sacrificing itself. This sacrifice terminates the effect and heals the target for 40% of maximum health. |n|c000080FFCooldown:|r " + I2S(R2I(BlzGetUnitAbilityCooldown(whichUnit,GUARDIAN_SPIRIT_ABILCODE,0))) + " seconds",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == SURGE_OF_LIGHT_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"SURGE_OF_LIGHT CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),SURGE_OF_LIGHT_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),SURGE_OF_LIGHT_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),SURGE_OF_LIGHT_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SURGE_OF_LIGHT_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == DIVINE_STAR_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"DIVINE_STAR")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),DIVINE_STAR_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),DIVINE_STAR_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),DIVINE_STAR_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),DIVINE_STAR_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == LUMINOUS_BARRIER_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"LUMINOUS_BARRIER CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),LUMINOUS_BARRIER_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),LUMINOUS_BARRIER_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),LUMINOUS_BARRIER_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),LUMINOUS_BARRIER_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == GUARDIAN_OF_THE_LIGHT_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"GUARDIAN_OF_THE_LIGHT CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and (GetUnitAbilityLevel(CASTER,GUARDIAN_SPIRIT_ABILCODE)>0) and (LoadInteger(udg_hash,GetHandleId(CASTER),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH) < MAX_TALENTS) then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call BlzSetUnitAbilityCooldown(CASTER,GUARDIAN_SPIRIT_ABILCODE,0,BlzGetUnitAbilityCooldown(CASTER,GUARDIAN_SPIRIT_ABILCODE,0)-GUARDIAN_OF_THE_LIGHT_COOLDOWN_LOWERING)
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH) < MAX_TALENTS then
if GetUnitAbilityLevel(CASTER,GUARDIAN_SPIRIT_ABILCODE)>0 then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"You have to learn Guardian Spirit first")
endif
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function PriestUnlearnTalents takes unit hero returns nothing
local integer SURGE_OF_LIGHT_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),SURGE_OF_LIGHT_LEVEL_HASH)
local integer DIVINE_STAR_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),DIVINE_STAR_LEVEL_HASH)
local integer LUMINOUS_BARRIER_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),LUMINOUS_BARRIER_LEVEL_HASH)
local integer GUARDIAN_OF_THE_LIGHT_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH)
local integer sum = SURGE_OF_LIGHT_LEVEL+DIVINE_STAR_LEVEL+LUMINOUS_BARRIER_LEVEL+GUARDIAN_OF_THE_LIGHT_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),SURGE_OF_LIGHT_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),DIVINE_STAR_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),LUMINOUS_BARRIER_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH,0)
call BlzSetUnitAbilityCooldown(hero,GUARDIAN_SPIRIT_ABILCODE,0,BlzGetAbilityCooldown(GUARDIAN_SPIRIT_ABILCODE,0))
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope GuardianSpirit initializer Init
//uses N key of hash
globals
private constant integer ABILCODE = 'A06Z'
private constant integer AURACODE = 'A072'
private constant integer BUFFCODE = 'B023'
constant integer GUARDIAN_SPIRIT_BUFFCODE = 'B023'
constant integer GUARDIAN_SPIRIT_AURACODE = 'A072'
constant real GUARDIAN_SPIRIT_LIFE_PERCENT = 0.4
private constant real HEALING_RECEIVED_BONUS = 0.1
private constant real DURATION = 10.
endglobals
function GetDivineSpiritBuffCode takes nothing returns integer
return BUFFCODE
endfunction
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real elapsed = LoadReal(udg_hash,GetHandleId(t),3)
local integer GUARDIAN_OF_THE_LIGHT_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),GUARDIAN_OF_THE_LIGHT_LEVEL_HASH)
local real energy = GUARDIAN_OF_THE_LIGHT_LEVEL * GUARDIAN_OF_THE_LIGHT_ENERGY_RESTORE
set elapsed = elapsed + 1
call AddHeroParameter(TARGET, HEALING_RECEIVED_BONUS, 1., GetReceivedHealingBonusHash(),"","")
if GUARDIAN_OF_THE_LIGHT_LEVEL > 0 then
call RegenerateEnergy(TARGET, GetUnitState(TARGET,UNIT_STATE_MAX_MANA)*energy)
endif
if elapsed >= DURATION or not (GetUnitAbilityLevel(TARGET,BUFFCODE)>0) then
call UnitRemoveAbility(TARGET,AURACODE)
call UnitRemoveAbility(TARGET,BUFFCODE)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),3,elapsed)
endif
set TARGET = null
set CASTER = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = CreateTimer()
call UnitAddAbility(TARGET,AURACODE)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,TARGET)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,CASTER)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call TimerStart(t,1.,true,function onTimer)
set t = null
set CASTER = null
set TARGET = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function onCast)
set t = null
endfunction
endscope
scope FlashHeal initializer onInit
globals
private constant integer ABILCODE = 'A06W'
private constant string EFFECT = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
private constant string ATTACH = "origin"
private constant real HEALING_BASE = 100.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local real HEALING = HEALING_BASE * GetUnitAbilityLevel(CASTER,ABILCODE) + GetUnitSpellPower(CASTER)
local integer SURGE_OF_LIGHT_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),SURGE_OF_LIGHT_LEVEL_HASH)
local real crit = SURGE_OF_LIGHT_CRIT_BONUS * SURGE_OF_LIGHT_LEVEL
if SURGE_OF_LIGHT_LEVEL > 0 then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellCritHash(), GetUnitSpellCrit(CASTER) + crit)
endif
call DestroyEffect(AddSpecialEffectTarget(EFFECT,TARGET,ATTACH))
call HealUnit(CASTER,TARGET,HEALING)
if SURGE_OF_LIGHT_LEVEL > 0 then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellCritHash(), GetUnitSpellCrit(CASTER) - crit)
endif
set CASTER = null
set TARGET = null
endfunction
private function onEndCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.)
endfunction
private function onBeginCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.35)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t2, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t2, Condition( function Conds ) )
call TriggerAddAction(t2,function onBeginCast)
call TriggerRegisterAnyUnitEventBJ( t3, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( t3, Condition( function Conds ) )
call TriggerAddAction(t3,function onEndCast)
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function onCast)
set t = null
set t2 = null
set t3 = null
endfunction
endscope
scope PrayerOfHealing initializer onInit
globals
private constant integer ABILCODE = 'A06U'
private constant integer SUNCODE = 'h03K'
private constant integer WAVECODE = 'h03L'
private constant integer ISPREVENTED_HASH = 201
private constant real AOE = 600.
private constant real WAVE_HEAL_PERIOD = 1.
private constant real HEALING_BASE = 100.
private constant real HEALING_SPELL_POWER_FACTOR_BASE = 0.5
private constant real HEALING_SPELL_POWER_FACTOR_LEVEL = 0.15
private constant real MANA_COST_BASE = 20.
private constant real MANA_COST_PERCENT = 0.04
private constant real SUN_HEIGHT = 350.
private constant string HEAL_EFFECT = "Abilities\\Weapons\\PriestMissile\\PriestMissile.mdl"
private constant string CASTER_EFFECT = "Abilities\\Spells\\Items\\HealingSalve\\HealingSalveTarget.mdl"
private constant string CASTER_ATTACH = "hand right"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and (GetWidgetLife(GetFilterUnit())>0.) and (not BlzIsUnitInvulnerable(GetFilterUnit()))
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit SUN = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),3)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local group g = null
local real x = GetUnitX(SUN)
local real y = GetUnitY(SUN)
local unit tempu = null
local unit WAVE = null
local real manacost = (MANA_COST_BASE * GetUnitAbilityLevel(CASTER,ABILCODE) + GetUnitState(CASTER,UNIT_STATE_MAX_MANA) * MANA_COST_PERCENT) / 25.
local real HEALING_AMMOUNT = HEALING_BASE * GetUnitAbilityLevel(CASTER,ABILCODE) + GetUnitSpellPower(CASTER)*( HEALING_SPELL_POWER_FACTOR_BASE + HEALING_SPELL_POWER_FACTOR_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE))
local integer DIVINE_STAR_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),DIVINE_STAR_LEVEL_HASH)
if not (Elapsed >= WAVE_HEAL_PERIOD) then
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),3,Elapsed)
else
call SaveReal(udg_hash,GetHandleId(t),3,0.)
set udg_temp_unit = CASTER
set g = CreateGroup()
call GroupEnumUnitsInRange(g,x,y,AOE,function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DestroyEffect(AddSpecialEffectTarget(HEAL_EFFECT,tempu,"chest"))
call HealUnit(CASTER,tempu,HEALING_AMMOUNT)
if DIVINE_STAR_LEVEL > 0 then
call UnitShield.IncreaseShieldDuration(tempu,CASTER,SHIELD_OF_FAITH_BUFFCODE,DIVINE_STAR_LEVEL*DIVINE_STAR_DURATION_BONUS)
call UnitShield.IncreaseShieldDurability(tempu,CASTER,SHIELD_OF_FAITH_BUFFCODE,DIVINE_STAR_LEVEL*DIVINE_STAR_DURABILITY_BONUS,true)
endif
call GroupRemoveUnit(g,tempu)
endloop
call PlaySoundOnUnitBJ( gg_snd_PriestCastAttack1, 100, SUN )
set WAVE = CreateUnit(GetOwningPlayer(CASTER),WAVECODE,x,y,0.)
call SetUnitFlyHeight(WAVE,SUN_HEIGHT,0.)
call SetUnitTimeScale(WAVE,0.25)
call UnitApplyTimedLife(WAVE,'BHwe',2.)
set WAVE = null
call DestroyGroup(g)
set g = null
endif
if GetUnitState(CASTER,UNIT_STATE_MANA) >= manacost then
call SetUnitState(CASTER,UNIT_STATE_MANA, GetUnitState(CASTER,UNIT_STATE_MANA)-manacost)
else
call IssueImmediateOrder(CASTER,"stop")
endif
if ISPREVENTED then
call KillUnit(SUN)
call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),5))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
set SUN = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit SUN = CreateUnit(GetOwningPlayer(CASTER),SUNCODE,x,y,0.)
call SetUnitFlyHeight(SUN,SUN_HEIGHT,0.)
call FadeUnitOut(SUN,1.,false)
call SaveEffectHandle(udg_hash,GetHandleId(t),5,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,SUN)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call SetUnitTimeScale(CASTER,0.04)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set SUN = null
set t = null
endfunction
private function onEndCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.)
endfunction
private function onBeginCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.25)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t2, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t2, Condition( function Conds ) )
call TriggerAddAction(t2,function onBeginCast)
call TriggerRegisterAnyUnitEventBJ( t3, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( t3, Condition( function Conds ) )
call TriggerAddAction(t3,function onEndCast)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
set t2 = null
set t3 = null
endfunction
endscope
scope ShieldOfFaith initializer onInit
globals
private constant integer ABILCODE = 'A06X'
private constant integer AURACODE = 'A071'
private constant integer BUFFCODE = 'B022'
constant integer SHIELD_OF_FAITH_BUFFCODE = 'B022'
private constant real AOE = 700.
private constant real SHIELD_DURATION_BASE = 7.
private constant real SHIELD_DURATION_LEVEL = 1.
private constant real SHIELD_MULTIPLIER_BASE = 0.25
private constant real SHIELD_MULTIPLIER_LEVEL_FACTOR = 0.05
private constant real SHIELD_AMOUNT_BASE = 50
private constant real SHIELD_AMOUNT_LEVEL = 100
private constant string EFFECT = "Abilities\\Spells\\Undead\\ReplenishHealth\\ReplenishHealthCaster.mdl"
private constant string ATTACH = "origin"
private constant string REGEN_EFFECT = "Abilities\\Spells\\Other\\GeneralAuraTarget\\GeneralAuraTarget.mdl"
private constant string REGEN_ATTACH = "overhead"
private unit SHIELD_CASTER = null
private group AFFECTED = CreateGroup()
private group REGEN_AFFECTED = CreateGroup()
private timer REGEN_TIMER = null
private real TEMP_REGEN = 0.
private integer TEMP_COUNTER = 0
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(SHIELD_CASTER)) and not(IsUnitDeadBX(GetFilterUnit())) and not BlzIsUnitInvulnerable(GetFilterUnit()) and not(IsUnitInGroup(GetFilterUnit(),AFFECTED))
endfunction
private function ForGroupRegen takes nothing returns nothing
local unit tempu = GetEnumUnit()
if GetUnitAbilityLevel(tempu, SHIELD_OF_FAITH_BUFFCODE) > 0 then
call AddHeroParameter(tempu,TEMP_REGEN,1.,GetEnergyRegenBonusHash(),REGEN_EFFECT,REGEN_ATTACH)
set TEMP_COUNTER = TEMP_COUNTER + 1
else
call GroupRemoveUnit(REGEN_AFFECTED,tempu)
endif
set tempu = null
endfunction
private function onTimerRegen takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local integer LUMINOUS_BARRIER_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),LUMINOUS_BARRIER_LEVEL_HASH)
set TEMP_REGEN = LUMINOUS_BARRIER_LEVEL * LUMINOUS_BARRIER_ENERGY_REGEN
set TEMP_COUNTER = 0
call ForGroup(REGEN_AFFECTED, function ForGroupRegen)
if TEMP_COUNTER == 0 or LUMINOUS_BARRIER_LEVEL <= 0 then
call GroupClear(REGEN_AFFECTED)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set REGEN_TIMER = null
endif
set t = null
set CASTER = null
endfunction
private function FadeLightning takes nothing returns nothing
local timer t = GetExpiredTimer()
local real TIMEOUT = LoadReal(udg_hash,GetHandleId(t),2)
local lightning LG = LoadLightningHandle(udg_hash,GetHandleId(t),1)
call SetLightningColor(LG,100.,100.,100.,GetLightningColorA(LG)+10.)
set TIMEOUT = TIMEOUT + 0.1
call SaveReal(udg_hash,GetHandleId(t),2,TIMEOUT)
if TIMEOUT >=1. then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call DestroyLightning(LG)
endif
set t = null
set LG = null
endfunction
private function TakeLightningToFade takes lightning LG returns nothing
local timer t = CreateTimer()
call SaveLightningHandle(udg_hash,GetHandleId(t),1,LG)
call TimerStart(t,0.1,true,function FadeLightning)
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local integer JUMPS = 3
local real SPELLPOWER = GetUnitSpellPower(CASTER)
local real DURATION = SHIELD_DURATION_BASE + SHIELD_DURATION_LEVEL * GetUnitAbilityLevel(CASTER,ABILCODE)
local real AMOUNT = 0.
local real AMOUNT_BASE = 0.
local real MULT = 0.
local real x1 = GetUnitX(CASTER)
local real x2 = GetUnitX(TARGET)
local real y1 = GetUnitY(CASTER)
local real y2 = GetUnitY(TARGET)
local real z1 = GetTerrainZ(x1,y1) + 70. + GetUnitFlyHeight(CASTER)
local real z2 = GetTerrainZ(x2,y2) + 70. + GetUnitFlyHeight(TARGET)
local integer i = 1
local group g = CreateGroup()
local integer LUMINOUS_BARRIER_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),LUMINOUS_BARRIER_LEVEL_HASH)
//call BJDebugMsg(GetUnitName(GetTriggerUnit()) + "Starts effect")
if LUMINOUS_BARRIER_LEVEL > 0 and REGEN_TIMER == null then
set REGEN_TIMER = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(REGEN_TIMER),1,CASTER)
call TimerStart(REGEN_TIMER,1.,true, function onTimerRegen)
endif
set SHIELD_CASTER = CASTER
set AMOUNT_BASE = SHIELD_AMOUNT_BASE + GetUnitAbilityLevel(CASTER,ABILCODE)*SHIELD_AMOUNT_LEVEL
set AMOUNT = AMOUNT_BASE + SPELLPOWER
set MULT = SHIELD_MULTIPLIER_BASE + SHIELD_MULTIPLIER_LEVEL_FACTOR*GetUnitAbilityLevel(CASTER,ABILCODE)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,TARGET,ATTACH))
call TakeLightningToFade(AddLightningEx("HWPB",false,x1,y1,z1,x2,y2,z2))
call UnitShield.Add(TARGET,CASTER,AMOUNT,DURATION,-1,MULT,AURACODE,BUFFCODE)
if LUMINOUS_BARRIER_LEVEL > 0 then
call GroupAddUnit(REGEN_AFFECTED,TARGET)
endif
set x1 = x2
set y1 = y2
set z1 = z2
call GroupAddUnit(AFFECTED,TARGET)
set TARGET = null
loop
call GroupEnumUnitsInRange(g,x2,y2,AOE,function GroupFilter)
set TARGET = FirstOfGroup(g)
exitwhen i>JUMPS or TARGET == null
set x2=GetUnitX(TARGET)
set y2=GetUnitY(TARGET)
set z2=GetTerrainZ(x2,y2) + 70. + GetUnitFlyHeight(TARGET)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,TARGET,ATTACH))
call TakeLightningToFade(AddLightningEx("HWSB",false,x1,y1,z1,x2,y2,z2))
call UnitShield.Add(TARGET,CASTER,AMOUNT,DURATION,-1,MULT,AURACODE,BUFFCODE)
if LUMINOUS_BARRIER_LEVEL > 0 then
call GroupAddUnit(REGEN_AFFECTED,TARGET)
endif
set x1 = x2
set y1 = y2
set z1 = z2
call GroupAddUnit(AFFECTED,TARGET)
call GroupClear(g)
set TARGET = null
set i = i + 1
endloop
call GroupClear(AFFECTED)
call DestroyGroup(g)
set CASTER = null
set g = null
endfunction
private function onEndCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.)
endfunction
private function onBeginCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.75)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t2, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t2, Condition( function Conds ) )
call TriggerAddAction(t2,function onBeginCast)
call TriggerRegisterAnyUnitEventBJ( t3, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( t3, Condition( function Conds ) )
call TriggerAddAction(t3,function onEndCast)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conds )
call TriggerAddAction(t, function onCast )
set t = null
set t2 = null
set t3 = null
endfunction
endscope
scope DivineHymn initializer onInit
globals
private constant integer ABILCODE = 'A06Y'
private constant integer AURACODE = 'A074'
private constant integer BUFFCODE = 'B025'
private constant integer INNER_FIRE_CODE = 'h03M'
private constant integer EFFECT_CODE = 'h03N'
private constant real AOE = 600.
private constant real DURATION = 10.
private constant real ENERGY_REGEN_BASE = 0.1
private constant real ENERGY_REGEN_LEVEL = 0.1
private constant real MANA_REGEN_BASE = 0.
private constant real MANA_REGEN_LEVEL = 0.025
private constant real HP_REGEN_BASE = 0.
private constant real HP_REGEN_LEVEL = 0.025
private unit temp_CASTER = null
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return not (IsUnitDeadBX(GetFilterUnit())) and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(temp_CASTER))
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local real elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit FIRE = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit EFFECT = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local real x = GetUnitX(FIRE)
local real y = GetUnitY(FIRE)
local group g = CreateGroup()
local unit tempu = null
local real energy = ENERGY_REGEN_BASE+ENERGY_REGEN_LEVEL * GetUnitAbilityLevel(CASTER,ABILCODE)
local real heal = HP_REGEN_BASE + HP_REGEN_LEVEL * GetUnitAbilityLevel(CASTER,ABILCODE)
local real mana = MANA_REGEN_BASE + MANA_REGEN_LEVEL * GetUnitAbilityLevel(CASTER,ABILCODE)
set temp_CASTER = CASTER
call GroupEnumUnitsInRange(g,x,y, AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call AddHeroParameter(tempu, energy, 0.99, GetEnergyRegenBonusHash(),"","")
call HealUnit(tempu,CASTER, GetUnitState(tempu,UNIT_STATE_MAX_LIFE)*heal)
call RegenerateMana(tempu,GetUnitState(tempu,UNIT_STATE_MAX_MANA)*mana)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\HealingWave\\HealingWaveTarget.mdl",tempu,"chest"))
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set elapsed = elapsed + 1.
if elapsed >= DURATION then
call FadeUnitIn(FIRE,1.)
call FadeUnitIn(EFFECT,1.)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),4,elapsed)
endif
set t = null
set g = null
set CASTER = null
set FIRE = null
set EFFECT = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit FIRE = CreateUnit(GetOwningPlayer(CASTER),INNER_FIRE_CODE,x,y,0.)
local unit EFFECT = CreateUnit(GetOwningPlayer(CASTER),EFFECT_CODE,x,y,0.)
local timer t = CreateTimer()
call UnitAddAbility(FIRE,AURACODE)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,FIRE)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,EFFECT)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call TimerStart(t,1.,true, function onTimer)
set t = null
set FIRE = null
set EFFECT = null
set CASTER = null
endfunction
private function onEndCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.)
endfunction
private function onBeginCast takes nothing returns nothing
call SetUnitTimeScale(GetTriggerUnit(),1.35)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t2 = CreateTrigger()
local trigger t3 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t2, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t2, Condition( function Conds ) )
call TriggerAddAction(t2,function onBeginCast)
call TriggerRegisterAnyUnitEventBJ( t3, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( t3, Condition( function Conds ) )
call TriggerAddAction(t3,function onEndCast)
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function onCast)
set t = null
set t2 = null
set t3 = null
endfunction
endscope
library HereticTalents initializer onInit requires MapGameplayUtils
globals
constant integer ERETIC_CODE = 'H03J'
private constant integer MAX_TALENTS = 10
private constant integer DEMONIC_CONSUMPTION_CODE = 'A07Z'
private constant integer MASTER_SUMMONER_CODE = 'A080'
private constant integer CORRUPTION_CODE = 'A081'
private constant integer SOULWELL_CODE = 'A082'
private constant integer BONE_RITUAL_ABILCODE = 'A07S'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer DEMONIC_CONSUMPTION_LEVEL_HASH = 250
constant real DEMONIC_CONSUMPTION_ENERGYREG_BONUS = 0.01
constant real DEMONIC_CONSUMPTION_DURATION_BASE = 3.
constant real DEMONIC_CONSUMPTION_DURATION_LEVEL = 2.
constant integer MASTER_SUMMONER_LEVEL_HASH = 251
constant real MASTER_SUMMONER_CAST_DECREASE = 0.1
constant real MASTER_SUMMONER_COOLDOWN_DECREASE = 0.5
constant integer CORRUPTION_LEVEL_HASH = 252
constant real CORRUPTION_DOT_OVERALLDAMAGE = 0.12
constant real CORRUPTION_DOT_DURATION = 4.
constant real CORRUPTION_DOT_PERIOD = 0.99
constant string CORRUPTION_DOT_EFFECT = "war3mapImported\\BloodCloudTarget.mdl"
constant string CORRUPTION_DOT_ATTACH = "head"
constant integer SOULWELL_LEVEL_HASH = 253
constant real SOULWELL_RESTORE = 0.1
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == ERETIC_CODE
endfunction
private function GetDemonicConsumptionDescriptionByLevel takes integer lvl returns string
return "While Demonic Adornment is active, every spended charge of Haunt increase Energy Regeneration by |c008080C0" + I2S(R2I(DEMONIC_CONSUMPTION_ENERGYREG_BONUS*100*lvl)) + "%|r for |c008080C0" + I2S(R2I(DEMONIC_CONSUMPTION_DURATION_BASE+DEMONIC_CONSUMPTION_DURATION_LEVEL*lvl)) + "|r seconds. Charges released on DOT cause half of the effect."
endfunction
private function GetMasterSummonerDescriptionByLevel takes integer lvl returns string
return "Lowers the casting time of Bone Ritual by |c008080C0" + R2SW(MASTER_SUMMONER_CAST_DECREASE*lvl,2,1) + "|r sec. and cooldown by |c008080C0" + R2SW(MASTER_SUMMONER_COOLDOWN_DECREASE*lvl,2,1) + "|r sec."
endfunction
private function GetCorruptionDescriptionByLevel takes integer lvl returns string
return "Enemy units affected by Bone Ritual in addition take |c008080C0" + I2S(R2I(CORRUPTION_DOT_OVERALLDAMAGE*100*lvl)) + "%|r of the ability damage as a plague DOT, which lasts for "+ I2S(R2I(CORRUPTION_DOT_DURATION)) +" seconds."
endfunction
private function GetSoulwellDescriptionByLevel takes integer lvl returns string
return "Allied heroes near The Chosen Lich Graveyard receive a soulstone, which restores |c008080C0" + I2S(R2I(SOULWELL_RESTORE*100*lvl)) + "%|r of max health and energy. Soulstone has 90 seconds cooldown."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),DEMONIC_CONSUMPTION_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(DEMONIC_CONSUMPTION_CODE, GetDemonicConsumptionDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetDemonicConsumptionDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(DEMONIC_CONSUMPTION_CODE, GetDemonicConsumptionDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),MASTER_SUMMONER_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(MASTER_SUMMONER_CODE, GetMasterSummonerDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetMasterSummonerDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(MASTER_SUMMONER_CODE, GetMasterSummonerDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),CORRUPTION_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(CORRUPTION_CODE, GetCorruptionDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetCorruptionDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(CORRUPTION_CODE, GetCorruptionDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),SOULWELL_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(SOULWELL_CODE, GetSoulwellDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetSoulwellDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(SOULWELL_CODE, GetSoulwellDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == DEMONIC_CONSUMPTION_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"DEMONIC_CONSUMPTION CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),DEMONIC_CONSUMPTION_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),DEMONIC_CONSUMPTION_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),DEMONIC_CONSUMPTION_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),DEMONIC_CONSUMPTION_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == MASTER_SUMMONER_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MASTER_SUMMONER CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and (GetUnitAbilityLevel(CASTER,BONE_RITUAL_ABILCODE)>0) and (LoadInteger(udg_hash,GetHandleId(CASTER),MASTER_SUMMONER_LEVEL_HASH) < MAX_TALENTS) then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),MASTER_SUMMONER_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),MASTER_SUMMONER_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
set j = 0
loop
exitwhen j>8
call BlzSetUnitAbilityCooldown(CASTER,BONE_RITUAL_ABILCODE,j,BlzGetUnitAbilityCooldown(CASTER,BONE_RITUAL_ABILCODE,j)-MASTER_SUMMONER_COOLDOWN_DECREASE)
set j = j + 1
endloop
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),MASTER_SUMMONER_LEVEL_HASH) < MAX_TALENTS then
if GetUnitAbilityLevel(CASTER,BONE_RITUAL_ABILCODE)>0 then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"You have to learn Guardian Spirit first")
endif
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == CORRUPTION_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CORRUPTION CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),CORRUPTION_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),CORRUPTION_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),CORRUPTION_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),CORRUPTION_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == SOULWELL_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"SOULWELL CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),SOULWELL_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),SOULWELL_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),SOULWELL_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),SOULWELL_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function EreticUnlearnTalents takes unit hero returns nothing
local integer DEMONIC_CONSUMPTION_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),DEMONIC_CONSUMPTION_LEVEL_HASH)
local integer MASTER_SUMMONER_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),MASTER_SUMMONER_LEVEL_HASH)
local integer CORRUPTION_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),CORRUPTION_LEVEL_HASH)
local integer SOULWELL_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),SOULWELL_LEVEL_HASH)
local integer sum = DEMONIC_CONSUMPTION_LEVEL+MASTER_SUMMONER_LEVEL+CORRUPTION_LEVEL+SOULWELL_LEVEL
local integer j = 0
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),DEMONIC_CONSUMPTION_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),MASTER_SUMMONER_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),CORRUPTION_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),SOULWELL_LEVEL_HASH,0)
if GetUnitAbilityLevel(hero,BONE_RITUAL_ABILCODE)>0 then
set j = 0
loop
exitwhen j>7
call BlzSetUnitAbilityCooldown(hero,BONE_RITUAL_ABILCODE,j,BlzGetAbilityCooldown(BONE_RITUAL_ABILCODE,j))
set j = j + 1
endloop
endif
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope Soulstone initializer onInit
globals
constant integer SOULSTONE_ITEM_CODE = 'I014'
group SOULSTONE_AFFECTED = CreateGroup()
endglobals
private function Acts takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer lvl = LoadInteger(udg_hash,GetHandleId(GetManipulatedItem()),1)
local real EnergyValue = GetUnitState(CASTER,UNIT_STATE_MAX_MANA)*SOULWELL_RESTORE*lvl
local real HealValue = GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)*SOULWELL_RESTORE*lvl
call RegenerateEnergy(CASTER,EnergyValue)
call HealUnit(CASTER,CASTER,HealValue)
set CASTER = null
endfunction
private function Conds takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == SOULSTONE_ITEM_CODE
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t,Player(0),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(1),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerAddCondition(t,Condition(function Conds))
call TriggerAddAction(t,function Acts)
set t = null
endfunction
endscope
scope Graveyard initializer onInit
globals
private constant integer ABILCODE = 'A07H'
private constant integer AURA_DAMAGE_CODE = 'A07W'
private constant integer STANDARD_CODE = 'h03R'
private constant integer AURA_CODE = 'h03X'
private constant real AOE = 800.
private constant real CRIT_BONUS_BASE = 0.05
private constant real SPELL_CRIT_BONUS_BASE = 0.05
private constant real DURATION = 20.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and (GetWidgetLife(GetFilterUnit())>0.) and IsUnitAPlayerHero(GetFilterUnit())
endfunction
private function GetSoulstoneItemDescriptionByLevel takes integer lvl returns string
return "Restores |c008080C0" + I2S(R2I(SOULWELL_RESTORE*100*lvl)) + "%|r of max health and energy when used."
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(SOULSTONE_AFFECTED,CASTER)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function TryGiveSoulstoneToHero takes unit hero, integer lvl returns nothing
local boolean flag = IsUnitInGroup(hero,SOULSTONE_AFFECTED) or UnitHasItemId(hero,SOULSTONE_ITEM_CODE)
local integer j = IsInventoryFull(hero)
local item SS = null
local timer t = null
if (j >= 0) and (not flag) then
set SS = CreateItem(SOULSTONE_ITEM_CODE,GetUnitX(hero),GetUnitY(hero))
//call FlushChildHashtable(udg_hash,GetHandleId(SS))
call SaveInteger(udg_hash,GetHandleId(SS),1,lvl)
call BlzSetItemDescription(SS,GetSoulstoneItemDescriptionByLevel(lvl))
call BlzSetItemExtendedTooltip(SS,GetSoulstoneItemDescriptionByLevel(lvl))
call UnitAddItem(hero,SS)
call UnitDropItemSlot(hero,SS,j)
call DestroyEffect(AddSpecialEffectTarget("Objects\\InventoryItems\\CrystalShard\\CrystalShard.mdl",hero,"overhead"))
call GroupAddUnit(SOULSTONE_AFFECTED,hero)
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,hero)
call TimerStart(t,25.,false,function onTimerRemoveAffect)
set t = null
set SS = null
endif
endfunction
private function onTimerApplyBonusesAura takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit STANDARD = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),2)
//local integer WAR_BANNER = LoadInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH)
local group g = CreateGroup()
local unit tempu = null
local real CritBonus = 0.
local real SpellCritBonus = 0.
local integer SOULWELL_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),SOULWELL_LEVEL_HASH)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(STANDARD),GetUnitY(STANDARD),AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set CritBonus = GetHeroAgi(tempu,false)*CRIT_BONUS_BASE
set SpellCritBonus = GetHeroInt(tempu,false)*SPELL_CRIT_BONUS_BASE
call AddHeroParameter(tempu,CritBonus,1.,GetCritHash(),"","")
call AddHeroParameter(tempu,SpellCritBonus,1.,GetSpellCritHash(),"","")
if SOULWELL_LEVEL > 0 then
call TryGiveSoulstoneToHero(tempu, SOULWELL_LEVEL)
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if not (GetWidgetLife(STANDARD)>0.) then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set g = null
set STANDARD = null
set CASTER = null
endfunction
private function onTimerResetFlag takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit STANDARD = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit AURA = CreateUnit(GetOwningPlayer(STANDARD),AURA_CODE,GetUnitX(STANDARD),GetUnitY(STANDARD),0.)
local integer WAR_BANNER = LoadInteger(udg_hash,GetHandleId(CASTER),WAR_BANNER_LEVEL_HASH)
local timer t1 = null
call SetUnitAnimation(STANDARD,"stand")
call UnitAddAbility(STANDARD,AURA_DAMAGE_CODE)
call SetUnitAbilityLevel(STANDARD,AURA_DAMAGE_CODE,WAR_BANNER+1)
call UnitApplyTimedLife(STANDARD,'BHwe',DURATION)
call UnitApplyTimedLife(AURA,'BHwe',DURATION-1.)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,STANDARD)
call SaveUnitHandle(udg_hash,GetHandleId(t1),2,CASTER)
call TimerStart(t1,1.,true,function onTimerApplyBonusesAura)
set t1 = null
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set STANDARD = null
set CASTER = null
set AURA = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local unit STANDARD = CreateUnit(GetOwningPlayer(CASTER),STANDARD_CODE,x,y,0.)
local timer t = CreateTimer()
call SetUnitAnimation(STANDARD,"birth")
call SaveUnitHandle(udg_hash,GetHandleId(t),1,STANDARD)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,CASTER)
call TimerStart(t,1.,false,function onTimerResetFlag)
set t = null
set CASTER = null
set STANDARD = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition( function Conds ))
call TriggerAddAction(t, function onCast)
set t = null
endfunction
endscope
scope Shadowfury initializer onInit
globals
private constant integer ABILCODE = 'A07G'
private constant integer BEAMCODE = 'h03Q'
private constant real BEAM_AOE = 125.
private constant real BASE_DAMAGE_PER_LEVEL = 50.
private constant real MANA_PERCENT_COST = 0.//0.06
private constant real SPELL_POWER_EFFECT = 0.35
private constant real SPELL_POWER_PER_LEVEL = 0.05
private constant real AFFECTED_PERIOD = 0.5
private constant real BEAM_SPEED = 1000.
private constant real MAX_RAY_DIST = 1000.
private constant real BEAM_CREATE_PERIOD = 0.25
private constant integer ISPREVENTED_HASH = 201
private constant real ANGLE_SPEED = 1.57
private constant string EFFECT = "Abilities\\Weapons\\BansheeMissile\\BansheeMissile.mdl"
private constant string EXPLOSION_EFFECT = "Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayTarget.mdl"
private constant string EXPLOSION_ATTACH = "chest"
private constant string CASTER_EFFECT = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
private constant string CASTER_ATTACH = "origin"
private constant real CHANGE_ANIM_PERIOD = 0.28
private constant real PI_CONST = 3.1416
private constant real ANGLE_SMALL = 0.1
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
//angles between 0..2pi
private function AnglesIsClose takes real a1, real a2 returns boolean
local real diff = a1 - a2
if diff < 0. then
set diff = -diff
endif
return (diff < ANGLE_SMALL) or ((2*PI_CONST-diff) < ANGLE_SMALL)
endfunction
private function onTimerMoveMissile takes nothing returns nothing
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local group g = LoadGroupHandle(udg_hash,GetHandleId(t),2)
local real SinceLastBeam = LoadReal(udg_hash,GetHandleId(t),3)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real x1 = GetPlayerMouseX(GetOwningPlayer(CASTER))
local real y1 = GetPlayerMouseY(GetOwningPlayer(CASTER))
local real angle = Atan2(y1-y,x1-x)
local real newAngle = 0.
local unit tempu = null
local group tempGroup = CreateGroup()
local real lastAngle = Deg2Rad(GetUnitFacing(CASTER))
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local real ElapsedAnim = LoadReal(udg_hash,GetHandleId(t),4)
local boolean DirectAnim = LoadBoolean(udg_hash,GetHandleId(t),5)
local real MANA_CONSUMED = LoadReal(udg_hash,GetHandleId(t),6)
local real DAMAGE = BASE_DAMAGE_PER_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)+(SPELL_POWER_EFFECT+SPELL_POWER_PER_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE))*GetUnitSpellPower(CASTER)
local real manacost = GetUnitState(CASTER,UNIT_STATE_MAX_MANA) * MANA_PERCENT_COST / 25.
set ElapsedAnim = ElapsedAnim + 0.04
if ElapsedAnim >= CHANGE_ANIM_PERIOD then
if not DirectAnim then
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,CASTER,"hand left"))
call SetUnitTimeScale(CASTER,1.)
call SaveBoolean(udg_hash,GetHandleId(t),5,true)
else
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,CASTER,"hand left"))
call SetUnitTimeScale(CASTER,-1.)
call SaveBoolean(udg_hash,GetHandleId(t),5,false)
endif
else
call SaveReal(udg_hash,GetHandleId(t),4,ElapsedAnim)
endif
//moving ray
if not (angle >= 0.) and (angle < PI_CONST) then
set angle = angle + 2*PI_CONST
endif
set newAngle = lastAngle
if not AnglesIsClose(lastAngle,angle) then
if lastAngle<angle then
if lastAngle + (2*PI_CONST-angle) > angle-lastAngle then
set newAngle = lastAngle + ANGLE_SPEED/25.
else
set newAngle = lastAngle - ANGLE_SPEED/25.
endif
else
if angle + (2*PI_CONST-lastAngle) < lastAngle-angle then
set newAngle = lastAngle + ANGLE_SPEED/25.
else
set newAngle = lastAngle - ANGLE_SPEED/25.
endif
endif
endif
call SetUnitFacing(CASTER,Rad2Deg(newAngle))
set SinceLastBeam = SinceLastBeam + 0.04
if SinceLastBeam >= BEAM_CREATE_PERIOD then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Creating Beam")
set tempu = CreateUnit(GetOwningPlayer(CASTER),BEAMCODE,x+65*Cos(newAngle),y+65*Sin(newAngle),Rad2Deg(newAngle))
//call UnitApplyTimedLife(tempu,'BHwe',RAY_DIST/BEAM_SPEED)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
//GenerateTrajectoryParameters
set tempu = null
else
call SaveReal(udg_hash,GetHandleId(t),3,SinceLastBeam)
endif
if GetUnitState(CASTER,UNIT_STATE_MANA) >= manacost then
set MANA_CONSUMED = MANA_CONSUMED + manacost
call SaveReal(udg_hash,GetHandleId(t),6,MANA_CONSUMED)
call SetUnitState(CASTER,UNIT_STATE_MANA, GetUnitState(CASTER,UNIT_STATE_MANA)-manacost)
else
call IssueImmediateOrder(CASTER,"stop")
endif
if ISPREVENTED then
call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),6))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
set tempGroup = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveGroupHandle(udg_hash,GetHandleId(t),2,CreateGroup())
call SaveEffectHandle(udg_hash,GetHandleId(t),6,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveReal(udg_hash,GetHandleId(t),3,0.)
//for animation
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveBoolean(udg_hash,GetHandleId(t),5,false)
//for galvanizing spark mana consumed counter
call SaveReal(udg_hash,GetHandleId(t),6,0.)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope BoneRitual initializer onInit
globals
private constant integer ABILCODE = 'A07S'
private constant integer BONE_UNIT_CODE = 'u004'
private constant integer EXPLOSION_CODE = 'h03V'
private constant integer DEMONIC_ADOMMENT_CODE = 'B02A'
private constant integer ISPREVENTED_HASH = 202
private constant real AOE = 400.
private constant real DAMAGE_BASE = 150.
private constant real DAMAGE_LEVEL = 350.
private constant real BONE_H = 360.
private constant real SLAMTIME = 2.2
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and not BlzIsUnitInvulnerable(GetFilterUnit())
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit SKELET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit EXPLOSION = null
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),3)
local boolean DEMONIC = LoadBoolean(udg_hash,GetHandleId(t),6)
local real SLAM_TIME_NEW = LoadReal(udg_hash,GetHandleId(t),7)
local group g = null
local unit tempu = null
local real x = 0.
local real y = 0.
local real DAMAGE = 0.
local integer CORRUPTION_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),CORRUPTION_LEVEL_HASH)
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),3,Elapsed)
if DEMONIC and not ISPREVENTED then
call IssueImmediateOrder(CASTER,"stop")
endif
if Elapsed >= SLAM_TIME_NEW then
call IssueImmediateOrder(CASTER,"stop")
set x = LoadReal(udg_hash,GetHandleId(t),4)
set y = LoadReal(udg_hash,GetHandleId(t),5)
set EXPLOSION = CreateUnit(GetOwningPlayer(CASTER),EXPLOSION_CODE,x,y,0.)
set DAMAGE = DAMAGE_BASE + DAMAGE_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)+GetUnitSpellPower(CASTER)
call PlaySoundOnUnitBJ( gg_snd_WarStompBirth1, 100, EXPLOSION )
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DealDeathDamage(CASTER,tempu,DAMAGE)
if IsUnitKnockbackable(tempu) then
call SetUnitAnimation(tempu,"death")
endif
if CORRUPTION_LEVEL > 0 then
call AUTODOT(CASTER,tempu,DAMAGE*CORRUPTION_DOT_OVERALLDAMAGE*CORRUPTION_LEVEL,CORRUPTION_DOT_DURATION,CORRUPTION_DOT_PERIOD,4,CORRUPTION_DOT_EFFECT,CORRUPTION_DOT_ATTACH,true)
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
call KillUnit(EXPLOSION)
call SetUnitTimeScale(SKELET,0.25)
endif
if (ISPREVENTED and not DEMONIC) or Elapsed >= SLAM_TIME_NEW then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call FadeUnitIn(SKELET,2.5)
if Elapsed < SLAM_TIME_NEW then
call SetUnitTimeScale(SKELET,1.5)
call SetUnitAnimation(SKELET,"death")
endif
endif
set CASTER = null
set SKELET = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local real alpha = GetRandomReal(0.,3.14)
local unit SKELET = CreateUnit(GetOwningPlayer(CASTER),BONE_UNIT_CODE,x+BONE_H*Cos(alpha),y+BONE_H*Sin(alpha),Rad2Deg(alpha)+180.)
local timer t = CreateTimer()
local boolean DEMONIC = (GetUnitAbilityLevel(CASTER,DEMONIC_ADOMMENT_CODE)>0)
local integer MASTER_SUMMONER_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),MASTER_SUMMONER_LEVEL_HASH)
local real SLAM_TIME_NEW = SLAMTIME
local real SCALE = 0.25
if MASTER_SUMMONER_LEVEL > 0 then
set SLAM_TIME_NEW = SLAMTIME - MASTER_SUMMONER_CAST_DECREASE*MASTER_SUMMONER_LEVEL
set SCALE = (2.2*0.25)/SLAM_TIME_NEW
endif
if GetRandomInt(1,100) <= 20 then
call PlaySoundOnUnitBJ( gg_snd_AcolytePissed4, 100, CASTER )
endif
call SetUnitTimeScale(SKELET,SCALE)
call SetUnitAnimation(SKELET,"attack spell")
call FadeUnitOut(SKELET,SLAMTIME,false)
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,SKELET)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call SaveReal(udg_hash,GetHandleId(t),4,x)
call SaveReal(udg_hash,GetHandleId(t),5,y)
call SaveBoolean(udg_hash,GetHandleId(t),6,DEMONIC)
call SaveReal(udg_hash,GetHandleId(t),7,SLAM_TIME_NEW)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set SKELET = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope HauntEretic initializer onInit
globals
private constant integer ABILCODE = 'A07T'
private constant integer COIL_CODE = 'h03W'
private constant real SEARCHAOE = 750.
private constant real SPEED = 750.
private constant real CHECKAOE = 50.
private constant integer CHARGES_BASE = 5
private constant integer CHARGES_LEVEL = 5
private constant real DAMAGE_IMPACT_BASE = 100.
private constant real DAMAGE_IMPACT_LEVEL = 150.
private constant real DOT_DAMAGE_CHARGE = 100.
private constant real DOT_DURATION = 4.55
private constant real DOT_PERIOD = 0.75
private constant string DOT_EFFECT = "FelCurse.mdx"
private constant string DOT_ATTACH = "chest"
private constant real AFFECT_PERIOD = 1.5
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0. and (not IsUnitInGroup(GetFilterUnit(),AFFECTED))
endfunction
private function GetClosestNonAffectedTarget takes unit target returns unit
local group g = CreateGroup()
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local unit tempu = null
local unit newUnit = null
local real minD = 0.
local real curD = 0.
call GroupEnumUnitsInRange(g,x,y,SEARCHAOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set curD = (x-GetUnitX(tempu))*(x-GetUnitX(tempu))+(y-GetUnitY(tempu))*(y-GetUnitY(tempu))
if (newUnit == null) or curD < minD then
set newUnit = tempu
set minD = curD
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
return newUnit
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local unit NEWTARGET = null
local unit COIL = LoadUnitHandle(udg_hash,GetHandleId(t),3)
local integer CHARGES = LoadInteger(udg_hash,GetHandleId(t),4)
local timer t1 = null
local real x = GetUnitX(COIL)
local real y = GetUnitY(COIL)
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local real alpha = Atan2(yt-y,xt-x)
local real h = SPEED/25.
local real dist = SquareRoot( (xt-x)*(xt-x) + (yt-y)*(yt-y) )
local real DAMAGE = DAMAGE_IMPACT_BASE + DAMAGE_IMPACT_LEVEL * GetUnitAbilityLevel(CASTER,ABILCODE) + GetUnitSpellPower(CASTER)
local integer k = 0
local real ERegen = 0.
local real ERegenDur = 0.
local integer DEMONIC_CONSUMPTION_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),DEMONIC_CONSUMPTION_LEVEL_HASH)
call SetUnitFacing(COIL,Rad2Deg(alpha))
if dist <= CHECKAOE then
call GroupAddUnit(AFFECTED,TARGET)
call DealDeathDamage(CASTER,TARGET,DAMAGE)
if DEMONIC_CONSUMPTION_LEVEL > 0 then
set ERegen = DEMONIC_CONSUMPTION_ENERGYREG_BONUS*DEMONIC_CONSUMPTION_LEVEL
set ERegenDur = DEMONIC_CONSUMPTION_DURATION_BASE + DEMONIC_CONSUMPTION_DURATION_LEVEL*DEMONIC_CONSUMPTION_LEVEL
call AddHeroParameter(CASTER,ERegen,ERegenDur,GetEnergyRegenBonusHash(),"","")
endif
call DestroyEffect(AddSpecialEffectTarget("FelRain.mdx",TARGET,"origin"))
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,TARGET)
call TimerStart(t1,AFFECT_PERIOD,false,function onTimerRemoveAffect)
set t1 = null
set udg_temp_unit = CASTER
set NEWTARGET = GetClosestNonAffectedTarget(TARGET)
if NEWTARGET == null then
set k = GetRandomInt(1,3)
if k==1 and CHARGES > 2 then
call PlaySoundOnUnitBJ( gg_snd_BansheeYesAttack1, 100, COIL)
endif
if k==2 and CHARGES > 2 then
call PlaySoundOnUnitBJ( gg_snd_BansheeYesAttack2, 100, COIL)
endif
if k==3 and CHARGES > 2 then
call PlaySoundOnUnitBJ( gg_snd_BansheeYesAttack3, 100, COIL)
endif
if DEMONIC_CONSUMPTION_LEVEL > 0 then
set ERegen = DEMONIC_CONSUMPTION_ENERGYREG_BONUS*DEMONIC_CONSUMPTION_LEVEL*CHARGES*0.5
set ERegenDur = DEMONIC_CONSUMPTION_DURATION_BASE + DEMONIC_CONSUMPTION_DURATION_LEVEL*DEMONIC_CONSUMPTION_LEVEL
call AddHeroParameter(CASTER,ERegen,ERegenDur,GetEnergyRegenBonusHash(),"","")
endif
call AUTODOT(CASTER,TARGET,(DOT_DAMAGE_CHARGE+0.5*GetUnitSpellPower(CASTER))*CHARGES,DOT_DURATION,DOT_PERIOD,6,DOT_EFFECT,DOT_ATTACH,true)
call KillUnit(COIL)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
if CHARGES > 0 then
call SaveUnitHandle(udg_hash,GetHandleId(t),2,NEWTARGET)
call SaveInteger(udg_hash,GetHandleId(t),4,CHARGES-1)
else
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call KillUnit(COIL)
endif
set NEWTARGET = null
endif
else
call SetUnitX(COIL,x+h*Cos(alpha))
call SetUnitY(COIL,y+h*Sin(alpha))
endif
set CASTER = null
set TARGET = null
set COIL = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local unit COIL = CreateUnit(GetOwningPlayer(CASTER),COIL_CODE,x,y,Rad2Deg(Atan2(GetUnitY(TARGET)-y,GetUnitX(TARGET)-x)))
local timer t = CreateTimer()
local integer CHARGES = CHARGES_BASE + CHARGES_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)
call PlaySoundOnUnitBJ( gg_snd_BansheeDeath, 100, COIL)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,TARGET)
call SaveUnitHandle(udg_hash,GetHandleId(t),3,COIL)
call SaveInteger(udg_hash,GetHandleId(t),4,CHARGES)
call TimerStart(t,0.04,true,function onTimer)
set t = null
set CASTER = null
set TARGET = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope DemonicAdomment initializer onInit
globals
private constant integer ABILCODE = 'A07U'
private constant integer MULTISHOT_CODE = 'A07V'
private constant integer DAMAGE_DETECTOR_CODE = 'A001'
private constant real DURATION = 25.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),2)
local integer LAST_DMG = LoadInteger(udg_hash,GetHandleId(t),3)
local integer NEW_DMG = R2I(GetUnitSpellPower(CASTER)*(0.4+0.2*GetUnitAbilityLevel(CASTER,ABILCODE)))
local effect e = null
if GetWidgetLife(CASTER) > 0. then
if LAST_DMG > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)-LAST_DMG,0)
endif
if NEW_DMG > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)+NEW_DMG,0)
call SaveInteger(udg_hash,GetHandleId(t),3,NEW_DMG)
else
call SaveInteger(udg_hash,GetHandleId(t),3,0)
endif
else
set Elapsed = DURATION
endif
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),2,Elapsed)
if GetWidgetLife(CASTER)>GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)*0.5 then
call SetWidgetLife(CASTER,GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)*0.5)
endif
if Elapsed>=DURATION then
call UnitRemoveAbility(CASTER,MULTISHOT_CODE)
call UnitAddAbility(CASTER,DAMAGE_DETECTOR_CODE)
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)-NEW_DMG,0)
set e = LoadEffectHandle(udg_hash,GetHandleId(t),4)
call DestroyEffect(e)
set e = null
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local effect e = AddSpecialEffectTarget("war3mapImported\\DemonicAdornment.mdx",CASTER,"head")
if GetRandomInt(1,100) <= 20 then
call PlaySoundOnUnitBJ( gg_snd_AcolytePissed6, 100, CASTER )
endif
call UnitRemoveAbility(CASTER,DAMAGE_DETECTOR_CODE)
call UnitAddAbility(CASTER,MULTISHOT_CODE)
call SetUnitAbilityLevel(CASTER,MULTISHOT_CODE,GetUnitAbilityLevel(CASTER,ABILCODE))
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call SaveInteger(udg_hash,GetHandleId(t),3,0)
call SaveEffectHandle(udg_hash,GetHandleId(t),4,e)
call TimerStart(t,0.04,true,function onTimer)
set t = null
set e = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conds ) )
call TriggerAddAction(t, function onCast )
set t = null
endfunction
endscope
scope MaleficBonds initializer onInit
globals
private constant integer ABILCODE = 'A07E'
private constant integer ABIL_BUFF = 'A07D'
private constant integer BUFF_CODE = 'B02B'
private constant real BONDS_AOE = 800.
private constant real BREAK_BONDS_DIST = 1500.
private constant real HP_DIFFERENCE_THRESHOLD = 0.05
private constant real STAT_PERCENT_BASE = 0.1
private constant real STAT_PERCENT_LEVEL = 0.15
private constant real DURATION = 15.
endglobals
private function Conds takes nothing returns boolean
if GetSpellAbilityId() == ABILCODE then
if IsUnitAPlayerHero(GetSpellTargetUnit()) then
return true
else
call IssueImmediateOrder(GetTriggerUnit(),"stop")
call SimError(GetOwningPlayer(GetTriggerUnit()),"Malefic Bonds can target only player-controlled heroes.")
endif
endif
return false
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real xCo = LoadReal(udg_hash,GetHandleId(t),3)
local real yCo = LoadReal(udg_hash,GetHandleId(t),4)
local real xTo = LoadReal(udg_hash,GetHandleId(t),5)
local real yTo = LoadReal(udg_hash,GetHandleId(t),6)
local real xCn = GetUnitX(CASTER)
local real yCn = GetUnitY(CASTER)
local real xTn = GetUnitX(TARGET)
local real yTn = GetUnitY(TARGET)
local real dist = SquareRoot( (xCn-xTn)*(xCn-xTn) + (yCn-yTn)*(yCn-yTn) )
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),7)
local real p1 = GetWidgetLife(CASTER)/GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)
local real p2 = GetWidgetLife(TARGET)/GetUnitState(TARGET,UNIT_STATE_MAX_LIFE)
local real minP = 0.
local real diff = 0.
local boolean flag = false
local integer LastDCaster = LoadInteger(udg_hash,GetHandleId(t),8)
local integer LastDTarget = LoadInteger(udg_hash,GetHandleId(t),9)
local integer LastACaster = LoadInteger(udg_hash,GetHandleId(t),10)
local integer LastATarget = LoadInteger(udg_hash,GetHandleId(t),11)
local real LastSPCaster = LoadReal(udg_hash,GetHandleId(t),12)
local real LastSPTarget = LoadReal(udg_hash,GetHandleId(t),13)
local integer NewDCaster = 0
local integer NewDTarget = 0
local integer NewACaster = 0
local integer NewATarget = 0
local real NewSPCaster = 0.
local real NewSPTarget = 0.
local real MUL = STAT_PERCENT_BASE + STAT_PERCENT_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)
if GetWidgetLife(CASTER) > 0. and GetWidgetLife(TARGET)>0. then
if LastDCaster > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)-LastDCaster,0)
endif
if LastDTarget > 0 then
call BlzSetUnitBaseDamage(TARGET,BlzGetUnitBaseDamage(TARGET,0)-LastDTarget,0)
endif
set NewDCaster = R2I(BlzGetUnitBaseDamage(TARGET,0) * MUL)
set NewDTarget = R2I(BlzGetUnitBaseDamage(CASTER,0) * MUL)
if GetUnitTypeId(TARGET) == SHAMAN_CODE or GetUnitTypeId(TARGET) == SHAMAN_WOLF_CODE or GetUnitTypeId(TARGET) == DRUID_CODE or GetUnitTypeId(TARGET) == DRUID_TREE_CODE then
set NewDCaster = 0
set NewDTarget = 0
endif
if NewDCaster > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)+NewDCaster,0)
endif
if NewDTarget > 0 then
call BlzSetUnitBaseDamage(TARGET,BlzGetUnitBaseDamage(TARGET,0)+NewDTarget,0)
endif
call SaveInteger(udg_hash,GetHandleId(t),8,NewDCaster)
call SaveInteger(udg_hash,GetHandleId(t),9,NewDTarget)
if LastACaster > 0 then
call BlzSetUnitArmor(CASTER,BlzGetUnitArmor(CASTER)-LastACaster)
endif
if LastATarget > 0 then
call BlzSetUnitArmor(TARGET,BlzGetUnitArmor(TARGET)-LastATarget)
endif
set NewACaster = R2I(BlzGetUnitArmor(TARGET) * MUL)
set NewATarget = R2I(BlzGetUnitArmor(CASTER) * MUL)
if NewACaster > 0 then
call BlzSetUnitArmor(CASTER,BlzGetUnitArmor(CASTER)+NewACaster)
endif
if NewATarget > 0 then
call BlzSetUnitArmor(TARGET,BlzGetUnitArmor(TARGET)+NewATarget)
endif
call SaveInteger(udg_hash,GetHandleId(t),10,NewACaster)
call SaveInteger(udg_hash,GetHandleId(t),11,NewATarget)
if LastSPCaster > 0 then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash()) - LastSPCaster )
endif
if LastSPTarget > 0 then
call SaveReal(udg_hash,GetHandleId(TARGET),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(TARGET),GetSpellPowerHash()) - LastSPTarget )
endif
set NewSPCaster = GetUnitSpellPower(TARGET)*MUL
set NewSPTarget = GetUnitSpellPower(CASTER)*MUL
if NewSPCaster > 0 then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash()) + NewSPCaster )
endif
if NewSPTarget > 0 then
call SaveReal(udg_hash,GetHandleId(TARGET),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(TARGET),GetSpellPowerHash()) + NewSPTarget )
endif
call SaveReal(udg_hash,GetHandleId(t),12,NewSPCaster)
call SaveReal(udg_hash,GetHandleId(t),13,NewSPTarget)
endif
if p1 < p2 then
set minP = p1
set diff = p2 - p1
set flag = true
else
set minP = p2
set diff = p1 - p2
set flag = false
endif
if (diff > HP_DIFFERENCE_THRESHOLD) and (GetWidgetLife(TARGET)>0.) and (GetWidgetLife(CASTER)>0.) then
if flag then
call SetWidgetLife(TARGET, GetWidgetLife(TARGET) - GetUnitState(TARGET,UNIT_STATE_MAX_LIFE)*diff/(25*5))
else
call SetWidgetLife(CASTER, GetWidgetLife(CASTER) - GetUnitState(CASTER,UNIT_STATE_MAX_LIFE)*diff/(25*5))
endif
endif
if (dist > BONDS_AOE) and (dist <= BREAK_BONDS_DIST) then
call SetUnitX(CASTER,xCo)
call SetUnitY(CASTER,yCo)
call SetUnitX(TARGET,xTo)
call SetUnitY(TARGET,yTo)
else
call SaveReal(udg_hash,GetHandleId(t),3,xCn)
call SaveReal(udg_hash,GetHandleId(t),4,yCn)
call SaveReal(udg_hash,GetHandleId(t),5,xTn)
call SaveReal(udg_hash,GetHandleId(t),6,yTn)
endif
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),7,Elapsed)
if (dist > BREAK_BONDS_DIST) or (Elapsed >= DURATION) or (not (GetWidgetLife(TARGET)>0.)) or (not (GetWidgetLife(CASTER)>0.)) then
if LastDCaster > 0 then
call BlzSetUnitBaseDamage(CASTER,BlzGetUnitBaseDamage(CASTER,0)-LastDCaster,0)
endif
if LastDTarget > 0 then
call BlzSetUnitBaseDamage(TARGET,BlzGetUnitBaseDamage(TARGET,0)-LastDTarget,0)
endif
if LastACaster > 0 then
call BlzSetUnitArmor(CASTER,BlzGetUnitArmor(CASTER)-LastACaster)
endif
if LastATarget > 0 then
call BlzSetUnitArmor(TARGET,BlzGetUnitArmor(TARGET)-LastATarget)
endif
if LastSPCaster > 0 then
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetSpellPowerHash()) - LastSPCaster )
endif
if LastSPTarget > 0 then
call SaveReal(udg_hash,GetHandleId(TARGET),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(TARGET),GetSpellPowerHash()) - LastSPTarget )
endif
call UnitRemoveAbility(CASTER,ABIL_BUFF)
call UnitRemoveAbility(CASTER,BUFF_CODE)
call UnitRemoveAbility(TARGET,ABIL_BUFF)
call UnitRemoveAbility(TARGET,BUFF_CODE)
call DestroyLightning(LoadLightningHandle(udg_hash,GetHandleId(t),8))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set CASTER = null
set TARGET = null
set t = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = null
local lightning BONDS = null
if (not (GetUnitAbilityLevel(CASTER,BUFF_CODE)>0)) and (not (GetUnitAbilityLevel(TARGET,BUFF_CODE)>0)) then
set t = CreateTimer()
set BONDS = LightningUnit("MYCA", false, CASTER, TARGET, DURATION)
call UnitAddAbility(CASTER,ABIL_BUFF)
call UnitAddAbility(TARGET,ABIL_BUFF)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,TARGET)
call SaveReal(udg_hash,GetHandleId(t),3,GetUnitX(CASTER))
call SaveReal(udg_hash,GetHandleId(t),4,GetUnitY(CASTER))
call SaveReal(udg_hash,GetHandleId(t),5,GetUnitX(TARGET))
call SaveReal(udg_hash,GetHandleId(t),6,GetUnitY(TARGET))
call SaveReal(udg_hash,GetHandleId(t),7,0.)
call SaveLightningHandle(udg_hash,GetHandleId(t),8,BONDS)
call TimerStart(t,0.04,true,function onTimer)
else
call IssueImmediateOrder(CASTER,"stop")
call SimError(GetTriggerPlayer(),"The target already has Malefic Bonds.")
endif
set t = null
set CASTER = null
set TARGET = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conds ) )
call TriggerAddAction(t, function onCast )
set t = null
endfunction
endscope
scope EreticAbilitiesSwitch initializer onInit
globals
private constant integer ABILCODE_ERETIC = 'A07E'
private constant integer ABILCODE_BONEGUARD = 'A07D'
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE_ERETIC or GetSpellAbilityId() == ABILCODE_BONEGUARD
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
if GetSpellAbilityId() == ABILCODE_BONEGUARD then
call AddSpecialEffectTarget("war3mapImported\\DemonicAdornment.mdx",CASTER,"head")
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),ABILCODE_BONEGUARD,false)
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),'A07F',false)
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),'A07C',true)
if not (GetUnitAbilityLevel(CASTER,ABILCODE_ERETIC)>0.) then
call UnitAddAbility(CASTER,ABILCODE_ERETIC)
endif
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),ABILCODE_ERETIC,true)
elseif GetSpellAbilityId() == ABILCODE_ERETIC then
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),ABILCODE_ERETIC,false)
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),'A07C',false)
if not (GetUnitAbilityLevel(CASTER,ABILCODE_BONEGUARD)>0.) then
call UnitAddAbility(CASTER,ABILCODE_BONEGUARD)
endif
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),ABILCODE_BONEGUARD,true)
call SetPlayerAbilityAvailable(GetOwningPlayer(CASTER),'A07F',true)
endif
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope BoneStorm initializer onInit
globals
private constant integer ABILCODE = 'A07C'
private constant integer LORD_CODE = 'u004'
private constant integer ISPREVENTED_HASH = 201
private constant real AOE = 250.
private constant real AFFECTED_PERIOD = 0.5
private constant real MAXSPEED = 600.
private constant real MINMOUSEDIST = 50.
private constant real MAXMOUSEDIST = 1500.
private constant string EFFECT = "Abilities\\Weapons\\MeatwagonMissile\\MeatwagonMissile.mdl"
private constant string ATTACH = "chest"
private constant string CASTER_EFFECT = "null"
private constant string CASTER_ATTACH = "origin"
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit LORD = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),3)
local boolean ISPREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local group g = null
local unit tempu = null
local real manacost = 0.04//(MANA_COST_BASE * GetUnitAbilityLevel(CASTER,ABILCODE) + GetUnitState(CASTER,UNIT_STATE_MAX_MANA) * MANA_COST_PERCENT) / 25.
local real x = GetUnitX(LORD)
local real y = GetUnitY(LORD)
local real xp = GetPlayerMouseX(GetOwningPlayer(CASTER))
local real yp = GetPlayerMouseY(GetOwningPlayer(CASTER))
local real dist = SquareRoot( (x-xp)*(x-xp) + (y-yp)*(y-yp) )
local real h = 0.
local real angle = 0.
local real xnew = 0.
local real ynew = 0.
local timer t1 = null
local real DAMAGE = 0.
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),3,Elapsed)
if GetUnitState(CASTER,UNIT_STATE_MANA)>=manacost then
if dist <= MAXMOUSEDIST and dist >= MINMOUSEDIST then
set angle = Atan2( yp-y,xp-x )
set h = (MAXSPEED/MAXMOUSEDIST)*dist/25. + 100./25.
set xnew = x+h*Cos(angle)
set ynew = y+h*Sin(angle)
//if IsPointPathable(xnew,ynew) then
call SetUnitX(LORD,xnew)
call SetUnitY(LORD,ynew)
//endif
endif
call SetUnitState(CASTER,UNIT_STATE_MANA, GetUnitState(CASTER,UNIT_STATE_MANA)-manacost)
else
call IssueImmediateOrder(CASTER,"stop")
endif
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g, x, y , AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
if not IsUnitInGroup(tempu,AFFECTED) then
call DealPhysicalDamage(CASTER,tempu,DAMAGE)
call GroupAddUnit(AFFECTED,tempu)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,tempu,ATTACH))
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,AFFECTED_PERIOD, false, function onTimerRemoveAffect)
set t1 = null
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if ISPREVENTED then
call FadeUnitIn(LORD, 2.)
//call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),5))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set g = null
set CASTER = null
set LORD = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real x = GetPlayerMouseX(GetOwningPlayer(CASTER))
local real y = GetPlayerMouseY(GetOwningPlayer(CASTER))
local unit LORD = CreateUnit(GetOwningPlayer(CASTER),LORD_CODE,x,y,0.)
call SetUnitAnimation(LORD,"stand")
call SetUnitAnimation(LORD,"attack walk stand spin")
call FadeUnitOut(LORD,2.,false)
call SaveEffectHandle(udg_hash,GetHandleId(t),5,AddSpecialEffectTarget(CASTER_EFFECT,CASTER,CASTER_ATTACH))
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,LORD)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call TimerStart(t,0.04,true,function onTimer)
set CASTER = null
set LORD = null
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
library AkamaTalents initializer onInit requires MapGameplayUtils
globals
constant integer AKAMA_CODE = 'O00C'
private constant integer MAX_TALENTS = 10
private constant integer CORROSIVE_BLAST_CODE = 'A08C'
private constant integer VANISH_CODE = 'A08D'
private constant integer DEEPENDING_SHADOWS_CODE = 'A08E'
private constant integer DANCING_BLADES_CODE = 'A08F'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer CORROSIVE_BLAST_LEVEL_HASH = 250
constant real CORROSIVE_BLAST_EXPERTISE_MULTIPLIER = 0.05
constant real CORROSIVE_BLAST_DAMAGE_MULTIPLIER = 0.15
constant integer VANISH_LEVEL_HASH = 251
constant real VANISH_COMBAT_CHANCE = 10
constant real VANISH_CRIT_STIKE_CHANCE = 1.5
constant integer DEEPENDING_SHADOWS_LEVEL_HASH = 252
constant real DEEPENDING_SHADOWS_MISS_CHANCE = 5
constant real DEEPENDING_SHADOWS_EVASION_CHANCE = 5
constant integer DANCING_BLADES_LEVEL_HASH = 253
constant real DANCING_BLADES_COMBO_DAMAGE_MULTIPLIER = 0.02
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == AKAMA_CODE
endfunction
private function GetCorrosiveBlastDescriptionByLevel takes integer lvl returns string
return "Increases the damage done by Nether Bomb by |c008080C0" + I2S(R2I(CORROSIVE_BLAST_DAMAGE_MULTIPLIER*100*lvl)) +"%|r and makes it reduce affected enemies' armor by |c008080C0" + I2S(R2I(CORROSIVE_BLAST_EXPERTISE_MULTIPLIER*100*lvl)) + "%|r of hero expertise as an armor penetration effect."
endfunction
private function GetVanishDescriptionByLevel takes integer lvl returns string
return "Enveloping Mist has a |c008080C0" + I2S(R2I(VANISH_COMBAT_CHANCE*lvl)) + "%|r chance to immediately make the target out of combat. While Shadowalk is active, Akama gets |c008080C0" + I2S(R2I(VANISH_CRIT_STIKE_CHANCE*lvl)) + "%|r additional critical strike chance."
endfunction
private function GetDeependingShadowsDescriptionByLevel takes integer lvl returns string
return "Enveloping Mist improves the target evasion chance by |c008080C0" + I2S(R2I(DEEPENDING_SHADOWS_EVASION_CHANCE*lvl)) + "%|r. Devouring Shadows makes affected enemies to miss with additional |c008080C0" + I2S(R2I(DEEPENDING_SHADOWS_EVASION_CHANCE*lvl)) + "%|r chance."
endfunction
private function GetDancingBladesDescriptionByLevel takes integer lvl returns string
return "Shadow Blades deals |c008080C0" + I2S(R2I(DANCING_BLADES_COMBO_DAMAGE_MULTIPLIER*100*lvl)) + "%|r additional damage for each Combo level on the enemy unit."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),CORROSIVE_BLAST_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(CORROSIVE_BLAST_CODE, GetCorrosiveBlastDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetCorrosiveBlastDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(CORROSIVE_BLAST_CODE, GetCorrosiveBlastDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),VANISH_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(VANISH_CODE, GetVanishDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetVanishDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(VANISH_CODE, GetVanishDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),DEEPENDING_SHADOWS_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(DEEPENDING_SHADOWS_CODE, GetDeependingShadowsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetDeependingShadowsDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(DEEPENDING_SHADOWS_CODE, GetDeependingShadowsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),DANCING_BLADES_LEVEL_HASH)
if temp < MAX_TALENTS then
call BlzSetAbilityExtendedTooltip(DANCING_BLADES_CODE, GetDancingBladesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetDancingBladesDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(DANCING_BLADES_CODE, GetDancingBladesDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == CORROSIVE_BLAST_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"CORROSIVE_BLAST CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),CORROSIVE_BLAST_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),CORROSIVE_BLAST_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),CORROSIVE_BLAST_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),CORROSIVE_BLAST_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == VANISH_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"VANISH CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),VANISH_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),VANISH_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),VANISH_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),VANISH_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == DEEPENDING_SHADOWS_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"DEEPENDING_SHADOWS CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),DEEPENDING_SHADOWS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),DEEPENDING_SHADOWS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),DEEPENDING_SHADOWS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),DEEPENDING_SHADOWS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == DANCING_BLADES_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"DANCING_BLADES CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),DANCING_BLADES_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),DANCING_BLADES_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),DANCING_BLADES_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),DANCING_BLADES_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function AkamaUnlearnTalents takes unit hero returns nothing
local integer CORROSIVE_BLAST_LEVEL = LoadInteger(udg_hash,GetHandleId(hero), CORROSIVE_BLAST_LEVEL_HASH)
local integer VANISH_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),VANISH_LEVEL_HASH)
local integer DEEPENDING_SHADOWS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),DEEPENDING_SHADOWS_LEVEL_HASH)
local integer DANCING_BLADES_LEVEL = LoadInteger(udg_hash,GetHandleId(hero), DANCING_BLADES_LEVEL_HASH)
local integer sum = CORROSIVE_BLAST_LEVEL+VANISH_LEVEL+DEEPENDING_SHADOWS_LEVEL+DANCING_BLADES_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),CORROSIVE_BLAST_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),VANISH_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),DEEPENDING_SHADOWS_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),DANCING_BLADES_LEVEL_HASH,0)
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
library AkamaComboMechanics
globals
private constant integer AKAMA_COMBO_TIMER_HASH = 221
constant integer AKAMA_COMBO_ABILCODE = 'A088'
private constant integer COMBO_BUFFCODE = 'B02F'
private integer MAX_LEVEL = 6
private real REFRESH_PERIOD = 5.
endglobals
private function onTimerResetCombo takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call UnitRemoveAbility(u,AKAMA_COMBO_ABILCODE)
call UnitRemoveAbility(u,COMBO_BUFFCODE)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
function AddAkamaComboLevel takes unit whichUnit, integer count, integer lim returns nothing
local integer k = GetUnitAbilityLevel(whichUnit,AKAMA_COMBO_ABILCODE)
local timer t = null
if k <= 0 then
call UnitAddAbility(whichUnit,AKAMA_COMBO_ABILCODE)
endif
if k + count <= lim then
call SetUnitAbilityLevel(whichUnit,AKAMA_COMBO_ABILCODE,k+count)
else
if lim > k then
call SetUnitAbilityLevel(whichUnit,AKAMA_COMBO_ABILCODE,lim)
endif
endif
if LoadTimerHandle(udg_hash,GetHandleId(whichUnit),AKAMA_COMBO_TIMER_HASH) == null then
set t = CreateTimer()
call SaveTimerHandle(udg_hash,GetHandleId(whichUnit),AKAMA_COMBO_TIMER_HASH,t)
else
set t = LoadTimerHandle(udg_hash,GetHandleId(whichUnit),AKAMA_COMBO_TIMER_HASH)
endif
call SaveUnitHandle(udg_hash,GetHandleId(t),1,whichUnit)
call TimerStart(t,REFRESH_PERIOD,false,function onTimerResetCombo)
set t = null
endfunction
endlibrary
scope NetherBomb initializer onInit
globals
private constant integer ABILCODE = 'A086'
private constant integer BOMB_CODE = 'h044'
private constant real AOE = 300.
private constant real BLOW_DELAY = 0.75*0.5
private constant real BOMB_LIFETIME = 20.
private constant real FLY_SPEED = 700.
private constant real HEIGHT_SPEED = 300
private constant real BASE_DMG_MULT = 0.7
private constant real LEVEL_DMG_MULT = 0.4
private constant string BLOW_EFFECT = "war3mapImported\\Nether Blast II.mdx"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit BOMB = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real FLYDURATION = LoadReal(udg_hash,GetHandleId(t),3)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local real ang = LoadReal(udg_hash,GetHandleId(t),5)
local boolean ACTIVATED = LoadBoolean(udg_hash,GetHandleId(t),6)
local boolean BLOWED = LoadBoolean(udg_hash,GetHandleId(t),7)
local effect eff = null
local real x = GetUnitX(BOMB)
local real y = GetUnitY(BOMB)
local group g = CreateGroup()
local unit tempu = null
local real ATTACKPOWER = BlzGetUnitBaseDamage(CASTER,0)
local real DAMAGE = ATTACKPOWER * ( BASE_DMG_MULT+LEVEL_DMG_MULT*GetUnitAbilityLevel(CASTER,ABILCODE) )
local integer CORROSIVE_BLAST_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),CORROSIVE_BLAST_LEVEL_HASH)
local integer PENETRATION = R2I(GetHeroAgi(CASTER,true)*CORROSIVE_BLAST_LEVEL*CORROSIVE_BLAST_EXPERTISE_MULTIPLIER)
set DAMAGE = DAMAGE * (1 + CORROSIVE_BLAST_LEVEL*CORROSIVE_BLAST_DAMAGE_MULTIPLIER)
set Elapsed = Elapsed + 0.02
if (Elapsed <= FLYDURATION) and (not ACTIVATED) then
set x = x + (FLY_SPEED/50.)*Cos(ang)
set y = y + (FLY_SPEED/50.)*Sin(ang)
call SetUnitX(BOMB,x)
call SetUnitY(BOMB,y)
if (Elapsed <= FLYDURATION/2.) then
call SetUnitFlyHeight(BOMB, GetUnitFlyHeight(BOMB)+HEIGHT_SPEED/50., 0.)
else
call SetUnitFlyHeight(BOMB,GetUnitFlyHeight(BOMB)-HEIGHT_SPEED/50.,0.)
endif
endif
call SaveReal(udg_hash,GetHandleId(t),4,Elapsed)
set udg_temp_unit = CASTER
if (BLOWED and Elapsed >= BLOW_DELAY) then
call GroupEnumUnitsInRange(g, x, y , AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
call DealPhysicalDamage(CASTER,tempu,DAMAGE)
if CORROSIVE_BLAST_LEVEL > 0 then
call ApplyArmorPenetration(tempu, PENETRATION)
endif
call AddAkamaComboLevel(tempu,1,3)
call RegenerateEnergy(CASTER,1+0.5*GetUnitAbilityLevel(tempu,AKAMA_COMBO_ABILCODE))
call GroupRemoveUnit(g,tempu)
endloop
call RemoveUnit(BOMB)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),8))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
if ACTIVATED and (not BLOWED) then
call GroupEnumUnitsInRange(g, x, y , AOE/1.75, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null or BLOWED
set BLOWED = true
call GroupRemoveUnit(g,tempu)
endloop
if (not BLOWED) and Elapsed >= BOMB_LIFETIME then
set BLOWED = true
endif
if BLOWED then
call SaveBoolean(udg_hash,GetHandleId(t),7,true)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call ShowUnit(BOMB,false)
set eff = AddSpecialEffect(BLOW_EFFECT,x,y)
call BlzSetSpecialEffectScale(eff,0.85)
call BlzSetSpecialEffectTimeScale(eff,2.)
call SaveEffectHandle(udg_hash,GetHandleId(t),8,eff)
endif
endif
call DestroyGroup(g)
if (Elapsed >= FLYDURATION) and (not ACTIVATED) then
call SaveBoolean(udg_hash,GetHandleId(t),6,true)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SetUnitAnimation(BOMB,"birth")
call SetUnitFlyHeight(BOMB,0.,0.)
endif
set t = null
set CASTER = null
set BOMB = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xt = GetSpellTargetX()
local real yt = GetSpellTargetY()
local real ang = Atan2(yt-y,xt-x)
local unit BOMB = CreateUnit(GetOwningPlayer(CASTER),BOMB_CODE,x,y,Rad2Deg(ang))
local real dist = SquareRoot( (x-xt)*(x-xt) + (y-yt)*(y-yt) )
call SetUnitFlyHeight(BOMB,50.,0)
call SetUnitTimeScale(BOMB,1.25)
call SetUnitAnimation(BOMB,"Stand")
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,BOMB)
call SaveReal(udg_hash,GetHandleId(t),3,dist/FLY_SPEED)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveReal(udg_hash,GetHandleId(t),5,ang)
call SaveBoolean(udg_hash,GetHandleId(t),6,false)
call SaveBoolean(udg_hash,GetHandleId(t),7,false)
call TimerStart(t,0.02,true,function onTimer)
set t = null
set CASTER = null
set BOMB = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope Shadowalk initializer onInit
globals
private constant integer ABILCODE = 'A085'
private constant integer BUFFCODE = 'B02E'
private constant real AOE = 250.
private constant real BASE_DMG_MULT = 0.35
private constant real LEVEL_DMG_MULT = 0.15
private constant real AFFECTED_PERIOD = 0.5
private constant real DURATION = 10.
private constant real CHARGE_AFFECT_PERIOD = 1.75
private constant real CHARGE_MIN_DISTANCE = 0.
private constant real CHARGE_MAX_DISTANCE = 800.
private constant integer CHARGE_AFFECT_HASH = 201
private constant integer EFFECT_HASH = 202
private group AFFECTED = CreateGroup()
private group ORDER_GROUP = CreateGroup()
private trigger ORDER_TRIG = null
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),2)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xlast = LoadReal(udg_hash,GetHandleId(t),3)
local real ylast = LoadReal(udg_hash,GetHandleId(t),4)
local group g = CreateGroup()
local unit tempu = null
local timer t1 = null
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),2,Elapsed)
if IsPointPathable(x,y) then
call SaveReal(udg_hash,GetHandleId(t),3,x)
call SaveReal(udg_hash,GetHandleId(t),4,y)
else
if (not (GetUnitAbilityLevel(CASTER,'A08G')>0.)) then
call SetUnitX(CASTER,xlast)
call SetUnitY(CASTER,ylast)
endif
endif
if Elapsed >= DURATION then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(CASTER),EFFECT_HASH))
call SetUnitVertexColor(CASTER,255,255,255,255)
call SetUnitTimeScale(CASTER,1.)
if (not (GetUnitAbilityLevel(CASTER,'A08G')>0.)) then
call SetUnitPathing(CASTER,true)
endif
call AddUnitAnimationProperties(CASTER,"alternate",false)
endif
set t = null
set CASTER = null
set g = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local effect eff = null
local integer VANISH_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),VANISH_LEVEL_HASH)
if not IsUnitInGroup(CASTER,ORDER_GROUP) then
call GroupAddUnit(ORDER_GROUP,CASTER)
call TriggerRegisterUnitEvent(ORDER_TRIG,CASTER,EVENT_UNIT_ISSUED_TARGET_ORDER)
endif
call SaveBoolean(udg_hash,GetHandleId(CASTER),CHARGE_AFFECT_HASH,false)
set eff = AddSpecialEffectTarget("Abilities\\Spells\\Human\\CloudOfFog\\CloudOfFog.mdl",CASTER,"origin")
call SetUnitVertexColor(CASTER,255,255,255,125)
call BlzSetSpecialEffectScale(eff,0.5)
call BlzPlaySpecialEffect(eff, ConvertAnimType(2))
call SetUnitPathing(CASTER,false)
call AddUnitAnimationProperties(CASTER,"alternate",true)
call SaveEffectHandle(udg_hash,GetHandleId(CASTER),EFFECT_HASH,eff)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call SaveReal(udg_hash,GetHandleId(t),3,GetUnitX(CASTER))
call SaveReal(udg_hash,GetHandleId(t),4,GetUnitY(CASTER))
if VANISH_LEVEL > 0 then
call AddHeroParameter(CASTER,VANISH_LEVEL*VANISH_CRIT_STIKE_CHANCE, DURATION, GetCritHash(),"","")
endif
call TimerStart(t,0.04,true,function onTimer)
set t = null
set CASTER = null
set eff = null
endfunction
private function onTimerRemoveChargeAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call SetUnitVertexColor(CASTER,255,255,255,125)
call SaveBoolean(udg_hash,GetHandleId(CASTER),CHARGE_AFFECT_HASH,false)
call FlushChildHashtable(udg_hash,GetHandleId(t))
set t = null
set CASTER = null
endfunction
private function onOrder takes nothing returns boolean
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetOrderTargetUnit()
local timer t = null
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local real d = 0.
local real ang = 0.
local boolean flag = IsUnitEnemy(TARGET,GetOwningPlayer(CASTER)) and (not BlzIsUnitInvulnerable(TARGET))
local integer i = 1
loop
exitwhen i > 6
set flag = (flag or (TARGET==udg_Heroes[i] and (not BlzIsUnitInvulnerable(TARGET))))
set i = i + 1
endloop
if flag and ( (GetIssuedOrderId() == OrderId("attack")) or (GetIssuedOrderId() == OrderId("smart")) ) and (GetUnitAbilityLevel(CASTER,BUFFCODE) > 0) and (not LoadBoolean(udg_hash,GetHandleId(CASTER),CHARGE_AFFECT_HASH) ) then
set d = SquareRoot((x-xt)*(x-xt)+(y-yt)*(y-yt))
if d >= CHARGE_MIN_DISTANCE and d <= CHARGE_MAX_DISTANCE then
set ang = Deg2Rad(GetUnitFacing(TARGET)+180.)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",x,y))
call SetUnitX(CASTER,xt+50*Cos(ang))
call SetUnitY(CASTER,yt+50*Sin(ang))
call AddAkamaComboLevel(TARGET,1,5)
call FadeUnitOut(CASTER,1.,false)
call AddHeroParameter(CASTER,5*GetUnitAbilityLevel(CASTER,ABILCODE), CHARGE_AFFECT_PERIOD, GetCritHash(),"","")
call SaveBoolean(udg_hash,GetHandleId(CASTER),CHARGE_AFFECT_HASH,true)
set t = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,CHARGE_AFFECT_PERIOD,false,function onTimerRemoveChargeAffect)
endif
endif
set CASTER = null
set TARGET = null
set t = null
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set ORDER_TRIG = CreateTrigger()
call TriggerAddCondition( ORDER_TRIG, Condition( function onOrder ) )
set t = null
endfunction
endscope
scope DevouringShadows initializer onInit
globals
private constant integer ABILCODE = 'A083'
private constant integer SHADOW_CODE = 'h043'
private constant real AOE = 500.
private constant real DAMAGE_AOE = 300.
private constant real MIN_AOE = 150.
private constant real BASE_DMG_MULT = 0.3
private constant real LEVEL_DMG_MULT = 0.30
private constant real BASE_SP_DMG_MULT = 0.5
private constant real LEVEL_SP_DMG_MULT = 0.5
private real SHADOW_ANIM_SLOW = 1.5
private real SHADOW_ANIM_PERIOD = 2.
private constant integer SHADOW_ANIM_INDEX = 2
private constant real ALPHA_SPEED = 3.14/25.
private constant real SUCKING_SPEED_COEFF = 0.9
private constant real DURATION = 10.
private constant integer UNIT_SUCK_LIMIT = 15
private constant real DAMAGE_AFFECT_PERIOD = 1.
private constant integer EFFECT_HASH = 220
private constant string EFFECT = "Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl"
private constant string ATTACH = "chest"
private group DAMAGE_AFFECTED = CreateGroup()
private group AFFECTED = CreateGroup()
private real SHADOW_X = 0.
private real SHADOW_Y = 0.
private integer CUR_COUNT = 0
private boolean ENDED = false
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function AffectedForGroup takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetEnumUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real xn = 0.
local real yn = 0.
local real ang = 0.
local real turn_angle = 0.
local real d = SquareRoot( (SHADOW_X-x)*(SHADOW_X-x) + (SHADOW_Y-y)*(SHADOW_Y-y) )
local real h = 0.
if (d > AOE) or (not (GetWidgetLife(u)>0.) ) or ENDED then
call GroupRemoveUnit(AFFECTED,u)
call SetUnitPathing(u,true)
call SetUnitVertexColor(u,255,255,255,255)
call DestroyEffect( LoadEffectHandle(udg_hash,GetHandleId(u),EFFECT_HASH) )
set CUR_COUNT = CUR_COUNT - 1
else
set turn_angle = (0.5*(d/AOE) + 0.5)*ALPHA_SPEED
set xn = SHADOW_X + (x-SHADOW_X) * Cos(turn_angle) - (y-SHADOW_Y)*Sin(turn_angle)
set yn = SHADOW_Y + (x-SHADOW_X) * Sin(turn_angle) + (y-SHADOW_Y)*Cos(turn_angle)
if d > MIN_AOE then
set h = (0.4*(1-d/AOE)+0.6)*GetUnitMoveSpeed(u)*SUCKING_SPEED_COEFF/25.
set ang = Atan2(SHADOW_Y-yn,SHADOW_X-xn)
set xn = xn + h*Cos(ang)
set yn = yn + h*Sin(ang)
endif
call SetUnitX(u,xn)
call SetUnitY(u,yn)
endif
set u = null
endfunction
private function onTimerRemoveDamageAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(DAMAGE_AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit SHADOW = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),3)
local real ElapsedAnim = LoadReal(udg_hash,GetHandleId(t),4)
local boolean AnimForward = LoadBoolean(udg_hash,GetHandleId(t),5)
local real x = GetUnitX(SHADOW)
local real y = GetUnitY(SHADOW)
local real dist = 0.
local effect eff = null
local group g = CreateGroup()
local timer t1 = null
local unit tempu = null
local real ATTACKPOWER = BlzGetUnitBaseDamage(CASTER,0)
local real DAMAGE = ATTACKPOWER * (BASE_DMG_MULT+LEVEL_DMG_MULT*GetUnitAbilityLevel(CASTER,ABILCODE)) + GetUnitSpellPower(CASTER)*(BASE_SP_DMG_MULT+LEVEL_SP_DMG_MULT*GetUnitAbilityLevel(CASTER,ABILCODE))
local integer DEEPENDING_SHADOWS_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),DEEPENDING_SHADOWS_LEVEL_HASH)
set Elapsed = Elapsed + 0.04
if Elapsed >= SHADOW_ANIM_SLOW and Elapsed <= SHADOW_ANIM_SLOW + 0.04 then
call SetUnitTimeScale(SHADOW,0.5)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveBoolean(udg_hash,GetHandleId(t),5,true)
set eff = AddSpecialEffectTarget("DarkHarvest.mdl",SHADOW,"origin")
call SaveEffectHandle(udg_hash,GetHandleId(t),6,eff)
call BlzSetSpecialEffectScale(eff,0.35)
set eff = null
endif
if Elapsed > SHADOW_ANIM_SLOW then
set ElapsedAnim = ElapsedAnim + 0.04
call SaveReal(udg_hash,GetHandleId(t),4,ElapsedAnim)
if ElapsedAnim >= SHADOW_ANIM_PERIOD then
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call SaveBoolean(udg_hash,GetHandleId(t),5, not AnimForward)
if AnimForward then
call SetUnitTimeScale(SHADOW,-0.5)
else
call SetUnitTimeScale(SHADOW,0.5)
endif
endif
endif
call SaveReal(udg_hash,GetHandleId(t),3,Elapsed)
if Elapsed >= SHADOW_ANIM_SLOW then
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g, x, y , AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
if (not IsUnitInGroup(tempu,AFFECTED)) and (CUR_COUNT < UNIT_SUCK_LIMIT) and IsUnitKnockbackable(tempu) then
call GroupAddUnit(AFFECTED,tempu)
set CUR_COUNT = CUR_COUNT + 1
call SetUnitPathing(tempu,false)
call SetUnitVertexColor(tempu,255,255,255,150)
call SaveEffectHandle(udg_hash,GetHandleId(tempu),EFFECT_HASH,AddSpecialEffectTarget(EFFECT,tempu,ATTACH))
endif
set dist = SquareRoot((x-GetUnitX(tempu))*(x-GetUnitX(tempu)) + (y-GetUnitY(tempu))*(y-GetUnitY(tempu)) )
if dist <= DAMAGE_AOE then
if not IsUnitInGroup(tempu,DAMAGE_AFFECTED) then
call GroupAddUnit(DAMAGE_AFFECTED,tempu)
call DealShadowDamage(CASTER,tempu,DAMAGE)
if DEEPENDING_SHADOWS_LEVEL > 0 then
call AddHeroParameter(tempu,DEEPENDING_SHADOWS_LEVEL*DEEPENDING_SHADOWS_MISS_CHANCE,DAMAGE_AFFECT_PERIOD-0.01,GetMissChanceHash(),"Abilities\\Spells\\Other\\Tornado\\Tornado_Target.mdl","chest")
endif
call AddAkamaComboLevel(tempu,1,3)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,DAMAGE_AFFECT_PERIOD,false,function onTimerRemoveDamageAffect)
set t1 = null
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
endif
call DestroyGroup(g)
if Elapsed >= DURATION then
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),6))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call SetUnitTimeScale(SHADOW,0.5)
call KillUnit(SHADOW)
set ENDED = true
endif
set SHADOW_X = x
set SHADOW_Y = y
call ForGroup(AFFECTED, function AffectedForGroup)
set ENDED = false
set t = null
set CASTER = null
set SHADOW = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
local unit SHADOW = CreateUnit(GetOwningPlayer(CASTER),SHADOW_CODE,GetSpellTargetX(),GetSpellTargetY(),270.)
call SetUnitVertexColor(SHADOW,255,255,255,125)
call SetUnitAnimationByIndex(SHADOW,SHADOW_ANIM_INDEX)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,SHADOW)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call TimerStart(t,0.04,true,function onTimer)
set t = null
set CASTER = null
set SHADOW = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope ShadowBlades initializer onInit
globals
private constant integer ABILCODE = 'A087'
private constant integer SHADOW_CODE = 'h043'
private constant string BLADES_CODE = "Poisoned_Daggers.mdl"
private constant real AOE = 250.
private constant real BASE_DMG_MULT = 0.65
private constant real LEVEL_DMG_MULT = 0.35
private constant real AFFECTED_PERIOD = 0.75
private constant real DURATION = 10.
private constant integer EFFECT_HASH = 220
private constant string EFFECT = "Abilities\\Spells\\NightElf\\shadowstrike\\ShadowStrikeMissile.mdl"
private constant string ATTACH = "chest"
private group AFFECTED = CreateGroup()
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),4)
local real x = GetUnitX(TARGET)
local real y = GetUnitY(TARGET)
local group g = CreateGroup()
local unit tempu = null
local real newDMG = 0.
local real ATTACKPOWER = BlzGetUnitBaseDamage(CASTER,0)
local real DAMAGE = ATTACKPOWER * (BASE_DMG_MULT+LEVEL_DMG_MULT*GetUnitAbilityLevel(CASTER,ABILCODE)) + GetUnitSpellPower(CASTER)
local integer DANCING_BLADES_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),DANCING_BLADES_LEVEL_HASH)
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),4,Elapsed)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g, x, y , AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
if not IsUnitInGroup(tempu,AFFECTED) then
set newDMG = DAMAGE*(1+DANCING_BLADES_LEVEL*DANCING_BLADES_COMBO_DAMAGE_MULTIPLIER*GetUnitAbilityLevel(tempu,AKAMA_COMBO_ABILCODE))
call DealPhysicalDamage(CASTER,tempu,newDMG)
call AddAkamaComboLevel(tempu,1,6)
call GroupAddUnit(AFFECTED,tempu)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,tempu,ATTACH))
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,AFFECTED_PERIOD, false, function onTimerRemoveAffect)
set t1 = null
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if (Elapsed >= DURATION) or (not (GetWidgetLife(TARGET)>0.)) then
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(t),3))
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
set TARGET = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local unit TARGET = GetSpellTargetUnit()
local timer t = CreateTimer()
local effect eff = AddSpecialEffectTarget(BLADES_CODE, TARGET, "chest")
call BlzSetSpecialEffectScale(eff,1.5)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,TARGET)
call SaveEffectHandle(udg_hash,GetHandleId(t),3,eff)
call SaveReal(udg_hash,GetHandleId(t),4,0.)
call TimerStart(t,0.04,true,function onTimer)
set t = null
set CASTER = null
set TARGET = null
set eff = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope EnvelopingMist initializer onInit
globals
private constant integer ABILCODE = 'A089'
private constant integer ABIL_BUFF_CODE = 'A08A'
constant integer ENVELOPING_MIST_BUFF_CODE = 'B02G'
private constant real DURATION = 10.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit TARGET = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real Elapsed = LoadReal(udg_hash,GetHandleId(t),2)
local integer DEEPENDING_SHADOWS_LEVEL = LoadInteger(udg_hash,GetHandleId(t),3)
set Elapsed = Elapsed + 0.04
call SaveReal(udg_hash,GetHandleId(t),2,Elapsed)
if (Elapsed >= DURATION) or (not (GetWidgetLife(TARGET)>0.)) then
call UnitRemoveAbility(TARGET,ABIL_BUFF_CODE)
call UnitRemoveAbility(TARGET,ENVELOPING_MIST_BUFF_CODE)
if DEEPENDING_SHADOWS_LEVEL > 0 then
call SaveReal(udg_hash,GetHandleId(TARGET),GetEvasionHash(), LoadReal(udg_hash,GetHandleId(TARGET),GetEvasionHash()) - DEEPENDING_SHADOWS_LEVEL*DEEPENDING_SHADOWS_EVASION_CHANCE )
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set TARGET = null
endfunction
private function onCast takes nothing returns nothing
local unit TARGET = GetSpellTargetUnit()
local timer t = CreateTimer()
local unit CASTER = GetTriggerUnit()
local integer DEEPENDING_SHADOWS_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),DEEPENDING_SHADOWS_LEVEL_HASH)
local integer VANISH_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),VANISH_LEVEL_HASH)
local integer k = 0
call UnitAddAbility(TARGET,ABIL_BUFF_CODE)
if DEEPENDING_SHADOWS_LEVEL > 0 then
call SaveReal(udg_hash,GetHandleId(TARGET),GetEvasionHash(), LoadReal(udg_hash,GetHandleId(TARGET),GetEvasionHash()) + DEEPENDING_SHADOWS_LEVEL*DEEPENDING_SHADOWS_EVASION_CHANCE )
endif
if VANISH_LEVEL > 0 then
set k = GetRandomInt(1,100)
if k <= VANISH_LEVEL*VANISH_COMBAT_CHANCE then
call MakeUnitOutOfCombat(TARGET)
endif
endif
call SaveUnitHandle(udg_hash,GetHandleId(t),1,TARGET)
call SaveReal(udg_hash,GetHandleId(t),2,0.)
call SaveInteger(udg_hash,GetHandleId(t),3,DEEPENDING_SHADOWS_LEVEL)
call TimerStart(t,0.04,true,function onTimer)
set t = null
set TARGET = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
library IronGolemTalents initializer onInit requires MapGameplayUtils
globals
constant integer IRON_GOLEM_CODE = 'O00R'
private constant integer MAX_TALENTS = 10
private constant integer IMPROVED_RECHARGE_CODE = 'A099'
private constant integer HEAVY_ARTILLERY_CODE = 'A09A'
private constant integer PROLONGED_VIBRATIONS_CODE = 'A09B'
private constant integer ADVANCED_HARDWARE_CODE = 'A09C'
private constant integer POWER_CONVERSION_ABILCODE = 'A094'
private constant string LEARN_EFFECT = "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl"
constant integer IMPROVED_RECHARGE_LEVEL_HASH = 250
constant real IMPROVED_RECHARGE_COOLDOWN_LOWERING = 0.1
constant integer IMPROVED_RECHARGE_STACKS_PRESERVING = 1
constant integer HEAVY_ARTILLERY_LEVEL_HASH = 251
constant real HEAVY_ARTILLERY_CHANCE = 0.02
constant real HEAVY_ARTILLERY_DAMAGE = 0.05
constant integer PROLONGED_VIBRATIONS_LEVEL_HASH = 252
constant integer ADVANCED_HARDWARE_LEVEL_HASH = 253
constant integer ADVANCED_HARDWARE_COOLDOWN_LOWERING = 2
constant real ADVANCED_HARDWARE_INACTIVE_LOWERING = 1.
endglobals
private function Conds takes nothing returns boolean
return GetUnitTypeId( GetTriggerUnit() ) == IRON_GOLEM_CODE
endfunction
private function GetImprovedRechargeDescriptionByLevel takes integer lvl returns string
return "Improves recharging of the Defensive System stacks by |c008080C0" + R2SW(IMPROVED_RECHARGE_COOLDOWN_LOWERING*lvl,2,1) + "|r sec. and makes Overcharge preserve upto |c008080C0" + I2S(IMPROVED_RECHARGE_STACKS_PRESERVING*lvl) + "|r of Defensive System stacks."
endfunction
private function GetHeavyArtilleryDescriptionByLevel takes integer lvl returns string
return "Gives a |c008080C0" + I2S(R2I(HEAVY_ARTILLERY_CHANCE*100*lvl)) + "%|r chance that the rocket launched during Rocket Barrage will affect enemies in 300 AOE, dealing increased by |c008080C0" + I2S(R2I(HEAVY_ARTILLERY_DAMAGE*lvl*100)) + "%|r damage and stunning enemies by |c008080C0" + R2SW(0.25*lvl,2,1) + "|r seconds (magical) or decrease their armor value by |c008080C0"+ I2S(2*lvl) + "|r for 5 seconds (physical) depending on the active Defensive System type."
endfunction
private function GetProlongedVibrationsDescriptionByLevel takes integer lvl returns string
return "Reduced the armor value of enemies near the crater appeared after Ground Slam by |c008080C0" + I2S(3*lvl) + "%|r."
endfunction
private function GetAdvancedHardwareDescriptionByLevel takes integer lvl returns string
return "Lowers the cooldown of Power Conversion by |c008080C0" + I2S(ADVANCED_HARDWARE_COOLDOWN_LOWERING*lvl) + "|r seconds and decreases the time of inactive self-defense by |c008080C0"+ I2S(R2I(ADVANCED_HARDWARE_INACTIVE_LOWERING*lvl)) + "|r seconds."
endfunction
private function updateTooltips takes unit whichUnit returns nothing
local integer temp
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),IMPROVED_RECHARGE_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(IMPROVED_RECHARGE_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetImprovedRechargeDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(IMPROVED_RECHARGE_CODE, GetImprovedRechargeDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetImprovedRechargeDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(IMPROVED_RECHARGE_CODE, GetImprovedRechargeDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),HEAVY_ARTILLERY_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(HEAVY_ARTILLERY_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetHeavyArtilleryDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(HEAVY_ARTILLERY_CODE, GetHeavyArtilleryDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetHeavyArtilleryDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(HEAVY_ARTILLERY_CODE, GetHeavyArtilleryDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),PROLONGED_VIBRATIONS_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(PROLONGED_VIBRATIONS_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetProlongedVibrationsDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(PROLONGED_VIBRATIONS_CODE, GetProlongedVibrationsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetProlongedVibrationsDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(PROLONGED_VIBRATIONS_CODE, GetProlongedVibrationsDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
set temp = LoadInteger(udg_hash,GetHandleId(whichUnit),ADVANCED_HARDWARE_LEVEL_HASH)
if temp < MAX_TALENTS then
if temp == 0 then
call BlzSetAbilityExtendedTooltip(ADVANCED_HARDWARE_CODE, "|cffff0000Talent is not learned.|r" + "|n|n|cff80ff80Next Level:|r |n" + GetAdvancedHardwareDescriptionByLevel(temp+1),0)
else
call BlzSetAbilityExtendedTooltip(ADVANCED_HARDWARE_CODE, GetAdvancedHardwareDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |n" + GetAdvancedHardwareDescriptionByLevel(temp+1),0)
endif
else
call BlzSetAbilityExtendedTooltip(ADVANCED_HARDWARE_CODE, GetAdvancedHardwareDescriptionByLevel(temp) + "|n|n|cff80ff80Next Level:|r |cffff0000MAXIMUM|r",0)
endif
endfunction
private function onLearn takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer SPELL = GetSpellAbilityId()
local integer j = 0
if SPELL == IMPROVED_RECHARGE_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"IMPROVED_RECHARGE CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_RECHARGE_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),IMPROVED_RECHARGE_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_RECHARGE_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_RECHARGE_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == HEAVY_ARTILLERY_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"HEAVY_ARTILLERY CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_ARTILLERY_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),HEAVY_ARTILLERY_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_ARTILLERY_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_ARTILLERY_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if SPELL == PROLONGED_VIBRATIONS_CODE then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"PROLONGED_VIBRATIONS CLICKED")
if GetHeroSkillPoints(CASTER) > 0 and LoadInteger(udg_hash,GetHandleId(CASTER),PROLONGED_VIBRATIONS_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),PROLONGED_VIBRATIONS_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),PROLONGED_VIBRATIONS_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
else
if LoadInteger(udg_hash,GetHandleId(CASTER),PROLONGED_VIBRATIONS_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
if (SPELL == ADVANCED_HARDWARE_CODE) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"ADVANCED_HARDWARES CLICKED")
if (GetHeroSkillPoints(CASTER) > 0) and LoadInteger(udg_hash,GetHandleId(CASTER),ADVANCED_HARDWARE_LEVEL_HASH) < MAX_TALENTS then
call ModifyHeroSkillPoints( CASTER, bj_MODIFYMETHOD_SUB, 1 )
call SaveInteger(udg_hash,GetHandleId(CASTER),ADVANCED_HARDWARE_LEVEL_HASH,LoadInteger(udg_hash,GetHandleId(CASTER),ADVANCED_HARDWARE_LEVEL_HASH) + 1 )
call DestroyEffect( AddSpecialEffectTarget(LEARN_EFFECT,CASTER,"origin") )
call updateTooltips(CASTER)
set j = 0
loop
exitwhen j>5
call BlzSetUnitAbilityCooldown(CASTER,POWER_CONVERSION_ABILCODE,j,BlzGetUnitAbilityCooldown(CASTER,POWER_CONVERSION_ABILCODE,j)-ADVANCED_HARDWARE_COOLDOWN_LOWERING)
set j = j + 1
endloop
else
if LoadInteger(udg_hash,GetHandleId(CASTER),ADVANCED_HARDWARE_LEVEL_HASH) < MAX_TALENTS then
call SimError(GetOwningPlayer(CASTER),"Not enough skill points")
else
call SimError(GetOwningPlayer(CASTER),"Talent has reached the maximum level")
endif
endif
endif
set CASTER = null
endfunction
function IronGolemUnlearnTalents takes unit hero returns nothing
local integer j = 0
local integer IMPROVED_RECHARGE_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),IMPROVED_RECHARGE_LEVEL_HASH)
local integer HEAVY_ARTILLERY_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),HEAVY_ARTILLERY_LEVEL_HASH)
local integer PROLONGED_VIBRATIONS_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),PROLONGED_VIBRATIONS_LEVEL_HASH)
local integer ADVANCED_HARDWARE_LEVEL = LoadInteger(udg_hash,GetHandleId(hero),ADVANCED_HARDWARE_LEVEL_HASH)
local integer sum = IMPROVED_RECHARGE_LEVEL+HEAVY_ARTILLERY_LEVEL+PROLONGED_VIBRATIONS_LEVEL+ADVANCED_HARDWARE_LEVEL
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_ADD, sum )
call SaveInteger(udg_hash,GetHandleId(hero),IMPROVED_RECHARGE_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),HEAVY_ARTILLERY_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),PROLONGED_VIBRATIONS_LEVEL_HASH,0)
call SaveInteger(udg_hash,GetHandleId(hero),ADVANCED_HARDWARE_LEVEL_HASH,0)
if GetUnitAbilityLevel(hero,POWER_CONVERSION_ABILCODE) > 0 then
set j = 0
loop
exitwhen j>5
call BlzSetUnitAbilityCooldown(hero,POWER_CONVERSION_ABILCODE,j,BlzGetAbilityCooldown(POWER_CONVERSION_ABILCODE,j))
set j = j + 1
endloop
endif
call updateTooltips(hero)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call updateTooltips(null)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onLearn )
set t = null
endfunction
endlibrary
scope GolemDefensiveSystems initializer onInit
globals
private constant integer ABILCODE_MAGICAL = 'A08X'
private constant integer ABILCODE_PHYSICAL = 'A08Y'
private constant integer ABILCODE_BUFF = 'A08Z'
private constant integer CODE_BUFF = 'B02O'
private integer PREV_SYSTEM = 0 // 0 - no system; 1 - physical system; 2 - magical system
private integer LAST_CHARGES = 0
private integer CURRENT_CHARGES = 0
private real BASE_MANA_COST = 3
private integer MAX_STACKS = 10
private integer BASE_ARMOR_BONUS = 2
private real BASE_RESIST_BONUS = 0.03
private effect SHIELD_EFFECT = null
private string SHIELD_PHYS = "Effect_ShieldBuff_Red.mdx"
private string SHIELD_MAG = "Effect_ShieldBuff_Blue.mdx"
private string SHIELD_ATTACH = "overhead"
private unit GOLEM = null
private constant real CHARGE_PERIOD = 2.
private timer TIMER = null
private constant real TIMER_PERIOD = 0.1
private real CLOCK = 0.
endglobals
private function Conds takes nothing returns boolean
return (GetSpellAbilityId() == ABILCODE_MAGICAL or GetSpellAbilityId() == ABILCODE_PHYSICAL)
endfunction
function GetDefensiveSystemStacks takes nothing returns integer
return CURRENT_CHARGES
endfunction
function GetActiveDefensiveSystem takes nothing returns integer
return PREV_SYSTEM
endfunction
private function ReleaveDefCharges takes nothing returns nothing
if LAST_CHARGES > 0 then
call BlzSetUnitArmor(GOLEM,BlzGetUnitArmor(GOLEM)-BASE_ARMOR_BONUS*LAST_CHARGES)
endif
set LAST_CHARGES = 0
endfunction
private function ReleaveMagCharges takes nothing returns nothing
if LAST_CHARGES > 0 then
call SaveReal(udg_hash,GetHandleId(GOLEM), GetSpellResistHash(), LoadReal(udg_hash,GetHandleId(GOLEM),GetSpellResistHash()) - BASE_RESIST_BONUS*LAST_CHARGES)
endif
set LAST_CHARGES = 0
endfunction
function ReleaseDefensiveSystemCharges takes integer k returns nothing
call UnitRemoveAbility(GOLEM,ABILCODE_BUFF)
call UnitRemoveAbility(GOLEM, CODE_BUFF)
if PREV_SYSTEM == 1 then
call ReleaveDefCharges()
endif
if PREV_SYSTEM == 2 then
call ReleaveMagCharges()
endif
set CURRENT_CHARGES = k
endfunction
private function onTimer takes nothing returns nothing
local integer IMPROVED_RECHARGE_LEVEL = LoadInteger(udg_hash,GetHandleId(GOLEM),IMPROVED_RECHARGE_LEVEL_HASH)
if GetUnitAbilityLevel(GOLEM,POWER_COVNERSION_SELF_BUFF) > 0. then
if GetUnitAbilityLevel(GOLEM, CODE_BUFF) > 0. then
call ReleaseDefensiveSystemCharges(0)
endif
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Defensive System Charge BLOCK after Power Conversion.")
else
set CLOCK = CLOCK + TIMER_PERIOD
if CLOCK >= (CHARGE_PERIOD - IMPROVED_RECHARGE_LEVEL*IMPROVED_RECHARGE_COOLDOWN_LOWERING) then
set CLOCK = 0.
if (GetUnitState(GOLEM, UNIT_STATE_MANA) >= BASE_MANA_COST) and (CURRENT_CHARGES < MAX_STACKS) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Defensive System stack charged.")
set CURRENT_CHARGES = CURRENT_CHARGES + 1
call SetUnitState(GOLEM,UNIT_STATE_MANA,GetUnitState(GOLEM,UNIT_STATE_MANA)-BASE_MANA_COST)
if not (GetUnitAbilityLevel(GOLEM, CODE_BUFF) > 0.) then
call UnitAddAbility(GOLEM,ABILCODE_BUFF)
endif
endif
endif
if (PREV_SYSTEM == 1) and not (CURRENT_CHARGES==LAST_CHARGES) then
call BlzSetUnitArmor(GOLEM,BlzGetUnitArmor(GOLEM)+BASE_ARMOR_BONUS*(CURRENT_CHARGES-LAST_CHARGES))
endif
if (PREV_SYSTEM == 2) and not (CURRENT_CHARGES==LAST_CHARGES) then
call SaveReal(udg_hash,GetHandleId(GOLEM), GetSpellResistHash(), LoadReal(udg_hash,GetHandleId(GOLEM),GetSpellResistHash()) + BASE_RESIST_BONUS*(CURRENT_CHARGES-LAST_CHARGES))
endif
set LAST_CHARGES = CURRENT_CHARGES
if GetUnitAbilityLevel(GOLEM,ABILCODE_BUFF) > 0. then
call SetUnitAbilityLevel(GOLEM,ABILCODE_BUFF,CURRENT_CHARGES)
endif
endif
if not (GetWidgetLife(GOLEM)>0.) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Iron Golem Died. Destroying Timer")
call UnitRemoveAbility(GOLEM, ABILCODE_BUFF)
call UnitRemoveAbility(GOLEM, CODE_BUFF)
call UnitRemoveAbility(GOLEM, POWER_CONVERSION_SELF_AURA)
call UnitRemoveAbility(GOLEM, POWER_COVNERSION_SELF_BUFF)
if PREV_SYSTEM == 1 then
call ReleaveDefCharges()
endif
if PREV_SYSTEM == 2 then
call ReleaveMagCharges()
endif
set CURRENT_CHARGES = 0
set CLOCK = 0
set PREV_SYSTEM = 0
call DestroyTimer(TIMER)
set TIMER = null
call DestroyEffect(SHIELD_EFFECT)
endif
endfunction
private function onCast takes nothing returns nothing
set GOLEM = GetTriggerUnit()
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Defensive System used")
call DestroyEffect(SHIELD_EFFECT)
if not (PREV_SYSTEM == 0) then
set CURRENT_CHARGES = CURRENT_CHARGES / 2
else
set CURRENT_CHARGES = 0
set LAST_CHARGES = 0
endif
if GetSpellAbilityId() == ABILCODE_PHYSICAL then
if PREV_SYSTEM == 2 then
call ReleaveMagCharges()
endif
set PREV_SYSTEM = 1
call UnitRemoveAbility(GOLEM,ABILCODE_PHYSICAL)
call UnitAddAbility(GOLEM,ABILCODE_MAGICAL)
set SHIELD_EFFECT = AddSpecialEffectTarget(SHIELD_PHYS,GOLEM,SHIELD_ATTACH)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Physical Defensive System activated")
endif
if GetSpellAbilityId() == ABILCODE_MAGICAL then
if PREV_SYSTEM == 1 then
call ReleaveDefCharges()
endif
set PREV_SYSTEM = 2
call UnitRemoveAbility(GOLEM,ABILCODE_MAGICAL)
call UnitAddAbility(GOLEM,ABILCODE_PHYSICAL)
set SHIELD_EFFECT = AddSpecialEffectTarget(SHIELD_MAG,GOLEM,SHIELD_ATTACH)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Magical Defensive System activated")
endif
set CLOCK = 0.
if TIMER==null then
set TIMER = CreateTimer()
call TimerStart(TIMER,TIMER_PERIOD,true,function onTimer)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Timer of Defensive System activated")
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope GolemRecharge initializer onInit
globals
private constant integer ABILCODE = 'A090'
private constant real AOE = 300.
private constant real DAMAGE_BASE = 100.
private constant real MANA_BASE_LEVEL = 5.
private constant real MANA_STACK = 5.
private constant real AGGRO_IGNORE_DURATION = 3.
private constant real ATTACK_POWER_BASE = 0.35
private constant real ATTACK_POWER_LEVEL_FACTOR = 0.15
private constant real SPELL_POWER_BASE = 0.35
private constant real SPELL_POWER_LEVEL_FACTOR = 0.15
private constant real DAMAGE_PER_LEVEL_BASE = 200
private constant string DAMAGE_EFFECT = "Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl"
private constant string DAMAGE_ATTACH = "origin"
//real RECHARGE_SKIP_TIME = 0.35
private constant real SKIP_TIME = 0.
private constant real RECHARGE_H = 180.
private constant real RECHARGE_ALPHA = 0.65
private constant integer ISPREVENTED_HASH = 201
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function DamageAround takes unit CASTER, real x, real y, integer k returns nothing
local group g = CreateGroup()
local unit tempu = null
local real DAMAGE = DAMAGE_PER_LEVEL_BASE*GetUnitAbilityLevel(CASTER,ABILCODE)
local real threatD = 0.
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if IsUnitKnockbackable(tempu) then
call SetUnitAnimation(tempu,"death")
endif
if k == 1 then
set DAMAGE = DAMAGE + BlzGetUnitBaseDamage(CASTER,0)*(ATTACK_POWER_BASE+ATTACK_POWER_LEVEL_FACTOR*GetUnitAbilityLevel(CASTER,ABILCODE))
call DealPhysicalDamage(CASTER,tempu,DAMAGE)
endif
if k == 2 then
set DAMAGE = DAMAGE + GetUnitSpellPower(CASTER)*(SPELL_POWER_BASE+SPELL_POWER_LEVEL_FACTOR*GetUnitAbilityLevel(CASTER,ABILCODE))
call DealMagicalDamage(CASTER,tempu,DAMAGE)
endif
/*if not (Aggro.target(tempu)==CASTER) then
set threatD = Aggro.Targetaggro(tempu) - Aggro.get(tempu,CASTER,false)
if threatD >=0. then
call Aggro.add(tempu,CASTER,threatD)
endif
endif
call Aggro.ignoreAggro(tempu,AGGRO_IGNORE_DURATION,CASTER,false)
*/
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolean PREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xn = RECHARGE_H * Cos(Deg2Rad(GetUnitFacing(CASTER)))
local real yn = RECHARGE_H * Sin(Deg2Rad(GetUnitFacing(CASTER)))
local real xe = Cos(RECHARGE_ALPHA)*xn + Sin(RECHARGE_ALPHA)*yn
local real ye = -Sin(RECHARGE_ALPHA)*xn + Cos(RECHARGE_ALPHA)*yn
local integer k = GetActiveDefensiveSystem()
local integer STACKS = GetDefensiveSystemStacks()
local integer IMPROVED_RECHARGE_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),IMPROVED_RECHARGE_LEVEL_HASH)
if k==0 then
set k = GetRandomInt(1,2)
endif
if not PREVENTED then
call RegenerateEnergy(CASTER,MANA_BASE_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)+MANA_STACK*STACKS)
call ReleaseDefensiveSystemCharges(IMPROVED_RECHARGE_LEVEL)
set x = x + xe
set y = y + ye
if k==1 then
call DestroyEffect(AddSpecialEffectTarget("effects\\Ground Slam Fire.mdx",CASTER,"hand right"))
call DamageAround(CASTER,x,y,1)
if GROUND_SLAM_ACTIVATED then
call DamageAround(CASTER,GROUND_SLAM_X,GROUND_SLAM_Y,1)
call DestroyEffect(AddSpecialEffect("effects\\Ground Slam Fire.mdx",GROUND_SLAM_X,GROUND_SLAM_Y))
endif
else
call DamageAround(CASTER,x,y,2)
call DestroyEffect(AddSpecialEffectTarget("effects\\Ground Slam Blue.mdx",CASTER,"hand right"))
if GROUND_SLAM_ACTIVATED then
call DamageAround(CASTER,GROUND_SLAM_X,GROUND_SLAM_Y,2)
call DestroyEffect(AddSpecialEffect("effects\\Ground Slam Blue.mdx",GROUND_SLAM_X,GROUND_SLAM_Y))
endif
endif
endif
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,SKIP_TIME,false,function onTimer)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope GolemRocketBarrage initializer onInit
globals
private constant integer ABILCODE = 'A091'
private constant integer HEAVY_ARTILLERY_STUN_ABILCODE = 'A09D'
private constant integer HEAVY_ARTILLERY_ARMOR_ABILCODE = 'A09E'
//private constant integer DUMMY_ATTACKER = 'h02B'
private constant real AOE = 350.
private constant real AOE_ROCKET = 175.
private constant real MANA_PER_ROCKET = 1.
private constant real ATTACK_POWER_BASE = 0.25
private constant real ATTACK_POWER_LEVEL_FACTOR = 0.08
private constant real SPELL_POWER_BASE = 0.25
private constant real SPELL_POWER_LEVEL_FACTOR = 0.08
private constant real DAMAGE_PER_LEVEL_BASE = 30
private constant string HANDS_EFFECT = "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBase.mdl"//"Abilities\\Spells\\Human\\SunderingBlades\\SunderingBlades.mdl"
private effect EFFECT_HAND_LEFT = null
private effect EFFECT_HAND_RIGHT = null
private integer ROCKET_PHYS_DUMMY = 'h04C'
private integer ROCKET_MAGIC_DUMMY = 'h04D'
private real ROCKET_HEAVY_SCALE = 1.5
real BARRAGE_HAND_H = 160.
real BARRAGE_HEAD_H = 205.
real BARRAGE_HAND_OFFSET = 150.
real BARRAGE_HAND_ANGLE = 0.75
real BARRAGE_HEAD_OFFSET = -20.
real TIMER_PERIOD = 0.1
real TIMER_FLY_ITERATES = 50
real FLY_DURATION_MIN = 0.5
real FLY_DURATION_MAX = 1.
real BARRAGE_SKIP_TIME = 0.35
private constant real SKIP_TIME = 0.25
private constant integer ISPREVENTED_HASH = 202
private group AFFECTED = CreateGroup()
private real AFFECT_PERIOD = 0.5
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function onFinish takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
call SetUnitTimeScale(CASTER,1.)
call DestroyEffect(EFFECT_HAND_LEFT)
call DestroyEffect(EFFECT_HAND_RIGHT)
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,true)
set CASTER = null
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function onTimerMoveRocket takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit ROCKET = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),6)
local real ang = LoadReal(udg_hash,GetHandleId(t),2)
local real vel = LoadReal(udg_hash,GetHandleId(t),3)
local real velh = LoadReal(udg_hash,GetHandleId(t),4)
local integer k = LoadInteger(udg_hash,GetHandleId(t),5)
local boolean flag = LoadBoolean(udg_hash,GetHandleId(t),7)
local real DAMAGE = DAMAGE_PER_LEVEL_BASE*GetUnitAbilityLevel(CASTER,ABILCODE)
local integer HEAVY_ARTILLERY_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_ARTILLERY_LEVEL_HASH)
local unit tempu = null
local real CUR_AOE = AOE_ROCKET
local group g = null
local timer t1 = null
if not (GetWidgetLife(ROCKET)>0.) then
if flag then
set CUR_AOE = 300.
set DAMAGE = DAMAGE*(1.+HEAVY_ARTILLERY_LEVEL*HEAVY_ARTILLERY_DAMAGE)
if k == 1 then
call DummyCastNonTarget(ROCKET,HEAVY_ARTILLERY_ARMOR_ABILCODE,HEAVY_ARTILLERY_LEVEL,"howlofterror")
endif
endif
set udg_temp_unit = CASTER
set g = CreateGroup()
call GroupEnumUnitsInRange(g,GetUnitX(ROCKET),GetUnitY(ROCKET),CUR_AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if (not IsUnitInGroup(tempu,AFFECTED)) or flag then
if k == 1 then
set DAMAGE = DAMAGE + BlzGetUnitBaseDamage(CASTER,0)*(ATTACK_POWER_BASE+ATTACK_POWER_LEVEL_FACTOR*GetUnitAbilityLevel(CASTER,ABILCODE))
call DealPhysicalDamage(CASTER,tempu,DAMAGE)
endif
if k == 2 then
set DAMAGE = DAMAGE + GetUnitSpellPower(CASTER)*(SPELL_POWER_BASE+SPELL_POWER_LEVEL_FACTOR*GetUnitAbilityLevel(CASTER,ABILCODE))
call DealMagicalDamage(CASTER,tempu,DAMAGE)
if flag then
call DummyCastTarget(CASTER,tempu,HEAVY_ARTILLERY_STUN_ABILCODE,HEAVY_ARTILLERY_LEVEL,"thunderbolt")
endif
endif
call GroupAddUnit(AFFECTED,tempu)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,AFFECT_PERIOD,false,function onTimerRemoveAffect)
set t1 = null
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SetUnitX(ROCKET,GetUnitX(ROCKET)+vel*Cos(ang))
call SetUnitY(ROCKET,GetUnitY(ROCKET)+vel*Sin(ang))
call SetUnitFlyHeight(ROCKET,GetUnitFlyHeight(ROCKET)-velh,0.)
endif
set t = null
set ROCKET = null
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolean PREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local unit dummy = null
local integer k = 0
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real x0 = 0
local real y0 = 0
local real xt = LoadReal(udg_hash,GetHandleId(t),2)
local real yt = LoadReal(udg_hash,GetHandleId(t),3)
local real xf = 0
local real yf = 0
local real height = 0
local real alpha = 0
local real h = 0
local timer t1 = null
local real dur = 0.
local real vel = 0.
local real velh = 0.
local real dist = 0.
local real ang = 0.
local integer j = 0
local integer HEAVY_ARTILLERY_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),HEAVY_ARTILLERY_LEVEL_HASH)
local integer p = R2I(HEAVY_ARTILLERY_LEVEL*HEAVY_ARTILLERY_CHANCE*100)
local boolean flag = false
if not PREVENTED then
if GetUnitState(CASTER,UNIT_STATE_MANA)>=MANA_PER_ROCKET then
call SetUnitState(CASTER,UNIT_STATE_MANA,GetUnitState(CASTER,UNIT_STATE_MANA)-MANA_PER_ROCKET)
if GetRandomInt(1,100) <= p then
set flag = true
endif
set k = GetRandomInt(1,3)
set alpha = GetRandomReal(0.,6.28)
set h = GetRandomReal(0.,AOE)
set xf = xt + h*Cos(alpha)
set yf = yt + h*Sin(alpha)
set alpha = Deg2Rad(GetUnitFacing(CASTER))
if k==1 then //Right hand
set x0 = x + BARRAGE_HAND_OFFSET*Cos( alpha + BARRAGE_HAND_ANGLE)
set y0 = y + BARRAGE_HAND_OFFSET*Sin( alpha + BARRAGE_HAND_ANGLE)
set height = BARRAGE_HAND_H
endif
if k==2 then //Left hand
set x0 = x + BARRAGE_HAND_OFFSET*Cos(alpha - BARRAGE_HAND_ANGLE)
set y0 = y + BARRAGE_HAND_OFFSET*Sin(alpha - BARRAGE_HAND_ANGLE)
set height = BARRAGE_HAND_H
endif
if k==3 then //Left hand
set x0 = x + BARRAGE_HEAD_OFFSET*Cos(Deg2Rad(GetUnitFacing(CASTER)))
set y0 = y + BARRAGE_HEAD_OFFSET*Sin(Deg2Rad(GetUnitFacing(CASTER)))
set height = BARRAGE_HEAD_H
endif
set ang = Atan2(yf-y0,xf-x0)
set j = GetActiveDefensiveSystem()
if j==0 then
set j = GetRandomInt(1,2)
endif
if j == 1 then
set dummy = CreateUnit(GetOwningPlayer(CASTER),ROCKET_PHYS_DUMMY,x0,y0,Rad2Deg(ang))
endif
if j == 2 then
set dummy = CreateUnit(GetOwningPlayer(CASTER),ROCKET_MAGIC_DUMMY,x0,y0,Rad2Deg(ang))
endif
//call UnitAddAbility(dummy,'Aave')
//call UnitRemoveAbility(dummy,'Aave')
call SetUnitFlyHeight(dummy,height,0.)
if flag then
call SetUnitScale(dummy,ROCKET_HEAVY_SCALE,ROCKET_HEAVY_SCALE,ROCKET_HEAVY_SCALE)
endif
set dur = GetRandomReal(FLY_DURATION_MIN,FLY_DURATION_MAX)
set dist = SquareRoot( (x0-xf)*(x0-xf) + (y0-yf)*(y0-yf) )
set vel = (dist/dur) / TIMER_FLY_ITERATES
set velh = (height/dur) / TIMER_FLY_ITERATES
call UnitApplyTimedLife(dummy,'BHwe',dur)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1, dummy)
call SaveReal(udg_hash,GetHandleId(t1),2,ang)
call SaveReal(udg_hash,GetHandleId(t1),3,vel)
call SaveReal(udg_hash,GetHandleId(t1),4,velh)
call SaveInteger(udg_hash,GetHandleId(t1),5,j)
call SaveUnitHandle(udg_hash,GetHandleId(t1),6,CASTER)
call SaveBoolean(udg_hash,GetHandleId(t1),7,flag)
call TimerStart(t1,1./TIMER_FLY_ITERATES,true,function onTimerMoveRocket)
set t1 = null
set dummy = null
else
call IssueImmediateOrder(CASTER,"stop")
endif
else
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CASTER = null
endfunction
private function onTimerStart takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolean PREVENTED = LoadBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH)
local timer t1 = null
if not PREVENTED then
set EFFECT_HAND_LEFT = AddSpecialEffectTarget(HANDS_EFFECT,CASTER,"hand left")
set EFFECT_HAND_RIGHT = AddSpecialEffectTarget(HANDS_EFFECT,CASTER,"hand right")
call SetUnitTimeScale(CASTER,0.)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t1),2,LoadReal(udg_hash,GetHandleId(t),2))
call SaveReal(udg_hash,GetHandleId(t1),3,LoadReal(udg_hash,GetHandleId(t),3))
call TimerStart(t1,TIMER_PERIOD,true, function onTimer)
set t1 = null
endif
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local timer t = CreateTimer()
call SaveBoolean(udg_hash,GetHandleId(CASTER),ISPREVENTED_HASH,false)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveReal(udg_hash,GetHandleId(t),2,GetSpellTargetX())
call SaveReal(udg_hash,GetHandleId(t),3,GetSpellTargetY())
call TimerStart(t,BARRAGE_SKIP_TIME,false,function onTimerStart)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t1, Condition( function Conds ) )
call TriggerAddAction( t1, function onFinish )
set t = null
set t1 = null
endfunction
endscope
scope GolemGroundSlam initializer onInit
globals
private constant integer ABILCODE = 'A092'
private constant integer CRATER_DUMMY = 'h04E'
private constant integer ARMOR_ABILCODE = 'A093'
private constant integer PROLONGED_VIBRATIONS_DEBUFF_AURA = 'A09F'
private constant integer PROLONGED_VIBRATIONS_ARMOR_DEBUFF_AURA = 'A09M'
private constant integer SLOW_CODE = 'A09L'
private constant real AGGRO_IGNORE_DURATION = 3.
private constant real AOE = 400.
private constant real CRATER_CREATION_TIME = 0.
private constant real AGGRO_PER_LEVEL = 0.1
private constant real DURATION = 10.
boolean GROUND_SLAM_ACTIVATED = false
real GROUND_SLAM_X = 0.
real GROUND_SLAM_Y = 0.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function GroupFilterAlly takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and (GetWidgetLife(GetFilterUnit())>0.) and (not BlzIsUnitInvulnerable(GetFilterUnit()))
endfunction
private function onTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit CRATER = LoadUnitHandle(udg_hash,GetHandleId(t),2)
local real ELAPSED = LoadReal(udg_hash,GetHandleId(t),3)
//local group g = CreateGroup()
local unit tempu = null
set ELAPSED = ELAPSED + 0.5
call SaveReal(udg_hash,GetHandleId(t),3,ELAPSED)
/*
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CRATER),GetUnitY(CRATER),AOE, function GroupFilterAlly)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not (tempu == CASTER) then
call AddHeroParameter(tempu,-AGGRO_PER_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE),0.49,GetAggroMultiplierHash(),"","")
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
*/
if ELAPSED >= DURATION then
set GROUND_SLAM_ACTIVATED = false
call SetUnitFlyHeight(CRATER,0.,0.)
call RemoveUnit(CRATER)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set CRATER = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer PROLONGED_VIBRATIONS_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),PROLONGED_VIBRATIONS_LEVEL_HASH)
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local real angle = 0.
local unit CRATER = CreateUnit(GetOwningPlayer(CASTER),CRATER_DUMMY,x,y,GetRandomReal(0,360.))
local timer t = CreateTimer()
local group g = CreateGroup()
local unit tempu = null
local real threatD = 0.
local real dist = 0.
set GROUND_SLAM_X = x
set GROUND_SLAM_Y = y
set GROUND_SLAM_ACTIVATED = true
call UnitAddAbility(CRATER,ARMOR_ABILCODE)
call SetUnitAbilityLevel(CRATER,ARMOR_ABILCODE,GetUnitAbilityLevel(CASTER,ABILCODE))
if PROLONGED_VIBRATIONS_LEVEL>0 then
//call UnitAddAbility(CRATER,PROLONGED_VIBRATIONS_DEBUFF_AURA)
//call SetUnitAbilityLevel(CRATER,PROLONGED_VIBRATIONS_DEBUFF_AURA,PROLONGED_VIBRATIONS_LEVEL)
call UnitAddAbility(CRATER,PROLONGED_VIBRATIONS_ARMOR_DEBUFF_AURA)
call SetUnitAbilityLevel(CRATER,PROLONGED_VIBRATIONS_ARMOR_DEBUFF_AURA,PROLONGED_VIBRATIONS_LEVEL)
endif
call DestroyEffect(AddSpecialEffect("effects\\Ground_Slam.mdx",x,y))
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call SaveUnitHandle(udg_hash,GetHandleId(t),2,CRATER)
call SaveReal(udg_hash,GetHandleId(t),3,0.)
call TimerStart(t,0.5,true,function onTimer)
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,x,y,AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if IsUnitKnockbackable(tempu) then
set angle = Rad2Deg(Atan2(y-GetUnitY(tempu),x-GetUnitX(tempu)))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",tempu,"origin"))
set dist = SquareRoot( (GetUnitX(tempu)-x)*(GetUnitX(tempu)-x) + (GetUnitY(tempu)-y)*(GetUnitY(tempu)-y) )
call ParKnock(tempu,300.,dist,0.35,angle,true,"")
call DummyCastTarget(CASTER, tempu, SLOW_CODE, GetUnitAbilityLevel(CASTER,ABILCODE), "slow")
endif
if not (Aggro.target(tempu)==CASTER) then
set threatD = Aggro.Targetaggro(tempu) - Aggro.get(tempu,CASTER,false)
if threatD >=0. then
call Aggro.add(tempu,CASTER,threatD)
endif
endif
call Aggro.ignoreAggro(tempu,AGGRO_IGNORE_DURATION,CASTER,false)
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
set t = null
set CRATER = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
scope GolemPowerConversion initializer onInit
globals
private constant integer ABILCODE = 'A094'
private constant integer AURACODE_MAGICAL = 'A095'
private constant integer BUFFCODE_MAGICAL = 'B02Q'
private constant integer AURACODE_PHYSICAL = 'A096'
private constant integer BUFFCODE_PHYSICAL = 'B02R'
constant integer POWER_CONVERSION_SELF_AURA = 'A097'
constant integer POWER_COVNERSION_SELF_BUFF = 'B02S'
private constant real SHIELD_DURATION_BASE = 10.5
private constant real SHIELD_AMMOUNT_LEVEL = 400.
private constant real STACK_BONUS = 0.1
private constant real SHIELD_MULTIPLIER = 0.8
private constant real AOE = 1000.
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == ABILCODE
endfunction
private function GroupFilterAlly takes nothing returns boolean
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and (GetWidgetLife(GetFilterUnit())>0.) and (not BlzIsUnitInvulnerable(GetFilterUnit()))
endfunction
private function onTimerRemoveBuff takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call UnitRemoveAbility(CASTER, POWER_CONVERSION_SELF_AURA)
call UnitRemoveAbility(CASTER, POWER_COVNERSION_SELF_BUFF)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCast takes nothing returns nothing
local unit CASTER = GetTriggerUnit()
local integer ADVANCED_HARDWARE_LEVEL = LoadInteger(udg_hash,GetHandleId(CASTER),ADVANCED_HARDWARE_LEVEL_HASH)
local timer t = CreateTimer()
local group g = CreateGroup()
local unit tempu = null
local integer STACKS = GetDefensiveSystemStacks()
local real DURATION = SHIELD_DURATION_BASE
local real MULT = SHIELD_MULTIPLIER
local real AMOUNT = SHIELD_AMMOUNT_LEVEL*GetUnitAbilityLevel(CASTER,ABILCODE)*(1.+STACKS*STACK_BONUS)
local integer k = GetActiveDefensiveSystem()
if k==0 then
set k = GetRandomInt(1,2)
endif
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),AOE, function GroupFilterAlly)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if not (tempu == CASTER) then
if k == 1 then
call UnitShield.Add(tempu,CASTER,AMOUNT,DURATION,0,MULT,AURACODE_PHYSICAL,BUFFCODE_PHYSICAL)
endif
if k == 2 then
call UnitShield.Add(tempu,CASTER,AMOUNT,DURATION,1,MULT,AURACODE_MAGICAL,BUFFCODE_MAGICAL)
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
call UnitAddAbility(CASTER, POWER_CONVERSION_SELF_AURA)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,CASTER)
call TimerStart(t,DURATION-ADVANCED_HARDWARE_LEVEL*ADVANCED_HARDWARE_INACTIVE_LOWERING,false,function onTimerRemoveBuff)
set t = null
set CASTER = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onCast )
set t = null
endfunction
endscope
//TESH.scrollpos=9
//TESH.alwaysfold=0
globals
group MAGMA_GROUP = CreateGroup()
endglobals
function Magma_Slam_Acts takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
if MAGMAW_BATTLE_INITIALIZED then
call SetUnitTimeScale( udg_Magmaw, 1. )
if GetWidgetLife(udg_Magmaw) > 0. then
loop
exitwhen i>udg_PlayerCount
call CameraSetEQNoiseForPlayer( udg_Players[i], 15.00 )
set i = i + 1
endloop
endif
call EnableTrigger( gg_trg_Magma_Slam_Acts )
endif
call DestroyTimer(t)
set t = null
endfunction
function Trig_Magma_Slam_Actions takes nothing returns nothing
local timer t = null
if MAGMAW_BATTLE_INITIALIZED then
set t = CreateTimer()
call PauseTimer( udg_Magmaw_Firebreath )
call PauseTimer( udg_Magmaw_Burrow )
set udg_MagS_Effect = AddSpecialEffectTarget( "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl", udg_Magmaw, "head" )
call GroupClear(MAGMA_GROUP)
call SetUnitTimeScale( udg_Magmaw, 0.5 )
call PauseUnit( udg_Magmaw, true )
call SetUnitAnimation( udg_Magmaw, "attack slam" )
set udg_MagS_Degree = GetUnitFacing(udg_Magmaw)
set udg_MagS_Int = 0
call TimerStart(t,2.30,false,function Magma_Slam_Acts)
set t = null
endif
endfunction
//===========================================================================
function InitTrig_Magma_Slam takes nothing returns nothing
set gg_trg_Magma_Slam = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Magma_Slam, udg_Magmaw_Slam )
call TriggerAddAction( gg_trg_Magma_Slam, function Trig_Magma_Slam_Actions )
endfunction
function Trig_Magma_Slam_Acts_Func008001003001001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Magma_Slam_Acts_Func008001003001002 takes nothing returns boolean
return ( IsUnitInGroup(GetFilterUnit(), (MAGMA_GROUP)) == false )
endfunction
function Trig_Magma_Slam_Acts_Func008001003001 takes nothing returns boolean
return GetBooleanAnd( Trig_Magma_Slam_Acts_Func008001003001001(), Trig_Magma_Slam_Acts_Func008001003001002() )
endfunction
function Trig_Magma_Slam_Acts_Func008001003002 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_Magmaw)) == true )
endfunction
function Trig_Magma_Slam_Acts_Func008001003 takes nothing returns boolean
return GetBooleanAnd( Trig_Magma_Slam_Acts_Func008001003001(), Trig_Magma_Slam_Acts_Func008001003002() )
endfunction
function Trig_Magma_Slam_Acts_Func008A takes nothing returns nothing
call GroupAddUnit(MAGMA_GROUP,GetEnumUnit())
call UnitDamageTargetBJ( udg_Magmaw, GetEnumUnit(), 500.00*CURRENT_DIFFICULTY, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call ParKnock(GetEnumUnit(),0.,500,1.,udg_temp_real,true,"none")
endfunction
function Trig_Magma_Slam_Acts_Func011C takes nothing returns boolean
if ( not ( udg_MagS_Int >= 6 ) ) then
return false
endif
return true
endfunction
function Trig_Magma_Slam_Acts_Actions takes nothing returns nothing
if MAGMAW_BATTLE_INITIALIZED then
set udg_LeakPoint[1] = GetUnitLoc(udg_Magmaw)
set udg_LeakPoint[2] = PolarProjectionBJ(udg_LeakPoint[1], 250.00, udg_MagS_Degree)
call CreateNUnitsAtLoc( 1, 'h00J', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[2], bj_UNIT_FACING )
call KillUnit( GetLastCreatedUnit() )
set udg_temp_real = AngleBetweenPoints(udg_LeakPoint[1], udg_LeakPoint[2])
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 4
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[2], ( udg_temp_real + ( 30.00 * I2R(( GetForLoopIndexA() - 2 )) ) ) )
call UnitApplyTimedLifeBJ( 3.50, 'BHwe', GetLastCreatedUnit() )
call ParKnock(GetLastCreatedUnit(),1500.,GetRandomReal(200.,1000.),3.5,udg_temp_real+30.*I2R(GetForLoopIndexA()-2),false,"none")
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set bj_wantDestroyGroup = true
call ForGroupBJ( GetUnitsInRangeOfLocMatching(200.00, udg_LeakPoint[2], Condition(function Trig_Magma_Slam_Acts_Func008001003)), function Trig_Magma_Slam_Acts_Func008A )
set udg_MagS_Degree = ( udg_MagS_Degree + 60.00 )
set udg_MagS_Int = ( udg_MagS_Int + 1 )
if ( Trig_Magma_Slam_Acts_Func011C() ) then
call StartTimerBJ( udg_Magmaw_Slam, false, 20.00 )
call PauseTimerBJ( false, udg_Magmaw_Firebreath )
call PauseTimerBJ( false, udg_Magmaw_Burrow )
call PauseUnitBJ( false, udg_Magmaw )
call DestroyEffect( udg_MagS_Effect )
call ResetUnitAnimation( udg_Magmaw )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_PlayerCount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CameraClearNoiseForPlayer( udg_Players[GetForLoopIndexA()] )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DisableTrigger( GetTriggeringTrigger() )
else
endif
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
endif
endfunction
//===========================================================================
function InitTrig_Magma_Slam_Acts takes nothing returns nothing
set gg_trg_Magma_Slam_Acts = CreateTrigger( )
call DisableTrigger( gg_trg_Magma_Slam_Acts )
call TriggerRegisterTimerEventPeriodic( gg_trg_Magma_Slam_Acts, 0.20 )
call TriggerAddAction( gg_trg_Magma_Slam_Acts, function Trig_Magma_Slam_Acts_Actions )
endfunction
//TESH.scrollpos=7
//TESH.alwaysfold=0
function Magma_Wave_Acts takes nothing returns nothing
local timer t = GetExpiredTimer()
if MAGMAW_BATTLE_INITIALIZED then
call AttachSoundToUnit(gg_snd_FrostwyrmPissed2,udg_Magmaw)
call SetSoundVolume(gg_snd_FrostwyrmPissed2,127)
call StartSound(gg_snd_FrostwyrmPissed2)
call SetUnitTimeScale( udg_Magmaw, 1. )
call EnableTrigger( gg_trg_Magma_Wave_Acts )
endif
call DestroyTimer(t)
set t = null
endfunction
function Trig_Magma_Wave_Actions takes nothing returns nothing
local timer t = null
if MAGMAW_BATTLE_INITIALIZED then
set t = CreateTimer()
call PauseTimer( udg_Magmaw_Slam )
call PauseTimer( udg_Magmaw_Burrow )
set udg_MagS_Effect = AddSpecialEffectTarget( "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl",udg_Magmaw,"head" )
call SetUnitTimeScale( udg_Magmaw, 0.5 )
call PauseUnit( udg_Magmaw,true )
call SetUnitAnimation( udg_Magmaw, "spell throw" )
set udg_MagS_Degree = ( GetUnitFacing(udg_Magmaw) + 75.00 )
if udg_MagS_Degree >= 360. then
set udg_MagS_Degree = udg_MagS_Degree - 360.
endif
set udg_MagS_Int = 0
call TimerStart(t,1.40,false,function Magma_Wave_Acts)
set t = null
endif
endfunction
//===========================================================================
function InitTrig_Magma_Wave takes nothing returns nothing
set gg_trg_Magma_Wave = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Magma_Wave, udg_Magmaw_Firebreath )
call TriggerAddAction( gg_trg_Magma_Wave, function Trig_Magma_Wave_Actions )
endfunction
//TESH.scrollpos=17
//TESH.alwaysfold=0
function Magma_Wave_Ends takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
local real baseAng = 30./udg_PlayersInGame
if MAGMAW_BATTLE_INITIALIZED then
call ShowUnit(udg_Magmaw, false)
set udg_LeakPoint[1] = GetUnitLoc(udg_Magmaw)
call CreateNUnitsAtLoc( 1, 'h00J', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[1], bj_UNIT_FACING )
call KillUnit(bj_lastCreatedUnit)
call SetTerrainTypeBJ( udg_LeakPoint[1], 'Dlvc', -1, 2, 0 )
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl",udg_LeakPoint[1]) )
loop
exitwhen i > udg_PlayersInGame
call CreateNUnitsAtLoc( 1, 'h00K', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[1], 0.00 )
call UnitApplyTimedLifeBJ( 2.00, 'BHwe', GetLastCreatedUnit() )
call ParKnock(GetLastCreatedUnit(),1000.,GetRandomReal(350.,1000.),2.,GetUnitFacing(udg_Magmaw)+baseAng*I2R(i-2),false,"none")
set i = i + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
endif
call DestroyTimer(t)
set t = null
endfunction
function Trig_Magma_Wave_Acts_Actions takes nothing returns nothing
local timer t = null
if MAGMAW_BATTLE_INITIALIZED then
set udg_LeakPoint[1] = GetUnitLoc(udg_Magmaw)
set udg_LeakPoint[2] = PolarProjectionBJ(udg_LeakPoint[1], 175.00, udg_MagS_Degree)
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"MAGMAW: (" +R2S(GetUnitX(udg_Magmaw)) + "," + R2S(GetUnitY(udg_Magmaw)) +"). Facing: " + R2S(GetUnitFacing(udg_Magmaw)))
call CreateNUnitsAtLoc( 1, 'h00I', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[2], udg_MagS_Degree )
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"LOC["+ I2S(udg_MagS_Int)+"] : (" + R2S(GetLocationX(udg_LeakPoint[2])) + "," + R2S(GetLocationY(udg_LeakPoint[2])) + "). Facing: " + R2S(udg_MagS_Degree))
call SaveReal(udg_hash,GetHandleId(bj_lastCreatedUnit),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(udg_Magmaw),GetSpellPowerHash()))
call GroupAddUnit(DPS_GROUP,bj_lastCreatedUnit)
call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 2.50 )
call ParKnock(bj_lastCreatedUnit,0.,1000.,2.,udg_MagS_Degree,false,"none")
set udg_MagS_Int = ( udg_MagS_Int + 1 )
if udg_MagS_Int <= 5 then
set udg_MagS_Degree = ( udg_MagS_Degree - 37.50 )
if udg_MagS_Degree < 0. then
set udg_MagS_Degree = udg_MagS_Degree + 360.
endif
else
set udg_MagS_Degree = ( udg_MagS_Degree + 37.50 )
if udg_MagS_Degree >= 360. then
set udg_MagS_Degree = udg_MagS_Degree - 360.
endif
endif
if udg_MagS_Int == 5 then
if udg_Magmaw_IsBurrow then
call DestroyEffect( udg_MagS_Effect )
call DisableTrigger( GetTriggeringTrigger() )
call SetUnitAnimation( udg_Magmaw, "morph" )
set udg_Magmaw_BurTimes = ( udg_Magmaw_BurTimes + 1 )
call StartTimerBJ( udg_Magmaw_Burow2, false, 2.00 )
set t = CreateTimer()
call TimerStart(t,1.30,false,function Magma_Wave_Ends)
else
call StartTimerBJ( udg_Magmaw_Firebreath, false, 10.00 )
call ResumeTimer( udg_Magmaw_Slam )
call ResumeTimer( udg_Magmaw_Burrow )
call PauseUnit( udg_Magmaw,false )
call DestroyEffect( udg_MagS_Effect )
call SetUnitAnimation(udg_Magmaw, "stand")
call DisableTrigger( GetTriggeringTrigger() )
endif
endif
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
set t = null
endif
endfunction
//===========================================================================
function InitTrig_Magma_Wave_Acts takes nothing returns nothing
set gg_trg_Magma_Wave_Acts = CreateTrigger( )
call DisableTrigger( gg_trg_Magma_Wave_Acts )
call TriggerRegisterTimerEventPeriodic( gg_trg_Magma_Wave_Acts, 0.25 )
call TriggerAddAction( gg_trg_Magma_Wave_Acts, function Trig_Magma_Wave_Acts_Actions )
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
function Magma_BurrowActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i
if MAGMAW_BATTLE_INITIALIZED then
call ShowUnit(udg_Magmaw,false)
set udg_LeakPoint[1] = GetUnitLoc(udg_Magmaw)
call CreateNUnitsAtLoc( 1, 'h00J', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[1], bj_UNIT_FACING )
call KillUnit( bj_lastCreatedUnit )
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl", udg_LeakPoint[1]) )
call SetTerrainTypeBJ( udg_LeakPoint[1], 'Dlvc', -1, 2, 0 )
set i = 1
loop
exitwhen i > 20
call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[1], 0.00 )
call UnitApplyTimedLife(bj_lastCreatedUnit , 'BHwe', 3.50 )
call ParKnock(bj_lastCreatedUnit,1000.,GetRandomReal(350.,1500.),3.5,36.*I2R(i),false,"none")
set i = i + 1
endloop
call RemoveLocation(udg_LeakPoint[1])
set i = 1
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
set i = i + 1
endloop
endif
call DestroyTimer(t)
set t = null
endfunction
function Trig_Magma_Burrow_Actions takes nothing returns nothing
local integer i = 1
local timer t = null
if MAGMAW_BATTLE_INITIALIZED then
set t = CreateTimer()
call PauseTimer( udg_Magmaw_Slam )
call PauseTimer( udg_Magmaw_Firebreath )
set udg_Magmaw_IsBurrow = true
set udg_Magmaw_BurTimes = 0
loop
exitwhen i > 8
set udg_MagmawLocVisited[i] = false
set i = i + 1
endloop
set i = 1
loop
exitwhen i > udg_PlayerCount
call CameraSetEQNoiseForPlayer( udg_Players[i], 15.00 )
set i = i + 1
endloop
call PauseUnit( udg_Magmaw,true)
call SetUnitAnimation( udg_Magmaw, "morph" )
call StartTimerBJ( udg_Magmaw_Burow2, false, 5.00 )
call TimerStart(t,1.30,false,function Magma_BurrowActs)
set t = null
endif
endfunction
//===========================================================================
function InitTrig_Magma_Burrow takes nothing returns nothing
set gg_trg_Magma_Burrow = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Magma_Burrow, udg_Magmaw_Burrow )
call TriggerAddAction( gg_trg_Magma_Burrow, function Trig_Magma_Burrow_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Burrow_Move_One takes nothing returns nothing
local timer t = GetExpiredTimer()
if MAGMAW_BATTLE_INITIALIZED then
call PauseUnit(udg_Magmaw, false )
call SetUnitAnimation(udg_Magmaw, "stand")
endif
call DestroyTimer(t)
set t = null
endfunction
function Burrow_Move_Two takes nothing returns nothing
local timer t = GetExpiredTimer()
if MAGMAW_BATTLE_INITIALIZED then
call TriggerExecute( gg_trg_Magma_Wave )
endif
call DestroyTimer(t)
set t = null
endfunction
function VolcanoBoulderGroupFilter takes nothing returns boolean
return (IsUnitEnemy(GetFilterUnit(), Player(7))) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0) and ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction
function VolcanoBoulderActs takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit tempu = null
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local group g = CreateGroup()
call GroupEnumUnitsInRange(g,x,y,225.,Condition(function VolcanoBoulderGroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call UnitDamageTarget(u,tempu,300+GetUnitSpellPower(udg_Magmaw),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
call DestroyTimer(t)
set u = null
set tempu = null
set g = null
endfunction
function VolcanoOnTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit vol = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local unit temp = null
if GetWidgetLife(vol) > 0. and MAGMAW_BATTLE_INITIALIZED then
set temp = CreateUnit(Player(7),'h01Z',GetUnitX(vol),GetUnitY(vol),0.)
call UnitApplyTimedLife(temp,'BHwe',2.5)
call ParKnock(temp,GetRandomReal(300.,500.),GetRandomReal(100.,300),2.5,GetRandomReal(0.,360.),false,"none")
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,temp)
call TimerStart(t1,2.5,false,function VolcanoBoulderActs)
set t1 = null
set temp = null
else
if not MAGMAW_BATTLE_INITIALIZED then
call KillUnit(vol)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set vol = null
endfunction
function VolcanoActivate takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit vol = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local timer t1 = null
if MAGMAW_BATTLE_INITIALIZED then
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,vol)
call TimerStart(t1,0.33,true,function VolcanoOnTimer)
call FlushChildHashtable(udg_hash,GetHandleId(t))
set t1 = null
else
call KillUnit(vol)
endif
call DestroyTimer(t)
set t = null
set vol = null
endfunction
function Trig_Magma_Burrow_Move_Actions takes nothing returns nothing
local timer t = null
local timer t1 = null
local integer j = 0
local unit vol = null
if MAGMAW_BATTLE_INITIALIZED then
set t = CreateTimer()
if udg_Magmaw_BurTimes >= 5 then
call StartTimerBJ( udg_Magmaw_Burrow, false, 60.00 )
call ResumeTimer( udg_Magmaw_Slam )
call ResumeTimer( udg_Magmaw_Firebreath )
set udg_Magmaw_IsBurrow = false
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSum)
call SetUnitPositionLocFacingBJ( udg_Magmaw, udg_LeakPoint[1], 270.00 )
call ShowUnit( udg_Magmaw,true )
call SetUnitAnimation( udg_Magmaw, "morph alternate" )
call RemoveLocation(udg_LeakPoint[1])
call TimerStart(t,3.0,false,function Burrow_Move_One)
else
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSpawn_1)
set udg_LeakPoint[2] = GetRectCenter(gg_rct_MagmarSpawn_2)
set udg_LeakPoint[3] = GetRectCenter(gg_rct_MagmarSpawn_3)
set udg_LeakPoint[4] = GetRectCenter(gg_rct_MagmarSpawn_4)
set udg_LeakPoint[5] = GetRectCenter(gg_rct_MagmarSpawn_5)
set udg_LeakPoint[6] = GetRectCenter(gg_rct_MagmarSpawn_6)
set udg_LeakPoint[7] = GetRectCenter(gg_rct_MagmarSpawn_7)
set udg_LeakPoint[8] = GetRectCenter(gg_rct_MagmarSpawn_8)
set udg_LeakPoint[9] = GetRectCenter(gg_rct_MagmarSum)
set j = GetRandomInt(1, 8)
loop
exitwhen not udg_MagmawLocVisited[j]
set j = GetRandomInt(1, 8)
endloop
set udg_MagmawLocVisited[j] = true
call SetUnitPositionLocFacingLocBJ( udg_Magmaw, udg_LeakPoint[j], udg_LeakPoint[9] )
call ShowUnit( udg_Magmaw, true)
call SetUnitAnimation( udg_Magmaw, "morph alternate" )
set vol = CreateUnit(Player(7),'h01Y',GetLocationX(udg_LeakPoint[j]),GetLocationY(udg_LeakPoint[j]),0.)
call SetUnitTimeScale(vol,5./3.12)
call SetUnitAnimation(vol,"birth")
call UnitApplyTimedLife(vol,'BHwe',25.+5*CURRENT_DIFFICULTY)
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,vol)
call TimerStart(t1, 3.12, false, function VolcanoActivate)
set udg_LeakPoint[10] = GetUnitLoc(udg_Magmaw)
call RemoveLocation(udg_LeakPoint[1])
call RemoveLocation(udg_LeakPoint[2])
call RemoveLocation(udg_LeakPoint[3])
call RemoveLocation(udg_LeakPoint[4])
call RemoveLocation(udg_LeakPoint[5])
call RemoveLocation(udg_LeakPoint[6])
call RemoveLocation(udg_LeakPoint[7])
call RemoveLocation(udg_LeakPoint[8])
call RemoveLocation(udg_LeakPoint[9])
call RemoveLocation(udg_LeakPoint[10])
call TimerStart(t,3.0,false,function Burrow_Move_Two)
set vol = null
set t1 = null
endif
set t = null
endif
endfunction
//===========================================================================
function InitTrig_Magma_Burrow_Move takes nothing returns nothing
set gg_trg_Magma_Burrow_Move = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Magma_Burrow_Move, udg_Magmaw_Burow2 )
call TriggerAddAction( gg_trg_Magma_Burrow_Move, function Trig_Magma_Burrow_Move_Actions )
endfunction
function Trig_Damage_Stone_Actions takes nothing returns nothing
local unit u = null
if MAGMAW_BATTLE_INITIALIZED then
if GetUnitTypeId(GetTriggerUnit()) == 'h00G' then
set udg_LeakPoint[10] = GetUnitLoc(GetTriggerUnit())
set u = CreateUnit( GetOwningPlayer(udg_Magmaw), 'h00L', GetLocationX(udg_LeakPoint[10]), GetLocationY(udg_LeakPoint[10]),0. )
call GroupAddUnit(DPS_GROUP,u)
call SaveReal(udg_hash,GetHandleId(u),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(udg_Magmaw),GetSpellPowerHash())/2.)
if udg_Magmaw_IsBurrow then
call UnitApplyTimedLifeBJ( 30.00+5*CURRENT_DIFFICULTY, 'BHwe', u )
else
call UnitApplyTimedLifeBJ( 15.00+5*CURRENT_DIFFICULTY, 'BHwe', u )
endif
call SetUnitAnimation( u, "birth" )
call RemoveLocation(udg_LeakPoint[10])
else
if GetUnitTypeId(GetTriggerUnit()) == 'h00K' then
set udg_LeakPoint[10] = GetUnitLoc(GetTriggerUnit())
call CreateNUnitsAtLoc( 1, 'n003', GetOwningPlayer(udg_Magmaw), udg_LeakPoint[10], bj_UNIT_FACING )
call Aggro.new(GetLastCreatedUnit())
call SetUnitAnimation( GetLastCreatedUnit(), "birth" )
call RemoveLocation(udg_LeakPoint[10])
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_Damage_Stone takes nothing returns nothing
set gg_trg_Damage_Stone = CreateTrigger( )
call DisableTrigger( gg_trg_Damage_Stone )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Damage_Stone, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Damage_Stone, function Trig_Damage_Stone_Actions )
endfunction
function Trig_Magmaw_defeat_Conditions takes nothing returns boolean
if ( not ( GetTriggerUnit() == udg_Magmaw ) ) then
return false
endif
return true
endfunction
function MagmawDefeatSummonFilter takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'n003' or GetUnitTypeId(GetFilterUnit())=='h00L'
endfunction
function MagmawDefeatKillSummons takes nothing returns nothing
call KillUnit( GetEnumUnit() )
endfunction
function Trig_Magmaw_defeat_Actions takes nothing returns nothing
local integer i = 1
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_3458" )
call SetUnitTimeScalePercent( udg_Magmaw, 35.00 )
set MAGMAW_BATTLE_INITIALIZED = false
set IS_BOSS_BATTLE = false
set IS_HEROES_IN_COMBAT = false
set MAGMAW_DEFEATED = true
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSum)
set bj_wantDestroyGroup = true
call ForGroupBJ( GetUnitsInRangeOfLocMatching(3000.00, udg_LeakPoint[1], Filter(function MagmawDefeatSummonFilter)), function MagmawDefeatKillSummons )
call RemoveLocation(udg_LeakPoint[1])
set i = 1
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
if RectContainsUnit( gg_rct_MoltenCoreBOUNDS, udg_Heroes[i]) then
call BoundPlayerUnitCameraToRect(udg_Heroes[i],gg_rct_MoltenCoreBOUNDS,false)
endif
//call SetCameraBoundsToRectForPlayerBJ( udg_Players[GetForLoopIndexA()], gg_rct_MoltenCoreBOUNDS )
set i = i + 1
endloop
call DestroyTimer( udg_Magmaw_Burrow )
call DestroyTimer( udg_Magmaw_Firebreath )
call DestroyTimer( udg_Magmaw_Slam )
call RemoveDestructable( gg_dest_YTpc_2868 )
call RemoveDestructable( gg_dest_YTpc_2869 )
call EnableTrigger( gg_trg_chapter2_teleport )
call EnableTrigger( gg_trg_Molten_Core_Teleport )
call DestroyTrigger( gg_trg_Magma_Burrow )
call DestroyTrigger( gg_trg_Magma_Burrow_Move )
call DestroyTrigger( gg_trg_Magma_Slam )
call DestroyTrigger( gg_trg_Magma_Slam_Acts )
call DestroyTrigger( gg_trg_Magma_Wave )
call DestroyTrigger( gg_trg_Magma_Wave_Acts )
call DestroyTrigger( gg_trg_Damage_Stone )
call GroupClear( udg_BOSSENCOUNTER_Group )
call DestroyGroup(MAGMA_GROUP)
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_Magmaw_defeat takes nothing returns nothing
set gg_trg_Magmaw_defeat = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Magmaw_defeat, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Magmaw_defeat, Condition( function Trig_Magmaw_defeat_Conditions ) )
call TriggerAddAction( gg_trg_Magmaw_defeat, function Trig_Magmaw_defeat_Actions )
endfunction
library MagmawBattleGroup initializer onInit requires PlayerCameraBound, HeroRevival
globals
boolean MAGMAW_BATTLE_INITIALIZED = false
boolean MAGMAW_SUMMONED = false
group MAGMAW_BATTLEGROUP = CreateGroup()
boolean MAGMAW_DEFEATED = false
private integer ENRAGE_ABILCODE = 'A09O'
private timer ENRAGE_TIMER = null
private real ENRAGE_STACK_PERIOD = 40.
endglobals
private function CheckDeadUnits takes nothing returns nothing
if GetEnumUnit()==null or not (GetWidgetLife(GetEnumUnit())>0.) or IsUnitType(GetEnumUnit(), UNIT_TYPE_DEAD) then
call GroupRemoveUnit(MAGMAW_BATTLEGROUP,GetEnumUnit())
endif
endfunction
private function MagmawSummonFilter takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'n003' or GetUnitTypeId(GetFilterUnit())=='h00L'
endfunction
private function KillSummons takes nothing returns nothing
call KillUnit( GetEnumUnit() )
endfunction
private function onTimerEnrage takes nothing returns nothing
call SetUnitAbilityLevel(udg_Magmaw, ENRAGE_ABILCODE, GetUnitAbilityLevel(udg_Magmaw,ENRAGE_ABILCODE)+ 1)
endfunction
private function onTimer takes nothing returns nothing
local integer i = 1
local integer j = 1
if MAGMAW_DEFEATED then
call DestroyTimer(GetExpiredTimer())
call DestroyGroup(MAGMAW_BATTLEGROUP)
endif
if MAGMAW_BATTLE_INITIALIZED then
if ENRAGE_TIMER == null then
set ENRAGE_TIMER = CreateTimer()
call TimerStart(ENRAGE_TIMER, ENRAGE_STACK_PERIOD, true, function onTimerEnrage)
endif
call ForGroup(MAGMAW_BATTLEGROUP, function CheckDeadUnits)
if CountUnitsInGroup(MAGMAW_BATTLEGROUP)==0 and GetWidgetLife(udg_Magmaw)>0. then
set j = 1
loop
exitwhen j > udg_PlayerCount
if IsUnitDeadBX(udg_Heroes[j]) then
call ImmediatelyReviveHero(udg_Heroes[j])
endif
set j = j + 1
endloop
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5.,"All heroes are dead. Resetting |c00FF0000Magmaw'|r battleground...")
set MAGMAW_BATTLE_INITIALIZED = false
set IS_BOSS_BATTLE = false
call SetUnitAbilityLevel(udg_Magmaw, ENRAGE_ABILCODE, 1)
call DestroyTimer(ENRAGE_TIMER)
set ENRAGE_TIMER = null
call DestroyEffect(udg_MagS_Effect)
call EnableTrigger( gg_trg_Molten_Core_Teleport )
call EnableTrigger( gg_trg_Molten_Core_Teleport_Back )
call PauseTimer(udg_Magmaw_Firebreath)
call PauseTimer(udg_Magmaw_Slam)
call PauseTimer(udg_Magmaw_Burrow)
call UnitRemoveBuffs(udg_Magmaw,true,true)
call SetUnitTimeScale(udg_Magmaw,1.)
call ResetUnitAnimation( udg_Magmaw )
call SetUnitAnimation(udg_Magmaw, "stand")
call PauseUnit(udg_Magmaw,false)
call SetUnitLifePercentBJ( udg_Magmaw, 100 )
call Aggro.clear(udg_Magmaw,null)
set udg_LeakPoint[1] = GetRectCenter(gg_rct_MagmarSum)
call SetUnitPositionLocFacingBJ( udg_Magmaw, udg_LeakPoint[1], 270.00 )
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
set i = i + 1
endloop
call ShowUnit( udg_Magmaw, true )
set udg_Magmaw_IsBurrow = false
set bj_wantDestroyGroup = true
call ForGroupBJ( GetUnitsInRangeOfLocMatching(3000.00, udg_LeakPoint[1], Filter(function MagmawSummonFilter)), function KillSummons )
call RemoveLocation(udg_LeakPoint[1])
endif
if not (GetWidgetLife(udg_Magmaw)>0.) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Magmaw is Dead. Destroying this timer...")
call DestroyTimer(GetExpiredTimer())
call DestroyGroup(MAGMAW_BATTLEGROUP)
endif
else
if MAGMAW_SUMMONED then
call SetUnitLifePercentBJ( udg_Magmaw, 100 )
call SetUnitManaPercentBJ( udg_Magmaw, 100 )
call PauseUnitBJ( false, udg_Magmaw )
endif
endif
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() and not IsUnitInGroup(GetTriggerUnit(), MAGMAW_BATTLEGROUP) then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local integer i = 1
if not MAGMAW_DEFEATED then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"|cff80ff80" + GetUnitName(GetTriggerUnit()) + "|r enters Magmaw battlefield")
call GroupAddUnit(MAGMAW_BATTLEGROUP, GetTriggerUnit())
call BoundPlayerUnitCameraToRect(GetTriggerUnit(),gg_rct_MagmawBattlefield,false)
endif
if MAGMAW_SUMMONED and not MAGMAW_BATTLE_INITIALIZED and not MAGMAW_DEFEATED then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5.,"|c00FF0000Magmaw'|r battleground activated.")
call DisableTrigger( gg_trg_Molten_Core_Teleport )
call DisableTrigger( gg_trg_Molten_Core_Teleport_Back )
call StartTimerBJ( udg_Magmaw_Firebreath, false, 10.00 )
call StartTimerBJ( udg_Magmaw_Slam, false, 20.00 )
call StartTimerBJ( udg_Magmaw_Burrow, false, 60.00 )
set MAGMAW_BATTLE_INITIALIZED = true
set IS_BOSS_BATTLE = true
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple(t, gg_rct_MagmawBattlefield )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onEnter )
call TimerStart(CreateTimer(),1.,true,function onTimer)
set t = null
endfunction
endlibrary
//TESH.scrollpos=43
//TESH.alwaysfold=0
scope ChaosMeteor
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),Player(7)) and GetWidgetLife(GetFilterUnit())>0. and not(GetUnitAbilityLevel(GetFilterUnit(),'B00B')>0)
endfunction
private function BouncingBoulderOnTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit boulder = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local real SPower = LoadReal(udg_hash,GetHandleId(t),2)
local integer times = LoadInteger(udg_hash,GetHandleId(t),3)
local real nextBounceTime = 0.
local real angle = 0.
set times = times + 1
call SaveInteger(udg_hash,GetHandleId(t),3,times)
call SetUnitScale(boulder,1.8-0.1*I2R(times),1.8-0.1*I2R(times),1.8-0.1*I2R(times))
set udg_temp_unit = CreateUnit(Player(7),'h027',GetUnitX(boulder),GetUnitY(boulder),0.)
call SetUnitScale(udg_temp_unit,1.1-0.1*I2R(times),1.1-0.1*I2R(times),1.1-0.1*I2R(times))
call SaveReal(udg_hash,GetHandleId(udg_temp_unit),5,SPower)
call GroupAddUnit(DPS_GROUP,udg_temp_unit)
call UnitAddAbility(udg_temp_unit,'A03J')
call SetUnitAbilityLevel(udg_temp_unit,'A03J',times)
call IssueImmediateOrder(udg_temp_unit,"creepthunderclap")
call UnitApplyTimedLife(udg_temp_unit,'BHwe',0.5)
if times >=CURRENT_DIFFICULTY then
call KillUnit(boulder)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
set nextBounceTime = GetRandomReal(1.,1.5)
set angle = GetRandomReal(0.,360.)
call SetUnitFacing(boulder,angle)
call ParKnock(boulder,GetRandomReal(250.,300.),GetRandomReal(150.,250.),nextBounceTime,angle,false,"")
call TimerStart(t,nextBounceTime,false,function BouncingBoulderOnTimer)
endif
set t = null
set boulder = null
endfunction
private function MeteorFalling takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local boolexpr GROUPFILTER = null
local timer t1 = null
local integer i = 1
call SetUnitFlyHeight(u,GetUnitFlyHeight(u)-24.,0.)
if GetUnitFlyHeight(u)<=48 or not(GetWidgetLife(u) > 0.) then
if GetWidgetLife(u)>0. then
set GROUPFILTER = Condition(function GroupFilter)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",GetUnitX(u),GetUnitY(u)) )
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(u),GetUnitY(u),200.,GROUPFILTER)
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call UnitDamageTarget(u,udg_temp_unit,500*CURRENT_DIFFICULTY,false,false,null,null,null)
endloop
call DestroyBoolExpr(GROUPFILTER)
set GROUPFILTER = null
endif
loop
exitwhen i > GetRandomInt(2,4)
set udg_temp_unit = CreateUnit(Player(7),'h00Z',GetUnitX(u),GetUnitY(u),0.)
call ParKnock(udg_temp_unit,GetRandomReal(150.,600.),GetRandomReal(150.,600.),1.,GetRandomReal(1.,360.),false,"")
if CURRENT_DIFFICULTY >=3 then
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,udg_temp_unit)
call SaveReal(udg_hash,GetHandleId(t1),2,LoadReal(udg_hash,GetHandleId(udg_Supremus),GetSpellPowerHash())/3.)
call SaveInteger(udg_hash,GetHandleId(t1),3,0)
call TimerStart(t1,1.,true,function BouncingBoulderOnTimer)
set t1 = null
else
call UnitApplyTimedLife(udg_temp_unit,'BHwe',1.)
endif
set i = i + 1
endloop
call KillUnit(u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
function FallMeteor takes nothing returns nothing
local timer tim = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(tim),1)
local timer t = CreateTimer()
call FlushChildHashtable(udg_hash,GetHandleId(tim))
call DestroyTimer(tim)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,0.04,true,function MeteorFalling)
set tim = null
set u = null
set t = null
endfunction
function ChaosMeteor takes real x,real y returns nothing
local unit u = CreateUnit(Player(7),'h00X',x,y,GetRandomReal(1.,360.))
local timer t = CreateTimer()
call UnitApplyTimedLife(CreateUnit(Player(7),'h01A',x,y,0.),'BHwe',2.5)
call SetUnitFlyHeight(u,1500.,0.)
call UnitApplyTimedLife(u,'BHwe',4.)
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call TimerStart(t,1.5,true,function FallMeteor)
set u = null
set t = null
endfunction
endscope
//TESH.scrollpos=3
//TESH.alwaysfold=0
function MetCastGroupFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() then
return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0.
endif
set i = i + 1
endloop
return false
endfunction
function Meteor_Cast_Actions takes nothing returns nothing
local integer i = 0
local integer METEOR_LIMIT = 0
if udg_PlayersInGame == 5 or udg_PlayersInGame == 6 then
set METEOR_LIMIT = 3
endif
if udg_PlayersInGame == 4 or udg_PlayersInGame == 3 then
set METEOR_LIMIT = 2
endif
if udg_PlayersInGame == 1 or udg_PlayersInGame == 2 then
set METEOR_LIMIT = 1
endif
call GroupEnumUnitsInRange(udg_temp_group,GetUnitX(udg_Supremus),GetUnitY(udg_Supremus),1000., Filter(function MetCastGroupFilter))
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null or i >= METEOR_LIMIT
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
if udg_temp_unit != CURRENT_CHARGE_TARGET then
call ChaosMeteor(GetUnitX(udg_temp_unit),GetUnitY(udg_temp_unit))
set i = i + 1
endif
endloop
call GroupClear(udg_temp_group)
call StartTimerBJ(udg_Meteor_Timer,false,10.-CURRENT_DIFFICULTY)
endfunction
//===========================================================================
function InitTrig_Meteor_Cast takes nothing returns nothing
set gg_trg_Meteor_Cast = CreateTrigger()
call TriggerRegisterTimerExpireEventBJ( gg_trg_Meteor_Cast, udg_Meteor_Timer )
call TriggerAddAction( gg_trg_Meteor_Cast, function Meteor_Cast_Actions )
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
globals
trigger STEPCLAPTRG
endglobals
function StepClapFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_Supremus)) and GetWidgetLife(GetFilterUnit())>0
endfunction
function Step_Clap_Acts takes nothing returns nothing
local timer t = GetExpiredTimer()
local trigger trg = LoadTriggerHandle(udg_hash,GetHandleId(t),1)
local real x1 = LoadReal(udg_hash,GetHandleId(t),2)
local real y1 = LoadReal(udg_hash,GetHandleId(t),3)
local real x2 = GetUnitX(udg_Supremus)
local real y2 = GetUnitY(udg_Supremus)
local real distance = SquareRoot((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
if distance >= 150. then
call DestroyEffect(AddSpecialEffectTarget("effects\\LavaClapCaster.mdl",udg_Supremus,"origin"))
call GroupEnumUnitsInRange(udg_temp_group,x2,y2,400.,Filter(function StepClapFilter))
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call UnitDamageTarget(udg_Supremus,udg_temp_unit,300.,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
if GetWidgetLife(udg_temp_unit)>0 then
//call AddUnitMS(udg_temp_unit,-10.,5.,"effects\\LavaClapTarget.mdl","overhead")
endif
endloop
endif
call EnableTrigger(trg)
set trg = null
set t = null
endfunction
function Trig_Step_Clap_Actions takes nothing returns nothing
local real x1 = GetUnitX(udg_Supremus)
local real y1 = GetUnitY(udg_Supremus)
local real x2 = LoadReal(udg_hash,GetHandleId(udg_Supremus),90)
local real y2 = LoadReal(udg_hash,GetHandleId(udg_Supremus),91)
local real distance = SquareRoot((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
local timer t = CreateTimer()
if distance >= 10. then
call TimerStart(t,1.,false,function Step_Clap_Acts)
call SaveTriggerHandle(udg_hash,GetHandleId(t),1,GetTriggeringTrigger())
call SaveReal(udg_hash,GetHandleId(t),2,x1)
call SaveReal(udg_hash,GetHandleId(t),3,y1)
call DisableTrigger(GetTriggeringTrigger())
endif
call SaveReal(udg_hash,GetHandleId(udg_Supremus),90,x1)
call SaveReal(udg_hash,GetHandleId(udg_Supremus),91,y1)
set t = null
endfunction
//===========================================================================
function InitTrig_Step_Clap takes nothing returns nothing
local trigger t = CreateTrigger()
set STEPCLAPTRG = t
call TriggerRegisterTimerEvent( t, 0.05,true )
call TriggerAddAction( t, function Trig_Step_Clap_Actions )
set t = null
call DisableTrigger(STEPCLAPTRG)
endfunction
scope ColossusCharge initializer onInit
globals
private constant real ATTACK_MULTIPLIER_DIFFICULTY_FACTOR = 0.5
private constant real DURATION = 15.
timer SUPREMUS_CHARGE_TIMER = CreateTimer()
unit CURRENT_CHARGE_TARGET = null
private constant integer SLOW_AURA_CODE = 'A06V'
private constant integer SLOW_BUFF_CODE = 'B021'
endglobals
private function HeroesFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() and not IsUnitDeadBX(GetFilterUnit()) then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function GetHeroMaxDist takes nothing returns unit
local real x1 = GetUnitX(udg_Supremus)
local real y1 = GetUnitY(udg_Supremus)
local real x2 = 0.
local real y2 = 0.
local real dist = 0.
local real targetdist = 1.
local group g = null
local unit hero = null
local unit target = null
set g = CreateGroup()
call GroupEnumUnitsInRange(g,x1,y1,2500.,function HeroesFilter)
loop
set hero = FirstOfGroup(g)
exitwhen hero == null
call GroupRemoveUnit(g,hero)
set x2 = GetUnitX(hero)
set y2 = GetUnitY(hero)
set dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
if dist > targetdist then
set targetdist = dist
set target = hero
endif
endloop
call DestroyGroup(g)
set g = null
return target
endfunction
private function Release takes nothing returns nothing
local timer t = GetExpiredTimer()
local real elapsed = LoadReal(udg_hash,GetHandleId(t),1)
local unit target = null
local force play = null
set elapsed = elapsed + 0.25
if elapsed >= DURATION or not SUPREMUS_BATTLE_INITIALIZED then
call SaveReal(udg_hash,GetHandleId(udg_Supremus),GetAttackDamageMultiplierHash(),LoadReal(udg_hash,GetHandleId(udg_Supremus),GetAttackDamageMultiplierHash())- (1. + ATTACK_MULTIPLIER_DIFFICULTY_FACTOR * CURRENT_DIFFICULTY))
//call SetUnitMoveSpeed(udg_Supremus,GetUnitMoveSpeed(udg_Supremus) + 100.)
call UnitRemoveAbility(udg_Supremus,SLOW_AURA_CODE)
call UnitRemoveAbility(udg_Supremus,SLOW_BUFF_CODE)
set CURRENT_CHARGE_TARGET = null
if SUPREMUS_BATTLE_INITIALIZED then
if not IsUnitPaused(udg_Supremus) then
call ResumeTimer(AbyssCall_Timer)
endif
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(udg_hash,GetHandleId(t),1,elapsed)
if IsUnitDeadBX(CURRENT_CHARGE_TARGET) then //Looking for a new target
set target = GetHeroMaxDist()
if target != null then
set CURRENT_CHARGE_TARGET = target
call Aggro.ignoreAggro(udg_Supremus,DURATION,target,true)
call AggroWarning(GetOwningPlayer(target))
if CURRENT_DIFFICULTY<=3 then
set play = udg_Players_Group
call AddTextTagUnit("|cffff0000Colossus Charge|r on me!",target,play,GetRandomReal(0.,0.),11.,3.,0.)
set play = null
endif
set target = null
set t = null
endif
endif
endif
set t = null
endfunction
private function onTimerGetTarget takes nothing returns nothing
local unit target = null
local timer t = null
local force play = null
set CURRENT_CHARGE_TARGET = null
if SUPREMUS_BATTLE_INITIALIZED then
set target = GetHeroMaxDist()
if target != null then
set CURRENT_CHARGE_TARGET = target
call Aggro.ignoreAggro(udg_Supremus,DURATION,target,true)
call AggroWarning(GetOwningPlayer(target))
if CURRENT_DIFFICULTY<=3 then
set play = udg_Players_Group
call AddTextTagUnit("|cffff0000Colossus Charge|r on me!",target,play,GetRandomReal(0.,0.),11.,3.,0.)
set play = null
endif
//call SetUnitMoveSpeed(udg_Supremus,GetUnitMoveSpeed(udg_Supremus) - 100.)
call UnitAddAbility(udg_Supremus,SLOW_AURA_CODE)
call SetUnitAbilityLevel(udg_Supremus,SLOW_AURA_CODE,CURRENT_DIFFICULTY+1)
set t = CreateTimer()
call SaveReal(udg_hash,GetHandleId(t),1,0.)
call TimerStart(t,0.25,true,function Release)
call SaveReal(udg_hash,GetHandleId(udg_Supremus),GetAttackDamageMultiplierHash(),LoadReal(udg_hash,GetHandleId(udg_Supremus),GetAttackDamageMultiplierHash())+1. + ATTACK_MULTIPLIER_DIFFICULTY_FACTOR * CURRENT_DIFFICULTY)
call PauseTimer(AbyssCall_Timer)
set target = null
set t = null
endif
call StartTimerBJ(SUPREMUS_CHARGE_TIMER,false,45.)
endif
endfunction
private function onChangeAttack takes nothing returns boolean
if GetIssuedOrderId() == OrderId("attack") and GetTriggerUnit()==udg_Supremus then
if not(GetOrderTargetUnit()==CURRENT_CHARGE_TARGET) and not IsUnitDeadBX(CURRENT_CHARGE_TARGET) then
call IssueTargetOrder(udg_Supremus,"attack",CURRENT_CHARGE_TARGET)
endif
endif
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,SUPREMUS_CHARGE_TIMER)
call TriggerAddAction(t, function onTimerGetTarget)
call TriggerAddCondition(t1, function onChangeAttack)
set t1 = null
set t = null
endfunction
endscope
//TESH.scrollpos=27
//TESH.alwaysfold=0
globals
unit STONECORE_PEON = null
unit STONECORE_GARROSH = null
unit STONECORE_GRUNT1 = null
unit STONECORE_GRUNT2 = null
unit STONECORE_TAUREN = null
unit STONECORE_WITCHDOCTOR = null
endglobals
function BombTargetFilter takes nothing returns boolean
return GetFilterUnit() == udg_Supremus
endfunction
function BombExplodeNOTARGET takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit BOMB = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(BOMB),1))
call KillUnit(BOMB)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call StartTimerBJ(udg_Abysal_Catapult,false,60.)
set t = null
set BOMB = null
endfunction
function SupremusResetFightSecond takes nothing returns nothing
local timer t = GetExpiredTimer()
if GetWidgetLife(udg_Supremus)>0. and SUPREMUS_BATTLE_INITIALIZED then
call SetUnitTimeScale(udg_Supremus,1.)
call PauseUnit(udg_Supremus,false)
if CURRENT_DIFFICULTY <= 3 then
call UnitRemoveAbility(udg_Supremus,'A01Q')
endif
call TimerStart(AbyssCall_Timer,5.,false,null)
call StartTimerBJ(udg_Abysal_Catapult,false,100.)
//call ResumeTimer(udg_ColCharge_Timer)
call ResumeTimer(SUPREMUS_CHARGE_TIMER)
endif
call DestroyTimer(t)
set t = null
endfunction
function SupremusResetFightFirst takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
if GetWidgetLife(udg_Supremus)>0. and SUPREMUS_BATTLE_INITIALIZED then
call SetUnitTimeScale(udg_Supremus,-1.)
call TimerStart(t1,1.75,false,function SupremusResetFightSecond)
endif
call DestroyTimer(t)
set t = null
set t1 = null
endfunction
function SupremusExplode takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
if SUPREMUS_BATTLE_INITIALIZED then
set t1 = CreateTimer()
call SetUnitTimeScale(udg_Supremus,0.)
if CURRENT_DIFFICULTY <= 3 then
call UnitAddAbility(udg_Supremus,'A01Q')
call AddHeroParameter(udg_Supremus,-0.25,15.,16,"","")
endif
call TimerStart(t1,15.,false,function SupremusResetFightFirst)
set t1 = null
endif
call DestroyTimer(t)
set t = null
endfunction
function BombCheckToExplode takes nothing returns nothing
local timer t1 = GetExpiredTimer()
local timer t2 = null
local timer t = null
local unit BOMB = LoadUnitHandle(udg_hash,GetHandleId(t1),1)
local real x = GetUnitX(BOMB)
local real y = GetUnitY(BOMB)
if GetWidgetLife(BOMB) > 0. and SUPREMUS_BATTLE_INITIALIZED then
call GroupEnumUnitsInRange(udg_temp_group,x,y,200.,Filter(function BombTargetFilter))
loop
set udg_temp_unit = FirstOfGroup(udg_temp_group)
exitwhen udg_temp_unit == null or IsSupremusCasting
set t2 = LoadTimerHandle(udg_hash,GetHandleId(t1),2)
call FlushChildHashtable(udg_hash,GetHandleId(t2))
call DestroyTimer(t2)
call FlushChildHashtable(udg_hash,GetHandleId(t1))
call DestroyTimer(t1)
call GroupRemoveUnit(udg_temp_group,udg_temp_unit)
call DestroyEffect(LoadEffectHandle(udg_hash,GetHandleId(BOMB),1))
call KillUnit(BOMB)
call PauseUnit(udg_Supremus,true)
call PauseTimer(AbyssCall_Timer)
call PauseTimer(SUPREMUS_CHARGE_TIMER)
//call PauseTimer(udg_ColCharge_Timer)
call SetUnitAnimation(udg_Supremus,"death")
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",udg_Supremus,"hand left"))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",udg_Supremus,"hand right"))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",udg_Supremus,"chest"))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl",udg_Supremus,"feet"))
set t = CreateTimer()
call TimerStart(t,1.9,false,function SupremusExplode)
set t = null
set t2 = null
endloop
else
if not SUPREMUS_BATTLE_INITIALIZED then
call KillUnit(BOMB)
endif
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
endif
set t1 = null
set BOMB = null
endfunction
function CatapultExplosion takes nothing returns nothing
local timer t1 = GetExpiredTimer()
local timer t = CreateTimer()
local timer t2 = CreateTimer()
local unit u
local real x = LoadReal(udg_hash,GetHandleId(t1),1)
local real y = LoadReal(udg_hash,GetHandleId(t1),2)
call PauseUnit(udg_Catapult,true)
call SetUnitAnimation(STONECORE_PEON,"stand ready")
call SetUnitFacing(udg_Catapult,0.)
call FlushChildHashtable(udg_hash,GetHandleId(t1))
call DestroyTimer(t1)
set u = CreateUnit(Player(15),'h00S',x,y,0.)
call SaveEffectHandle(udg_hash,GetHandleId(u),1,AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl",GetUnitX(u),GetUnitY(u)))
call SetUnitAnimation(u,"birth")
call SaveUnitHandle(udg_hash,GetHandleId(t),1,u)
call SaveTimerHandle(udg_hash,GetHandleId(t),2,t2)
call TimerStart(t,1.,true,function BombCheckToExplode)
call SaveUnitHandle(udg_hash,GetHandleId(t2),1,u)
call TimerStart(t2,15.,false,function BombExplodeNOTARGET)
set u = null
set t1 = null
set t2 = null
set t = null
endfunction
function Trig_Catapult_Strike_Actions takes nothing returns nothing
local timer t = CreateTimer()
local real angle = GetRandomReal(1.,360.)
local real x = GetRandomReal(GetRectMinX(gg_rct_Catapult),GetRectMaxX(gg_rct_Catapult))
local real y = GetRandomReal(GetRectMinY(gg_rct_Catapult),GetRectMaxY(gg_rct_Catapult))
local real x1 = GetUnitX(udg_Catapult)
local real y1 = GetUnitY(udg_Catapult)
local real distance = SquareRoot((x1-x)*(x1-x)+(y1-y)*(y1-y))
call PauseUnit(udg_Catapult,false)
call IssuePointOrder(udg_Catapult, "attackground", x,y)
call SetUnitAnimation(STONECORE_PEON,"attack")
call PlaySoundOnUnitBJ( gg_snd_PeonYesAttack2, 100, STONECORE_PEON )
call SaveReal(udg_hash,GetHandleId(t),1,x)
call SaveReal(udg_hash,GetHandleId(t),2,y)
call TimerStart(t,distance/900,false,function CatapultExplosion)
endfunction
//===========================================================================
function InitTrig_Catapult_Strike takes nothing returns nothing
set gg_trg_Catapult_Strike = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Catapult_Strike, udg_Abysal_Catapult )
call TriggerAddAction( gg_trg_Catapult_Strike, function Trig_Catapult_Strike_Actions )
endfunction
library SupremusAbyssCall initializer onInit requires IsUnitDead
globals
timer AbyssCall_Timer = CreateTimer()
boolean IsSupremusCasting = false
private constant real ABYSS_CALL_DURATION = 10.
private constant real ABYSS_CALL_COOLDOWN = 40.
endglobals
private function HeroesOnlyFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() then
return not IsUnitDeadBX(GetFilterUnit())
endif
set i = i + 1
endloop
return false
endfunction
private function AbyssCallEnd takes nothing returns nothing
local timer t = GetExpiredTimer()
if SUPREMUS_BATTLE_INITIALIZED then
call PauseUnit(udg_Supremus,false)
//call ResumeTimer(udg_ColCharge_Timer)
call ResumeTimer(SUPREMUS_CHARGE_TIMER)
call SetUnitTimeScale(udg_Supremus,1.)
if GetWidgetLife(udg_Supremus)>0 then
call SetUnitAnimation(udg_Supremus,"stand 1")
endif
call TimerStart(AbyssCall_Timer,ABYSS_CALL_COOLDOWN,false,null)
set IsSupremusCasting = false
endif
call DestroyTimer(t)
set t = null
endfunction
private function AbyssCallAttractOnTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local real time = LoadReal(udg_hash,GetHandleId(t),1)
local unit abyss = LoadUnitHandle(udg_hash,GetHandleId(t),1)
local group g = CreateGroup()
local unit tempu = null
local real x = GetUnitX(udg_Supremus)
local real y = GetUnitY(udg_Supremus)
local real x1 = 0.
local real y1 = 0.
local real angle = 0.
local real speed = 0.
local real coeff = 0.
local real dist = 0.
call GroupEnumUnitsInRange(g,x,y,2500.,Condition(function HeroesOnlyFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set x1 = GetUnitX(tempu)
set y1 = GetUnitY(tempu)
set angle = Atan2(y-y1,x-x1)
set dist = SquareRoot((x-x1)*(x-x1)+(y-y1)*(y-y1))
if dist > 50. then
if dist > 700. then
set coeff =2.
else
set coeff =0.75 + (0.25/6.)*CURRENT_DIFFICULTY
endif
set speed = GetUnitMoveSpeed(tempu)*coeff*0.04
call SetUnitX(tempu, GetUnitX(tempu)+speed*Cos(angle))
call SetUnitY(tempu, GetUnitY(tempu)+speed*Sin(angle))
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set time = time + 0.04
call SaveReal(udg_hash,GetHandleId(t),1,time)
if time >= ABYSS_CALL_DURATION or (not (GetWidgetLife(udg_Supremus)>0.) ) or not SUPREMUS_BATTLE_INITIALIZED then
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
call StopSoundBJ( gg_snd_VolcanoLoop, true )
call KillUnit(abyss)
endif
set t = null
set g = null
set abyss = null
endfunction
private function AbyssCallCreateAbyss takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = CreateTimer()
local timer t2 = CreateTimer()
local unit abyss = null
if GetWidgetLife(udg_Supremus)>0. and SUPREMUS_BATTLE_INITIALIZED then
call PlaySoundOnUnitBJ( gg_snd_VolcanoLoop, 100, udg_Supremus )
set abyss = CreateUnit(Player(7),'h028',GetUnitX(udg_Supremus),GetUnitY(udg_Supremus),0.)
call SetUnitAnimation(abyss,"stand")
call SaveReal(udg_hash,GetHandleId(abyss),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(udg_Supremus),GetSpellPowerHash()))
call GroupAddUnit(DPS_GROUP,abyss)
call UnitApplyTimedLife(abyss,'BHwe',ABYSS_CALL_DURATION)
call SaveUnitHandle(udg_hash,GetHandleId(t2),1,abyss)
call TimerStart(t1,ABYSS_CALL_DURATION,false, function AbyssCallEnd)
call TimerStart(t2,0.04,true, function AbyssCallAttractOnTimer)
endif
call DestroyTimer(t)
set t = null
set t1 = null
set t2 = null
set abyss = null
endfunction
private function CalculateHerosBaricenterAngle takes nothing returns real
local group g = CreateGroup()
local real x = GetUnitX(udg_Supremus)
local real y = GetUnitY(udg_Supremus)
local real avX = 0.
local real avY = 0.
local unit tempu = null
local integer count = 0
call GroupEnumUnitsInRange(g,x,y,1500.,Condition(function HeroesOnlyFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set count = count + 1
set avX = avX + GetUnitX(tempu)
set avY = avY + GetUnitY(tempu)
call GroupRemoveUnit(g,tempu)
endloop
return Atan2( avY/I2R(count) - y, avX/I2R(count) - x)
endfunction
private function AbyssCallStartonTimer takes nothing returns nothing
local timer t1 = CreateTimer()
local integer i = 1
local real dist = 0.
local real x = GetUnitX(udg_Supremus)
local real y = GetUnitY(udg_Supremus)
local real x1 = 0.
local real y1 = 0.
loop
exitwhen i > udg_PlayerCount
set x1 = GetUnitX(udg_Heroes[i])
set y1 = GetUnitY(udg_Heroes[i])
set dist = SquareRoot( (x-x1)*(x-x1)+(y-y1)*(y-y1) )
if dist <= 2500. then
call AggroWarning(GetOwningPlayer(udg_Heroes[i]))
endif
set i = i + 1
endloop
call PauseUnit(udg_Supremus,true)
call SetUnitFacing(udg_Supremus,Rad2Deg(CalculateHerosBaricenterAngle()))
call SetUnitAnimationByIndex(udg_Supremus,2)
if not IsSupremusCasting then
set IsSupremusCasting = true
call TimerStart(t1,3.,false,function AbyssCallCreateAbyss)
call PauseTimer(SUPREMUS_CHARGE_TIMER)
endif
set t1 = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,AbyssCall_Timer)
call TriggerAddAction(t,function AbyssCallStartonTimer)
set t = null
endfunction
endlibrary
scope SupremusDefeat initializer onInit
globals
private unit STONECORE_JUMBER = null
private trigger JUMPER_TRIGGER = null
endglobals
private function Conds takes nothing returns boolean
return GetTriggerUnit() == udg_Supremus
endfunction
private function FreezeSupremus takes nothing returns nothing
call DestroyTimer(GetExpiredTimer())
call SetUnitTimeScale(udg_Supremus,0.)
endfunction
private function Acts takes nothing returns nothing
local integer i = 1
//call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1578" )
call DisplayTextToForce(GetPlayersAll(), "|c00CDAF00Supremus has been defeated!|r")
call SetUnitTimeScalePercent( udg_Supremus, 35.00 )
set SUPREMUS_BATTLE_INITIALIZED = false
set IS_BOSS_BATTLE = false
set IS_HEROES_IN_COMBAT = false
set SUPREMUS_DEFEATED = true
call TimerStart(CreateTimer(),4.,false, function FreezeSupremus)
set i = 1
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
if RectContainsUnit( gg_rct_StoneCoreBOUNDS, udg_Heroes[i]) then
call BoundPlayerUnitCameraToRect(udg_Heroes[i],gg_rct_StoneCoreBOUNDS,false)
endif
set i = i + 1
endloop
//call DestroyTimer( udg_ColCharge_Timer )
call DestroyTimer(SUPREMUS_CHARGE_TIMER)
call DestroyTimer( udg_SupremusTimer )
call DestroyTimer( udg_Abysal_Catapult )
call DestroyTimer( udg_Meteor_Timer )
call DestroyTimer( AbyssCall_Timer )
call SetUnitAnimation( udg_Catapult, "death" )
call DisableTrigger( gg_trg_Stonecore_Teleport_Back )
call EnableTrigger( gg_trg_Stonecore_Teleport )
call DestroyTrigger( gg_trg_Catapult_Strike )
call DestroyTrigger( gg_trg_Meteor_Cast )
//call DestroyTrigger( gg_trg_Supremus_BattleGroup )
call DestroyTrigger(STEPCLAPTRG)
//call GroupClear( udg_BOSSENCOUNTER_Group )
call SetUnitAnimation(STONECORE_PEON,"stand work")
call SetUnitAnimation(STONECORE_GRUNT1,"stand victory")
call SetUnitAnimation(STONECORE_GRUNT2,"stand victory")
call SetUnitAnimation(STONECORE_TAUREN,"stand victory")
call SetUnitAnimation(STONECORE_WITCHDOCTOR,"stand victory")
call SetUnitAnimation(STONECORE_GARROSH,"stand victory")
/*
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 8
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call DestroyFogModifier(SUPRE_FOG[GetForLoopIndexA()-1])
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
*/
set STONECORE_JUMBER = CreateUnit(ORGRIMMAR,'h03G',GetRectCenterX(gg_rct_StonecoreJumperStart),GetRectCenterY(gg_rct_StonecoreJumperStart),0. )
call EnableTrigger(JUMPER_TRIGGER)
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
private function HeroCheck takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function JumperActs takes nothing returns nothing
call SetUnitX(GetTriggerUnit(),GetRectCenterX(gg_rct_StonecoreJumperFinish))
call SetUnitY(GetTriggerUnit(),GetRectCenterY(gg_rct_StonecoreJumperFinish))
call IssueImmediateOrder(GetTriggerUnit(),"stop")
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetTriggerUnit(), "origin" ))
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function Acts )
set JUMPER_TRIGGER = CreateTrigger()
call TriggerRegisterEnterRectSimple( JUMPER_TRIGGER, gg_rct_StonecoreJumperStart )
call TriggerAddCondition( JUMPER_TRIGGER, Condition( function HeroCheck ) )
call TriggerAddAction( JUMPER_TRIGGER, function JumperActs )
call DisableTrigger(JUMPER_TRIGGER)
set t = null
endfunction
endscope
scope SupremusDefeatProceed initializer onInit
globals
private boolean GARROSH_TALK_ACTIVATED = false
private constant string GARROSH_STONECORE_TALK = "What a valorous battle! I owe you my life. But we have no time to rest. Our allies from the Darnassus, leading by Cenarius, are besieged by the Legion. You must help them. Hurry up! My ships will deliver you to the place."
endglobals
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
if not GARROSH_TALK_ACTIVATED then
set GARROSH_TALK_ACTIVATED = true
call SetCinematicScene('O000',null,"Garrosh",GARROSH_STONECORE_TALK,15.,15.)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterEnterRectSimple( t, gg_rct_StonecoreJumperFinish )
call TriggerAddCondition(t, function Conds)
call TriggerAddAction( t, function onEnter)
set t = null
endfunction
endscope
library SupremusBattleGroup initializer onInit requires PlayerCameraBound, HeroRevival
globals
boolean SUPREMUS_BATTLE_INITIALIZED = false
boolean SUPREMUS_SUMMONED = false
group SUPREMUS_BATTLEGROUP = CreateGroup()
boolean SUPREMUS_DEFEATED = false
private integer ENRAGE_ABILCODE = 'A09O'
private timer ENRAGE_TIMER = null
private real ENRAGE_STACK_PERIOD = 40.
endglobals
private function CheckDeadUnits takes nothing returns nothing
if GetEnumUnit()==null or not (GetWidgetLife(GetEnumUnit())>0.) or IsUnitType(GetEnumUnit(), UNIT_TYPE_DEAD) then
call GroupRemoveUnit(SUPREMUS_BATTLEGROUP,GetEnumUnit())
endif
endfunction
private function onTimerEnrage takes nothing returns nothing
call SetUnitAbilityLevel(udg_Supremus, ENRAGE_ABILCODE, GetUnitAbilityLevel(udg_Supremus,ENRAGE_ABILCODE)+ 1)
endfunction
private function onTimer takes nothing returns nothing
local integer i = 1
local integer j = 1
if SUPREMUS_DEFEATED then
call DestroyTimer(GetExpiredTimer())
call DestroyGroup(SUPREMUS_BATTLEGROUP)
endif
if SUPREMUS_BATTLE_INITIALIZED then
if ENRAGE_TIMER == null then
set ENRAGE_TIMER = CreateTimer()
call TimerStart(ENRAGE_TIMER, ENRAGE_STACK_PERIOD, true, function onTimerEnrage)
endif
call ForGroup(SUPREMUS_BATTLEGROUP, function CheckDeadUnits)
if CountUnitsInGroup(SUPREMUS_BATTLEGROUP)==0 then
set j = 1
loop
exitwhen j > udg_PlayerCount
if IsUnitDeadBX(udg_Heroes[j]) then
call ImmediatelyReviveHero(udg_Heroes[j])
endif
set j = j + 1
endloop
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5.,"All heroes are dead. Resetting |c00FF0000Supremus'|r battleground...")
set SUPREMUS_BATTLE_INITIALIZED = false
set IS_BOSS_BATTLE = false
call SetUnitAbilityLevel(udg_Supremus, ENRAGE_ABILCODE, 1)
call DestroyTimer(ENRAGE_TIMER)
set ENRAGE_TIMER = null
call EnableTrigger( gg_trg_Stonecore_Teleport )
call EnableTrigger( gg_trg_Stonecore_Teleport_Back )
set IsSupremusCasting = false
call IssueImmediateOrder(udg_Catapult,"stop")
call PauseTimer(SUPREMUS_CHARGE_TIMER)
call PauseTimerBJ( true, udg_Abysal_Catapult )
call PauseTimerBJ( true, udg_Meteor_Timer )
call PauseTimer(AbyssCall_Timer)
call UnitRemoveAbility(udg_Supremus,'A01Q')
call UnitRemoveBuffsBJ( bj_REMOVEBUFFS_ALL, udg_Supremus )
call SetUnitTimeScale(udg_Supremus,1.)
call ResetUnitAnimation( udg_Supremus )
call PauseUnitBJ( false, udg_Supremus )
call SetUnitLifePercentBJ( udg_Supremus, 100 )
call SetUnitManaPercentBJ( udg_Supremus, 100 )
call Aggro.clear(udg_Supremus,null)
set udg_LeakPoint[1] = GetRectCenter(gg_rct_AbyssalSummoning)
call IssuePointOrderLoc( udg_Supremus, "move", udg_LeakPoint[1] )
call RemoveLocation(udg_LeakPoint[1])
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
set i = i + 1
endloop
endif
else
if SUPREMUS_SUMMONED then
call SetUnitLifePercentBJ( udg_Supremus, 100 )
call SetUnitManaPercentBJ( udg_Supremus, 100 )
call PauseUnitBJ( false, udg_Supremus )
endif
endif
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() and not IsUnitInGroup(GetTriggerUnit(), SUPREMUS_BATTLEGROUP) then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onEnter takes nothing returns nothing
local integer i = 1
if not SUPREMUS_DEFEATED then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"|cff80ff80" + GetUnitName(GetTriggerUnit()) + "|r enters Supremus battlefield")
call GroupAddUnit(SUPREMUS_BATTLEGROUP, GetTriggerUnit())
call BoundPlayerUnitCameraToRect(GetTriggerUnit(),gg_rct_AbyssalBattlefield,false)
endif
if SUPREMUS_SUMMONED and not SUPREMUS_BATTLE_INITIALIZED and not SUPREMUS_DEFEATED then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5.,"|c00FF0000Supremus'|r battleground activated.")
call DisableTrigger( gg_trg_Stonecore_Teleport_Back )
call DisableTrigger( gg_trg_Stonecore_Teleport )
call TimerStart(SUPREMUS_CHARGE_TIMER,30.,false,null)
//call StartTimerBJ( udg_ColCharge_Timer, false, 30.00 )
call StartTimerBJ( udg_Abysal_Catapult, false, 40.00 )
call TimerStart(AbyssCall_Timer,50.,false,null)
call TimerStart(udg_Meteor_Timer, 20., false, null)
set SUPREMUS_BATTLE_INITIALIZED = true
set IS_BOSS_BATTLE = true
endif
endfunction
private function onInit takes nothing returns nothing
set gg_trg_Supremus_BattleGroup = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Supremus_BattleGroup, gg_rct_AbyssalBattlefield )
call TriggerAddCondition( gg_trg_Supremus_BattleGroup, Condition( function Conds ) )
call TriggerAddAction( gg_trg_Supremus_BattleGroup, function onEnter )
call TimerStart(CreateTimer(),1.,true,function onTimer)
endfunction
endlibrary
scope EredarsChange initializer onInit
globals
boolean EREDARS_CHANGE_STARTED = false
endglobals
private function onTimerChangeEredars takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = PASSIVE_EREDAR
local real x = 0.
local real y = 0.
if EREDARS_BATTLE_INITIALIZED then
call PauseUnit(PASSIVE_EREDAR,false)
call SetUnitX(PASSIVE_EREDAR,GetRectCenterX(gg_rct_EredarVortexCenter))
call SetUnitY(PASSIVE_EREDAR,GetRectCenterY(gg_rct_EredarVortexCenter))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl", PASSIVE_EREDAR,"origin"))
call SetUnitAnimation(PASSIVE_EREDAR,"Stand")
call FadeUnitOut(PASSIVE_EREDAR,2.,false)
if ACTIVE_EREDAR == ARCHIMONDE then
set x = GetRectCenterX(gg_rct_EredarsPlatformLeft)
set y = GetRectCenterY(gg_rct_EredarsPlatformLeft)
else
set x = GetRectCenterX(gg_rct_EredarsPlatformRight)
set y = GetRectCenterY(gg_rct_EredarsPlatformRight)
endif
if GetWidgetLife(ACTIVE_EREDAR)>0. then
call SetUnitX(ACTIVE_EREDAR,x)
call SetUnitY(ACTIVE_EREDAR,y)
call SetUnitFacing(ACTIVE_EREDAR,270.)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl", ACTIVE_EREDAR,"origin"))
call SetUnitAnimation(ACTIVE_EREDAR,"Stand")
call SetUnitInvulnerable(ACTIVE_EREDAR,true)
endif
set PASSIVE_EREDAR = ACTIVE_EREDAR
set ACTIVE_EREDAR = u
set EREDARS_CHANGE_STARTED = false
call SetUnitInvulnerable(ACTIVE_EREDAR,false)
call ResumeTimer(EREDAR_VOID_TIMER)
call ResumeTimer(EREDAR_CAST_TIMER)
if EREDARS_SARGERAS_ACTIVATED then
call ResumeTimer(EREDAR_SARGERAS_TIMER)
endif
endif
set u = null
call DestroyTimer(t)
set t = null
endfunction
private function onTimerExpired takes nothing returns nothing
if GetWidgetLife(PASSIVE_EREDAR)>0. then
call PauseUnit(ACTIVE_EREDAR,true)
set EREDARS_CHANGES_COUNT = EREDARS_CHANGES_COUNT + 1
if EREDARS_CHANGES_COUNT >= EREDARS_SARGERAS_CHANGES_COUNT_ACTIVATE and not EREDARS_SARGERAS_ACTIVATED then
set EREDARS_SARGERAS_ACTIVATED = true
call TimerStart(EREDAR_SARGERAS_TIMER,EREDAR_SARGERAS_COOLDOWN,false,null)
endif
if GetWidgetLife(ACTIVE_EREDAR)>0. then
call SetUnitAnimation(ACTIVE_EREDAR,"Spell Slam")
endif
if GetWidgetLife(PASSIVE_EREDAR)>0. then
call SetUnitAnimation(PASSIVE_EREDAR,"Spell Slam")
endif
call PauseTimer(EREDAR_VOID_TIMER)
call PauseTimer(EREDAR_CAST_TIMER)
if EREDARS_SARGERAS_ACTIVATED then
call PauseTimer(EREDAR_SARGERAS_TIMER)
endif
set EREDARS_CHANGE_STARTED = true
call TimerStart(EREDAR_CHANGE_TIMER,EREDAR_CHANGE_COOLDOWN,false,null)
call TimerStart(CreateTimer(),3.,false,function onTimerChangeEredars)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,EREDAR_CHANGE_TIMER)
call TriggerAddAction(t,function onTimerExpired)
set t = null
endfunction
endscope
library EredarsVoid initializer onInit requires IsUnitDead
globals
private constant integer VOID_CODE_ARCHIMONDE = 'h039'
private constant integer VOID_CODE_KILJAEDEN = 'h038'
private constant integer HELLFIRE_MARK_ABILCODE = 'A069'
private constant integer HELLFIRE_MARK_ABILBUFF = 'B01P'
private constant integer HELLFIRE_MARK_EXPLODE_CODE = 'h025'
private constant real HELLFIRE_MARK_DEBUFF_DURATION = 5.
private constant real HELLFIRE_MARK_EXPLODE_AOE = 400.
private constant real HELLFIRE_MARK_EXPLODE_DAMAGE_TARGET = 200. //*difficulty factor
private constant real HELLFIRE_MARK_EXPLODE_DAMAGE_AOE = 400. //*difficulty factor
private constant integer DEVOURING_VORTEX_ABILCODE = 'A06A'
private constant integer DEVOURING_VORTEX_ABILBUFF = 'B01Q'
private constant integer DEVOURING_VORTEX_EXPLODE_CODE = 'h03A'
private constant integer DEVOURING_VORTEX_AOE_ABIL = 'A06B'
private constant integer DEVOURING_VORTEX_AOE_UNIT = 'h03P'
private constant real VORTEX_AOEUNIT_ANGLESPEED = 7.
private constant real DEVOURING_VORTEX_DEBUFF_DURATION = 7.
private constant real DEVOURING_VORTEX_EXPLODE_AOE = 500.
private constant real DEVOURING_VORTEX_EXPLODE_DAMAGE_PLAYER = 200. //*players factor
private constant real DEVOURING_VORTEX_EXPLODE_DAMAGE_DIFFICULTY = 200. //*difficulty factor
private constant real DEVOURING_VORTEX_DEVOUR_AOE = 10.
private constant real DEVOURING_VORTEX_CONSUMING_SPEED = 2. //*25
private constant real DEVOURING_VORTEX_SEARCH_AOE = 1000.
private constant real DEVOURING_VORTEX_ACTIVATION_PERIOD = 5.
private constant real DEVOURING_VORTEX_HERO_SUCKING_AOE_BASE = 200.
private constant real DEVOURING_VORTEX_HERO_SUCKING_AOE_LEVEL = 100.
private constant real DEVOURING_VORTEX_HERO_SUCKING_SPEED_BASE = 0.35
private constant real DEVOURING_VORTEX_HERO_SUCKING_SPEED_DIFFICULTY_FACTOR = 0.05
private constant real DEVOURING_VORTEX_EXPLODE_CONSUMING_AOE = 300
private constant real DEVOURING_VORTEX_EXPLODE_CONSUMING_DAMAGE_BASE = 300.
private constant real DEVOURING_VORTEX_EXPLODE_CONSUMING_DAMAGE_DIFFICULTY_FACTOR = 0.5
private constant integer VORTEX_CONSUMED_HASH = 10
private constant integer VORTEX_CONSUMING_HASH = 11
private constant integer VORTEX_CONSUMING_GROUP_HASH = 12
private constant integer VORTEX_CONSUME_LIMIT_HASH = 13
private constant integer VORTEX_ELAPSED_HASH = 14
private constant integer VORTEX_ACTIVE_HASH = 15
private constant integer VORTEX_AOEUNIT_HASH = 16
private constant integer FIRE_VORTEX_UNDER_CONSUMING_HASH = 17
private constant real HELLFIRE_MARK_HERO_SEARCH_AOE = 3000.
private group AFFECTED = CreateGroup()
private group FIRES_GROUP = CreateGroup()
private group VORTEX_GROUP = CreateGroup()
private timer VORTEX_TIMER = null
private integer COUNTER = 0
private real FIRE_MIN_DIST = 0.
private unit FIRE_MIN = null
endglobals
private function RemoveVoids takes nothing returns nothing
local unit vortex = GetEnumUnit()
local group g = LoadGroupHandle(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_GROUP_HASH)
local unit AOE_UNIT = LoadUnitHandle(C3_hash,GetHandleId(vortex),VORTEX_AOEUNIT_HASH)
call DestroyGroup(g)
call GroupRemoveUnit(VORTEX_GROUP,vortex)
call KillUnit(vortex)
call KillUnit(AOE_UNIT)
call FlushChildHashtable(C3_hash,GetHandleId(vortex))
set AOE_UNIT = null
set g = null
set vortex = null
endfunction
private function RemoveFires takes nothing returns nothing
call GroupRemoveUnit(FIRES_GROUP,GetEnumUnit())
call KillUnit(GetEnumUnit())
endfunction
function EredarsClearFireVortex takes nothing returns nothing
call ForGroup(VORTEX_GROUP,function RemoveVoids)
call ForGroup(FIRES_GROUP,function RemoveFires)
endfunction
private function HeroesFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() and not IsUnitDeadBX(GetFilterUnit()) then
return not (udg_Heroes[i] == Aggro.target(ACTIVE_EREDAR))
endif
set i = i + 1
endloop
return false
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(PASSIVE_EREDAR)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0.
endfunction
private function GroupFilterHeroes takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() and not IsUnitDeadBX(GetFilterUnit()) then
set COUNTER = COUNTER + 1
return true
endif
set i = i + 1
endloop
return false
endfunction
private function HeroesOnlyFilter takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetFilterUnit() and not IsUnitDeadBX(GetFilterUnit()) then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onTimerExplodeFire takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hero = null
local group g = CreateGroup()
local unit tempu = null
local unit explode = null
local unit FIRE = null
if EREDARS_BATTLE_INITIALIZED then
loop
set hero = FirstOfGroup(AFFECTED)
exitwhen hero == null
set explode = CreateUnit(Player(7),HELLFIRE_MARK_EXPLODE_CODE,GetUnitX(hero),GetUnitY(hero),0.)
call SetUnitScale(explode,2.5,2.5,2.5)
call KillUnit(explode)
set explode = null
set FIRE = CreateUnit(GetOwningPlayer(PASSIVE_EREDAR), VOID_CODE_KILJAEDEN, GetUnitX(hero),GetUnitY(hero),0.)
call GroupAddUnit(FIRES_GROUP,FIRE)
call GroupAddUnit(DPS_GROUP,FIRE)
call FlushChildHashtable(udg_hash,GetHandleId(FIRE))
call FlushChildHashtable(C3_hash,GetHandleId(FIRE))
call SaveBoolean(C3_hash,GetHandleId(FIRE),FIRE_VORTEX_UNDER_CONSUMING_HASH,false)
call SaveReal(udg_hash,GetHandleId(FIRE),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(KILJAEDEN),GetSpellPowerHash()))
call GroupEnumUnitsInRange(g,GetUnitX(hero),GetUnitY(hero),HELLFIRE_MARK_EXPLODE_AOE, function GroupFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
if tempu == hero then
call DealFireDamage(PASSIVE_EREDAR, tempu, HELLFIRE_MARK_EXPLODE_DAMAGE_TARGET*CURRENT_DIFFICULTY)
else
call DealFireDamage(PASSIVE_EREDAR, tempu, HELLFIRE_MARK_EXPLODE_DAMAGE_AOE*CURRENT_DIFFICULTY)
endif
call GroupRemoveUnit(g,tempu)
endloop
call GroupRemoveUnit(AFFECTED,hero)
endloop
endif
call DestroyGroup(g)
set g = null
call DestroyTimer(t)
set t = null
set tempu = null
set hero = null
set FIRE = null
endfunction
private function onTimerApplyHellfireDebuff takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = CreateGroup()
local real x = GetRectCenterX(gg_rct_EredarVortexCenter)
local real y = GetRectCenterY(gg_rct_EredarVortexCenter)
local integer k = 3
local integer count = 0
local unit tempu = null
local force play = null
if EREDARS_BATTLE_INITIALIZED then
if udg_PlayersInGame <= 5 then
set k = 2
endif
if udg_PlayersInGame <=3 then
set k = 1
endif
call GroupClear(AFFECTED)
call GroupEnumUnitsInRange(g,x,y,HELLFIRE_MARK_HERO_SEARCH_AOE,function HeroesFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null or count >= k
set count = count + 1
set IHP_ABI = HELLFIRE_MARK_ABILCODE
set IHP_BUFFER = HELLFIRE_MARK_ABILBUFF
call AddHeroParameter(tempu,-0.1,HELLFIRE_MARK_DEBUFF_DURATION,GetSpellResistHash(),"","")
call GroupAddUnit(AFFECTED,tempu)
call GroupRemoveUnit(g,tempu)
if CURRENT_DIFFICULTY<=3 then
call AggroWarning(GetOwningPlayer(tempu))
set play = udg_Players_Group
call AddTextTagUnit("I've got |cffff0000Hellfire Mark|r on me! Stay away.",tempu,play,GetRandomReal(0.,0.),11.,4.,0.)
set play = null
endif
endloop
if count < k and not IsUnitDeadBX(Aggro.target(ACTIVE_EREDAR)) then
set tempu = Aggro.target(ACTIVE_EREDAR)
set IHP_ABI = HELLFIRE_MARK_ABILCODE
set IHP_BUFFER = HELLFIRE_MARK_ABILBUFF
call AddHeroParameter(tempu,-0.1,HELLFIRE_MARK_DEBUFF_DURATION,GetSpellResistHash(),"","")
call GroupAddUnit(AFFECTED,tempu)
if CURRENT_DIFFICULTY<=3 then
call AggroWarning(GetOwningPlayer(tempu))
set play = udg_Players_Group
call AddTextTagUnit("I've got |cffff0000Hellfire Mark|r on me! Stay away.",tempu,play,GetRandomReal(0.,0.),11.,4.,0.)
set play = null
endif
endif
call TimerStart(CreateTimer(),HELLFIRE_MARK_DEBUFF_DURATION,false,function onTimerExplodeFire)
if not IsUnitDeadBX(PASSIVE_EREDAR) then
call SetUnitAnimation(PASSIVE_EREDAR,"Stand")
endif
call ResumeTimer(EREDAR_CHANGE_TIMER)
endif
call DestroyGroup(g)
set g = null
call DestroyTimer(t)
set tempu = null
set t = null
endfunction
private function GetClosestFire takes nothing returns nothing
local unit FIRE = GetEnumUnit()
local unit VORTEX = udg_temp_unit
local real x = GetUnitX(FIRE)
local real y = GetUnitY(FIRE)
local real x1 = GetUnitX(VORTEX)
local real y1 = GetUnitY(VORTEX)
local real dist = SquareRoot( (x-x1)*(x-x1)+(y-y1)*(y-y1) )
local boolean alreadyconsumed = LoadBoolean(C3_hash,GetHandleId(GetEnumUnit()),FIRE_VORTEX_UNDER_CONSUMING_HASH)
if dist < FIRE_MIN_DIST and not alreadyconsumed then
set FIRE_MIN_DIST = dist
set FIRE_MIN = FIRE
endif
endfunction
private function VortexFindFires takes nothing returns nothing
local unit vortex = GetEnumUnit()
local integer consumed = LoadInteger(C3_hash,GetHandleId(vortex),VORTEX_CONSUMED_HASH)
local integer consuming = LoadInteger(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_HASH)
local integer consumeLIMIT = LoadInteger(C3_hash,GetHandleId(vortex),VORTEX_CONSUME_LIMIT_HASH)
local boolean ACTIVE = LoadBoolean(C3_hash,GetHandleId(vortex),VORTEX_ACTIVE_HASH)
local group g = null
if consumed + consuming < consumeLIMIT and ACTIVE then
set udg_temp_unit = vortex
set FIRE_MIN = FirstOfGroup(FIRES_GROUP)
if not(FIRE_MIN==null) then
if LoadBoolean(C3_hash,GetHandleId(FIRE_MIN),FIRE_VORTEX_UNDER_CONSUMING_HASH) then
set FIRE_MIN_DIST = 10000.
else
set FIRE_MIN_DIST = SquareRoot( (GetUnitX(FIRE_MIN)-GetUnitX(vortex))*(GetUnitX(FIRE_MIN)-GetUnitX(vortex)) + (GetUnitY(FIRE_MIN)-GetUnitY(vortex))*(GetUnitY(FIRE_MIN)-GetUnitY(vortex)) )
endif
call ForGroup(FIRES_GROUP,function GetClosestFire)
if consuming == 0 then
//call SetUnitAnimation(vortex,"birth")
endif
if FIRE_MIN_DIST <= DEVOURING_VORTEX_SEARCH_AOE then
set consuming = consuming + 1
call SaveInteger(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_HASH,consuming)
set g = LoadGroupHandle(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_GROUP_HASH)
if g == null then
set g = CreateGroup()
call SaveGroupHandle(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_GROUP_HASH,g)
endif
call GroupAddUnit(g, FIRE_MIN)
//call GroupRemoveUnit(FIRES_GROUP,FIRE_MIN)
call SaveBoolean(C3_hash,GetHandleId(FIRE_MIN),FIRE_VORTEX_UNDER_CONSUMING_HASH,true)
set g = null
endif
endif
endif
set vortex = null
endfunction
private function FiresMove takes nothing returns nothing
local unit FIRE = GetEnumUnit()
local unit vortex = udg_temp_unit
local integer consumed = LoadInteger(C3_hash,GetHandleId(vortex),VORTEX_CONSUMED_HASH)
local integer consuming = LoadInteger(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_HASH)
local integer consumeLIMIT = LoadInteger(C3_hash,GetHandleId(vortex),VORTEX_CONSUME_LIMIT_HASH)
local unit VORTEX_AOEUNIT = LoadUnitHandle(C3_hash,GetHandleId(vortex),VORTEX_AOEUNIT_HASH)
local real x = GetUnitX(vortex)
local real y = GetUnitY(vortex)
local real x1 = GetUnitX(FIRE)
local real y1 = GetUnitY(FIRE)
local real angle = Atan2(y-y1,x-x1)
local real dist = 0.
local real DAMAGE = 0.
local group HEROES_GROUP = null
local unit hero = null
call SetUnitX(FIRE,x1+DEVOURING_VORTEX_CONSUMING_SPEED*Cos(angle))
call SetUnitY(FIRE,y1+DEVOURING_VORTEX_CONSUMING_SPEED*Sin(angle))
set dist = SquareRoot( (x-x1)*(x-x1) + (y-y1)*(y-y1) )
if dist <= DEVOURING_VORTEX_DEVOUR_AOE then
set consumed = consumed + 1
set consuming = consuming - 1
call GroupRemoveUnit(LoadGroupHandle(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_GROUP_HASH),FIRE)
call KillUnit(FIRE)
call GroupRemoveUnit(FIRES_GROUP,FIRE)
call FadeUnitIn(FIRE,2.)
set DAMAGE = DEVOURING_VORTEX_EXPLODE_CONSUMING_DAMAGE_BASE * (1 + DEVOURING_VORTEX_EXPLODE_CONSUMING_DAMAGE_DIFFICULTY_FACTOR * CURRENT_DIFFICULTY)
if consumed >= consumeLIMIT then
set DAMAGE = 2*DAMAGE
endif
set HEROES_GROUP = CreateGroup()
call GroupEnumUnitsInRange(HEROES_GROUP,DEVOURING_VORTEX_EXPLODE_CONSUMING_AOE, x, y, function HeroesOnlyFilter)
loop
set hero = FirstOfGroup(HEROES_GROUP)
exitwhen hero == null
call DealFireDamage(vortex,hero,DAMAGE)
call GroupRemoveUnit(HEROES_GROUP,hero)
endloop
call DestroyGroup(HEROES_GROUP)
set HEROES_GROUP = null
if consumed >= consumeLIMIT then
set DAMAGE = 2*DAMAGE
call DestroyGroup(LoadGroupHandle(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_GROUP_HASH))
call FlushChildHashtable(C3_hash,GetHandleId(vortex))
call FadeUnitIn(vortex,1.)
call KillUnit(vortex)
call KillUnit(VORTEX_AOEUNIT)
else
call SaveInteger(C3_hash,GetHandleId(vortex), VORTEX_CONSUMED_HASH, consumed)
call SaveInteger(C3_hash,GetHandleId(vortex), VORTEX_CONSUMING_HASH, consuming)
if consuming == 0 then
//call SetUnitAnimation(vortex,"stand")
endif
endif
endif
set FIRE = null
set vortex = null
endfunction
private function VortexMoveFires takes nothing returns nothing
local unit vortex = GetEnumUnit()
local group g = LoadGroupHandle(C3_hash,GetHandleId(vortex),VORTEX_CONSUMING_GROUP_HASH)
local real elapsed = LoadReal(C3_hash,GetHandleId(vortex),VORTEX_ELAPSED_HASH)
local boolean ACTIVE = LoadBoolean(C3_hash,GetHandleId(vortex),VORTEX_ACTIVE_HASH)
local real x = 0.
local real y = 0.
local real x1 = 0.
local real y1 = 0.
local real angle = 0.
local real coeff = 0.
local real dist = 0.
local real h = 0.
local real anglespeed = VORTEX_AOEUNIT_ANGLESPEED / 25.
local group HEROES_GROUP = null
local unit hero = null
local unit VORTEX_AOEUNIT = null
local real SUCKING_AOE = DEVOURING_VORTEX_HERO_SUCKING_AOE_BASE + DEVOURING_VORTEX_HERO_SUCKING_AOE_LEVEL * CURRENT_DIFFICULTY
set elapsed = elapsed + 0.04
if elapsed >= DEVOURING_VORTEX_ACTIVATION_PERIOD and not ACTIVE then
set ACTIVE = true
call UnitAddAbility(vortex,DEVOURING_VORTEX_AOE_ABIL)
call SaveBoolean(C3_hash,GetHandleId(vortex),VORTEX_ACTIVE_HASH,true)
set VORTEX_AOEUNIT = CreateUnit(GetOwningPlayer(vortex),DEVOURING_VORTEX_AOE_UNIT,GetUnitX(vortex),GetUnitY(vortex),0.)
call SetUnitX(VORTEX_AOEUNIT,GetUnitX(vortex)+SUCKING_AOE)
call SetUnitY(VORTEX_AOEUNIT,GetUnitY(vortex))
call SaveUnitHandle(C3_hash,GetHandleId(vortex),VORTEX_AOEUNIT_HASH,VORTEX_AOEUNIT)
set VORTEX_AOEUNIT = null
else
call SaveReal(C3_hash,GetHandleId(vortex),VORTEX_ELAPSED_HASH,elapsed)
endif
if ACTIVE then
set x = GetUnitX(vortex)
set y = GetUnitY(vortex)
set VORTEX_AOEUNIT = LoadUnitHandle(C3_hash,GetHandleId(vortex),VORTEX_AOEUNIT_HASH)
set x1 = GetUnitX(VORTEX_AOEUNIT)-x
set y1 = GetUnitY(VORTEX_AOEUNIT)-y
call SetUnitX(VORTEX_AOEUNIT, x1 * Cos(anglespeed) - y1 * Sin(anglespeed) + x)
call SetUnitY(VORTEX_AOEUNIT, x1 * Sin(anglespeed) + y1 * Cos(anglespeed) + y)
call SetUnitFacing(vortex,GetUnitFacing(vortex)+72./30.)
set HEROES_GROUP = CreateGroup()
call GroupEnumUnitsInRange(HEROES_GROUP, x, y, SUCKING_AOE, function HeroesOnlyFilter)
loop
set hero = FirstOfGroup(HEROES_GROUP)
exitwhen hero == null
set x1 = GetUnitX(hero)
set y1 = GetUnitY(hero)
set angle = Atan2(y-y1,x-x1)
set dist = SquareRoot( (x-x1)*(x-x1) + (y-y1)*(y-y1) )
if dist > 10. and dist <= SUCKING_AOE then
set coeff = (1-dist/SUCKING_AOE) * ( DEVOURING_VORTEX_HERO_SUCKING_SPEED_BASE + DEVOURING_VORTEX_HERO_SUCKING_SPEED_DIFFICULTY_FACTOR*CURRENT_DIFFICULTY )
set h = coeff * GetUnitMoveSpeed(hero)/25.
call SetUnitX(hero,x1+h*Cos(angle))
call SetUnitY(hero,y1+h*Sin(angle))
endif
call GroupRemoveUnit(HEROES_GROUP,hero)
endloop
call DestroyGroup(HEROES_GROUP)
set HEROES_GROUP = null
set VORTEX_AOEUNIT = null
endif
if ACTIVE then
set udg_temp_unit = vortex
call ForGroup(g,function FiresMove)
endif
set g = null
set vortex = null
endfunction
private function onTimerFindFires takes nothing returns nothing
call ForGroup(VORTEX_GROUP,function VortexFindFires)
call ForGroup(VORTEX_GROUP,function VortexMoveFires)
endfunction
private function onTimerExplodeVortex takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit hero = null
local unit VORTEX = null
local group g = null
local unit tempu = null
local real damage = 0.
local integer k = 3
if EREDARS_BATTLE_INITIALIZED then
if udg_PlayersInGame <= 5 then
set k = 2
endif
if udg_PlayersInGame <=3 then
set k = 1
endif
loop
set hero = FirstOfGroup(AFFECTED)
exitwhen hero == null
call DestroyEffect(AddSpecialEffectTarget("BlackHole.mdx",hero,"chest"))
set VORTEX = CreateUnit(GetOwningPlayer(PASSIVE_EREDAR), VOID_CODE_ARCHIMONDE, GetUnitX(hero),GetUnitY(hero),0.)
call GroupAddUnit(DPS_GROUP,VORTEX)
call FlushChildHashtable(udg_hash,GetHandleId(VORTEX))
call FlushChildHashtable(C3_hash,GetHandleId(VORTEX))
call SaveReal(udg_hash,GetHandleId(VORTEX),GetSpellPowerHash(),LoadReal(udg_hash,GetHandleId(ARCHIMONDE),GetSpellPowerHash()))
call SaveInteger(C3_hash,GetHandleId(VORTEX),VORTEX_CONSUME_LIMIT_HASH,k)
if VORTEX_TIMER == null then
set VORTEX_TIMER = CreateTimer()
call TimerStart(VORTEX_TIMER,0.04, true, function onTimerFindFires)
endif
call GroupAddUnit(VORTEX_GROUP,VORTEX)
set COUNTER = 0
set g = CreateGroup()
call GroupEnumUnitsInRange(g,GetUnitX(hero),GetUnitY(hero), DEVOURING_VORTEX_EXPLODE_AOE , function GroupFilterHeroes)
set damage = (DEVOURING_VORTEX_EXPLODE_DAMAGE_PLAYER*udg_PlayersInGame + DEVOURING_VORTEX_EXPLODE_DAMAGE_DIFFICULTY*CURRENT_DIFFICULTY)/COUNTER
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null
call DealFireDamage(PASSIVE_EREDAR, tempu, damage)
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
set g = null
call GroupRemoveUnit(AFFECTED,hero)
endloop
endif
call DestroyGroup(g)
set g = null
set hero = null
set VORTEX = null
set tempu = null
call DestroyTimer(t)
set t = null
endfunction
private function onTimerApplyVortexDebuff takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = CreateGroup()
local real x = GetRectCenterX(gg_rct_EredarVortexCenter)
local real y = GetRectCenterY(gg_rct_EredarVortexCenter)
local integer k = 1
local integer count = 0
local unit tempu = null
local force play = null
if EREDARS_BATTLE_INITIALIZED then
call GroupClear(AFFECTED)
call GroupEnumUnitsInRange(g,x,y,HELLFIRE_MARK_HERO_SEARCH_AOE,function HeroesFilter)
loop
set tempu = FirstOfGroup(g)
exitwhen tempu==null or count >= k
set count = count + 1
set IHP_ABI = DEVOURING_VORTEX_ABILCODE
set IHP_BUFFER = DEVOURING_VORTEX_ABILBUFF
call AddHeroParameter(tempu,-0.1,DEVOURING_VORTEX_DEBUFF_DURATION,GetSpellResistHash(),"","")
call GroupAddUnit(AFFECTED,tempu)
if CURRENT_DIFFICULTY<=3 then
call AggroWarning(GetOwningPlayer(tempu))
set play = udg_Players_Group
call AddTextTagUnit("I've got |cff008080Devouring Vortex|r on me! Come closer.",tempu,play,GetRandomReal(0.,0.),11.,4.,0.)
set play = null
endif
call GroupRemoveUnit(g,tempu)
endloop
if count < k and not IsUnitDeadBX(Aggro.target(ACTIVE_EREDAR)) then
set tempu = Aggro.target(ACTIVE_EREDAR)
set IHP_ABI = DEVOURING_VORTEX_ABILCODE
set IHP_BUFFER = DEVOURING_VORTEX_ABILBUFF
call AddHeroParameter(tempu,-0.1,DEVOURING_VORTEX_DEBUFF_DURATION,GetSpellResistHash(),"","")
call GroupAddUnit(AFFECTED,tempu)
if CURRENT_DIFFICULTY<=3 then
call AggroWarning(GetOwningPlayer(tempu))
set play = udg_Players_Group
call AddTextTagUnit("I've got |cff008080Devouring Vortex|r on me! Come closer.",tempu,play,GetRandomReal(0.,0.),11.,4.,0.)
set play = null
endif
endif
call TimerStart(CreateTimer(),DEVOURING_VORTEX_DEBUFF_DURATION,false,function onTimerExplodeVortex)
if not IsUnitDeadBX(PASSIVE_EREDAR) then
call SetUnitAnimation(PASSIVE_EREDAR,"Stand")
endif
call ResumeTimer(EREDAR_CHANGE_TIMER)
endif
call DestroyGroup(g)
set g = null
set tempu = null
call DestroyTimer(t)
set t = null
endfunction
private function onTimerExpired takes nothing returns nothing
call PauseUnit(PASSIVE_EREDAR,true)
if not IsUnitDeadBX(PASSIVE_EREDAR) then
call SetUnitAnimation(PASSIVE_EREDAR,"Spell")
endif
call PauseTimer(EREDAR_CHANGE_TIMER)
call TimerStart(EREDAR_VOID_TIMER,EREDAR_VOID_ZONE_COOLDOWN,false,null)
if PASSIVE_EREDAR==KILJAEDEN then
call PlaySoundOnUnitBJ( gg_snd_TichondriusWhat3, 100, KILJAEDEN )
call TimerStart(CreateTimer(),1.,false,function onTimerApplyHellfireDebuff)
else
call PlaySoundOnUnitBJ( gg_snd_N01Archimonde30, 100, ARCHIMONDE )
call TimerStart(CreateTimer(),1.,false,function onTimerApplyVortexDebuff)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,EREDAR_VOID_TIMER)
call TriggerAddAction(t,function onTimerExpired)
set t = null
endfunction
endlibrary
scope EredarsCast initializer onInit
globals
constant integer FIREHANDS_AURACODE = 'A06C'
private constant integer SLAMANIM_CODE = 'A04C'
constant integer FIREHANDS_BUFFCODE = 'B01S'
constant real FIREHANDS_BONUSDAMAGE = 100.
constant real FIREHANDS_SPLASH = 1.
private constant real NO_CAST_BEFORE_CHANGE = 8.
constant integer NULLBARRIER_AURACODE = 'A06D'
constant integer NULLBARRIER_BUFFCODE = 'B01T'
private constant integer NULLBARRIER_EXPLOSION_CODE = 'h03O'
private constant real NULLBARRIER_DURATION = 15.
private constant real NULLBARRIER_EXPLODE_AOE = 3000.
private constant real NULLBARRIER_DAMAGE_PER_CHARGE = 200.
private constant real NULLBARRIER_DAMAGE_DIFFICULTY_FACTOR = 0.2
private constant real NULLBARRIER_SPELL_RESIST = 0.8
private constant real NULLBARRIER_ATTACK_PROC_PERIOD = 2.5
timer NULLBARRIER_TIMER = CreateTimer()
timer FIREHANDS_TIMER = CreateTimer()
private constant integer CHARGESHASH = 202
private constant integer SPELLRESIST_HASH = 203
private constant integer LAST_ATTACK_HASH = 204
private constant real AOE = 250.
private constant real MAXKNOCKBACK = 250.
private constant real MAXHEIGHTKNOCKBACK = 75.
private constant real DURATIONKNOCKBACK = 0.15
private constant real BUFFDURATION = 15.
endglobals
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0. and not (GetFilterUnit()==CENARIUS)
endfunction
//On Kiljaedens's attack
private function onTimerAttack takes nothing returns nothing
local timer t = FIREHANDS_TIMER
local unit CASTER = LoadUnitHandle(C3_hash,GetHandleId(t),1)
local unit TARGET = LoadUnitHandle(C3_hash,GetHandleId(t),2)
local group g = CreateGroup()
local unit tempu = null
local real dist = 0.
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real xt = GetUnitX(TARGET)
local real yt = GetUnitY(TARGET)
local integer CHARGES = LoadInteger(C3_hash,GetHandleId(CASTER),CHARGESHASH)
set CHARGES = CHARGES - 1
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(TARGET),GetUnitY(TARGET),AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
if (xt-x)*(GetUnitX(tempu)-x)+(yt-y)*(GetUnitY(tempu)-y) >= 0 then
set dist = SquareRoot( (x-GetUnitX(tempu))*(x-GetUnitX(tempu))+(y-GetUnitY(tempu))*(y-GetUnitY(tempu)) )
if dist <= MAXKNOCKBACK then
call ParKnock(tempu,MAXHEIGHTKNOCKBACK*(1-dist/MAXKNOCKBACK),MAXKNOCKBACK-dist,DURATIONKNOCKBACK,Rad2Deg(Atan2(GetUnitY(tempu)-y,GetUnitX(tempu)-x)),true,"Abilities\\Weapons\\DemonHunterMissile\\DemonHunterMissile.mdl")
endif
endif
call GroupRemoveUnit(g,tempu)
endloop
call DestroyGroup(g)
if CHARGES <=0 then
call UnitRemoveAbility(CASTER,SLAMANIM_CODE)
call UnitRemoveAbility(CASTER,FIREHANDS_AURACODE)
call UnitRemoveAbility(CASTER,FIREHANDS_BUFFCODE)
else
call SaveInteger(C3_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
endif
call FlushChildHashtable(C3_hash,GetHandleId(t))
set t = null
set CASTER = null
set TARGET = null
set g = null
endfunction
private function onTimerReceivedAttack takes nothing returns nothing
local timer t = NULLBARRIER_TIMER
local unit CASTER = LoadUnitHandle(C3_hash,GetHandleId(t),2)
local unit ATTACKER = LoadUnitHandle(C3_hash,GetHandleId(t),1)
local integer CHARGES = LoadInteger(C3_hash,GetHandleId(CASTER),CHARGESHASH)
local group g = null
local unit tempu = null
local real DAMAGE = NULLBARRIER_DAMAGE_PER_CHARGE*(1+NULLBARRIER_DAMAGE_DIFFICULTY_FACTOR*CURRENT_DIFFICULTY)
local real SPELLRESIST_PER_CHARGE = LoadReal(C3_hash,GetHandleId(CASTER),SPELLRESIST_HASH)
local real ELAPSED = LoadReal(C3_hash,GetHandleId(CASTER),LAST_ATTACK_HASH)
if ELAPSED >= NULLBARRIER_ATTACK_PROC_PERIOD then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Shield Proced with: " + I2S(CHARGES) + " charges.")
set CHARGES = CHARGES - 1
call SaveReal(C3_hash,GetHandleId(CASTER),LAST_ATTACK_HASH,0.)
set tempu = CreateUnit(GetOwningPlayer(CASTER),NULLBARRIER_EXPLOSION_CODE,GetUnitX(CASTER),GetUnitY(CASTER),0.)
call SetUnitAnimation(tempu,"birth")
call UnitApplyTimedLife(tempu,'BHwe',1.25)
//call DestroyEffect(AddSpecialEffectTarget("DarkNova.mdx",CASTER,"chest"))
set g = CreateGroup()
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(g,GetUnitX(CASTER),GetUnitY(CASTER),NULLBARRIER_EXPLODE_AOE,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
call DealArcaneDamage(CASTER,tempu,DAMAGE)
call GroupRemoveUnit(g,tempu)
endloop
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash())-SPELLRESIST_PER_CHARGE)
call DestroyGroup(g)
if CHARGES <=0 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Shield ended no charges")
call UnitRemoveAbility(CASTER,NULLBARRIER_AURACODE)
call UnitRemoveAbility(CASTER,NULLBARRIER_BUFFCODE)
else
call SaveInteger(C3_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
endif
call FlushChildHashtable(C3_hash,GetHandleId(t))
endif
set g = null
set t = null
set CASTER = null
set ATTACKER = null
endfunction
private function onTimerCheckBuffDuration takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(C3_hash,GetHandleId(t),1)
local real duration = LoadReal(C3_hash,GetHandleId(t),2)
local real elapsed = LoadReal(C3_hash,GetHandleId(t),3)
local real ElapsedFromLastAttack = LoadReal(C3_hash,GetHandleId(CASTER),LAST_ATTACK_HASH)
local integer REMAINED_CHARGES = LoadInteger(C3_hash,GetHandleId(CASTER),CHARGESHASH)
local real SPELLRESIST_PER_CHARGE = LoadReal(C3_hash,GetHandleId(CASTER),SPELLRESIST_HASH)
set ElapsedFromLastAttack = ElapsedFromLastAttack + 0.25
call SaveReal(C3_hash,GetHandleId(CASTER),LAST_ATTACK_HASH,ElapsedFromLastAttack)
set elapsed = elapsed + 0.25
if elapsed >= duration then
if GetUnitAbilityLevel(CASTER,NULLBARRIER_AURACODE) > 0 then
call UnitRemoveAbility(CASTER,NULLBARRIER_AURACODE)
call UnitRemoveAbility(CASTER,NULLBARRIER_BUFFCODE)
endif
if REMAINED_CHARGES > 0 then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Shield ended due to duration")
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash())-REMAINED_CHARGES*SPELLRESIST_PER_CHARGE)
endif
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
else
call SaveReal(C3_hash,GetHandleId(t),3,elapsed)
endif
set t = null
set CASTER = null
endfunction
private function onCastNullBarrier takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(C3_hash,GetHandleId(t),1)
local timer t1 = null
local integer CHARGES = CURRENT_DIFFICULTY + udg_PlayersInGame
if EREDARS_BATTLE_INITIALIZED then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Null Barrier Casted")
call ResumeTimer(EREDAR_CHANGE_TIMER)
call ResumeTimer(EREDAR_VOID_TIMER)
call SaveReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash(),LoadReal(udg_hash,GetHandleId(CASTER),GetSpellResistHash())+NULLBARRIER_SPELL_RESIST)
//Give charges
call SaveInteger(C3_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
call SaveReal(C3_hash,GetHandleId(CASTER),SPELLRESIST_HASH,NULLBARRIER_SPELL_RESIST/CHARGES)
call SaveReal(C3_hash,GetHandleId(CASTER),LAST_ATTACK_HASH,NULLBARRIER_ATTACK_PROC_PERIOD)
//Give Buff
call UnitAddAbility(CASTER,NULLBARRIER_AURACODE)
set t1 = CreateTimer()
call SaveUnitHandle(C3_hash,GetHandleId(t1),1,CASTER)
call SaveReal(C3_hash,GetHandleId(t1),2,NULLBARRIER_DURATION)
call SaveReal(C3_hash,GetHandleId(t1),3,0.)
call TimerStart(t1,0.25,true,function onTimerCheckBuffDuration)
endif
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set t1 = null
set CASTER = null
endfunction
private function onBuffExpires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(C3_hash,GetHandleId(t),1)
if GetUnitAbilityLevel(CASTER,FIREHANDS_AURACODE) > 0 then
call UnitRemoveAbility(CASTER,SLAMANIM_CODE)
call UnitRemoveAbility(CASTER,FIREHANDS_AURACODE)
call UnitRemoveAbility(CASTER,FIREHANDS_BUFFCODE)
endif
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set CASTER = null
endfunction
private function onCastFirehands takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit CASTER = LoadUnitHandle(C3_hash,GetHandleId(t),1)
local timer t1 = null
local integer CHARGES = CURRENT_DIFFICULTY + udg_PlayersInGame
if EREDARS_BATTLE_INITIALIZED then
call ResumeTimer(EREDAR_CHANGE_TIMER)
call ResumeTimer(EREDAR_VOID_TIMER)
//Give attack charges
call SaveInteger(C3_hash,GetHandleId(CASTER),CHARGESHASH,CHARGES)
//Give attack slam animation
call UnitAddAbility(CASTER,SLAMANIM_CODE)
//Give Buff
call UnitAddAbility(CASTER,FIREHANDS_AURACODE)
set t1 = CreateTimer()
call SaveUnitHandle(C3_hash,GetHandleId(t1),1,CASTER)
call TimerStart(t1,BUFFDURATION,false,function onBuffExpires)
endif
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set t1 = null
set CASTER = null
endfunction
private function onTimerExpired takes nothing returns nothing
local timer t = null
if TimerGetRemaining(EREDAR_CHANGE_TIMER) < NO_CAST_BEFORE_CHANGE then
call TimerStart(EREDAR_CAST_TIMER,NO_CAST_BEFORE_CHANGE,false,null)
else
set t = CreateTimer()
call SetUnitAnimation(ACTIVE_EREDAR,"Spell")
call SaveUnitHandle(C3_hash,GetHandleId(t),1,ACTIVE_EREDAR)
call PauseTimer(EREDAR_CHANGE_TIMER)
call PauseTimer(EREDAR_VOID_TIMER)
call TimerStart(EREDAR_CAST_TIMER,EREDAR_CAST_COOLDOWN,false,null)
if ACTIVE_EREDAR==KILJAEDEN then
call PlaySoundOnUnitBJ( gg_snd_TichondriusYesAttack1, 100, KILJAEDEN )
call TimerStart(t,1.,false, function onCastFirehands)
else
call PlaySoundOnUnitBJ( gg_snd_N01Archimonde30, 100, ARCHIMONDE )
call TimerStart(t,1.,false, function onCastNullBarrier)
endif
endif
set t = null
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t1 = CreateTrigger()
local trigger t2 = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,EREDAR_CAST_TIMER)
call TriggerAddAction(t,function onTimerExpired)
call TriggerRegisterTimerExpireEvent(t1,FIREHANDS_TIMER)
call TriggerAddAction(t1,function onTimerAttack)
call TriggerRegisterTimerExpireEvent(t2,NULLBARRIER_TIMER)
call TriggerAddAction(t2,function onTimerReceivedAttack)
set t = null
set t1 = null
set t2 = null
endfunction
endscope
scope EredarsSargeres initializer onInit
globals
private constant integer EYE_CODE = 'h03B'
private constant integer RAY_CODE = 'h03C'
private constant real EYE_SUMMON_PERIOD = 5.
private constant real RAYS_DURAION = 10.
private constant real BEAM_AOE = 175.
private constant real AFFECTED_PERIOD = 0.5
private constant real RAY_DAMAGE_BASE = 150.
private constant real RAY_DAMAGE_DIFFICULTY_FACTOR = 0.5
private constant real BEAM_SPEED = 2000.
private constant real RAY_DIST = 2000.
private constant real BEAM_CREATE_PERIOD = 0.25
private constant string EXPLOSION_EFFECT = "Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl"
private constant string EXPLOSION_ATTACH = "chest"
private integer COUNT = 0
private real xmiddle = 0
private real ymiddle = 0
private group AFFECTED = CreateGroup()
private group TEMP_GROUP = null
private constant real PICONST = 3.14159
endglobals
private function CalculateXY takes nothing returns nothing
set COUNT = COUNT + 1
set xmiddle = xmiddle + GetUnitX(GetEnumUnit())
set ymiddle = ymiddle + GetUnitY(GetEnumUnit())
endfunction
private function GroupFilter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_temp_unit)) and GetWidgetLife(GetFilterUnit())>0.
endfunction
private function KillBeams takes nothing returns nothing
call KillUnit(GetEnumUnit())
endfunction
private function onTimerRemoveAffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_hash,GetHandleId(t),1)
call GroupRemoveUnit(AFFECTED,u)
call FlushChildHashtable(udg_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set u = null
endfunction
private function IsUnitCloseToRay takes unit u, unit CASTER, real rayAngle returns boolean
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real xc = GetUnitX(CASTER)
local real yc = GetUnitY(CASTER)
local real Xc = xc + 10*Cos(rayAngle)
local real Yc = yc + 10*Sin(rayAngle)
local real cosa = 0.
local real dist = SquareRoot( (x-xc)*(x-xc)+(y-yc)*(y-yc) )
local real Sprod = (Xc-xc) * (x-xc) + (Yc-yc)*(y-yc)
local real angle = Atan2(y-yc,x-xc)
if Sprod>=0 then
if dist <= BEAM_AOE then
return false
else
set cosa = ( Sprod) / ( SquareRoot( (Xc-xc)*(Xc-xc)+(Yc-yc)*(Yc-yc) ) * SquareRoot((x-xc)*(x-xc)+(y-yc)*(y-yc)) )
return (dist*SquareRoot(1-cosa*cosa) ) <= BEAM_AOE
endif
else
return false
endif
return false
endfunction
private function MoveBeams takes nothing returns nothing
local unit BEAM = GetEnumUnit()
if GetWidgetLife(BEAM)>0. then
call SetUnitX(BEAM,GetUnitX(BEAM)+(BEAM_SPEED/25.)*Cos(Deg2Rad(GetUnitFacing(BEAM))))
call SetUnitY(BEAM,GetUnitY(BEAM)+(BEAM_SPEED/25.)*Sin(Deg2Rad(GetUnitFacing(BEAM))))
else
call GroupRemoveUnit(TEMP_GROUP,BEAM)
endif
set BEAM = null
endfunction
private function onTimerRaysAction takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t1 = null
local unit CASTER = LoadUnitHandle(C3_hash,GetHandleId(t),1)
local real SinceLastBeam = LoadReal(C3_hash,GetHandleId(t),2)
local group g = LoadGroupHandle(C3_hash,GetHandleId(t),3)
local real x = GetUnitX(CASTER)
local real y = GetUnitY(CASTER)
local real Elapsed = LoadReal(C3_hash,GetHandleId(t),4)
local unit tempu = null
local integer i = 1
local boolean InRay = false
local real angle = 0.
local group tempGroup = CreateGroup()
local real DAMAGE = RAY_DAMAGE_BASE*(1+RAY_DAMAGE_DIFFICULTY_FACTOR*CURRENT_DIFFICULTY)
//dealing dmg
set udg_temp_unit = CASTER
call GroupEnumUnitsInRange(tempGroup, x, y , RAY_DIST+200., function GroupFilter)
loop
set tempu = FirstOfGroup(tempGroup)
exitwhen tempu==null
set InRay = IsUnitCloseToRay(tempu,CASTER,1*PICONST/2.) or IsUnitCloseToRay(tempu,CASTER,2*PICONST/2.) or IsUnitCloseToRay(tempu,CASTER,3*PICONST/2.) or IsUnitCloseToRay(tempu,CASTER,0.)
if not IsUnitInGroup(tempu,AFFECTED) and InRay then
call DealArcaneDamage(CASTER,tempu,DAMAGE)
call GroupAddUnit(AFFECTED,tempu)
call DestroyEffect(AddSpecialEffectTarget(EXPLOSION_EFFECT,tempu,EXPLOSION_ATTACH))
set t1 = CreateTimer()
call SaveUnitHandle(udg_hash,GetHandleId(t1),1,tempu)
call TimerStart(t1,AFFECTED_PERIOD, false, function onTimerRemoveAffect)
set t1 = null
endif
call GroupRemoveUnit(tempGroup,tempu)
endloop
call DestroyGroup(tempGroup)
//creatin and moving rays
set SinceLastBeam = SinceLastBeam + 0.04
if SinceLastBeam >= BEAM_CREATE_PERIOD then
set i = 1
loop
exitwhen i > 4
set angle = 0. + (i-1) * (PICONST/2.)
set tempu = CreateUnit(GetOwningPlayer(CASTER),RAY_CODE,x,y,Rad2Deg(angle))
call UnitApplyTimedLife(tempu,'BHwe',RAY_DIST/BEAM_SPEED)
call GroupAddUnit(g,tempu)
call SaveReal(C3_hash,GetHandleId(t),2,0.)
set i = i + 1
endloop
set tempu = null
else
call SaveReal(C3_hash,GetHandleId(t),2,SinceLastBeam)
endif
set TEMP_GROUP = g
call ForGroup(g,function MoveBeams)
set TEMP_GROUP = null
set Elapsed = Elapsed + 0.04
if Elapsed > RAYS_DURAION or not EREDARS_BATTLE_INITIALIZED then
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
call ForGroup(g,function KillBeams)
call DestroyGroup(g)
call FadeUnitIn(CASTER,3.)
else
call SaveReal(C3_hash,GetHandleId(t),4,Elapsed)
endif
set t = null
set g = null
set CASTER = null
set tempGroup = null
endfunction
private function onTimerStartRays takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit EYE = LoadUnitHandle(C3_hash,GetHandleId(t),1)
local timer t1 = CreateTimer()
call SaveUnitHandle(C3_hash,GetHandleId(t1),1,EYE)
call SaveReal(C3_hash,GetHandleId(t1),2,0.)
call SaveGroupHandle(C3_hash,GetHandleId(t1),3,CreateGroup())
call TimerStart(t1,0.04,true,function onTimerRaysAction)
call FlushChildHashtable(C3_hash,GetHandleId(t))
call DestroyTimer(t)
set t = null
set t1 = null
set EYE = null
endfunction
private function onCast takes nothing returns nothing
local real xmin = GetRectMinX(gg_rct_EredarBattlefield)
local real xmax = GetRectMaxX(gg_rct_EredarBattlefield)
local real x = 0.
local real y = 0.
local unit EYE = null
local timer t = null
if EREDARS_BATTLE_INITIALIZED then
set COUNT = 1
set xmiddle = GetUnitX(ACTIVE_EREDAR)
set ymiddle = GetUnitY(ACTIVE_EREDAR)
call ResumeTimer(EREDAR_CHANGE_TIMER)
call ResumeTimer(EREDAR_VOID_TIMER)
call ResumeTimer(EREDAR_CAST_TIMER)
call ForGroup(EREDARS_BATTLEGROUP, function CalculateXY)
set x = xmiddle / COUNT
set y = ymiddle / COUNT
set EYE = CreateUnit(GetOwningPlayer(ACTIVE_EREDAR),EYE_CODE,x,y,270.)
call FadeUnitOut(EYE,EYE_SUMMON_PERIOD,false)
call PlaySoundOnUnitBJ( gg_snd_SargerasLaugh, 100, ACTIVE_EREDAR )
set t = CreateTimer()
call SaveUnitHandle(C3_hash,GetHandleId(t),1,EYE)
call TimerStart(t,EYE_SUMMON_PERIOD,false,function onTimerStartRays)
endif
set EYE = null
set t = null
endfunction
private function onTimerExpired takes nothing returns nothing
call PauseTimer(EREDAR_CHANGE_TIMER)
call PauseTimer(EREDAR_VOID_TIMER)
call PauseTimer(EREDAR_CAST_TIMER)
call SetUnitAnimation(ACTIVE_EREDAR,"Spell")
call TimerStart(EREDAR_SARGERAS_TIMER,EREDAR_SARGERAS_COOLDOWN,false,null)
call TimerStart(CreateTimer(),1.,false, function onCast)
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerExpireEvent(t,EREDAR_SARGERAS_TIMER)
call TriggerAddAction(t,function onTimerExpired)
set t = null
endfunction
endscope
library EredarsDefeat initializer onInit requires EredarsVoid
globals
boolean EREDARS_BRIDGE_COLLAPSE_SCENE_STARTED = false
private constant integer BRIDGE_EXPLOSION_CODE = 'h03D'
endglobals
private function Conds takes nothing returns boolean
return GetTriggerUnit() == ARCHIMONDE or GetTriggerUnit() == KILJAEDEN
endfunction
private function onTimerUnpause takes nothing returns nothing
local integer i = 1
call DestroyTimer(GetExpiredTimer())
//call DisplayTextToForce(GetPlayersAll(), "Unpause timer Expired and Destroyed")
loop
exitwhen i > udg_PlayerCount
call PauseUnitBJ( false, udg_Heroes[i] )
set i = i + 1
endloop
//call DisplayTextToForce(GetPlayersAll(), "Heroes unpaused")
call TimerStart(CreateTimer(),10.,false,function Victory)
//call DisplayTextToForce(GetPlayersAll(), "VictoryTimerStarted")
endfunction
private function onTimerChangeLoc takes nothing returns nothing
local integer i = 1
call DestroyTimer(GetExpiredTimer())
//call DisplayTextToForce(GetPlayersAll(), "ChangeLoc timer Expired and Destroyed")
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 5.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
//call DisplayTextToForce(GetPlayersAll(), "FadeIN Started")
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
call ResetToGameCameraForPlayer(udg_Players[i],0.)
if IsUnitDeadBX(udg_Heroes[i]) then
call ReviveHero(udg_Heroes[i],GetRectCenterX(gg_rct_DummySelect),GetRectCenterY(gg_rct_DummySelect),false)
call SetUnitAnimation(udg_Heroes[i],"death")
endif
if i == 1 then
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_IslandP1),GetRectCenterY(gg_rct_IslandP1))
endif
if i == 2 then
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_IslandP2),GetRectCenterY(gg_rct_IslandP2))
endif
if i == 3 then
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_IslandP3),GetRectCenterY(gg_rct_IslandP3))
endif
if i == 4 then
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_IslandP4),GetRectCenterY(gg_rct_IslandP4))
endif
if i == 5 then
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_IslandP5),GetRectCenterY(gg_rct_IslandP5))
endif
if i == 6 then
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_IslandP6),GetRectCenterY(gg_rct_IslandP6))
endif
set i = i + 1
endloop
//call DisplayTextToForce(GetPlayersAll(), "Movement done and Camera panned")
set EREDARS_BRIDGE_COLLAPSE_SCENE_STARTED = false
call TimerStart(CreateTimer(),5.,false, function onTimerUnpause)
//call DisplayTextToForce(GetPlayersAll(), "Unpause timer started")
endfunction
private function onTimerKillBridge takes nothing returns nothing
local integer i = 1
local unit EXPLOSION = null
call DestroyTimer(GetExpiredTimer())
//call DisplayTextToForce(GetPlayersAll(), "KillBridge timer destroed")
call TimerStart(CreateTimer(), 10., false, function onTimerChangeLoc)
//call DisplayTextToForce(GetPlayersAll(), "ChangeLoc timer started")
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 5.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
//call DisplayTextToForce(GetPlayersAll(), "FadeOut used")
loop
exitwhen i > udg_PlayerCount
if not IsUnitDeadBX(udg_Heroes[i]) then
call PauseUnit(udg_Heroes[i],true)
call SetUnitAnimation(udg_Heroes[i],"death")
endif
call MakeUnitFall(udg_Heroes[i],GetTerrainZ(GetUnitX(udg_Heroes[i]),GetUnitY(udg_Heroes[i]))-200.,0.,5.)
set i = i + 1
endloop
//call DisplayTextToForce(GetPlayersAll(), "Death and fall finished")
set EXPLOSION = CreateUnit(GetOwningPlayer(ACTIVE_EREDAR), BRIDGE_EXPLOSION_CODE, GetRectCenterX(gg_rct_EredarVortexCenter),GetRectCenterY(gg_rct_EredarVortexCenter),0 )
call UnitApplyTimedLife(EXPLOSION,'BHwe',5.)
//call DisplayTextToForce(GetPlayersAll(), "Explosion created")
call KillDestructable( gg_dest_B00E_2422 )
//call DisplayTextToForce(GetPlayersAll(), "Bridge killed")
set EXPLOSION = null
endfunction
private function onTimerStartShaking takes nothing returns nothing
local integer i = 1
call PlaySoundOnUnitBJ( gg_snd_SargerasRoar, 100, ACTIVE_EREDAR )
loop
exitwhen i > udg_PlayerCount
call CameraSetEQNoiseForPlayer( udg_Players[i], 6.00 )
set i = i + 1
endloop
call TimerStart(CreateTimer(),5., false, function onTimerKillBridge)
call DestroyTimer(GetExpiredTimer())
endfunction
private function Acts takes nothing returns nothing
local integer i = 1
if GetWidgetLife(ARCHIMONDE)>0. or GetWidgetLife(KILJAEDEN)>0. then
if not EREDARS_CHANGE_STARTED then
call TimerStart(EREDAR_CHANGE_TIMER,1.,false,null)
endif
else //Win
call DisplayTextToForce(GetPlayersAll(), "|c00CDAF00Eredars have been defeated!|r")
set EREDARS_DEFEATED = true
set EREDARS_BATTLE_INITIALIZED = false
set IS_BOSS_BATTLE = false
set IS_HEROES_IN_COMBAT = false
set EREDARS_BRIDGE_COLLAPSE_SCENE_STARTED = true
call DestroyTimer(EREDAR_VOID_TIMER)
call DestroyTimer(EREDAR_CHANGE_TIMER)
call DestroyTimer(EREDAR_CAST_TIMER)
call DestroyTimer(EREDAR_SARGERAS_TIMER)
call EredarsClearFireVortex()
call TimerStart(CreateTimer(), 4., false, function onTimerStartShaking)
loop
exitwhen i > udg_PlayerCount
if IsUnitDeadBX(udg_Heroes[i]) then
call ReviveHero(udg_Heroes[i],GetRectCenterX(gg_rct_EredarVortexCenter)+GetRandomReal(-200,200),GetRectCenterY(gg_rct_EredarVortexCenter)+GetRandomReal(-200,200),false)
endif
if not RectContainsUnit( gg_rct_EredarBattlefield, udg_Heroes[i]) then
call SetUnitPosition(udg_Heroes[i],GetRectCenterX(gg_rct_EredarVortexCenter)+GetRandomReal(-200,200),GetRectCenterY(gg_rct_EredarVortexCenter)+GetRandomReal(-200,200))
endif
set i = i + 1
endloop
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function Acts )
set t = null
endfunction
endlibrary
library EredarsBattleGroup initializer onInit requires IsUnitDead, EredarsVoid,HeroRevival
globals
boolean EREDARS_BATTLE_INITIALIZED = false
boolean EREDARS_SUMMONED = false
boolean EREDARS_BEFORE_BATTLE_TIMER_STARTED = false
group EREDARS_BATTLEGROUP = CreateGroup()
boolean EREDARS_DEFEATED = false
private integer ENRAGE_ABILCODE = 'A09O'
private timer ENRAGE_TIMER = null
private real ENRAGE_STACK_PERIOD = 40.
endglobals
private function CheckDeadUnits takes nothing returns nothing
if GetEnumUnit()==null or not (GetWidgetLife(GetEnumUnit())>0.) or IsUnitType(GetEnumUnit(), UNIT_TYPE_DEAD) then
call GroupRemoveUnit(EREDARS_BATTLEGROUP,GetEnumUnit())
endif
endfunction
private function onTimerEnrage takes nothing returns nothing
call SetUnitAbilityLevel(ARCHIMONDE, ENRAGE_ABILCODE, GetUnitAbilityLevel(ARCHIMONDE,ENRAGE_ABILCODE)+ 1)
call SetUnitAbilityLevel(KILJAEDEN, ENRAGE_ABILCODE, GetUnitAbilityLevel(KILJAEDEN,ENRAGE_ABILCODE)+ 1)
endfunction
private function onTimer takes nothing returns nothing
local integer i = 1
local integer j = 1
if EREDARS_DEFEATED then
call DestroyTimer(GetExpiredTimer())
endif
if EREDARS_BATTLE_INITIALIZED then
if ENRAGE_TIMER == null then
set ENRAGE_TIMER = CreateTimer()
call TimerStart(ENRAGE_TIMER, ENRAGE_STACK_PERIOD, true, function onTimerEnrage)
endif
call ForGroup(EREDARS_BATTLEGROUP, function CheckDeadUnits)
if CountUnitsInGroup(EREDARS_BATTLEGROUP)==0 then
set j = 1
loop
exitwhen j > udg_PlayerCount
if IsUnitDeadBX(udg_Heroes[j]) then
call ImmediatelyReviveHero(udg_Heroes[j])
endif
set j = j + 1
endloop
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5.,"All heroes are dead. Resetting |c00FF0000EREDARS'|r battleground...")
set EREDARS_BATTLE_INITIALIZED = false
set IS_BOSS_BATTLE = false
set EREDARS_BEFORE_BATTLE_TIMER_STARTED = false
call DestroyTimer(ENRAGE_TIMER)
set ENRAGE_TIMER = null
call PauseTimer(EREDAR_VOID_TIMER)
call PauseTimer(EREDAR_CHANGE_TIMER)
call PauseTimer(EREDAR_CAST_TIMER)
call PauseTimer(EREDAR_SARGERAS_TIMER)
set EREDARS_CHANGES_COUNT = 0
set EREDARS_SARGERAS_ACTIVATED = false
call EredarsClearFireVortex()
if IsUnitDeadBX(ARCHIMONDE) then
call ReviveHero(ARCHIMONDE, GetRectCenterX(gg_rct_EredarsPlatformLeft), GetRectCenterY(gg_rct_EredarsPlatformLeft),false)
endif
if IsUnitDeadBX(KILJAEDEN) then
call ReviveHero(KILJAEDEN, GetRectCenterX(gg_rct_EredarsPlatformRight), GetRectCenterY(gg_rct_EredarsPlatformRight),false)
endif
call SetUnitAbilityLevel(ARCHIMONDE, ENRAGE_ABILCODE, 1)
call SetUnitAbilityLevel(KILJAEDEN, ENRAGE_ABILCODE, 1)
call SetUnitInvulnerable(ARCHIMONDE,true)
call PauseUnit(ARCHIMONDE,true)
call SetUnitInvulnerable(KILJAEDEN,true)
call PauseUnit(KILJAEDEN,true)
call SetUnitX(ARCHIMONDE,GetRectCenterX(gg_rct_EredarsPlatformLeft))
call SetUnitY(ARCHIMONDE,GetRectCenterY(gg_rct_EredarsPlatformLeft))
call SetUnitFacing(ARCHIMONDE,270.)
call FadeUnitOut(ARCHIMONDE,5.,false)
call SetUnitX(KILJAEDEN,GetRectCenterX(gg_rct_EredarsPlatformRight))
call SetUnitY(KILJAEDEN,GetRectCenterY(gg_rct_EredarsPlatformRight))
call SetUnitFacing(KILJAEDEN,270.)
call FadeUnitOut(KILJAEDEN,5.,false)
call UnitRemoveBuffsBJ( bj_REMOVEBUFFS_ALL, ARCHIMONDE )
call UnitRemoveBuffsBJ( bj_REMOVEBUFFS_ALL, KILJAEDEN )
call SetUnitTimeScale(ARCHIMONDE,1.)
call SetUnitTimeScale(KILJAEDEN,1.)
call SetUnitAnimation(ARCHIMONDE,"stand")
call SetUnitAnimation(KILJAEDEN,"stand")
call SetUnitLifePercentBJ( ARCHIMONDE, 100 )
call SetUnitManaPercentBJ( ARCHIMONDE, 100 )
call SetUnitLifePercentBJ( KILJAEDEN, 100 )
call SetUnitManaPercentBJ( KILJAEDEN, 100 )
call Aggro.clear(ARCHIMONDE,null)
call Aggro.clear(KILJAEDEN,null)
call KillDestructable(EREDAR_BARRIER)
loop
exitwhen i > udg_PlayerCount
call CameraClearNoiseForPlayer( udg_Players[i] )
set i = i + 1
endloop
endif
if IsUnitDeadBX(ARCHIMONDE) and IsUnitDeadBX(KILJAEDEN) then
//call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15.,"Eredars is Dead. Destroying this timer...")
call DestroyTimer(GetExpiredTimer())
call DestroyGroup(EREDARS_BATTLEGROUP)
endif
else
if EREDARS_SUMMONED then
//call SetUnitLifePercentBJ( udg_Supremus, 100 )
// call SetUnitManaPercentBJ( udg_Supremus, 100 )
//call PauseUnitBJ( false, udg_Supremus )
endif
endif
endfunction
private function Conds takes nothing returns boolean
local integer i = 1
loop
exitwhen i > udg_PlayerCount
if udg_Heroes[i] == GetTriggerUnit() and not IsUnitInGroup(GetTriggerUnit(), EREDARS_BATTLEGROUP) then
return true
endif
set i = i + 1
endloop
return false
endfunction
private function onTimerStartBattle takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
call PauseUnit(ACTIVE_EREDAR,false)
call SetUnitX(ACTIVE_EREDAR,GetRectCenterX(gg_rct_EredarVortexCenter))
call SetUnitY(ACTIVE_EREDAR,GetRectCenterY(gg_rct_EredarVortexCenter))
//call DestroyEffect(AddSpecialEffectTarget("Void Disc.mdx", ACTIVE_EREDAR,"origin"))
call SetUnitAnimation(ACTIVE_EREDAR,"Stand")
call FadeUnitOut(ACTIVE_EREDAR,2.,false)
call SetUnitInvulnerable(ACTIVE_EREDAR,false)
call SetUnitInvulnerable(PASSIVE_EREDAR,true)
call DestroyTimer(t)
set t = null
endfunction
private function StartBattle takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = 1
local integer k = GetRandomInt(1,2)
set EREDAR_BARRIER = CreateDestructable('B00G',GetRectCenterX(gg_rct_EredarBarrier),GetRectCenterY(gg_rct_EredarBarrier),0.,2.,1)
if k==1 then
set ACTIVE_EREDAR = ARCHIMONDE
set PASSIVE_EREDAR = KILJAEDEN
else
set ACTIVE_EREDAR = KILJAEDEN
set PASSIVE_EREDAR = ARCHIMONDE
endif
set EREDARS_BATTLE_INITIALIZED = true
set IS_BOSS_BATTLE = true
call TimerStart(EREDAR_VOID_TIMER,EREDAR_VOID_ZONE_COOLDOWN,false,null)
call TimerStart(EREDAR_CHANGE_TIMER,EREDAR_CHANGE_COOLDOWN,false,null)
call TimerStart(EREDAR_CAST_TIMER,EREDAR_CAST_COOLDOWN,false,null)
call SetUnitAnimation(ACTIVE_EREDAR,"Spell Slam")
call TimerStart(CreateTimer(), 3., false, function onTimerStartBattle)
call DestroyTimer(t)
set t = null
endfunction
private function onEnter takes nothing returns nothing
local integer i = 1
if not EREDARS_DEFEATED then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3.,"|cff80ff80" + GetUnitName(GetTriggerUnit()) + "|r enters Eredars battlefield")
call GroupAddUnit(EREDARS_BATTLEGROUP, GetTriggerUnit())
endif
if EREDARS_SUMMONED and not EREDARS_BATTLE_INITIALIZED and not EREDARS_DEFEATED then
if not EREDARS_BEFORE_BATTLE_TIMER_STARTED then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5.,"|c00FF0000Eredars'|r battleground will be activated in 10 seconds.")
call TimerStart(CreateTimer(),10.,false,function StartBattle)
set EREDARS_BEFORE_BATTLE_TIMER_STARTED = true
endif
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterEnterRectSimple( t, gg_rct_EredarBattlefield )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function onEnter )
call TimerStart(CreateTimer(),1.,true,function onTimer)
set t = null
endfunction
endlibrary