Thunder Storm
vJASS: Yes.
GUI/JASS: JASS.
Systems: None.
Import difficulty: Easy-Medium.
"The caster makes multiple lightnings from above, and when they hit a target, the target is damaged. If a target dies while being hit by a lightning, a lightning ripples out from the location of the dying unit, to a random unit in a AoE."
Screenshot:
Code:
Enjoy..
vJASS: Yes.
GUI/JASS: JASS.
Systems: None.
Import difficulty: Easy-Medium.
"The caster makes multiple lightnings from above, and when they hit a target, the target is damaged. If a target dies while being hit by a lightning, a lightning ripples out from the location of the dying unit, to a random unit in a AoE."
Screenshot:
Code:
JASS:
scope ThunderStorm initializer init
//**************************************
// Thunder Storm Spell By Vestras *
// *
// Requirements: *
// *
// NewGen v1.5a, the abilities, the *
// dummy. *
// *
// Credit me if using this spell. *
//**************************************
globals
private constant integer ThunderStorm_SpellID = 039;A002039;
// Raw code of the spell.
private constant integer ThunderStorm_DummyID = 039;h000039;
// Raw code of the dummy.
private constant integer ThunderStorm_DummyAbilID = 039;A001039;
// Raw code of the dummy ability.
private constant real ThunderStorm_AoE = 400.0
// The AoE of the spell.
private constant real ThunderStorm_Damage = 50.0
// The Damage of the spell.
private constant real ThunderStorm_Time = 5.0
// The time between each lightning.
private constant real ThunderStorm_Multi = 2.10
// The damage multiplier.
private constant real ThunderStorm_Divide = 3.30
// The damage divider. Current damage is exactly 30.
private constant boolean ThunderStorm_Show = true
// Whether the trigger should show a text message to the player
// if there are no units in range or not.
// Below; Needed by the code, don't touch.
private group ThunderStorm_Group = CreateGroup()
private unit ThunderStorm_Target = null
private unit ThunderStorm_Caster = null
private rect ThunderStorm_Rect = null
endglobals
private constant function ThunderStorm_AttackType takes nothing returns attacktype
return ATTACK_TYPE_NORMAL // The attack type of the damage
endfunction
private constant function ThunderStorm_DamageType takes nothing returns damagetype
return DAMAGE_TYPE_UNIVERSAL // The damage type of the damage
endfunction
private constant function ThunderStorm_WeaponType takes nothing returns weapontype
return WEAPON_TYPE_WHOKNOWS // The weapon type of the damage
endfunction
private constant function ThunderStorm_DamageMulti takes nothing returns real
return ThunderStorm_Damage * ThunderStorm_Multi / ThunderStorm_Divide
// The defined damage times the defined multiplier divided by the defined divider.
endfunction
private function ThunderStorm_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ThunderStorm_SpellID
endfunction
private function ThunderStorm_BefCond2 takes nothing returns nothing
if ( CountUnitsInGroup(ThunderStorm_Group) <= 0 ) then
call DisplayTextToPlayer(GetOwningPlayer(ThunderStorm_Caster), 0.5, -0.5, "|cffffcc00No units to Strike.|r")
if gg_snd_Error != null then
call StartSound(gg_snd_Error)
endif
endif
endfunction
private function ThunderStorm_ConditionsDies takes nothing returns boolean
return ( IsUnitInGroup(GetDyingUnit(), ThunderStorm_Group) == true )
endfunction
private function ThunderStorm_GroupDies takes nothing returns nothing
local unit u = GetEnumUnit()
local location l = GetUnitLoc(u)
local unit d = CreateUnitAtLoc(GetOwningPlayer(ThunderStorm_Caster), ThunderStorm_DummyID, l, 0)
call SetUnitFlyHeight(d, 0.00, 100000000.0)
call TriggerSleepAction(0.01)
call UnitAddAbility(d, ThunderStorm_DummyAbilID)
call IssueTargetOrderById(d, 852587, u) //forkedlightning
call UnitApplyTimedLife(d, 039;BTLF039;, 0.75)
call UnitDamageTarget(ThunderStorm_Caster, u, ThunderStorm_DamageMulti(), false, true, ThunderStorm_AttackType(), ThunderStorm_DamageType(), ThunderStorm_WeaponType())
set d=null
set u=null
call RemoveLocation(l)
set l = null
endfunction
private function ThunderStorm_ActionsDies takes nothing returns nothing
local unit d = GetDyingUnit()
local unit u = ThunderStorm_Caster
local group g2 = GetRandomSubGroup(1, ThunderStorm_Group)
call ForGroup(g2, function ThunderStorm_GroupDies)
if ( ThunderStorm_Show == true ) then
call ThunderStorm_BefCond2()
endif
endfunction
private function initdies takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(t, Condition(function ThunderStorm_ConditionsDies))
call TriggerAddAction(t, function ThunderStorm_ActionsDies)
endfunction
private function ThunderStorm_GroupActions takes nothing returns nothing
local unit u = GetEnumUnit()
local unit d = CreateUnit(GetOwningPlayer(ThunderStorm_Caster), ThunderStorm_DummyID, GetRandomReal(GetRectMinX(ThunderStorm_Rect),GetRectMaxX(ThunderStorm_Rect)), GetRandomReal(GetRectMinY(ThunderStorm_Rect),GetRectMaxY(ThunderStorm_Rect)), 0)
call UnitAddAbility(d, ThunderStorm_DummyAbilID)
call IssueTargetOrderById(d, 852587, u) //forkedlightning
call UnitApplyTimedLife(d, 039;BTLF039;, 0.75)
call UnitDamageTarget(ThunderStorm_Caster, u, ThunderStorm_DamageMulti(), false, true, ThunderStorm_AttackType(), ThunderStorm_DamageType(), ThunderStorm_WeaponType())
set d=null
set u=null
call initdies()
endfunction
private function ThunderStorm_GroupConditions takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true ) and ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false ) and ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(ThunderStorm_Caster)) == true )
endfunction
private function ThunderStorm_BefCond1 takes nothing returns nothing
if ( CountUnitsInGroup(ThunderStorm_Group) <= 0 ) then
call DisplayTextToPlayer(GetOwningPlayer(ThunderStorm_Caster), 0.5, -0.5, "|cffffcc00No units to Strike.|r")
if gg_snd_Error != null then
call StartSound(gg_snd_Error)
endif
endif
endfunction
private function ThunderStorm_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local location l = GetUnitLoc(u)
set ThunderStorm_Caster = u
set ThunderStorm_Rect = Rect( x - ThunderStorm_AoE*0.5, y - ThunderStorm_AoE*0.5, x + ThunderStorm_AoE*0.5, y + ThunderStorm_AoE*0.5 )
set ThunderStorm_Group = GetUnitsInRangeOfLocMatching(ThunderStorm_AoE, l, Condition(function ThunderStorm_GroupConditions))
call ForGroup(ThunderStorm_Group, function ThunderStorm_GroupActions)
if ( ThunderStorm_Show == true ) then
call ThunderStorm_BefCond1()
endif
call GroupClear(ThunderStorm_Group)
call RemoveRect(ThunderStorm_Rect)
set u = null
endfunction
//================================================== =========================
private function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function ThunderStorm_Conditions))
call TriggerAddAction(t, function ThunderStorm_Actions)
endfunction
endscope
Enjoy..