function LightningBolt_Conds takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction
//===================================================
function LB_InstantKill_Conds takes nothing returns boolean
local integer level = GetUnitAbilityLevel(GetTriggerUnit(),'A002')
local real chance
if level == 1 then
set chance = 0
elseif level == 2 then
set chance = 0
elseif level == 3 then
set chance = 0
elseif level == 4 then
set chance = 0.5
elseif level == 5 then
set chance = 1
endif
return GetRandomReal(1, 100) <= chance
endfunction
//===================================================
function LB_DoubleDamage_Conds takes nothing returns boolean
local integer level = GetUnitAbilityLevel(GetTriggerUnit(),'A002')
local real chance
if level == 1 then
set chance = 0
elseif level == 2 then
set chance = 4
elseif level == 3 then
set chance = 6
elseif level == 4 then
set chance = 8
elseif level == 5 then
set chance = 10
endif
return GetRandomReal(1, 100) <= chance
endfunction
//===================================================
function LB_DoNothing_Conds takes nothing returns boolean
local integer level = GetUnitAbilityLevel(GetTriggerUnit(),'A002')
local real chance
if level == 1 then
set chance = 0
elseif level == 2 then
set chance = 0
elseif level == 3 then
set chance = 0.25
elseif level == 4 then
set chance = 0.5
elseif level == 5 then
set chance = 1
endif
return GetRandomReal(1, 100) <= chance
endfunction
//===================================================
function LightningBolt_Acts takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local unit dummy = CreateUnit( GetOwningPlayer(caster), 'h000', GetUnitX(target), GetUnitY(target), 0)
local integer damage = 75 * GetUnitAbilityLevel(caster, 'A002')
local texttag t = CreateTextTag()
local effect enor
local real randDistance = GetRandomReal(8, 160)
local real randAngle = GetRandomReal(0, 360)
local location m = Location( GetUnitX(target) + randDistance * Cos(randAngle), GetUnitY(target) + randDistance * Sin(randAngle))
if GetUnitAbilityLevel(caster, 'A002') == 1 then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 1)
call SetUnitAbilityLevel(dummy, 'A001', 1)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call DestroyEffect(enor)
elseif GetUnitAbilityLevel(caster, 'A002') == 2 then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 2)
call SetUnitAbilityLevel(dummy, 'A001', 2)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
if LB_DoubleDamage_Conds() == true then
call UnitDamageTarget(caster, target, 2 * damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call SetTextTagText(t, "Doubled", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 80, 80, 255, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call DestroyEffect(enor)
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
else
call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
endif
call DestroyEffect(enor)
elseif GetUnitAbilityLevel(caster, 'A002') == 3 then
if LB_DoubleDamage_Conds() == false and LB_DoNothing_Conds() == true then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoubleDamage_Conds() == true and LB_DoNothing_Conds() == false then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 3)
call SetUnitAbilityLevel(dummy, 'A001', 3)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitDamageTarget(caster, target, 2 * damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call SetTextTagText(t, "Doubled", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 80, 80, 255, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoubleDamage_Conds() == false and LB_DoNothing_Conds() == false then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 3)
call SetUnitAbilityLevel(dummy, 'A001', 3)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call DestroyEffect(enor)
elseif LB_DoubleDamage_Conds() == true and LB_DoNothing_Conds() == true then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
endif
elseif GetUnitAbilityLevel(caster, 'A002') == 4 then
if LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call KillUnit(target)
call SetTextTagText(t, "Fried", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 250, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 4)
call SetUnitAbilityLevel(dummy, 'A001', 4)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitDamageTarget(caster, target, 2 * damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call SetTextTagText(t, "Doubled", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 80, 80, 255, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call KillUnit(target)
call SetTextTagText(t, "Fried", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 250, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 4)
call SetUnitAbilityLevel(dummy, 'A001', 4)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call DestroyEffect(enor)
endif
elseif GetUnitAbilityLevel(caster, 'A002') == 5 then
if LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == true and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectLoc("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", m)
call SetTextTagText(t, "Missed", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 0, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call KillUnit(target)
call SetTextTagText(t, "Fried", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 250, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == true and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 5)
call SetUnitAbilityLevel(dummy, 'A001', 5)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitDamageTarget(caster, target, 2 * damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call SetTextTagText(t, "Doubled", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 80, 80, 255, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == true then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call KillUnit(target)
call SetTextTagText(t, "Fried", .023 )
call SetTextTagPosUnit( t, caster, 0 )
call SetTextTagColor(t, 255, 250, 0, 255 )
call SetTextTagPermanent(t, false)
call SetTextTagVelocity( t, 0, .0277 )
call TriggerSleepAction(2.00)
call DestroyTextTag(t)
call DestroyEffect(enor)
elseif LB_DoNothing_Conds() == false and LB_DoubleDamage_Conds() == false and LB_InstantKill_Conds() == false then
set enor = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", target, "origin")
call UnitAddAbility(dummy, 'A000')
call UnitAddAbility(dummy, 'A001')
call SetUnitAbilityLevel(dummy, 'A000', 5)
call SetUnitAbilityLevel(dummy, 'A001', 5)
call IssueTargetOrder(dummy, "thunderbolt", target)
call TriggerSleepAction(0.5)
call IssueTargetOrder(dummy, "slow", target)
call UnitApplyTimedLife(dummy, 'BTLF', 2)
call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call DestroyEffect(enor)
endif
endif
call RemoveLocation(m)
set m = null
set caster = null
set target = null
set dummy = null
set t = null
set enor = null
endfunction
//===========================================================================
function InitTrig_Lightning_Bolt takes nothing returns nothing
local trigger LightningBolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( LightningBolt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( LightningBolt, Condition( function LightningBolt_Conds ) )
call TriggerAddAction( LightningBolt, function LightningBolt_Acts )
set LightningBolt = null
endfunction