Array
(
    [scriptVersion] => 7
    [oeValues] => Array
        (
            [RngBuff1] => 250
            [scaleBull] => 0
            [MissileHoming] => 1
            [Upgrade] => Array
                (
                )

            [targs1] => Array
                (
                )

            [goldcost] => 535
            [weapsOn] => 1
            [dice1] => 1
            [Missilespeed] => 1100
            [targCount1] => 1
            [moveHeight] => 28
            [file] => Units\Creeps\tuskar\tuskar.mdl
            [atkType1] => pierce
            [dmgpt1] => 0.4
            [modelScale] => 0.45
            [weapTp1] => missile
            [acquire] => 900
            [rangeN1] => 900
            [upgrades] => Array
                (
                )

            [cool1] => 1.9
            [Ubertip] => Loves to brain unsuspecting units with his snowballs.
            [backSw1] => 0.5
            [abilList] => Array
                (
                )

            [Name] => Baby Tuskar
            [Missileart] => abilities\weapons\TuskarSpear\TuskarSpear.mdl
            [Art] => ReplaceableTextures\CommandButtons\BTNTuskaarBrown.blp
            [buildingShadow] => Array
                (
                )

            [turnRate] => 0.14
            [sides1] => 1
            [uberSplat] => Array
                (
                )

            [auto] => Array
                (
                )

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

    [settings] => Array
        (
            [author] => Palandu
            [element] => ice
            [authorDisplay] => |cffbdb76bPalandu|r
            [alpha] => 255
            [balanceTip] => |cffFFFF00+8% |rdmg to champions (|cffFFFF00+0.6%|r/lvl)|n|cffFFFF00+10% |rdmg to bosses (|cffFFFF00+1%|r/lvl)|n|cffFFFF00-20% |rdmg to air
            [rarity] => uncommon
            [version] => 1.0
            [abil_factor] => 0.9
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 1.29834
                    [y] => 17.1281
                    [z] => 0
                    [scale] => 1
                    [rot] => 1.74533
                    [file] => Doodads\Ashenvale\Structures\AshenRubble\AshenRubble2.mdl
                    [red] => 1
                    [green] => 50
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -33.4313
                    [y] => 11.5108
                    [z] => 0
                    [scale] => 0.4
                    [rot] => 0
                    [file] => Doodads\Icecrown\Rocks\IceBlock\IceBlock2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 25.3611
                    [y] => 30.0285
                    [z] => 0
                    [scale] => 0.4
                    [rot] => 3.19395
                    [file] => Doodads\Icecrown\Rocks\IceBlock\IceBlock2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 10.0004
                    [y] => -39.7722
                    [z] => 0
                    [scale] => 0.4
                    [rot] => 3.80482
                    [file] => Doodads\Icecrown\Rocks\IceBlock\IceBlock2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_DMG_TO_CHAMPION
                    [base] => 0.08
                    [add] => 0.006
                )

            [1] => Array
                (
                    [id] => MOD_DMG_TO_BOSS
                    [base] => 0.1
                    [add] => 0.01
                )

            [2] => Array
                (
                    [id] => MOD_DMG_TO_AIR
                    [base] => -0.2
                    [add] => 0
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        ProjectileType billy_SnowBall
    endglobals
    
    private function billy_SnowBallHit takes Projectile p, Unit target returns nothing
        local Unit t = p.getCaster()
        if p.userInt == 0 then //miss
            call t.getOwner().displayFloatingTextX2("missed", target, 150, 50, 0, 155, 0.07, 1, 2, 0.018, 0)
        else
            call t.doSpellDamage(target, p.userReal, t.calcSpellCritNoBonus())
            call cb_stun.applyOnlyTimed(t, target, p.userReal2)
            call SFXAtUnit("Abilities\\Spells\\Other\\FrostBolt\\FrostBoltMissile.mdl", target.getUnit())
            if p.userInt2 == 1 then //temple shot
                call t.getOwner().displayFloatingTextX2("Temple Crusher!", target, 150, 50, 255, 200, 0.07, 2, 3, 0.026, 0)
            else
                call t.getOwner().displayFloatingTextX2("Knockdown!", target, 0, 0, 255, 155, 0.07, 1.5, 3, 0.022, 0)
            endif
        endif
    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 billy_SnowBall = ProjectileType.createInterpolate("Abilities\\Spells\\Items\\AIob\\AIobTarget.mdl", 2000)
        call billy_SnowBall.enableHoming(billy_SnowBallHit,0)
    endfunction
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Attack
                    [code] => local Unit u = Event.getTarget()
        local real facingDelta
        local real unitToTowerVector = Atan2(tower.getY() - u.getY(), tower.getX() - u.getX())*bj_RADTODEG
        local Projectile p
        
        if (unitToTowerVector < 0) then
           set unitToTowerVector = unitToTowerVector + 360
        endif
        
        set facingDelta = unitToTowerVector - GetUnitFacing(u.getUnit()) 
        
        if (facingDelta < 0) then               
            set facingDelta = facingDelta + 360
        endif
        
        if (facingDelta > 180) then
            set facingDelta = 360 - facingDelta
        endif
        
        if facingDelta >=80 then   //launch
            set p = Projectile.createFromUnitToUnit(billy_SnowBall, tower, 100, 0, tower, Event.getTarget(), true, false, true)
            call p.setScale(0.8)
            if facingDelta <=100 then   //temple shot
                set p.userInt2=1
                set p.userReal=tower.getCurrentAttackDamageWithBonus()*1.2
                set p.userReal2=0.6
            else                        //back of the head
                set p.userInt2=2
                set p.userReal=tower.getCurrentAttackDamageWithBonus()*0.4
                set p.userReal2=0.4
            endif
            
            //decide hit/miss
            if tower.calcChance(0.20+I2R(tower.getLevel())/100) then
                set p.userInt = 1 //hit
            else
                set p.userInt = 0 //miss
            endif
        endif
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNFrostBolt.blp
                            [visible] => true
                            [name] => Vicious Snow Ball
                            [short_explain] => Hurls snowballs at the enemies heads.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => Throws a fast snowball on attack at the target's head when it's not facing this tower. But the snowball only has a |cffFFFF8020%|r chance to hit, where it hits is decided by the angle of attack.|n|n|cff9b32ffTemple Crusher|r : If it hits side-on, does |cffFFFF80120%|r of its attack damage as spell damage and a |cffFFFF800.6|r second stun.|n|n|cff00ff9bKnockdown|r : If it hits the back of the head, does |cffFFFF8040%|r of its attack damage as spell damage and a |cffFFFF800.4|r second stun.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+1%|r chance to hit.
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

    [references] => Array
        (
            [0] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => ProjectileType
                    [name] => billy_SnowBall
                )

        )

)