Array
(
    [scriptVersion] => 7
    [oeValues] => Array
        (
            [MissileHoming] => 1
            [Upgrade] => Array
                (
                )

            [targs1] => Array
                (
                )

            [goldcost] => 4000
            [dice1] => 1
            [Missilespeed] => 1200
            [moveHeight] => 35
            [file] => abilities\weapons\DemolisherMissile\DemolisherMissile.mdl
            [manaN] => 1000
            [atkType1] => magic
            [modelScale] => 0.7
            [rangeN1] => 0
            [upgrades] => Array
                (
                )

            [cool1] => 10
            [Ubertip] => One of the greatest inventions of the dwarves.
            [regenMana] => 10
            [abilList] => Array
                (
                )

            [Name] => The Steam Engine
            [Art] => ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
            [buildingShadow] => Array
                (
                )

            [unitSound] => SteamTank
            [sides1] => 1
            [auto] => Array
                (
                )

            [dmgplus1] => 0
            [bldtm] => 1
        )

    [settings] => Array
        (
            [author] => Glowackos/cedi
            [element] => iron
            [authorDisplay] => |cffff6347Glowackos|r/cedi
            [alpha] => 255
            [balanceTip] => |cffFFFF00+10 |rmana/lvl|n|cffFFFF00+5% |rmana regen/lvl
            [rarity] => unique
            [version] => 1.0
            [abil_factor] => 0.00
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 35.9194
                    [y] => 3.90394
                    [z] => 0.000000953674
                    [scale] => 0.5
                    [rot] => 3.14159
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -35.4104
                    [y] => 0.386749
                    [z] => 0.000000953674
                    [scale] => 0.5
                    [rot] => 0
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 33.8852
                    [y] => 8.38704
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 3.1782
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 2.20294
                    [y] => 40.4892
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 4.68305
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => -46.1641
                    [y] => 28.1961
                    [z] => 44.8
                    [scale] => 0.5
                    [rot] => 0.335918
                    [file] => Doodads\Dungeon\Props\SewerWallpipes\SewerWallpipes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.56
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -32.147
                    [y] => -30.5102
                    [z] => 0
                    [scale] => 0.25
                    [rot] => 6.23083
                    [file] => Doodads\Outland\Props\Grate\Grate1.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => -30.8073
                    [y] => -30.1041
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 1.57192
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [7] => Array
                (
                    [x] => 36.1656
                    [y] => -27.9198
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 1.61841
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [8] => Array
                (
                    [x] => 0.801812
                    [y] => -7.00417
                    [z] => 38.4
                    [scale] => 0.1
                    [rot] => 4.01258
                    [file] => Abilities\Spells\Other\Tornado\TornadoElementalSmall.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -3.14
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [9] => Array
                (
                    [x] => 36.6556
                    [y] => 1.56895
                    [z] => 0
                    [scale] => 0.25
                    [rot] => 0.959931
                    [file] => Doodads\Outland\Props\Grate\Grate1.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [10] => Array
                (
                    [x] => 1.26102
                    [y] => -9.03736
                    [z] => -19.2
                    [scale] => 0.2
                    [rot] => 5.11382
                    [file] => Doodads\Cityscape\Props\FountainRuined\FountainRuined.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_MANA
                    [base] => 0
                    [add] => 10
                )

            [1] => Array
                (
                    [id] => MOD_MANA_REGEN_PERC
                    [base] => 0
                    [add] => 0.05
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Tower Creation
                    [code] => local Effect e = Effect.createAnimatedScaled("Doodads\\Cinematic\\FireTrapUp\\FireTrapUp.mdl",tower.getX() - 4, tower.getY() + 41, 75.0, 0.0 ,0.55)
    //Power level
    set tower.userInt = 0
    //Num towers in AOE
    set tower.userInt2 = 0
    //Store effect
    set tower.userInt3 = e
    //Mana degen
    set tower.userReal = 0.0
    call engine_UpdateAnims(tower)
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Tower Details
                    [code] => call cedi_steam_MB.setValue(0,I2S(tower.userInt))
    call cedi_steam_MB.setValue(1,I2S(tower.userInt2))
    return cedi_steam_MB
                    [values] => Array
                        (
                        )

                )

            [2] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType cedi_steam_buff
        MultiboardValues cedi_steam_MB
    endglobals
    
    function engine_UpdateAnims takes Tower tower returns nothing
        local Effect e = tower.userInt3
        local unit u = tower.getUnit()
        call SetUnitTimeScale(u, I2R( tower.userInt) / 10.0)
        call e.setAnimationSpeed(0.5 + I2R( tower.userInt) / 20.0)
        call e.setScale(I2R(tower.userInt) / 20.0)
        set u = null
    endfunction
    
    function engine_UpdateManaUse takes Tower tower returns nothing
        local real manaDeg = tower.userInt * SquareRoot(tower.userInt2) * 10 / 100.0
        call tower.modifyProperty(MOD_MANA_REGEN_PERC, tower.userReal - manaDeg)
        set tower.userReal = manaDeg
    endfunction
    
    function steam_buff_onCreate takes Buff B returns nothing
        local Tower tower = B.getCaster()
        set B.userReal = 0.06 * tower.userInt
        set tower.userInt2 = tower.userInt2 + 1
        call engine_UpdateManaUse(tower)
        call B.getBuffedUnit().modifyProperty(MOD_DAMAGE_ADD_PERC, B.userReal)
        call B.getBuffedUnit().modifyProperty(MOD_ATTACKSPEED, B.userReal / 2.0)
    endfunction
    
    function steam_buff_onAttack takes Buff B returns nothing
        local Tower caster = B.getCaster()
        local Tower tower = B.getBuffedUnit()
        local integer lvl = caster.getLevel()
        if caster.calcChance(0.01 * tower.getBaseAttackspeed()) then
            call caster.addExp(1 + 0.04 * lvl)
            call Effect.createScaled("Objects\\Spawnmodels\\Human\\FragmentationShards\\FragBoomSpawn.mdl",tower.getX() + 11, tower.getY() + 56, 40.0, 0.0, 3).destroy()
        endif
    endfunction
    
    function steam_buff_periodic takes Buff B returns nothing
        local real r = 0.06 * Unit(B.getCaster()).userInt - B.userReal
        set B.userReal = B.userReal + r
        call B.getBuffedUnit().modifyProperty( MOD_DAMAGE_ADD_PERC, r)
        call B.getBuffedUnit().modifyProperty( MOD_ATTACKSPEED, r / 2.0)
    endfunction
    
    function steam_buff_onCleanup takes Buff B returns nothing
        local Tower tower = B.getCaster()
        set tower.userInt2 = tower.userInt2 - 1
        call engine_UpdateManaUse(tower)
        call B.getBuffedUnit().modifyProperty(MOD_DAMAGE_ADD_PERC, -B.userReal)
        call B.getBuffedUnit().modifyProperty(MOD_ATTACKSPEED, -B.userReal / 2.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 cedi_steam_buff = BuffType.createAuraEffectType(true)
        call cedi_steam_buff.setBuffIcon('@@0@@')
        call cedi_steam_buff.addEventOnCreate(steam_buff_onCreate)
        call cedi_steam_buff.addEventOnAttack(steam_buff_onAttack, 1.0, 0.0)
        call cedi_steam_buff.addPeriodicEvent(steam_buff_periodic, 1.0)
        call cedi_steam_buff.addEventOnCleanup(steam_buff_onCleanup)
        set cedi_steam_MB = MultiboardValues.create(2)
        call cedi_steam_MB.setKey(0,"Power Level") 
        call cedi_steam_MB.setKey(1,"Towers Powered")
	endfunction
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNMagicLariet.blp
                            [visible] => true
                            [name] => Power Surge
                            [short_explain] => Buffed towers have a chance to grant the Steam Engine exp.
                            [long_explain] => Towers under the effect of Steam Power have a |cffFFFF801%|r base attackspeed adjusted chance to cause a surge in the Steam Engine, granting it |cffFFFF801|r exp.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.04|r exp
                        )

                )

            [3] => Array
                (
                    [name] => Periodic
                    [code] => local unit u = tower.getUnit()
    if tower.userInt != 0 and GetUnitState(u, UNIT_STATE_MANA) <= 1.0 then
        set tower.userInt = 0
        call engine_UpdateManaUse(tower)
        call engine_UpdateAnims(tower)
        call tower.getOwner().displayFloatingText("Power Level: 0", tower, 50, 150, 100)
        call cb_stun.applyOnlyTimed( tower, tower, 120.0 )
    endif
    set u = null
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [PERIODIC_period] => 1.0
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [4] => Array
                (
                    [name] => Autocast
                    [code] => if tower.userInt < 50 then
        set tower.userInt = tower.userInt + 1
        call engine_UpdateManaUse(tower)
        call engine_UpdateAnims(tower)
    endif
    call tower.getOwner().displayFloatingText("Power Level: " + I2S(tower.userInt), tower, 50+4*tower.userInt, 150-3*tower.userInt, 100-2*tower.userInt)
                    [values] => Array
                        (
                            [caster_art] => 
                            [icon] => ReplaceableTextures\CommandButtons\BTNReplay-SpeedUp.blp
                            [AUTOCAST_cooldown] => 0.5
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [AUTOCAST_isExtended] => false
                            [long_explain] => Increases the power level of the engine by |cffFFFF801|r. Maximum power level is |cffFFFF8050|r.
                            [AUTOCAST_autocastType] => AC_TYPE_NOAC_IMMEDIATE
                            [AUTOCAST_manacost] => 0
                            [AUTOCAST_range] => 0
                            [AUTOCAST_buffType] => 0
                            [name] => Speed Up
                            [AUTOCAST_targetSelf] => true
                            [short_explain] => Increases the power level of the engine.
                            [AUTOCAST_targetType] => 0
                            [target_art] => 
                            [AUTOCAST_autoRange] => 0.00
                        )

                )

            [5] => Array
                (
                    [name] => Autocast
                    [code] => if tower.userInt > 0 then
        set tower.userInt = tower.userInt - 1
        call engine_UpdateManaUse(tower)
        call engine_UpdateAnims(tower)
    endif
    call tower.getOwner().displayFloatingText("Power Level: " + I2S(tower.userInt), tower, 50+4*tower.userInt, 150-3*tower.userInt, 100-2*tower.userInt)
                    [values] => Array
                        (
                            [caster_art] => 
                            [icon] => ReplaceableTextures\CommandButtons\BTNReplay-SpeedDown.blp
                            [AUTOCAST_cooldown] => 5.00
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [AUTOCAST_isExtended] => false
                            [long_explain] => Decreases the power level of the engine by |cffFFFF801|r.
                            [AUTOCAST_autocastType] => AC_TYPE_NOAC_IMMEDIATE
                            [AUTOCAST_manacost] => 0
                            [AUTOCAST_range] => 0
                            [AUTOCAST_buffType] => 0
                            [name] => Speed Down
                            [AUTOCAST_targetSelf] => true
                            [short_explain] => Decreases the power level of the engine.
                            [AUTOCAST_targetType] => 0
                            [target_art] => 
                            [AUTOCAST_autoRange] => 0.00
                        )

                )

            [6] => Array
                (
                    [name] => On Tower Destruction
                    [code] => local Effect e = tower.userInt3
    call e.destroy()
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [7] => Array
                (
                    [name] => Tower Aura
                    [code] => Array
                        (
                        )

                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
                            [visible] => true
                            [AURA_auraEffect] => cedi_steam_buff
                            [AURA_power] => 1
                            [long_explain] => Increases attackdamage of towers in |cffFFFF80450|r AOE by |cffFFFF80[6 x power level]%|r and attackspeed by half this amount. In order to sustain this, the engine consumes a lot of mana. Mana regeneration is reduced by |cffFFFF80[10 x power level x squareroot(towers powered)]%|r. If the mana of the engine reaches zero it will deactivate itself for |cffFFFF80120|r seconds. Does not stack with other Steam Engines!
                            [AURA_level] => 1
                            [AURA_auraRange] => 450.0
                            [AURA_targetType] => TARGET_TYPE_TOWERS
                            [AURA_levelAdd] => 1
                            [AURA_powerAdd] => 1
                            [name] => Steam Power
                            [AURA_targetSelf] => false
                            [short_explain] => Increases attackspeed and attack damage of nearby player towers.
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => BHfs
                    [oeValues] => Array
                        (
                            [Bufftip] => Steam Power
                            [Buffubertip] => This tower has increased attackspeed and damage.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
                            [TargetArt] => Array
                                (
                                )

                            [EditorName] => Steam Power
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

)