Spellpack Magic / Mana Spells

S

sinners_la_b

Guest
This is my magic / mana spell back. Very fun to use in my opinion, hopefully you enjoy

Magic Overload

Jass : Yes
Lag : No
Leaks : No

The caster becomes overloaded with magical energies which then erupt in lines at random distance and random angles.

CODE !

JASS:

<div style="margin-left: 20px">

scope MagicOverload
//*********************************************************************************************
//                                       Magic Overload                                       *  
//                                     ------------------                                     *
//                                              BY                                            *
//                                                                                            *
//                                                                                            *
//                                          sinners_la_b                                      *
//                                                                                            * 
//                            contact at : <a href="mailto:[email protected]">[email protected]</a>                           *
//                                                                                            *  
//                          Read the README for Implementaion details                         *
//                                                                                            *  
//*********************************************************************************************


globals

//&lt;--------&gt;START RAW CODES&lt;--------&gt;

    private constant integer MagicOverload_Raw               = &#039;A000&#039;   // Raw code of Magic Overload
    private constant integer MagicOverload_DummyRaw          = &#039;u001&#039;   // Raw cope of a dummy units, in the spell they are the effects

//&lt;--------&gt;END RAW CODES&lt;--------&gt;
   
   
//&lt;--------&gt;START REAL VALUES&lt;--------&gt;   
   
    private constant real MagicOverload_MinimumDistance      = 100.00 // Minimum distance from caster the lines will be made
    private constant real MagicOverload_MaximumDistance      = 500.00 // Base Maximum (Base + Further * level)
    private constant real MagicOverload_MaximumDistanceFurther = 100.00 // Further Maximum
    private constant real MagicOverload_Damage               = 120  // Base Damage ( Base + Further * level)
    private constant real MagicOverload_DamageFurther        = 50   // Further Damagr

//&lt;--------&gt;END REAL VALUES&lt;--------&gt;     
    
endglobals

 struct MO

    unit caster
    integer count
    integer level
    group k
    
    
endstruct


function MagicOverload_IdCheck takes nothing returns boolean
 return GetSpellAbilityId() == MagicOverload_Raw 
endfunction

function MagicOverload_Cond takes nothing returns boolean
local timer t   = GetExpiredTimer()
local MO d
set d = GetTimerStructA(t)

        return (not IsUnitInGroup(GetFilterUnit(), d.k)) and IsPlayerEnemy(GetOwningPlayer(d.caster), GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) &gt; 0.405 and IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)==false

endfunction


