//***************************************************************************************************
//* ===================
//* Runing Destruction
//* ===================
//* Made by Shdow89
//*
//*
//* How to implement:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* 1. Copy the spell "Runing Destruction" to your map, along with it's buff.
//*
//* 2. Make a global variable of the type hashtable and name it Hasis
//*
//* 3. Copy the costum script section and paste it in your map.
//*
//* 4. Copy this trigger and Paste it in your map. Or you can just copy the code
//* make a trigger with a name Runing Destruction, convert it to costum text(JASS) and paste the code.
//*
//* 5. Change the rawcode of the spell and buff in this code, to the ones in your map, and use the spell.
//* Go down through constants and change what you like.
//*
//* Choosable/Effects:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* Go down through constant function and change to what you like. Units affected are:
//* Enemy Units, Non-Magic immune, Non-Structures and living. This can be changed in the
//* costum script section of the map.
//*
//* Editor's Word:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* My third JASS spell. I'm really proud of this one xD, and I enjoyed making it.
//* Have fun and alter what you want, just remember to give credits :).
//*
//* Spells Action:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* The caster enters a destructive state. Whenever he's moving he deals damage to nearby
//* enemy units. Faster the caster is, more damage he will deal. In addition 1 % of caster's
//* movement speed is transfered into damage.
//*
//* Credits:
//* ¯¯¯¯¯¯¯¯
//* Daelin for his tutorial about DistanceBetweenPoints.
//* Deuterium for his continous comments and help :) (Hope you like this one :))
//* And you for dling the map :).
//*
//*
//*************************************************************************************************
constant function Runing_Destruction_ID takes nothing returns integer
return 'A000' // Runing Destruction ability ID
endfunction
constant function Runing_Destruction_Buff_ID takes nothing returns integer
return 'B000' // It's buff ID
endfunction
constant function Caster_SFX takes nothing returns string
return "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl" // SFX for the caster
endfunction
constant function Target_SFX takes nothing returns string
return "Abilities\\Spells\\Other\\Volcano\\VolcanoMissile.mdl" // SFX for the target
endfunction
constant function Caster_SFX_Point takes nothing returns string
return "chest" // The attachment point for SFX for caster
endfunction
constant function Radius takes nothing returns real
return 200.00 // AOE of the spell
endfunction
constant function Timer_Loop takes nothing returns real
return 0.1 // How fast timer repeats
endfunction
constant function Damage_Per takes integer i returns real
return 0.2 * i // Damage, it's 20 % * level of the Runing Destruction
endfunction
constant function Speed_Damage takes nothing returns real
return 0.01 // extra damage from the movement speed it's 1 % now.
endfunction
//===========================================================================================
//Don't edit anything below this, if you are unsure.
//==============================================================================================
function Trig_Runing_Destruction_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Runing_Destruction_ID()
endfunction
function Runing_Destruction_Effect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit butters = LoadUnitHandle(udg_Hasis, GetHandleId(t), 1)
local real snail = GetUnitMoveSpeed(butters)*Speed_Damage()
local real damage = 0.00
local real x = LoadReal(udg_Hasis, GetHandleId(t), 2)
local real y = LoadReal(udg_Hasis, GetHandleId(t), 3)
local integer i = LoadInteger(udg_Hasis, GetHandleId(t), 4)
local real x1 = GetUnitX(butters)
local real y1 = GetUnitY(butters)
if (GetUnitAbilityLevel(butters, Runing_Destruction_Buff_ID()) > 0) then
if x != x1 or y != y1 then
set damage = Damage_Per(i) * SquareRoot((x1-x)*(x1-x) + (y1-y)*(y1-y)) + snail
call DestroyEffect(AddSpecialEffectTarget(Caster_SFX(), butters, Caster_SFX_Point()))
call DamageEnemiesArea (butters, Radius(), x1, y1, damage, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS, Target_SFX())
endif
call SaveReal(udg_Hasis, GetHandleId(t), 2, x1)
call SaveReal(udg_Hasis, GetHandleId(t), 3, y1)
else
call PauseTimer(t)
call DestroyTimer(t)
set butters = null
endif
endfunction
function Trig_Runing_Destruction_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit cartman = GetTriggerUnit()
local integer i = GetUnitAbilityLevel(cartman, Runing_Destruction_ID())
local real x = GetUnitX(cartman)
local real y = GetUnitY(cartman)
call SaveUnitHandle(udg_Hasis, GetHandleId(t), 1, cartman)
call SaveReal(udg_Hasis, GetHandleId(t), 2, x)
call SaveReal(udg_Hasis, GetHandleId(t), 3, y)
call SaveInteger(udg_Hasis, GetHandleId(t), 4, i)
call TimerStart(t, Timer_Loop(), true, function Runing_Destruction_Effect)
set cartman = null
endfunction
//==================================================================================================
function InitTrig_Runing_Destruction takes nothing returns nothing
local trigger trig = CreateTrigger()
local integer guza
set guza = 0
loop
call TriggerRegisterPlayerUnitEvent(trig, Player(guza), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set guza = guza + 1
exitwhen guza == 16
endloop
call TriggerAddCondition(trig, Condition(function Trig_Runing_Destruction_Conditions))
call TriggerAddAction(trig, function Trig_Runing_Destruction_Actions)
call Preload(Caster_SFX())
call Preload(Target_SFX())
call PreloadStart()
set udg_Hasis = InitHashtable()
set trig = null
endfunction