1
Warcraft III Spells and Systems / Death Carrier
« on: June 19, 2013, 09:01:21 AM »
|
Death Carrier
By moyack. 2009.
Requires: Check related topics
Description:
A deadly mark moves randomly over the enemies in an area of effect, jumping 5 times over them before exploding and dealing damage to the nearest enemies to the explosion.
Level 1 - The explosion deals 100 damage.
Level 2 - The explosion deals 170 damage.
Level 3 - The explosion deals 240 damage.
How to install:
- Open the test map.
- Add TimerUtils to your map if you haven't it installed. (Could it be possible??).
- Copy the trigger, the ability and the effect used in this spell into you map.
- Voila!! spell installed.
Code: jass [Select]
- // Death Carrier (hmm probably the name is not the best but meh...)
- // By moyack. 2009.
- // Made for the spell contest No 13 (for the bad luck maybe??)
- // Requires TimerUtils.
- library DeathCarrier initializer init requires TimerUtils
- // Configuration part...
- globals
- private constant integer SpellID = 'A000'
- private constant real dt = 0.5 //
- endglobals
- private constant function Damage takes integer lvl returns real
- return 100. + 70. * (lvl - 1)
- endfunction
- private constant function AOE takes integer lvl returns real
- return 500. // I left it in this way so it can be configurable to a variable area
- endfunction
- private constant function Jumps takes integer lvl returns integer
- return 5 // sets the number of times the maks jumps on units before explode
- endfunction
- // end configuration part...
- private function GetEnemies takes nothing returns boolean
- return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(bj_groupRandomCurrentPick))
- endfunction
- private struct data
- group g
- unit c
- integer counter = 0
- private method onDestroy takes nothing returns nothing
- call GroupClear(.g)
- set .c = null
- endmethod
- private static method PickRandomUnit takes nothing returns nothing
- set bj_groupRandomConsidered = bj_groupRandomConsidered + 1
- set bj_groupRandomCurrentPick = GetEnumUnit()
- endif
- endmethod
- private static method DealDamage takes nothing returns nothing
- call UnitDamageTarget(GetEnumUnit(), GetEnumUnit(), Damage(GetUnitAbilityLevel(bj_groupRandomCurrentPick, SpellID)), true, true, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_ROCK_HEAVY_BASH)
- call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SpellID, EFFECT_TYPE_SPECIAL, 2), GetEnumUnit(), "chest"))
- endmethod
- static method effect takes nothing returns nothing
- local data d = data( GetTimerData(GetExpiredTimer()) )
- local real x
- local real y
- set bj_groupRandomConsidered = 0
- set bj_groupRandomCurrentPick = null
- if bj_groupRandomCurrentPick == null then
- call d.destroy()
- call ReleaseTimer(GetExpiredTimer())
- return
- endif
- call DestroyEffect(AddSpellEffectTargetById(SpellID, EFFECT_TYPE_SPECIAL, bj_groupRandomCurrentPick, "overhead"))
- set d.counter = d.counter + 1
- set x = GetUnitX(bj_groupRandomCurrentPick)
- set y = GetUnitY(bj_groupRandomCurrentPick)
- call GroupClear(d.g)
- set bj_groupRandomCurrentPick = d.c
- call GroupEnumUnitsInRange(d.g, x, y, 0.5*AOE(GetUnitAbilityLevel(d.c, SpellID)), Condition(function GetEnemies))
- call d.destroy()
- call ReleaseTimer(GetExpiredTimer())
- else
- call UnitDamageTarget(d.c, bj_groupRandomCurrentPick, GetRandomReal(0, Damage(GetUnitAbilityLevel(d.c, SpellID))), true, false, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_ROCK_HEAVY_BASH)
- endif
- endmethod
- static method Start takes unit c, location l returns nothing
- local data d = data.allocate()
- local timer t = NewTimer()
- if d.g == null then
- set d.g = CreateGroup()
- endif
- set d.c = c
- set bj_groupRandomCurrentPick = c
- call GroupEnumUnitsInRangeOfLoc(d.g, l, AOE(GetUnitAbilityLevel(c, SpellID)), Condition(function GetEnemies))
- call SetTimerData(t, integer(d))
- call RemoveLocation(l)
- set l = null
- set t = null
- endmethod
- endstruct
- private function Conditions takes nothing returns boolean
- return GetSpellAbilityId() == SpellID
- endfunction
- private function Actions takes nothing returns nothing
- endfunction
- //===========================================================================
- private function init takes nothing returns nothing
- call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
- set t = null
- endfunction
- endlibrary
Changelog:
(2/2/2009) Removed the timer from the struct, now it's managed via local variables.
(11/3/2009) Now every jump deals a random damage to the jumping unit.