• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Dota_Skywrath Mage_Mystic Flare_1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
How to import?
Just copy trigger "Mystic Flare",ability 'A000' and global var MF_Hash and that's it


JASS:
constant function MF_AbiId takes nothing returns integer
    return 'A000'
endfunction

constant function MF_Interval takes nothing returns real
    return .1
endfunction

constant function MF_Radius takes nothing returns real
    return 170.+25.
endfunction

constant function MF_DamageAmount takes nothing returns real
    return 300.+300.
endfunction

constant function MF_SpecEffect takes nothing returns string
    return "war3mapImported\\DivineWrathTarget.mdx"
endfunction

constant function MF_Counter takes nothing returns integer
    return 20
endfunction

constant function MF_DmgFactor takes nothing returns integer
    return 1 // 2 3 4 5
endfunction

constant function MF_IgnoreDead takes unit u returns boolean
    return GetUnitTypeId(u)<1 or IsUnitType(u,UNIT_TYPE_DEAD)  //GetWidgetLife(u)<.405
endfunction

function FlushTrigger takes trigger t,hashtable h returns nothing
    local integer id=GetHandleId(t)
    if(t!=null)then
        call DisableTrigger(t)
        call DestroyTrigger(t)
        call FlushChildHashtable(h,id)
    endif
endfunction

function MF_Filter takes unit u,unit t returns boolean
    local boolean a=IsUnitType(t,UNIT_TYPE_HERO)
    local boolean b=IsUnitEnemy(u,GetOwningPlayer(t))
    local boolean c=IsUnitType(t,UNIT_TYPE_STRUCTURE)
    local boolean d=IsUnitType(t,UNIT_TYPE_ANCIENT)
    return a and b and not c and not d and not MF_IgnoreDead(t)
endfunction

function MF_DamageOptions takes unit u,unit t,integer i,real d returns nothing
    if i==0 then
        return
    endif
    if i==1 then
        call UnitDamageTarget(u,t,d,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
    elseif i==2 then
       call UnitDamageTarget(u,t,d,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    elseif i==3 then
       call UnitDamageTarget(u,t,d,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
    elseif i==4 then
       call UnitDamageTarget(u,t,d,true,true,ATTACK_TYPE_PIERCE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    elseif i==5 then
       call UnitDamageTarget(u,t,d,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    endif
endfunction

function MF_DamageTarget takes unit u,unit t,integer i,group g returns nothing
    call MF_DamageOptions(u,t,MF_DmgFactor(),((MF_DamageAmount()*i)/bj_groupCountUnits)/MF_Counter())
endfunction

function MF_Periodic takes nothing returns boolean
    local trigger t=GetTriggeringTrigger()
    local integer id=GetHandleId(t)
    local unit u=LoadUnitHandle(udg_MF_Hash,id,0)
    local real x=LoadReal(udg_MF_Hash,id,1)
    local real y=LoadReal(udg_MF_Hash,id,2)
    local integer lvl=LoadInteger(udg_MF_Hash,id,3)
    local unit uFirst
    if GetTriggerEvalCount(t)>20 then          
        call FlushTrigger(t,udg_MF_Hash)
    else
        call GroupEnumUnitsInRange(bj_lastCreatedGroup,x,y,MF_Radius(),null)
        set bj_groupCountUnits=0
        loop
            set uFirst=FirstOfGroup(bj_lastCreatedGroup)
            exitwhen uFirst==null
            if MF_Filter(u,uFirst)then
                set bj_groupCountUnits=bj_groupCountUnits+1
                call MF_DamageTarget(u,uFirst,lvl,bj_lastCreatedGroup)
            endif
            call GroupRemoveUnit(bj_lastCreatedGroup,uFirst)
        endloop
    endif
    set t=null
    set u=null
    set uFirst=null
    return false
endfunction

function MF_Actions takes nothing returns boolean
    local trigger t
    local integer id
    local unit u
    local real x
    local real y
    local integer lvl
    if GetSpellAbilityId()==MF_AbiId() then
        set t=CreateTrigger()
        set id=GetHandleId(t)
        set u=GetTriggerUnit()
        set x=GetSpellTargetX()
        set y=GetSpellTargetY()
        set lvl=GetUnitAbilityLevel(u,MF_AbiId())
        call TriggerRegisterTimerEvent(t,MF_Interval(),true)
        call TriggerAddCondition(t,Condition(function MF_Periodic))      
        call SaveAgentHandle(udg_MF_Hash,id,0,u)
        call SaveReal(udg_MF_Hash,id,1,x*1.)
        call SaveReal(udg_MF_Hash,id,2,y*1.)
        call SaveInteger(udg_MF_Hash,id,3,lvl)
        call DestroyEffect(AddSpecialEffect(MF_SpecEffect(),x,y))
        set t=null
        set u=null
    endif
    return false
endfunction

function InitTrig_Mystic_Flare takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function MF_Actions))
    set t=null
endfunction
Contents

Dota - Spell Mystic Flare (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 16th Jul 2012 Bribe: I will approve this once you add importing instructions (for example that the user needs to copy the text from the map header).

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

16th Jul 2012
Bribe: I will approve this once you add importing instructions (for example that the user needs to copy the text from the map header).
 
Level 10
Joined
Aug 21, 2010
Messages
316
the only thing I can comment is creating a trigger in every cast of this spell is very bad, others code Im too lazy to read coz its not worth it...

1.
I would like to explain to me what is wrong here because I am convinced that you have no idea are you talking about.
2.
Otherwise, this is the original spell from dota,so I do not intend to change anything.
3.
Why this spell use trigger and not a timer?
It should to ask IceFrog not me.
 
Level 3
Joined
Jul 1, 2012
Messages
49
I think Mystic Flare does'nt need triggers and i think its just flame strike. Look at the flame strike spell it deals damage to enemies in AOE of your target point but the effect must be customized. (This post is only my idea)
 
Level 3
Joined
Jan 4, 2013
Messages
58
I think Mystic Flare does'nt need triggers and i think its just flame strike. Look at the flame strike spell it deals damage to enemies in AOE of your target point but the effect must be customized. (This post is only my idea)

the damage hit to heroes are spread equaly so its not flamestrike
 
Top