Magic Mushroom v1
3200
ID:
377
Family ID:
Author:
drol
Rarity:
unique
Element:
nature
Attack Type:
Magic
Attack Range:
900
Attack CD:
0.9
Damage:
1513-1612
Mana:
60
Mana regen:
4
Status:
Approved

Description:

A humongous mushroom emanating mystical powers.
Specials:
+0.16 mana regen/lvl
Mystical Trance
Buffs a tower in 500 range, increasing its spell damage and trigger chances by 25%. Lasts 5 seconds.

Level Bonus:
+0.2 sec duration
+1% spell damage
+1% trigger chances

AC_TYPE_OFFENSIVE_BUFF
 50, 500 range, 2s cooldown
Fungus Strike
After casting Mystical Trance the Mushroom's next attack will deal 100% of its damage as spell damage with an additional 20% chance to crit. Additionally makes the target creep receive 10% more damage from spells. This effect is permanent and stacks.

Level Bonus:
+1% spell damage
+0.8% spell crit chance
Rapid Growth
Every 20 seconds the Mushroom has a 40% chance to grow, permanently gaining 3% bonus spell damage. Maximum of 40 succesful growths.

Level Bonus:
-0.4 seconds
+0.12% bonus spell damage
Download

Toggle Triggers

Autocast

caster_art: Abilities\Spells\Items\AIre\AIreTarget.mdl AUTOCAST_cooldown: 2 AUTOCAST_numBuffsBeforeIdle: 1 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF AUTOCAST_manacost: 50 AUTOCAST_range: 500 AUTOCAST_buffType: drol_mushroomBuff AUTOCAST_targetSelf: true AUTOCAST_targetType: TARGET_TYPE_TOWERS target_art: AUTOCAST_autoRange: 500
private function onAutocast takes Tower tower returns nothing
    set tower.userInt2 = 1
    
    call drol_mushroomBuff.applyCustomTimed(tower,Event.getTarget(),tower.getLevel(),5. + tower.getLevel()*0.2)
endfunction

Header

    globals
        //@export
        BuffType drol_mushroomGrowth
        //@export
        BuffType drol_mushroomBuff
        //@export
        BuffType drol_mushroomDebuff
        //@export
        MultiboardValues drol_mushroomMultiboardValue
    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 m = Modifier.create()
    local Modifier mm = Modifier.create()
    
    set drol_mushroomGrowth = BuffType.createAuraEffectType( true )
    set drol_mushroomBuff = BuffType.create( 5, 0.2, true)
    set drol_mushroomDebuff = BuffType.create( 3600, 0, false )
    
    call mm.addModification(MOD_SPELL_DAMAGE_DEALT,0.25,0.01)
    call mm.addModification(MOD_TRIGGER_CHANCES,0.25,0.01)
    
    call drol_mushroomGrowth.setBuffIcon( '@@0@@' )
    call drol_mushroomBuff.setBuffIcon( '@@1@@' )
    call drol_mushroomDebuff.setBuffIcon( '@@2@@' )
    
    call drol_mushroomGrowth.setBuffModifier(m)
    call drol_mushroomBuff.setBuffModifier(mm)
    
    call drol_mushroomBuff.setStackingGroup("drol_mushroomBuff")
    
    set drol_mushroomMultiboardValue = MultiboardValues.create(2)  
    call drol_mushroomMultiboardValue.setKey(0,"Growths")
    call drol_mushroomMultiboardValue.setKey(1,"Spell Damage") 
    
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    if tower.userInt2 != 0 and Event.isMainTarget() then
        set tower.userInt2 = 0
        call drol_mushroomDebuff.apply(tower, Event.getTarget(), tower.getLevel())
        call Event.getTarget().modifyProperty(MOD_SPELL_DAMAGE_RECEIVED, 0.1)
        call tower.doSpellDamage(Event.getTarget(),Event.damage*(1.+tower.getLevel()*0.01),tower.calcSpellCrit(0.2+tower.getLevel()*0.008,0))
        set Event.damage = 0
    endif
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt = 0 // number of succesful growths
    set tower.userInt2 = 0 // used for spelldamage attack on autocast
    set tower.userReal = 0.
    
endfunction

On Tower Details

function onTowerDetails takes Tower tower returns MultiboardValues
    call drol_mushroomMultiboardValue.setValue(0,I2S(tower.userInt)) 
    call drol_mushroomMultiboardValue.setValue(1,I2S(R2I(tower.userReal * 100.)) + "%")
    return drol_mushroomMultiboardValue
endfunction

Periodic

PERIODIC_period: 20
function periodic takes Tower tower returns nothing
    local integer lvl = tower.getLevel()
    local real growth
    local Effect targetEffect
    
    if (tower.calcChance(0.4) and tower.userInt < 40) then
    
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, 0.03+(lvl*0.0012))
        set tower.userReal = tower.userReal + 0.03 + lvl * 0.0012
    
        set targetEffect = Effect.createScaled("Abilities\\Spells\\NightElf\\TargetArtLumber\\TargetArtLumber.mdl", GetUnitX(tower.getUnit()), GetUnitY(tower.getUnit()), 30, 0, 1.4)
        call targetEffect.setLifetime(1.0)
    
        set tower.userInt = tower.userInt + 1
        set growth = 1.25 + tower.userInt * 0.015
        call SetUnitScale(tower.getUnit(), growth, growth, growth)
    
    endif

    call Event.getCurrentPeriodicEvent().enableAdvanced(20 - lvl*0.4, false)
    
endfunction