NetherHawk
New Member
- Reaction score
- 26
well this spellpack's theme is dodging incoming damage
based on: Dota's dispersion, aphotic shield and backtrack
Jass,MUI and leakless i hope
uses NewGen and local handle vars
i nearly killed all my brain cells doing these spells -- i wanna credit GalS~ and cr4xzZz for answering my queries =D enjoy
copy all the triggers and u will be fine, not forgeting the units, abilities, buffs.
overall : medium import difficulty
Dispersion
Backtrack
any bugs, leaks or comments feel free to tell me =]
-- Fixed FX bug, Damage bug with Aphotic Shield
@Daxtreme: i have learnt my lesson, only 3 here =[
based on: Dota's dispersion, aphotic shield and backtrack
Jass,MUI and leakless i hope
uses NewGen and local handle vars
i nearly killed all my brain cells doing these spells -- i wanna credit GalS~ and cr4xzZz for answering my queries =D enjoy
copy all the triggers and u will be fine, not forgeting the units, abilities, buffs.
overall : medium import difficulty
Dispersion
JASS:
globals
real Min_Dispersion_Damage_Ratio
endglobals
function DispersionFilter takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction
function DispersionDamage takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit p = GetEnumUnit()
local unit d = CreateUnit(GetOwningPlayer(u),039;h002039;,GetUnitX(u),GetUnitY(u),0)
local real r = Min_Dispersion_Damage_Ratio
call UnitAddAbility(d,039;A004039;)
call IssueTargetOrderById(d,OrderId("thunderbolt"),p) // for the minor stun effect
call UnitApplyTimedLife(d,039;BTLF039;,1.00)
call UnitDamageTarget(u,p,r,true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)// this is the dispersion damage
endfunction
function DispersionMain takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit d
local group g = CreateGroup()
local real r = GetEventDamage()
local boolexpr b = Condition(function DispersionFilter)
local real r1 = GetUnitState(u,UNIT_STATE_LIFE)
set Min_Dispersion_Damage_Ratio = ReturnMinReal(r,r1)// checks that damage being dealt will not exceed her life
call DelayedDamageCheck(u,r)
call GroupEnumUnitsInRange(g,GetUnitX(u),GetUnitY(u),400,b)
call ForGroup(g,function DispersionDamage)
call DestroyGroup(g)
call DestroyBoolExpr(b)
set d = CreateUnit(GetOwningPlayer(u),039;h001039;,GetUnitX(u),GetUnitY(u),0)
call SetUnitPathing(d,false)
call SetUnitInvulnerable(d,true)
call SetUnitAnimation(d,"Death") // just the purple effects
call PolledWait(2)
call RemoveUnit(d)
endfunction
function Dispersion_Chance takes nothing returns boolean
return GetRandomInt(1,100)<=GetUnitAbilityLevel(GetTriggerUnit(),039;A002039;)*10 and GetEventDamage()>5
endfunction // you can adjust the chance for dispersion to occur here
function Dispersion_Jass_Actions takes nothing returns nothing
local trigger tr2 = CreateTrigger()
local unit u = GetTriggerUnit()
call TriggerRegisterUnitEvent(tr2,u,EVENT_UNIT_DAMAGED)
call TriggerAddCondition(tr2,Condition(function Dispersion_Chance))
call TriggerAddAction(tr2,function DispersionMain)
endfunction
function Dispersion_Jass_Conditions takes nothing returns boolean
return GetLearnedSkill()==039;A002039;and GetUnitAbilityLevel(GetTriggerUnit(),039;A002039;)==1 and IsUnitIllusion(GetTriggerUnit())==false
endfunction
//===========================================================================
function InitTrig_Dispersion_Jass takes nothing returns nothing
local trigger tr1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(tr1,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(tr1,Condition(function Dispersion_Jass_Conditions))
call TriggerAddAction(tr1,function Dispersion_Jass_Actions)
endfunction
Backtrack
JASS:
function Trig_Backtrack_Jass_Conditions takes nothing returns boolean
return GetLearnedSkill()==039;A003039;and IsUnitIllusion(GetTriggerUnit())==false
endfunction
function Backtrack_Main takes nothing returns nothing
local unit u = GetTriggerUnit()
local real r = GetEventDamage()
if(r > 0)then
if(GetRandomInt(1,100)<=(5 + (5*GetUnitAbilityLevel(u,039;A003039;))))then // chance to backtrack
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE)+ r)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\WingedSerpentMissile\\WingedSerpentMissile.mdl",u,"hand,left"))
endif
endif
endfunction
function Trig_Backtrack_Jass_Actions takes nothing returns nothing
local trigger tr
if GetUnitAbilityLevel(GetTriggerUnit(),039;A003039;)==1 then
set tr=CreateTrigger()
call TriggerRegisterUnitEvent(tr,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call TriggerAddAction(tr,function Backtrack_Main)
endif
endfunction
//===========================================================================
function InitTrig_Backtrack_Jass takes nothing returns nothing
set gg_trg_Backtrack_Jass=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Backtrack_Jass,EVENT_PLAYER_HERO_SKILL)
call TriggerAddCondition(gg_trg_Backtrack_Jass,Condition(function Trig_Backtrack_Jass_Conditions))
call TriggerAddAction(gg_trg_Backtrack_Jass,function Trig_Backtrack_Jass_Actions)
endfunction
JASS:
globals
unit AphoticShield_Caster
endglobals
function Aphotic_Spell takes nothing returns boolean
return GetSpellAbilityId()==039;A005039;
endfunction
function Aphotic_Filter takes nothing returns boolean
if(IsUnitAlly(GetFilterUnit(),GetOwningPlayer(AphoticShield_Caster)))then
return false
endif
if(IsUnitType(GetFilterUnit(),UNIT_TYPE_MAGIC_IMMUNE)) then
return false
endif
if(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE))then
return false
endif
return true
endfunction
function Aphotic_Lightning takes nothing returns nothing
call UnitDamageTargetBJ(AphoticShield_Caster,GetEnumUnit(),(75 + (50*I2R(GetUnitAbilityLevel(AphoticShield_Caster,039;A005039;)))),ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl",GetEnumUnit(),"chest") )
endfunction
function Aphotic_ForkedLightning takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit ux = GetHandleUnit(t,"AphoticTarget")
local location l = GetUnitLoc(ux)
local group g1 = GetUnitsInRangeOfLocMatching(600,l,Condition(function Aphotic_Filter))
call ForGroup(g1, function Aphotic_Lightning)
call DestroyGroup(g1)
call RemoveLocation(l)
call PauseTimer(t)
call DestroyTimer(t)
set ux = null
set t = null
set l = null
endfunction
function Aphotic_Heal takes nothing returns nothing
local trigger tr = GetTriggeringTrigger()
local real r = GetHandleReal(tr,"AphoticLife")
local unit ux = GetTriggerUnit()
local timer t = CreateTimer()
if(r<GetEventDamage())then
call DelayedDamageCheck(GetTriggerUnit(),r)
call DestroyEffect(GetHandleFX(tr,"AphoticFX"))
call DisableTrigger(tr)
call SetHandleBoolean(tr,"AphoticDone",true)
set AphoticShield_Caster = GetHandleUnit(tr,"AphoticOwner")
call SetHandleHandle(t,"AphoticTarget",ux)
call TimerStart(t,0,true,function Aphotic_ForkedLightning)
elseif(GetEventDamage()>0)then
call DelayedDamageCheck(GetTriggerUnit(),GetEventDamage())
call SetHandleReal(tr,"AphoticLife",r-GetEventDamage())
endif
endfunction
function Aphotic_Setting takes nothing returns nothing
local trigger tr = CreateTrigger()
local triggeraction ta = TriggerAddAction(tr,function Aphotic_Heal)
local effect fx = AddSpecialEffectTarget("Defensive Barrier big.mdx",GetSpellTargetUnit(),"chest")
call TriggerRegisterUnitEvent(tr,GetSpellTargetUnit(),EVENT_UNIT_DAMAGED)
call UnitRemoveBuffsBJ(1,GetSpellTargetUnit())
call SetHandleReal(tr,"AphoticLife",75 + I2R(50*GetUnitAbilityLevel(GetTriggerUnit(),039;A005039;) ) )
call SetHandleHandle(tr,"AphoticFX",fx)
call SetHandleHandle(tr,"AphoticCaster",GetTriggerUnit())
call SetHandleBoolean(tr,"AphoticDone",false)
call PolledWait(20)
if(GetHandleBoolean(tr,"AphoticDone")==true)then
call DestroyEffect(fx)
endif
call DestroyEffect(fx)
call FlushHandleLocals(tr)
call TriggerRemoveAction(tr,ta)
call DestroyTrigger(tr)
endfunction
function InitTrig_Aphotic_Shield_Jass takes nothing returns nothing
set gg_trg_Aphotic_Shield_Jass=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Aphotic_Shield_Jass,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Aphotic_Shield_Jass,Condition(function Aphotic_Spell))
call TriggerAddAction(gg_trg_Aphotic_Shield_Jass,function Aphotic_Setting)
endfunction
any bugs, leaks or comments feel free to tell me =]
-- Fixed FX bug, Damage bug with Aphotic Shield
@Daxtreme: i have learnt my lesson, only 3 here =[