kingkingyyk3
Visitor (Welcome to the Jungle, Baby!)
- Reaction score
- 216
This spell is from DotA.. I have recoded it..
Description : Using his mighty axe, the Tauren Chieften rends the very earth itself, sending a jagged crack under the feet of his enemies. After several seconds the earth implodes, sending his foes tumbling inwards. Any unit caught in the implosion will take damage based on their maximum life and have their speed slowed for a short time. Implodes after 3 seconds. Deals 35% of a unit's maximum HP and slow it.
Let's take a peek to it :
GUI/Jass/vJass -> Hints : Jasshelper is needed.
MUI/MPI -> Hints : Use structs to store data, MUI or not MUI?
Leak/Lag -> Classic case.
The icon is also included!
JASS:
/*
Earth Splitter v2.0.1
by kingking
Description : Using his mighty axe, the Tauren Chieften rends the very earth itself,
sending a jagged crack under the feet of his enemies. After several seconds the earth
implodes, sending his foes tumbling inwards. Any unit caught in the implosion will
take damage based on their maximum life and have their speed slowed for a short time.
Implodes after certain seconds. Deals part of a unit's maximum HP and slow it.
Implement Instruction :
1) Copy this trigger and required libraries to your map.
2) Make sure you implemented the required libraries correctly.
3) Copy the abilities, "Earth Splitter" and "Earth Splitter slow" to your map.
4) Copy the Earth Splitter buff.
5) Set the buff in Earth Splitter Slow.
6) Adjust the constant globals to correct rawcodes.
7) You may tweak constant functions if you want.
8) Enjoy it!
Requires :
GTrigger Event System
KeyTimers 2
DummyCaster
Jasshelper v0.A.2.A or later
*/
scope EarthSplitter
/* <= Constant globals => */
globals
private constant integer ABIL_ID = 039;A000039;
//Ability's Id
private constant integer SLOW_ID = 039;A001039;
//Slow's id
private constant string GROUND_EFFECT = "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl"
//Effect on the ground when unit are damaged and slowed
private constant real GROUND_EFFECT_DURATION = 2.
//Duration of efect.
private constant string SMASH_EFFECT = "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl"
//Effect of projectile.
private constant attacktype DAMAGE_A_ATTACK_TYPE = ATTACK_TYPE_MELEE
private constant damagetype DAMAGE_A_DAMAGE_TYPE = DAMAGE_TYPE_NORMAL
private constant weapontype DAMAGE_A_WEAPON_TYPE = null
private constant attacktype DAMAGE_B_ATTACK_TYPE = ATTACK_TYPE_MAGIC
private constant damagetype DAMAGE_B_DAMAGE_TYPE = DAMAGE_TYPE_MAGIC
private constant weapontype DAMAGE_B_WEAPON_TYPE = null
endglobals
private keyword d
//============== <= Constants => ========\\
private function FilterUnit takes unit whichUnit returns boolean
return IsUnitEnemy(whichUnit,d.owner) and IsUnitType(whichUnit,UNIT_TYPE_DEAD) == false and IsUnitType(whichUnit,UNIT_TYPE_STRUCTURE) == false
endfunction
private function DamageFactor takes integer lvl returns real
return 10. * lvl + 15.
endfunction
private function WaveSpeed takes integer lvl returns real
return .2
endfunction
private function WaveRange takes integer lvl returns real
return 150.
endfunction
private function NumberOfWaves takes integer lvl returns integer
return 12
endfunction
private function Delay takes integer lvl returns real
return 1.
endfunction
private function AoE takes integer lvl returns real
return 250.
endfunction
private function DamageAFrac takes integer lvl returns real
return 50.
endfunction
private function DamageBFrac takes integer lvl returns real
return 50.
endfunction
// <= NO MORE TOUCHING => \\
private keyword Data
globals
private constant integer MaxWave = 13
private constant group enumGroup = CreateGroup()
private conditionfunc cf
private Data d
endglobals
private struct Data
unit caster
player owner
real array eX [MaxWave]
real array eY [MaxWave]
effect array eff [MaxWave]
real cx
real cy
real tx
real ty
real angle
real array cos [3]
real array sin [3]
integer tick
group g
real fraction
integer level
real waveRange
real halfRange
integer waveCount
real aoe
real dmgAFrac
real dmgBFrac
private static method End takes nothing returns boolean
local thistype this = KT_GetData()
loop
call DestroyEffect(.eff[.tick])
set .eff[.tick] = null
set .tick = .tick + 1
exitwhen .tick > .waveCount
endloop
call GroupClear(.g)
call .destroy()
return true
endmethod
private static method Damage takes nothing returns boolean
local unit u = GetFilterUnit()
local real maxHP
if not IsUnitInGroup(u,d.g) and FilterUnit(u) then
call UnitAddAbility(DUMMY,SLOW_ID)
call SetUnitAbilityLevel(DUMMY,SLOW_ID,d.level)
call IssueTargetOrder(DUMMY,"slow",u)
call UnitRemoveAbility(DUMMY,SLOW_ID)
set maxHP = GetUnitState(u,UNIT_STATE_MAX_LIFE) * d.fraction
call UnitDamageTarget(d.caster,u,d.dmgAFrac * maxHP,false,false,DAMAGE_A_ATTACK_TYPE,DAMAGE_A_DAMAGE_TYPE,DAMAGE_A_WEAPON_TYPE)
call UnitDamageTarget(d.caster,u,d.dmgBFrac * maxHP,false,false,DAMAGE_B_ATTACK_TYPE,DAMAGE_B_DAMAGE_TYPE,DAMAGE_B_WEAPON_TYPE)
call SetUnitX(u,d.eX[d.tick])
call SetUnitY(u,d.eY[d.tick])
call GroupAddUnit(d.g,u)
endif
set u = null
return false
endmethod
private static method Periodic2 takes nothing returns boolean
local thistype this = KT_GetData()
if .g == null then
set .g = CreateGroup()
endif
loop
set .eff[.tick] = AddSpecialEffect(GROUND_EFFECT,.eX[.tick],.eY[.tick])
set d = this
call GroupEnumUnitsInRange(enumGroup,.eX[.tick],.eY[.tick],.aoe,cf)
set .tick = .tick - 1
exitwhen .tick == -1
endloop
call KT_Add(function thistype.End,this,GROUND_EFFECT_DURATION)
return true
endmethod
private static method Periodic takes nothing returns boolean
local thistype this = KT_GetData()
if .tick < .waveCount then
set .tick = .tick + 1
set .cx = .cx + .cos[0]
set .cy = .cy + .sin[0]
set .eX[.tick] = .cx
set .eY[.tick] = .cy
call DestroyEffect(AddSpecialEffect(SMASH_EFFECT,.cx + .cos[0],.cy + .sin[0]))
call DestroyEffect(AddSpecialEffect(SMASH_EFFECT,.cx + .cos[1],.cy + .sin[1]))
call DestroyEffect(AddSpecialEffect(SMASH_EFFECT,.cx + .cos[2],.cy + .sin[2]))
return false
endif
call KT_Add(function thistype.Periodic2, this, Delay(.level))
return true
endmethod
private static method Act takes nothing returns boolean
local thistype this = thistype.allocate()
set .caster = GetTriggerUnit()
set .tx = GetSpellTargetX()
set .ty = GetSpellTargetY()
set .cx = GetUnitX(.caster)
set .cy = GetUnitY(.caster)
set .angle = Atan2(.ty - .cy,.tx - .cx)
set .level = GetUnitAbilityLevel(.caster,ABIL_ID)
set .waveRange = WaveRange(.level)
set .halfRange = .waveRange / 2.
set .cos[0] = .waveRange * Cos(.angle)
set .sin[0] = .waveRange * Sin(.angle)
set .cos[1] = .halfRange * Cos(.angle + 2.1)
set .sin[1] = .halfRange * Sin(.angle + 2.1)
set .cos[2] = .halfRange * Cos(.angle - 2.1)
set .sin[2] = .halfRange * Sin(.angle - 2.1)
set .waveCount = NumberOfWaves(.level)
set .aoe = AoE(.level)
set .fraction = DamageFactor(.level) * .01
set .owner = GetOwningPlayer(.caster)
set .dmgAFrac = DamageAFrac(.level) * .01
set .dmgBFrac = DamageBFrac(.level) * .01
set .tick = 0
call KT_Add(function thistype.Periodic,this,WaveSpeed(.level))
return false
endmethod
private static method onInit takes nothing returns nothing
call GT_AddStartsEffectAction(function thistype.Act,ABIL_ID)
set cf = Condition(function thistype.Damage)
endmethod
endstruct
endscope
/////////////////////////////////End/////////////////////////////////////////////////////////
Description : Using his mighty axe, the Tauren Chieften rends the very earth itself, sending a jagged crack under the feet of his enemies. After several seconds the earth implodes, sending his foes tumbling inwards. Any unit caught in the implosion will take damage based on their maximum life and have their speed slowed for a short time. Implodes after 3 seconds. Deals 35% of a unit's maximum HP and slow it.
Let's take a peek to it :
GUI/Jass/vJass -> Hints : Jasshelper is needed.
MUI/MPI -> Hints : Use structs to store data, MUI or not MUI?
Leak/Lag -> Classic case.
The icon is also included!