GetTriggerUnit-
DogEntrepreneur
- Reaction score
- 129
You don't need integer2real()?
Most of the time, you don't. But there's an obscure bug where in some circumstances your map will utterly fail to load (in WC3, not the editor lol) because of it. So if that ever happens, you know what it possibly is.You don't need integer2real()?
if value > 0.00 then
if value < 11. then//550(522 is maximum movement speed) * HAPPENNING
//(Prevent dealing massive damage when unit teleports to other place or being slided!)
set dmg = value / d.percent
else
set dmg = 0.
endif
call UnitDamageTarget(d.caster, d.target, dmg, true, false, AT, DT, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect(BLOOD_EFFECT, d.nx, d.ny))
endif
I'm pretty sure in DotA it does do damage based on Blink/Teleport distance?
So if you Blink/Teleport while Ruptured you take a lot of damage.
If not for teleport, I'm 99% sure it does for Blink.
scope Rupture
globals
private constant integer ABIL_ID = 039;A000039; // Hero ability.
private constant integer ABIL2_ID = 039;A001039; // Dummy ability to place buff.
private constant integer DUMMY_ID = 039;buff039; // Dummy unit.
private constant integer BUFF_ID = 039;B002039; // Buff for dummy ability.
private constant real INTERVAL = 0.02 // Interval for timer.
private constant real THRESHOLD = 200.00 // Threshold for distance.
private constant attacktype A_TYPE = ATTACK_TYPE_CHAOS
private constant damagetype D_TYPE = DAMAGE_TYPE_UNIVERSAL
private constant weapontype W_TYPE = WEAPON_TYPE_WHOKNOWS
private constant string BLOOD_SFX = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"
private constant string BLOOD_POINT = "origin"
private constant string CAST_ORDER = "purge"
endglobals
//---------------------------------------------------------------------\\
private function InitialDamage takes integer lvl returns real
return 50.00 + (100.00 * lvl)
endfunction
private function DamagePercent takes integer lvl returns real
return 0.20 * lvl
endfunction
private function Duration takes integer lvl returns real
return 3.00 + (2.00 * lvl)
endfunction
//---------------------------------------------------------------------\\
// \\
// DO NOT TOUCH PAST THIS POINT UNLESS YOU KNOW WHAT YOUR ARE DOING! \\
// \\
//---------------------------------------------------------------------\\
private struct Data
unit cast = null
unit targ = null
real targx = 0.00
real targy = 0.00
real time = 0.00
real perc = 0.00
integer level = 0
static thistype array D
static integer Total = 0
static timer Timer = null
static method create takes nothing returns thistype
local thistype d = thistype.allocate()
local unit dummy = null
set d.cast = GetTriggerUnit()
set d.targ = GetSpellTargetUnit()
set d.targx = GetUnitX(d.targ)
set d.targy = GetUnitY(d.targ)
set d.level = GetUnitAbilityLevel(d.cast,ABIL_ID)
set d.time = Duration(d.level)
set d.perc = DamagePercent(d.level)
call UnitDamageTarget(d.cast,d.targ,InitialDamage(d.level),false,false,A_TYPE,D_TYPE,W_TYPE)
set dummy = CreateUnit(GetOwningPlayer(d.cast),DUMMY_ID,d.targx,d.targy,0.00)
call UnitAddAbility(dummy,ABIL2_ID)
call SetUnitAbilityLevel(dummy,ABIL2_ID,d.level)
call IssueTargetOrder(dummy,CAST_ORDER,d.targ)
call UnitApplyTimedLife(dummy,039;BTLF039;,1.00)
if .Total == 0 then
call TimerStart(.Timer,INTERVAL,true,function thistype.periodic)
endif
set .D[.Total] = d
set .Total = .Total + 1
set dummy = null
return d
endmethod
static method periodic takes nothing returns nothing
local thistype d = 0
local integer i = 0
local real x = 0.00
local real y = 0.00
local real v = 0.00
loop
exitwhen i >= .Total
set d = .D<i>
if d.time <= 0.00 or GetWidgetLife(d.targ) < 0.406 then
call d.destroy()
set .Total = .Total - 1
set .D<i> = .D[.Total]
set i = i - 1
else
set x = GetUnitX(d.targ)
set y = GetUnitY(d.targ)
set v = SquareRoot((x - d.targx) * (x - d.targx) + (y - d.targy) * (y - d.targy))
if v > THRESHOLD then
set v = 0.00
endif
if v > 1.00 then
call UnitDamageTarget(d.cast,d.targ,d.perc * v,false,false,A_TYPE,D_TYPE,W_TYPE)
if GetRandomInt(0,1) == 0 then
call DestroyEffect(AddSpecialEffectTarget(BLOOD_SFX,d.targ,BLOOD_POINT))
endif
endif
set d.targx = x
set d.targy = y
set d.time = d.time - INTERVAL
endif
set i = i + 1
endloop
if .Total == 0 then
call PauseTimer(.Timer)
endif
endmethod
private method onDestroy takes nothing returns nothing
call UnitRemoveAbility(.targ,BUFF_ID)
set .cast = null
set .targ = null
endmethod
static method conds takes nothing returns boolean
return GetSpellAbilityId() == ABIL_ID
endmethod
static method onInit takes nothing returns nothing
local trigger trig = CreateTrigger()
set .Timer = CreateTimer()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(trig,Condition(function thistype.conds))
call TriggerAddAction(trig,function thistype.create)
endmethod
endstruct
endscope
</i></i>