//-------------------------------------------------------------------------------------------
// Tremor v1.0 by scorpion182
//
//
//
//
//
//-------------------------------------------------------------------------------------------
library Tremor initializer init requires xecollider, xedamage, ParabolicMovement, GroupUtils, BoundSentinel
//-----Calibration Section-------------------------------------------------------------------
globals
private constant integer SPELL_ID='A000' //ability rawcode
private constant string PATH="Abilities\\Spells\\Other\\Volcano\\VolcanoMissile.mdl" //missile fx path
private constant string DUST_FX="Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl"
private constant string STOMP_FX="Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
private constant integer MISSILE_COUNT=10 //missile count
private constant real SPEED=300. //missile speed
private constant real MAX_HEIGHT=500. //maximum height
private constant real COLLISION_SIZE=125. //collision size each missile
private constant real SCALE=1.0 //missile scale
private constant real DISTANCE_INC=SPEED*XE_ANIMATION_PERIOD //distance increment
endglobals
//set damage
private constant function GetDamage takes integer lvl returns real
return lvl*50.
endfunction
//set area of effect
private constant function GetAoE takes integer lvl returns real
return 500.+lvl*0.
endfunction
//damage filter
private function DamageOptions takes xedamage spellDamage returns nothing
set spellDamage.dtype=DAMAGE_TYPE_UNIVERSAL
set spellDamage.atype=ATTACK_TYPE_NORMAL
set spellDamage.exception=UNIT_TYPE_STRUCTURE
set spellDamage.visibleOnly=true
set spellDamage.damageAllies=false //damage allies if true
endfunction
//-------------------------------------------------------------------------------------------
globals
private xedamage xed
private boolexpr b
endglobals
private function IsUnitAlive takes nothing returns boolean
return not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) or GetUnitTypeId(GetFilterUnit()) != 0
endfunction
private struct data extends xecollider
unit caster
real pos
integer level
private method loopControl takes nothing returns nothing
if .pos>0 then
set .pos=.pos-DISTANCE_INC
set .z=ParabolaZ(MAX_HEIGHT,GetAoE(.level),.pos)
else
call GroupEnumUnitsInRange(ENUM_GROUP,.x,.y,COLLISION_SIZE,b)
call xed.damageGroup(caster,ENUM_GROUP,GetDamage(.level))
call .flash(DUST_FX)
call .terminate()
endif
endmethod
endstruct
//spell action
private function SpellEffect takes nothing returns nothing
local data d
local real x
local real y
local unit caster
local integer i=0
if GetSpellAbilityId() == SPELL_ID then
set caster=GetSpellAbilityUnit()
set x=GetUnitX(caster)
set y=GetUnitY(caster)
call DestroyEffect(AddSpecialEffectTarget(STOMP_FX,caster,"origin"))
//create missiles
loop
exitwhen i==MISSILE_COUNT
set d=data.create(x,y,i*(2*bj_PI)/MISSILE_COUNT)
set d.fxpath=PATH
set d.speed=SPEED
set d.scale=SCALE
set d.level=GetUnitAbilityLevel(caster,SPELL_ID)
set d.expirationTime=200000
set d.caster=caster
set d.pos=GetAoE(d.level)
set i=i+1
endloop
endif
set caster=null
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t,function SpellEffect)
//init xedamage
set xed=xedamage.create()
call DamageOptions(xed)
set b=Condition(function IsUnitAlive)
//preload fx
call Preload(STOMP_FX)
call Preload(PATH)
call Preload(DUST_FX)
endfunction
endlibrary