Frog Pipe v1
1650
lvl: 48

ID:

198

Author:

Deemzul

Rarity:

unique

Status:

Approved

Description:

A pipe with a sound that frogs cannot resist.

Latest Upload Comment:

Restored from 1.10
Frog Piper
Has a 20% chance on attack to summon 4 frogs that deal 100% attack damage when they hit an enemy.

Frogs cannot hit air.
Download

Toggle Triggers

Header

goldcost: 1650
    globals
    //@export
    ProjectileType deem_FrogPT
    endglobals
    
    function deem_FrogAttack takes Tower tower, Unit target, integer temp returns nothing
        local Projectile p 
        local real x = tower.getX()
        local real y = tower.getY()
        local real angle
        local real homerange = 190
        
        set angle = Atan2(target.getY() - y, target.getX() - x)
        set p = Projectile.create(deem_FrogPT, tower, 0.00, 0, x + GetRandomInt(-40,40), y + GetRandomInt(-40,40), 5.00, angle * bj_RADTODEG + temp)
        call p.setCollisionParameters(homerange,TARGET_CREEPS)
        set p.userInt = temp
        set p.userReal = tower.getCurrentAttackDamageWithBonus()
        set p.userReal2 = tower.calcAttackMulticrit(0,0,0)
    endfunction
    
    
    function deem_FrogCollision takes Projectile p, Unit target returns nothing
         local Tower tower = p.getCaster()
         call tower.doAttackDamage(target,p.userReal,p.userReal2)
    endfunction
    
    
    function deem_FrogPeriodic takes Projectile p returns nothing
            set p.userInt = p.userInt * -1
            set p.speed = 500
            set p.direction = p.direction + p.userInt
    endfunction
    
    
    function deem_FrogHome takes Projectile p, Unit target returns nothing
          local Tower tower = p.getCaster()
          if target.getSize() != SIZE_AIR then
          set p.speed = 500
          call p.setCollisionEnabled(false)
          call p.setHomingTarget(target)
          set p.accelerate = 8
          call p.color(95,200,255,255)
          call p.disablePeriodic()
          set p.remainingLifetime = 3.00
          endif
    endfunction
    

    private function init takes nothing returns nothing
         set deem_FrogPT = ProjectileType.createRanged("units\\critters\\Frog\\Frog.mdl", 3700.0, 500.0) 
         call deem_FrogPT.enableCollision( deem_FrogHome, 0.00, TARGET_CREEPS, false )
         call deem_FrogPT.enableHoming(deem_FrogCollision, 0 )
         call deem_FrogPT.enablePeriodic(deem_FrogPeriodic,0.60)
         call deem_FrogPT.setAcceleration(-36)
         call deem_FrogPT.disableExplodeOnHit()
    endfunction

On Attack

goldcost: 0 ONATTACK_chance: 0.2 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Item itm returns nothing
    local Unit target = Event.getTarget()
    if target.getSize() != SIZE_AIR then
        call deem_FrogAttack(itm.getCarrier(),target,GetRandomInt(-40,-20))
        call deem_FrogAttack(itm.getCarrier(),target,GetRandomInt(-20,-0))
        call deem_FrogAttack(itm.getCarrier(),target,GetRandomInt(0,20))
        call deem_FrogAttack(itm.getCarrier(),target,GetRandomInt(20,40))
    endif
endfunction