Sorceress v1
3800
ID:
160
Family ID:
Author:
cedi
Rarity:
unique
Element:
astral
Attack Type:
Magic
Attack Range:
1200
Attack CD:
3
Damage:
5760-5771
Status:
Approved

Description:

I make your dreams come true.
Choose Modification
Cycle through the modifications:
Slow: 8% for 5 seconds, -20% dmg
Silence: 5 seconds, 50% chance, -40% dmg
Health Regeneration: -10% for 5 seconds, -25% dmg
Armor: -6% for 5 seconds, -25% dmg
Spell Vulnerability: 12% for 5 seconds, -25% dmg
AoE: 50, -15% dmg

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 0s cooldown
Add Modification
Adds the bonus to the missile if the tower has enough damage left.

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 0s cooldown
Remove Modification
Removes the bonus to the missile and returns the damage used.

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 0s cooldown
Magic Missile
Whenever this tower attacks it launches a magic missile in the target's direction. The missile hits all units in 150 AoE and deals 100% of the tower's attack damage as spell damage to the hit units. The missile travels 1200 units.

Level Bonus:
+2% spell damage
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 0 AUTOCAST_autoRange: 0 AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: true
private function onAutocast takes Tower tower returns nothing
    set tower.userInt2 = tower.userInt2 + 1
    if tower.userInt2 > 6 then
        set tower.userInt2 = 1
    endif
    call tower.getOwner().displaySmallFloatingText( strings[tower.userInt2], tower, 255, 255, 255, 40 )
endfunction

Autocast

AUTOCAST_cooldown: 0 AUTOCAST_autoRange: 0 AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: true
private function onAutocast takes Tower tower returns nothing
    local Data d = tower.userInt
    //inc
    if tower.userInt2 == 1 then
        //slow
        if d.dmg >= 20 then
            set d.slow = d.slow + 8
            set d.dmg = d.dmg - 20
        endif
    elseif tower.userInt2 == 2 then
        //silence
        if d.dmg >= 40 then
            set d.silence = d.silence + 5
            set d.dmg = d.dmg - 40
        endif
    elseif tower.userInt2 == 3 then
        //regen
        if d.dmg >= 25 then
            set d.regen = d.regen + 10
            set d.dmg = d.dmg - 25
        endif
    elseif tower.userInt2 == 4 then
        //armor
        if d.dmg >= 25 then
            set d.armor = d.armor + 6
            set d.dmg = d.dmg - 25
        endif
    elseif tower.userInt2 == 5 then
        //spell
        if d.dmg >= 25 then
            set d.spell = d.spell + 12
            set d.dmg = d.dmg - 25
        endif
    elseif tower.userInt2 == 6 then
        //aoe
        if d.dmg >= 15 then
            set d.aoe = d.aoe + 50
            set d.dmg = d.dmg - 15
        endif
    endif
endfunction

Autocast

AUTOCAST_cooldown: 0 AUTOCAST_autoRange: 0 AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: true
private function onAutocast takes Tower tower returns nothing
    local Data d = tower.userInt
    //inc
    if tower.userInt2 == 1 then
        //slow
        if d.slow >= 8 then
            set d.slow = d.slow - 8
            set d.dmg = d.dmg + 20
        endif
    elseif tower.userInt2 == 2 then
        //silence
        if d.silence >= 5 then
            set d.silence = d.silence - 5
            set d.dmg = d.dmg + 40
        endif
    elseif tower.userInt2 == 3 then
        //regen
        if d.regen >= 10 then
            set d.regen = d.regen - 10
            set d.dmg = d.dmg + 25
        endif
    elseif tower.userInt2 == 4 then
        //armor
        if d.armor >= 6 then
            set d.armor = d.armor - 6
            set d.dmg = d.dmg + 25
        endif
    elseif tower.userInt2 == 5 then
        //spell
        if d.spell >= 12 then
            set d.spell = d.spell - 12
            set d.dmg = d.dmg + 25
        endif
    elseif tower.userInt2 == 6 then
        //aoe
        if d.aoe > 150 then
            set d.aoe = d.aoe - 50
            set d.dmg = d.dmg + 15
        endif
    endif
endfunction

