Planar Gate v1
3200
ID:
651
Family ID:
Author:
Majildian
Rarity:
unique
Element:
astral
Attack Type:
Energy
Attack Range:
700
Attack CD:
2.5
Damage:
3573-3573
Abil. Factor:
0.28
Status:
Approved

Description:

A gate to the astral plane, glowing figures can be seen flying around on the other side.

Latest Upload Comment:

Restored from 1.10
Astral Eruption
Releases a huge wave of astral power through the gate, weakening the boundary between the planes.
This empowers all currently alive falcons and any that are created during the next 6 seconds, allowing them to deal double damage and partially shift their targets into the astral plane, increasing the damage they take from astral towers by 1% of the falcon's current damage ratio.

Level Bonus:
+0.18 seconds
Planeshift
On attack the Gate releases a magical falcon to hunt down its enemies.
The falcon deals energy damage equal to the Gate's current attack damage and bounces until it runs out of damage. Each bounce deals 5% less damage.
There is a maximum of 1 falcon summoned at a time and a 20% chance to ignore the maximum.

Level Bonus:
-0.1% damage loss per bounce
+1 falcon every 8 levels
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 35 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 1000 AUTOCAST_range: 0 AUTOCAST_buffType: Maj_astralEruption AUTOCAST_targetSelf: true AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 700
private function onAutocast takes Tower tower returns nothing
    local real x = tower.getX()
    local real y = tower.getY()
    call Maj_astralEruption.apply(tower, tower, tower.getLevel())
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 1, 1, 255, 255, 255).setLifetime(0.5)
    call TriggerSleepAction(0.3)
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 2, 1, 255, 255, 255).setLifetime(0.5)
    call TriggerSleepAction(0.3)
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 3, 1, 255, 255, 255).setLifetime(0.5)
endfunction

