Baby Tuskar v1
535
ID:
142
Family ID:
Author:
Palandu
Rarity:
uncommon
Element:
ice
Attack Type:
Elemental
Attack Range:
900
Attack CD:
1.9
Damage:
1008-1008
Abil. Factor:
0.9
Status:
Approved

Description:

Loves to brain unsuspecting units with his snowballs.

Latest Upload Comment:

Restored from 1.10
Specials:
+8% dmg to champions (+0.6%/lvl)
+10% dmg to bosses (+1%/lvl)
-20% dmg to air
Vicious Snow Ball
Throws a fast snowball on attack at the target's head when it's not facing this tower. But the snowball only has a 20% chance to hit, where it hits is decided by the angle of attack.

Temple Crusher : If it hits side-on, does 120% of its attack damage as spell damage and a 0.6 second stun.

Knockdown : If it hits the back of the head, does 40% of its attack damage as spell damage and a 0.4 second stun.

Level Bonus:
+1% chance to hit.
Download

Toggle Triggers

Header

    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

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
        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
endfunction