function GetHost takes nothing returns nothing
local gamecache g = InitGameCache("Map.w3v")
call StoreInteger ( g, "Map", "Host", GetPlayerId(GetLocalPlayer ())+1)
call TriggerSyncStart ()
call SyncStoredInteger ( g, "Map", "Host" )
call TriggerSyncReady ()
set udg_player_host = Player( GetStoredInteger ( g, "Map", "Host" )-1)
call FlushGameCache( g )
set g = null
endfunction
function DummyCastPoint takes player casterPlayer, integer casterSpell, location casterPos, location spellPos, string spellString returns nothing
local unit caster = CreateUnitAtLoc(casterPlayer, 'h004',casterPos,0.0)
call UnitAddAbility(caster, casterSpell)
call IssuePointOrderLoc(caster, spellString, spellPos)
call UnitApplyTimedLife(caster, 'BTLF', 1.0)
set caster = null
endfunction
function DummyCastPointTimed takes player casterPlayer, integer casterSpell, location casterPos, location spellPos, string spellString, real duration returns nothing
local unit caster = CreateUnitAtLoc(casterPlayer, 'h004',casterPos,0.0)
call UnitAddAbility(caster, casterSpell)
call IssuePointOrderLoc(caster, spellString, spellPos)
call UnitApplyTimedLife(caster, 'BTLF', duration)
set caster = null
endfunction
function GetPlayerColorString takes player p, integer n returns nothing
//Credits to Andrewgosu from TH for the color codes//
local playercolor c = GetPlayerColor(p)
if c == PLAYER_COLOR_RED then
set udg_color[n] = 1
elseif c == PLAYER_COLOR_BLUE then
set udg_color[n] = 2
elseif c == PLAYER_COLOR_CYAN then
set udg_color[n] = 3
elseif c == PLAYER_COLOR_PURPLE then
set udg_color[n] = 4
elseif c == PLAYER_COLOR_YELLOW then
set udg_color[n] = 5
elseif c == PLAYER_COLOR_ORANGE then
set udg_color[n] = 6
elseif c == PLAYER_COLOR_GREEN then
set udg_color[n] = 7
elseif c == PLAYER_COLOR_PINK then
set udg_color[n] = 8
elseif c == PLAYER_COLOR_LIGHT_GRAY then
set udg_color[n] = 9
elseif c == PLAYER_COLOR_LIGHT_BLUE then
set udg_color[n] = 10
elseif c == PLAYER_COLOR_AQUA then
set udg_color[n] = 11
elseif c == PLAYER_COLOR_BROWN then
set udg_color[n] = 12
endif
endfunction
function StringContainsString takes string str, string partial returns boolean
//Returns true if the full string is contained inside. Capitalization matters!
local integer i = 0
local integer l = StringLength(partial)
local integer l2 = StringLength(str)
loop
exitwhen i > l2
if SubString(str,i,i+l) == partial then
return true
endif
set i = i + 1
endloop
return false
endfunction
Name | Type | is_array | initial_value |
bool_ar | boolean | No | |
bool_flyingcastles | boolean | No | |
bool_game_started | boolean | No | |
bool_isDay | boolean | No | |
bool_mercs_only | boolean | No | |
bool_mode_input | boolean | No | |
bool_no_mercs | boolean | No | |
bool_no_spells | boolean | No | |
bool_nomusic | boolean | No | |
bool_nonights | boolean | No | |
bool_ready | boolean | Yes | |
bool_super_lever | boolean | No | |
color | integer | Yes | |
color_string | string | Yes | |
CorpseCounter | integer | No | |
CorpseGroup | group | Yes | |
CorpseTimer | timer | No | |
dialog_mode | dialog | No | |
game_mode | integer | No | |
gameOver | boolean | No | |
GDD__Integers | integer | Yes | |
GDD__LeftMapGroup | group | No | |
GDD__TriggerArray | trigger | Yes | |
GDD__UnitArray | unit | Yes | |
GDD_Damage | real | No | |
GDD_DamagedUnit | unit | No | |
GDD_DamageSource | unit | No | |
GDD_Event | real | No | |
group_AlliancePool | force | Yes | |
heroTimer | timer | Yes | |
heroTimerWindow | timerdialog | Yes | |
int_Day | integer | No | |
int_Neutral | integer | No | |
int_ready | integer | No | |
int_VassalCount | integer | Yes | |
item_Card | itemcode | Yes | |
lastStoredPoint | location | Yes | |
leaderboard | leaderboard | No | |
leaderboard_bottom_bitch | leaderboard | No | |
leaderboard_conqueror | leaderboard | No | |
leaderboard_highest_level | leaderboard | No | |
leaderboard_horde | leaderboard | No | |
leaderboard_int_bottom_bitch | integer | Yes | |
leaderboard_int_conqueror | integer | Yes | |
leaderboard_int_horde | integer | Yes | |
leaderboard_int_researcher | integer | Yes | |
leaderboard_int_slayer | integer | Yes | |
leaderboard_int_warlord | integer | Yes | |
leaderboard_researcher | leaderboard | No | |
leaderboard_slayer | leaderboard | No | |
leaderboard_warlord | leaderboard | No | |
mine_timer | timer | No | |
minimize_timer | timer | No | |
minimizeGroup | group | No | |
player_CanRebel | boolean | Yes | true |
player_host | player | No | |
player_Max | integer | No | 0 |
player_RealName | string | Yes | |
player_Title | string | Yes | |
playerColor | playercolor | Yes | |
playerHero | unit | Yes | |
playerLord | player | Yes | |
randomHero | unitcode | Yes | |
real_handicap | real | No | 60.00 |
real_RoundDuration | real | No | 180.00 |
real_xp_rate | real | No | 100.00 |
region_Arena | rect | Yes | |
region_Pick | rect | Yes | |
region_Player | rect | Yes | |
slein | boolean | No | |
starting_Food | integer | No | |
starting_Gold | integer | No | |
starting_Income | integer | No | 360 |
temp_int | integer | No | |
temp_int2 | integer | No | |
temp_Player | player | No | |
temp_PlayerGroup | force | No | |
temp_Point | location | No | |
temp_Point2 | location | No | |
temp_Real | real | No | |
temp_string | string | No | |
temp_Unit | unit | No | |
temp_unit_neutral | unitcode | Yes | |
temp_UnitGroup | group | No | |
temp_UnitGroup2 | group | No | |
temp_x | real | No | |
temp_y | real | No | |
tempPoint | location | No | |
timer_Fight | timer | No | |
timer_FightWindow | timerdialog | No | |
timer_Neutral | timer | No | |
timer_noNights | timer | No | |
timer_reinforcement_1 | timer | No | |
timer_reinforcement_2 | timer | No | |
timer_reinforcement_3 | timer | No | |
timer_reinforcement_spawn | timer | No | |
timer_Round | timer | No | |
timer_Round_2 | timer | No | |
timer_Round_3 | timer | No | |
timer_Round_4 | timer | No | |
timer_RoundWindow | timerdialog | No | |
timerwindow_noNights | timerdialog | No | |
unit_Circle | unit | Yes | |
unit_Neutral | unitcode | Yes | |
unit_Player | group | Yes | |
unit_playercastle | unit | Yes | |
unit_Resource | unit | Yes | |
unit_SerpentWard | unitcode | Yes | |
unit_Vault | unit | No | |
vault_timer | timer | No | |
weather_effect | integer | Yes | |
x | real | No | |
y | real | No |
// GUI-Friendly Damage Detection -- v1.2.1 -- by Weep
// http:// www.thehelper.net/forums/showthread.php?t=137957
//
// Requires: only this trigger and its variables.
//
// -- What? --
// This snippet provides a leak-free, GUI-friendly implementation of an "any unit takes
// damage" event. It requires no JASS knowledge to use.
//
// It uses the Game - Value Of Real Variable event as its method of activating other
// triggers, and passes the event responses through a few globals.
//
// -- Why? --
// The traditional GUI method of setting up a trigger than runs when any unit is damaged
// leaks trigger events. This snippet is easy to implement and removes the need to do
// you own GUI damage detection setup.
//
// -- How To Implement --
// 0. Before you copy triggers that use GDD into a new map, you need to copy over GDD
// with its GDD Variable Creator trigger, or there will be a problem: the variables
// won't be automatically created correctly.
//
// 1. Be sure "Automatically create unknown variables while pasting trigger data" is
// enabled in the World Editor general preferences.
// 2. Copy this trigger category ("GDD") and paste it into your map.
// (Alternately: create the variables listed in the globals block below, create a
// trigger named "GUI Friendly Damage Detection", and paste in this entire text.)
// 3. Create your damage triggers using Game - Value Of Real Variable as the event,
// select GDD_Event as the variable, and leave the rest of the settings to the default
// "becomes Equal to 0.00".
// The event responses are the following variables:
// GDD_Damage is the amount of damage, replacing Event Response - Damage Taken.
// GDD_DamagedUnit is the damaged unit, replacing Event Response - Triggering Unit.
// Triggering Unit can still be used, if you need to use waits.
// Read the -- Notes -- section below for more info.
// GDD_DamageSource is the damaging unit, replacing Event Response - Damage Source.
//
// -- Notes --
// GDD's event response variables are not wait-safe; you can't use them after a wait in
// a trigger. If you need to use waits, Triggering Unit (a.k.a. GetTriggerUnit()) can
// be used in place of GDD_DamageSource. There is no usable wait-safe equivalent to
// Event Damage or Damage Source; you'll need to save the values yourself.
//
// Don't write any values to the variables used as the event responses, or it will mess
// up any other triggers using this snippet for their triggering. Only use their values.
//
// This uses arrays, so can detect damage for a maximum of 8190 units at a time, and
// cleans up data at a rate of 33.33 per second, by default. This should be enough for
// most maps, but if you want to change the rate, change the value returned in the
// GDD_RecycleRate function at the top of the code, below.
//
// By default, GDD will not register units that have Locust at the moment of their
// entering the game, and will not recognize when they take damage (which can only
// happen if the Locust ability is later removed from the unit.) To allow a unit to have
// Locust yet still cause GDD damage events if Locust is removed, you can either design
// the unit to not have Locust by default and add it via triggers after creation, or
// edit the GDD_Filter function at the top of the code, below.
//
// -- Credits --
// Captain Griffin on wc3c.net for the research and concept of GroupRefresh.
//
// Credit in your map not needed, but please include this README.
//
// -- Version History --
// 1.2.1: Minor code cleaning. Added configuration functions. Updated documentation.
// 1.2.0: Made this snippet work properly with recursive damage.
// 1.1.1: Added a check in order to not index units with the Locust ability (dummy units).
// If you wish to check for damage taken by a unit that is unselectable, do not
// give the unit-type Locust in the object editor; instead, add the Locust ability
// 'Aloc' via a trigger after its creation, then remove it.
// 1.1.0: Added a check in case a unit gets moved out of the map and back.
// 1.0.0: First release.
//===================================================================
// Configurables.
function GDD_RecycleRate takes nothing returns real //The rate at which the system checks units to see if they've been removed from the game
return 0.03
endfunction
function GDD_Filter takes unit u returns boolean //The condition a unit has to pass to have it registered for damage detection
return GetUnitAbilityLevel(u, 'Aloc') == 0 //By default, the system ignores Locust units, because they normally can't take damage anyway
endfunction
//===================================================================
// This is just for reference.
// If you use JassHelper, you could uncomment this section instead of creating the variables in the trigger editor.
// globals
// real udg_GDD_Event = 0.
// real udg_GDD_Damage = 0.
// unit udg_GDD_DamagedUnit
// unit udg_GDD_DamageSource
// trigger array udg_GDD__TriggerArray
// integer array udg_GDD__Integers
// unit array udg_GDD__UnitArray
// group udg_GDD__LeftMapGroup = CreateGroup()
// endglobals
//===================================================================
// System code follows. Don't touch!
function GDD_Event takes nothing returns boolean
local unit damagedcache = udg_GDD_DamagedUnit
local unit damagingcache = udg_GDD_DamageSource
local real damagecache = udg_GDD_Damage
set udg_GDD_DamagedUnit = GetTriggerUnit()
set udg_GDD_DamageSource = GetEventDamageSource()
set udg_GDD_Damage = GetEventDamage()
set udg_GDD_Event = 1.
set udg_GDD_Event = 0.
set udg_GDD_DamagedUnit = damagedcache
set udg_GDD_DamageSource = damagingcache
set udg_GDD_Damage = damagecache
set damagedcache = null
set damagingcache = null
return false
endfunction
function GDD_AddDetection takes nothing returns boolean
// if(udg_GDD__Integers[0] > 8190) then
// call BJDebugMsg("GDD: Too many damage events! Decrease number of units present in the map or increase recycle rate.")
// ***Recycle rate is specified in the GDD_RecycleRate function at the top of the code. Smaller is faster.***
// return
// endif
if(IsUnitInGroup(GetFilterUnit(), udg_GDD__LeftMapGroup)) then
call GroupRemoveUnit(udg_GDD__LeftMapGroup, GetFilterUnit())
elseif(GDD_Filter(GetFilterUnit())) then
set udg_GDD__Integers[0] = udg_GDD__Integers[0]+1
set udg_GDD__UnitArray[udg_GDD__Integers[0]] = GetFilterUnit()
set udg_GDD__TriggerArray[udg_GDD__Integers[0]] = CreateTrigger()
call TriggerRegisterUnitEvent(udg_GDD__TriggerArray[udg_GDD__Integers[0]], udg_GDD__UnitArray[udg_GDD__Integers[0]], EVENT_UNIT_DAMAGED)
call TriggerAddCondition(udg_GDD__TriggerArray[udg_GDD__Integers[0]], Condition(function GDD_Event))
endif
return false
endfunction
function GDD_PreplacedDetection takes nothing returns nothing
local group g = CreateGroup()
local integer i = 0
loop
call GroupEnumUnitsOfPlayer(g, Player(i), Condition(function GDD_AddDetection))
set i = i+1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call DestroyGroup(g)
set g = null
endfunction
function GDD_GroupRefresh takes nothing returns nothing
// Based on GroupRefresh by Captain Griffen on wc3c.net
if (bj_slotControlUsed[5063] == true) then
call GroupClear(udg_GDD__LeftMapGroup)
set bj_slotControlUsed[5063] = false
endif
call GroupAddUnit(udg_GDD__LeftMapGroup, GetEnumUnit())
endfunction
function GDD_Recycle takes nothing returns nothing
if(udg_GDD__Integers[0] <= 0) then
return
elseif(udg_GDD__Integers[1] <= 0) then
set udg_GDD__Integers[1] = udg_GDD__Integers[0]
endif
if(GetUnitTypeId(udg_GDD__UnitArray[udg_GDD__Integers[1]]) == 0) then
call DestroyTrigger(udg_GDD__TriggerArray[udg_GDD__Integers[1]])
set udg_GDD__TriggerArray[udg_GDD__Integers[1]] = null
set udg_GDD__TriggerArray[udg_GDD__Integers[1]] = udg_GDD__TriggerArray[udg_GDD__Integers[0]]
set udg_GDD__UnitArray[udg_GDD__Integers[1]] = udg_GDD__UnitArray[udg_GDD__Integers[0]]
set udg_GDD__UnitArray[udg_GDD__Integers[0]] = null
set udg_GDD__Integers[0] = udg_GDD__Integers[0]-1
endif
set udg_GDD__Integers[1] = udg_GDD__Integers[1]-1
endfunction
function GDD_LeaveMap takes nothing returns boolean
local boolean cached = bj_slotControlUsed[5063]
if(udg_GDD__Integers[2] < 64) then
set udg_GDD__Integers[2] = udg_GDD__Integers[2]+1
else
set bj_slotControlUsed[5063] = true
call ForGroup(udg_GDD__LeftMapGroup, function GDD_GroupRefresh)
set udg_GDD__Integers[2] = 0
endif
call GroupAddUnit(udg_GDD__LeftMapGroup, GetFilterUnit())
set bj_slotControlUsed[5063] = cached
return false
endfunction
// ===========================================================================
function InitTrig_GUI_Friendly_Damage_Detection takes nothing returns nothing
local region r = CreateRegion()
call RegionAddRect(r, GetWorldBounds())
call TriggerRegisterEnterRegion(CreateTrigger(), r, Condition(function GDD_AddDetection))
call TriggerRegisterLeaveRegion(CreateTrigger(), r, Condition(function GDD_LeaveMap))
call GDD_PreplacedDetection()
call TimerStart(CreateTimer(), GDD_RecycleRate(), true, function GDD_Recycle)
set r = null
endfunction
function Trig_DamageDetection_Actions takes nothing returns nothing
set udg_GDD_DamagedUnit = BlzGetEventDamageTarget()
set udg_GDD_DamageSource = GetEventDamageSource()
set udg_GDD_Damage = GetEventDamage()
call ConditionalTriggerExecute( gg_trg_denyAllyDamage )
call ConditionalTriggerExecute( gg_trg_SystemShockFun )
call ConditionalTriggerExecute( gg_trg_DieHard )
call ConditionalTriggerExecute( gg_trg_CoatArmsInvuln )
call ConditionalTriggerExecute( gg_trg_CleavingStrikeHit )
call ConditionalTriggerExecute( gg_trg_preventCastleDamage )
call ConditionalTriggerExecute( gg_trg_RedDragonAttack )
call ConditionalTriggerExecute( gg_trg_BronzeDragonAttack )
call ConditionalTriggerExecute( gg_trg_BlackDragonAttack )
call ConditionalTriggerExecute( gg_trg_GreenDragonAttack )
call ConditionalTriggerExecute( gg_trg_NetherDragonAttack )
call ConditionalTriggerExecute( gg_trg_ToughCarapaceLoss )
call ConditionalTriggerExecute( gg_trg_MutatingAttack )
call ConditionalTriggerExecute( gg_trg_PiercingShotVisuals )
endfunction
//===========================================================================
function InitTrig_DamageDetection takes nothing returns nothing
local integer index
set gg_trg_DamageDetection = CreateTrigger( )
set index = 0
loop
call TriggerRegisterPlayerUnitEvent( gg_trg_DamageDetection, Player(index), EVENT_PLAYER_UNIT_DAMAGED, null )
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddAction( gg_trg_DamageDetection, function Trig_DamageDetection_Actions )
endfunction
function Trig_RedDragonAttack_Func001C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A04F', udg_GDD_DamageSource) > 0 ) ) then
return false
endif
if (BlzGetEventIsAttack() == false) then
return false
endif
return true
endfunction
function Trig_RedDragonAttack_Conditions takes nothing returns boolean
if ( not Trig_RedDragonAttack_Func001C() ) then
return false
endif
return true
endfunction
function Trig_RedDragonAttack_Actions takes nothing returns nothing
set udg_temp_Point = GetUnitLoc(udg_GDD_DamagedUnit)
call CreateNUnitsAtLoc( 1, 'h00I', GetOwningPlayer(udg_GDD_DamageSource), udg_temp_Point, bj_UNIT_FACING )
call BlzSetUnitBaseDamage( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceNumber( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceSides( GetLastCreatedUnit(), 0, 0 )
call UnitAddAbilityBJ( 'AIf2', GetLastCreatedUnit() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", udg_GDD_DamagedUnit )
call RemoveLocation( udg_temp_Point )
endfunction
//===========================================================================
function InitTrig_RedDragonAttack takes nothing returns nothing
set gg_trg_RedDragonAttack = CreateTrigger( )
call TriggerAddCondition( gg_trg_RedDragonAttack, Condition( function Trig_RedDragonAttack_Conditions ) )
call TriggerAddAction( gg_trg_RedDragonAttack, function Trig_RedDragonAttack_Actions )
endfunction
function Trig_BlackDragonAttack_Conditions takes nothing returns boolean
if (GetUnitAbilityLevelSwapped('A04H', udg_GDD_DamageSource) < 1) then
return false
endif
if (BlzGetEventIsAttack() == false) then
return false
endif
return true
endfunction
function Trig_BlackDragonAttack_Actions takes nothing returns nothing
set udg_temp_Point = GetUnitLoc(udg_GDD_DamagedUnit)
call CreateNUnitsAtLoc( 1, 'h00I', GetOwningPlayer(udg_GDD_DamageSource), udg_temp_Point, bj_UNIT_FACING )
call BlzSetUnitBaseDamage( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceNumber( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceSides( GetLastCreatedUnit(), 0, 0 )
call UnitAddAbilityBJ( 'A04K', GetLastCreatedUnit() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "doom", udg_GDD_DamagedUnit )
call RemoveLocation( udg_temp_Point )
endfunction
//===========================================================================
function InitTrig_BlackDragonAttack takes nothing returns nothing
set gg_trg_BlackDragonAttack = CreateTrigger( )
call TriggerAddCondition( gg_trg_BlackDragonAttack, Condition( function Trig_BlackDragonAttack_Conditions ) )
call TriggerAddAction( gg_trg_BlackDragonAttack, function Trig_BlackDragonAttack_Actions )
endfunction
function Trig_BronzeDragonAttack_Func001C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A04E', udg_GDD_DamageSource) > 0 ) ) then
return false
endif
if (BlzGetEventIsAttack() == false) then
return false
endif
return true
endfunction
function Trig_BronzeDragonAttack_Conditions takes nothing returns boolean
if ( not Trig_BronzeDragonAttack_Func001C() ) then
return false
endif
return true
endfunction
function Trig_BronzeDragonAttack_Actions takes nothing returns nothing
set udg_temp_Point = GetUnitLoc(udg_GDD_DamagedUnit)
call CreateNUnitsAtLoc( 1, 'h004', GetOwningPlayer(udg_GDD_DamageSource), udg_temp_Point, bj_UNIT_FACING )
call UnitAddAbilityBJ( 'A040', GetLastCreatedUnit() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "purge", udg_GDD_DamagedUnit )
call RemoveLocation( udg_temp_Point )
endfunction
//===========================================================================
function InitTrig_BronzeDragonAttack takes nothing returns nothing
set gg_trg_BronzeDragonAttack = CreateTrigger( )
call TriggerAddCondition( gg_trg_BronzeDragonAttack, Condition( function Trig_BronzeDragonAttack_Conditions ) )
call TriggerAddAction( gg_trg_BronzeDragonAttack, function Trig_BronzeDragonAttack_Actions )
endfunction
function Trig_GreenDragonAttack_Func001C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A01W', udg_GDD_DamageSource) > 0 ) ) then
return false
endif
if (BlzGetEventIsAttack() == false) then
return false
endif
return true
endfunction
function Trig_GreenDragonAttack_Conditions takes nothing returns boolean
if ( not Trig_GreenDragonAttack_Func001C() ) then
return false
endif
return true
endfunction
function Trig_GreenDragonAttack_Actions takes nothing returns nothing
set udg_temp_Point = GetUnitLoc(udg_GDD_DamagedUnit)
call CreateNUnitsAtLoc( 1, 'h00I', GetOwningPlayer(udg_GDD_DamageSource), udg_temp_Point, bj_UNIT_FACING )
call BlzSetUnitBaseDamage( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceNumber( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceSides( GetLastCreatedUnit(), 0, 0 )
call UnitAddAbilityBJ( 'A042', GetLastCreatedUnit() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", udg_GDD_DamagedUnit )
call RemoveLocation( udg_temp_Point )
endfunction
//===========================================================================
function InitTrig_GreenDragonAttack takes nothing returns nothing
set gg_trg_GreenDragonAttack = CreateTrigger( )
call TriggerAddCondition( gg_trg_GreenDragonAttack, Condition( function Trig_GreenDragonAttack_Conditions ) )
call TriggerAddAction( gg_trg_GreenDragonAttack, function Trig_GreenDragonAttack_Actions )
endfunction
function Trig_NetherDragonAttack_Func001C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A02X', udg_GDD_DamageSource) > 0 ) ) then
return false
endif
if (BlzGetEventIsAttack() == false) then
return false
endif
return true
endfunction
function Trig_NetherDragonAttack_Conditions takes nothing returns boolean
if ( not Trig_NetherDragonAttack_Func001C() ) then
return false
endif
return true
endfunction
function Trig_NetherDragonAttack_Actions takes nothing returns nothing
set udg_temp_Point = GetUnitLoc(udg_GDD_DamagedUnit)
call CreateNUnitsAtLoc( 1, 'h00I', GetOwningPlayer(udg_GDD_DamageSource), udg_temp_Point, bj_UNIT_FACING )
call BlzSetUnitBaseDamage( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceNumber( GetLastCreatedUnit(), 0, 0 )
call BlzSetUnitDiceSides( GetLastCreatedUnit(), 0, 0 )
call UnitAddAbilityBJ( 'A046', GetLastCreatedUnit() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "attack", udg_GDD_DamagedUnit )
call RemoveLocation( udg_temp_Point )
endfunction
//===========================================================================
function InitTrig_NetherDragonAttack takes nothing returns nothing
set gg_trg_NetherDragonAttack = CreateTrigger( )
call TriggerAddCondition( gg_trg_NetherDragonAttack, Condition( function Trig_NetherDragonAttack_Conditions ) )
call TriggerAddAction( gg_trg_NetherDragonAttack, function Trig_NetherDragonAttack_Actions )
endfunction
function Trig_CleavingStrike_Copy_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A02V' ) ) then
return false
endif
return true
endfunction
function Trig_CleavingStrike_Copy_Func002001 takes unit un returns boolean
return ( UnitHasBuffBJ(un, 'B00L') == false )
endfunction
function Trig_CleavingStrike_Copy_Actions takes nothing returns nothing
local unit a = GetSpellAbilityUnit()
call UnitAddAbilityBJ( 'A02P', a )
loop
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
exitwhen ( Trig_CleavingStrike_Copy_Func002001(a) )
endloop
call UnitRemoveAbilityBJ( 'A02P', a)
set a = null
endfunction
//===========================================================================
function InitTrig_CleavingStrike_Copy takes nothing returns nothing
set gg_trg_CleavingStrike_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_CleavingStrike_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_CleavingStrike_Copy, Condition( function Trig_CleavingStrike_Copy_Conditions ) )
call TriggerAddAction( gg_trg_CleavingStrike_Copy, function Trig_CleavingStrike_Copy_Actions )
endfunction
function Trig_ToughCarapaceLoss_Conditions takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A049', udg_GDD_DamagedUnit) > 0 ) ) then
return false
endif
if (BlzGetEventIsAttack() == false) then
return false
endif
return true
endfunction
function Trig_ToughCarapaceLoss_Actions takes nothing returns nothing
call DecUnitAbilityLevelSwapped( 'A049', udg_GDD_DamagedUnit )
endfunction
//===========================================================================
function InitTrig_ToughCarapaceLoss takes nothing returns nothing
set gg_trg_ToughCarapaceLoss = CreateTrigger( )
call TriggerAddCondition( gg_trg_ToughCarapaceLoss, Condition( function Trig_ToughCarapaceLoss_Conditions ) )
call TriggerAddAction( gg_trg_ToughCarapaceLoss, function Trig_ToughCarapaceLoss_Actions )
endfunction