Array
(
    [scriptVersion] => 8
    [oeValues] => Array
        (
            [auto] => Array
                (
                )

            [Art] => ReplaceableTextures\CommandButtons\BTNEvasion.blp
            [turnRate] => 3
            [bldtm] => 1
            [dmgplus1] => 1304
            [goldcost] => 900
            [unitSound] => Array
                (
                )

            [sides1] => 7
            [manaN] => 125
            [acquire] => 875
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Mage Hunter
            [weapTp1] => missile
            [file] => units\nightelf\HeroDemonHunter\HeroDemonHunter.mdl
            [MissileHoming] => 1
            [uberSplat] => YTDG
            [Harea1] => 150
            [Missileart] => war3mapImported\GargoyleMissilePink.mdl
            [Missilespeed] => 1300
            [dice1] => 1
            [RngBuff1] => 250
            [regenMana] => 1.75
            [Hfact1] => 0.1
            [modelScale] => 0.5
            [rangeN1] => 875
            [atkType1] => normal
            [cool1] => 1.9
            [Ubertip] => An enemy of magic who speaks its every tongue, who wields the very force he seeks to end.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [moveHeight] => 15
            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
            [teamColor] => 7
        )

    [settings] => Array
        (
            [balanceTip] => |cffFFFF00+50% |rdmg to magical (|cffFFFF00+2%|r/lvl)|n|cffFFFF0010%|r crit chance (|cffFFFF00+0.3%|r/lvl)|n|cffFFFF00x1.5|r crit damage (|cffFFFF00+x0.05|r/lvl)
            [abil_factor] => 0.65
            [author] => Ashbringer
            [alpha] => 255
            [authorDisplay] => |cffff6600Ashbringer|r
            [element] => arcane
            [rarity] => rare
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.0871471
                    [y] => -0.0564405
                    [z] => -6.4
                    [scale] => 0.85
                    [rot] => 3.26883
                    [file] => Doodads\BlackCitadel\Props\RuneArt\RuneArt1.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [1] => Array
                (
                    [x] => -0.146219
                    [y] => -0.0755139
                    [z] => -25.6
                    [scale] => 2.1
                    [rot] => 3.63029
                    [file] => war3mapImported\GeneralAuraTargetWhite.mdl
                    [red] => 255
                    [green] => 125
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [2] => Array
                (
                    [x] => -13.0673
                    [y] => 0.355043
                    [z] => 0
                    [scale] => 0.09
                    [rot] => 0
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [3] => Array
                (
                    [x] => 13.0667
                    [y] => -0.285576
                    [z] => 0
                    [scale] => 0.09
                    [rot] => 3.14159
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [4] => Array
                (
                    [x] => -13.0744
                    [y] => 0.205598
                    [z] => 12.8
                    [scale] => 0.09
                    [rot] => 0
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [5] => Array
                (
                    [x] => 13.0596
                    [y] => -0.435021
                    [z] => 12.8
                    [scale] => 0.09
                    [rot] => 3.14159
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [6] => Array
                (
                    [x] => -13.1395
                    [y] => 0.319729
                    [z] => 6.4
                    [scale] => 0.09
                    [rot] => 0
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [7] => Array
                (
                    [x] => 12.9946
                    [y] => -0.32089
                    [z] => 6.4
                    [scale] => 0.09
                    [rot] => 3.14159
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [8] => Array
                (
                    [x] => -0.0391842
                    [y] => 0.127582
                    [z] => -6.4
                    [scale] => 1
                    [rot] => 1.67552
                    [file] => war3mapImported\GeneralAuraTargetWhite.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [9] => Array
                (
                    [x] => -0.250075
                    [y] => 0.227367
                    [z] => -64
                    [scale] => 0.78
                    [rot] => 3.15043
                    [file] => Doodads\Ruins\Props\RuinsPillar\RuinsPillar2.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [10] => Array
                (
                    [x] => -0.0395099
                    [y] => 0.369834
                    [z] => 0
                    [scale] => 1
                    [rot] => 1.67552
                    [file] => war3mapImported\GeneralAuraTargetWhite.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [11] => Array
                (
                    [x] => -0.0472074
                    [y] => 0.153372
                    [z] => -32
                    [scale] => 0.35
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Props\FountainRuined\FountainRuined.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [12] => Array
                (
                    [x] => -0.0819538
                    [y] => 0.147257
                    [z] => 6.4
                    [scale] => 0.5
                    [rot] => 4.71239
                    [file] => Abilities\Spells\Items\AIso\BIsvTarget.mdl
                    [red] => 255
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_DMG_TO_MAGIC
                    [base] => 0.5
                    [add] => 0.02
                )

            [1] => Array
                (
                    [id] => MOD_ATK_CRIT_CHANCE
                    [base] => 0.0875
                    [add] => 0.003
                )

            [2] => Array
                (
                    [id] => MOD_ATK_CRIT_DAMAGE
                    [base] => 0.25
                    [add] => 0.05
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => if tower.userInt > 0 then
        call tower.addAttackCrit()
        set tower.userInt = 0
    endif
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNDaggerOfEscape.blp
                            [name] => Null Blade
                            [short_explain] => Critical hits have a chance to remove a percentage of the target's mana.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => Attacks have a |cffFFFF807.5%|r chance on critical hit to remove up to |cffFFFF8012.5%|r of the target's maximum mana. This effect occurs before Magebane.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.3%|r chance|n|cffFFFF80+0.5%|r maximum mana
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
    endglobals
    
    //@export
    function ashbringer_mage_hunter takes Tower tower, Unit target, real damage, boolean is_crit returns real
        local real max_mana = GetUnitState(target.getUnit(), UNIT_STATE_MAX_MANA)
        local real mana
        local integer level = tower.getLevel()
        local real magebane = 1
        local real null_blade

        if max_mana > 0 then
            if is_crit then
                if tower.calcChance(0.075 + (level * 0.003)) or tower.userInt2>0 then
                    set null_blade = 0.125 + (level * 0.005)
                    if tower.userInt2 > 0 then
                        set null_blade = null_blade * (1 + (1.5 + (level * 0.06)))
                        set tower.userInt2 = 0
                    endif
                    call target.subtractMana(max_mana * null_blade, true)
                    call Effect.createSimpleOnUnit("war3mapImported\\AnimateDeadTargetArcane.mdx", target, "origin").setLifetime(3)
                endif
            endif
            
            set mana = GetUnitState(target.getUnit(), UNIT_STATE_MANA)
            set magebane = 1 + (100 * (1 - (mana / max_mana)) * (0.005 + (tower.getLevel() * 0.0002)))
            if magebane > 1 then
                call Effect.createSimpleOnUnit("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl", target, "chest").setLifetime(1)
            endif
        elseif tower.userInt2 > 0 then
            set tower.userInt2 = 0
        endif
        
        return damage * magebane
    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
	endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => On Damage
                    [code] => set Event.damage = ashbringer_mage_hunter(tower, Event.getTarget(), Event.damage, Event.isAttackDamageCritical())
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNControlMagic.blp
                            [name] => Magebane
                            [short_explain] => Attacks deal more damage based on how much mana the target is missing. Has no effect against enemies without mana.
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => Attacks deal |cffFFFF800.5%|r more damage for every |cffFFFF801%|r of maximum mana the target is missing. Has no effect against enemies without mana.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.02%|r damage per missing mana
                        )

                )

            [3] => Array
                (
                    [name] => Autocast
                    [code] => set tower.userInt = tower.userInt + 1
    set tower.userInt2 = tower.userInt2 + 1
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 10
                            [AUTOCAST_autoRange] => 875
                            [AUTOCAST_manacost] => 100
                            [icon] => ReplaceableTextures\CommandButtons\BTNAmbush.blp
                            [AUTOCAST_range] => 875
                            [AUTOCAST_targetType] => 0
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [caster_art] => Abilities\Spells\Items\AIil\AIilTarget.mdl
                            [long_explain] => Causes the tower's next attack to be a critical hit and trigger Null Blade with |cffFFFF80150%|r increased effectiveness.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+6%|r Null Blade effect
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_IMMEDIATE
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => false
                            [name] => The Hunt
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => The tower's next attack will be a critical hit and will trigger Null Blade with greatly increased effect.
                        )

                )

            [4] => Array
                (
                    [name] => On Tower Creation
                    [code] => call SetUnitColor(tower.getUnit(), ConvertPlayerColor(7))
    set tower.userInt = 0
    set tower.userInt2 = 0
    call AddUnitAnimationProperties(tower.getUnit(), "alternate", false)
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

    [lightning] => Array
        (
        )

)