[gui]Damage Engine
Acontecimientos
Partida - UnitIndexEvent becomes Igual a 1.00
Partida - UnitIndexEvent becomes Igual a 2.00
Condiciones
Acciones
-------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
Set DamageBlockingAbility = Bonificación de atributo (8 niveles)
-------- Copy the Detect Spell Damage Ability from Object Editor into your map and set the following variable respectively: --------
Set SpellDamageAbility = Reacción SUPREMO
-------- - --------
-------- You can add extra classifications here if you want to differentiate between your triggered damage --------
-------- Use DamageTypeExplosive (or any negative value damage type) if you want a unit killed by that damage to explode --------
Set DamageTypeExplosive = -1
Set DamageTypeCriticalStrike = 1
Set DamageTypeHeal = 2
Set DamageTypeReduced = 3
Set DamageTypeBlocked = 4
-------- - --------
Custom script: call ExecuteFunc("InitDamageEvent")
Custom script: endfunction
Custom script: function DmgEvAmplifyCheck takes nothing returns nothing
-------- The next if/else blocks handles magic damage modification --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
(DamageEventTarget is EtÃ

rea) Igual a True
(DamageEventTarget is Un hÃ

roe) Igual a False
Entonces: Acciones
Set DamageEventAmount = (DamageEventAmount x 1.67)
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
(Level of Gracia de Elune for DamageEventTarget) Mayor que 0
Entonces: Acciones
Set DamageEventAmount = (DamageEventAmount x 0.80)
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
(DamageEventTarget is Un hÃ

roe) Igual a True
(DamageEventTarget has an item of type Brazales rúnicos) Igual a True
Entonces: Acciones
Set DamageEventAmount = (DamageEventAmount x 0.67)
Otros: Acciones
Custom script: endfunction
-------- - --------
-------- The next conditions let you filter out units you don't want detection for. By default, units with Locust will not pass the check. --------
-------- - --------
Custom script: function DmgEvFilter takes nothing returns boolean
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
(DmgEvUnit is Una estructura) Igual a False
Entonces: Acciones
Custom script: return GetUnitAbilityLevel(udg_DmgEvUnit, 'Aloc') == 0
Otros: Acciones
Custom script: return false
Custom script: endfunction
Custom script: function DmgEvResetVars takes nothing returns nothing
Set DmgEvRecursionN = (DmgEvRecursionN - 1)
Set DamageEventPrevAmt = LastDmgPrevAmount[DmgEvRecursionN]
Set DamageEventAmount = LastDmgValue[DmgEvRecursionN]
Set DamageEventSource = LastDmgSource[DmgEvRecursionN]
Set DamageEventTarget = LastDmgTarget[DmgEvRecursionN]
Set IsDamageSpell = LastDmgWasSpell[DmgEvRecursionN]
Set DamageEventType = LastDmgPrevType[DmgEvRecursionN]
Custom script: endfunction
Custom script: function CheckDamagedLifeEvent takes nothing returns nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DoNotClearNext Igual a False
Entonces: Acciones
Set NextDamageOverride = False
Set NextDamageType = 0
Otros: Acciones
Set DoNotClearNext = False
Custom script: if udg_DmgEvTrig != null then
Custom script: call DestroyTrigger(udg_DmgEvTrig)
Custom script: set udg_DmgEvTrig = null
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
IsDamageSpell Igual a True
Entonces: Acciones
Unidad - Set life of DamageEventTarget to (Max(LastDamageHP, 0.41))
Custom script: if udg_LastDamageHP <= 0.405 then
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventType Menor que 0
Entonces: Acciones
Unidad - Make DamageEventTarget Explotar on death
Otros: Acciones
Detonador - Turn off DamageEventTrigger
-------- Kill the unit --------
Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, -999, false, false, null, DAMAGE_TYPE_UNIVERSAL, null)
Detonador - Turn on DamageEventTrigger
Custom script: endif
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
(Level of DamageBlockingAbility for DamageEventTarget) Mayor que 0
Entonces: Acciones
Unidad - Remove DamageBlockingAbility from DamageEventTarget
Unidad - Set life of DamageEventTarget to LastDamageHP
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventAmount No igual a 0.00
Entonces: Acciones
Set AfterDamageEvent = 0.00
Set AfterDamageEvent = 1.00
Set AfterDamageEvent = 0.00
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DmgEvRecursionN Mayor que 0
Entonces: Acciones
Custom script: call DmgEvResetVars()
Otros: Acciones
Custom script: endif
Custom script: endfunction
Custom script: function DmgEvOnExpire takes nothing returns nothing
Set DmgEvStarted = False
Custom script: call CheckDamagedLifeEvent()
Custom script: endfunction
Custom script: function OnDmgEv takes nothing returns nothing
Custom script: local boolean clear = false
Custom script: local boolean override = udg_DamageEventOverride
Custom script: local code c = function CheckDamagedLifeEvent
Set DoNotClearNext = True
Custom script: call CheckDamagedLifeEvent() //in case the unit state event failed and the 0.00 second timer hasn't yet expired
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DmgEvRunning Igual a True
Entonces: Acciones
Set DmgEvRecursionLevel = (DmgEvRecursionLevel + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DmgEvRecursionLevel Menor que 16
Entonces: Acciones
Set LastDmgPrevAmount[DmgEvRecursionN] = DamageEventPrevAmt
Set LastDmgValue[DmgEvRecursionN] = DamageEventAmount
Set LastDmgSource[DmgEvRecursionN] = DamageEventSource
Set LastDmgTarget[DmgEvRecursionN] = DamageEventTarget
Set LastDmgWasSpell[DmgEvRecursionN] = IsDamageSpell
Set LastDmgPrevType[DmgEvRecursionN] = DamageEventType
Set DmgEvRecursionN = (DmgEvRecursionN + 1)
Otros: Acciones
-------- Delete the next couple of lines to disable the in-game recursion crash warnings --------
Secuencia cinematográfica - Clear the screen of text messages for (All players)
Partida - Display to (All players) for 999.00 seconds the text: WARNING: Recursion ...
Skip remaining actions
Otros: Acciones
Set DmgEvRunning = True
Custom script: set clear = true
Set DamageEventAmount = (Damage taken)
Set DamageEventSource = (Damage source)
Set DamageEventTarget = (Triggering unit)
Set DamageEventPrevAmt = (Abs(DamageEventAmount))
Set DamageEventType = NextDamageType
Set NextDamageType = 0
Set DamageEventOverride = NextDamageOverride
Set NextDamageOverride = False
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventAmount Igual a 0.00
Entonces: Acciones
Set DamageEvent = 0.00
Set DamageEvent = 2.00
Set DamageEvent = 0.00
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DmgEvStarted Igual a False
Entonces: Acciones
Set DmgEvStarted = True
Custom script: call TimerStart(udg_DmgEvTimer, 0.00, false, function DmgEvOnExpire)
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventAmount Menor que 0.00
Entonces: Acciones
Set DamageEventAmount = (0.00 - DamageEventAmount)
Set IsDamageSpell = True
Custom script: call DmgEvAmplifyCheck()
Otros: Acciones
Set IsDamageSpell = False
Set DamageModifierEvent = 0.00
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventOverride Igual a False
Entonces: Acciones
Set DamageModifierEvent = 1.00
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventOverride Igual a False
Entonces: Acciones
Set DamageModifierEvent = 2.00
Set DamageModifierEvent = 3.00
Otros: Acciones
Custom script: set udg_DamageEventOverride = override
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventAmount Mayor que 0.01
Entonces: Acciones
Set DamageModifierEvent = 4.00
Otros: Acciones
Set DamageModifierEvent = 0.00
Set DamageEvent = 0.00
Set DamageEvent = 1.00
Set DamageEvent = 0.00
Custom script: call CheckDamagedLifeEvent() //in case the unit state event failed from a recursive damage event
-------- Process damage modification --------
Set DmgEvLife = (Vida of DamageEventTarget)
Custom script: set udg_DmgEvTrig = CreateTrigger()
Custom script: call TriggerAddCondition(udg_DmgEvTrig, Filter(c))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
IsDamageSpell Igual a False
Entonces: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventAmount No igual a DamageEventPrevAmt
Entonces: Acciones
Set DmgEvLife = ((DmgEvLife + DamageEventPrevAmt) - DamageEventAmount)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
(Vida máx. of DamageEventTarget) Menor que DmgEvLife
Entonces: Acciones
Set LastDamageHP = (DmgEvLife - DamageEventPrevAmt)
Unidad - Add DamageBlockingAbility to DamageEventTarget
Otros: Acciones
Unidad - Set life of DamageEventTarget to (Max(DmgEvLife, 0.42))
Otros: Acciones
Detonador - Add to DmgEvTrig the event (Unidad - DamageEventTarget's life becomes Menor que (Max(0.41, (DmgEvLife - (DamageEventPrevAmt / 2.00)))))
Otros: Acciones
Set LastDamageHP = (Vida máx. of DamageEventTarget)
Set DmgEvPrevLife = DmgEvLife
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
(DmgEvLife + (DamageEventPrevAmt x 0.75)) Mayor que LastDamageHP
Entonces: Acciones
Set DmgEvLife = (Max((LastDamageHP - (DamageEventPrevAmt / 2.00)), 1.00))
Unidad - Set life of DamageEventTarget to DmgEvLife
Set DmgEvLife = ((DmgEvLife + LastDamageHP) / 2.00)
Otros: Acciones
Set DmgEvLife = (DmgEvLife + (DamageEventPrevAmt x 0.50))
Set LastDamageHP = (DmgEvPrevLife - (DamageEventPrevAmt - (DamageEventPrevAmt - DamageEventAmount)))
Detonador - Add to DmgEvTrig the event (Unidad - DamageEventTarget's life becomes Mayor que DmgEvLife)
Custom script: if clear then
Set DmgEvRunning = False
Set DmgEvRecursionLevel = 0
Custom script: elseif udg_DamageEventPrevAmt == 0.00 then
Custom script: call DmgEvResetVars()
Custom script: endif
Custom script: endfunction
Custom script: function CreateDmgEv takes nothing returns nothing
Custom script: local code c = function OnDmgEv
Custom script: set udg_DamageEventTrigger = CreateTrigger()
Custom script: call TriggerAddCondition(udg_DamageEventTrigger, Filter(c))
Custom script: endfunction
Custom script: function SetupDmgEv takes nothing returns nothing
Custom script: local integer pdex = udg_UDex
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
UnitIndexEvent Igual a 1.00
Entonces: Acciones
Set DmgEvUnit = UDexUnits[UDex]
Custom script: if DmgEvFilter() then
Set UnitDamageRegistered[UDex] = True
Detonador - Add to DamageEventTrigger the event (Unidad - DmgEvUnit Recibe daño)
Unidad - Add SpellDamageAbility to DmgEvUnit
Custom script: call UnitMakeAbilityPermanent(udg_DmgEvUnit, true, udg_SpellDamageAbility)
Custom script: endif
Otros: Acciones
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
UnitDamageRegistered[UDex] Igual a True
Entonces: Acciones
Set UnitDamageRegistered[UDex] = False
Set DamageEventsWasted = (DamageEventsWasted + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
DamageEventsWasted Igual a 32
Entonces: Acciones
Set DamageEventsWasted = 0
Custom script: call DestroyTrigger(udg_DamageEventTrigger)
Custom script: call CreateDmgEv()
Set UDex = UDexNext[0]
Custom script: loop
Custom script: exitwhen udg_UDex == 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Si: Condiciones
UnitDamageRegistered[UDex] Igual a True
Entonces: Acciones
Detonador - Add to DamageEventTrigger the event (Unidad - UDexUnits[UDex] Recibe daño)
Otros: Acciones
Set UDex = UDexNext[UDex]
Custom script: endloop
Custom script: set udg_UDex = pdex
Otros: Acciones
Otros: Acciones
Custom script: endfunction
Custom script: function InitDamageEvent takes nothing returns nothing
Custom script: local code c = function CheckDamagedLifeEvent
Custom script: set udg_ClearDamageEvent = CreateTrigger()
Custom script: call TriggerAddCondition(udg_ClearDamageEvent, Filter(c))
For each (Integer A) from 1 to 16, do (Actions)
Bucle: Acciones
Jugador - Desactivar SpellDamageAbility for (Player((Integer A)))
Custom script: call CreateDmgEv()
Custom script: set c = function SetupDmgEv
Set UnitIndexerEnabled = False
Custom script: set udg_DmgEvUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
Set UnitIndexerEnabled = True
Unidad - Add DamageBlockingAbility to DmgEvUnit
Unidad - Add SpellDamageAbility to DmgEvUnit
Unidad - Remove DmgEvUnit from the game
Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(c))
Detonador - Run (This trigger) (checking conditions)
Cuenta atrás del reloj - Start DmgEvTimer as a Un tiro timer that will expire in 0.00 seconds
Detonador - Turn off ClearDamageEvent
[/gui]