Warcraft 3 documentation
vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

[Spell] Dark Matter v1.0 No New Posts Warcraft III Spells and Systems

Started by
Dalve

0 Members and 1 Guest are viewing this topic.

Rating

Average Score - 5 / 5

« Created: June 03, 2017, 11:48:54 PM by moyack »

[Spell] Dark Matter v1.0
on: February 01, 2015, 06:12:25 PM
Categories: Target Ground, vJASS
Rating: 5
Warcraft III Spell resource
« Created: June 04, 2017, 12:02:05 AM by moyack »


(Description)
Summons  a dark matter at the targeted point. The dark  matter has  ability to absorb all enemy units within 400  range  onto it's position while releasing smaller dark particles to attack those  captured units. Each particle deals 90 damage  on  hit. Lasts for 15 seconds.

(Details)
  • Level(s): 1
  • Manacost: 270
  • Cooldown: 145 s
  • Cast range: 800
  • Area of Effect: 400







  • (Required)
    • Stack
    • CTL
    • WorldBounds
  • (Optional)
    • SpellEffectEvent
    • AutoFly

  • Import all necessary datas (imports, objects, triggers, etc.) into your map.
  • Install all required dependencies correctly.
  • Configure the spell.
  • Done.

(Readme)
Code: jass
  1. /*
  2.  
  3.     [General]
  4.         Name: Dark Matter
  5.         Version: 1.0
  6.         Class: Ultimate
  7.    
  8.     [Details]
  9.         Level(s): 1
  10.         Manacost: 270
  11.         Cooldown: 145 s
  12.         Cast range: 800
  13.         Area of Effect: 400
  14.        
  15.     [Description]
  16.         Summons  a dark matter at the targeted point. The dark  matter
  17.         has  ability to absorb all enemy units within 400  range  onto
  18.         it's position while releasing smaller dark particles to attack
  19.         those  captured units. Each particle deals 90 damage  on  hit.
  20.         Lasts for 15 seconds.
  21.  
  22.     [External dependencies]
  23.         (Required)
  24.             - Stack
  25.             - CTL
  26.             - WorldBounds
  27.         (Optional)
  28.             - SpellEffectEvent
  29.             - AutoFly
  30.            
  31.     [Credits]
  32.         - Nestharus
  33.             | Stack, CTL, WorldBounds, AutoFly
  34.            
  35.         - Bribe
  36.             | SpellEffectEvent
  37.            
  38.         - JetFangInferno
  39.             | Deathwave.mdx
  40.            
  41.         - WILL THE ALMIGHTY
  42.             | Blackhole.mdx
  43.            
  44.         - Hellx-Magnus
  45.             | BTNEyeOfShadow
  46.            
  47.     [How to import]
  48.         - Import all necessary datas (imports, objects, triggers, etc.)
  49.             into your map.
  50.         - Install all required dependencies correctly.
  51.         - Configure the spell.
  52.         - Done.
  53. */
