Princess of Light v1
1700
ID:
561
Family ID:
Author:
Boekie
Rarity:
rare
Element:
astral
Attack Type:
Magic
Attack Range:
1000
Attack CD:
1.5
Damage:
1989-1989
Abil. Factor:
0.76
Status:
Approved

Description:

This tower is able to extract experience from creeps and energy from spells.

Latest Upload Comment:

Restored from 1.10
Specials:
+2 mana/lvl
Extract Experience
Casts a buff on a creep. Towers that damage this creep have a 33% chance to extract 1 experience. Buff lasts 10 seconds or until 10 extractions occur.

Level Bonus:
+0.05 experience
+1 extraction
Channel Energy
Whenever this tower is hit by a friendly spell, the caster of that spell will be granted 1 experience and this tower will gain 15% bonus damage for 10 seconds. This effect stacks up to 15 times, but new stacks will not refresh the duration of olds ones.

Level Bonus:
+0.5% damage 
+0.1 seconds duration
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 5 AUTOCAST_numBuffsBeforeIdle: 3 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF AUTOCAST_manacost: 20 AUTOCAST_range: 1000 AUTOCAST_buffType: boekie_expGain_buff AUTOCAST_targetSelf: false AUTOCAST_targetType: TARGET_TYPE_CREEPS target_art: AUTOCAST_autoRange: 1000
private function onAutocast takes Tower tower returns nothing
    local integer level = tower.getLevel()
    set boekie_expGain_buff.apply(tower,Event.getTarget(),level).userInt = 10 + level
endfunction

Header

    globals
        //@export
        BuffType boekie_expGain_buff
        //@export
        BuffType boekie_lightSpeed_buff
    endglobals
        
    private function addExpToAttacker takes Buff b returns nothing
        if b.userInt > 0 then
            set b.userInt = b.userInt - 1
            call Event.getTarget().addExp(1.0 + (b.getLevel() * 0.05))
        else
            call b.removeBuff()
        endif
    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 boekie_expGain_buff = BuffType.create(10.0,0.0,true)
        call boekie_expGain_buff.addEventOnDamaged(addExpToAttacker,0.33,0.0)  
        call boekie_expGain_buff.setBuffIcon('@@0@@')
        
        call m.addModification(MOD_DAMAGE_ADD_PERC,0.0,0.005) 
        set boekie_lightSpeed_buff = BuffType.create(-1,0,true)
        call boekie_lightSpeed_buff.setBuffModifier(m) 
        call boekie_lightSpeed_buff.setBuffIcon('@@1@@')
    endfunction

On Spell Target

function onSpellTarget takes Tower tower returns nothing
    local Unit caster = Event.getTarget()
    local Buff b = tower.getBuffOfType(boekie_lightSpeed_buff)
    local integer twrLevel = tower.getLevel()
    local integer UID = tower.getUID()
    local integer bonusDmg = 30 + twrLevel //each point = 0.5% dmg bonus

    if caster.isATower() then
        call caster.addExp(1) 
        if b == 0 then
            set boekie_lightSpeed_buff.apply(tower, tower, bonusDmg).userInt = 1
        else
            if b.userInt >= 15 then
                return //already at max stacks. ABORT!
            endif
            set b.userInt = b.userInt + 1
            call b.setPower(b.getPower() + bonusDmg)
        endif
        call TriggerSleepAction(10 + 0.01 * twrLevel)
        if tower.getUID() == UID then //make sure tower still alive
            set b = tower.getBuffOfType(boekie_lightSpeed_buff)
            if b != 0 then //make sure buff hasn't been purged or something
                if b.userInt <= 1 then
                    call b.removeBuff()
                else
                    set b.userInt = b.userInt - 1
                    call b.setPower(b.getPower() - bonusDmg)
                endif
            endif
        endif
    endif
endfunction