Name | Type | is_array | initial_value |
MSLoc | location | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
//===========================================================================
//A vJASS and JESP (i think)
//@author Kratoz-X
//
//@credits
//Flame_Phoenix for it great turorial "Making a spell in vJass" :D
//
//@version 1.0
//
//vJASS is soo Cooool :)
//===========================================================================
scope BurningWaves initializer Init
//===========================================================================
//=============================SETUP START===================================
//===========================================================================
globals
private constant integer SPELL_ID = 'A001' //the rawcode of the spell
private constant integer DUMMY_ID = 'h000' //rw of the dummy unit my omnidummy is used in all my spells :)
private constant string AOE_EFFECT = "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl" //effect that will be created when we cast the spell on the AOE
private constant string AOE2_EFFECT = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" //another thing used to make this spell cool
private constant damagetype D_TYPE = DAMAGE_TYPE_FIRE //the attack type of the spell
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC //the damage type of the spell
private constant string RAY_ID1 = "FORK" //The rw of ligthing used for the waves
private constant real RAY_R1 = 0.75 //Red color of the ray
private constant real RAY_G1 = 0.5 //Green color
private constant real RAY_B1 = 0.0 //blue color
private constant real RAY_A1 = 1.0 //Alpha of color 1=no transparency 0=FULL transparency
private constant string RAY_ID2 = "FORK" //The rw of ligthing used for the waves
private constant real RAY_R2 = 1.0 //Red color of the ray
private constant real RAY_G2 = 0.2 //Green color
private constant real RAY_B2 = 0.05 //blue color
private constant real RAY_A2 = 1.0 //Alpha of color 1=no transparency 0=FULL transparency
private constant real Spellaoe = 150 //not sugested to be more than 200 for balance things but whatever
endglobals
private function Range takes integer level returns real
//Real range betwen waves
return 150.
endfunction
private function Waves takes integer level returns real
//Number of waves per level
return level * 2. //3 waves are from default to evade the spell was too long of too short
endfunction
private function Delay takes integer level returns real
//delay in seconds betwen waves CANT be les than 0.1 ¬¬ why not Blizzard?????
//this also affect true sigtht
return 0.1
endfunction
private function Damage takes integer level returns real
//The damage enemies will take
return level * 25.
endfunction
//===========================================================================
//=============================SETUP END=====================================
//===========================================================================
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
//===========================================================================
private function Actions takes nothing returns nothing
local location spellLoc = GetSpellTargetLoc()
local unit caster = GetTriggerUnit()
local real spellX = GetLocationX(spellLoc)
local real spellY = GetLocationY(spellLoc)
local location curentwave = GetUnitLoc(caster)
local real waveX = GetLocationX(curentwave)
local real waveY = GetLocationY(curentwave)
local integer level = GetUnitAbilityLevel(caster, SPELL_ID)
local real facing = GetUnitFacing(caster)
local real Loopspell = 0
local lightning array wavesray
set Loopspell = 0
call TriggerSleepAction( .1 )
set facing = GetUnitFacing(caster)
loop
exitwhen Loopspell == (Waves(level) + 3.)
set curentwave = PolarProjectionBJ(GetUnitLoc(caster), ( Range(level) * (Loopspell + 1.50 ) ), facing)
set waveX = GetLocationX(curentwave)
set waveY = GetLocationY(curentwave)
call AddLightningLoc( RAY_ID1, GetUnitLoc(caster), curentwave )
set wavesray[1] = GetLastCreatedLightningBJ()
call AddLightningLoc( RAY_ID2, GetUnitLoc(caster), curentwave )
set wavesray[2] = GetLastCreatedLightningBJ()
call DestroyEffect(AddSpecialEffect(AOE_EFFECT, waveX, waveY))
call SetLightningColorBJ( wavesray[1], RAY_R1, RAY_G1, RAY_B1, RAY_A1 )
call SetLightningColorBJ( wavesray[2], RAY_R2, RAY_G2, RAY_B2, RAY_A2 )
call TriggerSleepAction( Delay(level) )
call DestroyEffect(AddSpecialEffect(AOE2_EFFECT, waveX, waveY))
set Loopspell = (Loopspell + 1)
call UnitDamagePointLoc( caster, Delay(level), Spellaoe, curentwave, Damage(level), A_TYPE, D_TYPE )
//Someone can tell me whow make unitgroups to make this optional damage allies???????????
call DestroyLightning( wavesray[1] )
call DestroyLightning( wavesray[2] )
endloop
call RemoveLocation(spellLoc)
call RemoveLocation(curentwave)
set spellLoc = null
set curentwave = null
set Loopspell = 0
set caster = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger BurningWavesTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(BurningWavesTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(BurningWavesTrg, Condition( function Conditions ) )
call TriggerAddAction( BurningWavesTrg, function Actions )
//preloading effects
call Preload(AOE_EFFECT)
call Preload(AOE2_EFFECT)
//preloading the ability
set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, 0, 0, 0)
call UnitAddAbility(bj_lastCreatedUnit, SPELL_ID)
call KillUnit(bj_lastCreatedUnit)
endfunction
endscope