(Spell)
Code: jass
  1. scope DarkMatter
  2. /*
  3.  
  4.             ~* Dark Matter *~
  5.                     version 1.0
  6.            
  7.         Created by: Dalvengyr
  8.         Copyright 2015
  9.    
  10.         This resource is copyright protected.
  11.         Don't redistribute without permission.
  12.        
  13.         You are free to edit, use, remake, etc.
  14.         but don't remove the copyright notes
  15.         above.
  16.    
  17. */
  18.  
  19.     /*                 *\
  20.         Configuration
  21.     \*                 */
  22.    
  23.     globals
  24.    
  25.     /*  I. General settings */
  26.    
  27.         // Dummy unit's raw code at Object Editor.
  28.         private constant integer    DUMMY_OBJECT_ID       = 'h000'
  29.        
  30.         // Main spell's raw code at Object Editor.
  31.         private constant integer    SPELL_OBJECT_ID       = 'A000'
  32.        
  33.         // General decay time for special effects.
  34.         // Time for effects to finish their death animations
  35.         // before removed completely.
  36.         private constant real       SFX_DECAY_TIME        = 5.0
  37.        
  38.         // General units' hit z offset. Used for 3D collision.
  39.         private constant real       UNITS_HIT_Z_OFFSET    = 50.0
  40.        
  41.    
  42.     /*  II. Orb settings
  43.                 Orb is an object at the center of spell area.
  44.     */
  45.        
  46.         // Orb model's file path.
  47.         private constant string     ORB_SFX               = "war3mapImported\\BlackHole.mdx"
  48.        
  49.         // Orb's flying height.
  50.         private constant real       ORB_HEIGHT_Z          = 0.0
  51.        
  52.         // Orb's scale/size.
  53.         private constant real       ORB_SCALE             = 1.0
  54.        
  55.         // How bad range between victims and the orb can affect the absorb power.
  56.         private constant real       ORB_POWER_FACTOR      = 0.375
  57.        
  58.        
  59.     /*  III. Swirl settings
  60.                 Swirl is consisted by several "waves" (because I use wave model) which
  61.                 swirl around the main orb.
  62.     */
  63.        
  64.         // Wave's raw code at Object Editor.
  65.         private constant integer    SWIRL_WAVE_OBJECT_ID  = 'h001'
  66.        
  67.         // Wave's animation speed.
  68.         private constant real       SWIRL_TIME_SCALE      = 0.1
  69.        
  70.         // Wave's flying height.
  71.         private constant real       SWIRL_HEIGHT_Z        = 100.0
  72.        
  73.         // Wave's scale/size.
  74.         private constant real       SWIRL_SCALE           = 1.25
  75.        
  76.        
  77.     /*  IV. Particle settings
  78.                 Particles are missiles that are periodically released by the orb to attack
  79.                 captured units.
  80.     */
  81.    
  82.         // Particle's model file path.
  83.         private constant string     PARTICLE_SFX          = "Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl"
  84.    
  85.         // Particle's starting fly height when launched.
  86.         private constant real       PARTICLE_LAUNCH_Z     = 100.0
  87.    
  88.         // Particle's scale/size.
  89.         private constant real       PARTICLE_SCALE        = 0.2
  90.    
  91.         // Particle's turn rate.
  92.         private constant real       PARTICLE_TURN_SPEED   = 0.1
  93.    
  94.         // Max range between particle at target to hit the target.
  95.         private constant real       PARTICLE_HIT_RADIUS   = 70.0
  96.    
  97.         // If false, each particle can only hits one target.
  98.         private constant boolean    PARTICLE_PIERCING     = false
  99.        
  100.         // Dealt damage setting.
  101.         private constant attacktype PARTICLE_ATTACK_TYPE  = ATTACK_TYPE_NORMAL
  102.         private constant damagetype PARTICLE_DAMAGE_TYPE  = DAMAGE_TYPE_NORMAL
  103.        
  104.     endglobals
  105.    
  106.     // These settings allow you to assign different values for each level
  107.     // in case the ability has more than one level.
  108.    
  109.     // Number of created wave to swirl around the orb.
  110.     private constant function SwirlCount takes integer level returns integer
  111.         return 9
  112.     endfunction
  113.    
  114.     // Range/distance from the orb to the created waves.
  115.     private constant function SwirlRadius takes integer level returns real
  116.         return 125.0
  117.     endfunction
  118.    
  119.     // Rotation speed of waves, in radians.
  120.     private constant function SwirlRotation takes integer level returns real
  121.         return 0.09
  122.     endfunction
  123.    
  124.     // Dealt damage when particle hits a target.
  125.     private constant function ParticleDamage takes integer level returns real
  126.         return 90.0
  127.     endfunction
  128.    
  129.     // Move speed of each particle.
  130.     private constant function ParticleSpeed takes integer level returns real
  131.         return 5.0
  132.     endfunction
  133.    
  134.     // Maximum delay before the orb releases another particle.
  135.     // Delay is randomized between zero and this value.
  136.     private constant function ParticleSpawnDelayMax takes integer level returns real
  137.         return 0.5
  138.     endfunction
  139.    
  140.     // Maximum range between the orb and targets to absorb them.
  141.     private constant function OrbAoE takes integer level returns real
  142.         return 400.0
  143.     endfunction
  144.    
  145.     // Duration of the spell.
  146.     private constant function OrbDuration takes integer level returns real
  147.         return 15.0
  148.     endfunction
  149.    
  150.     // The absorbtion power.
  151.     private constant function OrbPower takes integer level returns real
  152.         return 15.0
  153.     endfunction
  154.    
  155.     // Classifications of targets that can be affected by this spell.
  156.     private constant function SpellTargets takes unit target, player caster returns boolean
  157.         return IsUnitEnemy(target, caster) and not IsUnitType(target, UNIT_TYPE_STRUCTURE)
  158.     endfunction
  159.    
  160.     // You can add any additional effect to the target here.
  161.     // This function is executed right before the damage is dealt to
  162.     // the target.
  163.     // If you don't need this, you are free to remove this module
  164.     // anytime.
  165.     private module DarkMatterDamageEvent
  166.         static method onDamage takes unit caster, unit target returns nothing
  167.            
  168.         endmethod
  169.     endmodule
  170.    
  171.     // ~*~*~*~*~**~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
  172.    
  173.     globals
  174.         private constant real INTERVAL = 0.0312500
  175.         private group Group = CreateGroup()
  176.     endglobals
  177.    
  178.    
  179.     // Native declaration.
  180.     native UnitAlive takes unit id returns boolean
  181.    
  182.    
  183.     // Stack used to contain/store waves.
  184.     private struct Swirl extends array
  185.         unit unit
  186.         implement Stack
  187.     endstruct
  188.    
  189.    
  190.     // Create swirl at give coordinates.
  191.     private struct Tornado extends array
  192.        
  193.         Swirl swirl
  194.         integer count
  195.        
  196.         real distance
  197.         real angle
  198.         real rotation
  199.        
  200.         real space
  201.         real x
  202.         real y
  203.        
  204.         static constant real TAU = 2*bj_PI
  205.        
  206.         method terminate takes nothing returns nothing
  207.            
  208.             local Swirl node = .swirl.first
  209.            
  210.             // Kill all waves.
  211.             loop
  212.                 exitwhen node == 0
  213.                
  214.                 call KillUnit(node.unit)
  215.                 set node.unit = null
  216.                
  217.                 set node = node.next
  218.             endloop
  219.            
  220.             call .swirl.destroy()
  221.             call destroy()
  222.            
  223.         endmethod
  224.        
  225.        
  226.         implement CTL
  227.        
  228.             local real a
  229.             local integer i
  230.             local Swirl node
  231.            
  232.         implement CTLExpire
  233.        
  234.             set i = .count
  235.             set node = .swirl.first
  236.             set .angle = .angle + .rotation
  237.            
  238.             // Iterate through all nodes to update
  239.             // their angles/rotations.
  240.             loop
  241.                 exitwhen i <= 0
  242.                
  243.                 set a = .angle+.space*i
  244.                 call SetUnitX(node.unit, .x + .distance * Cos(a))
  245.                 call SetUnitY(node.unit, .y + .distance * Sin(a))
  246.                 call SetUnitFacing(node.unit, a*bj_RADTODEG)
  247.                
  248.                 set node = node.next
  249.                 set i = i - 1
  250.             endloop
  251.            
  252.         implement CTLEnd
  253.        
  254.        
  255.         static method spawn takes player p, integer count, real x, real y, real dist, real rot returns thistype
  256.            
  257.             local thistype this = create()
  258.             local integer i = 0
  259.             local real a
  260.             local Swirl node
  261.            
  262.             // Number of waves.
  263.             set .count = count
  264.             // Angle difference between each wave (in radian).
  265.             set .space = TAU/count
  266.             // Initial angle (random).
  267.             set .angle = GetRandomReal(-bj_PI, bj_PI)
  268.             // Allocate stack for waves.
  269.             set .swirl = Swirl.create()
  270.            
  271.             // Distance from center to waves.
  272.             set .distance = dist
  273.             // Rotation rate.
  274.             set .rotation = rot
  275.             set .x = x
  276.             set .y = y
  277.            
  278.             // Create the waves and store into the stack.
  279.             loop
  280.                 exitwhen i >= count
  281.                
  282.                 // Allocate new node to the stack.
  283.                 set node = .swirl.push()
  284.                 set a = .angle+.space*i
  285.                 set node.unit = CreateUnit(p, SWIRL_WAVE_OBJECT_ID, x+dist*Cos(a), y+dist*Sin(a), a*bj_RADTODEG)
  286.                
  287.                 call SetUnitScale(node.unit, SWIRL_SCALE, 1, 1)
  288.                 call SetUnitTimeScale(node.unit, SWIRL_TIME_SCALE)
  289.                
  290.                 if SWIRL_HEIGHT_Z > 0 then
  291.                
  292.                     static if not LIBRARY_AutoFly then
  293.                         if UnitAddAbility(node.unit, 'Amrf') and UnitRemoveAbility(node.unit, 'Amrf') then
  294.                         endif
  295.                     endif
  296.                    
  297.                     call SetUnitFlyHeight(node.unit, SWIRL_HEIGHT_Z, 0)
  298.                 endif
  299.                
  300.                 set i = i + 1
  301.             endloop
  302.            
  303.             return this
  304.         endmethod
  305.        
  306.     endstruct
  307.    
  308.    
  309.     private keyword DarkMatter
  310.    
  311.    
  312.     // Launch 3D homing missile.
  313.     private struct SimpleMissile extends array
  314.        
  315.         effect sfx
  316.         player owner
  317.         group targets
  318.        
  319.         unit caster
  320.         unit target
  321.         unit missile
  322.        
  323.         real x
  324.         real y
  325.         real z
  326.        
  327.         real dc
  328.         real dx
  329.         real damage
  330.        
  331.         real turn
  332.         real angle
  333.         real speed
  334.        
  335.         method terminate takes nothing returns nothing
  336.        
  337.             // Group is only created if piercing is true.
  338.             static if PARTICLE_PIERCING then
  339.                 call DestroyGroup(.targets)
  340.                 set .targets = null
  341.             endif
  342.            
  343.             call DestroyEffect(.sfx)
  344.             call UnitApplyTimedLife(.missile, 'BTLF', SFX_DECAY_TIME)
  345.             call destroy()
  346.            
  347.             // Remove leaks.
  348.             set .missile = null
  349.             set .target = null
  350.             set .caster = null
  351.             set .sfx = null
  352.            
  353.         endmethod
  354.        
  355.         implement optional DarkMatterDamageEvent
  356.        
  357.         implement CTL
  358.        
  359.             local real a
  360.             local real v
  361.             local real h
  362.            
  363.             local real d
  364.             local real x
  365.             local real y
  366.            
  367.             local unit u
  368.             local unit t
  369.             local integer rand
  370.            
  371.         implement CTLExpire
  372.        
  373.             set .dc = .dc + .speed
  374.             set .x = .x + .speed * Cos(.angle)
  375.             set .y = .y + .speed * Sin(.angle)
  376.            
  377.             // Parabola equation.
  378.             set v = 4 * (.dx-.dc) * (.dc/.dx) + PARTICLE_LAUNCH_Z
  379.            
  380.             // If haven't touched the ground and still inside the map bounds.
  381.             if v > 0 and .x < WorldBounds.maxX and .x > WorldBounds.minX and .y < WorldBounds.maxY and .y > WorldBounds.minY then
  382.            
  383.                 call SetUnitX(.missile, .x)
  384.                 call SetUnitY(.missile, .y)
  385.                 call SetUnitFlyHeight(.missile, v, 0)
  386.                
  387.                 // Adjust the angle to face the target.
  388.                 set a = Atan2(GetUnitY(.target)-.y, GetUnitX(.target)-.x)
  389.                 if Cos(.angle - a) < Cos(.turn) then
  390.                     if Sin(a - .angle) >= 0 then
  391.                         set .angle = .angle + .turn
  392.                     else
  393.                         set .angle = .angle - .turn
  394.                     endif
  395.                 else
  396.                     set .angle = a
  397.                 endif
  398.                
  399.                 // Determine one random target from all possible targets.
  400.                 // if not piercing.
  401.                 static if not PARTICLE_PIERCING then
  402.                     set t = null
  403.                     set rand = 0
  404.                 endif
  405.                
  406.                 // Iterates all units around the missile.
  407.                 call GroupEnumUnitsInRange(Group, .x, .y, PARTICLE_HIT_RADIUS, null)
  408.                 loop
  409.                     set u = FirstOfGroup(Group)
  410.                     exitwhen u == null
  411.                     call GroupRemoveUnit(Group,  u)
  412.                    
  413.                     if UnitAlive(u) and SpellTargets(u, owner) then
  414.                    
  415.                         set x = GetUnitX(u)
  416.                         set y = GetUnitY(u)
  417.                         set h = GetUnitFlyHeight(u) + UNITS_HIT_Z_OFFSET - v
  418.                         set d = SquareRoot((.x-x)*(.x-x)+(.y-y)*(.y-y))
  419.                        
  420.                         // 3D spherical collision.
  421.                         if SquareRoot(d*d+h*h) <= PARTICLE_HIT_RADIUS then
  422.                        
  423.                             static if PARTICLE_PIERCING then
  424.                            
  425.                                 if not IsUnitInGroup(u, .targets) then
  426.                                
  427.                                     static if thistype.onDamage.exists then
  428.                                         call thistype.onDamage(.caster, u)
  429.                                     endif
  430.                                
  431.                                     call UnitDamageTarget(.caster, u, .damage, false, false, PARTICLE_ATTACK_TYPE, PARTICLE_DAMAGE_TYPE, null)
  432.                                     call GroupAddUnit(.targets, u)
  433.                                    
  434.                                 endif
  435.                                
  436.                             else
  437.                                
  438.                                 // Quite effective to obtain random unit from a group.
  439.                                 set rand = rand + 1
  440.                                
  441.                                 if GetRandomInt(1, rand) == 1 then
  442.                                     set t = u
  443.                                 endif
  444.                                
  445.                             endif
  446.                         endif
  447.                        
  448.                     endif
  449.                 endloop
  450.                
  451.                 static if not PARTICLE_PIERCING then
  452.                     // If a target is found.
  453.                     if t != null then
  454.                        
  455.                         static if thistype.onDamage.exists then
  456.                             call thistype.onDamage(.caster, t)
  457.                         endif
  458.                    
  459.                         call UnitDamageTarget(.caster, t, .damage, false, false, PARTICLE_ATTACK_TYPE, PARTICLE_DAMAGE_TYPE, null)
  460.                         call terminate()
  461.                         set t = null
  462.                        
  463.                     endif
  464.                 endif
  465.                
  466.             else
  467.                 call terminate()
  468.             endif
  469.            
  470.         implement CTLEnd
  471.        
  472.        
  473.         static method launch takes DarkMatter source, unit target returns thistype
  474.            
  475.             local thistype this = create()
  476.             local real x = GetUnitX(target)
  477.             local real y = GetUnitY(target)
  478.            
  479.             set .target = target
  480.             set .caster = source.caster
  481.             set .owner = source.owner
  482.            
  483.             // Launch from random location nearby the orb.
  484.             set .x = source.x + GetRandomReal(-source.tornado.distance, source.tornado.distance)
  485.             set .y = source.y + GetRandomReal(-source.tornado.distance, source.tornado.distance)
  486.             set .angle = GetRandomReal(-bj_PI, bj_PI)
  487.            
  488.             set .missile = CreateUnit(.owner, DUMMY_OBJECT_ID, .x, .y, .angle*bj_RADTODEG)
  489.             set .sfx = AddSpecialEffectTarget(PARTICLE_SFX, .missile, "origin")
  490.             set .turn = PARTICLE_TURN_SPEED
  491.            
  492.             set .damage = source.damage
  493.             set .speed = source.speed
  494.             set .dx = source.aoe
  495.             set .dc = 0
  496.            
  497.             // Create group if only piercing is true.
  498.             static if PARTICLE_PIERCING then
  499.                 set .targets = CreateGroup()
  500.             endif
  501.            
  502.             static if not LIBRARY_AutoFly then
  503.                 if UnitAddAbility(.missile, 'Amrf') and UnitRemoveAbility(.missile, 'Amrf') then
  504.                 endif
  505.             endif
  506.            
  507.             call SetUnitFlyHeight(.missile, PARTICLE_LAUNCH_Z, 0)
  508.             call SetUnitScale(.missile, PARTICLE_SCALE, 1, 1)
  509.            
  510.             return this
  511.         endmethod
  512.        
  513.     endstruct
  514.    
  515.    
  516.     // Main spell's struct.
  517.     private struct DarkMatter extends array
  518.    
  519.         unit orb
  520.         unit caster
  521.         group targets
  522.        
  523.         Tornado tornado
  524.         player owner
  525.         effect sfx
  526.        
  527.         real aspd
  528.         real aspdx
  529.         real speed
  530.        
  531.         real damage
  532.         real power
  533.         real aoe
  534.        
  535.         real duration
  536.         real x
  537.         real y
  538.        
  539.         real delay
  540.         real delayx
  541.         real rotation
  542.         real amount
  543.        
  544.         static constant real HP = bj_PI/2
  545.        
  546.         method terminate takes nothing returns nothing
  547.        
  548.             local unit u
  549.        
  550.             // Turn all remaining units' collision back to on.
  551.             loop
  552.                 set u = FirstOfGroup(.targets)
  553.                 exitwhen u == null
  554.                 call GroupRemoveUnit(.targets, u)
  555.                 call SetUnitPathing(u, true)
  556.             endloop
  557.        
  558.             call .tornado.terminate()
  559.             call DestroyEffect(.sfx)
  560.             call DestroyGroup(.targets)
  561.             call UnitApplyTimedLife(.orb, 'BTLF', SFX_DECAY_TIME)
  562.            
  563.             call destroy()
  564.             // Remove leaks.
  565.             set .targets = null
  566.             set .caster = null
  567.             set .orb = null
  568.             set .sfx = null
  569.            
  570.         endmethod
  571.        
  572.        
  573.         implement CTL
  574.            
  575.             local group g
  576.        
  577.             local integer rand = 0
  578.             local unit t = null
  579.             local unit u
  580.            
  581.             local real d
  582.             local real x
  583.             local real y
  584.            
  585.             local real h
  586.             local real a
  587.             local real pow
  588.            
  589.         implement CTLExpire
  590.        
  591.             if .duration > INTERVAL then
  592.            
  593.                 set .duration = .duration - INTERVAL
  594.                
  595.                 // Iterate through all units around the orb (within aoe).
  596.                 call GroupEnumUnitsInRange(Group, .x, .y, .aoe, null)
  597.                 loop
  598.                     set u = FirstOfGroup(Group)
  599.                     exitwhen u == null
  600.                     call GroupRemoveUnit(Group, u)
  601.                    
  602.                     if UnitAlive(u) and SpellTargets(u, owner) then
  603.                        
  604.                         set x = GetUnitX(u)
  605.                         set y = GetUnitY(u)
  606.                         set d = SquareRoot((.x-x)*(.x-x)+(.y-y)*(.y-y))
  607.                         // Power is affected by distance between orb and the target.
  608.                         set pow = .power - .power*(d/.aoe)*ORB_POWER_FACTOR
  609.                         // Calculate target angle.
  610.                         set a = Atan2(.y-y, .x-x) - (HP*(d/.aoe))*.rotation
  611.                        
  612.                         if not IsUnitInGroup(u, .targets) then
  613.                             call GroupAddUnit(.targets, u)
  614.                             call SetUnitPathing(u, false)
  615.                         endif
  616.                    
  617.                         if .aspd <= INTERVAL then
  618.                        
  619.                             set rand = rand + 1
  620.                            
  621.                             if GetRandomInt(1, rand) == 1 then
  622.                                 set t = u
  623.                             endif
  624.                            
  625.                         endif
  626.                        
  627.                         if d > pow then
  628.                        
  629.                             call SetUnitX(u, x + pow * Cos(a))
  630.                             call SetUnitY(u, y + pow * Sin(a))
  631.                            
  632.                         else
  633.                        
  634.                             call SetUnitX(u, .x)
  635.                             call SetUnitY(u, .y)
  636.                            
  637.                         endif
  638.                        
  639.                     endif
  640.                 endloop
  641.                
  642.                 // Iterates all affected units which have
  643.                 // escaped the spell area and turn their
  644.                 // collision on.
  645.                 set g = .targets
  646.                 set .targets = CreateGroup()
  647.                 loop
  648.                     set u = FirstOfGroup(g)
  649.                     exitwhen u == null
  650.                     call GroupRemoveUnit(g, u)
  651.                    
  652.                     set x = GetUnitX(u)
  653.                     set y = GetUnitY(u)
  654.                     if SquareRoot((.x-x)*(.x-x)+(.y-y)*(.y-y)) > .aoe then
  655.                         call SetUnitPathing(u, true)
  656.                     else
  657.                         call GroupAddUnit(.targets, u)
  658.                     endif
  659.                 endloop
  660.                
  661.                 if .aspd > INTERVAL then
  662.                     set .aspd = .aspd - INTERVAL
  663.                 elseif t != null then
  664.                     // Launch missile if a random target is found.
  665.                     set .aspd = GetRandomReal(0, .aspdx)
  666.                     call SimpleMissile.launch(this, t)
  667.                     set t = null
  668.                 endif
  669.                
  670.                 // Remove leaks.
  671.                 call DestroyGroup(g)
  672.                 set g = null
  673.             else
  674.                 call terminate()
  675.             endif
  676.            
  677.         implement CTLEnd
  678.        
  679.        
  680.         static method onCast takes nothing returns nothing
  681.            
  682.             local thistype this = create()
  683.             local integer l
  684.            
  685.             set .caster = GetTriggerUnit()
  686.             set .owner = GetTriggerPlayer()
  687.            
  688.             set .x = GetSpellTargetX()
  689.             set .y = GetSpellTargetY()
  690.             set .targets = CreateGroup()
  691.            
  692.             set .orb = CreateUnit(.owner, DUMMY_OBJECT_ID, .x, .y, 270)
  693.             set .sfx = AddSpecialEffectTarget(ORB_SFX, .orb, "origin")
  694.             set l = GetUnitAbilityLevel(.caster, SPELL_OBJECT_ID)
  695.            
  696.             set .aoe = OrbAoE(l)
  697.             set .power = OrbPower(l)
  698.             set .duration = OrbDuration(l)
  699.            
  700.             set .rotation = SwirlRotation(l)
  701.             set .tornado = Tornado.spawn(.owner, SwirlCount(l), .x, .y, SwirlRadius(l), .rotation)
  702.             // Get the rotation direction.
  703.             set .rotation = .rotation/RAbsBJ(.rotation)
  704.            
  705.             set .speed = ParticleSpeed(l)
  706.             set .damage = ParticleDamage(l)
  707.             set .aspd = ParticleSpawnDelayMax(l)
  708.            
  709.             set .aspdx = .aspd
  710.             call SetUnitScale(.orb, ORB_SCALE, 1, 1)
  711.            
  712.             if ORB_HEIGHT_Z > 0 then
  713.                 static if not LIBRARY_AutoFly then
  714.                     if UnitAddAbility(.orb, 'Amrf') and UnitRemoveAbility(.orb, 'Amrf') then
  715.                     endif
  716.                 endif
  717.                 call SetUnitFlyHeight(.orb, ORB_HEIGHT_Z, 0)
  718.             endif
  719.            
  720.         endmethod
  721.            
  722.            
  723.         static if not LIBRARY_SpellEffectEvent then
  724.             private static method check takes nothing returns boolean
  725.                 if GetSpellAbilityId() == SPELL_OBJECT_ID then
  726.                     call thistype.onCast()
  727.                 endif
  728.                 return false
  729.             endmethod
  730.         endif
  731.        
  732.        
  733.         static method onInit takes nothing returns nothing
  734.  
  735.             local trigger t
  736.            
  737.             static if LIBRARY_SpellEffectEvent then
  738.                 call RegisterSpellEffectEvent(SPELL_OBJECT_ID, function thistype.onCast)
  739.             else
  740.                 set t = CreateTrigger()
  741.                 call TriggerAddCondition(t, Condition(function thistype.check))
  742.             endif
  743.            
  744.         endmethod
  745.        
  746.     endstruct
  747.    
  748. endscope

  • Nestharus

