Moderator
M
Moderator
|
Configuration

Events


Map initialization

Conditions

Actions


-------- Note: There are some fields that do not increase on levelups by default but are configurable. --------


-------- Those fields not present here are within the Object Editor, such as; --------


-------- HDA Cast Range, Cast Time, Ability Cooldowns, Salvation Duration --------


-------- -------------------------------------------- --------


-------- Ability itself --------


Set Config_HD_Ability = Holy Deliverance Aura


-------- Spellbook for the Aura --------


Set Config_HD_SpellBook = Deliverance (Spellbook)


-------- Dummy Type --------


Set Config_HD_DummyID = Dummy


-------- Dummy Ability --------


Set Config_HD_SalvationDummy = Deliverance (Salvation)


-------- Salvation Buff --------


Set Config_HD_SalvationBuff = Holy Deliverance Aura (Salvation)


-------- -------------------------------------------- --------


-------- -------------------------------------------- --------


-------- Aura Range --------


-------- -------------------------------------------- --------


Set Config_HD_Range[1] = 750.00


Set Config_HD_Range[2] = 750.00


Set Config_HD_Range[3] = 750.00


-------- -------------------------------------------- --------


-------- Area for Heal Splash --------


-------- -------------------------------------------- --------


Set Config_HD_HealArea[1] = 200.00


Set Config_HD_HealArea[2] = 250.00


Set Config_HD_HealArea[3] = 300.00


-------- -------------------------------------------- --------


-------- Heal base amount --------


-------- -------------------------------------------- --------


Set Config_HD_HealBase[1] = 75.00


Set Config_HD_HealBase[2] = 100.00


Set Config_HD_HealBase[1] = 125.00


-------- -------------------------------------------- --------


-------- Cooldown of the heal --------


-------- -------------------------------------------- --------


Set Config_HD_HealCD[1] = 7.00


Set Config_HD_HealCD[2] = 6.00


Set Config_HD_HealCD[3] = 5.00


-------- -------------------------------------------- --------


-------- Cooldown reduction of the passive heal per damage instance --------


-------- -------------------------------------------- --------


Set Config_HD_HealCDRed[1] = 0.25


Set Config_HD_HealCDRed[2] = 0.25


Set Config_HD_HealCDRed[3] = 0.25


-------- -------------------------------------------- --------


-------- Special Effect for Heal --------


-------- -------------------------------------------- --------


Set Config_HD_HealFx = Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl


-------- -------------------------------------------- --------


-------- Heal Int Scale Percent, in decimal --------


-------- -------------------------------------------- --------


Set Config_HD_HealScale[1] = 2.00


Set Config_HD_HealScale[2] = 2.00


Set Config_HD_HealScale[3] = 2.00


-------- -------------------------------------------- --------


-------- Percentage Healing received by splashed units, in decimal --------


-------- -------------------------------------------- --------


Set Config_HD_HealSplash[1] = 0.25


Set Config_HD_HealSplash[2] = 0.25


Set Config_HD_HealSplash[3] = 0.25


-------- -------------------------------------------- --------


-------- Trigger Fire Rate in seconds --------


-------- -------------------------------------------- --------


Set Config_HD_Rate = 0.50


-------- -------------------------------------------- --------


-------- Regeneration Base --------


-------- -------------------------------------------- --------


Set Config_HD_RegenBase[1] = 1.25


Set Config_HD_RegenBase[2] = 1.50


Set Config_HD_RegenBase[3] = 1.75


-------- -------------------------------------------- --------


-------- Regeneration for every 10% missing health --------


-------- -------------------------------------------- --------


Set Config_HD_Regeneration[1] = 0.50


Set Config_HD_Regeneration[2] = 0.50


Set Config_HD_Regeneration[3] = 0.50


-------- -------------------------------------------- --------


-------- Salvation Healing Bonus Percentage, in Decimal --------


-------- -------------------------------------------- --------


Set Config_HD_SalvationBonus[1] = 0.50


Set Config_HD_SalvationBonus[2] = 0.50


Set Config_HD_SalvationBonus[3] = 0.50


-------- -------------------------------------------- --------


-------- How many heals to trigger salvation --------


