Name | Type | is_array | initial_value |
Airship | boolean | Yes | |
ArmorSlot | item | Yes | |
ArmorSpell | integer | Yes | |
Battlefield | rect | No | |
BattleRegion | rect | Yes | |
BattleTimer | timer | No | |
BattleTitle | string | No | |
BattleWarnTimer | timer | No | |
Beach | rect | Yes | |
Blight | rect | Yes | |
Block | group | No | |
Cursors | location | Yes | |
DemonRunes | integer | No | |
Desert | rect | Yes | |
Dunes | rect | Yes | |
ElfForest | rect | Yes | |
EnemyGeneral | unit | No | |
EquipmentShow | boolean | Yes | |
Forest | rect | Yes | |
GoodGeneral | unit | No | |
HauntedForest | rect | Yes | |
Hotkeys | hashtable | No | |
InBattle | boolean | No | |
InForest | boolean | No | |
ItemCapabilties | hashtable | No | |
ItemClasses | hashtable | No | |
Jungle | rect | Yes | |
MainSlot | item | Yes | |
MainSpell | integer | Yes | |
MapBattle | unit | No | |
MapFlag | unit | Yes | |
MapHero | unit | Yes | |
MapLocation | location | Yes | |
MapShip | unit | Yes | |
OffhandSlot | item | Yes | |
OffhandSpell | integer | Yes | |
Pack | unit | Yes | |
Palms | rect | Yes | |
PhysicsUnits | group | No | |
Plains | rect | Yes | |
PlayerCount | integer | No | |
PortalMapLocation | location | Yes | |
Portals | location | Yes | |
Quests | quest | Yes | |
RainForest | rect | Yes | |
Rolls | integer | Yes | |
Sea | rect | Yes | |
Skills | string | Yes | |
SnowForest | rect | Yes | |
SnowPlains | rect | Yes | |
SpellCaster | unit | No | |
SpellTarget | unit | No | |
SpellTimers | hashtable | No | |
StandIn | unit | Yes | |
UnitPhysics | hashtable | No | |
Votes | boolean | Yes | |
World | hashtable | No |
library World
function StartWorld takes nothing returns nothing
set udg_World = InitHashtable()
call StopSound(bj_dayAmbientSound, true, true)
call StopSound(bj_nightAmbientSound, true, true)
endfunction
function ToWorld takes unit u returns nothing
local integer pid = GetConvertedPlayerId(GetOwningPlayer(u))
local real scaling = BlzGetUnitRealField(u, UNIT_RF_SCALING_VALUE)
if u != udg_MapHero[pid] and u != udg_StandIn[pid] then
return
endif
call SetUnitPositionLoc( udg_MapFlag[pid], GetRectCenter(gg_rct_Packs) )
if udg_MapShip[pid] != null then
set udg_BattleRegion[pid] = udg_Sea[pid]
call SetUnitPositionLoc( u, OffsetLocation(GetRectCenter(udg_BattleRegion[pid]), 0, -300.00) )
call SelectUnitForPlayerSingle( udg_MapShip[pid], ConvertedPlayer(pid) )
call ResetToGameCameraForPlayer( GetOwningPlayer(u), 0 )
call SetCameraTargetControllerNoZForPlayer( ConvertedPlayer(pid), udg_MapShip[pid], 0, 0, false )
if GetUnitTypeId(udg_MapShip[pid]) == 'h013' then
call SetCameraFieldForPlayer( ConvertedPlayer(pid), CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 0 )
call SetCameraFieldForPlayer( ConvertedPlayer(pid), CAMERA_FIELD_TARGET_DISTANCE, 2000.00, 1.00 )
call SetCameraFieldForPlayer( ConvertedPlayer(pid), CAMERA_FIELD_ANGLE_OF_ATTACK, 320.00, 1.00 )
elseif GetLocalPlayer() == GetOwningPlayer(u) then
call PlaySoundBJ( gg_snd_GoblinShipyardWhat1 )
endif
else
call SetUnitScalePercent( u, scaling*40, scaling*40, scaling*40 )
call BlzSetUnitRealFieldBJ( u, UNIT_RF_SELECTION_SCALE, 0.30 )
call SetUnitMoveSpeed( u, ( GetUnitDefaultMoveSpeed(u) / 2.00 ) )
call SetUnitPositionLoc( u, udg_MapLocation[pid] )
call SetCameraFieldForPlayer( ConvertedPlayer(pid), CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 0 )
call SetCameraFieldForPlayer( ConvertedPlayer(pid), CAMERA_FIELD_ANGLE_OF_ATTACK, 304.00, 0 )
if udg_Airship[pid] == true then
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(AirshipButton, true)
endif
endif
endif
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(ReturnButton, false)
call ClearMapMusicBJ( )
call StopMusicBJ( false )
call PlayMusicBJ( gg_snd_SadMystery )
endif
set udg_BattleRegion[pid] = null
endfunction
function ToSea takes unit u returns nothing
local real scaling = BlzGetUnitRealField(u, UNIT_RF_SCALING_VALUE)
local integer pid = GetConvertedPlayerId(GetOwningPlayer(u))
call SelectUnitForPlayerSingle( udg_MapShip[pid], ConvertedPlayer(pid) )
call SetCameraTargetControllerNoZForPlayer( ConvertedPlayer(pid), udg_MapShip[pid], 0, 0, false )
call SetUnitLifePercentBJ( udg_MapShip[pid], RMaxBJ(1.00, GetUnitLifePercent(udg_MapHero[pid])))
set udg_BattleRegion[pid] = udg_Sea[pid]
call SetUnitPositionLoc( udg_MapHero[pid], GetRectCenter(udg_Sea[pid]) )
call SetUnitPositionLoc( udg_MapFlag[pid], GetRectCenter(gg_rct_Packs) )
//call BlzSetUnitRealFieldBJ( udg_MapHero[pid], UNIT_RF_SELECTION_SCALE, 1.00 )
call SetUnitScalePercent( udg_MapHero[pid], scaling*100, scaling*100, scaling*100 )
call SetUnitMoveSpeed( udg_MapHero[pid], GetUnitDefaultMoveSpeed(udg_MapHero[pid]) )
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(u), udg_MapShip[pid], 0, 0, false )
call SetCameraFieldForPlayer( ConvertedPlayer(pid), CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 0 )
call SetCameraFieldForPlayer( ConvertedPlayer(pid), CAMERA_FIELD_ANGLE_OF_ATTACK, 304.00, 0 )
call SelectUnitForPlayerSingle( udg_MapShip[pid], GetOwningPlayer(u) )
if udg_Airship[pid] == true then
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(AirshipButton, false)
endif
endif
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(ReturnButton, false)
call PlaySoundBJ( gg_snd_GoblinShipyardWhat1 )
endif
endfunction
function ToSky takes unit hero returns nothing
local integer p
local unit airship
local real scaling = BlzGetUnitRealField(hero, UNIT_RF_SCALING_VALUE)
set p = GetConvertedPlayerId(GetOwningPlayer(hero))
set airship = udg_MapShip[p]
set udg_BattleRegion[p] = gg_rct_Sea_1
call SetUnitPositionLoc( udg_MapFlag[p], GetRectCenter(gg_rct_Packs) )
call SetUnitScalePercent( hero, scaling*100, scaling*100, scaling*100 )
call BlzSetUnitRealFieldBJ( hero, UNIT_RF_SELECTION_SCALE, 1.00 )
call SetUnitMoveSpeed( hero, GetUnitDefaultMoveSpeed(hero) )
call SetUnitPositionLoc( hero, OffsetLocation(GetRectCenter(udg_BattleRegion[p]), 0, -300.00) )
call SetUnitFlyHeightBJ( airship, 500.00, 0.00 )
call SetUnitFlyHeightBJ( airship, 450.00, 150.00 )
call SetCameraFieldForPlayer( GetOwningPlayer(hero), CAMERA_FIELD_TARGET_DISTANCE, 2000.00, 1.00 )
call SetCameraFieldForPlayer( GetOwningPlayer(hero), CAMERA_FIELD_ANGLE_OF_ATTACK, 320.00, 1.00 )
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(hero), airship, 0, 0, false )
call SelectUnitForPlayerSingle( airship, GetOwningPlayer(hero) )
endfunction
function ToLocation takes unit u returns nothing
local integer p = GetConvertedPlayerId(GetOwningPlayer(u))
local real scaling = BlzGetUnitRealField(u, UNIT_RF_SCALING_VALUE)
call SetUnitPositionLoc( udg_MapFlag[p], udg_MapLocation[p] )
call SetUnitScalePercent( u, scaling*100, scaling*100, scaling*100 )
call BlzSetUnitRealFieldBJ( u, UNIT_RF_SELECTION_SCALE, 1.00 )
call SetUnitMoveSpeed( u, GetUnitDefaultMoveSpeed(u) )
call SetCameraFieldForPlayer( GetOwningPlayer(u), CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 0 )
call SetCameraFieldForPlayer( GetOwningPlayer(u), CAMERA_FIELD_ANGLE_OF_ATTACK, 304.00, 0 )
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(AirshipButton, false)
call BlzFrameSetVisible(ReturnButton, false)
endif
set udg_MapShip[p] = null
call TriggerSleepAction( 0.00 )
call IssueImmediateOrder( u, "stop" )
endfunction
function ToUnderwater takes unit u returns nothing
if GetLocalPlayer() == GetOwningPlayer(u) then
call SetTerrainFogExBJ( 0, -250.00, 2250.00, 0.50, 0.00, 0.00, 60.00 )
endif
endfunction
function ToAbovewater takes unit u returns nothing
if GetLocalPlayer() == GetOwningPlayer(u) then
call ResetTerrainFogBJ( )
endif
endfunction
function ToTown takes unit u returns nothing
local integer p = GetConvertedPlayerId(GetOwningPlayer(u))
set udg_PortalMapLocation[p] = udg_MapLocation[p]
call ToLocation(u)
endfunction
function BattleTheme takes unit u returns nothing
if (GetLocalPlayer() == GetOwningPlayer(u)) then
call ClearMapMusicBJ( )
call StopMusicBJ( false )
call PlayMusicExBJ( gg_snd_PursuitTheme, 15.00, 0 )
call SetMusicOffsetBJ( 15.00 )
endif
endfunction
function ToBattle takes unit u returns nothing
local trigger t = GetTriggeringTrigger()
local integer pid = GetConvertedPlayerId(GetOwningPlayer(u))
local real scaling = BlzGetUnitRealField(u, UNIT_RF_SCALING_VALUE)
local location loc = GetRectCenter(udg_BattleRegion[pid])
local unit gu
local group g
call SaveInteger(udg_World, GetHandleId(t), StringHash("pid"), pid)
call SetUnitScalePercent( u, scaling*100, scaling*100, scaling*100 )
call BlzSetUnitRealFieldBJ( u, UNIT_RF_SELECTION_SCALE, 1.00 )
call SetUnitMoveSpeed( u, GetUnitDefaultMoveSpeed(u) )
call SetCameraFieldForPlayer( GetOwningPlayer(u), CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 0 )
call SetCameraFieldForPlayer( GetOwningPlayer(u), CAMERA_FIELD_ANGLE_OF_ATTACK, 304.00, 0 )
call SetUnitPositionLoc( udg_MapFlag[pid], udg_MapLocation[pid] )
call SetUnitPositionLoc( u, OffsetLocation(GetRectCenter(udg_BattleRegion[pid]), 0, -300.00) )
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(ReturnButton, true)
call BlzFrameSetVisible(AirshipButton, false)
endif
if GetUnitTypeId(u) == 'h000' or GetUnitTypeId(u) == 'n002' then
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(u)), "Click the |cffc3dbffReturn|r button at the bottom left, by the minimap, to leave fights." )
endif
set g = GetUnitsInRectAll(udg_BattleRegion[pid])
loop
set gu = FirstOfGroup(g)
exitwhen gu == null
if GetOwningPlayer(gu) == Player(PLAYER_NEUTRAL_AGGRESSIVE) then
call IssuePointOrderLocBJ( gu, "smart", Location(GetLocationX(loc), GetLocationY(loc)-100) )
endif
call GroupRemoveUnit(g,gu)
endloop
call IssueImmediateOrder( u, "stop" )
call BattleTheme(u)
call RemoveLocation(loc)
call DestroyGroup(g)
set loc = null
set g = null
endfunction
function TreeDestructible takes nothing returns boolean
local integer id = GetDestructableTypeId(GetEnumDestructable())
return id == 'B009' or id == 'B008' or id == 'B005' or id == 'B006' or id == 'B00A' or id == 'B001' or id == 'B007' or id == 'B00C' or id == 'B00B' or id == 'B00D'
endfunction
function CountTrees takes nothing returns nothing
if udg_InForest == false then
set udg_InForest = TreeDestructible()
endif
endfunction
function InForest takes unit u returns boolean
local real radius = 55.0
local rect r = Rect(GetUnitX(u) - radius, GetUnitY(u) - radius, GetUnitX(u) + radius, GetUnitY(u) + radius)
set udg_InForest = false
call EnumDestructablesInRect(r, null, function CountTrees)
return udg_InForest
endfunction
function BattleUnits takes integer n, integer utype, integer pid returns nothing
if n == 0 then
return
endif
call CreateNUnitsAtLoc( n, utype, Player(PLAYER_NEUTRAL_AGGRESSIVE), OffsetLocation(GetRectCenter(udg_BattleRegion[pid]), 0, 300.00), 270.00 )
endfunction
function Lava takes unit hero returns nothing
local location loc
local effect fx
if hero == null then
return
endif
set loc = GetUnitLoc(hero)
if GetTerrainTypeBJ(loc) == 'Dlvc' and GetUnitAbilityLevel(hero, 'B005') == 0 then
set fx = AddSpecialEffectTargetUnitBJ( "origin", hero, "Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl" )
// call BlzSetSpecialEffectHeight( fx, 50.00 )
call BlzSetSpecialEffectScale( fx, 1.50 )
call UnitRemoveAbility(hero, 'Bfro')
call UnitDamageTargetBJ( gg_unit_n015_0521, hero, 6.0, ATTACK_TYPE_HERO, DAMAGE_TYPE_FIRE )
call TriggerSleepAction( 1.00 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Frost takes unit source, unit target returns nothing
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(target), GetUnitY(target), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A004' )
call IssueTargetOrder( caster , "frostnova", target )
call RemoveUnit( caster )
endfunction
function Frostbite takes unit hero returns nothing
local location loc
local effect fx
if hero == null then
return
endif
set loc = GetUnitLoc(hero)
if GetTerrainTypeBJ(loc) == 'cWc1' and GetUnitAbilityLevel(hero, 'B004') == 0 then
call UnitDamageTargetBJ( gg_unit_n02P_1513, hero, 2.0, ATTACK_TYPE_HERO, DAMAGE_TYPE_COLD )
call Frost( gg_unit_n02P_1513, hero )
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Lightning takes unit target returns nothing
local location loc = GetUnitLoc(target)
local effect fx
if (GetRandomInt(1, 2) == 1) then
set fx = AddSpecialEffectLoc( "Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl", loc )
call UnitDamageTargetBJ( gg_unit_n015_0521, target, 25.0, ATTACK_TYPE_HERO, DAMAGE_TYPE_LIGHTNING )
call PlaySoundAtPointBJ( gg_snd_LightningBolt, 100, loc, 0 )
call TriggerSleepAction( 1.00 )
//call StopSoundBJ(gg_snd_LightningBolt, false)
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Dunk takes unit source, unit target returns nothing
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(target), GetUnitY(target), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A02F' )
call IssueTargetOrder( caster , "frostnova", target )
call RemoveUnit( caster )
endfunction
function Drown takes unit hero returns nothing
local unit caster
local location loc
local boolean water
local effect fx
if hero == null then
return
endif
set loc = GetUnitLoc(hero)
set water = not IsTerrainPathableBJ(loc, PATHING_TYPE_FLOATABILITY) and (RectContainsUnit(gg_rct_Sunken_Ruins, hero) or RectContainsUnit(gg_rct_Sunken_City, hero))
if water and GetUnitAbilityLevel(hero, 'B006') == 0 and GetTerrainTypeBJ(loc) != 'Ywmb' then
set fx = AddSpecialEffectTargetUnitBJ( "overhead", hero, "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl" )
call Dunk(gg_unit_n02P_1513, hero)
call UnitDamageTargetBJ( gg_unit_n015_0521, hero, 6.0, ATTACK_TYPE_HERO, DAMAGE_TYPE_FORCE )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Demongate takes unit target returns nothing
local location loc = GetUnitLoc(target)
local effect fx
local effect fx2
if udg_DemonRunes >= 3 then
return
endif
set fx = AddSpecialEffectTargetUnitBJ( "origin", target, "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl" )
set fx2 = AddSpecialEffectTargetUnitBJ( "chest", target, "Objects\\Spawnmodels\\Undead\\UndeadBlood\\UndeadBloodAbomination.mdl" )
call BlzSetSpecialEffectScale( fx, 0.60 )
call UnitDamageTargetBJ( gg_unit_n015_0521, target, 150.0, ATTACK_TYPE_HERO, DAMAGE_TYPE_LIGHTNING )
//call PlaySoundAtPointBJ( gg_snd_LightningBolt, 100, loc, 0 )
call TriggerSleepAction( 1.00 )
//call StopSoundBJ(gg_snd_LightningBolt, false)
call DestroyEffect(fx)
call DestroyEffect(fx2)
call RemoveLocation(loc)
set loc = null
set fx = null
set fx2 = null
endfunction
endlibrary
function WestmoorMelee takes integer pid returns nothing
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Forest[pid]
if (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 3), 'nspr', pid ) // Spider
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nwlt', pid ) // Timber Wolf
else
call BattleUnits( GetRandomInt(1, 2), 'nbrg', pid ) // Brigand
endif
elseif ( GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'ngno', pid ) // Hyenal
call BattleUnits( GetRandomInt(0, 1), 'ngna', pid )
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nmpe', pid ) // Mud Sucker
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nbrg', pid ) // Brigand
else
call BattleUnits( 1, 'ngrk', pid ) // Mud Golem
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'ngno', pid ) // Hyenal
call BattleUnits( GetRandomInt(0, 1), 'ngna', pid )
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nwlt', pid ) // Timber Wolf
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'ngrk', pid ) // Mud Golem
else
call BattleUnits( 1, 'nbrg', pid ) // Brigand
endif
endif
endfunction
function EastmoorMelee takes integer pid returns nothing
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Forest[pid]
elseif ( GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
else
set udg_BattleRegion[pid] = udg_Plains[pid]
endif
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( GetRandomInt(1, 3), 'nsty', pid ) // Imp
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nwlg', pid ) // Wolf
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nogr', pid ) // Ogre
else
call BattleUnits( GetRandomInt(1, 2), 'ngrk', pid ) // Mud Golem
endif
endfunction
function SeaMelee takes integer pid returns nothing
set udg_BattleRegion[pid] = udg_Sea[pid]
if (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 3), 'nmcf', pid ) // Hagfish
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nlds', pid ) // Sea Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'ntrh', pid ) // Sea Turtle Hatchling
else
call BattleUnits( GetRandomInt(1, 3), 'hrif', pid ) // Pirate
endif
call IssueImmediateOrderBJ( udg_MapShip[pid], "stop" )
call SelectUnitForPlayerSingle( udg_MapHero[pid], ConvertedPlayer(pid) )
call CameraSetupApplyForPlayer( true, gg_cam_Boat, ConvertedPlayer(pid), 0 )
call SetCameraTargetControllerNoZForPlayer( ConvertedPlayer(pid), udg_MapHero[pid], 0, 0, false )
endfunction
function NorthEradunMelee takes integer pid returns nothing
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Palms[pid]
elseif ( GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
else
set udg_BattleRegion[pid] = udg_Desert[pid]
endif
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( GetRandomInt(1, 3), 'ngno', pid ) // Hyenal
call BattleUnits( 1, 'ngnb', pid ) // Hyenal Brute
call BattleUnits( GetRandomInt(1, 2), 'ngns', pid ) // Hyenal Assassin
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nanw', pid ) // Scorpion
call BattleUnits( 1, 'ngns', pid ) // Hyenal Assassin
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'narg', pid ) // Stone Golem
else
call BattleUnits( GetRandomInt(1, 3), 'ucs1', pid ) // Scarab
endif
endfunction
function AncientEradunMelee takes integer pid returns nothing
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Palms[pid]
elseif ( GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
else
set udg_BattleRegion[pid] = udg_Desert[pid]
endif
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nzom', pid ) // Mummy
call BattleUnits( GetRandomInt(1, 3), 'ucs1', pid ) // Scarab
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 1, 'narg', pid ) // Stone Golem
call BattleUnits( GetRandomInt(1, 3), 'nanw', pid ) // Scorpion
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'narg', pid ) // Stone Golem
call BattleUnits( 1, 'nggr', pid ) // Obsidian Golem
else
call BattleUnits( 1, 'ucs2', pid ) // Jeweled Scarab
call BattleUnits( GetRandomInt(1, 3), 'ucs1', pid ) // Scarab
endif
endfunction
function SouthEradunMelee takes integer pid returns nothing
if ( InForest(udg_MapHero[pid]) or GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Vgrs' ) then
set udg_BattleRegion[pid] = udg_Palms[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( GetRandomInt(1, 3), 'nqb1', pid ) // Wild Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'ucs1', pid ) // Scarab
call BattleUnits( GetRandomInt(1, 2), 'nspg', pid ) // Jungle Spider
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nslr', pid ) // Salamander
else
call BattleUnits( 1, 'njgb', pid ) // Moss Golem
endif
elseif ( GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nscb', pid ) // Stone Crab
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nlpr', pid ) // Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nsgn', pid ) // Merman
else
call BattleUnits( GetRandomInt(1, 3), 'nmbg', pid ) // Piranha
endif
else
set udg_BattleRegion[pid] = udg_Desert[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( GetRandomInt(1, 3), 'nnwl', pid ) // Sandroach Scout
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'npfl', pid ) // Sand Beast
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nele', pid ) // Genie
else
call BattleUnits( 1, 'ownr', pid ) // Manticore
endif
endif
endfunction
function MiddleEradunMelee takes integer pid returns nothing
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Palms[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nqb1', pid ) // Wild Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'ucs1', pid ) // Scarab
call BattleUnits( 2, 'nspg', pid ) // Jungle Spider
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nslr', pid ) // Salamander
else
call BattleUnits( 2, 'njgb', pid ) // Moss Golem
endif
elseif ( GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nscb', pid )
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nlpr', pid )
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nsgn', pid )
else
call BattleUnits( 1, 'nnwl', pid )
endif
else
set udg_BattleRegion[pid] = udg_Desert[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nnwl', pid )
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'npfl', pid )
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nele', pid )
else
call BattleUnits( 1, 'ownr', pid )
endif
endif
endfunction
function WestEradunMelee takes integer pid returns nothing
if ( GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid])) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Dunes[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nscb', pid )
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nlpr', pid )
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'npfl', pid )
else
call BattleUnits( 1, 'nanw', pid )
endif
else
set udg_BattleRegion[pid] = udg_Desert[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nanw', pid )
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'npfl', pid )
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nele', pid )
else
call BattleUnits( 1, 'ownr', pid )
endif
endif
endfunction
function WestZaronaMelee takes integer pid returns nothing
local integer terrain = GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid]))
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Jungle[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nqb2', pid ) // Dire Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nowe', pid ) // Owlkin Brave
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nltl', pid ) // Dinosaur
else
call BattleUnits( 1, 'nrzs', pid ) // Razormane Master
call BattleUnits( 2, 'nrzt', pid ) // Razorback Slave
endif
elseif ( terrain == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nscb', pid ) // Stone Crab
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 3, 'nlpr', pid ) // Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 3, 'ntrh', pid ) // Sea Turtle Hatchling
else
call BattleUnits( 4, 'nmcf', pid ) // Hagfish
endif
else
set udg_BattleRegion[pid] = udg_Palms[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nqb2', pid ) // Dire Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nowe', pid ) // Owlkin Brave
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nltl', pid ) // Dinosaur
else
call BattleUnits( 1, 'nrzs', pid ) // Razormane Master
call BattleUnits( 2, 'nrzt', pid ) // Razorback Slave
endif
endif
endfunction
function MiddleZaronaMelee takes integer pid returns nothing
local integer terrain = GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid]))
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Palms[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nqb1', pid ) // Wild Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nowe', pid ) // Owlkin Brave
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nltl', pid ) // Dinosaur
else
call BattleUnits( 1, 'nwe3', pid ) // Giant Eagle
endif
elseif ( terrain == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nscb', pid ) // Stone Crab
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 3, 'nlpr', pid ) // Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 3, 'ntrh', pid ) // Sea Turtle Hatchling
else
call BattleUnits( 4, 'nmcf', pid ) // Hagfish
endif
else
set udg_BattleRegion[pid] = udg_Desert[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nqb2', pid ) // Dire Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nowe', pid ) // Owlkin Brave
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nltl', pid ) // Dinosaur
else
call BattleUnits( 1, 'nrzs', pid ) // Razormane Master
call BattleUnits( 2, 'nrzt', pid ) // Razorback Slave
endif
endif
endfunction
function EastZaronaMelee takes integer pid returns nothing
local integer terrain = GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid]))
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Jungle[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nqb1', pid ) // Wild Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nowb', pid ) // Owlkin
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'njgb', pid ) // Moss Golem
else
call BattleUnits( 1, 'nwe3', pid ) // Giant Eagle
endif
elseif ( terrain == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nlpr', pid ) // Lobster
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nscb', pid ) // Stone Crab
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'ntrh', pid ) // Sea Turtle Hatchling
else
call BattleUnits( 3, 'nmcf', pid ) // Hagfish
endif
else
set udg_BattleRegion[pid] = udg_Palms[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nqb1', pid ) // Wild Boar
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( GetRandomInt(1, 2), 'nowb', pid ) // Owlkin
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nwe3', pid ) // Giant Eagle
else
call BattleUnits( 1, 'nltl', pid ) // Dinosaur
endif
endif
endfunction
function NorticaMelee takes integer pid returns nothing
local integer terrain = GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid]))
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_SnowForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nwwf', pid ) // Frost Wolf
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nitr', pid ) // Ice Troll
call BattleUnits( 1, 'nitp', pid ) // Ice Troll Priest
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nbdm', pid ) // Frost Wyrm
else
call BattleUnits( 2, 'edtm', pid ) // Frost Owl
endif
elseif ( terrain == 'Zsan' or terrain == 'Vrck' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nitr', pid ) // Ice Troll
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nltc', pid ) // Frost Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'ntws', pid ) // Arctic Hagfish
else
call BattleUnits( 1, 'nplb', pid ) // Polar Bear
endif
else
set udg_BattleRegion[pid] = udg_SnowPlains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nwwf', pid ) // Frost Wolf
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nitr', pid ) // Ice Troll
call BattleUnits( 1, 'nitp', pid ) // Ice Troll Priest
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nbdm', pid ) // Frost Wyrm
else
call BattleUnits( 1, 'nplb', pid ) // Polar Bear
call BattleUnits( 1, 'edtm', pid ) // Frost Owl
endif
endif
endfunction
function EastNorticaMelee takes integer pid returns nothing
local integer terrain = GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid]))
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_SnowForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nwwf', pid ) // Frost Wolf
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nitr', pid ) // Ice Troll
call BattleUnits( 1, 'nitp', pid ) // Ice Troll Priest
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nits', pid ) // Ice Troll Berserker
else
call BattleUnits( 2, 'nitt', pid ) // Ice Troll Trapper
endif
elseif ( terrain == 'Zsan' or terrain == 'Vrck' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nitt', pid ) // Ice Troll Trapper
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nltc', pid ) // Frost Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'ntws', pid ) // Arctic Hagfish
else
call BattleUnits( 1, 'nplb', pid ) // Polar Bear
endif
else
set udg_BattleRegion[pid] = udg_SnowPlains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nwwf', pid ) // Frost Wolf
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nitr', pid ) // Ice Troll
call BattleUnits( 1, 'nitp', pid ) // Ice Troll Priest
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nits', pid ) // Ice Troll Berserker
else
call BattleUnits( 1, 'nplb', pid ) // Polar Bear
endif
endif
endfunction
function FarNorthMelee takes integer pid returns nothing
local integer terrain = GetTerrainTypeBJ(GetUnitLoc(udg_MapHero[pid]))
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_SnowForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nwwf', pid ) // Frost Wolf
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nfov', pid ) // Frost Guardian
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nbda', pid ) // Ice Wyrm
else
call BattleUnits( 2, 'nbdm', pid ) // Frost Wyrm
endif
elseif ( terrain == 'Zsan' or terrain == 'Vrck' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nfov', pid ) // Frost Guardian
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nltc', pid ) // Frost Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'ntws', pid ) // Arctic Hagfish
else
call BattleUnits( 1, 'nplb', pid ) // Polar Bear
endif
else
set udg_BattleRegion[pid] = udg_SnowPlains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nwwf', pid ) // Frost Wolf
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nfov', pid ) // Frost Guardian
call BattleUnits( 1, 'ndqp', pid ) // Ice Demoness
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nits', pid ) // Ice Troll Berserker
else
call BattleUnits( 1, 'nplb', pid ) // Polar Bear
endif
endif
endfunction
function DarkmoorMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
local boolean blight = IsPointBlightedBJ(hloc)
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_HauntedForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'npsb', pid ) // Black Spider
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nzof', pid ) // Zombie
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'ngh1', pid ) // Ghost
else
call BattleUnits( 1, 'osw3', pid ) // Werewolf
endif
elseif ( blight ) then
set udg_BattleRegion[pid] = udg_Blight[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'ugar', pid ) // Gargoyle
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nzof', pid ) // Zombie
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'ngh1', pid ) // Ghost
else
call BattleUnits( 3, 'ndrj', pid ) // Slime
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nmmu', pid ) // Hagfish Zombie
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nmfs', pid ) // Hagfish Plaguebearer
endif
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'ndrj', pid ) // Slime
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'ngh1', pid ) // Ghost
else
call BattleUnits( 1, 'ugar', pid ) // Gargoyle
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'ugar', pid ) // Gargoyle
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 3, 'nzof', pid ) // Zombie
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'ngh1', pid ) // Ghost
else
call BattleUnits( 1, 'osw3', pid ) // Werewolf
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function GaiaMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_ElfForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nsbm', pid ) // Duskvenom Spider
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'ndtr', pid ) // Dark Troll
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nenp', pid ) // Mandragora
else
call BattleUnits( 2, 'nwld', pid ) // Dark Wolf
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nmrm', pid ) // Hagfish Nightstalker
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nthl', pid ) // Blue Salamander
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'njga', pid ) // Fungal Golem
else
call BattleUnits( 1, 'nwld', pid ) // Dark Wolf
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nthl', pid ) // Blue Salamander
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 3, 'njga', pid ) // Fungal Golem
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'ndtr', pid ) // Dark Troll
else
call BattleUnits( 1, 'nwld', pid ) // Dark Wolf
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function GaiaWestMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_ElfForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nsbm', pid ) // Duskvenom Spider
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'ndtr', pid ) // Dark Troll
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nbds', pid ) // Green Wyrm
else
call BattleUnits( 2, 'nwld', pid ) // Dark Wolf
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nmrm', pid ) // Hagfish Nightstalker
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nthl', pid ) // Blue Salamander
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'njga', pid ) // Fungal Golem
else
call BattleUnits( 2, 'nbds', pid ) // Green Wyrm
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nthl', pid ) // Blue Salamander
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nbds', pid ) // Green Wyrm
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'ndtr', pid ) // Dark Troll
else
call BattleUnits( 1, 'nwld', pid ) // Dark Wolf
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function TropicoNorthMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Jungle[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nftr', pid ) // Jungle Troll
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'njg1', pid ) // Jungle stalker
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nsc2', pid ) // Coconut Crab
else
call BattleUnits( 1, 'nftt', pid ) // Jungle Troll Trapper
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nmsc', pid ) // Hagfish Prince
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nsc2', pid ) // Coconut Crab
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nlsn', pid ) // Spiny Lobster
else
call BattleUnits( 1, 'ntrs', pid ) // Sea Turtle
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nftr', pid ) // Jungle Troll
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 1, 'njg1', pid ) // Jungle stalker
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nsc2', pid ) // Coconut Crab
else
call BattleUnits( 1, 'nftt', pid ) // Jungle Troll Trapper
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function TropicoMiddleMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Jungle[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nftr', pid ) // Jungle Troll
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'njg1', pid ) // Jungle stalker
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nsnp', pid ) // Basilisk
else
call BattleUnits( 1, 'nftt', pid ) // Jungle Troll Trapper
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nsgh', pid ) // Merknight
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nmsc', pid ) // Hagfish Prince
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nlsn', pid ) // Spiny Lobster
else
call BattleUnits( 1, 'ntrs', pid ) // Sea Turtle
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nftr', pid ) // Jungle Troll
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nsnp', pid ) // Basilisk
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nsc2', pid ) // Coconut Crab
else
call BattleUnits( 1, 'nhyh', pid ) // Hydra Hatchling
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function FireIslandMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Jungle[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nane', pid ) // Red Scorpion
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'njg1', pid ) // Jungle stalker
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nsll', pid ) // Lava Lizard
else
call BattleUnits( 1, 'ntrd', pid ) // Lava Turtle
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nmsc', pid ) // Hagfish Prince
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nsc2', pid ) // Coconut Crab
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nlsn', pid ) // Spiny Lobster
else
call BattleUnits( 1, 'ntrd', pid ) // Lava Turtle
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nane', pid ) // Red Scorpion
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nsnp', pid ) // Basilisk
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nsc2', pid ) // Coconut Crab
else
call BattleUnits( 2, 'nsll', pid ) // Lava Lizard
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function FjordMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_SnowForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nwwd', pid ) // Dire Wolf
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 1, 'ngh2', pid ) // Wraith
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'ndmu', pid ) // Wight
else
call BattleUnits( 1, 'nmit', pid ) // Mammoth
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nsc3', pid ) // King Crab
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nlkl', pid ) // Deep Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nplg', pid ) // Polar Bear
else
call BattleUnits( 3, 'ehip', pid ) // Hippogryph
endif
else
set udg_BattleRegion[pid] = udg_SnowPlains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nplg', pid ) // Polar Bear
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nwwd', pid ) // Dire Wolf
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nmit', pid ) // Mammoth
else
call BattleUnits( 3, 'ehip', pid ) // Hippogryph
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function IronMountainsMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Forest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nssp', pid ) // Spitting Spider
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nwwg', pid ) // Alpha Wolf
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nogm', pid ) // Ogre
else
call BattleUnits( 1, 'nwrg', pid ) // Granite Golem
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nsc3', pid ) // King Crab
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nlkl', pid ) // Deep Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nogm', pid ) // Ogre
else
call BattleUnits( 1, 'efdr', pid ) // Cockatrice
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nogm', pid ) // Ogre
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 1, 'nwwg', pid ) // Alpha Wolf
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nwrg', pid ) // Granite Golem
else
call BattleUnits( 1, 'efdr', pid ) // Cockatrice
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function SilvermoonMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_Forest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 3, 'nssp', pid ) // Spitting Spider
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nwwg', pid ) // Alpha Wolf
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 1, 'nano', pid ) // Emperor Scorpion
else
call BattleUnits( 1, 'nwrg', pid ) // Granite Golem
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nmrr', pid ) // Piranha Knight
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nlkl', pid ) // Deep Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nmyr', pid ) // Naga
call BattleUnits( 1, 'nnsw', pid ) // Siren
else
call BattleUnits( 2, 'nmyr', pid ) // Naga
call BattleUnits( 1, 'nhyd', pid ) // Hydra
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 1, 'nano', pid ) // Emperor Scorpion
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'ncer', pid ) // Centaur Drudge
call BattleUnits( 2, 'ncea', pid ) // Centaur Archer
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'otau', pid ) // Minotaur
call BattleUnits( 1, 'ncea', pid ) // Centaur Archer
else
call BattleUnits( 2, 'nhyd', pid ) // Hydra
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function AmazoaMelee takes integer pid returns nothing
local location hloc = GetUnitLoc(udg_MapHero[pid])
if ( InForest(udg_MapHero[pid]) ) then
set udg_BattleRegion[pid] = udg_RainForest[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nssp', pid ) // Spitting Spider
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 5, 'ucry', pid ) // Army Ant
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nsqt', pid ) // Sasquatch
call BattleUnits( 2, 'nmrr', pid ) // Piranha Knight
else
call BattleUnits( 2, 'nsln', pid ) // Blob
call BattleUnits( 1, 'nsqe', pid ) // Elder Sasquatch
endif
elseif ( GetTerrainTypeBJ(hloc) == 'Zsan' ) then
set udg_BattleRegion[pid] = udg_Beach[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nmrr', pid ) // Piranha Knight
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nlkl', pid ) // Deep Lobster
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nmyr', pid ) // Naga
call BattleUnits( 1, 'nnsw', pid ) // Siren
else
call BattleUnits( 2, 'nmyr', pid ) // Naga
call BattleUnits( 1, 'nhyd', pid ) // Hydra
endif
else
set udg_BattleRegion[pid] = udg_Plains[pid]
if (GetRandomInt(1, 4) == 1) then
call BattleUnits( 2, 'nwwg', pid ) // Alpha Wolf
call BattleUnits( 1, 'nsqe', pid ) // Elder Sasquatch
elseif (GetRandomInt(1, 3) == 1) then
call BattleUnits( 2, 'nsqt', pid ) // Sasquatch
call BattleUnits( 1, 'nsqe', pid ) // Elder Sasquatch
elseif (GetRandomInt(1, 2) == 1) then
call BattleUnits( 2, 'nmrr', pid ) // Piranha Knight
else
call BattleUnits( 2, 'nsln', pid ) // Blob
endif
endif
call RemoveLocation(hloc)
set hloc = null
endfunction
function Melee takes nothing returns nothing
local unit hero
local unit ship
local boolean visible
local boolean walking
local boolean sailing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set hero = udg_MapHero[bj_forLoopAIndex]
set ship = udg_MapShip[bj_forLoopAIndex]
set visible = GetUnitAbilityLevel(hero, 'Binv') < 1
set walking = RectContainsUnit(gg_rct_World_Map, hero) and GetUnitTypeId(ship) != 'h013' and GetUnitCurrentOrder(hero) != String2OrderIdBJ("stop") and GetUnitCurrentOrder(hero) != String2OrderIdBJ("")
set sailing = GetUnitTypeId(ship) == 'h003' and GetUnitCurrentOrder(ship) != String2OrderIdBJ("stop") and GetUnitCurrentOrder(ship) != String2OrderIdBJ("")
if visible and walking or sailing then
set udg_Rolls[bj_forLoopAIndex] = udg_Rolls[bj_forLoopAIndex] + 1
if GetRandomInt(1, IMaxBJ(2, 10 - udg_Rolls[bj_forLoopAIndex])) == 1 then
set udg_Rolls[bj_forLoopAIndex] = 0
if RectContainsUnit(gg_rct_Westmoor, hero) and not RectContainsUnit(gg_rct_Darkmoor, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call WestmoorMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Eastmoor, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call EastmoorMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if sailing then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call SeaMelee(bj_forLoopAIndex)
call ToBattle(hero)
call SetCameraFieldForPlayer( GetOwningPlayer(hero), CAMERA_FIELD_TARGET_DISTANCE, 1800.00, 0 )
endif
if RectContainsUnit(gg_rct_North_Eradun, hero) and not RectContainsUnit(gg_rct_Ancient_Eradun, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call NorthEradunMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Ancient_Eradun, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call AncientEradunMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_South_Eradun, hero) and not RectContainsUnit(gg_rct_Ancient_Eradun, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call SouthEradunMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Middle_Eradun, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call MiddleEradunMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_East_Zarona, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call EastZaronaMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Middle_Zarona, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call MiddleZaronaMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_West_Zarona, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call WestZaronaMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Southwest_Nortica, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call NorticaMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_East_Nortica, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call EastNorticaMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Far_North, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call FarNorthMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Darkmoor, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call DarkmoorMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Darkmoor, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call DarkmoorMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_East_Gaia, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call GaiaMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_West_Gaia, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call GaiaWestMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_North_Tropica, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call TropicoNorthMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Middle_Tropica, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call TropicoMiddleMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Fire_Island, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call FireIslandMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Frost_Fjord, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call FjordMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Iron_Mountains, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call IronMountainsMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Iron_Mountains, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call IronMountainsMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Silvermoon, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call SilvermoonMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
if RectContainsUnit(gg_rct_Amazoa, hero) then
set udg_MapLocation[bj_forLoopAIndex] = GetUnitLoc(hero)
call AmazoaMelee(bj_forLoopAIndex)
call ToBattle(hero)
endif
endif
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
library Battles requires World, Text
function BattleChargeUnit takes nothing returns nothing
local integer t = GetUnitTypeId(GetEnumUnit())
if ( GetOwningPlayer(GetEnumUnit()) == Player(9) ) then
if ( t == 'hcth' or t == 'hsor' or t == 'hmpr' ) then
call IssueImmediateOrderBJ( GetEnumUnit(), "stop" )
else
call IssuePointOrderLocBJ( GetEnumUnit(), "attack", OffsetLocation(GetRectCenter(udg_Battlefield), 0, 1500.00) )
endif
else
endif
if ( GetOwningPlayer(GetEnumUnit()) == Player(20) ) then
if ( t == GetUnitTypeId(udg_EnemyGeneral) ) then
call IssueImmediateOrderBJ( GetEnumUnit(), "stop" )
call SetUnitOwner( udg_EnemyGeneral, Player(PLAYER_NEUTRAL_AGGRESSIVE), true )
else
call IssuePointOrderLocBJ( GetEnumUnit(), "attack", OffsetLocation(GetRectCenter(udg_Battlefield), 0, -1500.00) )
endif
else
endif
endfunction
function CleanupBattleUnit takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction
function CleanupBattleItem takes nothing returns nothing
call RemoveItem( GetEnumItem() )
endfunction
function BattleLine takes unit general, integer row, integer u, integer count returns nothing
local real out = 125.0
local unit last
local location loc = GetUnitLoc(general)
local location offset
local integer halfcount = R2I(count / 2)
// the odd extra
if count - 2*halfcount == 1 then
if row == 1 then
set offset = PolarProjectionBJ(loc, -100.0, GetUnitFacing(general) - 180.0)
else
set offset = PolarProjectionBJ(loc, (row-1) * 100.0, GetUnitFacing(general) - 180.0)
endif
call CreateUnit( GetOwningPlayer(general), u, GetLocationX(offset), GetLocationY(offset), GetUnitFacing(general) )
endif
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = halfcount
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set offset = PolarProjectionBJ(loc, out, GetUnitFacing(general) - 90.0)
set offset = PolarProjectionBJ(offset, (row-1) * 100.0, GetUnitFacing(general) - 180.0)
set last = CreateUnit( GetOwningPlayer(general), u, GetLocationX(offset), GetLocationY(offset), GetUnitFacing(general) )
call RemoveLocation(offset)
set offset = PolarProjectionBJ(loc, out, GetUnitFacing(general) + 90.0)
set offset = PolarProjectionBJ(offset, (row-1) * 100.0, GetUnitFacing(general) - 180.0)
set last = CreateUnit( GetOwningPlayer(general), u, GetLocationX(offset), GetLocationY(offset), GetUnitFacing(general) )
call RemoveLocation(offset)
set out = out + 125.0 * BlzGetUnitRealField(last, UNIT_RF_SELECTION_SCALE)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(loc)
set loc = null
set offset = null
endfunction
function BattleCharrrge takes nothing returns nothing
set udg_InBattle = true
call ForGroupBJ( GetUnitsInRectAll(udg_Battlefield), function BattleChargeUnit )
endfunction
function BattleHorn takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetCameraFieldForPlayer( GetOwningPlayer(udg_MapHero[bj_forLoopAIndex]), CAMERA_FIELD_TARGET_DISTANCE, 2000.00, 5.00 )
call SetCameraFieldForPlayer( GetOwningPlayer(udg_MapHero[bj_forLoopAIndex]), CAMERA_FIELD_ANGLE_OF_ATTACK, 310.00, 5.0 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call PlaySoundAtPointBJ( gg_snd_TheHornOfCenarius, 100, OffsetLocation(GetRectCenter(udg_Battlefield), 0, 1200.00), 0 )
call TimerStart(udg_BattleTimer, 1, false, function BattleCharrrge)
endfunction
function ToBattlefield takes unit u returns nothing
local real scaling = BlzGetUnitRealField(u, UNIT_RF_SCALING_VALUE)
call SetUnitScalePercent( u, scaling*100, scaling*100, scaling*100 )
call BlzSetUnitRealFieldBJ( u, UNIT_RF_SELECTION_SCALE, 1.00 )
call SetUnitMoveSpeed( u, GetUnitDefaultMoveSpeed(u) )
call ResetToGameCameraForPlayer( GetOwningPlayer(u), 0 )
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(u), u, 0, 0, false )
call SetCameraFieldForPlayer( GetOwningPlayer(u), CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 0 )
call SetCameraFieldForPlayer( GetOwningPlayer(u), CAMERA_FIELD_ANGLE_OF_ATTACK, 340.00, 0 )
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(ReturnButton, false)
call BlzFrameSetVisible(AirshipButton, false)
endif
call IssueImmediateOrder( u, "stop" )
call BattleTheme(u)
endfunction
function BattleFadeIn takes nothing returns nothing
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.40, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call Title(udg_BattleTitle)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_MapLocation[bj_forLoopAIndex] = PolarProjectionBJ(GetUnitLoc(udg_MapBattle), 5.00, 225.00)
call RemoveUnit( udg_MapShip[bj_forLoopAIndex] )
set udg_MapShip[bj_forLoopAIndex] = null
set udg_Votes[bj_forLoopAIndex] = false
if udg_BattleRegion[bj_forLoopAIndex] != null then
call ForGroupBJ( GetUnitsInRectOfPlayer(udg_BattleRegion[bj_forLoopAIndex], Player(PLAYER_NEUTRAL_AGGRESSIVE)), function CleanupBattleUnit )
call EnumItemsInRectBJ( udg_BattleRegion[bj_forLoopAIndex], function CleanupBattleItem )
endif
set udg_BattleRegion[bj_forLoopAIndex] = udg_Battlefield
call SetUnitPositionLoc( udg_MapHero[bj_forLoopAIndex], PolarProjectionBJ(GetRectCenter(udg_Battlefield), 1400.00, 270.00) )
call ToBattlefield( udg_MapHero[bj_forLoopAIndex] )
call ToAbovewater( udg_MapHero[bj_forLoopAIndex] )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call TimerStart(udg_BattleTimer, 5, false, function BattleHorn)
endfunction
function BattleMoveOut takes integer row, group g returns nothing
local unit general = udg_GoodGeneral
local integer count = CountUnitsInGroup( g )
local real out = 125.0
local real facing = 90.0 // GetUnitFacing(general)
local unit last
local location loc = GetUnitLoc(general)
local location offset
local integer halfcount = R2I(count / 2)
// the odd extra
if count - 2*halfcount == 1 then
if row == 1 then
set offset = PolarProjectionBJ(loc, -100.0, facing - 180.0)
else
set offset = PolarProjectionBJ(loc, (row-1) * 100.0, facing - 180.0)
endif
set last = FirstOfGroup( g )
if last == null then
call DestroyGroup( g )
call RemoveLocation( loc )
return
endif
call GroupRemoveUnit( g, last )
call SetUnitPositionLoc( last, offset )
call SetUnitFacing( last, facing )
call UnitRemoveAbility( last, 'Avul' )
call RemoveLocation(offset)
endif
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = halfcount
loop
set offset = PolarProjectionBJ(loc, out, facing - 90.0)
set offset = PolarProjectionBJ(offset, (row-1) * 100.0, facing - 180.0)
set last = FirstOfGroup( g )
exitwhen last == null
call GroupRemoveUnit( g, last )
call SetUnitPositionLoc( last, offset )
call SetUnitFacing( last, facing )
call UnitRemoveAbility( last, 'Avul' )
call RemoveLocation(offset)
set offset = PolarProjectionBJ(loc, out, facing + 90.0)
set offset = PolarProjectionBJ(offset, (row-1) * 100.0, facing - 180.0)
set last = FirstOfGroup( g )
exitwhen last == null
call GroupRemoveUnit( g, last )
call SetUnitPositionLoc( last, offset )
call SetUnitFacing( last, facing )
call UnitRemoveAbility( last, 'Avul' )
call RemoveLocation(offset)
set out = out + 125.0 * BlzGetUnitRealField(last, UNIT_RF_SELECTION_SCALE)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DestroyGroup( g )
call RemoveLocation( loc )
set loc = null
set offset = null
endfunction
function BattleTroops takes integer t returns group
local unit last
local group all = GetUnitsOfPlayerAndTypeId(Player(9), t)
local group g = CreateGroup()
loop
set last = FirstOfGroup( all )
exitwhen last == null
if IsUnitAliveBJ( last ) then
call GroupAddUnit( g, last )
endif
call GroupRemoveUnit( all, last )
endloop
call DestroyGroup( all )
set all = null
return g
endfunction
function BattleGroup takes group g1, group g2 returns group
call GroupAddGroup(g1, g2)
call DestroyGroup(g1)
return g2
endfunction
function BattleStart takes nothing returns nothing
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call TimerDialogDisplayBJ( false, GetLastCreatedTimerDialogBJ() )
call SetUnitPositionLoc( udg_GoodGeneral, PolarProjectionBJ(GetRectCenter(udg_Battlefield), 1300.00, 270.00) )
call SetUnitFacing( udg_GoodGeneral, 90.0 )
call UnitRemoveAbility( udg_GoodGeneral, 'Avul' )
call BlzSetUnitArmor( udg_GoodGeneral, RMaxBJ(7.0, 1.5 * BlzGetUnitArmor( udg_EnemyGeneral )) )
call BattleMoveOut( 0, BattleGroup(BattleGroup(BattleTroops('hfoo'), BattleTroops('hspt')), BattleTroops('hkni')) )
call BattleMoveOut( 1, BattleGroup(BattleGroup(BattleTroops('hmil'), BattleTroops('nbel')), BattleTroops('njks')) )
call BattleMoveOut( 2, BattleGroup(BattleTroops('nhea'), BattleTroops('earc')) )
call BattleMoveOut( 3, BattleTroops('hmpr') )
call BattleMoveOut( 3, BattleTroops('ebal') )
call BattleMoveOut( 4, BattleTroops('hsor') )
call BattleMoveOut( 4, BattleTroops('ocat') )
call TimerStart(udg_BattleTimer, 2.50, false, function BattleFadeIn)
endfunction
function VoteBattle takes unit hero returns nothing
local playerslotstate slot
local integer pid = GetConvertedPlayerId(GetOwningPlayer(hero))
local integer total = 0
local integer count = 0
local effect fx = AddSpecialEffect( "Abilities\\Spells\\NightElf\\ThornsAura\\ThornsAuraDamage.mdl", GetUnitX(udg_MapBattle), GetUnitY(udg_MapBattle) )
call BlzSetSpecialEffectScale( fx, 3.00 )
call PlaySoundBJ( gg_snd_ArrangedTeamInvitation )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(hero)) + " has voted |cffcc0000FIGHT NOW!" ) )
set udg_Votes[pid] = true
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set slot = GetPlayerSlotState(ConvertedPlayer(bj_forLoopAIndex))
if slot != PLAYER_SLOT_STATE_EMPTY and slot != PLAYER_SLOT_STATE_LEFT then
set total = total + 1
if udg_Votes[bj_forLoopAIndex] then
set count = count + 1
endif
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
if count == total then
call PauseTimer(udg_BattleWarnTimer)
call PauseTimer(udg_BattleTimer)
call BattleStart()
endif
call DestroyEffect(fx)
set fx = null
endfunction
function BattleWarn takes nothing returns nothing
call TimerDialogSetTimeColorBJ( GetLastCreatedTimerDialogBJ(), 100, 0.00, 0.00, 0 )
endfunction
function IsGoodFlag takes nothing returns boolean
return ( GetUnitTypeId(GetFilterUnit()) == 'n06N' and GetOwningPlayer(GetFilterUnit()) == Player(9) )
endfunction
function ShowFlag takes nothing returns nothing
call SetUnitVertexColorBJ( GetEnumUnit(), 100, 100, 100, 0.00 )
endfunction
function BattleCountdown takes string title returns nothing
local real period = 600.00
set udg_BattleTitle = title
//if GetPlayerName(Player(0)) != "WorldEdit" then
call TimerStart(udg_BattleTimer, period, false, function BattleStart)
call TimerStart(udg_BattleWarnTimer, period - 30.0, false, function BattleWarn)
//endif
call TimerDialogSetTimeColorBJ( GetLastCreatedTimerDialogBJ(), 100, 80.00, 0.00, 0 )
call TimerDialogSetTitleBJ( GetLastCreatedTimerDialogBJ(), title )
call TimerDialogDisplayBJ( true, GetLastCreatedTimerDialogBJ() )
call ForGroupBJ( GetUnitsInRangeOfLocMatching(250.00, GetUnitLoc(udg_MapBattle), Condition(function IsGoodFlag)), function ShowFlag )
endfunction
function VictoryFlag takes nothing returns nothing
call UnitRemoveAbility( GetEnumUnit(), 'Aneu' )
call SetUnitPositionLoc( GetEnumUnit(), GetUnitLoc(udg_MapBattle) )
endfunction
function IsEvilFlag takes nothing returns boolean
return ( GetUnitTypeId(GetFilterUnit()) == 'n06O' )
endfunction
function RemoveEnemyFlag takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction
function ImmortalizeVictors takes nothing returns nothing
call UnitAddAbilityBJ( 'Avul', GetEnumUnit() )
call IssueImmediateOrderBJ( GetEnumUnit(), "stop" )
endfunction
function VictoryParade takes nothing returns nothing
call IssuePointOrderLocBJ( GetEnumUnit(), "attack", OffsetLocation(GetRectCenter(udg_Battlefield), 0, -1500.00) )
endfunction
function DefeatDepression takes nothing returns nothing
call IssueImmediateOrderBJ( GetEnumUnit(), "holdposition" )
endfunction
function BattleVictory takes nothing returns nothing
local boolean water
local playerslotstate slot
local location loc
local string s = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n |cffffcc00VICTORY!|r"
call ClearTextMessages()
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.52,0.96,2,s)
call PlaySoundBJ( gg_snd_ClanInvitation )
set udg_InBattle = false
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set loc = GetUnitLoc(udg_MapHero[bj_forLoopAIndex])
call ProcText(loc, "+2 Spirit", 60, 80, 100)
call AdjustPlayerStateBJ( 2, ConvertedPlayer(bj_forLoopAIndex), PLAYER_STATE_RESOURCE_LUMBER )
call RemoveLocation(loc)
set slot = GetPlayerSlotState(ConvertedPlayer(bj_forLoopAIndex))
if slot != PLAYER_SLOT_STATE_EMPTY and slot != PLAYER_SLOT_STATE_LEFT then
set water = not IsTerrainPathableBJ(udg_MapLocation[bj_forLoopAIndex], PATHING_TYPE_FLOATABILITY)
if water then
if udg_Airship[bj_forLoopAIndex] then
set udg_MapShip[bj_forLoopAIndex] = CreateUnit( ConvertedPlayer(bj_forLoopAIndex), 'h013', GetUnitX(udg_MapBattle), GetUnitY(udg_MapBattle), 225.0 )
else
set udg_MapShip[bj_forLoopAIndex] = CreateUnit( ConvertedPlayer(bj_forLoopAIndex), 'h003', GetUnitX(udg_MapBattle), GetUnitY(udg_MapBattle), 225.0 )
endif
endif
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set loc = null
call ForGroupBJ( GetUnitsInRangeOfLocMatching(250.00, GetUnitLoc(udg_MapBattle), Condition(function IsGoodFlag)), function VictoryFlag )
call ForGroupBJ( GetUnitsInRangeOfLocMatching(250.00, GetUnitLoc(udg_MapBattle), Condition(function IsEvilFlag)), function RemoveEnemyFlag )
call RemoveUnit( udg_MapBattle )
call ForGroupBJ( GetUnitsInRectOfPlayer(udg_Battlefield, Player(9)), function ImmortalizeVictors )
call ForGroupBJ( GetUnitsInRectOfPlayer(udg_Battlefield, Player(20)), function DefeatDepression )
call TriggerSleepAction( 4.00 )
call ForGroupBJ( GetUnitsInRectOfPlayer(udg_Battlefield, Player(9)), function VictoryParade )
endfunction
function BattleDefeat takes nothing returns nothing
local integer i = 0
local string s = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n |cffdd0000DEFEAT...|r"
call SetUserControlForceOff( GetPlayersAll() )
call ShowUnit(udg_GoodGeneral, false)
call CinematicFilterGenericBJ( 15.00, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\DreamFilter_Mask.blp", 70.00, 0.00, 0.00, 100, 70.00, 0, 0, 0 )
set udg_GoodGeneral = CreateUnit(Player(bj_PLAYER_NEUTRAL_VICTIM), 'hcth', GetUnitX(udg_GoodGeneral), GetUnitY(udg_GoodGeneral), GetUnitFacing(udg_GoodGeneral))
call SetUnitState(udg_GoodGeneral, UNIT_STATE_LIFE, 1.00)
call SetUnitColor( udg_GoodGeneral, PLAYER_COLOR_LIGHT_BLUE )
call UnitAddAbilityBJ( 'Aloc', udg_GoodGeneral )
call SetUnitAnimation( udg_GoodGeneral, "death" )
call SetUnitTimeScalePercent( udg_GoodGeneral, 15.00 )
call ResetToGameCameraForPlayer( GetLocalPlayer(), 0 )
call PanCameraToTimedLocForPlayer( GetLocalPlayer(), GetUnitLoc(udg_GoodGeneral), 0 )
call SetCameraFieldForPlayer( GetLocalPlayer(), CAMERA_FIELD_TARGET_DISTANCE, 1000.00, 0 )
call SetCameraFieldForPlayer( GetLocalPlayer(), CAMERA_FIELD_TARGET_DISTANCE, 3000.00, 35.0 )
call SetCameraFieldForPlayer( GetLocalPlayer(), CAMERA_FIELD_ROTATION, 90.00, 0 )
call SetCameraFieldForPlayer( GetLocalPlayer(), CAMERA_FIELD_ROTATION, 180, 35.0 )
call DisableTrigger( gg_trg_Death )
call ClearTextMessages()
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.52,0.96,2,s)
call ClearMapMusicBJ()
call StopMusicBJ( false )
call PlayMusicBJ( gg_snd_TragicConfrontation )
call TriggerSleepAction( 5.00 )
call SetUserControlForceOn( GetPlayersAll() )
call DisplayTextToForce( GetPlayersAll(), "|cffcc0000GAMEOVER in 30 seconds...|r" )
call TriggerSleepAction( 30.00 )
call CustomDefeatBJ( GetLocalPlayer(), "GAMEOVER" )
endfunction
function MoveSoldier takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("soldier"))
local effect fx = AddSpecialEffect( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(u), GetUnitY(u) )
call SetUnitPosition( u, GetUnitX(udg_GoodGeneral), GetUnitY(udg_GoodGeneral) - 200.0 )
call DestroyEffect(fx)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
set fx = null
set t = null
endfunction
function RescueSoldier takes unit u returns nothing
local timer t = CreateTimer()
call ProcText(Location(GetUnitX(u)-25, GetUnitY(u)), "Rescued!", 85, 90, 100)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("soldier"), u)
call TimerStart(t, 5.00, false, function MoveSoldier)
endfunction
endlibrary
function IsEvil takes unit u returns boolean
return GetOwningPlayer(u) == Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetOwningPlayer(u) == Player(20)
endfunction
function IsAlive takes unit u returns boolean
return IsUnitAliveBJ(u)
endfunction
function SpiritQuest takes unit u, integer spirit returns nothing
local location loc = GetUnitLoc(u)
call ProcText(loc, "+"+I2S(spirit)+" Spirit", 60, 80, 100)
call AdjustPlayerStateBJ( spirit, GetOwningPlayer(u), PLAYER_STATE_RESOURCE_LUMBER )
call RemoveLocation(loc)
set loc = null
endfunction
function Orb takes unit u returns nothing
local location loc = GetUnitLoc(u)
call ProcText(loc, "|cffffdead+1 Orb|r", 60, 80, 100)
call RemoveLocation(loc)
set loc = null
endfunction
function BeginControl takes nothing returns nothing
call SetUserControlForceOn( GetPlayersAll() )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CameraSetupApplyForPlayer( true, gg_cam_Town_Glenheim, ConvertedPlayer(GetForLoopIndexA()), 0 )
call SetCameraTargetControllerNoZForPlayer( ConvertedPlayer(GetForLoopIndexA()), udg_MapHero[GetForLoopIndexA()], 0, 0, false )
call SetCameraFieldForPlayer( ConvertedPlayer(GetForLoopIndexA()), CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 0 )
call TriggerRegisterPlayerMouseEventBJ( gg_trg_Cursors, ConvertedPlayer(GetForLoopIndexA()), bj_MOUSEEVENTTYPE_MOVE )
call BlzTriggerRegisterPlayerKeyEvent(gg_trg_Spacebar, Player(GetForLoopIndexA()-1), OSKEY_SPACE, 0, true)
call SelectUnitForPlayerSingle( udg_MapHero[GetForLoopIndexA()], ConvertedPlayer(GetForLoopIndexA()) )
if ( GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_EMPTY or GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_LEFT ) then
call ShowUnitHide( udg_MapHero[GetForLoopIndexA()] )
call ShowUnitHide( udg_MapFlag[GetForLoopIndexA()] )
call BlzFrameSetVisible(BlzGetFrameByName("p"+I2S(GetForLoopIndexA()), 0), false)
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call SetTerrainFogExBJ( 0, 4000.00, 6000.00, 0.50, 46.00, 66.00, 0.85 )
call StartTimerBJ( udg_BattleTimer, false, 0.00 )
call StartTimerBJ( udg_BattleWarnTimer, false, 0.00 )
call CreateTimerDialogBJ( udg_BattleTimer, "The Battle..." )
//call ConditionalTriggerExecute( gg_trg_Countdown_Glenhill )
//call ConditionalTriggerExecute( gg_trg_Countdown_Frost_Hollow )
call ConditionalTriggerExecute( gg_trg_Countdown_Wintervale )
call PlayerLoad()
//call Title( " Act I\n Glenheim Village\n" )
//call Title( " Act II\n Port Icebane\n" )
call Title( " Act III\n Wintervale Village\n" )
endfunction
function ShowTitle takes nothing returns nothing
local timer t = CreateTimer()
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 10.00, "war3mapImported\\titlefilter.tga", 100.00, 100.00, 100.00, 0 )
call TimerStart(t, 7.00, false, function BeginControl)
endfunction
function PlayersStart takes nothing returns nothing
local real ang = 0.00
local location loc
local timer t = CreateTimer()
call PlayMusicBJ( gg_snd_SadMystery )
call FogEnableOff( )
call FogMaskEnableOff( )
call SetUserControlForceOff( GetPlayersAll() )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set ang = 90.0 + I2R(bj_forLoopAIndex-1) / 7 * 360.0
//set loc = PolarProjectionBJ(GetRectCenter(gg_rct_Act_I), 125.00, ang)
//set loc = PolarProjectionBJ(GetRectCenter(gg_rct_Act_II), 125.00, ang)
set loc = PolarProjectionBJ(GetRectCenter(gg_rct_Act_III), 125.00, ang)
set udg_MapHero[bj_forLoopAIndex] = CreateUnit( Player(bj_forLoopAIndex-1), 'n002', GetLocationX(loc), GetLocationY(loc), ang + 180.0 )
call UnitAddItemByIdSwapped( 'I00F', udg_MapHero[bj_forLoopAIndex] )
call UnitAddItemByIdSwapped( 'stwp', udg_MapHero[bj_forLoopAIndex] )
set udg_Portals[GetForLoopIndexA()] = loc
call SetPlayerStateBJ( ConvertedPlayer(GetForLoopIndexA()), PLAYER_STATE_RESOURCE_GOLD, 25 )
call SetPlayerStateBJ( ConvertedPlayer(GetForLoopIndexA()), PLAYER_STATE_RESOURCE_LUMBER, 1 )
call SetPlayerAbilityAvailableBJ( false, 'A014', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A014', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A015', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A00R', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A032', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A032', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A00O', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A00O', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A037', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A037', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A038', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A038', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A00N', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A00N', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A00U', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A00U', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A01F', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A01F', Player(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A02B', ConvertedPlayer(GetForLoopIndexA()) )
call SetPlayerAbilityAvailableBJ( false, 'A02B', Player(GetForLoopIndexA()) )
set udg_MapLocation[GetForLoopIndexA()] = PolarProjectionBJ(GetUnitLoc(gg_unit_n02S_2002), ( 100.00 + I2R(GetForLoopIndexA()) ), 225.00)
set udg_PortalMapLocation[GetForLoopIndexA()] = udg_MapLocation[GetForLoopIndexA()]
call CreateNUnitsAtLoc( 1, 'h00Z', ConvertedPlayer(GetForLoopIndexA()), GetRectCenter(gg_rct_Packs), 315.00 )
set udg_Pack[GetForLoopIndexA()] = GetLastCreatedUnit()
call CreateNUnitsAtLoc( 1, 'n06N', ConvertedPlayer(GetForLoopIndexA()), udg_MapLocation[GetForLoopIndexA()], 270.00 )
set udg_MapFlag[GetForLoopIndexA()] = GetLastCreatedUnit()
call UnitRemoveAbilityBJ( 'Aneu', GetLastCreatedUnit() )
call SetCameraTargetControllerNoZForPlayer( ConvertedPlayer(GetForLoopIndexA()), gg_unit_n009_0107, 0, 0, false )
call CameraSetupApplyForPlayer( true, gg_cam_Opening_From, ConvertedPlayer(GetForLoopIndexA()), 0 )
call CameraSetupApplyForPlayer( true, gg_cam_Opening_To, ConvertedPlayer(GetForLoopIndexA()), 15.00 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 2, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call DisplayTimedTextToForce( GetPlayersAll(), 2.50, "|cffffdd00War has broken out upon the world.|r" )
call DisplayTimedTextToForce( GetPlayersAll(), 3.00, "|cffffdd00The skies rain fire and the rivers|r |cffffdd00r|r|cfffdd000u|r|cfffbc400n|r|cfff9b800 |r|cfff7ac00r|r|cfff5a000e|r|cfff39300d|r|cfff18700 |r|cffef7b00w|r|cffed6f00i|r|cffeb6300t|r|cffe95700h|r|cffe74a00 |r|cffe53e00b|r|cffe33200l|r|cffe22500o|r|cffe01900o|r|cffde0d00d|r|cffdc0000...|r" )
call TimerStart(t, 7.00, false, function ShowTitle)
endfunction
function Outside takes player p returns nothing
if (p == GetLocalPlayer()) then
call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl" , "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
endif
endfunction
function Inside takes player p returns nothing
if (p == GetLocalPlayer()) then
call SetDayNightModels("","")
endif
endfunction
library Text
private function Char2Id takes string c returns integer
local integer i = 0
local string abc = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
local string t
loop
set t = SubString(abc,i,i + 1)
exitwhen t == null or t == c
set i = i + 1
endloop
if i < 10 then
return i + 48
elseif i < 36 then
return i + 65 - 10
endif
return i + 97 - 36
endfunction
private function Id2Char takes integer i returns string
local string abc = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
if i >= 97 then
return SubString(abc,i - 97 + 36,i - 96 + 36)
elseif i >= 65 then
return SubString(abc,i - 65 + 10,i - 64 + 10)
endif
return SubString(abc,i - 48,i - 47)
endfunction
function String2Id takes string s returns integer
return ((Char2Id(SubString(s,0,1)) * 256 + Char2Id(SubString(s,1,2))) * 256 + Char2Id(SubString(s,2,3))) * 256 + Char2Id(SubString(s,3,4))
endfunction
function Id2String takes integer id1 returns string
local integer t = id1 / 256
local string r = Id2Char(id1 - 256 * t)
set id1 = t / 256
set r = Id2Char(t - 256 * id1) + r
set t = id1 / 256
return Id2Char(t) + Id2Char(id1 - 256 * t) + r
endfunction
function ErrorMessage takes string error, player whichPlayer returns nothing
local sound s = CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
set error = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+error+"|r"
if GetLocalPlayer() == whichPlayer then
call ClearTextMessages()
call DisplayTimedTextToPlayer(whichPlayer,0.52,0.96,2,error)
call StartSound(s)
call KillSoundWhenDone(s)
endif
set s = null
endfunction
function Title takes string s returns nothing
local string ss = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n |cffffcc00"+s+"|r"
call ClearTextMessages()
call DisplayTimedTextToPlayer(GetLocalPlayer(),0.52,0.96,2,ss)
endfunction
function ProcText takes location loc, string s, integer r, integer g, integer b returns nothing
call CreateTextTagLocBJ( s, OffsetLocation(loc, -15, 0), 0, 9, r, g, b, 0 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 3 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 5 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
endfunction
function ProcTextTag takes location loc, string s, integer size, integer r, integer g, integer b returns nothing
call CreateTextTagLocBJ( s, OffsetLocation(loc, -15, 0), 0, size, r, g, b, 0 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 3 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 5 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
endfunction
function NextSplit takes string s, string d returns integer
local integer i = 0
local integer l = StringLength(s)
local string char
loop
exitwhen i == l
set char = SubString(s, i, i+1)
if (char == d) then
return i
endif
set i = i + 1
endloop
return i
endfunction
endlibrary
function Victory takes nothing returns nothing
local player p = GetOwningPlayer(GetKillingUnitBJ())
local unit hero = udg_MapHero[GetConvertedPlayerId(p)]
local integer uid = GetUnitTypeId(hero)
local string s = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n |cffffcc00VICTORY!|r"
call IssueImmediateOrder(hero, "repairon") // Return callout
if (GetLocalPlayer() == p) then
call ClearTextMessages()
call DisplayTimedTextToPlayer(p,0.52,0.96,2,s)
call PlaySoundBJ( gg_snd_ClanInvitation )
endif
if (uid == 'h000') then // Peasant
call SetUnitAnimation( hero, "stand ready" )
elseif (uid == 'h001') then // Swordsman
call SetUnitAnimation( hero, "stand 4" )
elseif (uid == 'n02U') then // Archer
call SetUnitAnimation( hero, "stand victory" )
elseif (uid == 'n02X') then // Mage
call SetUnitAnimation( hero, "stand victory" )
elseif (uid == 'n031') then // Priest
call SetUnitAnimation( hero, "stand 4" )
elseif (uid == 'h008') then // Zealot
call SetUnitAnimation( hero, "stand victory" )
endif
endfunction
function PackOut takes nothing returns nothing
local unit pack = udg_Pack[GetConvertedPlayerId(GetTriggerPlayer())]
local unit hero = udg_MapHero[GetConvertedPlayerId(GetTriggerPlayer())]
call IssueImmediateOrder( hero, "stop" )
call PlaySoundAtPointBJ( gg_snd_HeroDropItem1, 100, GetUnitLoc(hero), 0 )
call SetUnitPositionLoc( pack , PolarProjectionBJ(GetUnitLoc(hero), 50.00, GetUnitFacing(hero)) )
call SelectUnitAddForPlayer( hero, GetOwningPlayer(hero) )
endfunction
function PackIn takes nothing returns nothing
local unit hero = GetTriggerUnit()
local unit pack = udg_Pack[GetConvertedPlayerId(GetOwningPlayer(hero))]
call PlaySoundAtPointBJ( gg_snd_PickUpItem, 100, GetUnitLoc(hero), 0 )
call SetUnitPositionLoc( pack, GetRectCenter(gg_rct_Packs) )
call SelectUnitRemoveForPlayer( pack, GetOwningPlayer(hero) )
endfunction
library Airship requires Text
function SummonAirship takes nothing returns nothing
local player p
local unit hero
local unit airship
local location loc
local effect fx
local effect fx2
local playerslotstate slot
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 1.00 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set p = Player(bj_forLoopAIndex-1)
set hero = udg_MapHero[bj_forLoopAIndex]
call SetUnitPositionLoc( hero, OffsetLocation(GetRectCenter(gg_rct_Buried_Airship), -200.0, -200.00) )
call PauseUnitBJ( true, hero )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call TriggerSleepAction( 2.00 )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl", GetRectCenter(gg_rct_Buried_Airship) )
call TriggerSleepAction( 3.00 )
set fx2 = AddSpecialEffectLoc( "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", GetRectCenter(gg_rct_Buried_Airship) )
set airship = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), 'h014', GetRectCenterX(gg_rct_Buried_Airship), GetRectCenterY(gg_rct_Buried_Airship), 225.0 )
call SetUnitFlyHeightBJ( airship, 500.00, 50.00 )
call TriggerSleepAction( 2.00 )
call DestroyEffect( fx )
call DestroyEffect( fx2 )
call RemoveUnit( airship )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set p = Player(bj_forLoopAIndex-1)
set hero = udg_MapHero[bj_forLoopAIndex]
set udg_BattleRegion[bj_forLoopAIndex] = udg_Sea[bj_forLoopAIndex]
set slot = GetPlayerSlotState(p)
if slot != PLAYER_SLOT_STATE_EMPTY and slot != PLAYER_SLOT_STATE_LEFT then
call SetUnitPositionLoc( hero, OffsetLocation(GetRectCenter(udg_BattleRegion[bj_forLoopAIndex]), 0, -300.00) )
call PauseUnitBJ( false, hero )
call SetUnitScalePercent( hero, 100.00, 100.00, 100 )
call BlzSetUnitRealFieldBJ( hero, UNIT_RF_SELECTION_SCALE, 1.00 )
call SetUnitMoveSpeed( hero, GetUnitDefaultMoveSpeed(hero) )
set airship = CreateUnit( p, 'h013', GetUnitX(gg_unit_n01B_0814), GetUnitY(gg_unit_n01B_0814), 225.0 )
call SetUnitFlyHeightBJ( airship, 0.00, 0.00 )
call SetUnitFlyHeightBJ( airship, 450.00, 300.00 )
set udg_MapShip[bj_forLoopAIndex] = airship
call SetCameraFieldForPlayer( p, CAMERA_FIELD_TARGET_DISTANCE, 2000.00, 1.00 )
call SetCameraFieldForPlayer( p, CAMERA_FIELD_ANGLE_OF_ATTACK, 320.00, 1.00 )
call SetCameraTargetControllerNoZForPlayer( p, airship, 0, 0, false )
call SelectUnitForPlayerSingle( airship, p )
endif
if GetLocalPlayer() == p then
call ClearMapMusicBJ( )
call StopMusicBJ( false )
call PlayMusicExBJ( gg_snd_NightElfX1, 24.00, 0 )
call SetMusicOffsetBJ( 24.00 )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", GetRectCenter(gg_rct_Buried_Airship) )
call BlzSetSpecialEffectScale( fx, 2.00 )
call BlzSetSpecialEffectZ( fx, 300.0 )
call TriggerSleepAction( 2.00 )
call DestroyEffect( fx )
set fx = null
set fx2 = null
endfunction
function LandAirship takes nothing returns nothing
local real radius = 75.0
local unit u = GetTriggerUnit()
local rect r = Rect(GetUnitX(u) - radius, GetUnitY(u) - radius, GetUnitX(u) + radius, GetUnitY(u) + radius)
local location loc = GetUnitLoc(u)
local player p = GetOwningPlayer(u)
local integer pid = GetConvertedPlayerId(p)
local real scaling = BlzGetUnitRealField(udg_MapHero[pid], UNIT_RF_SCALING_VALUE)
if IsTerrainPathableBJ(loc, PATHING_TYPE_WALKABILITY) then
call ErrorMessage("Can not land here", p)
call RemoveLocation(loc)
set loc = null
return
endif
set udg_InForest = false
call EnumDestructablesInRect(r, null, function CountTrees)
if udg_InForest then
call ErrorMessage("Can not land on forest", p)
call RemoveLocation(loc)
set loc = null
return
endif
if GetTerrainTypeBJ(loc) == 'Dlvc' then
call ErrorMessage("Can not on lava", p)
call RemoveLocation(loc)
set loc = null
return
endif
call SetUnitFlyHeight( u, 0.00, 300.00 )
call SetCameraFieldForPlayer( p, CAMERA_FIELD_TARGET_DISTANCE, 1500.00, 1.00 )
call SetCameraFieldForPlayer( p, CAMERA_FIELD_ANGLE_OF_ATTACK, 304.00, 1.00 )
call SetUnitMoveSpeed( udg_MapHero[pid], ( GetUnitDefaultMoveSpeed(udg_MapHero[pid]) / 2.00 ) )
call TriggerSleepAction( 1.00 )
call SetUnitPositionLoc( udg_MapHero[pid], GetUnitLoc(udg_MapShip[pid]) )
call RemoveUnit( udg_MapShip[pid] )
set udg_MapShip[pid] = null
call SetUnitScalePercent( udg_MapHero[pid], 40*scaling, 40*scaling, 40*scaling )
call BlzSetUnitRealFieldBJ( udg_MapHero[pid], UNIT_RF_SELECTION_SCALE, 0.30 )
call SelectUnitForPlayerSingle( udg_MapHero[pid], p )
call SetCameraTargetControllerNoZForPlayer( p, udg_MapHero[pid], 0, 0, false )
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(ReturnButton, false)
call BlzFrameSetVisible(AirshipButton, true)
call ClearMapMusicBJ( )
call StopMusicBJ( false )
call PlayMusicBJ( gg_snd_SadMystery )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function TakeoffAirship takes unit u returns nothing
local integer p
local unit hero
local unit airship
set p = GetConvertedPlayerId(GetOwningPlayer(u))
set hero = udg_MapHero[p]
if RectContainsUnit(gg_rct_World_Map, hero) then
set udg_BattleRegion[p] = udg_Sea[p]
call SetUnitScalePercent( hero, 100.00, 100.00, 100 )
call BlzSetUnitRealFieldBJ( hero, UNIT_RF_SELECTION_SCALE, 1.00 )
call SetUnitMoveSpeed( hero, GetUnitDefaultMoveSpeed(hero) )
set airship = CreateUnit( GetOwningPlayer(hero), 'h013', GetUnitX(hero), GetUnitY(hero), 225.0 )
set udg_MapShip[p] = airship
call SetUnitPositionLoc( hero, OffsetLocation(GetRectCenter(udg_BattleRegion[p]), 0, -300.00) )
call SetUnitFlyHeightBJ( airship, 0.00, 0.00 )
call SetUnitFlyHeightBJ( airship, 450.00, 300.00 )
call SetCameraFieldForPlayer( GetOwningPlayer(hero), CAMERA_FIELD_TARGET_DISTANCE, 2000.00, 1.00 )
call SetCameraFieldForPlayer( GetOwningPlayer(hero), CAMERA_FIELD_ANGLE_OF_ATTACK, 320.00, 1.00 )
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(hero), airship, 0, 0, false )
call SelectUnitForPlayerSingle( airship, GetOwningPlayer(hero) )
if GetLocalPlayer() == GetOwningPlayer(u) then
call BlzFrameSetVisible(ReturnButton, false)
call BlzFrameSetVisible(AirshipButton, false)
call ClearMapMusicBJ( )
call StopMusicBJ( false )
call PlayMusicExBJ( gg_snd_NightElfX1, 24.00, 0 )
call SetMusicOffsetBJ( 24.00 )
endif
endif
endfunction
endlibrary
library FileIO
/***************************************************************
*
* v1.1.0, by TriggerHappy
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*
* Provides functionality to read and write files.
* _________________________________________________________________________
* 1. Requirements
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* - Patch 1.29 or higher.
* - JassHelper (vJASS)
* _________________________________________________________________________
* 2. Installation
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* Copy the script to your map and save it.
* _________________________________________________________________________
* 3. API
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* struct File extends array
*
* static constant integer AbilityCount
* static constant integer PreloadLimit
*
* readonly static boolean ReadEnabled
* readonly static integer Counter
* readonly static integer array List
*
* static method open takes string filename returns File
* static method create takes string filename returns File
*
* ---------
*
* method write takes string value returns File
* method read takes nothing returns string
* method clear takes nothing returns File
*
* method readEx takes boolean close returns string
* method readAndClose takes nothing returns string
* method readBuffer takes nothing returns string
* method writeBuffer takes string contents returns nothing
* method appendBuffer takes string contents returns nothing
*
* method close takes nothing returns nothing
*
* public function Write takes string filename, string contents returns nothing
* public function Read takes string filename returns string
*
***************************************************************/
globals
// Enable this if you want to allow the system to read files generated in patch 1.30 or below.
// NOTE: For this to work properly you must edit the 'Amls' ability and change the levels to 2
// as well as typing something in "Level 2 - Text - Tooltip - Normal" text field.
//
// Enabling this will also cause the system to treat files written with .write("") as empty files.
//
// This setting is really only intended for those who were already using the system in their map
// prior to patch 1.31 and want to keep old files created with this system to still work.
private constant boolean BACKWARDS_COMPATABILITY = false
endglobals
private keyword FileInit
struct File extends array
static constant integer AbilityCount = 10
static constant integer PreloadLimit = 200
readonly static integer Counter = 0
readonly static integer array List
readonly static integer array AbilityList
readonly static boolean ReadEnabled
readonly string filename
private string buffer
static method open takes string filename returns thistype
local thistype this = .List[0]
if (this == 0) then
set this = Counter + 1
set Counter = this
else
set .List[0] = .List[this]
endif
set this.filename = filename
set this.buffer = null
debug if (this >= JASS_MAX_ARRAY_SIZE) then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0, 120, "FileIO(" + filename + ") WARNING: Maximum instance limit " + I2S(JASS_MAX_ARRAY_SIZE) + " reached.")
debug endif
return this
endmethod
// This is used to detect invalid characters which aren't supported in preload files.
static if (DEBUG_MODE) then
private static method validateInput takes string contents returns string
local integer i = 0
local integer l = StringLength(contents)
local string ch = ""
loop
exitwhen i >= l
set ch = SubString(contents, i, i + 1)
if (ch == "\\") then
return ch
elseif (ch == "\"") then
return ch
endif
set i = i + 1
endloop
return null
endmethod
endif
method write takes string contents returns thistype
local integer i = 0
local integer c = 0
local integer len = StringLength(contents)
local integer lev = 0
local string prefix = "-" // this is used to signify an empty string vs a null one
local string chunk
debug if (.validateInput(contents) != null) then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0, 120, "FileIO(" + filename + ") ERROR: Invalid character |cffffcc00" + .validateInput(contents) + "|r")
debug return this
debug endif
set this.buffer = null
// Check if the string is empty. If null, the contents will be cleared.
if (contents == "") then
set len = len + 1
endif
// Begin to generate the file
call PreloadGenClear()
call PreloadGenStart()
loop
exitwhen i >= len
debug if (c >= .AbilityCount) then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0, 120, "FileIO(" + filename + ") ERROR: String exceeds max length (" + I2S(.AbilityCount * .PreloadLimit) + ").|r")
debug endif
set lev = 0
static if (BACKWARDS_COMPATABILITY) then
if (c == 0) then
set lev = 1
set prefix = ""
else
set prefix = "-"
endif
endif
set chunk = SubString(contents, i, i + .PreloadLimit)
call Preload("\" )\ncall BlzSetAbilityTooltip(" + I2S(.AbilityList[c]) + ", \"" + prefix + chunk + "\", " + I2S(lev) + ")\n//")
set i = i + .PreloadLimit
set c = c + 1
endloop
call Preload("\" )\nendfunction\nfunction a takes nothing returns nothing\n //")
call PreloadGenEnd(this.filename)
return this
endmethod
method clear takes nothing returns thistype
return this.write(null)
endmethod
private method readPreload takes nothing returns string
local integer i = 0
local integer lev = 0
local string array original
local string chunk = ""
local string output = ""
loop
exitwhen i == .AbilityCount
set original[i] = BlzGetAbilityTooltip(.AbilityList[i], 0)
set i = i + 1
endloop
// Execute the preload file
call Preloader(this.filename)
// Read the output
set i = 0
loop
exitwhen i == .AbilityCount
set lev = 0
// Read from ability index 1 instead of 0 if
// backwards compatability is enabled
static if (BACKWARDS_COMPATABILITY) then
if (i == 0) then
set lev = 1
endif
endif
// Make sure the tooltip has changed
set chunk = BlzGetAbilityTooltip(.AbilityList[i], lev)
if (chunk == original[i]) then
if (i == 0 and output == "") then
return null // empty file
endif
return output
endif
// Check if the file is an empty string or null
static if not (BACKWARDS_COMPATABILITY) then
if (i == 0) then
if (SubString(chunk, 0, 1) != "-") then
return null // empty file
endif
set chunk = SubString(chunk, 1, StringLength(chunk))
endif
endif
// Remove the prefix
if (i > 0) then
set chunk = SubString(chunk, 1, StringLength(chunk))
endif
// Restore the tooltip and append the chunk
call BlzSetAbilityTooltip(.AbilityList[i], original[i], lev)
set output = output + chunk
set i = i + 1
endloop
return output
endmethod
method close takes nothing returns nothing
if (this.buffer != null) then
call .write(.readPreload() + this.buffer)
set this.buffer = null
endif
set .List[this] = .List[0]
set .List[0] = this
endmethod
method readEx takes boolean close returns string
local string output = .readPreload()
local string buf = this.buffer
if (close) then
call this.close()
endif
if (output == null) then
return buf
endif
if (buf != null) then
set output = output + buf
endif
return output
endmethod
method read takes nothing returns string
return .readEx(false)
endmethod
method readAndClose takes nothing returns string
return .readEx(true)
endmethod
method appendBuffer takes string contents returns thistype
set .buffer = .buffer + contents
return this
endmethod
method readBuffer takes nothing returns string
return .buffer
endmethod
method writeBuffer takes string contents returns nothing
set .buffer = contents
endmethod
static method create takes string filename returns thistype
return .open(filename).write("")
endmethod
implement FileInit
endstruct
private module FileInit
private static method onInit takes nothing returns nothing
local string originalTooltip
// We can't use a single ability with multiple levels because
// tooltips return the first level's value if the value hasn't
// been set. This way we don't need to edit any object editor data.
set File.AbilityList[0] = 'Amls'
set File.AbilityList[1] = 'Aroc'
set File.AbilityList[2] = 'Amic'
set File.AbilityList[3] = 'Amil'
set File.AbilityList[4] = 'Aclf'
set File.AbilityList[5] = 'Acmg'
set File.AbilityList[6] = 'Adef'
set File.AbilityList[7] = 'Adis'
set File.AbilityList[8] = 'Afbt'
set File.AbilityList[9] = 'Afbk'
// Backwards compatability check
static if (BACKWARDS_COMPATABILITY) then
static if (DEBUG_MODE) then
set originalTooltip = BlzGetAbilityTooltip(File.AbilityList[0], 1)
call BlzSetAbilityTooltip(File.AbilityList[0], SCOPE_PREFIX, 1)
if (BlzGetAbilityTooltip(File.AbilityList[0], 1) == originalTooltip) then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0, 120, "FileIO WARNING: Backwards compatability enabled but \"" + GetObjectName(File.AbilityList[0]) + "\" isn't setup properly.|r")
endif
endif
endif
// Read check
set File.ReadEnabled = File.open("FileTester.pld").write(SCOPE_PREFIX).readAndClose() == SCOPE_PREFIX
endmethod
endmodule
public function Write takes string filename, string contents returns nothing
call File.open(filename).write(contents).close()
endfunction
public function Read takes string filename returns string
return File.open(filename).readEx(true)
endfunction
endlibrary
library PlayerSync
globals
public constant string SYNC_PREFIX = "S"
endglobals
private keyword INITS
private struct Sync extends array
static trigger Trigger = CreateTrigger()
implement INITS
endstruct
function SyncString takes string s returns boolean
return BlzSendSyncData(SYNC_PREFIX, s)
endfunction
function OnSyncString takes code func returns triggeraction
return TriggerAddAction(Sync.Trigger, func)
endfunction
function RemoveSyncString takes triggeraction t returns nothing
call TriggerRemoveAction(Sync.Trigger, t)
endfunction
private module INITS
private static method onInit takes nothing returns nothing
local integer i = 0
loop
call BlzTriggerRegisterPlayerSyncEvent(.Trigger, Player(i), SYNC_PREFIX, false)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
endmethod
endmodule
endlibrary
library SaveNLoad requires Capabilities, Jobs, Text
function SyncLoad takes nothing returns nothing
local string s = BlzGetTriggerSyncData()
local player p = GetTriggerPlayer()
local integer pid = GetConvertedPlayerId(p)
local unit u = udg_MapHero[pid]
local unit n
local item it
local effect fx
local effect fx2
local integer i = 0
local integer c
local real x
local real y
local real mapx
local real mapy
local real life
local real mana
local integer gold
local integer spirit
local integer orbs
local integer airship
local integer mainslot
local integer offhandslot
local integer armorslot
local integer item1
local integer item1charges
local integer item2
local integer item2charges
local integer item3
local integer item3charges
local integer item4
local integer item4charges
local integer item5
local integer item5charges
local integer item6
local integer item6charges
local integer pack1
local integer pack1charges
local integer pack2
local integer pack2charges
local integer pack3
local integer pack3charges
local integer pack4
local integer pack4charges
local integer pack5
local integer pack5charges
local integer pack6
local integer pack6charges
local integer abil
if StringLength(s) == 0 then
return
endif
set i = NextSplit(s, "|")
set c = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set x = S2R(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set y = S2R(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set mapx = S2R(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set mapy = S2R(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set life = RMaxBJ(1.00, I2R(S2I(SubString(s,0,i))))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set mana = I2R(S2I(SubString(s,0,i)))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set gold = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set spirit = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set orbs = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set airship = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set mainslot = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set offhandslot = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set armorslot = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item1 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item1charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item2 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item2charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item3 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item3charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item4 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item4charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item5 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item5charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item6 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set item6charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack1 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack1charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack2 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack2charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack3 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack3charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack4 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack4charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack5 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack5charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack6 = String2Id(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set pack6charges = S2I(SubString(s,0,i))
set s = SubString(s,i+1,StringLength(s))
set i = NextSplit(s, "|")
set udg_Skills[pid] = SubString(s,0,i)
call ShowUnit(u, false)
set n = CreateUnit(p, c, GetUnitX(u), GetUnitY(u), GetUnitFacing(u))
//set udg_MapLocation[pid] = Location(mapx, mapy)
call SetUnitState(n, UNIT_STATE_LIFE, life)
call SetUnitState(n, UNIT_STATE_MANA, mana)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, gold)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_LUMBER, spirit)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_FOOD_USED, orbs)
set udg_Airship[pid] = (airship == 1)
call UnitEquipItem(n, CreateItemLoc( mainslot, GetRectCenter(gg_rct_Equipment) ))
call UnitEquipItem(n, CreateItemLoc( offhandslot, GetRectCenter(gg_rct_Equipment) ))
call UnitEquipItem(n, CreateItemLoc( armorslot, GetRectCenter(gg_rct_Equipment) ))
set it = UnitAddItemById(n, item1)
call SetItemCharges(it, item1charges)
set it = UnitAddItemById(n, item2)
call SetItemCharges(it, item2charges)
set it = UnitAddItemById(n, item3)
call SetItemCharges(it, item3charges)
set it = UnitAddItemById(n, item4)
call SetItemCharges(it, item4charges)
set it = UnitAddItemById(n, item5)
call SetItemCharges(it, item5charges)
set it = UnitAddItemById(n, item6)
call SetItemCharges(it, item6charges)
set it = UnitAddItemById(udg_Pack[pid], pack1)
call SetItemCharges(it, pack1charges)
set it = UnitAddItemById(udg_Pack[pid], pack2)
call SetItemCharges(it, pack2charges)
set it = UnitAddItemById(udg_Pack[pid], pack3)
call SetItemCharges(it, pack3charges)
set it = UnitAddItemById(udg_Pack[pid], pack4)
call SetItemCharges(it, pack4charges)
set it = UnitAddItemById(udg_Pack[pid], pack5)
call SetItemCharges(it, pack5charges)
set it = UnitAddItemById(udg_Pack[pid], pack6)
call SetItemCharges(it, pack6charges)
set i = 0
set s = udg_Skills[pid]
loop
exitwhen StringLength(s) == 0
set i = NextSplit(s, "-")
set abil = String2Id(SubString(s,0,i))
call UnitAddAbility(n, abil)
if abil == 'A03C' then
call UnitAddAbilityBJ( 'A03F', n ) // Jousting Icon
endif
set s = SubString(s,i+1,StringLength(s))
endloop
set udg_MapHero[pid] = n
//set udg_Portals[pid] = Location(x,y)
call UnitAddAbility(n, 'A01F')
call SetUnitAbilityLevel( u, 'Adt1', 0 )
call SetCameraTargetControllerNoZForPlayer( p, n, 0, 0, false )
call SelectUnitForPlayerSingle( n, p )
call RemoveUnit(u)
call PlaySoundAtPointBJ( gg_snd_ClanInvitation, 100, GetUnitLoc(n), 0 )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", GetUnitLoc(n) )
set fx2 = AddSpecialEffectTarget( "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl", n, "origin" )
call TriggerSleepAction( 2.00 )
call DestroyEffect(fx)
call DestroyEffect(fx2)
set fx = null
set fx2 = null
endfunction
function PlayerReset takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer pid = GetConvertedPlayerId(p)
local real f = GetUnitFacing(udg_MapHero[pid])
local boolean fairy = UnitHasItemOfTypeBJ(udg_MapHero[pid], 'I00F')
local boolean tp = UnitHasItemOfTypeBJ(udg_MapHero[pid], 'stwp')
set udg_Skills[pid] = ""
call RemoveItem( udg_MainSlot[pid] )
call RemoveItem( udg_OffhandSlot[pid] )
call RemoveItem( udg_ArmorSlot[pid] )
call UnequipMain(udg_MapHero[pid])
call UnequipOffhand(udg_MapHero[pid])
call UnequipArmor(udg_MapHero[pid])
call RemoveUnit( udg_MapHero[pid] )
set udg_MapHero[pid] = CreateUnit(p, 'n002', GetRectCenterX(gg_rct_Glenheim), GetRectCenterY(gg_rct_Glenheim), f)
call RemoveUnit( udg_Pack[pid] )
set udg_Pack[pid] = CreateUnit(p, 'h00Z', GetRectCenterX(gg_rct_Packs), GetRectCenterY(gg_rct_Packs), f)
set udg_Airship[pid] = false
if fairy then
call UnitAddItemById(udg_MapHero[pid], 'I00F')
endif
if tp then
call UnitAddItemById(udg_MapHero[pid], 'stwp')
endif
call SetPlayerStateBJ( p, PLAYER_STATE_RESOURCE_GOLD, 25 )
call SetPlayerStateBJ( p, PLAYER_STATE_RESOURCE_LUMBER, 1 )
call SetPlayerStateBJ( p, PLAYER_STATE_RESOURCE_FOOD_USED, 0 )
call SetCameraTargetControllerNoZForPlayer( p, udg_MapHero[pid], 0, 0, false )
call SelectUnitForPlayerSingle( udg_MapHero[pid], p )
if GetPlayerName(p) == "WorldEdit" then
call SetPlayerAllianceStateBJ( Player(21), Player(0), bj_ALLIANCE_ALLIED_UNITS )
call UnitAddItemByIdSwapped( 'esaz', udg_MapHero[1] )
set udg_Airship[pid] = true
endif
endfunction
function PlayerLoad takes nothing returns nothing
local string s
call OnSyncString(function SyncLoad)
if (not File.ReadEnabled) then
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0, 120, "FileIO WARNING: You are unable to read files, save/load will not work.")
return
endif
set s = File.open("WarQuestWorld.txt").readAndClose()
if (s != null) then
call SyncString( s )
endif
endfunction
function PlayerSave takes player p returns nothing
local File file
local integer pid = GetConvertedPlayerId(p)
local unit hero = udg_MapHero[pid]
local unit pack = udg_Pack[pid]
local integer hid = GetUnitTypeId(hero)
local real x = GetUnitX(hero)
local real y = GetUnitY(hero)
local real mapx = GetLocationX(udg_MapLocation[pid])
local real mapy = GetLocationY(udg_MapLocation[pid])
local real life = GetUnitState(hero, UNIT_STATE_LIFE)
local real mana = GetUnitState(hero, UNIT_STATE_MANA)
local integer gold = GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD)
local integer spirit = GetPlayerState(p, PLAYER_STATE_RESOURCE_LUMBER)
local integer orbs = GetPlayerState(p, PLAYER_STATE_RESOURCE_FOOD_USED)
local integer airship = 0
local item mainslot = udg_MainSlot[pid]
local item offhandslot = udg_OffhandSlot[pid]
local item armorslot = udg_ArmorSlot[pid]
local item item1 = UnitItemInSlot(hero, 0)
local item item2 = UnitItemInSlot(hero, 1)
local item item3 = UnitItemInSlot(hero, 2)
local item item4 = UnitItemInSlot(hero, 3)
local item item5 = UnitItemInSlot(hero, 4)
local item item6 = UnitItemInSlot(hero, 5)
local item pack1 = UnitItemInSlot(pack, 0)
local item pack2 = UnitItemInSlot(pack, 1)
local item pack3 = UnitItemInSlot(pack, 2)
local item pack4 = UnitItemInSlot(pack, 3)
local item pack5 = UnitItemInSlot(pack, 4)
local item pack6 = UnitItemInSlot(pack, 5)
local string s = Id2String(hid)
if (GetLocalPlayer() != p) then
return
endif
if udg_Airship[pid] then
set airship = 1
endif
set s = s + "|" + R2S(x)
set s = s + "|" + R2S(y)
set s = s + "|" + R2S(mapx)
set s = s + "|" + R2S(mapy)
set s = s + "|" + I2S(R2I(life))
set s = s + "|" + I2S(R2I(mana))
set s = s + "|" + I2S(gold)
set s = s + "|" + I2S(spirit)
set s = s + "|" + I2S(orbs)
set s = s + "|" + I2S(airship)
set s = s + "|" + Id2String(GetItemTypeId(mainslot))
set s = s + "|" + Id2String(GetItemTypeId(offhandslot))
set s = s + "|" + Id2String(GetItemTypeId(armorslot))
set s = s + "|" + Id2String(GetItemTypeId(item1)) + "|" + I2S(GetItemCharges(item1))
set s = s + "|" + Id2String(GetItemTypeId(item2)) + "|" + I2S(GetItemCharges(item2))
set s = s + "|" + Id2String(GetItemTypeId(item3)) + "|" + I2S(GetItemCharges(item3))
set s = s + "|" + Id2String(GetItemTypeId(item4)) + "|" + I2S(GetItemCharges(item4))
set s = s + "|" + Id2String(GetItemTypeId(item5)) + "|" + I2S(GetItemCharges(item5))
set s = s + "|" + Id2String(GetItemTypeId(item6)) + "|" + I2S(GetItemCharges(item6))
set s = s + "|" + Id2String(GetItemTypeId(pack1)) + "|" + I2S(GetItemCharges(pack1))
set s = s + "|" + Id2String(GetItemTypeId(pack2)) + "|" + I2S(GetItemCharges(pack2))
set s = s + "|" + Id2String(GetItemTypeId(pack3)) + "|" + I2S(GetItemCharges(pack3))
set s = s + "|" + Id2String(GetItemTypeId(pack4)) + "|" + I2S(GetItemCharges(pack4))
set s = s + "|" + Id2String(GetItemTypeId(pack5)) + "|" + I2S(GetItemCharges(pack5))
set s = s + "|" + Id2String(GetItemTypeId(pack6)) + "|" + I2S(GetItemCharges(pack6))
set s = s + "|" + udg_Skills[pid]
if (not File.ReadEnabled) then
call DisplayTimedTextToPlayer(p,0,0, 120, "FileIO WARNING: You are unable to read files; save/load will not work")
else
call File.open("WarQuestWorld.txt").write(s).close()
endif
endfunction
endlibrary
library Jobs requires Capabilities, Text
function HeroClassChange takes unit u, integer c returns nothing
local unit n
local integer i
local item it
local real r
local string s
local integer skill
local player p = GetOwningPlayer(u)
local integer pid = GetConvertedPlayerId(p)
local effect fx
local effect fx2
set u = udg_MapHero[pid]
call ShowUnit(u, false)
set n = CreateUnit(p, c, GetUnitX(u), GetUnitY(u), GetUnitFacing(u))
set r = GetUnitState(u, UNIT_STATE_LIFE) / GetUnitState(u, UNIT_STATE_MAX_LIFE)
call SetUnitState(n, UNIT_STATE_LIFE, r * GetUnitState(n, UNIT_STATE_MAX_LIFE))
set r = GetUnitState(u, UNIT_STATE_MANA) / GetUnitState(u, UNIT_STATE_MAX_MANA)
call SetUnitState(n, UNIT_STATE_MANA, r * GetUnitState(n, UNIT_STATE_MAX_MANA))
call UnequipMain(u)
call UnequipOffhand(u)
call UnequipArmor(u)
set i = 0
loop
set it = UnitItemInSlot(u, i)
if (it != null) then
call UnitRemoveItem(u, it)
call UnitAddItem(n, it)
endif
set i = i + 1
exitwhen i >= bj_MAX_INVENTORY
endloop
set udg_MapHero[pid] = n
call UnitAddAbility(n, 'A01F')
//call UnitAddAbility(n, 'A02G' )
call SetUnitAbilityLevel( u, 'Adt1', 0 )
if udg_Skills[pid] != null and udg_Skills[pid] != "" then
set i = 0
set s = udg_Skills[pid]
loop
exitwhen StringLength(s) == 0
set i = NextSplit(s, "-")
set skill = String2Id(SubString(s,0,i))
call UnitAddAbilityBJ( skill, n )
if skill == 'A03C' then
call UnitAddAbilityBJ( 'A03F', n ) // Jousting Icon
endif
set s = SubString(s,i+1,StringLength(s))
endloop
endif
call SetCameraTargetControllerNoZForPlayer( p, n, 0, 0, false )
call SelectUnitForPlayerSingle( n, p )
set s = GetItemName(GetManipulatedItem())
if s == "|cffc3dbffAscend" then
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(p) + " has |cffffdeadAscended|r to become a |cffc3dbff" + GetUnitName(n) ) )
else
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(p) + " has studied |cffc3dbff" + s ) )
endif
call PlaySoundAtPointBJ( gg_snd_ClanInvitation, 100, GetUnitLoc(n), 0 )
call RemoveUnit(u)
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", GetUnitLoc(n) )
set fx2 = AddSpecialEffectTarget( "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl", n, "origin" )
call TriggerSleepAction( 2.00 )
call DestroyEffect(fx)
call DestroyEffect(fx2)
set fx = null
set fx2 = null
endfunction
function HeroAscend takes unit u returns nothing
local integer uid = GetUnitTypeId(u)
if (uid == 'h001') then
call HeroClassChange(u, 'h00B') // Knight
elseif (uid == 'n02U') then
call HeroClassChange(u, 'n03B') // Ranger
elseif (uid == 'n02X') then
call HeroClassChange(u, 'n03D') // Sorceror
elseif (uid == 'n031') then
call HeroClassChange(u, 'n03I') // Priest
elseif (uid == 'h008') then
call HeroClassChange(u, 'h00D') // Crusader
elseif (uid == 'h005') then
call HeroClassChange(u, 'h00F') // Viking
elseif (uid == 'h006') then
call HeroClassChange(u, 'h00H') // Huntress
elseif (uid == 'h00Y') then
call HeroClassChange(u, 'h00X') // Cavalry
elseif (uid == 'n03F') then
call HeroClassChange(u, 'n03G') // Corsair
elseif (uid == 'n038') then
call HeroClassChange(u, 'n039') // Necromancer
elseif (uid == 'n037') then
call HeroClassChange(u, 'n03K') // Shapeshifter
elseif (uid == 'h007') then
call HeroClassChange(u, 'h009') // Dragon Knight
elseif (uid == 'h01E') then
call HeroClassChange(u, 'h01F') // Samurai
endif
endfunction
function HeroLegend takes unit u returns nothing
local integer uid = GetUnitTypeId(u)
if (uid == 'h00B') then
call HeroClassChange(u, 'h00C') // Vanguard
elseif (uid == 'n03B') then
call HeroClassChange(u, 'n03C') // Amazon
elseif (uid == 'n03D') then
call HeroClassChange(u, 'n03E') // Wizard
elseif (uid == 'n03I') then
call HeroClassChange(u, 'n03J') // Saint
elseif (uid == 'h00D') then
call HeroClassChange(u, 'h00E') // Paladin
elseif (uid == 'h00F') then
call HeroClassChange(u, 'h00G') // Berzerker
elseif (uid == 'h00H') then
call HeroClassChange(u, 'h00I') // Assassin
elseif (uid == 'h00X') then
call HeroClassChange(u, 'h00W') // Cataphract
elseif (uid == 'n03G') then
call HeroClassChange(u, 'n03H') // Strider
elseif (uid == 'n039') then
call HeroClassChange(u, 'n03A') // Lich
elseif (uid == 'n03K') then
call HeroClassChange(u, 'n03L') // Guardian
elseif (uid == 'h009') then
call HeroClassChange(u, 'h00A') // Dragoon
elseif (uid == 'h01F') then
call HeroClassChange(u, 'h01G') // Daimyo
endif
endfunction
endlibrary Jobs
library SkillLearn requires SaveNLoad
function Hotkey takes integer abil, string hotkey returns nothing
call SaveStr(udg_Hotkeys, abil, StringHash("hotkey"), hotkey)
endfunction
function GetHotkey takes integer abil returns string
return LoadStr(udg_Hotkeys, abil, StringHash("hotkey"))
endfunction
function Skills takes nothing returns nothing
set udg_Hotkeys = InitHashtable()
call Hotkey('ACcb', "Q") // Bash
call Hotkey('A01U', "W") // Slash
call Hotkey('Adef', "D") // Block
call Hotkey('APsa', "Q") // Sprint
call Hotkey('A01S', "W") // Powershot
call Hotkey('ACen', "E") // Ensnare
call Hotkey('A007', "W") // Thunderstrike
call Hotkey('A02D', "E") // Firebolt
call Hotkey('ACmf', "D") // Mana Shield
call Hotkey('ACcn', "F") // Banish
call Hotkey('A02A', "D") // Dodge
call Hotkey('ACr2', "Q") // Holy
call Hotkey('A011', "D") // Meditate
call Hotkey('A00B', "E") // Call to Prayer
call Hotkey('AHre', "R") // Resurrection
call Hotkey('Aspl', "R") // Protect
call Hotkey('A00K', "Q") // Frostbolt
call Hotkey('A026', "R") // Arcane Torrent
call Hotkey('A025', "W") // Hydro
call Hotkey('AHhb', "W") // Holy Light
call Hotkey('ACdm', "F") // Exorcism
call Hotkey('A02S', "F") // Thrown Blade
call Hotkey('A000', "Q") // Uppercut
call Hotkey('A00C', "E") // Downward Strike
call Hotkey('AHtc', "E") // Slam
call Hotkey('A02V', "R") // Arc Shot
call Hotkey('A01X', "E") // Ball Lightning
call Hotkey('A024', "W") // Chainlightning
call Hotkey('A00A', "E") // Meteor
call Hotkey('A009', "R") // Static Discharge
call Hotkey('Aivs', "Q") // Shadowalk
call Hotkey('ACct', "R") // Criticalstrike
call Hotkey('A027', "W") // Pierce
call Hotkey('A01Q', "Q") // Charge
call Hotkey('A03C', "R") // Jousting
call Hotkey('A005', "Q") // Frostblast
call Hotkey('Asta', "E") // Stasis Trap
call Hotkey('Aroc', "R") // Multishot
call Hotkey('Absk', "R") // Berserk
call Hotkey('ANwm', "F") // Summon Bone Horror
call Hotkey('A002', "Q") // Skull Spirit
call Hotkey('A00H', "R") // Lucent Beam
call Hotkey('ACsm', "D") // Mana Leech
call Hotkey('A039', "D") // Exhume Corpse
call Hotkey('A01X', "E") // Arcane Orb
call Hotkey('A013', "R") // Summon Skeleton
call Hotkey('A01V', "W") // Blood Strike
call Hotkey('A00M', "W") // Disintegrate
call Hotkey('Aenr', "Q") // Entangle
call Hotkey('A017', "W") // Geostrike
call Hotkey('A00E', "D") // Wall of Thorns
call Hotkey('A01Z', "Q") // Frost Ray
call Hotkey('A008', "E") // Blizzard
call Hotkey('A02K', "E") // Earthquake
call Hotkey('A03D', "W") // Tidal Wave
call Hotkey('A033', "F") // Bear Form
call Hotkey('Adsm', "F") // Dispel
call Hotkey('Ahwd', "E") // Blessed Ring
call Hotkey('AOsf', "F") // Squire
call Hotkey('A02W', "R") // Backstab
call Hotkey('A02X', "D") // Sneak Attack
call Hotkey('A02Y', "F") // Shuriken
call Hotkey('A0sw', "F") // Tesla Coil
call Hotkey('A028', "E") // Magic Arrow
call Hotkey('A03H', "W") // Airstrikes
call Hotkey('A03E', "E") // Vision Quest
call Hotkey('A02Z', "E") // Bladewave
call Hotkey('A03B', "F") // Arrow Storm
call Hotkey('A01W', "W") // Aeroblade
call Hotkey('A00F', "R") // Double Strike
call Hotkey('A006', "Q") // Jump Strike
call Hotkey('A022', "E") // Singularity
call Hotkey('A021', "R") // Void Ray
call Hotkey('A01P', "F") // Omnislash
call Hotkey('Aeye', "F") // Chaos Ward
call Hotkey('A020', "F") // Chaos Ray
endfunction
function Learn takes unit u, integer abil returns nothing
local string s
local string skills
local string hotkey
local integer i
local integer skill
local integer pid = GetConvertedPlayerId(GetOwningPlayer(u))
set u = udg_MapHero[pid]
if udg_Skills[pid] == null or udg_Skills[pid] == "" then
set udg_Skills[pid] = Id2String(abil)
else
set skills = ""
set i = 0
set s = udg_Skills[pid]
loop
exitwhen StringLength(s) == 0
set i = NextSplit(s, "-")
set skill = String2Id(SubString(s,0,i))
set hotkey = GetHotkey(skill)
if ( hotkey != "" and hotkey == GetHotkey(abil) ) then
call UnitRemoveAbility(u, skill)
if skill == 'A03C' then
call UnitRemoveAbility(u, 'A03F') // Jousting Icon
endif
elseif (skills == "") then
set skills = Id2String(skill)
else
set skills = skills + "-" + Id2String(skill)
endif
set s = SubString(s,i+1,StringLength(s))
endloop
if (skills == "") then
set udg_Skills[pid] = Id2String(abil)
else
set udg_Skills[pid] = skills + "-" + Id2String(abil)
endif
endif
call UnitAddAbilityBJ( abil, u )
if abil == 'A03C' then
call UnitAddAbilityBJ( 'A03F', u ) // Jousting Icon
endif
call PlaySoundAtPointBJ( gg_snd_Tomes, 50, GetUnitLoc(u), 0 )
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetOwningPlayer(u)) + " has learned |cffc3dbff" + GetAbilityName(abil) ) )
endfunction
endlibrary
function Physics takes nothing returns nothing
set udg_UnitPhysics = InitHashtable()
endfunction
function SetUnitVelocity takes unit u, real vx, real vy, real vz returns nothing
if (HaveSavedReal(udg_UnitPhysics, GetHandleId(u), StringHash("vz")) == false) then
call GroupAddUnit(udg_PhysicsUnits, u)
call UnitAddAbility(u, 'Amrf')
call UnitRemoveAbility(u, 'Amrf')
call SetUnitPropWindow(u, 0)
endif
call SaveReal(udg_UnitPhysics, GetHandleId(u), StringHash("vx"), vx)
call SaveReal(udg_UnitPhysics, GetHandleId(u), StringHash("vy"), vy)
call SaveReal(udg_UnitPhysics, GetHandleId(u), StringHash("vz"), vz)
endfunction
function AddUnitVelocity takes unit u, real dvx, real dvy, real dvz returns nothing
local real vx = LoadReal(udg_UnitPhysics, GetHandleId(u), StringHash("vx"))
local real vy = LoadReal(udg_UnitPhysics, GetHandleId(u), StringHash("vy"))
local real vz = LoadReal(udg_UnitPhysics, GetHandleId(u), StringHash("vz"))
call SetUnitVelocity(u, vx+dvx, vy+dvy, vz+dvz)
endfunction
function DistanceBetweenUnits takes unit a, unit b returns real
local location aL = GetUnitLoc(a)
local location bL = GetUnitLoc(b)
local real distance = DistanceBetweenPoints(aL, bL)
call RemoveLocation(aL)
call RemoveLocation(bL)
set aL = null
set bL = null
return distance
endfunction
function DistanceBetweenUnitTarget takes unit a, location t returns real
local location aL = GetUnitLoc(a)
local real distance = DistanceBetweenPoints(aL, t)
call RemoveLocation(aL)
set aL = null
return distance
endfunction
function AngleBetweenUnits takes unit a, unit b returns real
local location aL = GetUnitLoc(a)
local location bL = GetUnitLoc(b)
local real angle = AngleBetweenPoints(aL, bL)
call RemoveLocation(aL)
call RemoveLocation(bL)
set aL = null
set bL = null
return angle
endfunction
function AngleBetweenUnitTarget takes unit a, location t returns real
local location aL = GetUnitLoc(a)
local real angle = AngleBetweenPoints(aL, t)
call RemoveLocation(aL)
set aL = null
return angle
endfunction
function IsUnitInSightOfUnit takes unit observer, unit target, real fov returns boolean
local real face = GetUnitFacing(observer)
local real angle = bj_RADTODEG*Atan2(GetUnitY(target) - GetUnitY(observer), GetUnitX(target) - GetUnitX(observer))
return not (RAbsBJ(face - angle) > fov and RAbsBJ(face - angle - 360.) > fov)
endfunction
function PhysicsUpdate takes unit u returns nothing
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real z = GetUnitFlyHeight(u)
local real vx = LoadReal(udg_UnitPhysics, GetHandleId(u), StringHash("vx"))
local real vy = LoadReal(udg_UnitPhysics, GetHandleId(u), StringHash("vy"))
local real vz = LoadReal(udg_UnitPhysics, GetHandleId(u), StringHash("vz"))
local real az = -1000.0
local real dt = 0.05
local trigger callback
set vz = vz+az*dt
set x = x+vx*dt
set y = y+vy*dt
set z = z+vz*dt
if (z < 0) then
set z = 0
set callback = LoadTriggerHandle(udg_UnitPhysics, GetHandleId(u), StringHash("callback"))
call FlushChildHashtable(udg_UnitPhysics, GetHandleId(u))
call GroupRemoveUnit(udg_PhysicsUnits, u)
call SetUnitPropWindow(u, GetUnitDefaultPropWindow(u))
call IssueImmediateOrderBJ(u, "stop")
else
call SetUnitVelocity(u, vx, vy, vz)
endif
call SetUnitX(u, x)
call SetUnitY(u, y)
call SetUnitFlyHeight(u, z, 0)
if (callback != null) then
set udg_SpellCaster = u
call ConditionalTriggerExecute( callback )
endif
endfunction
function Spells takes nothing returns nothing
set udg_SpellTimers = InitHashtable()
endfunction
function DummyCleanup takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit caster = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("caster"))
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
call FlushChildHashtable(udg_SpellTimers, GetHandleId(caster))
call RemoveUnit( caster )
call PauseTimer( t )
call DestroyTimer( t )
set t = null
endfunction
function DummySource takes unit caster returns unit
return LoadUnitHandle(udg_SpellTimers, GetHandleId(caster), StringHash("source"))
endfunction
function DummyCaster takes unit source, integer abil, real time returns unit
local timer t = CreateTimer()
local player p = GetOwningPlayer(source)
local unit caster
if GetOwningPlayer(source) == Player(PLAYER_NEUTRAL_AGGRESSIVE) then
set p = Player(20)
endif
set caster = CreateUnit( p, 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, abil )
call SetUnitUserData( caster, abil )
call TimerStart(t, time, false, function DummyCleanup)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(caster), StringHash("source"), source)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("caster"), caster)
return caster
endfunction
function UnitProcDamage takes unit u returns integer
return BlzGetUnitBaseDamage(u, 0) + GetRandomInt(1, BlzGetUnitDiceSides(u, 0)) * BlzGetUnitDiceNumber(u, 0)
endfunction
function HasAbility takes unit u, integer abil returns boolean
return GetUnitAbilityLevel(u, abil) > 0
endfunction
function IsUndead takes unit u returns boolean
return IsUnitType(u, UNIT_TYPE_UNDEAD)
endfunction
function IsAquatic takes unit u returns boolean
return HasAbility(u, 'Asa2')
endfunction
function IsInfernal takes unit u returns boolean
return HasAbility(u, 'AIfw') or HasAbility(u, 'ANpi') or HasAbility(u, 'Apig')
endfunction
function IsFrost takes unit u returns boolean
return HasAbility(u, 'AIft') or HasAbility(u, 'Afra') or HasAbility(u, 'ACfa')
endfunction
function Damage takes unit u, unit target, real damage, attacktype at, damagetype dt returns nothing
local location loc
local location locu
local string text = I2S(R2I(damage))
local string order = OrderId2StringBJ(GetUnitCurrentOrder(target))
local real z = GetUnitFlyHeight(target)
local integer textsize = 9
local integer r = 80
if damage == 0 or GetUnitTypeId(target) == 'h010' then
return
endif
set loc = GetUnitLoc(target)
set locu = GetUnitLoc(u)
if dt == DAMAGE_TYPE_DIVINE and IsUndead(target) then
set damage = damage * 1.5
set text = I2S(R2I(damage)) + "!"
set r = 100
endif
if dt == DAMAGE_TYPE_FIRE then
if IsFrost(target) then
set damage = damage * 1.5
set text = I2S(R2I(damage)) + "!"
set textsize = 11
set r = 100
endif
if IsInfernal(target) then
set damage = damage * 0.5
set text = I2S(R2I(damage)) + ".."
set r = 70
endif
endif
if dt == DAMAGE_TYPE_COLD then
if IsInfernal(target) then
set damage = damage * 1.5
set text = I2S(R2I(damage)) + "!"
set textsize = 11
set r = 100
endif
if IsFrost(target) then
set damage = damage * 0.5
set text = I2S(R2I(damage)) + ".."
set r = 70
endif
endif
if dt == DAMAGE_TYPE_LIGHTNING and (IsAquatic(target) or z > 10) then
set damage = damage * 1.5
set text = I2S(R2I(damage)) + "!"
set textsize = 11
set r = 100
endif
if dt == DAMAGE_TYPE_ENHANCED then
set textsize = 11
set text = text + "!"
set r = 100
endif
if order == "" or order == "move" then
call IssuePointOrderLoc( target, "attack", locu)
endif
call UnitDamageTargetBJ( u, target, damage, at, DAMAGE_TYPE_NORMAL ) // DAMAGE_TYPE_NORMAL for armor calc
call ProcTextTag(loc, text, textsize, r, 0, 0)
call RemoveLocation(loc)
call RemoveLocation(locu)
set loc = null
set locu = null
endfunction
function Frostbolt takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local location loc
local integer damage = UnitProcDamage(source)
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(target), GetUnitY(target), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A004' )
call TriggerSleepAction( DistanceBetweenUnits(source, target) / 700.0 )
set loc = GetUnitLoc(target)
call IssueTargetOrder( caster , "frostnova", target )
call Damage( source, target, damage-1, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_COLD )
call TriggerSleepAction( 1.00 )
call RemoveUnit( caster )
call RemoveLocation(loc)
set loc = null
endfunction
function FireboltUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local location loc = GetUnitLoc(u)
local integer damage = UnitProcDamage(udg_SpellCaster)
local boolean water = not IsTerrainPathableBJ(loc, PATHING_TYPE_FLOATABILITY)
local boolean snow = GetTerrainTypeBJ(loc) == 'cWc1'
if water or snow then
set damage = R2I(0.75 * damage)
endif
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(udg_SpellCaster))) then
call Damage( udg_SpellCaster, u, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function Firebolt takes nothing returns nothing
local unit source = GetTriggerUnit()
local integer damage = UnitProcDamage(source)
local location loc = GetSpellTargetLoc()
local unit launcher = CreateUnit( GetOwningPlayer(source), 'h01A', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local boolean water = not IsTerrainPathableBJ(loc, PATHING_TYPE_FLOATABILITY)
local boolean snow = GetTerrainTypeBJ(loc) == 'cWc1'
call UnitAddAbility( caster, 'A003' )
call IssuePointOrderLocBJ( launcher, "attackground", loc )
call TriggerSleepAction( DistanceBetweenUnitTarget(source, loc) / 900.0 )
if not water and not snow then
call IssuePointOrderLoc( caster, "flamestrike", loc )
endif
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(150, loc), function FireboltUnit)
call TriggerSleepAction( 8.00 )
call RemoveUnit( launcher )
call RemoveUnit( caster )
call RemoveLocation(loc)
set loc = null
endfunction
function Bash takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer damage = UnitProcDamage(source)
call Damage( source, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction
function Thunderstrike takes nothing returns nothing
local integer damage = UnitProcDamage(GetTriggerUnit())
local location loc = GetUnitLoc(GetSpellTargetUnit())
local effect fx = AddSpecialEffectLoc( "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", loc )
call Damage( GetTriggerUnit(), GetSpellTargetUnit(), damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_LIGHTNING )
call TriggerSleepAction( 1.00 )
call DestroyEffect(fx)
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Meditation takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(target), GetUnitY(target), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A02C' )
call IssueTargetOrder( caster , "rejuvination", target )
call TriggerSleepAction( 1.00 )
call RemoveUnit( caster )
endfunction
function MeteorUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local location loc = GetUnitLoc(u)
local integer damage = R2I(1.25*UnitProcDamage(udg_SpellCaster))
local boolean water = not IsTerrainPathableBJ(loc, PATHING_TYPE_FLOATABILITY)
local boolean snow = GetTerrainTypeBJ(loc) == 'cWc1'
if water or snow then
set damage = R2I(0.75 * damage)
endif
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(udg_SpellCaster))) then
call Damage( udg_SpellCaster, u, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function Meteor takes nothing returns nothing
local unit source = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local effect fx = AddSpecialEffectLoc( "Abilities\\Spells\\Demon\\RainOfFire\\RainOfFireTarget.mdl", GetSpellTargetLoc() )
local boolean water = not IsTerrainPathableBJ(loc, PATHING_TYPE_FLOATABILITY)
local boolean snow = GetTerrainTypeBJ(loc) == 'cWc1'
call BlzSetSpecialEffectScale( fx, 2.00 )
call DestroyEffect(fx)
call UnitAddAbility( caster, 'A003' )
call TriggerSleepAction( 0.50 )
if not water and not snow then
call IssuePointOrderLoc( caster, "flamestrike", loc )
endif
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function MeteorUnit)
call TriggerSleepAction( 1.00 )
call RemoveUnit( caster )
call RemoveLocation(loc)
set fx = null
set loc = null
endfunction
function StaticDischargeUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local location loc = GetUnitLoc(u)
local effect fx
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(GetTriggerUnit()))) then
call Damage( GetTriggerUnit(), u, 0.25 * GetUnitState(u, UNIT_STATE_LIFE), ATTACK_TYPE_MAGIC, DAMAGE_TYPE_LIGHTNING )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl", loc )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function StaticDischarge takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
local effect fx = AddSpecialEffectLoc( "Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl", loc )
call BlzSetSpecialEffectScale( fx, 4.00 )
call ForGroup(GetUnitsInRangeOfLocAll(350, loc), function StaticDischargeUnit)
call RemoveLocation(loc)
call DestroyEffect(fx)
set loc = null
set fx = null
endfunction
function CallToPrayerUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local location loc = GetUnitLoc(u)
local integer damage = UnitProcDamage(GetTriggerUnit())
local effect fx
if (IsAlive(u) and IsEvil(u)) then
call Damage( GetTriggerUnit(), u, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DIVINE )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\NightElf\\ThornsAura\\ThornsAuraDamage.mdl", loc )
call DestroyEffect(fx)
call IssuePointOrderLoc( u, "move", PolarProjectionBJ(loc, 400.00, AngleBetweenUnits(GetTriggerUnit(), u)))
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function CallToPrayer takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
local effect fx = AddSpecialEffectLoc( "Abilities\\Spells\\Undead\\ReplenishHealth\\ReplenishHealthCasterOverhead.mdl", loc )
call BlzSetSpecialEffectHeight( fx, 250 )
call BlzSetSpecialEffectScale( fx, 2.50 )
call ForGroup(GetUnitsInRangeOfLocAll(450, loc), function CallToPrayerUnit)
call RemoveLocation(loc)
call TriggerSleepAction( 1.50 )
call BlzSetSpecialEffectScale( fx, 0.01 )
call DestroyEffect(fx)
set loc = null
set fx = null
endfunction
function SlamUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local integer damage = R2I(1.25 * UnitProcDamage(GetTriggerUnit()))
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(GetTriggerUnit()))) then
call Damage( GetTriggerUnit(), u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfunction
function Slam takes nothing returns nothing
local location loc = GetUnitLoc(GetTriggerUnit())
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function SlamUnit)
call RemoveLocation(loc)
call TriggerSleepAction( 1.50 )
set loc = null
endfunction
function LucentBeamUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(udg_SpellCaster))]
local integer damage = R2I(0.25 * UnitProcDamage(hero))
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero))) then
call Damage( hero, u, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
endif
endfunction
function LucentBeam takes nothing returns nothing
local unit source = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
call TriggerSleepAction( 0.50 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call TriggerSleepAction( 0.5 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function LucentBeamUnit)
call RemoveLocation(loc)
set loc = null
endfunction
function FrostTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = DummyCaster(source, 'ACbf', 2.00)
call SetUnitPosition(caster, GetUnitX(source)+120, GetUnitY(source))
call IssuePointOrderLoc( caster, "breathoffrost", GetSpellTargetLoc() )
endfunction
function FrostBlast takes unit dummy, unit target returns nothing
local unit source = DummySource(dummy)
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(source)
call Damage( source, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_COLD )
call Frost( source, target )
call RemoveLocation(loc)
set loc = null
endfunction
function BlizzardTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = DummyCaster(source, 'ACbz', 15.00)
call IssuePointOrderLoc( caster, "blizzard", GetSpellTargetLoc() )
endfunction
function Blizzard takes unit dummy, unit target returns nothing
local unit source = DummySource(dummy)
local location loc = GetUnitLoc(target)
local integer damage = R2I(0.25*UnitProcDamage(source))
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( source, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_COLD )
call Frost( source, target )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function BallLightningUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(hero)
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( hero, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_LIGHTNING )
set fx = AddSpecialEffectLoc( "war3mapImported\\Static.mdx", loc )
call PlaySoundAtPointBJ( gg_snd_PurgeTarget1, 100, loc, 0 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function BallLightningTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A01Y' )
call IssuePointOrderLoc( caster, "carrionswarm", GetSpellTargetLoc() )
call TriggerSleepAction( 10.00 )
call RemoveUnit( caster )
endfunction
function JumpstrikeUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local location loc = GetUnitLoc(target)
local integer damage = 2*UnitProcDamage(hero)
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( hero, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function Jumpstrike takes nothing returns nothing
local unit caster = CreateUnit( GetOwningPlayer(udg_SpellCaster), 'h010', GetUnitX(udg_SpellCaster), GetUnitY(udg_SpellCaster), GetUnitFacing(udg_SpellCaster) )
local effect fx1 = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(udg_SpellCaster), GetUnitY(udg_SpellCaster) )
local effect fx2 = AddSpecialEffect( "war3mapImported\\ShockWind5.mdx", GetUnitX(udg_SpellCaster), GetUnitY(udg_SpellCaster) )
call BlzSetSpecialEffectTimeScale( fx1, 0.3 )
call BlzSetSpecialEffectScale( fx1, 1.50 )
call BlzSetSpecialEffectColor( fx1, 225, 25, 25 )
call BlzSetSpecialEffectHeight( fx1, 90.0 )
call BlzSetSpecialEffectYaw( fx1, Deg2Rad(GetUnitFacing(udg_SpellCaster)) )
call BlzSetSpecialEffectRoll( fx1, Deg2Rad(90.0) )
call BlzSetSpecialEffectScale( fx2, 0.50 )
call BlzSetSpecialEffectHeight( fx2, 10.0 )
call BlzSetSpecialEffectYaw( fx2, Deg2Rad(GetUnitFacing(udg_SpellCaster)) )
call UnitAddAbility( caster, 'Awrh' )
call IssueImmediateOrder( caster, "stomp" )
call TriggerSleepAction( 1.00 )
call RemoveUnit( caster )
call DestroyEffect(fx1)
call DestroyEffect(fx2)
set fx1 = null
set fx2 = null
endfunction
function JumpstrikeTarget takes nothing returns nothing
local unit hero = GetTriggerUnit()
local real angle = AngleBetweenUnitTarget(hero, GetSpellTargetLoc())
local real distance = DistanceBetweenUnitTarget(hero, GetSpellTargetLoc())
local real range = 800
local effect fx1 = AddSpecialEffect( "war3mapImported\\ShockWind3.mdx", GetUnitX(hero), GetUnitY(hero) )
local effect fx2
call BlzSetSpecialEffectHeight( fx1, 120.0 )
call BlzSetSpecialEffectScale( fx1, 0.25 )
call SetUnitVelocity( hero, distance/2*CosBJ(angle), distance/2*SinBJ(angle), 1000 )
call SaveTriggerHandle(udg_UnitPhysics, GetHandleId(GetTriggerUnit()), StringHash("callback"), gg_trg_Jumpstrike_Land)
call TriggerSleepAction(1.0)
call SetUnitVelocity( hero, distance*CosBJ(angle), distance*SinBJ(angle), -1000 )
set fx2 = AddSpecialEffect( "war3mapImported\\ShockWind3.mdx", GetUnitX(hero), GetUnitY(hero) )
call BlzSetSpecialEffectScale( fx2, 0.5 )
call BlzSetSpecialEffectHeight( fx2, GetUnitFlyHeight(hero) )
call BlzSetSpecialEffectYaw( fx2, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectPitch( fx2, Deg2Rad(45*(1-distance/range) - 45) )
call TriggerSleepAction(2.0)
call DestroyEffect(fx1)
call DestroyEffect(fx2)
set fx1 = null
set fx2 = null
endfunction
function WallOfThorns takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real armor = BlzGetUnitArmor( source )
local unit wall = CreateUnit( GetOwningPlayer(source), 'h015', GetUnitX(target), GetUnitY(target), GetUnitFacing(target) )
call UnitApplyTimedLife( wall, 'BTLF', 10.00 )
call BlzSetUnitArmor( wall, armor )
endfunction
function DoubleStrike takes unit source, unit target returns nothing
if (UnitHasBuffBJ(source, 'Bbsk')) then
call UnitRemoveAbility( source, 'Bbsk' )
else
call SetUnitUserData( source, 0 )
call IssueImmediateOrder( source, "berserk" )
call IssueTargetOrder( source, "attack", target )
endif
endfunction
function EternalChaos takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'AUls' )
call IssueImmediateOrder( caster, "locustswarm" )
call TriggerSleepAction( 20.00 )
call RemoveUnit( caster )
endfunction
function ChargeUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local integer damage = R2I(1.25 * UnitProcDamage(udg_SpellCaster))
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(udg_SpellCaster))) then
call Damage( udg_SpellCaster, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfunction
function ChargeTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local real angle = AngleBetweenUnitTarget(source, GetSpellTargetLoc())
local real distance = DistanceBetweenUnitTarget(source, GetSpellTargetLoc())
local effect fx = AddSpecialEffectLoc( "war3mapImported\\ShockWind4.mdx", PolarProjectionBJ(GetUnitLoc(source), 0, GetUnitFacing(source)) )
call SetUnitAnimation( source, "walk 1" )
call BlzSetSpecialEffectScale( fx, 0.25 )
call BlzSetSpecialEffectHeight( fx, 90 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(source) - 180) )
call SetUnitVelocity( source, 5*distance/2*CosBJ(angle), 5*distance/2*SinBJ(angle), 200 )
call SaveTriggerHandle(udg_UnitPhysics, GetHandleId(source), StringHash("callback"), gg_trg_Charge_Land)
call TriggerSleepAction( 1.50 )
call DestroyEffect(fx)
call ResetUnitAnimation( source )
set fx = null
endfunction
function ChargeLand takes nothing returns nothing
local location loc = GetUnitLoc(udg_SpellCaster)
call ForGroup(GetUnitsInRangeOfLocAll(100, loc), function ChargeUnit)
call RemoveLocation(loc)
call TriggerSleepAction( 1.50 )
set loc = null
endfunction
function SkullSpiritUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local location loc = GetUnitLoc(u)
local integer damage = UnitProcDamage(udg_SpellCaster)
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(udg_SpellCaster))) then
call Damage( udg_SpellCaster, u, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DEATH )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function SkullSpirit takes nothing returns nothing
local unit source = GetTriggerUnit()
local integer damage = UnitProcDamage(source)
local location loc = GetSpellTargetLoc()
local unit launcher = CreateUnit( GetOwningPlayer(source), 'h019', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local effect fx
call IssuePointOrderLocBJ( launcher, "attackground", loc )
call TriggerSleepAction( DistanceBetweenUnitTarget(source, loc) / 600.0 - 0.1)
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(100, loc), function SkullSpiritUnit)
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", loc )
call BlzSetSpecialEffectScale( fx, 1.50 )
call DestroyEffect(fx)
call TriggerSleepAction( 1.00 )
call RemoveUnit( launcher )
call RemoveLocation(loc)
set fx = null
set loc = null
endfunction
function BloodStrikeUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = UnitProcDamage(hero)
local effect fx
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero))) then
call Damage( hero, u, damage , ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call SetUnitLifeBJ( hero, GetUnitStateSwap(UNIT_STATE_LIFE, hero) + 1.5 )
set fx = AddSpecialEffectLoc( "Objects\\Spawnmodels\\Orc\\Orcblood\\OrdBloodWyvernRider.mdl", loc )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function BloodStrike takes nothing returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffect( "war3mapImported\\Reapers Claws Red.mdx", GetUnitX(hero) - 15, GetUnitY(hero) )
local effect fx2
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero) + 90) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(0.00) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(30.0) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+120)
call BlzSetSpecialEffectScale( fx, 0.80 )
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function BloodStrikeUnit)
call TriggerSleepAction( 0.15 )
set fx2 = AddSpecialEffect( "war3mapImported\\Reapers Claws Red.mdx", GetUnitX(hero) - 15, GetUnitY(hero) )
call BlzSetSpecialEffectYaw( fx2, Deg2Rad(GetUnitFacing(hero) - 90) )
call BlzSetSpecialEffectRoll( fx2, Deg2Rad(180.00) )
call BlzSetSpecialEffectPitch( fx2, Deg2Rad(30.0) )
call BlzSetSpecialEffectHeight(fx2, GetUnitFlyHeight(hero)+120)
call BlzSetSpecialEffectScale( fx2, 0.80 )
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function BloodStrikeUnit)
call TriggerSleepAction( 1.00 )
call DestroyEffect(fx)
call DestroyEffect(fx2)
call RemoveLocation(loc)
set loc = null
set fx = null
set fx2 = null
endfunction
function AerobladeUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = 2 * UnitProcDamage(hero)
local effect fx
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero)) and IsUnitInSightOfUnit(hero, u, 112.5)) then
call Damage( hero, u, damage , ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FORCE )
set fx = AddSpecialEffectLoc( "Abilities\\Weapons\\BallistaMissile\\BallistaMissileTarget.mdl", loc )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Aeroblade takes nothing returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffect( "war3mapImported\\Culling Cleave Silver.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
local effect fx2
local effect fx3
call BlzSetSpecialEffectColor( fx, 200, 200, 200 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(0.00) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(0.0) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+120)
call BlzSetSpecialEffectScale( fx, 1.30 )
call BlzSetSpecialEffectTimeScale( fx, 0.50 )
set fx2 = AddSpecialEffect( "war3mapImported\\Culling Cleave Silver.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
call BlzSetSpecialEffectColor( fx2, 220, 220, 220 )
call BlzSetSpecialEffectYaw( fx2, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx2, Deg2Rad(165.00) )
call BlzSetSpecialEffectPitch( fx2, Deg2Rad(0.0) )
call BlzSetSpecialEffectHeight(fx2, GetUnitFlyHeight(hero)+180)
call BlzSetSpecialEffectScale( fx2, 1.10 )
call BlzSetSpecialEffectTimeScale( fx, 0.90 )
set fx3 = AddSpecialEffect( "war3mapImported\\Culling Cleave Silver.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
call BlzSetSpecialEffectColor( fx3, 220, 220, 220 )
call BlzSetSpecialEffectYaw( fx3, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx3, Deg2Rad(15.00) )
call BlzSetSpecialEffectPitch( fx3, Deg2Rad(0.0) )
call BlzSetSpecialEffectHeight(fx3, GetUnitFlyHeight(hero)+100)
call BlzSetSpecialEffectScale( fx3, 1.10 )
call BlzSetSpecialEffectTimeScale( fx, 0.90 )
call ForGroup(GetUnitsInRangeOfLocAll(250, loc), function AerobladeUnit)
call TriggerSleepAction( 2.00 )
call DestroyEffect(fx)
call DestroyEffect(fx2)
call DestroyEffect(fx3)
call RemoveLocation(loc)
set loc = null
set fx = null
set fx2 = null
set fx3 = null
endfunction
function SlashUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = UnitProcDamage(hero)
local effect fx
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero)) and IsUnitInSightOfUnit(hero, u, 122.5)) then
call Damage( hero, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set fx = AddSpecialEffectLoc( "war3mapImported\\Ephemeral Cut Silver.mdx", loc )
call BlzSetSpecialEffectColor( fx, 255, 225, 100 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Slash takes nothing returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
//call BlzSetSpecialEffectRoll( fx, Deg2Rad(-90.00) )
//call BlzSetSpecialEffectPitch( fx, Deg2Rad(0.0) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+120)
call BlzSetSpecialEffectScale( fx, 1.00 )
call BlzSetSpecialEffectColor( fx, 255, 225, 100 )
//call BlzSetSpecialEffectAlpha( fx, 200 )
//call BlzSetSpecialEffectTimeScale( fx, 1.50 )
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function SlashUnit)
call TriggerSleepAction( 2.00 )
call DestroyEffect(fx)
set fx = null
set loc = null
endfunction
function UppercutUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = R2I(1.25 * UnitProcDamage(hero))
local effect fx
local unit source = GetTriggerUnit()
local real angle = AngleBetweenUnits(hero, u)
local real distance = 25
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero)) and IsUnitInSightOfUnit(hero, u, 82.5)) then
call Damage( hero, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call SetUnitVelocity( u, distance*CosBJ(angle), distance*SinBJ(angle), 650 )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl", loc )
call BlzSetSpecialEffectScale( fx, 0.50 )
call BlzSetSpecialEffectHeight(fx, 100)
call BlzSetSpecialEffectColor( fx, 155, 165, 185 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Uppercut takes nothing returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(-90.00) )
//call BlzSetSpecialEffectPitch( fx, Deg2Rad(0.0) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+160)
call BlzSetSpecialEffectScale( fx, 0.85 )
call BlzSetSpecialEffectColor( fx, 155, 165, 185 )
//call BlzSetSpecialEffectAlpha( fx, 200 )
//call BlzSetSpecialEffectTimeScale( fx, 1.50 )
call ForGroup(GetUnitsInRangeOfLocAll(150, loc), function UppercutUnit)
call TriggerSleepAction( 2.00 )
call DestroyEffect(fx)
set fx = null
set loc = null
endfunction
function AirstrikesUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = R2I(0.75 * UnitProcDamage(hero))
local effect fx
local unit source = GetTriggerUnit()
local real angle = AngleBetweenUnits(hero, u)
local real distance = 25
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero)) and IsUnitInSightOfUnit(hero, u, 122.5)) then
call Damage( hero, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call SetUnitVelocity( u, distance*CosBJ(angle), distance*SinBJ(angle), 450 )
set fx = AddSpecialEffectLoc( "war3mapImported\\Ephemeral Cut Silver.mdx", loc )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(u)+100)
call BlzSetSpecialEffectColor( fx, 155, 165, 185 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Airstrikes takes nothing returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
local real angle = GetUnitFacing(hero)
local real distance = 25
call SetUnitVelocity( hero, distance*CosBJ(angle), distance*SinBJ(angle), 800 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(-75.00) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+160)
call BlzSetSpecialEffectScale( fx, 1.15 )
call BlzSetSpecialEffectColor( fx, 205, 205, 205 )
//call BlzSetSpecialEffectPitch( fx, Deg2Rad(0.0) )
//call BlzSetSpecialEffectAlpha( fx, 200 )
//call BlzSetSpecialEffectTimeScale( fx, 1.50 )
call ForGroup(GetUnitsInRangeOfLocAll(175, loc), function AirstrikesUnit)
call TriggerSleepAction( 0.20 )
call SetUnitAnimation( hero, "attack" )
call DestroyEffect(fx)
set fx = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(-105.00) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+160)
call BlzSetSpecialEffectScale( fx, 1.15 )
call BlzSetSpecialEffectColor( fx, 205, 205, 205 )
call ForGroup(GetUnitsInRangeOfLocAll(175, loc), function AirstrikesUnit)
call TriggerSleepAction( 0.20 )
call SetUnitAnimation( hero, "attack" )
call DestroyEffect(fx)
set fx = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(-75.00) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+160)
call BlzSetSpecialEffectScale( fx, 1.15 )
call BlzSetSpecialEffectColor( fx, 205, 205, 205 )
call ForGroup(GetUnitsInRangeOfLocAll(175, loc), function AirstrikesUnit)
call TriggerSleepAction( 1.00 )
call ResetUnitAnimation( hero )
call DestroyEffect(fx)
set fx = null
set loc = null
endfunction
function DownwardStrikeUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = UnitProcDamage(hero)
local effect fx
local real z = GetUnitFlyHeight(u)
local unit source = GetTriggerUnit()
local real angle = AngleBetweenUnits(hero, u)
local real distance = 250
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero)) and IsUnitInSightOfUnit(hero, u, 82.5)) then
if z > 10 then
set damage = R2I(2.5*damage)
call Damage( hero, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ENHANCED )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl", loc )
call BlzSetSpecialEffectScale( fx, 0.75 )
call BlzSetSpecialEffectHeight(fx, z)
else
set damage = R2I(1.5*damage)
call Damage( hero, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set fx = AddSpecialEffectLoc( "war3mapImported\\Ephemeral Cut Silver.mdx", loc )
endif
call SetUnitVelocity( u, distance*CosBJ(angle), distance*SinBJ(angle), -300 )
call BlzSetSpecialEffectColor( fx, 155, 205, 185 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function DownwardStrike takes nothing returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(hero) - 12, GetUnitY(hero) )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(90.00) )
//call BlzSetSpecialEffectPitch( fx, Deg2Rad(0.0) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+160)
call BlzSetSpecialEffectScale( fx, 1.50 )
call BlzSetSpecialEffectColor( fx, 155, 205, 185 )
//call BlzSetSpecialEffectAlpha( fx, 200 )
call BlzSetSpecialEffectTimeScale( fx, 0.75 )
call ForGroup(GetUnitsInRangeOfLocAll(175, loc), function DownwardStrikeUnit)
call TriggerSleepAction( 2.00 )
call DestroyEffect(fx)
set fx = null
set loc = null
endfunction
function Dodge takes nothing returns nothing
local unit hero = GetTriggerUnit()
call UnitAddAbility( hero, 'A02B' )
call TriggerSleepAction( 1.00 )
call UnitRemoveAbility( hero, 'A02B' )
endfunction
function PierceUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = R2I(1.25*UnitProcDamage(hero))
local effect fx
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero))) then
call Damage( hero, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set fx = AddSpecialEffectLoc( "war3mapImported\\Ephemeral Cut Silver.mdx", loc )
call BlzSetSpecialEffectColor( fx, 255, 150, 25 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Pierce takes nothing returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffectLoc( "war3mapImported\\Piercing Thrust.mdx", PolarProjectionBJ(loc, 50, GetUnitFacing(hero)) )
local group g
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(hero)) )
call BlzSetSpecialEffectHeight(fx, GetUnitFlyHeight(hero)+120)
call BlzSetSpecialEffectScale( fx, 0.80 )
set g = GetUnitsInRangeOfLocAll(150, PolarProjectionBJ(loc, 100, GetUnitFacing(hero)))
call GroupAddGroup(GetUnitsInRangeOfLocAll(150, PolarProjectionBJ(loc, 300, GetUnitFacing(hero))), g)
call ForGroup(g, function PierceUnit)
call TriggerSleepAction( 1.00 )
call DestroyEffect(fx)
call DestroyGroup(g)
set g = null
set fx = null
set loc = null
endfunction
function PowershotUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(hero)
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
call Damage( hero, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function PowershotTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local effect fx = AddSpecialEffectLoc( "war3mapImported\\ShockWind4.mdx", PolarProjectionBJ(GetUnitLoc(source), 75, GetUnitFacing(source)) )
call BlzSetSpecialEffectScale( fx, 0.25 )
call BlzSetSpecialEffectHeight( fx, 50 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(source) - 180) )
call UnitAddAbility( caster, 'AUcs' )
call IssuePointOrderLoc( caster, "carrionswarm", GetSpellTargetLoc() )
call TriggerSleepAction( 10.00 )
call RemoveUnit( caster )
call DestroyEffect(fx)
set fx = null
endfunction
function ArcaneTorrentUnit takes nothing returns nothing
local unit target = GetEnumUnit()
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(udg_SpellCaster))]
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(hero) / 2
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", loc )
call BlzSetSpecialEffectScale( fx, 0.50 )
call Damage( hero, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function ArcaneTorrentTarget takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A00G' )
call IssuePointOrderLoc( caster, "clusterrockets", loc )
call TriggerSleepAction( DistanceBetweenUnitTarget(source, loc) / 900.0 + 0.25 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function ArcaneTorrentUnit)
call TriggerSleepAction( 0.25 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function ArcaneTorrentUnit)
call TriggerSleepAction( 0.25 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function ArcaneTorrentUnit)
call TriggerSleepAction( 5.00 )
call RemoveUnit( caster )
call RemoveLocation(loc)
set loc = null
endfunction
function ArrowStormUnit takes nothing returns nothing
local unit target = GetEnumUnit()
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(udg_SpellCaster))]
local integer damage = UnitProcDamage(hero) / 2
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
call Damage( hero, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfunction
function ArrowStormTarget takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A03A' )
call IssuePointOrderLoc( caster, "clusterrockets", loc )
call TriggerSleepAction( DistanceBetweenUnitTarget(source, loc) / 900.0 + 0.25 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function ArrowStormUnit)
call TriggerSleepAction( 0.25 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function ArrowStormUnit)
call TriggerSleepAction( 0.25 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(200, loc), function ArrowStormUnit)
call TriggerSleepAction( 5.00 )
call RemoveUnit( caster )
call RemoveLocation(loc)
set loc = null
endfunction
function ArcaneOrbUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local location loc = GetUnitLoc(target)
local integer damage = 2*UnitProcDamage(hero)
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
call Damage( hero, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", loc )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function ArcaneOrbTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A01T' )
call IssuePointOrderLoc( caster, "carrionswarm", GetSpellTargetLoc() )
call TriggerSleepAction( 10.00 )
call RemoveUnit( caster )
endfunction
function BladewaveUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local integer damage = 2*UnitProcDamage(hero)
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
call Damage( hero, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfunction
function BladewaveTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local effect fx = AddSpecialEffect( "war3mapImported\\Slash.mdx", GetUnitX(source) - 12, GetUnitY(source) )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(GetUnitFacing(source)) )
call BlzSetSpecialEffectRoll( fx, Deg2Rad(90.00) )
//call BlzSetSpecialEffectPitch( fx, Deg2Rad(0.0) )
call BlzSetSpecialEffectHeight(fx, 160)
call BlzSetSpecialEffectScale( fx, 2.50 )
call BlzSetSpecialEffectColor( fx, 255, 205, 115 )
//call BlzSetSpecialEffectAlpha( fx, 200 )
call BlzSetSpecialEffectTimeScale( fx, 0.75 )
call UnitAddAbility( caster, 'ACsh' )
call IssuePointOrderLoc( caster, "shockwave", GetSpellTargetLoc() )
call TriggerSleepAction( 10.00 )
call DestroyEffect(fx)
call RemoveUnit( caster )
set fx = null
endfunction
function DisintegrateUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local unit target = GetEnumUnit()
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(source) / 2
local effect fx
local boolean water = not IsTerrainPathableBJ(loc, PATHING_TYPE_FLOATABILITY)
local boolean snow = GetTerrainTypeBJ(loc) == 'cWc1'
if water or snow then
set damage = R2I(0.75 * damage)
endif
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( source, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_FIRE )
set fx = AddSpecialEffect( "Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl", GetUnitX(target), GetUnitY(target) )
call BlzSetSpecialEffectHeight( fx, 50.0 )
call BlzSetSpecialEffectScale( fx, 0.80 )
call TriggerSleepAction(1.00)
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function DisintegrateTick takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local group g
if (mana < 1) then
call IssueImmediateOrder( source, "stop" )
endif
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("fingerofdeath")) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
set g = GetUnitsInRangeOfLocAll(75, PolarProjectionBJ(GetUnitLoc(source), 75, facing))
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 100, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 250, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 400, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 550, facing)), g)
call ForGroup(g, function DisintegrateUnit)
call SetUnitState(source, UNIT_STATE_MANA, mana - 1)
endif
call DestroyGroup(g)
set g = null
set cursor = null
endfunction
function DisintegrateFX takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 620, facing), 0, facing + 135)
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local effect fx
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("fingerofdeath") or mana < 1) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
call SetUnitFacing(source, facing)
set fx = AddSpecialEffectLoc( "war3mapImported\\Disintegrate.mdx", beam )
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.4 + GetRandomReal(0, 0.1) )
call BlzSetSpecialEffectHeight( fx, 65.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
endif
call DestroyEffect(fx)
call RemoveLocation(beam)
set beam = null
set fx = null
set cursor = null
endfunction
function DisintegrateTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local timer t = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"))
local timer tfx = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"))
local real facing = AngleBetweenUnitTarget( source, GetSpellTargetLoc() )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 620, facing), 0, facing + 135)
local effect fx = AddSpecialEffectLoc( "war3mapImported\\Disintegrate.mdx", beam )
if t != null then
call PauseTimer(tfx)
call DestroyTimer(tfx)
call RemoveLocation(LoadLocationHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("beam")))
call FlushChildHashtable(udg_SpellTimers, GetHandleId(tfx))
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
endif
set t = CreateTimer()
set tfx = CreateTimer()
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.45 )
call BlzSetSpecialEffectHeight( fx, 65.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"), source)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("source"), source)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"), t)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"), tfx)
call TimerStart(t, 0.5, true, function DisintegrateTick)
call TimerStart(tfx, 0.05, true, function DisintegrateFX)
call RemoveLocation(beam)
call DestroyEffect(fx)
set beam = null
set fx = null
endfunction
function GeostrikeUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local integer damage = R2I(1 * UnitProcDamage(GetTriggerUnit()))
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(GetTriggerUnit()))) then
call Damage( GetTriggerUnit(), u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DEMOLITION )
endif
endfunction
function GeostrikeTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local unit caster = DummyCaster(source, 'AHtc', 5.00)
local effect fx = AddSpecialEffectLoc( "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl", loc )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(135.0) )
call BlzSetSpecialEffectScale( fx, 1.75 )
call SetUnitPosition(caster, GetLocationX(loc), GetLocationY(loc))
call IssueImmediateOrder( caster, "thunderclap" )
call ForGroup(GetUnitsInRangeOfLocAll(175, loc), function GeostrikeUnit)
call DestroyEffect(fx)
call TriggerSleepAction( .50 )
call ForGroup(GetUnitsInRangeOfLocAll(175, loc), function GeostrikeUnit)
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl", loc )
call BlzSetSpecialEffectScale( fx, 1.25 )
call DestroyEffect(fx)
call TriggerSleepAction( 0.25 )
call ForGroup(GetUnitsInRangeOfLocAll(175, loc), function GeostrikeUnit)
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl", loc )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(225.0) )
call DestroyEffect(fx)
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function EarthquakeUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local integer damage = R2I(1 * UnitProcDamage(GetTriggerUnit()))
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(GetTriggerUnit()))) then
call Damage( GetTriggerUnit(), u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DEMOLITION )
endif
endfunction
function EarthquakeTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local unit caster = DummyCaster(source, 'AHtc', 5.00)
local effect fx = AddSpecialEffectLoc( "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl", loc )
//call BlzSetSpecialEffectScale( fx, 1.75 )
call SetUnitPosition(caster, GetLocationX(loc), GetLocationY(loc))
call IssueImmediateOrder( caster, "thunderclap" )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function GeostrikeUnit)
call TriggerSleepAction( 1.0 )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
set caster = DummyCaster(source, 'AHtc', 5.00)
call SetUnitPosition(caster, GetLocationX(loc), GetLocationY(loc))
call IssueImmediateOrder( caster, "thunderclap" )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
set caster = DummyCaster(source, 'AHtc', 5.00)
call SetUnitPosition(caster, GetLocationX(loc), GetLocationY(loc))
call IssueImmediateOrder( caster, "thunderclap" )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call TriggerSleepAction( 1.0 )
call ForGroup(GetUnitsInRangeOfLocAll(325, loc), function EarthquakeUnit)
call RemoveLocation(loc)
call DestroyEffect(fx)
set loc = null
set fx = null
endfunction
function FrostRayUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local unit target = GetEnumUnit()
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(source) / 2
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( source, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_COLD )
set fx = AddSpecialEffect( "Abilities\\Spells\\Items\\AIob\\AIobSpecialArt.mdl", GetUnitX(target), GetUnitY(target) )
call BlzSetSpecialEffectHeight( fx, 100.0 )
call BlzSetSpecialEffectScale( fx, 0.80 )
call Frost( source, target )
call TriggerSleepAction(1.00)
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function FrostRayTick takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local group g
if (mana < 1) then
call IssueImmediateOrder( source, "stop" )
endif
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("manaburn")) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
set g = GetUnitsInRangeOfLocAll(75, PolarProjectionBJ(GetUnitLoc(source), 75, facing))
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 100, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 250, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 400, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 550, facing)), g)
call ForGroup(g, function FrostRayUnit)
call SetUnitState(source, UNIT_STATE_MANA, mana - 1)
endif
call DestroyGroup(g)
set g = null
set cursor = null
endfunction
function FrostRayFX takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 620, facing), 0, facing + 135)
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local effect fx
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("manaburn") or mana < 1) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
call SetUnitFacing(source, facing)
set fx = AddSpecialEffectLoc( "war3mapImported\\FrostRay.mdx", beam )
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.4 + GetRandomReal(0, 0.1) )
call BlzSetSpecialEffectHeight( fx, 65.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
endif
call RemoveLocation(beam)
call DestroyEffect(fx)
set beam = null
set fx = null
set cursor = null
endfunction
function FrostRayTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local timer t = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"))
local timer tfx = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"))
local real facing = AngleBetweenUnitTarget( source, GetSpellTargetLoc() )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 635, facing), 0, facing + 135)
local effect fx = AddSpecialEffectLoc( "war3mapImported\\FrostRay.mdx", beam )
if t != null then
call PauseTimer(tfx)
call DestroyTimer(tfx)
call RemoveLocation(LoadLocationHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("beam")))
call FlushChildHashtable(udg_SpellTimers, GetHandleId(tfx))
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
endif
set t = CreateTimer()
set tfx = CreateTimer()
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.45 )
call BlzSetSpecialEffectHeight( fx, 65.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"), source)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("source"), source)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"), t)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"), tfx)
call TimerStart(t, 0.6, true, function FrostRayTick)
call TimerStart(tfx, 0.05, true, function FrostRayFX)
call RemoveLocation(beam)
call DestroyEffect(fx)
set beam = null
set fx = null
endfunction
function ChaosRayUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local unit target = GetEnumUnit()
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(source)
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( source, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DEATH )
set fx = AddSpecialEffect( "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl", GetUnitX(target), GetUnitY(target) )
call BlzSetSpecialEffectHeight( fx, 50.0 )
call BlzSetSpecialEffectScale( fx, 0.80 )
call TriggerSleepAction(1.00)
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function ChaosRayTick takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local group g
if (mana < 1) then
call IssueImmediateOrder( source, "stop" )
endif
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("metamorphosis")) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
set g = GetUnitsInRangeOfLocAll(75, PolarProjectionBJ(GetUnitLoc(source), 75, facing))
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 100, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 250, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 400, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 550, facing)), g)
call ForGroup(g, function ChaosRayUnit)
call SetUnitState(source, UNIT_STATE_MANA, mana - 2.2)
endif
call DestroyGroup(g)
set g = null
set cursor = null
endfunction
function ChaosRayFX takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 620, facing), 0, facing + 135)
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local effect fx
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("metamorphosis") or mana < 1) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
call SetUnitFacing(source, facing)
set fx = AddSpecialEffectLoc( "war3mapImported\\ChaosRay.mdx", beam )
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.4 + GetRandomReal(0, 0.1) )
call BlzSetSpecialEffectHeight( fx, 85.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
endif
call RemoveLocation(beam)
call DestroyEffect(fx)
set beam = null
set fx = null
set cursor = null
endfunction
function ChaosRayTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local timer t = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"))
local timer tfx = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"))
local real facing = AngleBetweenUnitTarget( source, GetSpellTargetLoc() )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 620, facing), 0, facing + 135)
local effect fx = AddSpecialEffectLoc( "war3mapImported\\ChaosRay.mdx", beam )
if t != null then
call PauseTimer(tfx)
call DestroyTimer(tfx)
call RemoveLocation(LoadLocationHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("beam")))
call FlushChildHashtable(udg_SpellTimers, GetHandleId(tfx))
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
endif
set t = CreateTimer()
set tfx = CreateTimer()
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.45 )
call BlzSetSpecialEffectHeight( fx, 85.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"), source)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("source"), source)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"), t)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"), tfx)
call TimerStart(t, 0.5, true, function ChaosRayTick)
call TimerStart(tfx, 0.05, true, function ChaosRayFX)
call RemoveLocation(beam)
call DestroyEffect(fx)
set beam = null
set fx = null
endfunction
function VoidRayUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local unit target = GetEnumUnit()
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(source)
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( source, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
set fx = AddSpecialEffect( "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", GetUnitX(target), GetUnitY(target) )
call BlzSetSpecialEffectHeight( fx, 50.0 )
call BlzSetSpecialEffectScale( fx, 0.70 )
call TriggerSleepAction(1.00)
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function VoidRayTick takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local group g
if (mana < 1) then
call IssueImmediateOrder( source, "stop" )
endif
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("vengeance")) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
set g = GetUnitsInRangeOfLocAll(75, PolarProjectionBJ(GetUnitLoc(source), 75, facing))
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 100, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 250, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 400, facing)), g)
call GroupAddGroup(GetUnitsInRangeOfLocAll(100, PolarProjectionBJ(GetUnitLoc(source), 550, facing)), g)
call ForGroup(g, function VoidRayUnit)
call SetUnitState(source, UNIT_STATE_MANA, mana - 2.2)
endif
call DestroyGroup(g)
set g = null
set cursor = null
endfunction
function VoidRayFX takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local location cursor = udg_Cursors[GetConvertedPlayerId(GetOwningPlayer(source))]
local real facing = AngleBetweenUnitTarget( source, cursor )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 620, facing), 0, facing + 135)
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local effect fx
if (GetUnitCurrentOrder(source) != String2OrderIdBJ("vengeance") or mana < 1) then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
else
call SetUnitFacing(source, facing)
set fx = AddSpecialEffectLoc( "war3mapImported\\Void Ray.mdx", beam )
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.4 + GetRandomReal(0, 0.1) )
call BlzSetSpecialEffectHeight( fx, 85.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
endif
call RemoveLocation(beam)
call DestroyEffect(fx)
set beam = null
set fx = null
set cursor = null
endfunction
function VoidRayTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local timer t = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"))
local timer tfx = LoadTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"))
local real facing = AngleBetweenUnitTarget( source, GetSpellTargetLoc() )
local location beam = PolarProjectionBJ(PolarProjectionBJ(GetUnitLoc(source), 650, facing), 0, facing + 135)
local effect fx = AddSpecialEffectLoc( "war3mapImported\\Void Ray.mdx", beam )
if t != null then
call PauseTimer(tfx)
call DestroyTimer(tfx)
call RemoveLocation(LoadLocationHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("beam")))
call FlushChildHashtable(udg_SpellTimers, GetHandleId(tfx))
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
endif
set t = CreateTimer()
set tfx = CreateTimer()
call BlzSetSpecialEffectTimeScale( fx, 2.0 )
call BlzSetSpecialEffectScale( fx, 0.45 )
call BlzSetSpecialEffectHeight( fx, 85.0 )
call BlzSetSpecialEffectYaw( fx, Deg2Rad(facing - 8) )
call BlzSetSpecialEffectPitch( fx, Deg2Rad(263.0) )
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"), source)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(tfx), StringHash("source"), source)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("t"), t)
call SaveTimerHandle(udg_SpellTimers, GetHandleId(source), StringHash("tfx"), tfx)
call TimerStart(t, 0.5, true, function VoidRayTick)
call TimerStart(tfx, 0.05, true, function VoidRayFX)
call RemoveLocation(beam)
call DestroyEffect(fx)
set beam = null
set fx = null
endfunction
function SingularityUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local location loc = GetUnitLoc(target)
local integer damage = 3*UnitProcDamage(hero)
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
call Damage( hero, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", loc )
call BlzSetSpecialEffectScale( fx, 0.50 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function SingularityTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A023' )
call IssuePointOrderLoc( caster, "carrionswarm", GetSpellTargetLoc() )
call TriggerSleepAction( 10.00 )
call RemoveUnit( caster )
endfunction
function ChainLightningUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local location loc = GetUnitLoc(target)
local integer damage = 1*UnitProcDamage(hero)
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
call Damage( hero, target, damage, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_LIGHTNING )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function ChainLightningTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'ACcl' )
call IssueTargetOrder( caster, "chainlightning", GetSpellTargetUnit() )
call TriggerSleepAction( 10.00 )
call RemoveUnit( caster )
endfunction
function HydroUnit takes unit source, unit target returns nothing
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(source))]
local location loc = GetUnitLoc(target)
local integer damage = UnitProcDamage(hero)
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(hero))) then
call Damage( hero, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FORCE )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl", loc )
call BlzSetSpecialEffectScale( fx, 1.50 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function HydroTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = CreateUnit( GetOwningPlayer(source), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A00I' )
call IssueTargetOrder( caster, "chainlightning", GetSpellTargetUnit() )
call TriggerSleepAction( 10.00 )
call RemoveUnit( caster )
endfunction
function TidalwaveUnit takes unit dummy, unit target returns nothing
local unit source = DummySource(dummy)
local location loc = GetUnitLoc(target)
local integer damage = R2I(1.0*UnitProcDamage(source))
local effect fx
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( source, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FORCE )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl", loc )
call BlzSetSpecialEffectScale( fx, 1.50 )
call DestroyEffect(fx)
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function TidalwaveTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit caster = DummyCaster(source, 'ACcv', 15.00)
call IssuePointOrderLoc( caster, "carrionswarm", GetSpellTargetLoc() )
endfunction
function TeslaCoil takes nothing returns nothing
local unit coil = GetTriggerUnit()
local unit hero = udg_MapHero[GetConvertedPlayerId(GetOwningPlayer(coil))]
call BlzSetUnitBaseDamage( coil, BlzGetUnitBaseDamage(hero, 0), 0 )
call BlzSetUnitDiceSides( coil, BlzGetUnitDiceSides(hero, 0), 0 )
call BlzSetUnitArmor( coil, BlzGetUnitArmor(hero) )
endfunction
function MagicArrowTick takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local unit arrow = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("arrow"))
local group g = GetUnitsInRangeOfLocAll(100, GetUnitLoc(arrow))
local integer damage = UnitProcDamage(source)
local unit u
local location loc
local effect fx
loop
set u = FirstOfGroup(g)
exitwhen u == null
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(source))) then
set loc = GetUnitLoc(u)
call Damage( source, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
set fx = AddSpecialEffect( "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl", GetUnitX(u), GetUnitY(u) )
call BlzSetSpecialEffectScale( fx, 0.60 )
call BlzSetSpecialEffectHeight( fx, 100 )
call RemoveLocation(loc)
call DestroyEffect(fx)
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set loc = null
set fx = null
set t = null
set g = null
endfunction
function MagicArrowSeek takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit arrow = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("arrow"))
local unit source = LoadUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"))
local group g = GetUnitsInRangeOfLocAll(800, GetUnitLoc(arrow))
local unit u
local location loc
local integer targets = 0
loop
set u = FirstOfGroup(g)
exitwhen u == null
if (IsAlive(u) and IsEvil(u)) then
set targets = targets + 1
set loc = GetUnitLoc(u)
call IssuePointOrderLocBJ( arrow, "patrol", PolarProjectionBJ(loc, 75, AngleBetweenUnits(arrow,u)) )
call RemoveLocation(loc)
endif
call GroupRemoveUnit(g,u)
endloop
if targets == 0 then
call IssuePointOrderLocBJ( arrow, "patrol", GetUnitLoc(source) )
endif
call DestroyGroup(g)
set loc = null
set t = null
set g = null
endfunction
function MagicArrow takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit arrow = CreateUnit( GetOwningPlayer(source), 'u001', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local timer t = CreateTimer()
local timer tai = CreateTimer()
local effect fx
call IssuePointOrderLocBJ( arrow, "patrol", PolarProjectionBJ(GetUnitLoc(source), 800, GetUnitFacing(source)) )
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("source"), source)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(t), StringHash("arrow"), arrow)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(tai), StringHash("source"), source)
call SaveUnitHandle(udg_SpellTimers, GetHandleId(tai), StringHash("arrow"), arrow)
call TimerStart(t, 0.5, true, function MagicArrowTick)
call TimerStart(tai, 2.0, true, function MagicArrowSeek)
call TriggerSleepAction( 20.00 )
call PauseTimer(tai)
call DestroyTimer(tai)
call PauseTimer(t)
call DestroyTimer(t)
call PauseTimer(tai)
call DestroyTimer(tai)
call FlushChildHashtable(udg_SpellTimers, GetHandleId(t))
call FlushChildHashtable(udg_SpellTimers, GetHandleId(tai))
set fx = AddSpecialEffect( "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl", GetUnitX(arrow), GetUnitY(arrow) )
call BlzSetSpecialEffectHeight( fx, 50.0 )
call RemoveUnit( arrow )
call DestroyEffect(fx)
set t = null
set fx = null
endfunction
function OmnislashUnit takes unit u returns nothing
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(u)
local integer damage = UnitProcDamage(hero)
local effect fx
if IsAlive(hero) and IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(hero)) then
call Damage( hero, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set fx = AddSpecialEffectLoc( "war3mapImported\\Ephemeral Cut Silver.mdx", loc )
call BlzSetSpecialEffectColor( fx, 100, 255, 165 )
call BlzSetSpecialEffectAlpha( fx, 60 )
call BlzSetSpecialEffectScale( fx, 2.50 )
call DestroyEffect(fx)
set loc = PolarProjectionBJ(loc, 85, GetRandomReal(0,360))
call SetUnitPositionLoc( hero, loc )
call SetUnitFacing( hero, AngleBetweenUnitTarget( u, loc ) - 180 )
endif
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function OmnislashCondition takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_SpellCaster)) and IsAlive(GetFilterUnit())
endfunction
function Omnislash takes nothing returns nothing
local unit u
local unit hero = GetTriggerUnit()
local location loc = GetUnitLoc(hero)
local effect fx = AddSpecialEffect( "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", GetUnitX(hero), GetUnitY(hero) )
call SetUnitTimeScalePercent( hero, 1000.00 )
call SetUnitAnimation( hero, "attack" )
set udg_SpellCaster = hero
set u = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(512, loc, Condition(function OmnislashCondition)))
if u != null then
call OmnislashUnit(u)
endif
call DestroyEffect(fx)
call RemoveLocation(loc)
call TriggerSleepAction( 0.20 )
set loc = GetUnitLoc(hero)
set fx = AddSpecialEffect( "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", GetUnitX(hero), GetUnitY(hero) )
call SetUnitAnimation( hero, "attack" )
set udg_SpellCaster = hero
set u = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(512, loc, Condition(function OmnislashCondition)))
if u != null then
call OmnislashUnit(u)
endif
call DestroyEffect(fx)
call RemoveLocation(loc)
call TriggerSleepAction( 0.15 )
set loc = GetUnitLoc(hero)
set fx = AddSpecialEffect( "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", GetUnitX(hero), GetUnitY(hero) )
call SetUnitAnimation( hero, "attack" )
set udg_SpellCaster = hero
set u = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(512, loc, Condition(function OmnislashCondition)))
if u != null then
call OmnislashUnit(u)
endif
call DestroyEffect(fx)
call RemoveLocation(loc)
call TriggerSleepAction( 0.10 )
set loc = GetUnitLoc(hero)
set fx = AddSpecialEffect( "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", GetUnitX(hero), GetUnitY(hero) )
call SetUnitAnimation( hero, "attack" )
set udg_SpellCaster = hero
set u = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(512, loc, Condition(function OmnislashCondition)))
if u != null then
call OmnislashUnit(u)
endif
call DestroyEffect(fx)
call RemoveLocation(loc)
call TriggerSleepAction( 0.10 )
set loc = GetUnitLoc(hero)
set fx = AddSpecialEffect( "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", GetUnitX(hero), GetUnitY(hero) )
call SetUnitAnimation( hero, "attack" )
set udg_SpellCaster = hero
set u = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(512, loc, Condition(function OmnislashCondition)))
if u != null then
call OmnislashUnit(u)
endif
call DestroyEffect(fx)
call RemoveLocation(loc)
call TriggerSleepAction( 0.10 )
set loc = GetUnitLoc(hero)
set fx = AddSpecialEffect( "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", GetUnitX(hero), GetUnitY(hero) )
call SetUnitAnimation( hero, "attack" )
set udg_SpellCaster = hero
set u = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(512, loc, Condition(function OmnislashCondition)))
if u != null then
call OmnislashUnit(u)
endif
call DestroyEffect(fx)
call RemoveLocation(loc)
call TriggerSleepAction( 0.10 )
call SetUnitTimeScalePercent( hero, 100.00 )
call ResetUnitAnimation( hero )
set fx = null
set loc = null
endfunction
function ThrownBlade takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer damage = R2I(2*UnitProcDamage(source))
local unit caster = CreateUnit( Player(20), 'h010', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
call UnitAddAbility( caster, 'A02T' )
call IssueTargetOrder( caster , "slow", source )
call TriggerSleepAction( DistanceBetweenUnits(source, target) / 700.0 )
call Damage( source, target, damage-1, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call TriggerSleepAction( 1.00 )
call RemoveUnit( caster )
endfunction
function ArcshotUnit takes nothing returns nothing
local unit u = GetEnumUnit()
local location loc = GetUnitLoc(u)
local integer damage = R2I(1.25*UnitProcDamage(udg_SpellCaster))
if (IsAlive(u) and IsUnitEnemy(u, GetOwningPlayer(udg_SpellCaster))) then
call Damage( udg_SpellCaster, u, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
call RemoveLocation(loc)
set loc = null
endfunction
function ArcshotTarget takes nothing returns nothing
local unit source = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local unit launcher = CreateUnit( GetOwningPlayer(source), 'h01C', GetUnitX(source), GetUnitY(source), GetUnitFacing(source) )
local effect fx
call IssuePointOrderLocBJ( launcher, "attackground", loc )
call TriggerSleepAction( DistanceBetweenUnitTarget(source, loc) / 900.0 )
set udg_SpellCaster = source
call ForGroup(GetUnitsInRangeOfLocAll(75, loc), function ArcshotUnit)
set fx = AddSpecialEffect( "Abilities\\Weapons\\BallistaMissile\\BallistaMissileTarget.mdl", GetLocationX(loc), GetLocationY(loc) )
call TriggerSleepAction( 1.00 )
call DestroyEffect(fx)
call RemoveUnit( launcher )
call RemoveLocation(loc)
set loc = null
set fx = null
endfunction
function Squire takes nothing returns nothing
local unit squire = GetSummonedUnit()
local unit caster = GetSummoningUnit()
local integer base = BlzGetUnitBaseDamage( caster, 0 )
local integer range = BlzGetUnitDiceSides( caster, 0 )
local real armor = BlzGetUnitArmor( caster )
call BlzSetUnitBaseDamage( squire, R2I(base/2), 0 )
call BlzSetUnitDiceSides( squire, R2I(range/2 + 1), 0 )
call BlzSetUnitArmor( squire, armor )
endfunction
function SneakAttack takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer damage = R2I(1.5*UnitProcDamage(source))
local location loc = GetUnitLoc(target)
local effect fx
local effect fx2
set fx = AddSpecialEffect( "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl", GetUnitX(source), GetUnitY(source) )
call BlzSetUnitRealFieldBJ( source, UNIT_RF_TURN_RATE, 10*BlzGetUnitRealField(source, UNIT_RF_TURN_RATE) )
call TriggerSleepAction( 0.10 )
call SetUnitPositionLoc(source, PolarProjectionBJ(loc, -50.0, GetUnitFacing(target)))
call SetUnitFacing(source, GetUnitFacing(target))
if (IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source))) then
call Damage( source, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
set fx2 = AddSpecialEffect( "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl", GetUnitX(source), GetUnitY(source) )
call TriggerSleepAction( 1.00 )
call BlzSetUnitRealFieldBJ( source, UNIT_RF_TURN_RATE, 1*BlzGetUnitRealField(source, UNIT_RF_TURN_RATE) )
call DestroyEffect(fx)
call DestroyEffect(fx2)
call RemoveLocation(loc)
set loc = null
set fx = null
set fx2 = null
endfunction
function Shuriken takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer damage = R2I(0.5*UnitProcDamage(source))
call TriggerSleepAction( DistanceBetweenUnits(source, target) / 1500.0 )
call Damage( source, target, damage-1, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction
function BoneHorror takes nothing returns nothing
local unit minion = GetSummonedUnit()
local unit caster = GetSummoningUnit()
local integer base = BlzGetUnitBaseDamage( caster, 0 )
local integer range = BlzGetUnitDiceSides( caster, 0 )
local real armor = BlzGetUnitArmor( caster )
call BlzSetUnitBaseDamage( minion, R2I(base/2), 0 )
call BlzSetUnitDiceSides( minion, R2I(range/2 + 1), 0 )
call BlzSetUnitArmor( minion, 1.5*armor )
endfunction
function SummonSkeleton takes nothing returns nothing
local unit summon = GetSummonedUnit()
local unit caster = GetSummoningUnit()
local integer base = BlzGetUnitBaseDamage( caster, 0 )
local integer range = BlzGetUnitDiceSides( caster, 0 )
local real armor = BlzGetUnitArmor( caster )
call BlzSetUnitBaseDamage( summon, R2I(0.65*base), 0 )
call BlzSetUnitDiceSides( summon, R2I(0.65*range + 1), 0 )
call BlzSetUnitArmor( summon, armor )
endfunction
function BearForm takes nothing returns nothing
local unit summon = GetSummonedUnit()
local unit caster = GetSummoningUnit()
local location loc = GetUnitLoc(caster)
local integer base = BlzGetUnitBaseDamage( caster, 0 )
local integer range = BlzGetUnitDiceSides( caster, 0 )
local real armor = BlzGetUnitArmor( caster )
local real scaling = BlzGetUnitRealField(summon, UNIT_RF_SCALING_VALUE)
if RectContainsUnit(gg_rct_World_Map, caster) then
call SetUnitScalePercent( summon, scaling*40, scaling*40, scaling*40 )
call BlzSetUnitRealFieldBJ( summon, UNIT_RF_SELECTION_SCALE, 0.30 )
call SetUnitMoveSpeed( summon, ( GetUnitDefaultMoveSpeed(summon) / 2.00 ) )
endif
call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(caster), summon, 0, 0, false )
call SetUnitPositionLoc( caster, GetRectCenter(gg_rct_Packs) )
call SetUnitPositionLoc( summon, loc )
set udg_StandIn[GetConvertedPlayerId(GetOwningPlayer(caster))] = summon
call BlzSetUnitBaseDamage( summon, R2I(base), 0 )
call BlzSetUnitDiceSides( summon, R2I(range + 1), 0 )
call BlzSetUnitArmor( summon, armor )
call SetUnitState(summon, UNIT_STATE_LIFE, GetUnitState(caster, UNIT_STATE_LIFE))
call SetUnitState(summon, UNIT_STATE_MANA, GetUnitState(caster, UNIT_STATE_MANA))
call SelectUnitForPlayerSingle( summon, GetOwningPlayer(caster) )
call RemoveLocation(loc)
set loc = null
endfunction
function BearFormReturn takes nothing returns nothing
local unit summon = GetTriggerUnit()
local player p = GetOwningPlayer(summon)
local integer pid = GetConvertedPlayerId(p)
local unit hero = udg_MapHero[pid]
local real scaling = BlzGetUnitRealField(hero, UNIT_RF_SCALING_VALUE)
if RectContainsUnit(gg_rct_World_Map, summon) then
call SetUnitScalePercent( hero, scaling*40, scaling*40, scaling*40 )
call BlzSetUnitRealFieldBJ( hero, UNIT_RF_SELECTION_SCALE, 0.30 )
call SetUnitMoveSpeed( hero, ( GetUnitDefaultMoveSpeed(hero) / 2.00 ) )
endif
call SetCameraTargetControllerNoZForPlayer( p, hero, 0, 0, false )
call SetUnitPositionLoc( hero, GetUnitLoc(summon) )
call SelectUnitForPlayerSingle( hero, p )
endfunction
function HolyLight takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer damage = R2I(1*UnitProcDamage(source))
local real life = GetUnitState(target, UNIT_STATE_LIFE)
local boolean enemy = IsUnitEnemy(target, GetOwningPlayer(source))
local location loc = GetUnitLoc(target)
if IsAlive(target) and enemy then
call Damage( source, target, damage-1, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DIVINE )
elseif not enemy then
call SetUnitState(target, UNIT_STATE_LIFE, life + 50)
call ProcTextTag(loc, "+50", 9, 20, 90, 10)
endif
call RemoveLocation(loc)
set loc = null
endfunction
function Exorcism takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer damage = R2I(1*UnitProcDamage(source))
if IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source)) then
call Damage( source, target, damage-1, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DIVINE )
endif
endfunction
function ExhumeCorpseUnit takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetEnumUnit()
local real mana = GetUnitState(source, UNIT_STATE_MANA)
local location loc = GetUnitLoc(target)
if not IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source)) then
call SetUnitState(source, UNIT_STATE_MANA, mana + 25)
call ProcTextTag(loc, "+25", 9, 40, 60, 100)
call RemoveUnit(target)
endif
call RemoveLocation(loc)
set loc = null
endfunction
function ExhumeCorpse takes nothing returns nothing
local unit source = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
call ForGroupBJ( GetUnitsInRangeOfLocAll(85, GetSpellTargetLoc()), function ExhumeCorpseUnit )
endfunction
function Joust takes unit source, unit target returns nothing
local integer damage = R2I(1.50*UnitProcDamage(source))
if IsAlive(target) and IsUnitEnemy(target, GetOwningPlayer(source)) then
call Damage( source, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endif
endfunction
function DamageEffect takes unit source, unit target returns nothing
local integer abil = GetUnitUserData(source)
local damagetype dt = BlzGetEventDamageType()
local attacktype at = BlzGetEventAttackType()
local real damage = GetEventDamage()
local effect fx
local real x
local real y
if (abil == 'ACbf') then
call FrostBlast( source, target )
elseif (abil == 'ACbz') then
call Blizzard( source, target )
elseif (abil == 'ACcv') then
call TidalwaveUnit( source, target )
elseif (abil == 'A00F') then
call DoubleStrike( source, target )
elseif (abil == 'AUcs') then
call PowershotUnit( source, target )
elseif (abil == 'A01T') then
call ArcaneOrbUnit( source, target )
elseif (abil == 'ACsh') then
call BladewaveUnit( source, target )
elseif (abil == 'A023') then
call SingularityUnit( source, target )
elseif (abil == 'ACcl') then
call ChainLightningUnit( source, target )
elseif (abil == 'A00I') then
call HydroUnit( source, target )
elseif (abil == 'A01Y') then
call BallLightningUnit( source, target )
elseif (abil == 'Awrh') then
call JumpstrikeUnit( source, target )
endif
//Rage Mana
if (at != ATTACK_TYPE_NORMAL and dt == DAMAGE_TYPE_NORMAL and BlzGetUnitRealField( source, UNIT_RF_MANA_REGENERATION) < 0.00 ) then
call SetUnitManaBJ( source, ( GetUnitStateSwap(UNIT_STATE_MANA, source) + 3.00 ) )
endif
//Vision Quest
if ( GetUnitAbilityLevel(source, 'A03E') > 0 ) then
call SetUnitManaBJ( source, ( GetUnitStateSwap(UNIT_STATE_MANA, source) + 3.00 ) )
endif
//Block
if (dt == DAMAGE_TYPE_NORMAL and IsUnitInGroup(target, udg_Block)) then
call BlzSetEventDamage( damage / 3 )
set fx = AddSpecialEffectTarget( "Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl", target, "origin" )
call DestroyEffect( fx )
if (GetRandomInt(1, 4) == 1) then
set fx = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl", target, "origin" )
call DestroyEffect( fx )
call IssueImmediateOrder( target, "undefend" )
endif
endif
//Backstab
if (dt == DAMAGE_TYPE_NORMAL and GetUnitAbilityLevel(source, 'A02W') > 0 and not IsUnitInSightOfUnit(target, source, 112.5)) then
call BlzSetEventDamage( damage * 1.5 )
set fx = AddSpecialEffectTarget( "Objects\\Spawnmodels\\Orc\\Orcblood\\OrdBloodWyvernRider.mdl", target, "origin" )
call DestroyEffect( fx )
endif
//Joust
if (damage > 0.0 and damage <= 0.2 and GetUnitAbilityLevel(source, 'A03C') > 0) then
set x = LoadReal(udg_UnitPhysics, GetHandleId(source), StringHash("x"))
set y = LoadReal(udg_UnitPhysics, GetHandleId(source), StringHash("y"))
if (x != GetUnitX(source) or y != GetUnitY(source)) and IsUnitInSightOfUnit(source, target, 122.5) then
set fx = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl", target, "origin" )
call DestroyEffect( fx )
call Joust( source, target )
call SaveReal(udg_UnitPhysics, GetHandleId(source), StringHash("x"), GetUnitX(source))
call SaveReal(udg_UnitPhysics, GetHandleId(source), StringHash("y"), GetUnitY(source))
endif
call BlzSetEventDamage( 0.00 )
endif
endfunction
library Items
function ItemClass takes integer it, string class returns nothing
call SaveStr(udg_ItemClasses, it, StringHash("class"), class)
endfunction
function ClassSlot takes string class, string slot returns nothing
call SaveStr(udg_ItemClasses, StringHash(class), StringHash("slot"), slot)
endfunction
function GetItemClass takes item it returns string
return LoadStr(udg_ItemClasses, GetItemTypeId(it), StringHash("class"))
endfunction
function GetItemSlot takes item it returns string
return LoadStr(udg_ItemClasses, StringHash(GetItemClass(it)), StringHash("slot"))
endfunction
function ItemDamage takes integer it, integer base, integer range returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("damagebase"), base)
call SaveInteger(udg_ItemClasses, it, StringHash("damagerange"), range)
endfunction
function ItemArmor takes integer it, integer armor returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("armor"), armor)
endfunction
function ItemLife takes integer it, integer life, integer regen returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("life"), life)
call SaveInteger(udg_ItemClasses, it, StringHash("liferegen"), regen)
endfunction
function ItemMana takes integer it, integer mana, integer regen returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("mana"), mana)
call SaveInteger(udg_ItemClasses, it, StringHash("manaregen"), regen)
endfunction
function ItemCrit takes integer it, integer crit returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("crit"), crit)
endfunction
function ItemBash takes integer it, integer bash returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("bash"), bash)
endfunction
function ItemEvasion takes integer it, integer evasion returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("evasion"), evasion)
endfunction
function ItemResist takes integer it, integer resist returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("resist"), resist)
endfunction
function ItemSpell takes integer it, integer spell returns nothing
call SaveInteger(udg_ItemClasses, it, StringHash("spell"), spell)
endfunction
function GetItemDamageBase takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("damagebase"))
endfunction
function GetItemDamageRange takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("damagerange"))
endfunction
function GetItemArmor takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("armor"))
endfunction
function GetItemLife takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("life"))
endfunction
function GetItemLifeRegen takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("liferegen"))
endfunction
function GetItemMana takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("mana"))
endfunction
function GetItemManaRegen takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("manaregen"))
endfunction
function GetItemCrit takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("crit"))
endfunction
function GetItemBash takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("bash"))
endfunction
function GetItemEvasion takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("evasion"))
endfunction
function GetItemResist takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("resist"))
endfunction
function GetItemSpell takes item it returns integer
return LoadInteger(udg_ItemClasses, GetItemTypeId(it), StringHash("spell"))
endfunction
function UpdateItemStats takes unit hero returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(hero), GetUnitTypeId(hero), GetRectCenterX(gg_rct_Equipment), GetRectCenterY(gg_rct_Equipment), GetUnitFacing(hero))
local integer pid = GetConvertedPlayerId(GetOwningPlayer(hero))
local integer base = BlzGetUnitBaseDamage( dummy, 0 )
local integer range = BlzGetUnitDiceSides( dummy, 0 )
local integer armor = R2I(BlzGetUnitArmor( dummy ))
local integer life = BlzGetUnitMaxHP( dummy )
local integer liferegen = 0
local integer mana = BlzGetUnitMaxMana( dummy )
local integer manaregen = 0
local integer crit = 0
local integer bash = 0
local integer evasion = 0
local integer resist = 0
local integer spell = 0
call RemoveUnit(dummy)
if udg_MainSlot[pid] != null then
set base = base + GetItemDamageBase(udg_MainSlot[pid])
set range = range + GetItemDamageRange(udg_MainSlot[pid])
set armor = armor + GetItemArmor(udg_MainSlot[pid])
set life = life + GetItemLife(udg_MainSlot[pid])
set liferegen = liferegen + GetItemLifeRegen(udg_MainSlot[pid])
set mana = mana + GetItemMana(udg_MainSlot[pid])
set manaregen = manaregen + GetItemManaRegen(udg_MainSlot[pid])
set crit = crit + GetItemCrit(udg_MainSlot[pid])
set bash = bash + GetItemBash(udg_MainSlot[pid])
set evasion = evasion + GetItemEvasion(udg_MainSlot[pid])
set resist = resist + GetItemResist(udg_MainSlot[pid])
if udg_MainSpell[pid] > 0 then
call UnitRemoveAbility( hero, udg_MainSpell[pid] )
set udg_MainSpell[pid] = 0
endif
set spell = GetItemSpell(udg_MainSlot[pid])
if spell > 0 then
set udg_MainSpell[pid] = spell
call UnitAddAbility( hero, spell )
endif
endif
if udg_OffhandSlot[pid] != null then
set base = base + GetItemDamageBase(udg_OffhandSlot[pid])
set range = range + GetItemDamageRange(udg_OffhandSlot[pid])
set armor = armor + GetItemArmor(udg_OffhandSlot[pid])
set life = life + GetItemLife(udg_OffhandSlot[pid])
set liferegen = liferegen + GetItemLifeRegen(udg_OffhandSlot[pid])
set mana = mana + GetItemMana(udg_OffhandSlot[pid])
set manaregen = manaregen + GetItemManaRegen(udg_OffhandSlot[pid])
set crit = crit + GetItemCrit(udg_OffhandSlot[pid])
set bash = bash + GetItemBash(udg_OffhandSlot[pid])
set evasion = evasion + GetItemEvasion(udg_OffhandSlot[pid])
set resist = resist + GetItemResist(udg_OffhandSlot[pid])
if udg_OffhandSpell[pid] > 0 then
call UnitRemoveAbility( hero, udg_OffhandSpell[pid] )
set udg_OffhandSpell[pid] = 0
endif
set spell = GetItemSpell(udg_OffhandSlot[pid])
if spell > 0 then
set udg_OffhandSpell[pid] = spell
call UnitAddAbility( hero, spell )
endif
endif
if udg_ArmorSlot[pid] != null then
set base = base + GetItemDamageBase(udg_ArmorSlot[pid])
set range = range + GetItemDamageRange(udg_ArmorSlot[pid])
set armor = armor + GetItemArmor(udg_ArmorSlot[pid])
set life = life + GetItemLife(udg_ArmorSlot[pid])
set liferegen = liferegen + GetItemLifeRegen(udg_ArmorSlot[pid])
set mana = mana + GetItemMana(udg_ArmorSlot[pid])
set manaregen = manaregen + GetItemManaRegen(udg_ArmorSlot[pid])
set crit = crit + GetItemCrit(udg_ArmorSlot[pid])
set bash = bash + GetItemBash(udg_ArmorSlot[pid])
set evasion = evasion + GetItemEvasion(udg_ArmorSlot[pid])
set resist = resist + GetItemResist(udg_ArmorSlot[pid])
if udg_ArmorSpell[pid] > 0 then
call UnitRemoveAbility( hero, udg_ArmorSpell[pid] )
set udg_ArmorSpell[pid] = 0
endif
set spell = GetItemSpell(udg_ArmorSlot[pid])
if spell > 0 then
set udg_ArmorSpell[pid] = spell
call UnitAddAbility( hero, spell )
endif
endif
call BlzSetUnitBaseDamage( hero, base, 0 )
call BlzSetUnitDiceSides( hero, range, 0 )
call BlzSetUnitArmor( hero, armor )
call BlzSetUnitMaxHP( hero, life )
call BlzSetUnitMaxMana( hero, mana )
if liferegen > 0 then
call UnitAddAbility( hero, 'A014' )
call SetUnitAbilityLevel( hero, 'A00S', liferegen )
else
call UnitRemoveAbility( hero, 'A014' )
endif
if manaregen > 0 then
call UnitAddAbility( hero, 'A015' )
call SetUnitAbilityLevel( hero, 'A00R', manaregen )
else
call UnitRemoveAbility( hero, 'A015' )
endif
if crit > 0 then
call UnitAddAbility( hero, 'A032' )
call SetUnitAbilityLevel( hero, 'A02I', crit )
else
call UnitRemoveAbility( hero, 'A032' )
endif
if bash > 0 then
call UnitAddAbility( hero, 'A00O' )
call SetUnitAbilityLevel( hero, 'A02J', bash )
else
call UnitRemoveAbility( hero, 'A00O' )
endif
if evasion > 0 then
call UnitAddAbility( hero, 'A00N' )
call SetUnitAbilityLevel( hero, 'A012', evasion )
else
call UnitRemoveAbility( hero, 'A00N' )
endif
if resist > 0 then
call UnitAddAbility( hero, 'A00U' )
call SetUnitAbilityLevel( hero, 'A00T', resist )
else
call UnitRemoveAbility( hero, 'A00U' )
endif
endfunction
function Tool takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "tool")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Knife takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "knife")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Sword takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "sword")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Axe takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "axe")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Hammer takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "hammer")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Shield takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "shield")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Staff takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "staff")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Bow takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "bow")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Arrows takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "arrows")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Gun takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "gun")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Book takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "book")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Cloth takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "cloth")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Light takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "light")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Chain takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "chain")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function Plate takes integer it, integer base, integer range, integer armor returns nothing
call ItemClass(it, "plate")
call ItemDamage(it, base, range)
call ItemArmor(it, armor)
endfunction
function ItemClasses takes nothing returns nothing
set udg_ItemClasses = InitHashtable()
call ClassSlot("tool", "main")
call ClassSlot("knife", "main")
call ClassSlot("sword", "main")
call ClassSlot("axe", "main")
call ClassSlot("hammer", "main")
call ClassSlot("bow", "main")
call ClassSlot("staff", "main")
call ClassSlot("gun", "main")
call ClassSlot("shield", "off-hand")
call ClassSlot("arrows", "off-hand")
call ClassSlot("book", "off-hand")
call ClassSlot("cloth", "armor")
call ClassSlot("light", "armor")
call ClassSlot("chain", "armor")
call ClassSlot("plate", "armor")
call ClassSlot("gauntlets", "hands")
call ClassSlot("gloves", "hands")
call ClassSlot("greaves", "feet")
call ClassSlot("boots", "feet")
call ClassSlot("helmet", "head")
call ClassSlot("crown", "head")
call ClassSlot("ring", "accessory")
call ClassSlot("necklace", "accessory")
call Tool('rump', 4, 0, 0) // Pickaxe
call ItemSpell('rump', 'A02P')
call Knife('dkfw', 5, 1, 0) // Dagger
call Knife('ritd', 10, 1, 0) // Poison
call ItemSpell('ritd', 'A037')
call Knife('ratc', 18, 0, 0) // Claws
call Knife('crdt', 45, 0, 0) // Ice
call ItemSpell('crdt', 'AIft')
call Knife('shcw', 65, 0, 0) // Fire
call ItemSpell('shcw', 'AIfw')
call Knife('asbl', 100, 0, 0) // Assassins
call Sword('sor1', 7, 1, 0) // Short
call Sword('phlt', 10, 2, 0) // Broad
call Sword('sor2', 15, 2, 0) // Gladius
call Sword('rat6', 23, 3, 0) // Long
call Sword('sor4', 35, 4, 0) // Claymore
call Sword('bgst', 42, 4, 0) // Crystal
call Sword('rat9', 50, 6, 0) // Flamberge
call Sword('vddl', 52, 9, 0) // Coral
call Sword('frgd', 68, 12, 0) // Ice
call ItemSpell('frgd', 'AIft')
call Sword('sor3', 90, 16, 0) // Fire
call ItemSpell('sor3', 'AIfw')
call Sword('sor5', 135, 25, 0) // Cyclone
call ItemSpell('sor5', 'A038')
call Sword('scav', 170, 33, 0) // Sun
call Sword('desc', 200, 40, 0) // Dark
call Sword('srbd', 250, 45, 0) // Dragon
call Sword('ratf', 350, 60, 0) // Ancient
call Axe('stwa', 9, 0, 0) // Hand
call ItemCrit('rat3', 1)
call Axe('wtlg', 13, 0, 0) // Iron
call ItemCrit('wtlg', 1)
call Axe('wolg', 19, 0, 0) // Battle
call ItemCrit('wolg', 1)
call Axe('btst', 34, 0, 0) // Silver
call ItemCrit('btst', 1)
call Axe('tmmt', 50, 0, 0) // Rune
call ItemCrit('tmmt', 1)
call Axe('sneg', 70, 0, 0) // Ice
call ItemCrit('sneg', 2)
call ItemSpell('sneg', 'AIft')
call Axe('ssil', 92, 0, 0) // Fire
call ItemCrit('ssil', 2)
call ItemSpell('ssil', 'AIfw')
call Axe('flag', 170, 0, 0) // Solar
call ItemCrit('flag', 3)
call Axe('klmm', 195, 0, 0) // Death
call ItemCrit('klmm', 3)
call Axe('stel', 345, 0, 0) // Pangu
call ItemCrit('stel', 4)
call Hammer('sfog', 8, 0, 0) // Mallet
call ItemBash('sfog', 2)
call Hammer('drph', 12, 0, 0) // Cudgel
call ItemBash('drph', 2)
call Hammer('mlst', 18, 0, 0) // Maul
call ItemBash('mlst', 2)
call Hammer('shtm', 24, 0, 0) // Bone
call ItemBash('shtm', 2)
call Hammer('tbsm', 28, 0, 0) // Martel De Fer
call ItemBash('tbsm', 2)
call Hammer('tfar', 34, 0, 0) // Silver
call ItemBash('tfar', 2)
call Hammer('rhe2', 50, 0, 0) // Rune
call ItemBash('rhe2', 2)
call Hammer('srtl', 95, 0, 0) // Fire
call ItemBash('srtl', 3)
call ItemSpell('srtl', 'AIfw')
call Hammer('thle', 145, 0, 0) // Storm
call ItemBash('thle', 3)
call ItemSpell('thle', 'A038')
call Hammer('rag1', 340, 0, 0) // Mjollnir
call ItemBash('rag1', 4)
call ItemSpell('rag1', 'A038')
call Shield('rde2', 0, 0, 3) // Round
call Shield('gobm', 0, 0, 4) // Tower
call Shield('engr', 0, 0, 5) // Boeotian
call Shield('fwss', 0, 0, 6) // Skull
call ItemLife('fwss', 5, 0)
call Shield('shen', 0, 0, 7) // Buckler
call Shield('sksh', 0, 0, 8) // Targe
call Shield('nflg', 0, 0, 10) // Broad
call Shield('lhst', 0, 0, 12) // Kite
call Shield('fgbd', 0, 0, 15) // Knights
call Shield('arsh', 0, 0, 20) // Rune
call Shield('stpg', 0, 0, 24) // War
call Shield('sxpl', 0, 0, 30) // Ice
call Shield('tbar', 0, 0, 40) // Fire
call Shield('infs', 0, 0, 66) // Defender
call Shield('oflg', 0, 0, 80) // Doom
call Shield('shdt', 0, 0, 115) // Death
call Shield('shhn', 0, 0, 125) // Ancient
call Shield('ktrm', 0, 0, 170) // Aegis
call Bow('rat3', 5, 0, 0) // Hunting
call ItemCrit('rat3', 1)
call Bow('kgal', 7, 0, 0) // Cedar
call ItemCrit('kgal', 1)
call Bow('gmfr', 12, 0, 0) // Long
call ItemCrit('gmfr', 1)
call Bow('sor9', 18, 0, 0) // Cross
call ItemCrit('sor9', 1)
call Bow('sbch', 28, 0, 0) // Twilight
call ItemCrit('sbch', 1)
call Bow('penr', 36, 0, 0) // Silver
call ItemCrit('penr', 1)
call Bow('sor7', 44, 0, 0) // Gilded
call ItemCrit('sor7', 1)
call Bow('spsh', 48, 0, 0) // Coral
call ItemCrit('spsh', 1)
call Bow('fgdg', 75, 0, 0) // Blade
call ItemCrit('fgdg', 1)
//call Bow('', 105, 0, 0) //
//call Bow('', 140, 0, 0) //
call Bow('iotw', 240, 0, 0) // Ancient
call ItemCrit('iotw', 1)
call Arrows('dsum', 2, 0, 0) // Iron
call Arrows('tels', 4, 0, 0) // Piercing
call Arrows('sehr', 6, 0, 0) // Obsidian
call Arrows('skrt', 8, 0, 0) // Poison
call ItemSpell('skrt', 'A037')
call Arrows('cnhn', 12, 0, 0) // Guardian
call Arrows('belv', 20, 0, 0) // Silver
call Arrows('fgun', 30, 0, 0) // Truestrike
call Arrows('dphe', 40, 0, 0) // Fire
call ItemSpell('dphe', 'AIfw')
call Arrows('dthb', 60, 0, 0) // Ice
call ItemSpell('dthb', 'AIft')
call Arrows('rwiz', 80, 0, 0) // Dragon
call Arrows('sor8', 100, 0, 0) // Lucent
call Gun('frhg', 70, 0, 0) // Handgun
call Gun('sor6', 100, 0, 0) // Gunblade
call Gun('brag', 250, 0, 0) // Machine Gun
call Staff('will', 4, 0, 0) // Oak
call ItemMana('will', 15, 0)
call Staff('afac', 6, 0, 2) // Ironwood
call ItemMana('afac', 15, 0)
call Staff('ssan', 10, 0, 0) // Amethyst
call ItemMana('ssan', 25, 3)
call Staff('glsk', 17, 0, 0) // Tranquil
call ItemMana('glsk', 25, 0)
call Staff('vpur', 25, 0, 4) // Crystal
call ItemMana('vpur', 25, 0)
call Staff('stre', 30, 0, 0) // Skull
call ItemMana('stre', 0, 5)
call Staff('schl', 35, 0, 0) // Fortune
call ItemMana('schl', 25, 0)
call Staff('wneu', 40, 0, 0) // Gnarled
call ItemMana('wneu', 25, 3)
call Staff('spre', 45, 0, 0) // Swan
call ItemMana('spre', 40, 5)
call Staff('rots', 48, 0, 8) // Sea
call ItemMana('rots', 25, 3)
call ItemSpell('rots', 'A016')
call Staff('woms', 52, 0, 0) // Crescent
call ItemMana('woms', 75, 3)
call Staff('iwbr', 62, 0, 12) // Forest
call ItemMana('iwbr', 0, 3)
call Staff('wneg', 85, 0, 0) // Voodoo
call ItemMana('wneg', 0, 5)
call ItemSpell('wneg', 'A037')
call Staff('mnsf', 95, 0, 0) // Ice
call ItemSpell('mnsf', 'AIft')
call Staff('wcyc', 105, 0, 0) // Wind
call ItemSpell('wcyc', 'AIft')
call Staff('ccmd', 115, 0, 0) // Holy
call ItemMana('ccmd', 40, 5)
call ItemSpell('ccmd', 'A03G')
call Staff('wshs', 145, 0, 0) // Oculus
call Staff('wlsd', 200, 0, 0) // Celestial
call Book('ajen', 1, 0, 0) // Magika
call ItemMana('ajen', 15, 0)
call Book('tdx2', 2, 0, 0) // Sanctuary
call ItemMana('tdx2', 25, 0)
call Book('tdex', 3, 0, 0) // Aquarius
call ItemMana('tdex', 25, 3)
call Book('texp', 4, 0, 5) // Crystalis
call ItemMana('texp', 40, 0)
call Book('ledg', 6, 0, 0) // Tropicana
call ItemMana('ledg', 40, 3)
call ItemLife('ledg', 25, 0)
call Book('tret', 8, 0, 8) // Chronika
call ItemMana('tret', 75, 3)
call Book('fgsk', 10, 0, 0) // Necronomicon
call ItemMana('fgsk', 75, 5)
call ItemLife('fgsk', 25, 0)
call Book('dtsb', 15, 0, 20) // Naturalis
call ItemMana('dtsb', 75, 5)
call Book('sbok', 20, 4, 0) // Electra
call ItemMana('sbok', 75, 7)
call Book('tmsc', 25, 0, 0) // Arcana
call ItemMana('tmsc', 80, 5)
call ItemLife('tmsc', 25, 0)
call Book('tkno', 35, 0, 0) // Fire
call ItemSpell('tkno', 'AIfw')
call Book('tgxp', 45, 0, 0) // Ice
call ItemSpell('tgxp', 'AIft')
call Book('tint', 55, 0, 0) // Lightning
call ItemSpell('tint', 'A038')
call Book('tpow', 75, 0, 0) // Darkness
call Book('grsl', 100, 0, 0) // Souls
call Cloth('rde1', 0, 0, 2) // Cloak
call Cloth('hcun', 0, 0, 3) // Hood
call ItemMana('hcun', 15, 0)
call Cloth('gfor', 0, 0, 5) // Magic
call ItemMana('gfor', 25, 0)
call Cloth('dust', 0, 0, 8) // Vizier
call ItemMana('dust', 40, 0)
call ItemResist('dust', 4)
call Cloth('ciri', 0, 0, 13) // Sorceror
call ItemMana('ciri', 75, 0)
call ItemEvasion('ciri', 2)
call Cloth('rin1', 0, 0, 18) // Magus
call ItemMana('rin1', 75, 0)
call ItemEvasion('rin1', 3)
call Cloth('ocor', 0, 0, 25) // Arcane
call ItemMana('ocor', 75, 0)
call ItemResist('ocor', 4)
call ItemEvasion('ocor', 3)
call Cloth('lgdh', 0, 0, 35) // Neptune
call ItemMana('lgdh', 125, 0)
call ItemResist('lgdh', 4)
call Cloth('clfm', 0, 0, 50) // Demonic
call ItemMana('clfm', 125, 0)
call ItemResist('clfm', 6)
call Light('rde0', 0, 0, 4) // Leather
call Light('ram1', 0, 0, 7) // Studded
call Light('gopr', 0, 0, 12) // Bone
call Light('blba', 0, 0, 24) // Mithril
call ItemResist('blba', 2)
call Light('shwd', 0, 0, 35) // Coral
call Light('ckng', 0, 0, 124) // Leonidas
call Light('hval', 0, 0, 160) // Shredder
call Chain('ward', 0, 0, 6) // Bronze
call Chain('ankh', 0, 0, 10) // Iron
call Chain('fgfh', 0, 0, 16) // Silver
call ItemResist('fgfh', 2)
call Chain('evtl', 0, 0, 28) // Brigandine
call ItemResist('evtl', 2)
call Chain('kpin', 0, 0, 80) // Dragonscale
call ItemResist('kpin', 4)
call Plate('rde3', 0, 0, 8) // Bronze
call Plate('ram3', 0, 0, 14) // Iron
call Plate('ram2', 0, 0, 20) // Steel
call Plate('clsd', 0, 0, 30) // Crystal
call Plate('tgrh', 0, 0, 42) // Ice
call ItemSpell('tgrh', 'AIft')
call Plate('k3m2', 0, 0, 58) // Fire
call Plate('skul', 0, 0, 100) // Emerald
call ItemSpell('skul', 'A037')
call Plate('war2', 0, 0, 150) // Dark
call Plate('gomn', 0, 0, 220) // Ancient
call ItemEvasion('gomn', 3)
call Plate('whwd', 0, 0, 320) // Prismatic
call ItemEvasion('whwd', 3)
endfunction
endlibrary
library Capabilities requires Items, Text
function ItemCapability takes integer u, string class returns nothing
call SaveBoolean(udg_ItemCapabilties, u, StringHash(class), true)
endfunction
function UnequipMain takes unit hero returns nothing
local integer pid = GetConvertedPlayerId(GetOwningPlayer(hero))
if udg_MainSlot[pid] != null then
call SetItemPosition(udg_MainSlot[pid], GetUnitX(udg_MapHero[pid]), GetUnitY(udg_MapHero[pid]))
call UnitAddItem( udg_MapHero[pid], udg_MainSlot[pid] )
set udg_MainSlot[pid] = null
if udg_MainSpell[pid] > 0 then
call UnitRemoveAbility( hero, udg_MainSpell[pid] )
set udg_MainSpell[pid] = 0
endif
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetVisible(MainItem, false)
endif
call UpdateItemStats(udg_MapHero[pid])
endif
endfunction
function UnequipOffhand takes unit hero returns nothing
local integer pid = GetConvertedPlayerId(GetOwningPlayer(hero))
if udg_OffhandSlot[pid] != null then
call SetItemPosition(udg_OffhandSlot[pid], GetUnitX(udg_MapHero[pid]), GetUnitY(udg_MapHero[pid]))
call UnitAddItem( udg_MapHero[pid], udg_OffhandSlot[pid] )
set udg_OffhandSlot[pid] = null
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetVisible(OffhandItem, false)
endif
call UpdateItemStats(udg_MapHero[pid])
endif
endfunction
function UnequipArmor takes unit hero returns nothing
local integer pid = GetConvertedPlayerId(GetOwningPlayer(hero))
if udg_ArmorSlot[pid] != null then
call SetItemPosition(udg_ArmorSlot[pid], GetUnitX(udg_MapHero[pid]), GetUnitY(udg_MapHero[pid]))
call UnitAddItem( udg_MapHero[pid], udg_ArmorSlot[pid] )
set udg_ArmorSlot[pid] = null
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetVisible(ArmorItem, false)
endif
call UpdateItemStats(udg_MapHero[pid])
endif
endfunction
function UnitEquipItem takes unit u, item it returns nothing
local integer pid = GetConvertedPlayerId(GetOwningPlayer(u))
local string class = GetItemClass(it)
local string slot = GetItemSlot(it)
local item sit
if class == null then
return
endif
if LoadBoolean(udg_ItemCapabilties, GetUnitTypeId(u), StringHash(class)) == true then
if slot == "main" then
set sit = udg_MainSlot[pid]
elseif slot == "off-hand" then
set sit = udg_OffhandSlot[pid]
elseif slot == "armor" then
set sit = udg_ArmorSlot[pid]
endif
if sit != null then
call ErrorMessage("Can not equip another " + slot, GetOwningPlayer(u))
return
endif
if slot == "main" then
set udg_MainSlot[pid] = it
if GetOwningPlayer(u) == GetLocalPlayer() then
call BlzFrameSetTexture(MainItemBackdrop, BlzGetAbilityIcon(GetItemTypeId(it)), 0, true)
call BlzFrameSetVisible(MainItem, true)
endif
elseif slot == "off-hand" then
set udg_OffhandSlot[pid] = it
if GetOwningPlayer(u) == GetLocalPlayer() then
call BlzFrameSetTexture(OffhandItemBackdrop, BlzGetAbilityIcon(GetItemTypeId(it)), 0, true)
call BlzFrameSetVisible(OffhandItem, true)
endif
elseif slot == "armor" then
set udg_ArmorSlot[pid] = it
if GetOwningPlayer(u) == GetLocalPlayer() then
call BlzFrameSetTexture(ArmorItemBackdrop, BlzGetAbilityIcon(GetItemTypeId(it)), 0, true)
call BlzFrameSetVisible(ArmorItem, true)
endif
endif
call SetItemPositionLoc( it, GetRectCenter(gg_rct_Equipment) )
call UpdateItemStats(u)
else
call ErrorMessage("Can not equip " + GetItemName(it), GetOwningPlayer(u))
endif
endfunction
function Equip takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer pid = GetConvertedPlayerId(GetOwningPlayer(u))
local integer order = GetUnitCurrentOrder(u)
local item it
if order >= 852008 and order <= 852013 then
set it = UnitItemInSlot(u, order - 852008)
else
return
endif
if u == udg_Pack[pid] then
set u = udg_MapHero[pid]
endif
call UnitEquipItem(u, it)
endfunction
function Consume takes unit u, integer c, integer it returns nothing
local item i = GetItemOfTypeFromUnitBJ(u, it)
local integer remainder = GetItemCharges(i) - c
call SetItemCharges( i, remainder )
if remainder <= 0 then
call RemoveItem(i)
endif
endfunction
function ItemCapabilties takes nothing returns nothing
set udg_ItemCapabilties = InitHashtable()
// Villager
call ItemCapability('n002', "tool")
call ItemCapability('n002', "knife")
call ItemCapability('n002', "cloth")
// Peasant
call ItemCapability('h000', "tool")
call ItemCapability('h000', "knife")
call ItemCapability('h000', "hammer")
call ItemCapability('h000', "axe")
call ItemCapability('h000', "cloth")
call ItemCapability('h000', "light")
// Footman
call ItemCapability('h001', "tool")
call ItemCapability('h001', "knife")
call ItemCapability('h001', "sword")
call ItemCapability('h001', "hammer")
call ItemCapability('h001', "axe")
call ItemCapability('h001', "shield")
call ItemCapability('h001', "cloth")
call ItemCapability('h001', "light")
call ItemCapability('h001', "chain")
call ItemCapability('h001', "plate")
// Knight
call ItemCapability('h00B', "tool")
call ItemCapability('h00B', "knife")
call ItemCapability('h00B', "sword")
call ItemCapability('h00B', "hammer")
call ItemCapability('h00B', "axe")
call ItemCapability('h00B', "shield")
call ItemCapability('h00B', "cloth")
call ItemCapability('h00B', "light")
call ItemCapability('h00B', "chain")
call ItemCapability('h00B', "plate")
// Vanguard
call ItemCapability('h00C', "tool")
call ItemCapability('h00C', "knife")
call ItemCapability('h00C', "sword")
call ItemCapability('h00C', "hammer")
call ItemCapability('h00C', "axe")
call ItemCapability('h00C', "shield")
call ItemCapability('h00C', "cloth")
call ItemCapability('h00C', "light")
call ItemCapability('h00C', "chain")
call ItemCapability('h00C', "plate")
// Mage
call ItemCapability('n02X', "tool")
call ItemCapability('n02X', "knife")
call ItemCapability('n02X', "staff")
call ItemCapability('n02X', "book")
call ItemCapability('n02X', "cloth")
// Sorceror
call ItemCapability('n03D', "tool")
call ItemCapability('n03D', "knife")
call ItemCapability('n03D', "staff")
call ItemCapability('n03D', "book")
call ItemCapability('n03D', "cloth")
// Wizard
call ItemCapability('n03E', "tool")
call ItemCapability('n03E', "knife")
call ItemCapability('n03E', "staff")
call ItemCapability('n03E', "book")
call ItemCapability('n03E', "cloth")
// Archer
call ItemCapability('n02U', "tool")
call ItemCapability('n02U', "knife")
call ItemCapability('n02U', "shield")
call ItemCapability('n02U', "bow")
call ItemCapability('n02U', "arrows")
call ItemCapability('n02U', "cloth")
call ItemCapability('n02U', "light")
call ItemCapability('n02U', "chain")
// Ranger
call ItemCapability('n03B', "tool")
call ItemCapability('n03B', "knife")
call ItemCapability('n03B', "shield")
call ItemCapability('n03B', "bow")
call ItemCapability('n03B', "arrows")
call ItemCapability('n03B', "cloth")
call ItemCapability('n03B', "light")
call ItemCapability('n03B', "chain")
// Amazon
call ItemCapability('n03C', "tool")
call ItemCapability('n03C', "knife")
call ItemCapability('n03C', "shield")
call ItemCapability('n03C', "bow")
call ItemCapability('n03C', "arrows")
call ItemCapability('n03C', "cloth")
call ItemCapability('n03C', "light")
call ItemCapability('n03C', "chain")
// Monk
call ItemCapability('n031', "tool")
call ItemCapability('n031', "knife")
call ItemCapability('n031', "hammer")
call ItemCapability('n031', "staff")
call ItemCapability('n031', "book")
call ItemCapability('n031', "cloth")
// Priest
call ItemCapability('n03I', "tool")
call ItemCapability('n03I', "knife")
call ItemCapability('n03I', "hammer")
call ItemCapability('n03I', "staff")
call ItemCapability('n03I', "book")
call ItemCapability('n03I', "cloth")
// Saint
call ItemCapability('n03J', "tool")
call ItemCapability('n03J', "knife")
call ItemCapability('n03J', "hammer")
call ItemCapability('n03J', "staff")
call ItemCapability('n03J', "book")
call ItemCapability('n03J', "cloth")
// Zealot
call ItemCapability('h008', "tool")
call ItemCapability('h008', "knife")
call ItemCapability('h008', "axe")
call ItemCapability('h008', "sword")
call ItemCapability('h008', "hammer")
call ItemCapability('h008', "shield")
call ItemCapability('h008', "book")
call ItemCapability('h008', "cloth")
call ItemCapability('h008', "light")
call ItemCapability('h008', "chain")
call ItemCapability('h008', "plate")
// Crusader
call ItemCapability('h00D', "tool")
call ItemCapability('h00D', "knife")
call ItemCapability('h00D', "axe")
call ItemCapability('h00D', "sword")
call ItemCapability('h00D', "hammer")
call ItemCapability('h00D', "shield")
call ItemCapability('h00D', "book")
call ItemCapability('h00D', "cloth")
call ItemCapability('h00D', "light")
call ItemCapability('h00D', "chain")
call ItemCapability('h00D', "plate")
// Paladin
call ItemCapability('h00E', "tool")
call ItemCapability('h00E', "knife")
call ItemCapability('h00E', "axe")
call ItemCapability('h00E', "sword")
call ItemCapability('h00E', "hammer")
call ItemCapability('h00E', "shield")
call ItemCapability('h00E', "book")
call ItemCapability('h00E', "cloth")
call ItemCapability('h00E', "light")
call ItemCapability('h00E', "chain")
call ItemCapability('h00E', "plate")
// Raider
call ItemCapability('h005', "tool")
call ItemCapability('h005', "knife")
call ItemCapability('h005', "axe")
call ItemCapability('h005', "hammer")
call ItemCapability('h005', "shield")
call ItemCapability('h005', "cloth")
call ItemCapability('h005', "light")
call ItemCapability('h005', "chain")
call ItemCapability('h005', "plate")
// Viking
call ItemCapability('h00F', "tool")
call ItemCapability('h00F', "knife")
call ItemCapability('h00F', "axe")
call ItemCapability('h00F', "hammer")
call ItemCapability('h00F', "shield")
call ItemCapability('h00F', "cloth")
call ItemCapability('h00F', "light")
call ItemCapability('h00F', "chain")
call ItemCapability('h00F', "plate")
// Berzerker
call ItemCapability('h00G', "tool")
call ItemCapability('h00G', "knife")
call ItemCapability('h00G', "axe")
call ItemCapability('h00G', "hammer")
call ItemCapability('h00G', "shield")
call ItemCapability('h00G', "cloth")
call ItemCapability('h00G', "light")
call ItemCapability('h00G', "chain")
call ItemCapability('h00G', "plate")
// Stalker
call ItemCapability('h006', "tool")
call ItemCapability('h006', "knife")
call ItemCapability('h006', "sword")
call ItemCapability('h006', "shield")
call ItemCapability('h006', "cloth")
call ItemCapability('h006', "light")
// Huntress
call ItemCapability('h00H', "tool")
call ItemCapability('h00H', "knife")
call ItemCapability('h00H', "sword")
call ItemCapability('h00H', "shield")
call ItemCapability('h00H', "cloth")
call ItemCapability('h00H', "light")
// Assassin
call ItemCapability('h00I', "tool")
call ItemCapability('h00I', "knife")
call ItemCapability('h00I', "sword")
call ItemCapability('h00I', "shield")
call ItemCapability('h00I', "cloth")
call ItemCapability('h00I', "light")
// Rider
call ItemCapability('h00Y', "tool")
call ItemCapability('h00Y', "sword")
call ItemCapability('h00Y', "axe")
call ItemCapability('h00Y', "hammer")
call ItemCapability('h00Y', "shield")
call ItemCapability('h00Y', "cloth")
call ItemCapability('h00Y', "light")
call ItemCapability('h00Y', "chain")
call ItemCapability('h00Y', "plate")
// Cavalry
call ItemCapability('h00X', "tool")
call ItemCapability('h00X', "sword")
call ItemCapability('h00X', "axe")
call ItemCapability('h00X', "hammer")
call ItemCapability('h00X', "shield")
call ItemCapability('h00X', "cloth")
call ItemCapability('h00X', "light")
call ItemCapability('h00X', "chain")
call ItemCapability('h00X', "plate")
// Cataphract
call ItemCapability('h00W', "tool")
call ItemCapability('h00W', "sword")
call ItemCapability('h00W', "axe")
call ItemCapability('h00W', "hammer")
call ItemCapability('h00W', "shield")
call ItemCapability('h00W', "cloth")
call ItemCapability('h00W', "light")
call ItemCapability('h00W', "chain")
call ItemCapability('h00W', "plate")
// Rogue
call ItemCapability('n03F', "tool")
call ItemCapability('n03F', "knife")
call ItemCapability('n03F', "bow")
call ItemCapability('n03F', "gun")
call ItemCapability('n03F', "arrows")
call ItemCapability('n03F', "cloth")
call ItemCapability('n03F', "light")
// Corsair
call ItemCapability('n03G', "tool")
call ItemCapability('n03G', "knife")
call ItemCapability('n03G', "bow")
call ItemCapability('n03G', "gun")
call ItemCapability('n03G', "arrows")
call ItemCapability('n03G', "cloth")
call ItemCapability('n03G', "light")
// Strider
call ItemCapability('n03H', "tool")
call ItemCapability('n03H', "knife")
call ItemCapability('n03H', "bow")
call ItemCapability('n03H', "gun")
call ItemCapability('n03H', "arrows")
call ItemCapability('n03H', "cloth")
call ItemCapability('n03H', "light")
// Warlock
call ItemCapability('n038', "tool")
call ItemCapability('n038', "knife")
call ItemCapability('n038', "staff")
call ItemCapability('n038', "book")
call ItemCapability('n038', "cloth")
// Necromancer
call ItemCapability('n039', "tool")
call ItemCapability('n039', "knife")
call ItemCapability('n039', "staff")
call ItemCapability('n039', "book")
call ItemCapability('n039', "cloth")
// Lich
call ItemCapability('n03A', "tool")
call ItemCapability('n03A', "knife")
call ItemCapability('n03A', "staff")
call ItemCapability('n03A', "book")
call ItemCapability('n03A', "cloth")
// Druid
call ItemCapability('n037', "tool")
call ItemCapability('n037', "knife")
call ItemCapability('n037', "staff")
call ItemCapability('n037', "hammer")
call ItemCapability('n037', "axe")
call ItemCapability('n037', "book")
call ItemCapability('n037', "cloth")
call ItemCapability('n037', "light")
// Shapeshifter
call ItemCapability('n03K', "tool")
call ItemCapability('n03K', "knife")
call ItemCapability('n03K', "staff")
call ItemCapability('n03K', "hammer")
call ItemCapability('n03K', "axe")
call ItemCapability('n03K', "book")
call ItemCapability('n03K', "cloth")
call ItemCapability('n03K', "light")
// Guardian
call ItemCapability('n03L', "tool")
call ItemCapability('n03L', "knife")
call ItemCapability('n03L', "staff")
call ItemCapability('n03L', "hammer")
call ItemCapability('n03L', "axe")
call ItemCapability('n03L', "book")
call ItemCapability('n03L', "cloth")
call ItemCapability('n03L', "light")
// Mystic Knight
call ItemCapability('h007', "tool")
call ItemCapability('h007', "knife")
call ItemCapability('h007', "sword")
call ItemCapability('h007', "axe")
call ItemCapability('h007', "gun")
call ItemCapability('h007', "shield")
call ItemCapability('h007', "cloth")
call ItemCapability('h007', "light")
call ItemCapability('h007', "chain")
call ItemCapability('h007', "plate")
// Dragon Knight
call ItemCapability('h009', "tool")
call ItemCapability('h009', "knife")
call ItemCapability('h009', "sword")
call ItemCapability('h009', "axe")
call ItemCapability('h009', "gun")
call ItemCapability('h009', "shield")
call ItemCapability('h009', "cloth")
call ItemCapability('h009', "light")
call ItemCapability('h009', "chain")
call ItemCapability('h009', "plate")
// Dragoon
call ItemCapability('h00A', "tool")
call ItemCapability('h00A', "knife")
call ItemCapability('h00A', "sword")
call ItemCapability('h00A', "axe")
call ItemCapability('h00A', "gun")
call ItemCapability('h00A', "shield")
call ItemCapability('h00A', "cloth")
call ItemCapability('h00A', "light")
call ItemCapability('h00A', "chain")
call ItemCapability('h00A', "plate")
// Ronin
call ItemCapability('h01E', "tool")
call ItemCapability('h01E', "knife")
call ItemCapability('h01E', "sword")
call ItemCapability('h01E', "arrows")
call ItemCapability('h01E', "cloth")
call ItemCapability('h01E', "light")
call ItemCapability('h01E', "chain")
// Samurai
call ItemCapability('h01F', "tool")
call ItemCapability('h01F', "knife")
call ItemCapability('h01F', "sword")
call ItemCapability('h01F', "arrows")
call ItemCapability('h01F', "cloth")
call ItemCapability('h01F', "light")
call ItemCapability('h01F', "chain")
// Daimyo
call ItemCapability('h01G', "tool")
call ItemCapability('h01G', "knife")
call ItemCapability('h01G', "sword")
call ItemCapability('h01G', "arrows")
call ItemCapability('h01G', "cloth")
call ItemCapability('h01G', "light")
call ItemCapability('h01G', "chain")
endfunction
endlibrary
function TownPortal takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))
local unit hero = udg_MapHero[pid]
local effect fx
call TriggerSleepAction( 2.00 )
set fx = AddSpecialEffectLoc( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", udg_Portals[pid] )
if RectContainsUnit(udg_Battlefield, udg_MapHero[pid]) then
call SetUnitPosition( hero, GetUnitX(udg_GoodGeneral), GetUnitY(udg_GoodGeneral) )
else
set udg_MapLocation[pid] = udg_PortalMapLocation[pid]
call SetUnitPositionLoc( hero, udg_Portals[pid] )
call SetUnitPositionLoc( udg_MapFlag[pid], udg_PortalMapLocation[pid] )
call RemoveUnit( udg_MapShip[pid] )
call ToAbovewater( hero )
call ToTown( hero )
endif
call TriggerSleepAction( 2.00 )
call DestroyEffect( fx )
endfunction
function Antivenom takes unit u returns nothing
if u == null then
return
endif
if ( GetUnitAbilityLevel(u, 'B002') > 0 ) then
call UnitRemoveAbility( u, 'Bpsd' )
call UnitRemoveAbility( u, 'Bpoi' )
call UnitRemoveAbility( u, 'Bspo' )
call UnitRemoveAbility( u, 'Bssd' )
endif
endfunction
function Darksight takes unit u returns nothing
if u == null then
return
endif
if ( GetUnitAbilityLevel(u, 'B003') == 0 ) then
call UnitRemoveAbility(u, 'A01F')
endif
endfunction
function Frostguard takes unit u returns nothing
if u == null then
return
endif
if ( GetUnitAbilityLevel(u, 'B004') > 0 ) then
call UnitRemoveAbility(u, 'Bfro')
endif
endfunction
globals
framehandle P1Portrait = null
framehandle P1Bar = null
framehandle P2Portrait = null
framehandle P2Bar = null
framehandle P3Portrait = null
framehandle P3Bar = null
framehandle P4Portrait = null
framehandle P4Bar = null
framehandle P5Portrait = null
framehandle P5Bar = null
framehandle P6Portrait = null
framehandle P6Bar = null
framehandle P7Portrait = null
framehandle P7Bar = null
framehandle MenuTooltip = null
framehandle MenuTooltipText = null
framehandle Equipment = null
framehandle EquipmentButton = null
framehandle EquipmentButtonBackdrop = null
trigger EquipmentButtonTrigger = null
trigger EquipmentButtonTooltipTrigger = null
framehandle PackButton = null
framehandle PackButtonBackdrop = null
trigger PackButtonTrigger = null
trigger PackButtonTooltipTrigger = null
framehandle ReturnButton = null
framehandle ReturnHilite = null
framehandle ReturnButtonBackdrop = null
trigger ReturnButtonTrigger = null
trigger ReturnButtonTooltipTrigger = null
framehandle AirshipButton = null
framehandle AirshipButtonBackdrop = null
trigger AirshipButtonTrigger = null
trigger AirshipButtonTooltipTrigger = null
framehandle Armor = null
framehandle ArmorItem = null
framehandle ArmorItemBackdrop = null
trigger ArmorTrigger = null
trigger ArmorTooltipTrigger = null
framehandle Main = null
framehandle MainItem = null
framehandle MainItemBackdrop = null
trigger MainTrigger = null
trigger MainTooltipTrigger = null
framehandle Offhand = null
framehandle OffhandItem = null
framehandle OffhandItemBackdrop = null
trigger OffhandTrigger = null
trigger OffhandTooltipTrigger = null
framehandle TitleButton = null
framehandle Tooltips = null
framehandle TooltipsText = null
framehandle X = null
framehandle E = null
framehandle R = null
framehandle Q = null
framehandle W = null
framehandle D = null
framehandle F = null
framehandle Minimap = null
framehandle Battle = null
framehandle P1 = null
framehandle P2 = null
framehandle P3 = null
framehandle P4 = null
framehandle P5 = null
framehandle P6 = null
framehandle P7 = null
endglobals
library REFORGEDUIMAKER initializer init requires Capabilities, Battles, Airship
function EquipmentButtonFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
set udg_EquipmentShow[pid] = not udg_EquipmentShow[pid]
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetVisible(Equipment, udg_EquipmentShow[pid])
call BlzFrameSetEnable(EquipmentButton, false)
call BlzFrameSetEnable(EquipmentButton, true)
endif
endfunction
function PackButtonFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
local unit pack = udg_Pack[pid]
local unit hero = udg_MapHero[pid]
if not RectContainsUnit(gg_rct_World_Map, udg_MapHero[pid]) then
call IssueImmediateOrder( hero, "stop" )
call PlaySoundAtPointBJ( gg_snd_HeroDropItem1, 100, GetUnitLoc(hero), 0 )
call SetUnitPositionLoc( pack , PolarProjectionBJ(GetUnitLoc(hero), 50.00, GetUnitFacing(hero)) )
endif
call SelectUnitForPlayerSingle( pack, GetTriggerPlayer() )
call SelectUnitAddForPlayer( hero, GetTriggerPlayer() )
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetEnable(PackButton, false)
call BlzFrameSetEnable(PackButton, true)
endif
endfunction
function ReturnButtonFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
local unit u
local effect fx
if RectContainsUnit(udg_BattleRegion[pid], udg_MapHero[pid]) then
set u = udg_MapHero[pid]
elseif RectContainsUnit(udg_BattleRegion[pid], udg_StandIn[pid]) then
set u = udg_StandIn[pid]
endif
if u == null then
return
endif
if GetLocalPlayer() == GetTriggerPlayer() then
call BlzFrameSetVisible(ReturnButton, false)
endif
call IssueImmediateOrderBJ( u, "holdposition" )
set fx = AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkTarget.mdl" )
call TriggerSleepAction(1.00)
call DestroyEffect(fx)
set fx = null
if RectContainsUnit(gg_rct_Battle_Regions, u) then
call ForGroupBJ( GetUnitsInRectOfPlayer(udg_BattleRegion[pid], Player(PLAYER_NEUTRAL_AGGRESSIVE)), function CleanupBattleUnit )
call EnumItemsInRectBJ( udg_BattleRegion[pid], function CleanupBattleItem )
endif
if not udg_InBattle then
call ToWorld(u)
endif
endfunction
function AirshipButtonFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
call TakeoffAirship(udg_MapHero[pid])
endfunction
function EquipmentButtonTooltipFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetText(MenuTooltipText, "Equipment")
endif
endfunction
function PackButtonTooltipFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetText(MenuTooltipText, "Pack")
endif
endfunction
function ReturnButtonTooltipFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetText(MenuTooltipText, "Return")
endif
endfunction
function AirshipButtonTooltipFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetText(MenuTooltipText, "Airship")
endif
endfunction
function MainFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
call UnequipMain(udg_MapHero[pid])
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetEnable(MainItem, false)
call BlzFrameSetEnable(MainItem, true)
endif
endfunction
function MainTooltipFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
if udg_MainSlot[pid] != null then
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetText(TooltipsText, GetItemName(udg_MainSlot[pid])+"|n|n"+BlzGetItemDescription(udg_MainSlot[pid]))
endif
endif
endfunction
function OffhandFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
call UnequipOffhand(udg_MapHero[pid])
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetEnable(OffhandItem, false)
call BlzFrameSetEnable(OffhandItem, true)
endif
endfunction
function OffhandTooltipFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
if udg_OffhandSlot[pid] != null then
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetText(TooltipsText, GetItemName(udg_OffhandSlot[pid])+"|n|n"+BlzGetItemDescription(udg_OffhandSlot[pid]))
endif
endif
endfunction
function ArmorFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
call UnequipArmor(udg_MapHero[pid])
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetEnable(ArmorItem, false)
call BlzFrameSetEnable(ArmorItem, true)
endif
endfunction
function ArmorTooltipFunc takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
if udg_ArmorSlot[pid] != null then
if GetTriggerPlayer() == GetLocalPlayer() then
call BlzFrameSetText(TooltipsText, GetItemName(udg_ArmorSlot[pid])+"|n|n"+BlzGetItemDescription(udg_ArmorSlot[pid]))
endif
endif
endfunction
private function init takes nothing returns nothing
local real x = 0.136 / 2
local real y = 0.136 / 2
set P1Portrait = BlzCreateFrameByType("BACKDROP", "P1PortraitBackdrop", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 1)
call BlzFrameSetAbsPoint(P1Portrait, FRAMEPOINT_TOPLEFT, 0.00 - 1.85*x, 0.571550)
call BlzFrameSetAbsPoint(P1Portrait, FRAMEPOINT_BOTTOMRIGHT, 0.03 - 1.85*x, 0.540400)
call BlzFrameSetTexture(P1Portrait, "ReplaceableTextures\\CommandButtons\\BTNVillagerMan.blp", 0, true)
call BlzFrameSetVisible(P1Portrait, false)
set P1Bar = BlzCreateFrameByType("SIMPLESTATUSBAR", "", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 0)
call BlzFrameSetAbsPoint(P1Bar, FRAMEPOINT_TOPLEFT, 0.00 - 1.85*x, 0.540400)
call BlzFrameSetAbsPoint(P1Bar, FRAMEPOINT_BOTTOMRIGHT, 0.03 - 1.85*x, 0.538400)
call BlzFrameSetTexture(P1Bar, "replaceabletextures\\teamcolor\\teamcolor00", 0, true)
call BlzFrameSetValue(P1Bar, 100)
call BlzFrameSetVisible(P1Bar, false)
set P2Portrait = BlzCreateFrameByType("BACKDROP", "P2PortraitBackdrop", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 1)
call BlzFrameSetAbsPoint(P2Portrait, FRAMEPOINT_TOPLEFT, 0.031 - 1.85*x, 0.571550)
call BlzFrameSetAbsPoint(P2Portrait, FRAMEPOINT_BOTTOMRIGHT, 0.061 - 1.85*x, 0.540400)
call BlzFrameSetTexture(P2Portrait, "ReplaceableTextures\\CommandButtons\\BTNVillagerMan.blp", 0, true)
call BlzFrameSetVisible(P2Portrait, false)
set P2Bar = BlzCreateFrameByType("SIMPLESTATUSBAR", "", BlzGetFrameByName("ConsoleUI", 0), "", 0)
call BlzFrameSetAbsPoint(P2Bar, FRAMEPOINT_TOPLEFT, 0.031 - 1.85*x, 0.540400)
call BlzFrameSetAbsPoint(P2Bar, FRAMEPOINT_BOTTOMRIGHT, 0.061 - 1.85*x, 0.538400)
call BlzFrameSetTexture(P2Bar, "replaceabletextures\\teamcolor\\teamcolor01", 0, true)
call BlzFrameSetValue(P2Bar, 100)
call BlzFrameSetVisible(P2Bar, false)
set P3Portrait = BlzCreateFrameByType("BACKDROP", "P3PortraitBackdrop", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 1)
call BlzFrameSetAbsPoint(P3Portrait, FRAMEPOINT_TOPLEFT, 0.062 - 1.85*x, 0.571550)
call BlzFrameSetAbsPoint(P3Portrait, FRAMEPOINT_BOTTOMRIGHT, 0.092 - 1.85*x, 0.540400)
call BlzFrameSetTexture(P3Portrait, "ReplaceableTextures\\CommandButtons\\BTNVillagerMan.blp", 0, true)
call BlzFrameSetVisible(P3Portrait, false)
set P3Bar = BlzCreateFrameByType("SIMPLESTATUSBAR", "", BlzGetFrameByName("ConsoleUI", 0), "", 0)
call BlzFrameSetAbsPoint(P3Bar, FRAMEPOINT_TOPLEFT, 0.062 - 1.85*x, 0.540400)
call BlzFrameSetAbsPoint(P3Bar, FRAMEPOINT_BOTTOMRIGHT, 0.092 - 1.85*x, 0.538400)
call BlzFrameSetTexture(P3Bar, "replaceabletextures\\teamcolor\\teamcolor02", 0, true)
call BlzFrameSetValue(P3Bar, 100)
call BlzFrameSetVisible(P3Bar, false)
set P4Portrait = BlzCreateFrameByType("BACKDROP", "P4PortraitBackdrop", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 1)
call BlzFrameSetAbsPoint(P4Portrait, FRAMEPOINT_TOPLEFT, 0.093 - 1.85*x, 0.571550)
call BlzFrameSetAbsPoint(P4Portrait, FRAMEPOINT_BOTTOMRIGHT, 0.123 - 1.85*x, 0.540400)
call BlzFrameSetTexture(P4Portrait, "ReplaceableTextures\\CommandButtons\\BTNVillagerMan.blp", 0, true)
call BlzFrameSetVisible(P4Portrait, false)
set P4Bar = BlzCreateFrameByType("SIMPLESTATUSBAR", "", BlzGetFrameByName("ConsoleUI", 0), "", 0)
call BlzFrameSetAbsPoint(P4Bar, FRAMEPOINT_TOPLEFT, 0.093 - 1.85*x, 0.540400)
call BlzFrameSetAbsPoint(P4Bar, FRAMEPOINT_BOTTOMRIGHT, 0.123 - 1.85*x, 0.538400)
call BlzFrameSetTexture(P4Bar, "replaceabletextures\\teamcolor\\teamcolor03", 0, true)
call BlzFrameSetValue(P4Bar, 100)
call BlzFrameSetVisible(P4Bar, false)
set P5Portrait = BlzCreateFrameByType("BACKDROP", "P5PortraitBackdrop", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 1)
call BlzFrameSetAbsPoint(P5Portrait, FRAMEPOINT_TOPLEFT, 0.124 - 1.85*x, 0.571550)
call BlzFrameSetAbsPoint(P5Portrait, FRAMEPOINT_BOTTOMRIGHT, 0.154 - 1.85*x, 0.540400)
call BlzFrameSetTexture(P5Portrait, "ReplaceableTextures\\CommandButtons\\BTNVillagerMan.blp", 0, true)
call BlzFrameSetVisible(P5Portrait, false)
set P5Bar = BlzCreateFrameByType("SIMPLESTATUSBAR", "", BlzGetFrameByName("ConsoleUI", 0), "", 0)
call BlzFrameSetAbsPoint(P5Bar, FRAMEPOINT_TOPLEFT, 0.124 - 1.85*x, 0.540400)
call BlzFrameSetAbsPoint(P5Bar, FRAMEPOINT_BOTTOMRIGHT, 0.154 - 1.85*x, 0.538400)
call BlzFrameSetTexture(P5Bar, "replaceabletextures\\teamcolor\\teamcolor04", 0, true)
call BlzFrameSetValue(P5Bar, 100)
call BlzFrameSetVisible(P5Bar, false)
set P6Portrait = BlzCreateFrameByType("BACKDROP", "P6PortraitBackdrop", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 1)
call BlzFrameSetAbsPoint(P6Portrait, FRAMEPOINT_TOPLEFT, 0.155 - 1.85*x, 0.571550)
call BlzFrameSetAbsPoint(P6Portrait, FRAMEPOINT_BOTTOMRIGHT, 0.185 - 1.85*x, 0.540400)
call BlzFrameSetTexture(P6Portrait, "ReplaceableTextures\\CommandButtons\\BTNVillagerMan.blp", 0, true)
call BlzFrameSetVisible(P6Portrait, false)
set P6Bar = BlzCreateFrameByType("SIMPLESTATUSBAR", "", BlzGetFrameByName("ConsoleUI", 0), "", 0)
call BlzFrameSetAbsPoint(P6Bar, FRAMEPOINT_TOPLEFT, 0.155 - 1.85*x, 0.540400)
call BlzFrameSetAbsPoint(P6Bar, FRAMEPOINT_BOTTOMRIGHT, 0.185 - 1.85*x, 0.538400)
call BlzFrameSetTexture(P6Bar, "replaceabletextures\\teamcolor\\teamcolor05", 0, true)
call BlzFrameSetValue(P6Bar, 100)
call BlzFrameSetVisible(P6Bar, false)
set P7Portrait = BlzCreateFrameByType("BACKDROP", "P7PortraitBackdrop", BlzGetFrameByName("ConsoleUIBackdrop", 0), "", 1)
call BlzFrameSetAbsPoint(P7Portrait, FRAMEPOINT_TOPLEFT, 0.186 - 1.85*x, 0.571550)
call BlzFrameSetAbsPoint(P7Portrait, FRAMEPOINT_BOTTOMRIGHT, 0.216 - 1.85*x, 0.540400)
call BlzFrameSetTexture(P7Portrait, "ReplaceableTextures\\CommandButtons\\BTNVillagerMan.blp", 0, true)
call BlzFrameSetVisible(P7Portrait, false)
set P7Bar = BlzCreateFrameByType("SIMPLESTATUSBAR", "", BlzGetFrameByName("ConsoleUI", 0), "", 0)
call BlzFrameSetAbsPoint(P7Bar, FRAMEPOINT_TOPLEFT, 0.186 - 1.85*x, 0.540400)
call BlzFrameSetAbsPoint(P7Bar, FRAMEPOINT_BOTTOMRIGHT, 0.216 - 1.85*x, 0.538400)
call BlzFrameSetTexture(P7Bar, "replaceabletextures\\teamcolor\\teamcolor06", 0, true)
call BlzFrameSetValue(P7Bar, 100)
call BlzFrameSetVisible(P7Bar, false)
set MenuTooltip = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0)
call BlzFrameSetAbsPoint(MenuTooltip, FRAMEPOINT_TOPLEFT, 0.150000, 0.190000)
call BlzFrameSetAbsPoint(MenuTooltip, FRAMEPOINT_BOTTOMRIGHT, 0.222200, 0.160000)
set MenuTooltipText = BlzCreateFrameByType("TEXT", "MyScriptDialogButtonTooltip", MenuTooltip, "", 0)
call BlzFrameSetPoint(MenuTooltipText, FRAMEPOINT_BOTTOMLEFT, MenuTooltip, FRAMEPOINT_BOTTOMLEFT, 0.01, 0.01)
call BlzFrameSetPoint(MenuTooltipText, FRAMEPOINT_TOPRIGHT, MenuTooltip, FRAMEPOINT_TOPRIGHT, -0.01, -0.01)
call BlzFrameSetEnable(MenuTooltipText, false)
call BlzFrameSetText(MenuTooltipText, "Tooltip")
set Equipment = BlzCreateFrame("EscMenuBackdrop", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0),0,0)
call BlzFrameSetAbsPoint(Equipment, FRAMEPOINT_TOPLEFT, 0.498200, 0.440500)
call BlzFrameSetAbsPoint(Equipment, FRAMEPOINT_BOTTOMRIGHT, 0.603200, 0.289500)
call BlzFrameSetVisible(Equipment, false)
set EquipmentButton = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
call BlzFrameSetAbsPoint(EquipmentButton, FRAMEPOINT_TOPLEFT, 0.156500, 0.142000)
call BlzFrameSetAbsPoint(EquipmentButton, FRAMEPOINT_BOTTOMRIGHT, 0.175630, 0.123700)
set EquipmentButtonBackdrop = BlzCreateFrameByType("BACKDROP", "EquipmentButtonBackdrop", EquipmentButton, "", 1)
call BlzFrameSetAllPoints(EquipmentButtonBackdrop, EquipmentButton)
call BlzFrameSetTexture(EquipmentButtonBackdrop, "ReplaceableTextures\\CommandButtons\\BTNGlove.blp", 0, true)
set EquipmentButtonTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(EquipmentButtonTrigger, EquipmentButton, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(EquipmentButtonTrigger, function EquipmentButtonFunc)
set EquipmentButtonTooltipTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(EquipmentButtonTooltipTrigger, EquipmentButton, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(EquipmentButtonTooltipTrigger, function EquipmentButtonTooltipFunc)
set PackButton = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
call BlzFrameSetAbsPoint(PackButton, FRAMEPOINT_TOPLEFT, 0.156500, 0.120950)
call BlzFrameSetAbsPoint(PackButton, FRAMEPOINT_BOTTOMRIGHT, 0.175630, 0.102400)
set PackButtonBackdrop = BlzCreateFrameByType("BACKDROP", "PackButtonBackdrop", PackButton, "", 1)
call BlzFrameSetAllPoints(PackButtonBackdrop, PackButton)
call BlzFrameSetTexture(PackButtonBackdrop, "ReplaceableTextures\\CommandButtons\\BTNDustOfAppearance.blp", 0, true)
set PackButtonTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(PackButtonTrigger, PackButton, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(PackButtonTrigger, function PackButtonFunc)
set PackButtonTooltipTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(PackButtonTooltipTrigger, PackButton, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(PackButtonTooltipTrigger, function PackButtonTooltipFunc)
set ReturnButton = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
call BlzFrameSetAbsPoint(ReturnButton, FRAMEPOINT_TOPLEFT, 0.156500, 0.0991700)
call BlzFrameSetAbsPoint(ReturnButton, FRAMEPOINT_BOTTOMRIGHT, 0.175630, 0.0806400)
set ReturnButtonBackdrop = BlzCreateFrameByType("BACKDROP", "ReturnButtonBackdrop", ReturnButton, "", 1)
call BlzFrameSetAllPoints(ReturnButtonBackdrop, ReturnButton)
call BlzFrameSetTexture(ReturnButtonBackdrop, "ReplaceableTextures\\CommandButtons\\BTNSpy.blp", 0, true)
set ReturnHilite = BlzCreateFrameByType("SPRITE", " ReturnHilite ", ReturnButton, "", 0)
call BlzFrameSetAllPoints(ReturnHilite, ReturnButton)
call BlzFrameSetModel(ReturnHilite, "UI\\Feedback\\Autocast\\UI-ModalButtonOn.mdl", 0)
call BlzFrameSetScale(ReturnHilite, 0.5)
set ReturnButtonTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(ReturnButtonTrigger, ReturnButton, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(ReturnButtonTrigger, function ReturnButtonFunc)
set ReturnButtonTooltipTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(ReturnButtonTooltipTrigger, ReturnButton, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(ReturnButtonTooltipTrigger, function ReturnButtonTooltipFunc)
call BlzFrameSetVisible(ReturnButton, false)
set AirshipButton = BlzCreateFrame("ScriptDialogButton", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
call BlzFrameSetAbsPoint(AirshipButton, FRAMEPOINT_TOPLEFT, 0.156500, 0.0766200)
call BlzFrameSetAbsPoint(AirshipButton, FRAMEPOINT_BOTTOMRIGHT, 0.175630, 0.0579900)
set AirshipButtonBackdrop = BlzCreateFrameByType("BACKDROP", "AirshipButtonBackdrop", AirshipButton, "", 1)
call BlzFrameSetAllPoints(AirshipButtonBackdrop, AirshipButton)
call BlzFrameSetTexture(AirshipButtonBackdrop, "ReplaceableTextures\\CommandButtons\\BTNSacredRelic.blp", 0, true)
set AirshipButtonTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(AirshipButtonTrigger, AirshipButton, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(AirshipButtonTrigger, function AirshipButtonFunc)
set AirshipButtonTooltipTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(AirshipButtonTooltipTrigger, AirshipButton, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(AirshipButtonTooltipTrigger, function AirshipButtonTooltipFunc)
call BlzFrameSetVisible(AirshipButton, false)
call BlzFrameSetTooltip(EquipmentButton, MenuTooltip)
call BlzFrameSetTooltip(PackButton, MenuTooltip)
call BlzFrameSetTooltip(ReturnButton, MenuTooltip)
call BlzFrameSetTooltip(AirshipButton, MenuTooltip)
set Main = BlzCreateFrameByType("BACKDROP", " Main ", Equipment, "", 1)
call BlzFrameSetAbsPoint(Main, FRAMEPOINT_TOPLEFT, 0.515300, 0.402990)
call BlzFrameSetAbsPoint(Main, FRAMEPOINT_BOTTOMRIGHT, 0.550290, 0.368000)
call BlzFrameSetTexture(Main, "war3mapImported\\MainSlot.dds", 0, true)
set MainItem = BlzCreateFrame("ScriptDialogButton", Main, 0, 0)
call BlzFrameSetAbsPoint(MainItem, FRAMEPOINT_TOPLEFT, 0.517800, 0.401030)
call BlzFrameSetAbsPoint(MainItem, FRAMEPOINT_BOTTOMRIGHT, 0.548520, 0.370300)
set MainItemBackdrop = BlzCreateFrameByType("BACKDROP", " MainItem ", MainItem, "", 1)
call BlzFrameSetAllPoints(MainItemBackdrop, MainItem)
call BlzFrameSetTexture(MainItemBackdrop, "null.blp", 0, true)
call BlzFrameSetVisible(MainItem, false)
set MainTrigger = CreateTrigger()
set MainTooltipTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(MainTrigger, MainItem, FRAMEEVENT_CONTROL_CLICK)
call BlzTriggerRegisterFrameEvent(MainTooltipTrigger, MainItem, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(MainTrigger, function MainFunc)
call TriggerAddAction(MainTooltipTrigger, function MainTooltipFunc)
set Offhand = BlzCreateFrameByType("BACKDROP", " Offhand ", Equipment, "", 1)
call BlzFrameSetAbsPoint(Offhand, FRAMEPOINT_TOPLEFT, 0.551100, 0.402990)
call BlzFrameSetAbsPoint(Offhand, FRAMEPOINT_BOTTOMRIGHT, 0.586090, 0.368000)
call BlzFrameSetTexture(Offhand, "war3mapImported\\OffhandSlot.dds", 0, true)
set OffhandItem = BlzCreateFrame("ScriptDialogButton", Offhand, 0, 0)
call BlzFrameSetAbsPoint(OffhandItem, FRAMEPOINT_TOPLEFT, 0.552800, 0.401030)
call BlzFrameSetAbsPoint(OffhandItem, FRAMEPOINT_BOTTOMRIGHT, 0.583520, 0.370300)
set OffhandItemBackdrop = BlzCreateFrameByType("BACKDROP", " OffhandItem ", OffhandItem, "", 1)
call BlzFrameSetAllPoints(OffhandItemBackdrop, OffhandItem)
call BlzFrameSetTexture(OffhandItemBackdrop, "null.blp", 0, true)
call BlzFrameSetVisible(OffhandItem, false)
set OffhandTrigger = CreateTrigger()
set OffhandTooltipTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(OffhandTrigger, OffhandItem, FRAMEEVENT_CONTROL_CLICK)
call BlzTriggerRegisterFrameEvent(OffhandTooltipTrigger, OffhandItem, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(OffhandTrigger, function OffhandFunc)
call TriggerAddAction(OffhandTooltipTrigger, function OffhandTooltipFunc)
set Armor = BlzCreateFrameByType("BACKDROP", " Armor ", Equipment, "", 1)
call BlzFrameSetAbsPoint(Armor, FRAMEPOINT_TOPLEFT, 0.533200, 0.367190)
call BlzFrameSetAbsPoint(Armor, FRAMEPOINT_BOTTOMRIGHT, 0.568190, 0.332200)
call BlzFrameSetTexture(Armor, "war3mapImported\\ArmorSlot.dds", 0, true)
set ArmorItem = BlzCreateFrame("ScriptDialogButton", Armor, 0, 0)
call BlzFrameSetAbsPoint(ArmorItem, FRAMEPOINT_TOPLEFT, 0.535700, 0.365230)
call BlzFrameSetAbsPoint(ArmorItem, FRAMEPOINT_BOTTOMRIGHT, 0.566420, 0.334500)
set ArmorItemBackdrop = BlzCreateFrameByType("BACKDROP", " ArmorItem ", ArmorItem, "", 1)
call BlzFrameSetAllPoints(ArmorItemBackdrop, ArmorItem)
call BlzFrameSetTexture(ArmorItemBackdrop, "null.blp", 0, true)
call BlzFrameSetVisible(ArmorItem, false)
set ArmorTrigger = CreateTrigger()
set ArmorTooltipTrigger = CreateTrigger()
call BlzTriggerRegisterFrameEvent(ArmorTrigger, ArmorItem, FRAMEEVENT_CONTROL_CLICK)
call BlzTriggerRegisterFrameEvent(ArmorTooltipTrigger, ArmorItem, FRAMEEVENT_MOUSE_ENTER)
call TriggerAddAction(ArmorTrigger, function ArmorFunc)
call TriggerAddAction(ArmorTooltipTrigger, function ArmorTooltipFunc)
set TitleButton = BlzCreateFrame("ScriptDialogButton", Equipment,0,0)
call BlzFrameSetAbsPoint(TitleButton, FRAMEPOINT_TOPLEFT, 0.509300, 0.431140)
call BlzFrameSetAbsPoint(TitleButton, FRAMEPOINT_BOTTOMRIGHT, 0.592070, 0.408100)
call BlzFrameSetText(TitleButton, "Equipment")
set Tooltips = BlzCreateFrame("QuestButtonBaseTemplate", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0, 0)
call BlzFrameSetAbsPoint(Tooltips, FRAMEPOINT_TOPLEFT, 0.605700, 0.440600)
call BlzFrameSetAbsPoint(Tooltips, FRAMEPOINT_BOTTOMRIGHT, 0.798600, 0.289500)
call BlzFrameSetTooltip(MainItem, Tooltips)
call BlzFrameSetTooltip(OffhandItem, Tooltips)
call BlzFrameSetTooltip(ArmorItem, Tooltips)
set TooltipsText = BlzCreateFrameByType("TEXT", "MyScriptDialogButtonTooltip", Tooltips, "", 0)
call BlzFrameSetPoint(TooltipsText, FRAMEPOINT_BOTTOMLEFT, Tooltips, FRAMEPOINT_BOTTOMLEFT, 0.01, 0.01)
call BlzFrameSetPoint(TooltipsText, FRAMEPOINT_TOPRIGHT, Tooltips, FRAMEPOINT_TOPRIGHT, -0.01, -0.01)
call BlzFrameSetEnable(TooltipsText, false)
call BlzFrameSetText(TooltipsText, "Tooltip")
set X = BlzCreateFrameByType("BACKDROP", "X", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 1)
call BlzFrameSetAbsPoint(X, FRAMEPOINT_TOPLEFT, 0.682400, 0.0672800)
call BlzFrameSetAbsPoint(X, FRAMEPOINT_BOTTOMRIGHT, 0.700590, 0.0481900)
call BlzFrameSetTexture(X, "war3mapImported\\X.dds", 0, true)
call BlzFrameSetEnable(X, false)
set E = BlzCreateFrameByType("BACKDROP", "E", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 1)
call BlzFrameSetAbsPoint(E, FRAMEPOINT_TOPLEFT, 0.726100, 0.0672800)
call BlzFrameSetAbsPoint(E, FRAMEPOINT_BOTTOMRIGHT, 0.744290, 0.0481900)
call BlzFrameSetTexture(E, "war3mapImported\\E.dds", 0, true)
call BlzFrameSetEnable(E, false)
set R = BlzCreateFrameByType("BACKDROP", "R", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 1)
call BlzFrameSetAbsPoint(R, FRAMEPOINT_TOPLEFT, 0.769700, 0.0672900)
call BlzFrameSetAbsPoint(R, FRAMEPOINT_BOTTOMRIGHT, 0.787890, 0.0482000)
call BlzFrameSetTexture(R, "war3mapImported\\R.dds", 0, true)
call BlzFrameSetEnable(R, false)
set Q = BlzCreateFrameByType("BACKDROP", "Q", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 1)
call BlzFrameSetAbsPoint(Q, FRAMEPOINT_TOPLEFT, 0.638800, 0.0228490)
call BlzFrameSetAbsPoint(Q, FRAMEPOINT_BOTTOMRIGHT, 0.657780, 0.00386900)
call BlzFrameSetTexture(Q, "war3mapImported\\Q.dds", 0, true)
call BlzFrameSetEnable(Q, false)
set W = BlzCreateFrameByType("BACKDROP", "W", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 1)
call BlzFrameSetAbsPoint(W, FRAMEPOINT_TOPLEFT, 0.682400, 0.0230730)
call BlzFrameSetAbsPoint(W, FRAMEPOINT_BOTTOMRIGHT, 0.700590, 0.00398300)
call BlzFrameSetTexture(W, "war3mapImported\\W.dds", 0, true)
call BlzFrameSetEnable(W, false)
set D = BlzCreateFrameByType("BACKDROP", "D", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 1)
call BlzFrameSetAbsPoint(D, FRAMEPOINT_TOPLEFT, 0.725800, 0.0230840)
call BlzFrameSetAbsPoint(D, FRAMEPOINT_BOTTOMRIGHT, 0.743990, 0.00399400)
call BlzFrameSetTexture(D, "war3mapImported\\D.dds", 0, true)
call BlzFrameSetEnable(D, false)
set F = BlzCreateFrameByType("BACKDROP", "F", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 1)
call BlzFrameSetAbsPoint(F, FRAMEPOINT_TOPLEFT, 0.769200, 0.0230840)
call BlzFrameSetAbsPoint(F, FRAMEPOINT_BOTTOMRIGHT, 0.787390, 0.00399400)
call BlzFrameSetTexture(F, "war3mapImported\\F.dds", 0, true)
call BlzFrameSetEnable(F, false)
set Minimap = BlzCreateFrameByType("BACKDROP", "minimap", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(Minimap, 0.136, 0.136)
call BlzFrameSetPoint(Minimap, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_CENTER, 0.0, 0.0)
call BlzFrameSetTexture(Minimap, "war3mapImported\\warquestmap.dds",0, true)
set Battle = BlzCreateFrameByType("BACKDROP", "battle", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(Battle, 0.015, 0.015)
call BlzFrameSetPoint(Battle, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_CENTER, 0.0, 0.0)
call BlzFrameSetTexture(Battle, "war3mapImported\\battle.dds",0, true)
set P7 = BlzCreateFrameByType("BACKDROP", "p7", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(P7, 0.008, 0.008)
call BlzFrameSetPoint(P7, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x, y)
call BlzFrameSetTexture(P7, "war3mapImported\\p7.dds",0, true)
set P6 = BlzCreateFrameByType("BACKDROP", "p6", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(P6, 0.008, 0.008)
call BlzFrameSetPoint(P6, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x, y)
call BlzFrameSetTexture(P6, "war3mapImported\\p6.dds",0, true)
set P5 = BlzCreateFrameByType("BACKDROP", "p5", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(P5, 0.008, 0.008)
call BlzFrameSetPoint(P5, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x, y)
call BlzFrameSetTexture(P5, "war3mapImported\\p5.dds",0, true)
set P4 = BlzCreateFrameByType("BACKDROP", "p4", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(P4, 0.008, 0.008)
call BlzFrameSetPoint(P4, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x, y)
call BlzFrameSetTexture(P4, "war3mapImported\\p4.dds",0, true)
set P3 = BlzCreateFrameByType("BACKDROP", "p3", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(P3, 0.008, 0.008)
call BlzFrameSetPoint(P3, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x, y)
call BlzFrameSetTexture(P3, "war3mapImported\\p3.dds",0, true)
set P2 = BlzCreateFrameByType("BACKDROP", "p2", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(P2, 0.008, 0.008)
call BlzFrameSetPoint(P2, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x, y)
call BlzFrameSetTexture(P2, "war3mapImported\\p2.dds",0, true)
set P1 = BlzCreateFrameByType("BACKDROP", "p1", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
call BlzFrameSetSize(P1, 0.008, 0.008)
call BlzFrameSetPoint(P1, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x, y)
call BlzFrameSetTexture(P1, "war3mapImported\\p1.dds",0, true)
endfunction
endlibrary
function UpdateUI takes nothing returns nothing
local boolean playing
local real x
local real y
local real worldMinX = GetRectMinX(gg_rct_World_Map)
local real worldMinY = GetRectMinY(gg_rct_World_Map)
local real worldX = GetRectMaxX(gg_rct_World_Map) - worldMinX
local real worldY = GetRectMaxY(gg_rct_World_Map) - worldMinY
set x = (GetUnitX(udg_MapBattle) - worldMinX) / worldX
set y = (GetUnitY(udg_MapBattle) - worldMinY) / worldY
call BlzFrameSetPoint(Battle, FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x*0.136+.001, y*0.136+.003)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 7
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if udg_MapShip[bj_forLoopAIndex] != null then
set x = (GetUnitX(udg_MapShip[bj_forLoopAIndex]) - worldMinX) / worldX
set y = (GetUnitY(udg_MapShip[bj_forLoopAIndex]) - worldMinY) / worldY
elseif RectContainsUnit(gg_rct_World_Map, udg_MapHero[bj_forLoopAIndex]) then
set x = (GetUnitX(udg_MapHero[bj_forLoopAIndex]) - worldMinX) / worldX
set y = (GetUnitY(udg_MapHero[bj_forLoopAIndex]) - worldMinY) / worldY
else
set x = (GetLocationX(udg_MapLocation[bj_forLoopAIndex]) - worldMinX) / worldX
set y = (GetLocationY(udg_MapLocation[bj_forLoopAIndex]) - worldMinY) / worldY
endif
call BlzFrameSetPoint(BlzGetFrameByName("p" + I2S(bj_forLoopAIndex), 0), FRAMEPOINT_CENTER, BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), FRAMEPOINT_BOTTOMLEFT, x*0.136+.001, y*0.136+.002)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call BlzFrameSetValue(P1Bar, GetUnitLifePercent(udg_MapHero[1]))
call BlzFrameSetValue(P2Bar, GetUnitLifePercent(udg_MapHero[2]))
call BlzFrameSetValue(P3Bar, GetUnitLifePercent(udg_MapHero[3]))
call BlzFrameSetValue(P4Bar, GetUnitLifePercent(udg_MapHero[4]))
call BlzFrameSetValue(P5Bar, GetUnitLifePercent(udg_MapHero[5]))
call BlzFrameSetValue(P6Bar, GetUnitLifePercent(udg_MapHero[6]))
call BlzFrameSetValue(P7Bar, GetUnitLifePercent(udg_MapHero[7]))
call BlzFrameSetTexture(P1Portrait, BlzGetAbilityIcon(GetUnitTypeId(udg_MapHero[1])), 0, true)
call BlzFrameSetTexture(P2Portrait, BlzGetAbilityIcon(GetUnitTypeId(udg_MapHero[2])), 0, true)
call BlzFrameSetTexture(P3Portrait, BlzGetAbilityIcon(GetUnitTypeId(udg_MapHero[3])), 0, true)
call BlzFrameSetTexture(P4Portrait, BlzGetAbilityIcon(GetUnitTypeId(udg_MapHero[4])), 0, true)
call BlzFrameSetTexture(P5Portrait, BlzGetAbilityIcon(GetUnitTypeId(udg_MapHero[5])), 0, true)
call BlzFrameSetTexture(P6Portrait, BlzGetAbilityIcon(GetUnitTypeId(udg_MapHero[6])), 0, true)
call BlzFrameSetTexture(P7Portrait, BlzGetAbilityIcon(GetUnitTypeId(udg_MapHero[7])), 0, true)
set playing = GetPlayerSlotState(ConvertedPlayer(1)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerSlotState(ConvertedPlayer(1)) != PLAYER_SLOT_STATE_LEFT
call BlzFrameSetVisible(P1Portrait, playing)
call BlzFrameSetVisible(P1Bar, playing)
set playing = GetPlayerSlotState(ConvertedPlayer(2)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerSlotState(ConvertedPlayer(2)) != PLAYER_SLOT_STATE_LEFT
call BlzFrameSetVisible(P2Portrait, playing)
call BlzFrameSetVisible(P2Bar, playing)
set playing = GetPlayerSlotState(ConvertedPlayer(3)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerSlotState(ConvertedPlayer(3)) != PLAYER_SLOT_STATE_LEFT
call BlzFrameSetVisible(P3Portrait, playing)
call BlzFrameSetVisible(P3Bar, playing)
set playing = GetPlayerSlotState(ConvertedPlayer(4)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerSlotState(ConvertedPlayer(4)) != PLAYER_SLOT_STATE_LEFT
call BlzFrameSetVisible(P4Portrait, playing)
call BlzFrameSetVisible(P4Bar, playing)
set playing = GetPlayerSlotState(ConvertedPlayer(5)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerSlotState(ConvertedPlayer(5)) != PLAYER_SLOT_STATE_LEFT
call BlzFrameSetVisible(P5Portrait, playing)
call BlzFrameSetVisible(P5Bar, playing)
set playing = GetPlayerSlotState(ConvertedPlayer(6)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerSlotState(ConvertedPlayer(6)) != PLAYER_SLOT_STATE_LEFT
call BlzFrameSetVisible(P6Portrait, playing)
call BlzFrameSetVisible(P6Bar, playing)
set playing = GetPlayerSlotState(ConvertedPlayer(7)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerSlotState(ConvertedPlayer(7)) != PLAYER_SLOT_STATE_LEFT
call BlzFrameSetVisible(P7Portrait, playing)
call BlzFrameSetVisible(P7Bar, playing)
call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP, 0), false)
call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP_BUTTON, 0), false)
call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP_BUTTON, 1), false)
call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP_BUTTON, 2), false)
call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_MINIMAP_BUTTON, 3), false)
endfunction
function ToggleHotkeycard takes nothing returns nothing
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
local boolean selected = IsUnitSelected(udg_MapHero[pid], GetTriggerPlayer()) and not IsUnitSelected(udg_Pack[pid], GetTriggerPlayer())
if GetLocalPlayer() == GetTriggerPlayer() then
call BlzFrameSetVisible(X, selected)
call BlzFrameSetVisible(E, selected)
call BlzFrameSetVisible(R, selected)
call BlzFrameSetVisible(Q, selected)
call BlzFrameSetVisible(W, selected)
call BlzFrameSetVisible(D, selected)
call BlzFrameSetVisible(F, selected)
endif
endfunction