function Trig_Pepper_Breath_Cast_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A001' ) ) then
return false
endif
return true
endfunction
function Trig_Pepper_Breath_Loop_Func001Func010002003001 takes nothing returns boolean
local unit caster = GetTriggerUnit()
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster)) == true )
endfunction
function Trig_Pepper_Breath_Loop_Func001Func010002003002 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Pepper_Breath_Loop_Func001Func010002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Pepper_Breath_Loop_Func001Func010002003001(), Trig_Pepper_Breath_Loop_Func001Func010002003002() )
endfunction
function Trig_Pepper_Breath_Loop_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target
local real angle = GetUnitFacing(missle)
local real mr = 750.00
local location mpoint
local location mmpoint
local group units
local integer damage = ((GetUnitAbilityLevel(caster, 'A001') * 50))
if ( not ( cr < mr ) ) then
set cr = ( cr + ( mr / 25.00) )
set mpoint = GetUnitLoc(missile)
set mmpoint = PolarProjectionBJ(mpoint, ( mr / 25.00 ), angle)
call SetUnitPositionLoc( missile, mmpoint )
if ( not ( IsTerrainPathableBJ(mmpoint, PATHING_TYPE_WALKABILITY) == true ) ) then
call DestroyTimer(move)
call KillUnit( missile )
set missile = null
set caster = null
else
endif
set units = GetUnitsInRangeOfLocMatching(90.00, mmpoint, Condition(function Trig_Pepper_Breath_Loop_Func001Func010002003))
set target = GroupPickRandomUnit(units)
if ( not ( target != null ) ) then
call UnitDamageTargetBJ( caster, target, damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call KnockbackTarget(target, angle, 200, 20, false)
call DestroyTimer(move)
call KillUnit( missile )
set missile = null
set caster = null
else
endif
set target = null
call GroupClear( units )
call RemoveLocation(mpoint)
call RemoveLocation(mmpoint)
else
call DestroyTimer(move)
call KillUnit( missile )
set missile = null
set caster = null
endif
endfunction
function Trig_Pepper_Breath_Cast_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local unit missle
local real angle
local real cr = 0.00
local location cpoint = GetUnitLoc(caster)
local location tpoint
local location mpoint
local timer move = CreateTimer()
if ( not ( target == null ) ) then
set tpoint = GetSpellTargetLoc()
else
set tpoint = GetUnitLoc(target)
set target = null
endif
set mpoint = PolarProjectionBJ(cpoint, 50.00, AngleBetweenPoints(cpoint, tpoint))
set angle = AngleBetweenPoints(cpoint, tpoint)
call CreateNUnitsAtLoc( 1, 'n000', GetOwningPlayer(caster), mpoint, angle)
set missile = GetLastCreatedUnit()
call RemoveLocation(cpoint)
call RemoveLocation(tpoint)
call RemoveLocation(mpoint)
call TimerStart(move, 0.03, true, function Trig_Pepper_Breath_Loop_Actions)
endfunction
//===========================================================================
function InitTrig_Pepper_Breath_Cast takes nothing returns nothing
local trigger Pepper_Breath_Cast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Pepper_Breath_Cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Pepper_Breath_Cast, Condition( function Trig_Pepper_Breath_Cast_Conditions ) )
call TriggerAddAction( Pepper_Breath_Cast, function Trig_Pepper_Breath_Cast_Actions )
endfunction