Name | Type | is_array | initial_value |
UnitGroup_ESC | group | No |
//TESH.scrollpos=182
//TESH.alwaysfold=0
//**********************************
//* *
//* W A T E R W A V E *
//* v1.2 *
//* *
//* By: Ribenamania *
//* *
//****************************
scope Water initializer init
globals
//***************************************************************************************
//* These are variables that can be manipulate to have various effects of the spell *
//***************************************************************************************
//* FollowCaster - Do the waves centered at the caster every time boolean *
//* WaveTimesLevel - Do the wave's time multiple with level boolean *
//* WaveIntervalLevel - Do the wave's interval multiple with level boolean *
//* WaveIntervalUp - Do the wave's interval go up or down [true - up] [false - down] *
//* DummyNumberLevel - Do the wave's dummynumber multiple with level boolean *
//* KnockbackLevel - Do the wave's knockback multiple with level boolean *
//* WaveDamageLevel - Do the wave's damage multiple with level boolean *
//* SpellRawCode - Raw Code of The Spell *
//* DummyRawCode - Raw Code of The Dummy *
//* WaveTimes - Times of Wave *
//* WaveInterval - Interval Between Wave Times *
//* DummyNumber - Numbers of Waves/Dummies Summoned Out *
//* Knockback - Distance of Knockback *
//* WaveDamage - Damage per TimeOut of Wave [Per Level] *
//* WaveRadius - Radius of Wave Hit Units *
//* Timeout - Timer's Time Out [Controls the speed of the wave *
//* CasterSFX - The Special Effect of Caster When Spell Was Started *
//* SFX - The Special Effect When A Unit Has Been Hit *
//***************************************************************************
private constant boolean FollowCaster = true
private constant boolean WaveTimesLevel = true
private constant boolean WaveIntervalLevel = true
private constant boolean WaveIntervalUp = false
private constant boolean DummyNumberLevel = true
private constant boolean KnockbackLevel = true
private constant boolean WaveDamageLevel = true
private constant integer SpellRawCode = 'A000'
private constant integer DummyRawCode = 'n000'
private constant real WaveTimes = 1.00
private constant real DummyNumber = 2.00
private constant real WaveInterval = 2.00
private constant real Knockback = 1.00
private constant real WaveDamage = 3.00
private constant real WaveRadius = 90.00
private constant real TimeOut = 0.02
private constant string CasterSFX = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl"
private constant string SFX = "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl"
//************************************************************
//* These are variables that cannot be manipulate *
//**********************************************************
private constant group WaterGroup = CreateGroup()
private constant timer tim = CreateTimer()
private integer total = 0
private integer array water
private unit wave = null
endglobals
private struct Water_Data
unit s
endstruct
//*******************************************************
//* Spell Starts Here *
//*****************************************************
private function Update takes nothing returns nothing
local unit u
local unit enum
local Water_Data wd
local integer i = total - 1
local real level
local real knockang
local real x
local real y
local real ang
local real Knock = Knockback
local real Damage = WaveDamage
loop
exitwhen i < 0
set wd = water[i]
set u = wd.s
set wave = u
if GetWidgetLife(u) < .405 then
call wd.destroy()
set total = total - 1
if total < 0 then
call PauseTimer(tim)
set total = 0
else
set water[i] = water[total]
endif
else
set ang = GetUnitFacing(u)
set x = GetUnitX(u) + 5 * Cos(ang * bj_DEGTORAD)
set y = GetUnitY(u) + 5 * Sin(ang * bj_DEGTORAD)
call SetUnitPosition(u, x, y)
call GroupEnumUnitsInRange(WaterGroup, x, y, WaveRadius, null)
set enum = FirstOfGroup(WaterGroup)
loop
exitwhen enum == null
set level = I2R(GetUnitAbilityLevel(wave, 'Avul'))
set x = GetUnitX(enum)
set y = GetUnitY(enum)
set knockang = bj_RADTODEG * Atan2(y - GetUnitY(wave), x - GetUnitX(wave))
if KnockbackLevel == true then
set Knock = Knockback * level
endif
if WaveDamageLevel == true then
set Damage = WaveDamage * level
endif
set x = x + Knock * Cos(knockang * bj_DEGTORAD)
set y = y + Knock * Sin(knockang * bj_DEGTORAD)
if ( GetWidgetLife(enum) > .405 == true and IsUnitEnemy(enum, GetOwningPlayer(wave))) then
call UnitDamageTarget(wave, enum, Damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
if IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) == false then
call SetUnitPosition(enum, x, y)
endif
call DestroyEffect(AddSpecialEffect(SFX, x, y))
endif
call GroupRemoveUnit(WaterGroup, enum)
set enum = null
set enum = FirstOfGroup(WaterGroup)
endloop
endif
set wave = null
set i = i - 1
endloop
set u = null
endfunction
private function Trig_Suiton_Suishouha_Actions takes nothing returns nothing
local Water_Data wd
local unit caster = GetTriggerUnit()
local real casterlevel = I2R(GetUnitAbilityLevel(caster, SpellRawCode))
local real angle = 360.00 / DummyNumber
local real cx = GetUnitX(caster)
local real cy = GetUnitY(caster)
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local integer i = 1
local integer loopi = 1
local real DummyNum = DummyNumber
local real WaveTime = WaveTimes
local real WaveInter = WaveInterval
if DummyNumberLevel == true then
set DummyNum = DummyNumber * casterlevel
endif
if WaveTimesLevel == true then
set WaveTime = WaveTimes * casterlevel
endif
if WaveIntervalLevel == true then
if WaveIntervalUp == false then
set WaveInter = WaveInterval / casterlevel
else
set WaveInter = WaveInterval * casterlevel
endif
endif
loop
exitwhen loopi > WaveTime
loop
exitwhen i > DummyNum
set wd = Water_Data.create()
if FollowCaster == true then
set x = GetUnitX(caster) + 90 * Cos((GetUnitFacing(caster) + angle) * bj_DEGTORAD)
set y = GetUnitY(caster) + 90 * Sin((GetUnitFacing(caster) + angle) * bj_DEGTORAD)
else
set x = cx + 90 * Cos((GetUnitFacing(caster) + angle) * bj_DEGTORAD)
set y = cy + 90 * Sin((GetUnitFacing(caster) + angle) * bj_DEGTORAD)
endif
set wd.s = CreateUnit(GetOwningPlayer(caster), DummyRawCode, x, y, (GetUnitFacing(caster) + angle))
call SetUnitAbilityLevel(wd.s, 'Avul', GetUnitAbilityLevel(caster, SpellRawCode))
set water[total] = wd
set total = total + 1
set angle = angle + 360.00 / DummyNum
set i = i + 1
endloop
if FollowCaster == true then
call DestroyEffect(AddSpecialEffect(CasterSFX, GetUnitX(caster), GetUnitY(caster)))
else
call DestroyEffect(AddSpecialEffect(CasterSFX, cx, cy))
endif
if total == R2I(DummyNum) then
call TimerStart(tim, TimeOut, true, function Update)
endif
set angle = 360.00 / DummyNum
set i = 1
call TriggerSleepAction(WaveInter)
set loopi = loopi + 1
endloop
set caster = null
endfunction
private function Trig_Suiton_Suishouha_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SpellRawCode
endfunction
//===========================================================================
private function init takes nothing returns nothing
local integer index = 0
call Preload(CasterSFX)
call Preload(SFX)
set gg_trg_Suiton_Suishouha =CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Suiton_Suishouha, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_Suiton_Suishouha, Condition(function Trig_Suiton_Suishouha_Conditions))
call TriggerAddAction( gg_trg_Suiton_Suishouha, function Trig_Suiton_Suishouha_Actions )
endfunction
endscope