-------- -------------------------------------------- --------


Set Config_HD_SalvationCounter[1] = 4


Set Config_HD_SalvationCounter[2] = 4


Set Config_HD_SalvationCounter[3] = 4


-------- -------------------------------------------- --------


-------- Salvation Fx --------


-------- -------------------------------------------- --------


Set Config_HD_SalvationFx = Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl


-------- -------------------------------------------- --------


-------- Salvation Heal Fx --------


-------- -------------------------------------------- --------


Set Config_HD_SalvationReverseFx = HolyRestoration.mdx


-------- -------------------------------------------- --------


-------- End of configurables --------


-------- -------------------------------------------- --------


Custom script: call TriggerRegisterTimerEvent(gg_trg_Deliverance_Aura, udg_Config_HD_Rate, true)


Custom script: set udg_Config_HD_RegenBase[1] = udg_Config_HD_RegenBase[1] * udg_Config_HD_Rate


Custom script: set udg_Config_HD_RegenBase[2] = udg_Config_HD_RegenBase[2] * udg_Config_HD_Rate


Custom script: set udg_Config_HD_RegenBase[3] = udg_Config_HD_RegenBase[3] * udg_Config_HD_Rate


-------- ----------------------- --------


-------- Variable Creator --------


-------- !Delete actions below after copying! --------


-------- ----------------------- --------


Set HD_Caster[HD_Index] = (Triggering unit)


Set HD_Dummy = (Triggering unit)


Set HD_Group[A] = (Last created unit group)


Set HD_Player[A] = (Picked player)


Set HD_HealCD[A] = 0.00


Set HD_HealCounter[A] = 0


