//---------------------------------------------------------
//Hi, I'm Naitsirk and this is my very first vJASS sepll.
// This spell is ment to make an Explosion that damages the units in it.
//Then send out Rays of Sunlight which damages the enmies being hitted and heals the allies being hitted.
//Thanks to 270898 For helping me with it...
//Thanks to The_Witcher for learning me coordinates:P
// ohh... and sorry if it's abit messy...
//---------------------------------------------------------
//How to Import:
//First: Copy the spell to your map, and Copy the vJASS Trigger change the SPELL_ID global into the Raw Code of the Copied spell.
//Second: If you want to have more damage or heal then just increase the amount of returned in the Damage Function or the Heal Function
//That's it, or should be it... If you get a Problem then just send me a Private massage on The Hive...
//ohh... and if this thing Sucks then i'm sorry...
//---------------------------------------------------------
scope HolyExpl initializer Init
//-----------------Setup Start--------------------------
globals
private constant integer SPELL_ID = 'A000'
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC
private constant damagetype D_TYPE = DAMAGE_TYPE_NORMAL
private constant string EFFECT = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
private constant string EFFECT2 = "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl"
private constant string EFFECT3 = "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl"
endglobals
private function Damage takes integer level returns real
return level * 50.
endfunction
private function Heal takes integer level returns real
return level * 25.
endfunction
private function Loopdam takes integer level returns real
return level * 35.
endfunction
private function Target takes unit target returns boolean
return (GetWidgetLife(target) > 0.405) and (IsUnitType(target, UNIT_TYPE_STRUCTURE) == false) and (IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitType(target, UNIT_TYPE_MECHANICAL) == false)
endfunction
//-----------------Setup End----------------------------
private function Pick takes nothing returns boolean
return Target(GetFilterUnit())
endfunction
globals
private boolexpr b
private group groups = CreateGroup()
private group loopgroup = CreateGroup()
endglobals
private function c takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function a takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer loopsec = 0
local integer level = GetUnitAbilityLevel(caster, SPELL_ID)
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local real xRandom = GetRandomReal(x-250, x+250)
local real yRandom = GetRandomReal(y-250, y+250)
local real xEffect1 = xRandom+50
local real yEffect1 = yRandom-50
local real xEffect2 = xRandom-50
local real yEffect2 = yRandom+50
local real xEffect3 = xRandom-50
local real yEffect3 = yRandom-50
local real xEffect4 = xRandom+50
local real yEffect4 = yRandom+50
local unit target
call DestroyEffect(AddSpecialEffect(EFFECT, xRandom, yRandom))
call DestroyEffect(AddSpecialEffect(EFFECT, xEffect1, yEffect1))
call DestroyEffect(AddSpecialEffect(EFFECT, xEffect2, yEffect2))
call DestroyEffect(AddSpecialEffect(EFFECT, xEffect3, yEffect3))
call DestroyEffect(AddSpecialEffect(EFFECT, xEffect4, yEffect4))
call GroupEnumUnitsInRange(groups, xRandom, yRandom, 250., b)
loop
set target=FirstOfGroup(groups)
exitwhen target==null
call UnitDamageTarget(caster, target, Damage(level), true, false, A_TYPE, D_TYPE, null)
call GroupRemoveUnit(groups,target)
endloop
loop
set yRandom = GetRandomReal(y-250, y+250)
set xRandom = GetRandomReal(x-250, x+250)
exitwhen loopsec == 10
call TriggerSleepAction(0.10)
call DestroyEffect(AddSpecialEffect(EFFECT2, xRandom, yRandom))
call DestroyEffect(AddSpecialEffect(EFFECT3, xRandom, yRandom))
call GroupEnumUnitsInRange(loopgroup, xRandom, yRandom, 125., null)
set target = FirstOfGroup(loopgroup)
if IsUnitAlly(target, GetOwningPlayer(caster)) then
call SetWidgetLife(target, GetWidgetLife(target) + Heal(level))
else
call UnitDamageTarget(caster, target, Loopdam(level), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, null)
endif
set target = null
set loopsec = loopsec + 1
call GroupClear(loopgroup)
endloop
set loopsec = 0
set caster = null
set target = null
call GroupClear(groups)
endfunction
private function Init takes nothing returns nothing
local trigger Holy = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Holy, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(Holy, function a)
call TriggerAddCondition(Holy, Condition(function c))
set b = Condition( function Pick)
//preloading Effects
call Preload(EFFECT)
call Preload(EFFECT2)
call Preload(EFFECT3)
//preloading the spell
set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'hpea', 0,0,0)
call UnitAddAbility(bj_lastCreatedUnit, SPELL_ID)
call RemoveUnit(bj_lastCreatedUnit)
endfunction
endscope