Commander v1
612
lvl: 23

ID:

161

Author:

SternBogen

Rarity:

rare

Status:

Approved

Description:

Get ready to attack ...

Latest Upload Comment:

Restored from 1.10
Attack!
Every attack there is a 2% attackspeed adjusted chance to issue an attack order. When this happens, all towers in 350 range gain +50% attack speed for 4 seconds.

Level Bonus:
+0.01% chance
+0.1 seconds duration
Download

Toggle Triggers

Header

goldcost: 0
    globals
        BuffType stern_Commander_Attack
    endglobals
    
    //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()
        set stern_Commander_Attack = BuffType.create(4.00, 0.1, true)
        call stern_Commander_Attack.setBuffModifier(m)
        call stern_Commander_Attack.setStackingGroup( "stern_Commander_Attack" )
        call m.addModification(MOD_ATTACKSPEED,0.50,0)
        // call m.addModification(MOD_DAMAGE_BASE_PERC,0.10,0)
        call stern_Commander_Attack.setBuffIcon( '@@0@@' )
    endfunction

On Attack

goldcost: 612 ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Item itm returns nothing
    local Tower tower = itm.getCarrier()
    local Iterate in_range
    local Tower nxt
    local Playor spieler = tower.getOwner()
    local real speed = tower.getBaseAttackspeed() 
    if tower.calcChance(speed * (0.02 + 0.001 * tower.getLevel())) then
        call spieler.displayFloatingText("Attack!", tower, 255, 0, 0)
        call SFXOnUnit("Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl",tower.getUnit(),"origin")
        set in_range = Iterate.overUnitsInRangeOfCaster(tower,TARGET_TOWERS,350)
        loop
            set nxt = in_range.next()
            exitwhen nxt == 0
            call stern_Commander_Attack.applyCustomTimed(tower,nxt,tower.getLevel(), 4 + 0.2 * tower.getLevel())
        endloop
        
    endif
    // method displayFloatingText takes string whichText, Unit whichUnit, integer red, integer green, integer blue returns nothing
endfunction