| Stack, CTL, WorldBounds, AutoFly

           
  • Bribe

| SpellEffectEvent

           
  • JetFangInferno

| Deathwave.mdx


           
  • WILL THE ALMIGHTY

| Blackhole.mdx

           
  • Hellx-Magnus

| BTNEyeOfShadow

[/list]
« Last Edit: June 04, 2017, 12:03:20 AM by moyack »



Re: [Spell] Dark Matter v1.0
Reply #1 on: February 02, 2015, 08:12:27 AM

Great presentation in your spell. :)

Later the spell /system section will add some search features, this in order to stand out your resource.


Great work and thanks for contribute in Blizzmod :D


Re: [Spell] Dark Matter v1.0
Reply #2 on: February 04, 2015, 12:13:53 AM

I love the effects and assuming you are dalvengyr from hive then there should be not much problem with the code either but I am not really a coder to say that.

Thanks for sharing it here, hope we can see more from you.

Chronicles of Darkness
by: SonofJay

A BlizzMod Hosted Project

They can hate, let them hate, make them hate.


Re: [Spell] Dark Matter v1.0
Reply #3 on: September 22, 2015, 12:58:07 AM

Support, thank you for sharing.



 

* Random Spells & Systems

Started by moyack

Replies: 12
Views: 20074
PoC Information

Started by olofmoleman

Replies: 0
Views: 3963
Warcraft III Models

Started by moyack

Replies: 4
Views: 12577
Jass Tutorials

Started by Anitarf

Replies: 0
Views: 1665
Codes & Snippets

Started by rvonsonsnadtz

Replies: 10
Views: 21318
Coding Help
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...