Lesser Elemental Ghost v1
180
ID:
134
Family ID:
Author:
Der_kleine_Tomy
Rarity:
uncommon
Element:
fire
Attack Type:
Essence
Attack Range:
950
Attack CD:
2
Damage:
329-329
Abil. Factor:
0.85
Status:
Approved

Description:

A mysterious Ghost, which deals different damage types.

Latest Upload Comment:

Restored from 1.10
Specials:
+0.5% trigger chances/lvl
Elemental Wrath
The Elemental Ghost has a 15% chance to unleash it's wrath on attack, increasing its trigger chance by 15% for 5 seconds. Cannot retrigger during Elemental Wrath.

Level Bonus:
+0.1 seconds duration
+0.5% trigger chance increase
Mimic
The Ghost's attacks are varied, and its damage type will either be good or bad against its target. Trigger chance adjusts the good/bad attacks to be better.
Download

Toggle Triggers

Header

    globals
        //@export
        BuffType tomy_ElementalWrath
    endglobals
    

    
    //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 modifier = Modifier.create()
        call modifier.addModification(MOD_TRIGGER_CHANCES, 0.00, 0.001)
        set tomy_ElementalWrath = BuffType.create(5.0, 0.00, true)
        call tomy_ElementalWrath.setBuffIcon('@@0@@')
        call tomy_ElementalWrath.setBuffModifier(modifier)
    endfunction

On Attack

ONATTACK_chance: 0.15 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    if tower.getBuffOfType(tomy_ElementalWrath) == 0 then
        call tomy_ElementalWrath.applyCustomTimed(tower, tower, 150 + tower.getLevel() * 5, 5.0 + 0.1 * tower.getLevel())
    endif
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
 
    local Creep target = Event.getTarget()
    local boolean immune = target.isImmune()
    local boolean sif = target.getArmorType() == ARMOR_SIF
    local boolean zod = target.getArmorType() == ARMOR_ZOD
    local integer level = tower.getLevel()
    local real damageadd
    local real posDamageTypes = 3
  
    if immune then
        set posDamageTypes = 2
    endif
  
    if GetRandomInt(1, 100) > 50 then
        if sif or zod then
            set damageadd = 1.00
        elseif tower.calcChance(1.00/posDamageTypes) then
            set damageadd = 1.80
        elseif not immune and tower.calcChance(1.00/(posDamageTypes - 1)) then
            set damageadd = 1.50
        else
            set damageadd = 1.20
        endif
    else
        if zod then
            set damageadd = 0.90
        elseif sif then
            if not immune or (immune and tower.calcChance(0.50)) then
                set damageadd = 0.40
            else
                set damageadd = 0.00
            endif
        elseif tower.calcChance(1.00/(6.00-posDamageTypes)) then
            set damageadd = 1.00
        elseif tower.calcChance(1.00/(6.00-(posDamageTypes + 1))) then
            set damageadd = 0.90
        elseif not immune or (immune and tower.calcChance(1.00/(6.00-(posDamageTypes + 2)))) then
            set damageadd = 0.60
        else
            set damageadd = 0.00
        endif
    endif
  
    set Event.damage = Event.damage * damageadd
    if damageadd > 1.00 then
        call tower.getOwner().displaySmallFloatingText(formatFloat(damageadd,2), tower, 0, 255, 0, 40)
    elseif damageadd < 1.00 then
        call tower.getOwner().displaySmallFloatingText(formatFloat(damageadd,2), tower, 255, 0, 0, 40)
    else
        call tower.getOwner().displaySmallFloatingText(formatFloat(damageadd,2), tower, 255, 255, 255, 40)
    endif
endfunction