Добавлен , опубликован
Решил снова поиграться с героями и вот один из них.
Нимбедо - герой поддержки

Способности

Огненная бомба - Нимбедо при каждой атаке выпускает огненный шар, который взрывается в точке атаки, наносит урон равный 200% интеллекта в 200 АоЕ и отскакивает от 1-5 целей.
Код способности
function Trig_FireBomb_Actions takes nothing returns nothing
    local unit Caster = GetAttacker()
    local unit Target = GetTriggerUnit()
    local real x0 = GetUnitX(Caster)
    local real y0 = GetUnitY(Caster)
    local real x1 = GetUnitX(Target)
    local real y1 = GetUnitY(Target) 
    local real d = SquareRoot( (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) )
    local real h = d / 4
    local real h0 = GetUnitZ(Caster) + 175.0
    local real h1 = GetUnitFlyHeight(Target)
    local real a = bj_RADTODEG * Atan2(y1 - y0, x1 - x0)
    local player Owner = GetOwningPlayer(Caster)
    local timer Timer = CreateTimer()
    local integer id = GetHandleId(Timer)
    local unit dummy = CreateUnit(GetOwningPlayer(Caster), FireBombUnitId, x0/* + 100.0 * Cos(a * bj_DEGTORAD)*/, y0/* + 100.0 * Sin(a * bj_DEGTORAD)*/, a)
    
    if GetUnitAbilityLevel(Caster, 'A00K') == 0 then
        call UnitAddAbility(Caster, 'A00K')
    endif
    
    call SetUnitAnimation(Caster, "spell")
    
    call ShowUnit(dummy, false) 
    
    call TimerStart(Timer, 0.03, true, function FireBomb_Move)
    
    call SaveUnitHandle(H, id, StringHash("Fire Bomb"), dummy)
    call SaveUnitHandle(H, id, 'Targ', Target)
    call SaveReal(H, id, StringHash("Start X"), x0)
    call SaveReal(H, id, StringHash("Start Y"), y0)
    call SaveReal(H, id, StringHash("End X"), x1)
    call SaveReal(H, id, StringHash("End Y"), y1)
    call SaveReal(H, id, StringHash("Distance"), d)
    call SaveReal(H, id, StringHash("Max Height"), h)
    call SaveReal(H, id, StringHash("Start Height"), h0)
    call SaveReal(H, id, StringHash("End Height"), h1)
    call SaveReal(H, id, 'time', 0.0)
    call SaveEffectHandle(H, id, 'effe', AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl", Caster, "weapon"))
    call SaveInteger(H, GetHandleId(dummy), 'boun', GetUnitAbilityLevel(Caster, FireBomb) + GetUnitAbilityLevel(Caster, 'A00H') * 2)
    call SaveUnitHandle(H, GetHandleId(dummy), 'nimb', Caster)
    
    set Caster = null
    set Target = null
    set Timer = null
    set dummy = null
endfunction

function Trig_FireBomb_Cond takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(), FireBomb) > 0
endfunction

//===========================================================================
function InitTrig_FireBomb takes nothing returns nothing
    local integer index
    local trigger T1 = CreateTrigger()
    
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(T1, Player(index), EVENT_PLAYER_UNIT_ATTACKED, null)
        
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    
    call TriggerAddCondition(T1,function Trig_FireBomb_Cond)
    call TriggerAddAction(T1, function Trig_FireBomb_Actions)
    
    set T1 = null
endfunction
library FireBombMove
function IsDead2 takes unit u returns boolean
    return GetWidgetLife(u) < 0.405 or IsUnitType(u,UNIT_TYPE_DEAD)
endfunction

function Enemy2 takes nothing returns boolean
    return GetFilterUnit() != LoadUnitHandle(H, 'Targ', 'Unit') and IsDead(GetFilterUnit())==false and IsPlayerAlly(GetOwningPlayer(LoadUnitHandle(H,'Cast','Unit')), GetOwningPlayer(GetFilterUnit())) == false and GetUnitAbilityLevel(GetFilterUnit(),'Aloc')==0 and GetUnitAbilityLevel(GetFilterUnit(),'Avul')==0 and GetUnitAbilityLevel(GetFilterUnit(),'Bcyc')==0
endfunction

function ParabolaZ2 takes real h0, real h1, real h, real d, real d1 returns real
    return ((4 * h / d) * (d - d1) + h1 - h0) * (d1 / d) + h0
endfunction

