Burning Watchtower v1
65
ID:
658
Family ID:
Author:
Natac
Rarity:
uncommon
Element:
fire
Attack Type:
Elemental
Attack Range:
800
Attack CD:
1.4
Damage:
51-52
Abil. Factor:
0.5
Status:
Approved

Description:

Burning structure with a small synergetic effect for its element.

Latest Upload Comment:

Restored from 1.10
Burn
Starts to burn a target. On every further hit of a fire tower, the target will receive more bonus damage then before. Burning Structures will increase the bonus damage by 1, any other fire towers by 0.3. If the unit dies, it explodes and deals 49 damage to nearby units in a range of 200.
Lasts 5 seconds after the last attack of a fire tower.

Level Bonus:
+ 0.1 damage gain (Burning Structrues)
+ 0.03 damage gain (Other fire towers)
+ 0.12 seconds burn duration
Download

Toggle Triggers

Header

    globals
        //This buff is configurated as follows:
        //level: damage gain per attack
        //userReal: Already done bonus damage on the buffed unit
        //userInt: AOE-Damage if the buffed unit dies
        //@export
        BuffType   natac_burning_buff
    endglobals
    
    // b.userReal: The user Real is the current bonus damage of the buff. Init with 0
    function initOnCreate takes Buff b returns nothing
        set b.userReal  = 0.0
        set b.userInt = 0
    endfunction
    
    // Increase damage gain and do direct damage to the target by setting the event damage
    function damageOnFireAttack takes Buff b returns nothing 
        local real    damageGain 
        local real    damageFactor
        local Unit    attacker       = Event.getTarget()
        local boolean isBurningTower 
        if(Element.FIRE == attacker.getCategory()) then
            set isBurningTower = Tower(attacker).getFamily() == Tower(b.getCaster()).getFamily()
            if(isBurningTower) then 
                set damageFactor = 1.0 // is Burning Tower
            else
                set damageFactor = 0.3 // is other fire tower
            endif
            
            set  damageGain   = damageFactor * b.getLevel() * 0.01 //Added power with "*100", so multiply with 0.01
            set  b.userReal   = b.userReal + damageGain
            set  Event.damage = Event.damage + b.userReal
            
            if(isBurningTower) then //Display damage
                call attacker.getOwner().displaySmallFloatingText(I2S(R2I(b.userReal)), b.getBuffedUnit(),255,90,0, 40.0)
            endif
            
            call b.refreshDuration() // Reset duration
        endif
    endfunction 
    
    // Does damage to all units around the buffed unit, if the buffed unit dies
    // b.userInt: AOE damage of the current buff.
    function explodeOnDeath takes Buff b returns nothing 
        local Unit killer      = Event.getTarget()
        local Unit buffedUnit  = b.getBuffedUnit()
        call  SFXAtUnit("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl",buffedUnit.getUnit())
        call  killer.doSpellDamageAoEUnit(buffedUnit,200, b.userInt, killer.calcSpellCritNoBonus(),0.0)
    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  natac_burning_buff = BuffType.create(0.0, 0.0, false) //CustomTime applied
        call natac_burning_buff.setBuffIcon('@@0@@')
        call natac_burning_buff.addEventOnCreate(EventHandler.initOnCreate)
        call natac_burning_buff.addEventOnDamaged(EventHandler.damageOnFireAttack,1.0,0.0)
        call natac_burning_buff.addEventOnDeath(EventHandler.explodeOnDeath)
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local integer towerLevel = tower.getLevel()
    local Unit    target     = Event.getTarget()
    local real    level      = 1 + towerLevel*0.1
    local real    duration   = 5 + towerLevel*0.12
    local Buff    b          = natac_burning_buff.applyCustomTimed(tower, target, R2I(level*100), duration)
    
    // Upgrade AOE-damage, if it makes sense
    if(b.userInt < 49) then
        set b.userInt = 49
    endif
endfunction