Mojo Magic v1.31 - reworked
Import Difficulty: Easy
Requirements: JASS NewGen, T32 (map has it)
Allowed Targets: Enemies/Allies/Not Self/Organic
Leakless?: Check yourself
GUI/JASS?: vJASS
Lagless?: Yes
MUI?: Of course
Spell Description: Binds the target to the Witch Doctor using dark magic. If the linked units' distance is more than 600 range or the duration ends, the link will break and damage or heal the linked units.
The Witch Doctor recieves only the half of the damage if casted on enemy unit.
Level 1 - 60 damage/heal
Level 2 - 120 damage/heal
Level 3 - 180 damage/heal
Screenshots:
At cast:
Link breaks:
Triggers:
I made this spell for fun
It can be used to heal and damage either, but it will take effect on the caster too.
Enjoy!
Import Difficulty: Easy
Requirements: JASS NewGen, T32 (map has it)
Allowed Targets: Enemies/Allies/Not Self/Organic
Leakless?: Check yourself
GUI/JASS?: vJASS
Lagless?: Yes
MUI?: Of course
Spell Description: Binds the target to the Witch Doctor using dark magic. If the linked units' distance is more than 600 range or the duration ends, the link will break and damage or heal the linked units.
The Witch Doctor recieves only the half of the damage if casted on enemy unit.
Level 1 - 60 damage/heal
Level 2 - 120 damage/heal
Level 3 - 180 damage/heal
Screenshots:
At cast:
Link breaks:
Triggers:
JASS:
scope MojoMagic
globals
constant integer SPELL_ID = 039;A000039; //Spell ID (Ctrl+D at Object Editor)
constant real DAMAGE_MULTI = 60. //Damage multiplier
constant real CASTER_MULTI = 0.5 //Multiplier of damage on caster
constant integer DURATION = 5 //Multiplier of duration
constant string FX_STRING = "Abilities\\Spells\\Undead\\DeathPact\\DeathPactTarget.mdl" //Spell SFX
constant real RED = 0.75 //*******************************
constant real GREEN = 0.2 //
constant real BLUE = 0.8 //These are the colors and the alpha value of the lightning
constant real ALPHA = 0.8 //*******************************
constant real DISTANCE = 600.0 //The maximal range of the link
constant real HEIGHT = 50. // Height of lightning effect
constant string LIGHT_TYPE = "SPLK" // Type of lightning (STLK is Spirit Link)
constant boolean DMG_ON_END= true //This will set whether the damage part shall run when the chain is broken
private location MoveLoc = Location (0, 0)
endglobals
function GetCoordZ takes real x, real y returns real
call MoveLocation (MoveLoc, x, y)
return GetLocationZ (MoveLoc)
endfunction
private function Damage takes integer level returns real
return DAMAGE_MULTI * level
endfunction
private function Duration takes integer level returns integer
return DURATION * level
endfunction
//! textmacro DAMAGE_PART
if IsUnitEnemy(.target, GetOwningPlayer(.caster)) == true then
call UnitDamageTarget( .caster, .target, DAMAGE_MULTI, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS ) //Damage Target
call UnitDamageTarget( .caster, .caster, DAMAGE_MULTI*CASTER_MULTI, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS ) //Damage Caster
else
call SetUnitState( .target, UNIT_STATE_LIFE, ( GetWidgetLife( .target) + DAMAGE_MULTI ) ) //Heal Target
call SetUnitState( .caster, UNIT_STATE_LIFE, ( GetWidgetLife( .caster) + DAMAGE_MULTI ) ) //Heal Caster
endif
//! endtextmacro
private struct mojo
unit caster
unit target
lightning light
real damage
integer ticks
private method periodic takes nothing returns boolean
local real loc1x = GetUnitX(.caster)
local real loc1y = GetUnitY(.caster)
local real loc1z = GetCoordZ(loc1x,loc1y) + GetUnitFlyHeight(.caster) + HEIGHT
local real loc2x = GetUnitX(.target)
local real loc2y = GetUnitY(.target)
local real loc2z = GetCoordZ(loc2x,loc2y) + GetUnitFlyHeight(.target) + HEIGHT
local real disx = loc2x - loc1x
local real disy = loc2y - loc1y
local real distance = disx * disx + disy * disy
call MoveLightningEx( .light, true, loc1x, loc1y, loc1z, loc2x, loc2y, loc2z)
set .ticks = .ticks - 1
if .ticks == 0 and DMG_ON_END then
//! runtextmacro DAMAGE_PART()
call DestroyEffect( AddSpecialEffect( FX_STRING, loc1x, loc1y))
call DestroyEffect( AddSpecialEffect( FX_STRING, loc2x, loc2y))
call DestroyLightning(.light)
return true
endif
if distance >= DISTANCE*DISTANCE or GetWidgetLife(.target) <.405 or GetWidgetLife(.caster) <.405 then
//! runtextmacro DAMAGE_PART()
call DestroyEffect( AddSpecialEffect( FX_STRING, loc1x, loc1y))
call DestroyEffect( AddSpecialEffect( FX_STRING, loc2x, loc2y))
call DestroyLightning(.light)
return true
endif
return false
endmethod
implement T32
endstruct
private function Trig_Mojo_Magic_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
function Trig_Mojo_Magic_Actions takes nothing returns nothing
local mojo d = mojo.create()
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real loc1x = GetUnitX(caster)
local real loc1y = GetUnitY(caster)
local real loc1z = GetCoordZ(loc1x,loc1y) + GetUnitFlyHeight(d.caster) + HEIGHT
local real loc2x = GetUnitX(target)
local real loc2y = GetUnitY(target)
local real loc2z = GetCoordZ(loc2x,loc2y) + GetUnitFlyHeight(d.target) + HEIGHT
set d.light = AddLightningEx( LIGHT_TYPE, true, loc1x, loc1y, loc1z, loc2x, loc2y, loc2z ) //Set the type of the lightning (in this case, it's Spirit Link)
call SetLightningColor( d.light, RED, GREEN, BLUE, ALPHA ) //Set the color of the lightning
set d.caster = caster
set d.target = target
set d.damage = Damage( GetUnitAbilityLevel(d.caster, SPELL_ID) )
set d.ticks = R2I(Duration( GetUnitAbilityLevel(d.caster, SPELL_ID) ) / T32_PERIOD)
call d.startPeriodic()
set caster = null
set target = null
endfunction
//===========================================================================
function InitTrig_Mojo_Magic takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Mojo_Magic_Conditions ) )
call TriggerAddAction( t, function Trig_Mojo_Magic_Actions )
set t = null
endfunction
endscope
I made this spell for fun
It can be used to heal and damage either, but it will take effect on the caster too.
Enjoy!