function MagicOverload_Create takes nothing returns nothing 

        local timer t           = GetExpiredTimer()
        local real newx
        local real newy
        local real newx2
        local real newy2
        local real distance        
        local real angle
        local real newangle
        local unit dummy
        local unit array dummy2
        local boolexpr b        = Condition(function MagicOverload_Cond)
        local integer ui        = 1
        local group g           = CreateGroup()
        local unit next
        local MO d
        
        set d = GetTimerStructA(t)
                
       
                   
                   if GetUnitCurrentOrder(d.caster) == OrderId(&quot;channel&quot;) then
        
                
                                      
                                      set dummy = CreateUnit(GetOwningPlayer(d.caster), MagicOverload_DummyRaw, GetUnitX(d.caster), GetUnitY(d.caster), 0.00)
                    
                                                    call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, 2.00)
                    
                                                set distance = GetRandomReal(MagicOverload_MinimumDistance, MagicOverload_MaximumDistance + MagicOverload_MaximumDistanceFurther * d.level)
                                                set angle = GetRandomReal(1, 359)
                    
                    
                    
                                set newx = GetUnitX(d.caster) + distance * Cos(angle * bj_RADTODEG)
                                set newy = GetUnitY(d.caster) + distance * Sin(angle * bj_RADTODEG)
                        
                                    call SetUnitPosition(dummy, newx, newy)
                  
                        set newangle = AngleInReal(GetUnitX(d.caster), GetUnitY(d.caster), GetUnitX(dummy), GetUnitY(dummy))
                  
                    
                            set d.count = 100
                        
                        loop
                        
        
                                exitwhen d.count &gt;= distance
                    
                       
                            set dummy2[ui] = CreateUnit(GetOwningPlayer(d.caster), MagicOverload_DummyRaw, GetUnitX(d.caster), GetUnitY(d.caster), 0.00)
                       
                           call UnitApplyTimedLife(dummy2[ui], &#039;BTLF&#039;, 0.50)
                                
                              set newx2 = GetUnitX(d.caster) + d.count * Cos(newangle * bj_DEGTORAD)
                              set newy2 = GetUnitY(d.caster) + d.count * Sin(newangle * bj_DEGTORAD)
                                
                                    call SetUnitPosition(dummy2[ui], newx2, newy2)
                                    
                                        call GroupEnumUnitsInRange(g, GetUnitX(dummy2[ui]), GetUnitY(dummy2[ui]), 100, b)
                            call GroupClear(d.k)
                                     loop
                                                    
                                                    set next = FirstOfGroup(g)
                                    
                                                       
                                                       exitwhen next == null
                                        
                                        call GroupAddUnit(d.k, next)
                                        
                                                    call UnitDamageTarget(d.caster, next, MagicOverload_Damage + MagicOverload_DamageFurther * d.level , true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
                                   
                                                        call GroupRemoveUnit(g, next)
                                            
                                    endloop

                                 
                                 
                            set d.count = d.count + 100
                            set ui = ui + 1
                          
                            
                        endloop
                        
                        
                        
            else
            
            call PauseTimer(t)
            call ClearTimerStructA(t)
            call DestroyTimer(t)
            call d.destroy()
            call DestroyGroup(g)
            call DestroyBoolExpr(b)
            
                set t = null
                set dummy = null
                set d.caster = null
                set next = null
           loop
            
                exitwhen ui == 0
                
                    set dummy2[ui] = null
                    
                set ui = ui - 1
                
            endloop
            
        endif
            
        
endfunction




function MagicOverload_Core takes nothing returns nothing

        local timer t           = CreateTimer()
     
        local MO d              = MO.create()
        
        set d.count             = 100
        set d.caster            = GetTriggerUnit()
        set d.level             = GetUnitAbilityLevel(d.caster, MagicOverload_Raw)
        set d.k                 = CreateGroup()
                
                call SetTimerStructA(t, d)
       
                
            call TimerStart(t, 0.25, true, function MagicOverload_Create)
      
        
    
    endfunction

endscope

//===========================================================================
function InitTrig_Magic_Overload takes nothing returns nothing
    
    local trigger gg_trg_Magic_Overload = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Magic_Overload, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Magic_Overload, Condition( function MagicOverload_IdCheck ) )
    call TriggerAddAction( gg_trg_Magic_Overload, function MagicOverload_Core )
    
endfunction
&#8203;</div>


SCREENSHOT !

No1.jpg


Corupt Power

Jass : Yes
Lag : No
Leak : No

The caster corupts the power of all enemy units around him dealing damage and returning some of that corupted power back to him in pure form

CODE !

JASS:

<div style="margin-left: 20px">

scope CoruptPower
//*********************************************************************************************
//                                         Corupt Power                                       *  
//                                       ---------------                                      *
//                                              BY                                            *
//                                                                                            *
//                                                                                            *
//                                          sinners_la_b                                      *
//                                                                                            * 
//                            contact at : <a href="mailto:[email protected]">[email protected]</a>                           *
//                                                                                            *  
//                          Read the README for Implementaion details                         *
//                                                                                            *  
//*********************************************************************************************



globals

//&lt;--------&gt;START RAW CODES&lt;--------&gt;



            private constant integer CP_Raw                     = &#039;A001&#039; // Raw code of Corupt Power
            private constant integer CP_DummyRaw                = &#039;u002&#039; // Raw code of a dummy unit
            private constant integer CP_LightningRaw            = &#039;A002&#039; // Raw code of chain lightning that does the damage
 


//&lt;--------&gt;END RAW CODES&lt;--------&gt;        
            

//======================================================================            
            
            
//&lt;--------&gt;START REAL VALUES&lt;--------&gt;   

            
                                                                                   
            private constant real CP_Range                      = 400.00
            private constant real CP_Delay                      = 1


//&lt;--------&gt;END REAL VALUES&lt;--------&gt;

endglobals


struct CP

    unit caster
    real x
    real y
    real count
    integer level
   
    
endstruct

function CoruptPower_IdCheck takes nothing returns boolean
 return GetSpellAbilityId() == CP_Raw 
endfunction

function CoruptPower_Cond takes nothing returns boolean
  local CP d
  set d = GetTimerStructA(GetExpiredTimer())
  return IsPlayerEnemy(GetOwningPlayer(d.caster), GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) &gt; 0.405 and IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)==false
endfunction

function CoruptPower_Cast takes nothing returns nothing
    
        local CP d
        local timer t           = GetExpiredTimer()
        local unit dummy
       
        
                    set d = GetTimerStructA(t)
        
            set dummy = CreateUnit(GetOwningPlayer(d.caster), CP_DummyRaw , d.x, d.y, 0.00)
            call UnitAddAbility(dummy, CP_LightningRaw)
            call SetUnitAbilityLevel(dummy, CP_LightningRaw, d.level)
            
        call IssueTargetOrder(dummy, &quot;chainlightning&quot;, GetEnumUnit())
    
    
    
    call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, 0.25)
    
    set t = null
    set dummy = null
            
