Servant of the Twin Flames v1
2350
ID:
212
Family ID:
Author:
DaveMatthews
Rarity:
unique
Element:
fire
Attack Type:
Physical
Attack Range:
900
Attack CD:
1.1
Damage:
2043-2043
Status:
Approved

Description:

A fighter skilled in both physical and magical attacks.
Twin Pulses
Every time this tower has launched 8 red flames, it releases a green pulse, dealing 55% of its attack damage as spell damage in 900 AoE and every time it has launched 8 green flames, it releases a red pulse, dealing 55% of its attack damage as physical damage in 900 AoE. 

Level Bonus: 
+0.5% damage 
-1 flame needed at level 15 and 25
Twin Flames
On each attack, this tower has a chance equal to its crit chance to launch a green flame, dealing 65% of tower's attack damage as spell damage, and a chance equal to its spell crit chance to launch a red flame, dealing 65% of tower's attack damage as physical damage. 

Level Bonus: 
+0.5% damage
Twin Disciplines
Each time it scores a critical hit with an attack, this tower gains 1% bonus critical chance or spell critical chance, both stacking up to 10 times, for 7 seconds. The lower chance will always be prioritized.
Download

Toggle Triggers

Header

    globals
        //@export
        BuffType dave_physical_buff
        //@export
        BuffType dave_spell_buff
        //@export
        ProjectileType dave_red
        //@export
        ProjectileType dave_green
    endglobals
    
    
    function redHit takes Projectile p, Unit creep returns nothing  
        local Tower tower = p.getCaster()
        local integer level= tower.getLevel()
        call tower.doAttackDamage(creep,tower.getCurrentAttackDamageWithBonus()*p.userReal, tower.calcAttackMulticrit(0,0,0))  
    endfunction
    
    function greenHit takes Projectile p, Unit creep returns nothing  
        local Tower tower = p.getCaster()
        local integer level= tower.getLevel()
        call tower.doSpellDamage(creep,tower.getCurrentAttackDamageWithBonus()*p.userReal, tower.calcSpellCritNoBonus())  
    endfunction
    

    private function init takes nothing returns nothing
        local Modifier m = Modifier.create()
        local Modifier n = Modifier.create()
        
        //Physical
        set dave_physical_buff = BuffType.create(7,0,true)
        call m.addModification(MOD_ATK_CRIT_CHANCE,0,0.01)
        call dave_physical_buff.setBuffModifier(m)
        call dave_physical_buff.setBuffIcon('@@1@@')
        
        //Spell        
        set dave_spell_buff = BuffType.create(7,0,true)
        call n.addModification(MOD_SPELL_CRIT_CHANCE,0,0.01)         
        call dave_spell_buff.setBuffModifier(n)
        call dave_spell_buff.setBuffIcon('@@0@@')
        
        //Missiles
        set dave_red = ProjectileType.create("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl",4,1000) 
        call dave_red.setEventOnInterpolationFinished(ProjectileTargetEvent.redHit)
        set dave_green = ProjectileType.create("Abilities\\Weapons\\GreenDragonMissile\\GreenDragonMissile.mdl",4,1000)
        call dave_green.setEventOnInterpolationFinished(ProjectileTargetEvent.greenHit)
        
    endfunction

On Attack

ONATTACK_chance: 1 ONATTACK_chanceLevelAdd: 0
function onAttack takes Tower tower returns nothing
local Projectile p
local Iterate it
local Effect e
local Unit u
local integer level = tower.getLevel()

if tower.calcChance( tower.getProp_SpellCritChance() ) then
    set Projectile.createBezierInterpolationFromUnitToUnit(dave_red,tower,1,1,tower,Event.getTarget(),0,0.3,0,true).userReal = 0.65+0.005*level
    if tower.userInt >= tower.userInt3 then
        set tower.userInt = 0
        set it = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,900)
        loop
          set u = it.next()
          exitwhen u == 0
          call tower.doSpellDamage(u,tower.getCurrentAttackDamageWithBonus()*(0.55+0.005*level),tower.calcSpellCritNoBonus())
          call SFXOnUnit("Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl",u.getUnit(), "chest")
          set e = Effect.createColored("Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl",tower.getX()-48,tower.getY()+48, 40, 0.0, 0.42, 0, 255, 0, 255)
          call e.setLifetime(0.5)
        endloop
    else
        set tower.userInt = tower.userInt + 1
    endif