function FireBomb_Move takes nothing returns nothing
    local timer Timer = GetExpiredTimer()
    local integer id = GetHandleId(Timer)
    local unit dummy = LoadUnitHandle(H, id, StringHash("Fire Bomb"))
    local real x0 = LoadReal(H, id, StringHash("Start X"))
    local real y0 = LoadReal(H, id, StringHash("Start Y"))
    local real x1 = LoadReal(H, id, StringHash("End X"))
    local real y1 = LoadReal(H, id, StringHash("End Y"))
    local real d = LoadReal(H, id, StringHash("Distance"))
    local real h = LoadReal(H, id, StringHash("Max Height"))
    local real h0 = LoadReal(H, id, StringHash("Start Height"))
    local real h1 = LoadReal(H, id, StringHash("End Height"))
    local real a = bj_RADTODEG * Atan2(y1 - y0, x1 - x0)
    local real dx
    local real dy
    local real d1
    local real d2
    local real height
    local group g = CreateGroup()
    local unit Target
    local real Time = LoadReal(H, id, 'time') + 0.03
    
    call SaveReal(H, id, 'time', Time)
    
    if Time >= 0.48 then
        if Time == 0.48 then
            call UnitRemoveAbility(dummy, 'Aloc')
            call ShowUnit(dummy, true)
            call UnitAddAbility(dummy, 'Aloc')
            call DestroyEffect(LoadEffectHandle(H, id, 'effe'))
        endif
        
        set dx = GetUnitX(dummy)
        set dy = GetUnitY(dummy)
        set d1 = SquareRoot( (dx - x0) * (dx - x0) + (dy - y0) * (dy - y0) )
        set d2 = SquareRoot( (x1 - dx) * (x1 - dx) + (y1 - dy) * (y1 - dy) )
        set height = ParabolaZ2(h0, h1, h, d, d1)
        
        if d2 <= 20.0 then
            call ShowUnit(dummy, false)
            call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl", dx, dy))
            call PauseTimer(Timer)
            call DestroyTimer(Timer)
            
            call SaveUnitHandle(H, 'Unit', 'Unit', LoadUnitHandle(H, GetHandleId(dummy), 'nimb'))
            call GroupEnumUnitsInRange(g, dx, dy, 200.0, function Enemy)
            //call GroupEnumUnitsInRange(g, dx, dy, 200.0, function AttackBoss)
            
            loop
                set Target = FirstOfGroup(g)
                exitwhen Target == null
                call SaveBoolean(H, GetHandleId(Target), 'BDBo', false)
                //set udg_DetectedAttack=false
                call UnitDamageTarget(LoadUnitHandle(H, GetHandleId(dummy), 'nimb'), Target, GetHeroInt(LoadUnitHandle(H, GetHandleId(dummy), 'nimb'), true) * 2.0, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                call SaveBoolean(H, GetHandleId(Target), 'BDBo', true)
                //set udg_DetectedAttack=true
                call GroupRemoveUnit(g, Target)
            endloop
            
            call GroupClear(g)
            if LoadInteger(H, GetHandleId(dummy), 'boun') > 0 then
                call SaveUnitHandle(H, 'Cast', 'Unit', dummy)
                call SaveUnitHandle(H, 'Targ', 'Unit', LoadUnitHandle(H, id, 'Targ'))
                call GroupEnumUnitsInRange(g, dx, dy, 770.0, function Enemy2)                
                loop
                    set Target = GroupPickRandomUnit(g)
                    exitwhen Target == null
                    
                    set dx = GetUnitX(Target)
                    set dy = GetUnitY(Target)
                    set d2 = SquareRoot( (x1 - dx) * (x1 - dx) + (y1 - dy) * (y1 - dy) )
                    
                    if d2 < 300.0 or d2 > 700.0 then
                        call GroupRemoveUnit(g, Target)
                    else
                        call FlushChildHashtable(H, id)
                        call SaveUnitHandle(H, 'Targ', 'Unit', Target)
                        call SaveInteger(H, GetHandleId(dummy), 'boun', LoadInteger(H, GetHandleId(dummy), 'boun') - 1)
                        call TriggerExecute(gg_trg_FireBombBounce)
                        exitwhen Target != null
                    endif
                endloop
            else
                call RemoveUnit(dummy)
                call FlushChildHashtable(H, GetHandleId(dummy))
            endif
        else
            call SetUnitX(dummy, dx + 25.0 * Cos(a * bj_DEGTORAD))
            call SetUnitY(dummy, dy + 25.0 * Sin(a * bj_DEGTORAD))
            call SetUnitFlyHeight(dummy, height, 0.0)
        endif
    endif
    
    call GroupClear(g)
    call DestroyGroup(g)
    
    set Timer = null
    set dummy = null
    set g = null
    set Target = null
endfunction
endlibrary
function Trig_FireBombBounce_Actions takes nothing returns nothing
    local unit Caster = LoadUnitHandle(H, 'Cast', 'Unit')
    local unit Target = LoadUnitHandle(H, 'Targ', 'Unit')
    local real x0 = GetUnitX(Caster)
    local real y0 = GetUnitY(Caster)
    local real x1 = GetUnitX(Target)
    local real y1 = GetUnitY(Target) 
    local real d = SquareRoot( (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) )
    local real h = d / 4.0
    local real h0 = GetUnitFlyHeight(Caster)
    local real h1 = GetUnitFlyHeight(Target)
    local real a = bj_RADTODEG * Atan2(y1 - y0, x1 - x0)
    local player Owner = GetOwningPlayer(Caster)
    local timer Timer = CreateTimer()
    local integer id = GetHandleId(Timer)
    
    call TimerStart(Timer, 0.03, true, function FireBomb_Move)
    
    call SaveUnitHandle(H, id, StringHash("Fire Bomb"), Caster)
    call SaveUnitHandle(H, id, 'Targ', Target)
    call SaveReal(H, id, StringHash("Start X"), x0)
    call SaveReal(H, id, StringHash("Start Y"), y0)
    call SaveReal(H, id, StringHash("End X"), x1)
    call SaveReal(H, id, StringHash("End Y"), y1)
    call SaveReal(H, id, StringHash("Distance"), d)
    call SaveReal(H, id, StringHash("Max Height"), h)
    call SaveReal(H, id, StringHash("Start Height"), h0)
    call SaveReal(H, id, StringHash("End Height"), h1)
    call SaveReal(H, id, 'time', 0.0)
    call SaveEffectHandle(H, id, 'effe', AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl", Caster, "weapon"))
    
    set Caster = null
    set Target = null
    set Timer = null
endfunction

//===========================================================================
function InitTrig_FireBombBounce takes nothing returns nothing
    set gg_trg_FireBombBounce = CreateTrigger()
    call TriggerAddAction(gg_trg_FireBombBounce, function Trig_FireBombBounce_Actions)
endfunction
Ритуал обмена - Нимбедо создаёт луч, который восстанавливает союзному герою 1-3 ед. здоровья за 2 ед. маны Нимбедо.
Код способности
function RitualOfExchange_Move takes nothing returns nothing
    local timer Timer = GetExpiredTimer()
    local integer id = GetHandleId(Timer)
    local unit Caster = LoadUnitHandle(H, id, 'cast')
    local unit Target = LoadUnitHandle(H, id, 'targ')
    local lightning Lightning = LoadLightningHandle(H, id, 'ligh')
    local real x0 = GetUnitX(Caster)
    local real y0 = GetUnitY(Caster)
    local real z0 = GetLocalZ(x0, y0)
    local real x1 = GetUnitX(Target)
    local real y1 = GetUnitY(Target)
    local real z1 = GetLocalZ(x1, y1)
    
    call MoveLightningEx(Lightning, false, x0, y0, z0, x1, y1, z1)
    
    if GetUnitState(Caster, UNIT_STATE_MANA) < 0.5 then
        call PauseTimer(Timer)
        call DestroyTimer(Timer)
        call FlushChildHashtable(H, id)
        call DestroyLightning(Lightning)
        call IssueImmediateOrderById(Caster, OrderId("stop"))
        call DestroyEffect(LoadEffectHandle(H, id, 'roee'))
    endif
    
    if GetUnitState(Target, UNIT_STATE_LIFE) == GetUnitState(Target, UNIT_STATE_MAX_LIFE) then
        call PauseTimer(Timer)
        call DestroyTimer(Timer)
        call FlushChildHashtable(H, id)
        call DestroyLightning(Lightning)
        call IssueImmediateOrderById(Caster, OrderId("stop"))
        call DestroyEffect(LoadEffectHandle(H, id, 'roee'))
    endif
    
    call SetUnitState(Target, UNIT_STATE_LIFE, GetUnitState(Target, UNIT_STATE_LIFE) + 0.5 * GetUnitAbilityLevel(Caster, 'A00D'))
    call SetUnitState(Caster, UNIT_STATE_MANA, GetUnitState(Caster, UNIT_STATE_MANA) - 2.0)
    
    set Caster = null
    set Target = null
    set Lightning = null
    set Timer = null
endfunction

function DestroyCast_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local timer Timer = LoadTimerHandle(H, GetHandleId(Caster), 'timr')
    local lightning Lightning = LoadLightningHandle(H, GetHandleId(Caster), 'ligh')

    call DestroyTrigger(GetTriggeringTrigger())
    call PauseTimer(Timer)
    call DestroyTimer(Timer)
    call FlushChildHashtable(H, GetHandleId(Timer))
    call DestroyLightning(Lightning)
    call IssueImmediateOrderById(Caster, OrderId("stop"))
    call DestroyEffect(LoadEffectHandle(H, GetHandleId(Caster), 'roee'))
    
    set Caster = null
    set Timer = null
    set Lightning = null
endfunction

function Trig_RitualOfExchange_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local unit Target = GetSpellTargetUnit()
    local real x0 = GetUnitX(Caster)
    local real y0 = GetUnitY(Caster)
    local real z0 = GetLocalZ(x0, y0)
    local real x1 = GetUnitX(Target)
    local real y1 = GetUnitY(Target)
    local real z1 = GetLocalZ(x1, y1)
    local lightning Lightning = AddLightningEx("HWPB", false, x0, y0, z0, x1, y1, z1)
    local timer Timer = CreateTimer()
    local integer id = GetHandleId(Timer)
    local trigger DestroyCast = LoadTriggerHandle(H, GetHandleId(Caster), 'dstr')
        
    call TimerStart(Timer, 0.03, true, function RitualOfExchange_Move)
    call SaveUnitHandle(H, id, 'cast', Caster)
    call SaveUnitHandle(H, id, 'targ', Target)
    call SaveLightningHandle(H, id, 'ligh', Lightning)
    call SaveEffectHandle(H, id, 'roee', AddSpecialEffectTarget("Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl", Target, "origin"))
    
    call DestroyTrigger(DestroyCast)
    set DestroyCast = CreateTrigger()
    call TriggerRegisterUnitEvent(DestroyCast, Caster, EVENT_UNIT_SPELL_ENDCAST)
    call TriggerAddAction(DestroyCast, function DestroyCast_Actions)
    
    call SaveTriggerHandle(H, GetHandleId(Caster), 'dstr', DestroyCast)
    call SaveTimerHandle(H, GetHandleId(Caster), 'timr', Timer)
    call SaveLightningHandle(H, GetHandleId(Caster), 'ligh', Lightning)
    call SaveEffectHandle(H, GetHandleId(Caster), 'roee', LoadEffectHandle(H, id, 'roee'))
    
    set Caster = null
    set Target = null
    set Lightning = null
    set Timer = null
endfunction

function RitualOfExchange_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00D'
endfunction

//===========================================================================
function InitTrig_RitualOfExchange takes nothing returns nothing
    local integer index
    
    set gg_trg_RitualOfExchange = CreateTrigger()
    
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(gg_trg_RitualOfExchange, Player(index), EVENT_PLAYER_UNIT_SPELL_CHANNEL, null)
        
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    
    call TriggerAddCondition(gg_trg_RitualOfExchange,function RitualOfExchange_Conditions)
    call TriggerAddAction(gg_trg_RitualOfExchange, function Trig_RitualOfExchange_Actions)
endfunction
Тотем исцеления - Нимбедо создаёт в указанной области тотем, который существует в течении 5-13 секунд и восстанавливает всем союзным героям в округе здоровье в размере их силы и ману в размере их интеллекта.
Код способности
function HealingWard_Ally takes nothing returns boolean
    return IsDead(GetFilterUnit())==false and IsPlayerAlly(GetOwningPlayer(LoadUnitHandle(H,'hwbo','Unit')), GetOwningPlayer(GetFilterUnit()))==true and IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)==true
endfunction

function HealingWard_Actions takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer id = GetHandleId(T)
    local unit caster = LoadUnitHandle(H, id, 'Cast')
    local real x = LoadReal(H, id, 'WarX')
    local real y = LoadReal(H, id, 'WarY')
    local unit e = LoadUnitHandle(H, id, 'dymm')
    local real time = LoadReal(H, id, 'time')
    local group g = CreateGroup()
    local unit Target
        
    if time > 0.0 then
        call SaveUnitHandle(H, 'hwbo', 'Unit', caster)
        call GroupEnumUnitsInRange(g, x, y, 500.0, function HealingWard_Ally)
        //call GroupEnumUnitsInRange(g, x, y, 500.0, function Friend)
        
        loop
            set Target = FirstOfGroup(g)
            exitwhen Target == null
            call SetUnitState(Target, UNIT_STATE_LIFE, GetUnitState(Target, UNIT_STATE_LIFE) + ( I2R( GetHeroStr(Target, true) ) / 4 ))
            call SetUnitState(Target, UNIT_STATE_MANA, GetUnitState(Target, UNIT_STATE_MANA) + ( I2R( GetHeroInt(Target, true) ) / 4 ))
            call GroupRemoveUnit(g, Target)
        endloop
        
        call GroupClear(g)
        call DestroyGroup(g)
    else
        call PauseTimer(T)
        call DestroyTimer(T)
        call FlushChildHashtable(H, id)
        call RemoveUnit(e)
    endif
    
    call SaveReal(H, id, 'time', time - 1.0)
    
    set T = null
    set caster = null
    set e = null
    set g = null
    set Target = null
endfunction

function Trig_HealingWard_Actions takes nothing returns nothing
    local timer T = CreateTimer()
    
    call TimerStart(T, 0.25, true, function HealingWard_Actions)
    call SaveUnitHandle(H, GetHandleId(T), 'Cast', GetTriggerUnit())
    call SaveReal(H, GetHandleId(T), 'WarX', GetSpellTargetX())
    call SaveReal(H, GetHandleId(T), 'WarY', GetSpellTargetY())
    call SaveUnitHandle(H, GetHandleId(T), 'dymm', CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'e006', GetSpellTargetX(), GetSpellTargetY(), 0.0))
    call SaveReal(H, GetHandleId(T), 'time', I2R((3 + 2 * GetUnitAbilityLevel(GetTriggerUnit(), 'A00E')) * 4))
    
    set T = null