Set HD_Level[A] = 0
//////////////////////////////////////////////////////////////////////////////
// _ _ __ _ //
// | |_| || _\ /_\ //
// | _ |||_))/ _ \ //
// |_| |_||__//_/ \_\ //
// //
// Holy Deliverance Aura v 1.4 //
// by CakeMaster //
// //
//////////////////////////////////////////////////////////////////////////////
function HD_RadarCondition takes nothing returns boolean
return GetWidgetLife(GetFilterUnit()) > 0.405 and GetWidgetLife(GetFilterUnit()) != GetUnitState(GetFilterUnit(), UNIT_STATE_MAX_LIFE) and IsUnitAlly(GetFilterUnit(), udg_HD_Player[udg_A]) == true
endfunction
function HD_Setup takes nothing returns boolean
//On init
local integer i = -1
loop
set i = i + 1
exitwhen i == 15
call SetPlayerAbilityAvailable(Player(i), udg_Config_HD_SpellBook, false)
endloop
set udg_HD_Dummy = CreateUnit(Player(0), udg_Config_HD_DummyID, 0., 0., 0.)
call UnitAddAbility(udg_HD_Dummy, udg_Config_HD_SalvationDummy)
return false
endfunction
function HD_LearnedCache takes nothing returns boolean
local integer i = 0
local integer c = 0
local unit u = GetTriggerUnit()
//After a hero learns, cache his data
if GetLearnedSkill() == udg_Config_HD_Ability then
loop
set i = i + 1
exitwhen i > udg_HD_Index
if udg_HD_Caster[udg_A] == u then
set udg_HD_Level[udg_A] = udg_HD_Level[udg_A] + 1
else
set c = c + 1
endif
endloop
if c == udg_HD_Index then
set udg_HD_Index = (udg_HD_Index + 1)
set udg_HD_Caster[udg_HD_Index] = u
set udg_HD_Group[udg_HD_Index] = CreateGroup()
set udg_HD_HealCD[udg_HD_Index] = 0.
set udg_HD_HealCounter[udg_HD_Index] = 0
set udg_HD_Player[udg_HD_Index] = GetOwningPlayer(udg_HD_Caster[udg_HD_Index])
set udg_HD_Level[udg_HD_Index] = 1
//Adds the buffer aura
call UnitAddAbility(udg_HD_Caster[udg_HD_Index], udg_Config_HD_SpellBook)
if udg_HD_Index == 1 then
call EnableTrigger(gg_trg_Deliverance_Aura)
endif
endif
endif
set u = null
return false
endfunction
function HD_Detect takes nothing returns boolean
local integer a = 0
//Buff check for Salvation (invul + deflect)
//If a unit already has the buff, it does not prevent from further dummy casts
if GetUnitAbilityLevel(udg_target, udg_Config_HD_SalvationBuff) > 0 then
call DestroyEffect(AddSpecialEffect(udg_Config_HD_SalvationReverseFx, GetUnitX(udg_target), GetUnitY(udg_target)))
call SetWidgetLife(udg_target, (GetWidgetLife(udg_target) + udg_amount))
set udg_amount = 0.
endif
//Buff Application
loop
set a = a + 1
exitwhen a > udg_HD_Index
//Heal CD Reduction
if IsUnitInGroup(udg_target, udg_HD_Group[a]) == true or IsUnitInGroup(udg_source, udg_HD_Group[a]) == true then
set udg_HD_HealCD[a] = udg_HD_HealCD[a] - udg_Config_HD_HealCDRed[udg_HD_Level[udg_A]]
endif
endloop
return false
endfunction
function HD_OnCast takes nothing returns boolean
local group g
local real real1 = 0
local real x
local real y
local unit u = GetTriggerUnit()
local unit u2
if GetSpellAbilityId() == udg_Config_HD_Ability then
set udg_A = 0
loop
set udg_A = udg_A + 1
exitwhen udg_A > udg_HD_Index
if udg_HD_Caster[udg_A] == u then
set u2 = GetSpellTargetUnit()
set x = GetUnitX(u2)
set y = GetUnitY(u2)
set real1 = udg_Config_HD_HealBase[udg_HD_Level[udg_A]] + (I2R(GetHeroInt(u, true)) * udg_Config_HD_HealScale[udg_HD_Level[udg_A]])
//Salvation
if udg_HD_HealCounter[udg_A] < udg_Config_HD_SalvationCounter[udg_HD_Level[udg_A]] then
set udg_HD_HealCounter[udg_A] = udg_HD_HealCounter[udg_A] + 1
call DestroyEffect(AddSpecialEffect(udg_Config_HD_HealFx, x, y))
else
set udg_HD_HealCounter[udg_A] = 0
set real1 = real1 * (1. + udg_Config_HD_SalvationBonus[udg_HD_Level[udg_A]])
call SetUnitOwner(udg_HD_Dummy, GetOwningPlayer(udg_HD_Caster[udg_A]), false)
call IssueTargetOrder(udg_HD_Dummy, "bloodlust", u2)
endif
//Heal
call SetWidgetLife(u2, (GetWidgetLife(u2) + real1))
set real1 = real1 * udg_Config_HD_HealSplash[udg_HD_Level[udg_A]]
set g = CreateGroup()
call GroupEnumUnitsInRange(g, x, y, udg_Config_HD_HealArea[udg_HD_Level[udg_A]], Condition(function HD_RadarCondition))
//Area Heal
loop
set u2 = FirstOfGroup(g)
exitwhen u2 == null
call SetWidgetLife(u2, (GetWidgetLife(u2) + real1))
call GroupRemoveUnit(g, u2)
endloop
call DestroyGroup(g)
endif
endloop
endif
set g = null
set u = null
return false
endfunction
function Holy_Deliverance takes nothing returns boolean
local real x
local real y
local group g
local unit u
local real real1
local real real2
local real real3 = 0.
local unit u2
set udg_A = 0
loop
set udg_A = udg_A + 1
exitwhen udg_A > udg_HD_Index
if GetWidgetLife(udg_HD_Caster[udg_A]) > 0.405 then
set x = GetUnitX(udg_HD_Caster[udg_A])
set y = GetUnitY(udg_HD_Caster[udg_A])
//Reduce Cooldown
if udg_HD_HealCD[udg_A] > 0. then
set udg_HD_HealCD[udg_A] = udg_HD_HealCD[udg_A] - udg_Config_HD_Rate
else
set udg_HD_HealCD[udg_A] = 0.
endif
//Group Enumeration
call GroupClear(udg_HD_Group[udg_A])
call GroupEnumUnitsInRange(udg_HD_Group[udg_A], x, y, udg_Config_HD_Range[udg_HD_Level[udg_A]], Condition(function HD_RadarCondition))
set g = CreateGroup()
call GroupEnumUnitsInRange(g, x, y, udg_Config_HD_Range[udg_HD_Level[udg_A]], Condition(function HD_RadarCondition))
set u2 = null
set real1 = 0. //Lowest Percentage Checker
set real2 = 100. //Record Tracker
//Check for units to heal
loop
set u = FirstOfGroup(g)
exitwhen u == null
//====================
//Regen
set real3 = GetWidgetLife(u)
set x = GetUnitState(u, UNIT_STATE_MAX_LIFE)
set y = ((((x - real3) / x) * 100.) * udg_Config_HD_Regeneration[udg_HD_Level[udg_A]]) + udg_Config_HD_RegenBase[udg_HD_Level[udg_A]]
call SetWidgetLife(u, (GetWidgetLife(u) + y))
//====================
//Lowest health% unit
set real1 = (real3 / x) * 100.0
//Hero priority
if IsUnitType(u, UNIT_TYPE_HERO) then
//Makes it appear that the hero has 5% less
set real1 = real1 - 5.
endif
if real1 < real2 then
set real2 = real1
set real1 = real2
set u2 = u
endif
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
//Radar Checks
if u2 == null then
call GroupClear(udg_HD_Group[udg_A])
//Group is only used for CD Reduction
else
if udg_HD_HealCD[udg_A] == 0. then
set udg_HD_HealCD[udg_A] = udg_Config_HD_HealCD[udg_HD_Level[udg_A]]
set x = GetUnitX(u2)
set y = GetUnitY(u2)
set real1 = udg_Config_HD_HealBase[udg_HD_Level[udg_A]] + (I2R(GetHeroInt(udg_HD_Caster[udg_A], true)) * udg_Config_HD_HealScale[udg_HD_Level[udg_A]])
//Salvation
if udg_HD_HealCounter[udg_A] < udg_Config_HD_SalvationCounter[udg_HD_Level[udg_A]] then
set udg_HD_HealCounter[udg_A] = udg_HD_HealCounter[udg_A] + 1
call DestroyEffect(AddSpecialEffect(udg_Config_HD_HealFx, x, y))
else
set udg_HD_HealCounter[udg_A] = 0
set real1 = real1 * (1. + udg_Config_HD_SalvationBonus[udg_HD_Level[udg_A]])
call SetUnitOwner(udg_HD_Dummy, GetOwningPlayer(udg_HD_Caster[udg_A]), false)
call IssueTargetOrder(udg_HD_Dummy, "bloodlust", u2)
endif
//Heal
call SetWidgetLife(u2, (GetWidgetLife(u2) + real1))
set real1 = real1 * udg_Config_HD_HealSplash[udg_HD_Level[udg_A]]
set g = CreateGroup()
call GroupEnumUnitsInRange(g, x, y, udg_Config_HD_HealArea[udg_HD_Level[udg_A]], Condition(function HD_RadarCondition))
//Area Heal
loop
set u = FirstOfGroup(g)
exitwhen u == null
call SetWidgetLife(u, (GetWidgetLife(u) + real1))
call GroupRemoveUnit(g, u)
endloop
endif
endif
call DestroyGroup(g)
else
call GroupClear(udg_HD_Group[udg_A])
endif
endloop
set g = null
return false
endfunction
//===========================================================================
function InitTrig_Deliverance_Aura takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(t, Condition(function HD_LearnedCache))
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function HD_OnCast))
call TimerStart(CreateTimer(),0.0,false,function HD_Setup)
set t = CreateTrigger()
call TriggerRegisterVariableEvent(t, "udg_damageEventTrigger", EQUAL, 1.)
call TriggerAddCondition(t, Condition(function HD_Detect))
set t = null
set gg_trg_Deliverance_Aura = CreateTrigger()
call DisableTrigger(gg_trg_Deliverance_Aura)
call TriggerAddCondition(gg_trg_Deliverance_Aura, Condition(function Holy_Deliverance))
endfunction