endif
    
if tower.calcChance( tower.getProp_AtkCritChance() ) then
    set Projectile.createBezierInterpolationFromUnitToUnit(dave_green,tower,1,1,tower,Event.getTarget(),0,-0.3,0,true).userReal = 0.65+0.005*level
    if tower.userInt2 >= tower.userInt3 then
        set tower.userInt2 = 0
        set it = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,900)
        loop
          set u = it.next()
          exitwhen u == 0
          call tower.doAttackDamage(u,tower.getCurrentAttackDamageWithBonus()*(0.55+0.005*level),tower.calcAttackMulticrit(0,0,0))
          call SFXOnUnit("Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl",u.getUnit(), "chest")
          set e = Effect.createColored("Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl",tower.getX()+48,tower.getY()+48, 40, 0.0, 0.42, 255, 0, 0, 255)
          call e.setLifetime(0.5)
        endloop 
    else 
        set tower.userInt2 = tower.userInt2 + 1
    endif
endif
endfunction

On Damage

ONDAMAGE_chance: 1 ONDAMAGE_chanceLevelAdd: 0
function onDamage takes Tower tower returns nothing
local Buff b = tower.getBuffOfType(dave_physical_buff)
local Buff s = tower.getBuffOfType(dave_spell_buff)
local integer levelP
local integer levelS

if b != 0 then
   set levelP = b.getLevel()
endif

if s !=0 then
   set levelS = s.getLevel()
endif

if Event.isAttackDamageCritical() then
  if tower.getProp_AtkCritChance() < tower.getProp_SpellCritChance() or levelS == 10 then
     if b==0 then
        call dave_physical_buff.apply(tower,tower,1)
     else
        call dave_physical_buff.apply(tower,tower,IMinBJ(levelP + 1, 10))
     endif
  elseif tower.getProp_AtkCritChance() > tower.getProp_SpellCritChance() or levelP == 10 then
     if s==0 then
        call dave_spell_buff.apply(tower,tower, 1)
     else
        call dave_spell_buff.apply(tower,tower,IMinBJ(levelS + 1, 10))
     endif
  endif
endif
endfunction

On Level Up

function onLevelUp takes Tower tower returns nothing
  if tower.getLevel() < 15 then
    set tower.userInt3 = 8
  elseif tower.getLevel() < 25 then
    set tower.userInt3 = 7 
  elseif tower.getLevel() == 25 then
    set tower.userInt3 = 6
  endif
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
  set tower.userInt = 0
  set tower.userInt2 = 0
  
  if tower.getLevel() < 15 then
    set tower.userInt3 = 8
  elseif tower.getLevel() < 25 then
    set tower.userInt3 = 7 
  elseif tower.getLevel() == 25 then
    set tower.userInt3 = 6
  endif
endfunction
Keeper of the Twin Flames v1
3500
ID:
213
Family ID:
Author:
DaveMatthews
Rarity:
unique
Element:
fire
Attack Type:
Physical
Attack Range:
900
Attack CD:
1.1
Damage:
2825-2825
Status:
Approved

Description:

A fighter skilled in both physical and magical attacks.
Twin Pulses
Every time this tower has launched 8 red flames, it releases a green pulse, dealing 75% of its attack damage as spell damage in 900 AoE and every time it has launched 8 green flames, it releases a red pulse, dealing 75% of its attack damage as physical damage in 900 AoE. 

Level Bonus: 
+1% damage 
-1 flame needed at level 15 and 25
Twin Flames
On each attack, this tower has a chance equal to its crit chance to launch a green flame, dealing 75% of tower's attack damage as spell damage, and a chance equal to its spell crit chance to launch a red flame, dealing 75% of tower's attack damage as physical damage. 

Level Bonus: 
+1% damage
Twin Disciplines
Each time it scores a critical hit with an attack, this tower gains 2% bonus critical chance or spell critical chance, both stacking up to 10 times, for 7 seconds. The lower chance will always be prioritized.
Download

Toggle Triggers