endfunction

function HealingWard_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00E'
endfunction

//===========================================================================
function InitTrig_HealingWard takes nothing returns nothing
    local integer index
    
    set gg_trg_HealingWard = CreateTrigger()
    
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(gg_trg_HealingWard, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    
    call TriggerAddCondition(gg_trg_HealingWard,function HealingWard_Conditions)
    call TriggerAddAction(gg_trg_HealingWard, function Trig_HealingWard_Actions)
endfunction

Таланты

Сглаз - Нимбедо создаёт тотем, который существует 10 секунд и каждую секунду превращает одного противника в случайное животное на 4 секунды.
Код способности
function Trig_EvilEye_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local unit Dummy
    local unit Ward = CreateUnit(GetOwningPlayer(Caster), 'e007', GetSpellTargetX(), GetSpellTargetY(), 0.0)
    local unit Target
    local integer index = 10
    local group g = CreateGroup()
    local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    
    call UnitApplyTimedLife(Ward, 'BTLF', 4.0)
    
    loop
        call TriggerSleepAction(0.8)
        
        call SaveUnitHandle(H, 'Unit', 'Unit', Caster)
        call GroupEnumUnitsInRange(g, x, y, 500.0, function Enemy)
        //call GroupEnumUnitsInRange(g, x, y, 500.0, function AttackBoss)
        
        set Target = GroupPickRandomUnit(g)
        
        if Target != null then
            set Dummy = CreateUnit(GetOwningPlayer(Caster), DummyId, GetUnitX(Target), GetUnitY(Target), 0.0)
            call UnitAddAbility(Dummy, 'A00G')
            call IssueTargetOrder(Dummy, "hex", Target)
            call UnitApplyTimedLife(Dummy, 'BTLF', 2.0)
        endif
        
        call GroupClear(g)
        
        set index = index - 1
        exitwhen index == 0
    endloop

    call DestroyGroup(g)
    
    set Caster = null
    set Dummy = null
    set Ward = null
    set Target = null
    set g = null
endfunction

function EvilEye_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00F'
endfunction

//===========================================================================
function InitTrig_EvilEye takes nothing returns nothing
    local integer index
    
    set gg_trg_EvilEye = CreateTrigger()
    
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(gg_trg_EvilEye, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    
    call TriggerAddCondition(gg_trg_EvilEye,function EvilEye_Conditions)
    call TriggerAddAction(gg_trg_EvilEye, function Trig_EvilEye_Actions)
endfunction
Пирогейст - Огненная бомба получает два дополнительных отскока.
Герой будет дорабатываться
`
ОЖИДАНИЕ РЕКЛАМЫ...