endfunction


 function CoruptPower_Create takes nothing returns nothing

            local timer t               = GetExpiredTimer()
            local group g               = CreateGroup()
            local CP d
            local integer groupunits
            set d = GetTimerStructA(t)
          
       
       if GetUnitCurrentOrder(d.caster) == OrderId(&quot;charm&quot;) then
        
      
           
        call GroupEnumUnitsInRange(g, d.x, d.y, CP_Range, Condition(function CoruptPower_Cond))
        
        set groupunits = CountUnitsInGroup(g)
        
            call ForGroup(g, function CoruptPower_Cast)
     
            
    call SetUnitState(d.caster, UNIT_STATE_LIFE, GetUnitState(d.caster, UNIT_STATE_LIFE) + d.level * groupunits * 5 )    
       
       else
        
        call PauseTimer(t)
        call ClearTimerStructA(t)
        call DestroyGroup(g)
        call DestroyTimer(t)
        call d.destroy()

        set t = null
       
       endif

                
                    
                    
                    
                    
endfunction

 function CoruptPower_Core takes nothing returns nothing

            local timer t               = CreateTimer()
            local location l            = GetSpellTargetLoc()       
            local CP d                    = CP.create()
           
           
               
                set d.caster            = GetTriggerUnit()
                set d.level             = GetUnitAbilityLevel(d.caster, &#039;A001&#039;)
                set d.x                 = GetUnitX(d.caster)
                set d.y                 = GetUnitY(d.caster)
         
      
        call SetTimerStructA(t, d)
   
        
           call TimerStart(t, CP_Delay , true, function CoruptPower_Create)


        set t = null
        call RemoveLocation(l)
        set l = null


endfunction

endscope

//===========================================================================
function InitTrig_Corupt_Power takes nothing returns nothing
    set gg_trg_Corupt_Power = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Corupt_Power, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Corupt_Power, Condition( function CoruptPower_IdCheck ) )
    call TriggerAddAction( gg_trg_Corupt_Power, function CoruptPower_Core  )
endfunction
&#8203;</div>

SCREENSHOT !

CoruptPower.jpg

Mana Flood

Jass : Yes
Lag : No
Leak : No

Floods a unit with mana creating a barrier that absorbs damage. When the barrier reaches its brink it burst releasing the stored damage as mana and restoring some mana to all units around the target. Also when the unit has the shield on it will not take damage however your mana will be minused.

CODE !

JASS:

<div style="margin-left: 20px">

scope ManaFlood
//*********************************************************************************************
//                                          Mana Flood                                        *  
//                                       ---------------                                      *
//                                              BY                                            *
//                                                                                            *
//                                                                                            *
//                                          sinners_la_b                                      *
//                                                                                            * 
//                            contact at : <a href="mailto:[email protected]">[email protected]</a>                           *
//                                                                                            *  
//                          Read the README for Implementaion details                         *
//                                                                                            *  
//*********************************************************************************************

globals 

//&lt;--------&gt;START RAW CODES&lt;--------&gt;

        private constant integer ManaFlood_Raw              = &#039;A005&#039; // Raw code of Mana Flood
        private constant integer ManaFlood_DummyRaw         = &#039;u002&#039; // Raw code of dummy
        private constant integer ManaFlood_LightningRaw     = &#039;A004&#039; // Raw code of Lightning
        
//&lt;--------&gt;END RAW CODES&lt;--------&gt;

//&lt;--------&gt;START REAL VALUES&lt;--------&gt;

        private constant real ManaFlood_DamageRecieved              = 100.00 // Base of the damage ( base + further * level)
        private constant real ManaFlood_DamageRecievedFurther       = 50.00 // Further of the damage
        private constant real ManaFlood_Mana                        = 50
        private constant real ManaFlood_ManaFurther                 = 25
        
        real ManaFlood_DamageCounter       = 0
        
//&lt;--------&gt;END REAL VALUES&lt;--------&gt;

endglobals

struct MF

    unit caster
    unit target
    integer level
    real DamageRequired
    effect e
    triggeraction ta
    effect e2
endstruct

function ManaFlood_IdCheck takes nothing returns boolean
return GetSpellAbilityId() == ManaFlood_Raw 
endfunction

function ManaFlood_Cond takes nothing returns boolean

    local MF data                   = GetTriggerStructA(GetTriggeringTrigger())

return IsUnitAlly(GetFilterUnit(), GetOwningPlayer(data.caster)) and not ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) ) and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) &gt;0.405 and not ( IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD))

endfunction