Header

    globals
        //@import
        BuffType dave_physical_buff
        //@import
        BuffType dave_spell_buff
        //@import
        ProjectileType dave_red
        //@import
        ProjectileType dave_green
    endglobals

    private function init takes nothing returns nothing
    endfunction

On Attack

ONATTACK_chance: 1 ONATTACK_chanceLevelAdd: 0
function onAttack takes Tower tower returns nothing
local Projectile p
local Iterate it
local Effect e
local Unit u
local integer level = tower.getLevel()

if tower.calcChance( tower.getProp_SpellCritChance() ) then
    set Projectile.createBezierInterpolationFromUnitToUnit(dave_red,tower,1,1,tower,Event.getTarget(),0,0.3,0,true).userReal = 0.75+0.01*level
    if tower.userInt >= tower.userInt3 then
    set tower.userInt = 0
    set it = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,900)
    loop
      set u = it.next()
      exitwhen u == 0
      call tower.doSpellDamage(u,tower.getCurrentAttackDamageWithBonus()*(0.75+0.01*level),tower.calcSpellCritNoBonus())
      call SFXOnUnit("Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl",u.getUnit(), "chest")
      set e = Effect.createColored("Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl",tower.getX()-48,tower.getY()+48, 40, 0.0, 0.42, 0, 255, 0, 255)
      call e.setLifetime(0.5)
    endloop
    else
    set tower.userInt = tower.userInt + 1
    endif
endif
    
if tower.calcChance( tower.getProp_AtkCritChance() ) then
    set Projectile.createBezierInterpolationFromUnitToUnit(dave_green,tower,1,1,tower,Event.getTarget(),0,-0.3,0,true).userReal = 0.75+0.01*level
    if tower.userInt2 >= tower.userInt3 then
    set tower.userInt2 = 0
    set it = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,900)
    loop
      set u = it.next()
      exitwhen u == 0
      call tower.doAttackDamage(u,tower.getCurrentAttackDamageWithBonus()*(0.75+0.01*level),tower.calcAttackMulticrit(0,0,0))
      call SFXOnUnit("Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl",u.getUnit(), "chest")
      set e = Effect.createColored("Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl",tower.getX()+48,tower.getY()+48, 40, 0.0, 0.42, 255, 0, 0, 255)
      call e.setLifetime(0.5)
    endloop 
    else 
    set tower.userInt2 = tower.userInt2 + 1
    endif
endif
endfunction

On Damage

ONDAMAGE_chance: 1 ONDAMAGE_chanceLevelAdd: 0
function onDamage takes Tower tower returns nothing
local Buff b = tower.getBuffOfType(dave_physical_buff)
local Buff s = tower.getBuffOfType(dave_spell_buff)
local integer levelP
local integer levelS

if b != 0 then
   set levelP = b.getLevel()
endif

if s !=0 then
   set levelS = s.getLevel()
endif

if Event.isAttackDamageCritical() then
  if tower.getProp_AtkCritChance() < tower.getProp_SpellCritChance() or levelS == 10 then
     if b==0 then
        call dave_physical_buff.apply(tower,tower,1)
     else
        call dave_physical_buff.apply(tower,tower,IMinBJ(levelP + 1, 10))
     endif
  elseif tower.getProp_AtkCritChance() > tower.getProp_SpellCritChance() or levelP == 10 then
     if s==0 then
        call dave_spell_buff.apply(tower,tower, 1)
     else
        call dave_spell_buff.apply(tower,tower,IMinBJ(levelS + 1, 10))
     endif
  endif
endif
endfunction

On Level Up

function onLevelUp takes Tower tower returns nothing
  if tower.getLevel() < 15 then
    set tower.userInt3 = 8
  elseif tower.getLevel() < 25 then
    set tower.userInt3 = 7 
  elseif tower.getLevel() == 25 then
    set tower.userInt3 = 6
  endif
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
  set tower.userInt = 0
  set tower.userInt2 = 0
  
  if tower.getLevel() < 15 then
    set tower.userInt3 = 8
  elseif tower.getLevel() < 25 then
    set tower.userInt3 = 7 
  elseif tower.getLevel() == 25 then
    set tower.userInt3 = 6
  endif
endfunction