Little Phoenix v1 
            700
                 
         
             | 
    
    
              ID:              147 
             Family ID:       
             Author:          Der_kleine_Tomy 
             Rarity:          rare 
             Element:         fire 
             Attack Type:     Elemental 
             Attack Range:    850 
             Attack CD:       2.5 
             Damage:  832-832 
             Abil. Factor:  0.375 
             Status:          Approved 
     | 
    
    
    
         
                        Specials:
                    +20% dmg to nature (+1%/lvl)  
                        Eruption
                    When Phoenixfire expires, it erupts and deals 100 elemental damage per armor point the creep is missing in 200 range around its target. Additionally the target regains only 70% of its armor. Creeps further away recieve less damage. This ability can be cast to make Phoenixfire expire immediately. Level Bonus: -1% armor regain  
                        Phoenixfire
                    The Little Phoenix attacks up to 2 targets at once. If there are less creeps than attacks, the remaining attacks will hit the main target. The armor of attacked creeps melts, reducing it by 0.5 for 5 seconds. This buff is stackable. Level Bonus: +0.01 armor reduction +1 target at level 15  | 
    
    
    
        Download
        
        
        
        
         Toggle Triggers Autocast 
                        
                            AUTOCAST_cooldown: 1.0
                        
                            AUTOCAST_autoRange: 0.0
                        
                            AUTOCAST_manacost: 0
                        
                            AUTOCAST_range: 0.0
                        
                            AUTOCAST_targetType: 0
                        
                            AUTOCAST_numBuffsBeforeIdle: 0
                        
                            caster_art: 
                        
                            target_art: 
                        
                            AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE
                        
                            AUTOCAST_buffType: 0
                        
                            AUTOCAST_isExtended: false
                        
                            AUTOCAST_targetSelf: true
                        
                         
                    
                    
                        private function onAutocast takes Tower tower returns nothing
    local Buff b
    local Iterate it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 3000.0)
    local Unit u
    loop
        set u = it.next()
        exitwhen u == 0
        set b = u.getBuffOfType(tomy_PhoenixFireBuff)
        if b != 0 then
            call b.removeBuff()
        endif
    endloop