function ManaFlood_Detect takes nothing returns nothing

        local trigger tr                = GetTriggeringTrigger()
        local MF data                   = GetTriggerStructA(tr)                      
        local group g                   = CreateGroup()
        local unit next
        local unit dummy
        
        if ManaFlood_DamageCounter &lt; data.DamageRequired then
            
            set data.e                      = AddSpecialEffectTarget(&quot;Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl&quot;, data.target, &quot;origin&quot;)
            set data.e2                     = AddSpecialEffectTarget(&quot;Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl&quot;, data.target, &quot;overhead&quot;)
            
              
                call SetUnitState(data.target, UNIT_STATE_LIFE, GetUnitState(data.target, UNIT_STATE_LIFE) + GetEventDamage())
                call SetUnitState(data.target, UNIT_STATE_MANA, GetUnitState(data.target, UNIT_STATE_MANA) - GetEventDamage() / data.level)

                    set ManaFlood_DamageCounter = ManaFlood_DamageCounter + GetEventDamage()
            
            if GetUnitState(data.target, UNIT_STATE_MANA) &lt;= 0.405 then
                
                
        
        call TriggerRemoveAction(tr, data.ta)
        call DestroyEffect(data.e)
        call DestroyEffect(data.e2)
        call DestroyTrigger(tr)
        call data.destroy()
        call DestroyGroup(g)
        
            set next = null
            set dummy = null
           
           endif
     
        else
       
            call GroupEnumUnitsInRange(g, GetUnitX(data.target), GetUnitY(data.target), 400.00, Condition( function ManaFlood_Cond))
        
        
                    loop
                    
                        set next = FirstOfGroup(g)
                    
                            exitwhen next == null
                
                
                set dummy = CreateUnit(GetOwningPlayer(data.caster), ManaFlood_DummyRaw, GetUnitX(data.target), GetUnitY(data.target), 0.00)
                
                    call UnitAddAbility(dummy, ManaFlood_LightningRaw)
                    call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, 0.25)
                    call IssueTargetOrder(dummy, &quot;chainlightning&quot;, next)
                        
                        call SetUnitState(next, UNIT_STATE_MANA, GetUnitState(next, UNIT_STATE_MANA) + ManaFlood_Mana + ManaFlood_ManaFurther * data.level)
               
               call GroupRemoveUnit(g, next)
                
                  
                
                    endloop
        
        call TriggerRemoveAction(tr, data.ta)
        call DestroyEffect(data.e)
        call DestroyEffect(data.e2)
        call DestroyTrigger(tr)
        call data.destroy()
        call DestroyGroup(g)
        
            set next = null
            set dummy = null
       
       endif
        
endfunction
        
            
                    
function ManaFlood_Core takes nothing returns nothing

        
        local MF data                   = MF.create()
        local trigger tr                = CreateTrigger()
            
        
    set ManaFlood_DamageCounter             = 0
            
            set data.caster                 = GetTriggerUnit()
            set data.target                 = GetSpellTargetUnit()
            set data.level                  = GetUnitAbilityLevel(data.caster, ManaFlood_Raw)
            set data.DamageRequired         = ManaFlood_DamageRecieved + ManaFlood_DamageRecievedFurther * data.level
            set data.e                      = AddSpecialEffectTarget(&quot;Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl&quot;, data.target, &quot;origin&quot;)
            set data.e2                     = AddSpecialEffectTarget(&quot;Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl&quot;, data.target, &quot;overhead&quot;)
            
            
                call SetTriggerStructA(tr, data)
            
            call TriggerRegisterUnitEvent(tr, data.target, EVENT_UNIT_DAMAGED)
            set data.ta = TriggerAddAction(tr, function ManaFlood_Detect)
    
    call PolledWait(25)
    
        call TriggerRemoveAction(tr, data.ta)
        call DestroyEffect(data.e)
        call DestroyEffect(data.e2)
        call ClearTriggerStructA(tr)
        call DestroyTrigger(tr)
        call data.destroy()
 
        
       
endfunction
endscope
//===========================================================================
function InitTrig_Mana_Flood takes nothing returns nothing
    set gg_trg_Mana_Flood = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Mana_Flood, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Mana_Flood, Condition( function ManaFlood_IdCheck ) )
    call TriggerAddAction( gg_trg_Mana_Flood, function ManaFlood_Core )
endfunction
&#8203;</div>


SCREENSHOT !

ManaFlood.jpg


Hope you like them

Sinners
 

Attachments

  • Magic Mana Spells.w3x
    79.6 KB · Views: 219

hell_knight

Playing WoW
Reaction score
126
lol you could see my tutorial open in the background =)

Nice use of lightning effects +rep

( Can't test map , I think the problem is I don't got NewGen )
 
Reaction score
456
Nice looking spells.. but really brain-exploding coding, as there is so many empty lines between the calls.
 
S

sinners_la_b

Guest
Nice looking spells.. but really brain-exploding coding, as there is so many empty lines between the calls.

Yeah it just a personal thing cause it is easier for me to read it.

Also i thought the indents indented the code but i guess not.

Also Credit to hell_knight the the tutorial of custom lightning effects
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top