Nature Sprites v1
400
ID:
396
Family ID:
Author:
DaveMatthews
Rarity:
uncommon
Element:
nature
Attack Type:
Essence
Attack Range:
900
Attack CD:
1.2
Damage:
338-338
Abil. Factor:
0.7
Status:
Approved

Description:

Friendly spirits that live in the trees.

Latest Upload Comment:

Restored from 1.10
Nature's Gift
One of the spirits flies towards a tower in 500 range and buffs it for 5 seconds. The buff has a different effect depending on the tower's element:
+28% experience for Astral
+16% spell damage for Darkness
+4% crit chance for Nature
+16% damage for Fire
+20% buff duration for Ice
+8% attack speed for Storm
+6% item chance for Iron
The buffed tower has a 25% chance to receive another random effect in addition to the first one.

Level Bonus:
+0.8% experience
+0.4% spell damage
+0.1% crit chance
+0.4% damage
+0.6% buff duration
+0.2% attack speed
+0.14% item chance
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 2 AUTOCAST_autoRange: 500 AUTOCAST_manacost: 45 AUTOCAST_range: 500 AUTOCAST_targetType: TARGET_TYPE_TOWERS AUTOCAST_numBuffsBeforeIdle: 5 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Projectile p
    set p = Projectile.createFromUnitToUnit(dave_sprite, tower, 0, 0, tower, Event.getTarget(), true, false, false)
    call p.setScale(0.75)
    call p.color(50,255,50,255)
endfunction

Header

    globals
        BuffType dave_gift
        //@export
        ProjectileType dave_sprite
    endglobals
    
function gift_create takes Buff B returns nothing
    local Tower target = B.getBuffedUnit()
    local Tower tower = B.getCaster()
    local integer elem = target.getCategory()
    local integer relem
    local integer level = B.getLevel()
    local real memberModifier = tower.userReal // scale factor based on family member
    
    // Ensure caster is still alive.
    if tower == 0 then
        return
    endif

    if elem == Element.ASTRAL then
        set B.userInt = MOD_EXP_RECEIVED
        set B.userReal = (0.28 + level * 0.008) * memberModifier
    elseif elem == Element.DARKNESS then
        set B.userInt = MOD_SPELL_DAMAGE_DEALT
        set B.userReal = (0.16 + level * 0.004) * memberModifier
    elseif elem == Element.NATURE then
        set B.userInt = MOD_ATK_CRIT_CHANCE
        set B.userReal = (0.04 + level * 0.001) * memberModifier
    elseif elem == Element.FIRE then
        set B.userInt = MOD_DAMAGE_ADD_PERC
        set B.userReal = (0.16 + level * 0.004) * memberModifier
    elseif elem == Element.ICE  then
        set B.userInt = MOD_BUFF_DURATION
        set B.userReal = (0.2 + level * 0.006) * memberModifier
    elseif elem == Element.STORM  then
        set B.userInt = MOD_ATTACKSPEED
        set B.userReal = (0.08 + level * 0.002) * memberModifier
    elseif elem == Element.IRON  then
        set B.userInt = MOD_ITEM_CHANCE_ON_KILL
        set B.userReal = (0.06 + level * 0.0016) * memberModifier
    endif
    // Apply the modification
    call target.modifyProperty(B.userInt, B.userReal)

    if tower.calcChance(0.25) then
        set relem = GetRandomInt(0,5)
        // Relem cannot be 6 (IRON), so we apply iron buff if elem == relem.
        if elem == relem  then
            set B.userInt2 = MOD_ITEM_CHANCE_ON_KILL
            set B.userReal2 = (0.06 + level * 0.0016) * memberModifier
        elseif relem == Element.ASTRAL then
            set B.userInt2 = MOD_EXP_RECEIVED
            set B.userReal2 = (0.28 + level * 0.008) * memberModifier
        elseif relem == Element.DARKNESS then
            set B.userInt2 = MOD_SPELL_DAMAGE_DEALT
            set B.userReal2 = (0.16 + level * 0.004) * memberModifier
        elseif relem == Element.NATURE then
            set B.userInt2 = MOD_ATK_CRIT_CHANCE
            set B.userReal2 = (0.04 + level * 0.001) * memberModifier
        elseif relem == Element.FIRE then
            set B.userInt2 = MOD_DAMAGE_ADD_PERC
            set B.userReal2 = (0.16 + level * 0.004) * memberModifier
        elseif relem == Element.ICE  then
            set B.userInt2 = MOD_BUFF_DURATION
            set B.userReal2 = (0.2 + level * 0.006) * memberModifier
        elseif relem == Element.STORM  then
            set B.userInt2 = MOD_ATTACKSPEED
            set B.userReal2 = (0.08 + level * 0.002) * memberModifier
        endif
        // Apply the bonus modification
        call target.modifyProperty(B.userInt2, B.userReal2)
        set B.userInt3 = Effect.createColored("Abilities\\Weapons\\KeeperGroveMissile\\KeeperGroveMissile.mdl", target.getX(), target.getY(), 150, 0, 0.9, 255, 180, 180, 255)
    else
        set B.userInt2 = 0
        set B.userInt3 = Effect.createScaled("Abilities\\Weapons\\KeeperGroveMissile\\KeeperGroveMissile.mdl", target.getX(), target.getY(), 150, 0, 0.75)
    endif
    
endfunction

function effect_clean takes Buff B returns nothing
    local Tower target = B.getBuffedUnit()
    // Remove the modification
    call target.modifyProperty(B.userInt, -B.userReal)
    if B.userInt2 != 0 then
        // Remove the bonus modification
        call target.modifyProperty(B.userInt2, -B.userReal2)
    endif
    if B.userInt3 != 0 then
      call Effect(B.userInt3).destroy()
    endif
endfunction

function spritehit takes Projectile P, Unit target returns nothing
    local Tower tower = P.getCaster()
    call dave_gift.apply(tower, target, tower.getLevel())
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
     set dave_gift = BuffType.create(5,0,true)
     call dave_gift.setBuffIcon('@@0@@')
     call dave_gift.addEventOnCreate(gift_create)
     call dave_gift.addEventOnCleanup(effect_clean)
     
     set dave_sprite = ProjectileType.create("Abilities\\Weapons\\KeeperGroveMissile\\KeeperGroveMissile.mdl",4,400)
     call dave_sprite.enableHoming(ProjectileTargetEvent.spritehit,0)
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userReal = 1.0 //Member buff strength modifier
endfunction