function Missile_Effects takes nothing returns nothing
local unit missile = udg_TempUnit
local unit attacker = udg_MS_dmg_source_ex[udg_MS_index[3]]
local unit target = udg_TempUnitTarget
local integer effectId = udg_MS_effect_type_ex[udg_MS_index[3]]
local integer i
local real r
local location l1
local location l2
if (GetUnitTypeId(missile) != 'e000' and GetUnitTypeId(missile) != 'e001') then
//call DisplayTextToForce(GetPlayersAll(), "Missile is bugged!")
//Either the missile is destroyed or the missile variable refers to a different unit.
return//Stop running.
endif
if (GetUnitName(attacker) == "") then
//call DisplayTextToForce(GetPlayersAll(), "No attacker!")
//Attacker is either a dummy (which has no name according to the dummy rules) or the attacker doesn't refer to an existing unit.
//If the attacker is dead, it still has a name.
return//Stop running.
endif
if (GetUnitName(target) == "") then
//call DisplayTextToForce(GetPlayersAll(), "No target!")
//Target is either a dummy (which has no name according to the dummy rules) or the target doesn't refer to an existing unit.
return//Stop running.
endif
if (GetUnitState(target, UNIT_STATE_LIFE) == 0) then
//The target has no health so it is dead
//This system also collides with dead units (in my map) so... yea you can figure.
//In my map I deal with dead units differently because I want to use dead units as well.
return//Stop running.
endif
if (effectId == 0) then
//Do nothing
return//Stop running.
elseif (effectId == 1) then//Nidalee's Javelin Toss
set i = GetUnitAbilityLevel(attacker, 'A000')//Level of the ability A000 (Javelin Toss)
set l1 = GetUnitLoc(attacker)
set l2 = GetUnitLoc(target)
set r = DistanceBetweenPoints(l1, l2)
call RemoveLocation(l1)
call RemoveLocation(l2)
//This part is the calculation of the current Javelin Toss according to the LoL Wiki
if (r > 1300) then
set r = 1300
endif
set r = r - 525
if (r < 0) then
set r = 0
endif
set r = 1 + 0.02 * (r/7.75)
//End of the calculations
//The AP scaling is removed though.
call UnitDamageTarget(attacker, target, (25 + 25*i) * r, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call RemoveUnit(missile)//Removes the missile. This defines the difference between Nidalee's Javelin Toss and Ezreal's Ult for example
return//Stop running.
elseif (effectId == 2) then//Another Spell
set i = GetUnitAbilityLevel(attacker, 'A001')//Level of the ability A000 (Another Spell)
call DealDamage(attacker, target, 200 + 75*i, 0.8, 1)
return//Stop running.
endif
endfunction
//===========================================================================
function InitTrig_Missile_Effects takes nothing returns nothing
set gg_trg_Missile_Effects = CreateTrigger()
call TriggerAddAction(gg_trg_Missile_Effects, function Missile_Effects)
endfunction