Inflamed Stone v1
1000
ID:
241
Family ID:
Author:
SirCoqaLot.
Rarity:
rare
Element:
fire
Attack Type:
Magic
Attack Range:
850
Attack CD:
1
Damage:
1-192
Abil. Factor:
0.09
Status:
Unapproved

Description:

Advanced tower that will critical strike if it is has enough mana.

Latest Upload Comment:

Restored from 1.10
Specials:
+2% mana regen/lvl
Spellfire
This tower treats all spell modifiers as attack bonuses, with an 84% bonus gain of stated effect. This is recalculated before every attack. 

Level Bonus:
+3.36% bonus gain
Spellfire Projectiles
If this tower has at least 20 mana when it attacks, it will pay all its mana to proc a critical strike. 20 Mana is used to grant the critical strike and every further point of mana spent grants 8% more critical damage to that attack. 

Level Bonus:
-.2 Mana needed
Download

Toggle Triggers

Header

    globals

    //@export
    BuffType spellFlameDamage
    
    //@export
    BuffType spellFlameCritDamage

    //@export
    BuffType spellFlameCritChance
    
    endglobals
    
    //@export
    function addAttackStats takes Tower tower returns nothing 
        local integer lvl = tower.getLevel()
    local real spellBonuses = .84*100+100
    local real spellLevel = .0336*100
        //Just grab the current spell damage
    //Add attackdamage equal to that amount.
    //It should be a buff though.
    
    call spellFlameDamage.apply(tower, tower,R2I((tower.getProp_SpellDmgDealt())*(spellBonuses+spellLevel*lvl)))
    call spellFlameCritDamage.apply(tower, tower,R2I((tower.getProp_SpellCritDamage())*(spellBonuses+spellLevel*lvl)))
    call spellFlameCritChance.apply(tower, tower,R2I((tower.getProp_SpellCritChance())*(spellBonuses+spellLevel*lvl)))

    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
        local Modifier m = Modifier.create()
        set spellFlameDamage = BuffType.create(-1,0,false)
    call m.addModification(MOD_DAMAGE_ADD_PERC, 0.000, 0.01)
    call spellFlameDamage.setBuffModifier(m)

    
    set m = Modifier.create()
        call m.addModification( MOD_ATK_CRIT_CHANCE, 0.000, 0.01 )
        set spellFlameCritChance = BuffType.create(-1,0,false)
    call spellFlameCritChance.setBuffModifier(m)
    

    set m = Modifier.create()
    call m.addModification( MOD_ATK_CRIT_DAMAGE, 0.000, 0.01 )
    set spellFlameCritDamage= BuffType.create(-1,0,false)
        call spellFlameCritDamage.setBuffModifier(m)

    endfunction       

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local real mana = GetUnitState(tower.getUnit(),UNIT_STATE_MANA)
    call addAttackStats (tower)
    if mana >= (20 - 0.2*tower.getLevel()) then
        call tower.subtractMana(mana, false) 
        call tower.addCustomAttackCrit((mana - (20 - 0.2*tower.getLevel())) *0.08+tower.getProp_AtkCritDamage())
    endif
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing

endfunction