Header

    globals
        ProjectileType PT
        BuffType Slow
        BuffType Armor
        BuffType Spell
        BuffType Regen
        string array strings[7]
        MultiboardValues MB
    endglobals
    
    struct Data
        integer slow       = 0 //+0.05
        integer silence    = 0 //+5.0
        integer regen      = 0 //+0.05
        integer armor      = 0 //+1
        integer spell      = 0 //+0.06
        integer aoe        = 150 //No percentage, integer value!
        integer dmg        = 100
    endstruct
    
    function coll takes Projectile P, Unit U returns nothing
        local Tower T = P.getCaster() 
        local Data d = T.userInt
        
        if d.slow > 0.0 then
            //slow
            call Slow.apply( T, U, d.slow )
        endif
        if d.silence > 0.0 then
            //silence
            if ( T.calcChance( 0.5 ) ) then
                call cb_silence.applyOnlyTimed( T, U, d.silence )
            endif
        endif
        if d.regen > 0.0 then
            //regen
            call Regen.apply( T, U, d.regen )
        endif
        if d.armor > 0.0 then
            //armor
            call Armor.apply( T, U, d.armor )
        endif
        if d.spell > 0.0 then
            //spell
            call Spell.apply( T, U, d.spell )
        endif
        
        if d.dmg > 0.0 then
            call T.doSpellDamage( U, T.getCurrentAttackDamageWithBonus() * ( d.dmg / 100.00 ), T.calcSpellCritNoBonus() )
        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 PT = ProjectileType.createRanged( "Abilities\\Weapons\\FaerieDragonMissile\\FaerieDragonMissile.mdl", 1200.0, 1200.0 )
        call PT.enableCollision( coll, 150.0, TARGET_CREEPS, false )
        
        call m.addModification( MOD_MOVESPEED, 0.00, -0.01 )
        set Slow = BuffType.create( 5.0, 0.0, false )
        call Slow.setBuffModifier( m )
        call Slow.setBuffIcon( '@@0@@' )
        
        set m = Modifier.create()
        call m.addModification( MOD_ARMOR_PERC, 0.0, -0.01 )
        set Armor = BuffType.create( 5.0, 0.0, false )
        call Armor.setBuffModifier( m )
        call Armor.setBuffIcon( '@@1@@' )
        
        set m = Modifier.create()
        call m.addModification( MOD_SPELL_DAMAGE_RECEIVED, 0.0, 0.01 )
        set Spell = BuffType.create( 5.0, 0.0, false )
        call Spell.setBuffModifier( m )
        call Spell.setBuffIcon( '@@2@@' )
        
        set m = Modifier.create()
        call m.addModification( MOD_HP_REGEN_PERC, 0.0, -0.01 )
        set Regen = BuffType.create( 5.0, 0.00, false )
        call Regen.setBuffModifier( m )
        call Regen.setBuffIcon( '@@3@@' )
        
        set strings[1] = "Slow"
        set strings[2] = "Silence"
        set strings[3] = "Health Regeneration"
        set strings[4] = "Armor"
        set strings[5] = "Spell Vulnerability"
        set strings[6] = "AoE"
        
        set MB = MultiboardValues.create( 2 )
        call MB.setKey( 0, "Damage %" )
        call MB.setKey( 1, "Modification" )
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Data d = tower.userInt
    local Projectile P = Projectile.createFromUnitToUnit( PT, tower, 1.0, 1.0, tower, Event.getTarget(), false, true, false )
    call P.setCollisionParameters( d.aoe, TARGET_CREEPS )
    call P.setScale( d.aoe / 150.0 * 6.0 ) //150 aoe has a missile size of 4 (8)
    set P.z = 60.0
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    set Event.damage = 0
endfunction

On Level Up

function onLevelUp takes Tower tower returns nothing
    local Data d = tower.userInt
    if Event.isLevelUp() then
        set d.dmg = d.dmg + 2
    else
        set d.dmg = d.dmg - 2
    endif
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    local Data data = Data.create()
    set tower.userInt = data
    set tower.userInt2 = 1
    
    set tower.userInt3 = 0
    
    set data.dmg = data.dmg + tower.getLevel() * 2
endfunction

On Tower Destruction

function onDestruct takes Tower tower returns nothing
    local Data data = tower.userInt
    call data.destroy()
endfunction

On Tower Details

goldcost: 0
function onTowerDetails takes Tower tower returns MultiboardValues
    local Data d = tower.userInt
    local Playor p = Event.getMBObserver()
    local real t = 3.0
    
    call MB.setValue( 0, I2S( d.dmg ) + "%" )
    call MB.setValue( 1, strings[tower.userInt2] )
    
    call p.clearScreen()
    
    call p.displayTimedText( "|cffFF8000Sorceress Stats:|r", t )
    call p.displayTimedText( "Slow: |cffFFFF80" + I2S( d.slow ) + "%|r", t )
    call p.displayTimedText( "Silence: |cffFFFF80" + I2S( d.silence ) + "|r seconds", t )
    call p.displayTimedText( "Health Regeneration: |cffFFFF80-" + I2S( d.regen ) + "%|r", t )
    call p.displayTimedText( "Armor: |cffFFFF80-" + I2S( d.armor ) + "%|r", t )
    call p.displayTimedText( "Spell Vulnerability: |cffFFFF80-" + I2S( d.spell ) + "%|r", t )
    call p.displayTimedText( "AoE: |cffFFFF80" + I2S( d.aoe ) + "|r", t )
    
    return MB
endfunction