Header

    globals
        ProjectileType Maj_bouncingProj
        BuffType Maj_astralEruption
        BuffType Maj_astralDmgModBuff
    endglobals
    
    
    // p.userInt = number of crits
    // p.userInt2 = UID
    // p.userInt3 = check for buff
    // p.userReal = damage loss per bounce
    // p.userReal2 = damage ratio of this projectile
    // p.userReal3 = damage to deal
    function bounce takes Projectile p, Unit target returns nothing
        local Tower tower = p.getCaster()
        local Iterate it
        local Unit next
        local Projectile P
        local Playor pl
        local integer intVar
        local string critStr
        local real dmgMod
        local Buff b
        
        //Check if this projectile has damage ratio left and if the target is still alive.
        if p.userReal2 > 0 and target.getUID() == p.userInt2 then
            //Set the locals.
            set it = Iterate.overUnitsInRangeOfUnit(tower, TARGET_CREEPS, target, 500)
            set intVar = 0
            set critStr = ""
            set b = target.getBuffOfType(Maj_astralDmgModBuff)
            
            //Check if the tower cast the buff since the last time this projectile hit.
            if tower.getBuffOfType(Maj_astralEruption) > 0 and p.userInt3 == 0 then
                set p.userInt3 = 1
            endif
            
            //Check if the tower crit this attack, and if so, display the damage colored red above the tower
            //with exclamation marks after it equal to the number of crits. This only runs the first time the
            //projectile hits because p.userInt is set to 0 at the end.
            if p.userInt > 0 then
                set pl = tower.getOwner()
                set intVar = 0
                loop
                    set critStr = critStr + "!"
                    set intVar = intVar + 1
                    exitwhen intVar == p.userInt
                endloop
                call pl.displayFloatingText(I2S(R2I(p.userReal3)) + critStr, tower, 255, 0, 0)
            endif
            
            //Check if the buff was applied on the tower when it launched this projectile, and if
            //the target isn't immune then increase the damage it takes from astral, and apply the
            //buff or if the buff was already applied, increase the amount of damage taken to remove
            //when the buff gets purged or similar.
            if p.userInt3 == 1 then
                if target.isImmune() == false then
                    set dmgMod = p.userReal2*0.01
                    call target.modifyProperty(MOD_DMG_FROM_ASTRAL, dmgMod)
                
                    if b > 0 then
                        set b.userReal = b.userReal+dmgMod
                    else
                        set b = Maj_astralDmgModBuff.apply(tower,target,0)
                        set b.userReal = dmgMod
                    endif
                endif
            endif
            
            // Deal the damage (double if the projectile got buffed).
            call tower.doAttackDamage(target,p.userReal3 * p.userReal2 * (1+p.userInt3),1)
            
            //Choose a target from all creeps in 500 range that isn't this projectile's target.
            set next = it.nextRandom()
            if next == target and next != 0 then
                set next = it.nextRandom()
            endif
            //If no valid targets in range, end here and decrease tower's userInt so portal can fire again.
            if next == 0 then
                set tower.userInt = tower.userInt - 1
                return
            endif
            call it.destroy()
            
            //Fire the projectile to the next unit and set all the necessary values.
            set P = Projectile.createLinearInterpolationFromUnitToUnit(Maj_bouncingProj, tower, 1, 1, target, next, .35, true)
            
            set P.userInt = 0
            set P.userInt2 = next.getUID()
            set P.userInt3 = p.userInt3
            set P.userReal = p.userReal
            set P.userReal2 = p.userReal2-p.userReal    //decrease new projectile's damage multiplier
            set P.userReal3 = p.userReal3
        
        //Or if the projectile had no damage ratio, end here and decrease the tower userInt.
        else
            set tower.userInt = tower.userInt - 1
        endif
    endfunction
    
    //In case the buff gets purged.
    function removeMod takes Buff b returns nothing
        call b.getBuffedUnit().modifyProperty(MOD_DMG_FROM_ASTRAL, -b.userReal)
    endfunction
   
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
        set Maj_astralEruption = BuffType.create(6, 0.18, true)
        set Maj_astralDmgModBuff = BuffType.create(-1, 0, false)
        set Maj_bouncingProj = ProjectileType.createInterpolate("Abilities\\Weapons\\MurgulMagicMissile\\MurgulMagicMissile.mdl", 1250)
        call Maj_bouncingProj.setEventOnInterpolationFinished(ProjectileTargetEvent.bounce)
        call Maj_astralEruption.setBuffIcon('@@0@@')
        call Maj_astralDmgModBuff.setBuffIcon('@@1@@')
        call Maj_astralDmgModBuff.addEventOnCleanup(removeMod)
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Unit target
    local integer crits
    local real curDmg
    local Projectile p
    local Buff b

    //Check if the amount of birds summoned is low enough to create another one.
    if tower.userInt < R2I(1+(tower.getLevel()/8)) or tower.calcChance(0.20) then
        //Set the locals.
        set target = Event.getTarget()
        set crits = tower.getNumberOfCrits()
        set curDmg = tower.getCurrentAttackDamageWithBonus()
        set b = tower.getBuffOfType(Maj_astralEruption)
        
        //Set the projectile values.
        set p = Projectile.createLinearInterpolationFromUnitToUnit(Maj_bouncingProj, tower, 1, 1, tower, target, .5, true)
        set p.userInt2 = target.getUID()
        set p.userReal = 0.05-(tower.getLevel()*0.001)  //damage multiplier loss per bounce
        set p.userReal2 = 1 //Projectile's current damage multiplier
        if b > 0 then
            set p.userInt3 = 1
        else
            set p.userInt3 = 0
        endif
        //Check for crits.
        if (crits > 0) then
            set p.userReal3 = curDmg * (crits * (tower.getProp_AtkCritDamage() - 1) + 1)
            set p.userInt = crits
        else
            set p.userReal3 = curDmg
            set p.userInt = 0
        endif    
        
        //Increase counter for birds summoned.
        set tower.userInt = tower.userInt+1
    endif
    //Remove crits so a 0! doesn't pop up over the tower.
    call tower.resetAttackCrits()
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    //Set damage to 0 so the tower doesn't deal 2x damage on first hit.
    set Event.damage = 0
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt = 0
endfunction