endfunction
                    
                Header     globals
        //@export
        ProjectileType tomy_PhoenixPT
        //@export
        BuffType tomy_PhoenixFireBuff
        boolean purged = false
    endglobals
    
    function tomy_PhoenixAttackHit takes Projectile p, Unit target returns nothing
        local Tower tower = p.getCaster()
        local Buff b = target.getBuffOfType(tomy_PhoenixFireBuff)
        local integer familyMember = tower.userInt
        local integer level = tower.getLevel()
        local real armorLoss
        
        if familyMember == 1 then
            set armorLoss = 0.50 + 0.01 * level
        elseif familyMember == 2 then
            set armorLoss = 0.60 + 0.015 * level
        elseif familyMember == 3 then
            set armorLoss = 0.70 + 0.020 * level
        endif
        
        if b != 0 then
            call tomy_PhoenixFireBuff.apply(tower, target, b.getPower() + R2I(armorLoss * 100.0))
        else
            call tomy_PhoenixFireBuff.apply(tower, target, R2I(armorLoss * 100.0))
        endif
        call tower.doAttackDamage(target,tower.getCurrentAttackDamageWithBonus(),tower.calcAttackMulticrit(0,0,0))
        
    endfunction
    
    function tomy_PhoenixFireBuffPurged takes Buff b returns nothing
        set purged = true
    endfunction
    
    function tomy_PhoenixFireBuffExpired takes Buff b returns nothing
        local integer power = b.getPower()
        local Unit target = b.getBuffedUnit()
        local Tower tower = b.getCaster()
        local integer level = tower.getLevel()
        local integer familyMember = tower.userInt
        local real damagePerPower // 100 power = -1.00 armor
        local real armorRegainFactor
        local real damageMultiplier = tower.getCurrentAttackDamageWithBonus() / tower.getBaseDamage()
        
        if familyMember == 1 then
            set damagePerPower = 1.0
            set armorRegainFactor = 0.70 - 0.01 * level
        elseif familyMember == 2 then
            set damagePerPower = 2.6
            set armorRegainFactor = 0.60 - 0.015 * level
        elseif familyMember == 3 then
            set damagePerPower = 4.4
            set armorRegainFactor = 0.50 - 0.020 * level
        endif
        
        if not purged then
            set damagePerPower = damagePerPower * damageMultiplier
            call tower.doAttackDamageAoEUnit(target, 200.0 , power * damagePerPower, tower.calcAttackMulticrit(0,0,0),0.5)
            call SFXAtUnit("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", target.getUnit())
        endif
        call target.modifyProperty(MOD_ARMOR, -power / 100.0 * (1 - armorRegainFactor))
        set purged = false
    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
         local Modifier m = Modifier.create()
         call m.addModification(MOD_ARMOR,0,-0.01)
         set tomy_PhoenixPT = ProjectileType.createInterpolate("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl",800)
         call tomy_PhoenixPT.setEventOnInterpolationFinished(ProjectileTargetEvent.tomy_PhoenixAttackHit)
         set tomy_PhoenixFireBuff = BuffType.create(5.0,0,false)
         call tomy_PhoenixFireBuff.setBuffIcon('@@0@@')
         call tomy_PhoenixFireBuff.setBuffModifier(m)
         call tomy_PhoenixFireBuff.addEventOnCleanup(EventHandler.tomy_PhoenixFireBuffExpired)
         call tomy_PhoenixFireBuff.setEventOnPurge(EventHandler.tomy_PhoenixFireBuffPurged)
    endfunction
                    
                On Attack 
                        
                            ONATTACK_chance: 1.0
                        
                            ONATTACK_chanceLevelAdd: 0.0
                        
                         
                    
                    
                        function onAttack takes Tower tower returns nothing
    local integer attacks = 1
    local boolean add = false
    local Unit maintarget = Event.getTarget()
    local Unit target
    local Iterate it = Iterate.overUnitsInRangeOfUnit(tower,TARGET_TYPE_CREEPS,maintarget,450)
    local real sidearc = 0.20
    local boolean itDestroyed = false
 
    if tower.getLevel() >= 15 then
        set attacks = attacks + 1
    endif
 
    loop
        exitwhen attacks == 0 // Exit when all attacks are fired
        
        // If the Iterate is not destroyed, get the next target
        if not itDestroyed then
            set target = it.next()
        
            // If there are no more targets
            if target == 0 then
                set itDestroyed = true // Iterate is destroyed (auto destroy)
                set target = maintarget // target is the maintarget now
            endif
        endif
  
        // If there are no more units, shoot at the maintarget (itDestroyed). If there are units then don't shoot at the maintarget
        if itDestroyed or target != maintarget then
            call Projectile.createBezierInterpolationFromUnitToUnit(tomy_PhoenixPT,tower,0,0,tower,target,0,sidearc,0,true).setScale(0.40)
            set attacks = attacks - 1
            set sidearc = -sidearc
            if add then
                set sidearc = sidearc + 0.20
            endif
            set add = not add
        endif
    endloop
 
    // If the Iterate is not destroyed yet, destroy it
    if not itDestroyed then
        call it.destroy()
    endif  
endfunction
                    
                On Damage 
                        
                            ONDAMAGE_chance: 1.0
                        
                            ONDAMAGE_chanceLevelAdd: 0.0
                        
                         
                    
                    
                        function onDamage takes Tower tower returns nothing
    local Unit target = Event.getTarget()
    local Buff b = target.getBuffOfType(tomy_PhoenixFireBuff)
    local integer level = tower.getLevel()
    local real armorLoss = 0.50 + 0.01 * level
        
    if b != 0 then
        call tomy_PhoenixFireBuff.apply(tower, target, b.getPower() + R2I(armorLoss * 100.0))
    else
        call tomy_PhoenixFireBuff.apply(tower, target, R2I(armorLoss * 100.0))
    endif
 
endfunction
                    
                On Tower Creation function onCreate takes Tower tower returns nothing
    set tower.userInt = 1 // Save the family member (1 = first member)
    set tower.userInt2 = 0 // Used to save the buff (double linked list)
    call AddUnitAnimationProperties(tower.getUnit(), "stand alternate", false)
endfunction
                    
                 | 
    
    
Description:
Latest Upload Comment: