Morphling v1
3100
ID:
319
Family ID:
Author:
DaveMatthews
Rarity:
unique
Element:
nature
Attack Type:
Essence
Attack Range:
900
Attack CD:
1.5
Damage:
3910-3910
Status:
Approved

Description:

His adaptive nature makes him very versatile.
Morph: Might
Activates "Morph: Might". As long as this buff is on this tower gains 2% base damage and loses 2% attack speed on every attack, up to a maximum of 50 times. Removes "Morph: Swiftness" and resets its bonus when activated.

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 1s cooldown
Morph: Swiftness
Activates "Morph: Swiftness". As long as this buff is on this tower gains 2% attack speed and loses 2% base damage on every attack, up to a maximum of 50 times. Removes "Morph: Might" and resets its bonus when activated.

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 1s cooldown
Adapt
Stops the effect of morphs, leaving the current buff on the tower. Using the spell again removes Adapt.

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 1s cooldown
Evolve
Every time it casts Morphling Strike, this tower permanently gains 0.2% base damage and 0.1% attack speed if "Morph: Might" has at least 25 stacks, or 0.2% attack speed and 0.1% base damage if "Morph: Swiftness" has at least 25 stacks.  Can evolve a maximum of 500 times.
Morphling Strike
Every time this tower damages a unit, it has a 20% chance to launch 3 projectiles to random creeps in 900 range, dealing 2000 spell damage to them. On impact, if "Morph: Might" has at least 25 stacks, the projectiles deal additional spell damage equal to 25% of the tower's damage per second for 5 seconds; if "Morph: Swiftness" has at least 25 stacks, they slow the targets by 20% and increase the damage they receive from nature by 15% for 8 seconds. 

Level Bonus:
+60 damage 
+0.8% damage per second 
+0.4% slow 
+0.2% damage from nature 
+0.6% chance
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 1 AUTOCAST_numBuffsBeforeIdle: 1 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_buffType: dave_morph_damage AUTOCAST_targetSelf: true AUTOCAST_targetType: TARGET_TYPE_TOWERS target_art: AUTOCAST_autoRange: 0
private function onAutocast takes Tower tower returns nothing
local Buff b = tower.getBuffOfType(dave_morph_damage)
local integer bufflevel = b.getLevel()

if tower.getBuffOfType(dave_morph_damage)==0 then
   if tower.getBuffOfType(dave_morph_speed)!=0 then
     call tower.getBuffOfType(dave_morph_speed).removeBuff()
   endif
   call dave_morph_damage.apply(tower, tower, bufflevel)
endif
 
endfunction

Autocast

caster_art: AUTOCAST_cooldown: 1 AUTOCAST_numBuffsBeforeIdle: 1 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_buffType: dave_morph_speed AUTOCAST_targetSelf: true AUTOCAST_targetType: TARGET_TYPE_TOWERS target_art: AUTOCAST_autoRange: 0
private function onAutocast takes Tower tower returns nothing
local Buff b = tower.getBuffOfType(dave_morph_speed)
local integer bufflevel = b.getLevel()

if tower.getBuffOfType(dave_morph_speed)==0 then
   if tower.getBuffOfType(dave_morph_damage)!=0 then
      call tower.getBuffOfType(dave_morph_damage).removeBuff()
   endif
   call dave_morph_speed.apply(tower, tower, bufflevel)
endif
endfunction

Autocast

caster_art: AUTOCAST_cooldown: 1 AUTOCAST_numBuffsBeforeIdle: 1 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_buffType: dave_morph_adapt AUTOCAST_targetSelf: true AUTOCAST_targetType: TARGET_TYPE_TOWERS target_art: AUTOCAST_autoRange: 0
private function onAutocast takes Tower tower returns nothing
local Buff b = tower.getBuffOfType(dave_morph_adapt)
local integer bufflevel = b.getLevel()

if tower.getBuffOfType(dave_morph_adapt)==0 then
   call dave_morph_adapt.apply(tower, tower, bufflevel)
elseif tower.getBuffOfType(dave_morph_adapt)!=0 then
   call tower.getBuffOfType(dave_morph_adapt).removeBuff()
endif
endfunction

