function Trig_Bolt_Spell_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03H' ) ) then
return false
endif
return true
endfunction
function Trig_Bolt_Spell_Func013002003001 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction
function Trig_Bolt_Spell_Func013002003002001 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction
function Trig_Bolt_Spell_Func013002003002002 takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction
function Trig_Bolt_Spell_Func013002003002 takes nothing returns boolean
return GetBooleanAnd( Trig_Bolt_Spell_Func013002003002001(), Trig_Bolt_Spell_Func013002003002002() )
endfunction
function Trig_Bolt_Spell_Func013002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Bolt_Spell_Func013002003001(), Trig_Bolt_Spell_Func013002003002() )
endfunction
function Trig_Bolt_Spell_Func018Func001C takes nothing returns boolean
if ( not ( CountUnitsInGroup(udg_EL_Damage_Group) < 2 ) ) then
return false
endif
return true
endfunction
function Trig_Bolt_Spell_Func018A takes nothing returns nothing
if ( Trig_Bolt_Spell_Func018Func001C() ) then
call UnitDamageTargetBJ( udg_EL_Caster, GetEnumUnit(), ( udg_EL_Total_Damage * 1.50 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
else
call UnitDamageTargetBJ( udg_EL_Caster, GetEnumUnit(), ( udg_EL_Total_Damage / I2R(CountUnitsInGroup(udg_EL_Damage_Group)) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
endif
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_Bolt_Spell_Func020Func004002003001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Bolt_Spell_Func020Func004002003002 takes nothing returns boolean
return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), udg_EL_Owner) == true )
endfunction
function Trig_Bolt_Spell_Func020Func004002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Bolt_Spell_Func020Func004002003001(), Trig_Bolt_Spell_Func020Func004002003002() )
endfunction
function Trig_Bolt_Spell_Func020Func005Func001001 takes nothing returns boolean
return ( IsUnitDeadBJ(GetEnumUnit()) == true )
endfunction
function Trig_Bolt_Spell_Func020Func005A takes nothing returns nothing
if ( Trig_Bolt_Spell_Func020Func005Func001001() ) then
call GroupRemoveUnitSimple( GetEnumUnit(), udg_EL_Seek_Group )
else
call DoNothing( )
endif
endfunction
function Trig_Bolt_Spell_Actions takes nothing returns nothing
set udg_EL_Caster = GetTriggerUnit()
set udg_EL_Owner = GetOwningPlayer(udg_EL_Caster)
set udg_EL_Targeted_Location = GetSpellTargetLoc()
set udg_EL_Ability_Level = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), udg_EL_Caster)
set udg_EL_Dummy_Ability_Ligtning = 'A00G'
set udg_EL_Base_Number_of_Ligtnings = 2
set udg_EL_Total_Number_of_Ligtnings = ( udg_EL_Base_Number_of_Ligtnings * udg_EL_Ability_Level )
set udg_EL_Seek_Area_of_Effect = 500.00
set udg_EL_Damage_Area_of_Effect = 275.00
set udg_EL_Base_Damage = 100.00
set udg_EL_Total_Damage = ( udg_EL_Base_Damage * I2R(udg_EL_Ability_Level) )
set udg_EL_Damage_Group = GetUnitsInRangeOfLocMatching(udg_EL_Damage_Area_of_Effect, udg_EL_Targeted_Location, Condition(function Trig_Bolt_Spell_Func013002003))
call AddSpecialEffectLocBJ( udg_EL_Targeted_Location, "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call AddSpecialEffectLocBJ( udg_EL_Targeted_Location, "Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call ForGroupBJ( udg_EL_Damage_Group, function Trig_Bolt_Spell_Func018A )
call DestroyGroup(udg_EL_Damage_Group)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = udg_EL_Total_Number_of_Ligtnings
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_EL_Loop_Location = PolarProjectionBJ(udg_EL_Targeted_Location, 5.00, ( 360.00 / I2R(GetForLoopIndexA()) ))
call AddSpecialEffectLocBJ( udg_EL_Loop_Location, "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
set udg_EL_Seek_Group = GetUnitsInRangeOfLocMatching(udg_EL_Seek_Area_of_Effect, udg_EL_Targeted_Location, Condition(function Trig_Bolt_Spell_Func020Func004002003))
call ForGroupBJ( udg_EL_Seek_Group, function Trig_Bolt_Spell_Func020Func005A )
set udg_EL_Seek_Unit = GroupPickRandomUnit(udg_EL_Seek_Group)
call CreateNUnitsAtLoc( 1, 'h008', udg_EL_Owner, udg_EL_Loop_Location, bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 1.50, 'BTLF', GetLastCreatedUnit() )
call UnitAddAbilityBJ( udg_EL_Dummy_Ability_Ligtning, GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( udg_EL_Dummy_Ability_Ligtning, GetLastCreatedUnit(), udg_EL_Ability_Level )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "chainlightning", udg_EL_Seek_Unit )
call DestroyGroup(udg_EL_Seek_Group)
call RemoveLocation(udg_EL_Loop_Location)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(udg_EL_Targeted_Location)
endfunction
//===========================================================================
function InitTrig_Bolt_Spell takes nothing returns nothing
set gg_trg_Bolt_Spell = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bolt_Spell, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Bolt_Spell, Condition( function Trig_Bolt_Spell_Conditions ) )
call TriggerAddAction( gg_trg_Bolt_Spell, function Trig_Bolt_Spell_Actions )
endfunction