Header

    globals
    BuffType dave_morph_damage
    BuffType dave_morph_speed
    BuffType dave_morph_slow
    BuffType dave_morph_adapt
    BuffType dave_morph_dot
    ProjectileType dave_morph_strike_damage
    ProjectileType dave_morph_strike_speed 
    MultiboardValues dave_absorb_MultiboardValue
    endglobals
    
    function morphSpeedHit takes Projectile p, Unit creep returns nothing
    local Tower tower = p.getCaster()
    local integer level= tower.getLevel()
    
    call tower.doSpellDamage(creep,2000+(60*level), tower.calcSpellCritNoBonus())
    call dave_morph_slow.apply(tower, creep, level)
    endfunction
    
    function morphDamageHit takes Projectile p, Unit creep returns nothing
    local Tower tower = p.getCaster()
    local integer level= tower.getLevel()
    
    call tower.doSpellDamage(creep,2000+(60*level), tower.calcSpellCritNoBonus())
    call dave_morph_dot.apply(tower, creep, level)
    endfunction
    
    function dot takes Buff b returns nothing
    local Tower tower = b.getCaster()
    local integer level= tower.getLevel()
    call tower.doSpellDamage(b.getBuffedUnit(), tower.getCurrentAttackDamageWithBonus()*(0.25+0.008*level),tower.calcSpellCritNoBonus())
    endfunction    

    private function init takes nothing returns nothing
    local Modifier m = Modifier.create()
    local Modifier n = Modifier.create()
    local Modifier o = Modifier.create()
    
    set dave_morph_damage = BuffType.create(-1,0,true)
    call dave_morph_damage.setBuffModifier(m)
    call m.addModification(MOD_DAMAGE_BASE_PERC,0.0,0.02)
    call m.addModification(MOD_ATTACKSPEED,0.0,-0.02)
    call dave_morph_damage.setBuffIcon( '@@1@@' )
    
    set dave_morph_speed = BuffType.create(-1,0,true)
    call dave_morph_speed.setBuffModifier(n)
    call n.addModification(MOD_DAMAGE_BASE_PERC,0.0,-0.02)
    call n.addModification(MOD_ATTACKSPEED,0.0,0.02)
    call dave_morph_speed.setBuffIcon( '@@0@@' )
    
    set dave_morph_adapt = BuffType.create(-1,0,true)
    call dave_morph_adapt.setBuffIcon( '@@2@@' )
    
    set dave_morph_dot = BuffType.create(5,0,false)
    call dave_morph_dot.setBuffIcon( '@@4@@' )
    call dave_morph_dot.addPeriodicEvent(EventHandler.dot,1)
    
    set dave_morph_slow = BuffType.create(8,0.1,false)
    call dave_morph_slow.setBuffModifier(o)
    call o.addModification(MOD_MOVESPEED,-0.2,-0.004)
    call o.addModification(MOD_DMG_FROM_NATURE,0.15,0.002)
    call dave_morph_slow.setBuffIcon( '@@3@@' )
    
    set dave_morph_strike_damage = ProjectileType.create("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl",4,800)
    call dave_morph_strike_damage.enableHoming(ProjectileTargetEvent.morphDamageHit,0)
    
    set dave_morph_strike_speed = ProjectileType.create("Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl",4,800)
    call dave_morph_strike_speed.enableHoming(ProjectileTargetEvent.morphSpeedHit,0)
    
    set dave_absorb_MultiboardValue = MultiboardValues.create(2)
    call dave_absorb_MultiboardValue.setKey(0,"Evolve")
    call dave_absorb_MultiboardValue.setKey(1,"Morph level")
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
local Buff bd = tower.getBuffOfType(dave_morph_damage)
local Buff bs = tower.getBuffOfType(dave_morph_speed)

if tower.getBuffOfType(dave_morph_adapt)==0 then
   if bd!=0 and bd.getLevel()<50 then
       call dave_morph_damage.apply(tower, tower, bd.getLevel()+1)
   elseif bs!=0 and bs.getLevel()<50 then
       call dave_morph_speed.apply(tower, tower, bs.getLevel()+1)
   endif
endif
endfunction

On Damage

ONDAMAGE_chance: 0.2 ONDAMAGE_chanceLevelAdd: 0.006
function onDamage takes Tower tower returns nothing
local integer level = tower.getLevel()
local Iterate i
local Projectile p
local integer count = 0
local Unit next
local Buff bd = tower.getBuffOfType(dave_morph_damage)
local Buff bs = tower.getBuffOfType(dave_morph_speed)
local ProjectileType pt = 0
local real scale = 1.0

if bd != 0 and bd.getLevel()>=25 then
  set pt = dave_morph_strike_damage
  set scale = 1.6
  if tower.userInt < 500 then
     call tower.modifyProperty(MOD_DAMAGE_BASE_PERC, 0.002)
     call tower.modifyProperty(MOD_ATTACKSPEED, 0.001)
     set tower.userInt = tower.userInt + 1
  endif
elseif bs != 0 and bs.getLevel()>=25 then
  set pt = dave_morph_strike_speed
  if tower.userInt < 500 then
     call tower.modifyProperty(MOD_ATTACKSPEED, 0.002)
     call tower.modifyProperty(MOD_DAMAGE_BASE_PERC, 0.001)
     set tower.userInt = tower.userInt + 1
  endif
endif

if pt != 0 then
  set i = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,900)
  loop
    set next=i.next()
    set count=count+1
    exitwhen next==0 or count==4
    set p = Projectile.createFromUnitToUnit(pt,tower,1,1, tower, next, true, false, false)
    call p.setScale(scale)
  endloop
  if next != 0 then
    call i.destroy()
  endif
endif
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
set tower.userInt = 0
endfunction

On Tower Details

goldcost: 0
function onTowerDetails takes Tower tower returns MultiboardValues
local Buff d = tower.getBuffOfType(dave_morph_damage)
local integer bufflevelD = 0
local Buff s = tower.getBuffOfType(dave_morph_speed)
local integer bufflevelS = 0

if d != 0 then
   set bufflevelD = d.getLevel()
   call dave_absorb_MultiboardValue.setValue(1,I2S(bufflevelD))
endif

if s != 0 then
   set bufflevelS = s.getLevel()
   call dave_absorb_MultiboardValue.setValue(1,I2S(bufflevelS))
endif

call dave_absorb_MultiboardValue.setValue(0,I2S(tower.userInt))
return dave_absorb_MultiboardValue
endfunction