evolve
商店/共享库

blink_land

Where a point jump lands for the point it is aimed at: dota's rule in one function.

hunnyc0 个脚本在用
支持源码公开
在脚本中使用
pack.json
"requires": { "blink_land": "^1.0" }
你的 lua
local blink_land = require("lib/blink_land")

玩家无需安装:脚本会自动带上库,取范围内的任一版本。发布前可在开发会话中修改 scripts/lib/blink_land/ 来试验。

API
介绍

lib/blink_land

Where a point jump lands for the point it is aimed at: dota's rule in one function. The ready-blink mark (theme/zones through utea/blink_range) and the aim preview (hud/lib/aim) both draw from it.

local BL = require("lib/blink_land")
local p, kind = BL.land(ability, hero_pos, cursor)
aim kind lands
inside the cast range (plus SLACK 1 for float noise) in on the point
past it, OVERSHOOT (every blink dagger, anti-mage, queen of pain) edge at the cast range along the aim
past it, no OVERSHOOT (fallen sky) walk on the point, after a walk in
under min_blink_range min pushed out to it

The daggers' kv still carries blink_range_clamp (960, arcane 1120), but 7.39 removed the overshoot penalty and the lib does not read it. Live check 2026-11-30, lab, Anti-Mage 25 with item_blink, distance the hero moved:

cast aim distance moved
item_blink, synthetic order 1210, 1300, 1600, 2200 (x2), 5000 1200 each
item_blink, real click on the slot and the ground ~4000 (x2) 1200 each
item_blink, synthetic order 800 800
antimage_blink lvl 4 700 / 2000 / 120 700 / 1100 / 200
call what
land_xy(fx, fy, ax, ay, range, over, min) the rule on numbers: landing x, y, kind
reach(ab) live cast_range() (bonuses folded in), OVERSHOOT, min range
land(ab, from, aim) land_xy on a live ability, a Vector with the aim's z

Offline test: tools\lua\lua.exe scripts\lib\blink_land\selftest.lua.

源码

1.0.0 版本的代码,即客户端拿到的内容。包内字节码由这些文件编译而来。

init.lua64 行
-- lib/blink_land: where a point jump really lands for the point it is aimed at, the one copy of
-- dota's rule. the ready-blink mark and the aim preview draw it (#1153).
--
-- dota's rule, measured live 2026-11-30 (item_blink, antimage_blink; synthetic order and a real click):
--   inside the cast range       lands on the point
--   past it, OVERSHOOT          lands at the cast range along the aim (every blink dagger since 7.39,
--                               anti-mage, queen of pain). the kv still carries blink_range_clamp 960 /
--                               1120: dead, the dagger lands at 1200
--   past it, no OVERSHOOT       walks in first, then lands on the point (fallen sky)
--   under min_blink_range       pushed out to it (anti-mage)
--
--   local BL = require("lib/blink_land")
--   local p, kind = BL.land(ability, from, aim)   -- kind: in | edge | walk | min
local B = {}

B.OVERSHOOT = 274877906944
B.SLACK = 1               -- an aim on the ring with float noise past it is still inside

local sqrt = math.sqrt

-- pure: from, aim as numbers; range, over (OVERSHOOT), min. returns the landing x, y and its kind
function B.land_xy(fx, fy, ax, ay, range, over, min_r)
    local dx, dy = ax - fx, ay - fy
    local d = sqrt(dx * dx + dy * dy)
    if d < 1e-3 then return fx, fy, "in" end
    local ux, uy = dx / d, dy / d
    if min_r and min_r > 0 and d < min_r then return fx + ux * min_r, fy + uy * min_r, "min" end
    if not range or range <= 0 or d <= range + B.SLACK then return ax, ay, "in" end
    if not over then return ax, ay, "walk" end
    return fx + ux * range, fy + uy * range, "edge"
end

local function call(e, m, ...)
    local f = e and e[m]
    if not f then return nil end
    local ok, v = pcall(f, e, ...)
    if ok then return v end
    return nil
end

-- the live numbers: cast range with its bonuses folded in (e:cast_range), OVERSHOOT, min_blink_range
function B.reach(ab)
    local range = tonumber(call(ab, "cast_range")) or 0
    local min_r = tonumber(call(ab, "special", "min_blink_range")) or 0
    local over = call(ab, "has_behavior", B.OVERSHOOT) == true
    return range, over, min_r > 0 and min_r or nil
end

local function xy(p)
    if p.x ~= nil then return p.x, p.y, p.z end
    return p:GetX(), p:GetY(), p:GetZ()
end

-- landing of ability from `from` aimed at `aim` (vectors), on the aim's z
function B.land(ab, from, aim)
    local fx, fy = xy(from)
    local ax, ay, az = xy(aim)
    local range, over, min_r = B.reach(ab)
    local x, y, kind = B.land_xy(fx, fy, ax, ay, range, over, min_r)
    return Vector(x, y, az or 0), kind
end

return B
pack.json2 行
{ "kind": "lib", "version": "1.0.0" }
更新日志

这个作品没有版本说明。

使用它的脚本

还没有已发布的脚本需要它。

该作者的其他作品

该作者的其他作品

lotus

作者 hunnyc

The lotus pools: how many lotuses each holds and when the next one grows.

pack.json
"requires": { "lotus": "^1.0" }
你的 lua
local lotus = require("lib/lotus")
0 个脚本在用还没有已发布的版本

order_watch

作者 hunnyc

Watches the orders our scripts send and reports three invariants as a red line with the module names (#1184):

pack.json
"requires": { "order_watch": "^1.0" }
你的 lua
local order_watch = require("lib/order_watch")
0 个脚本在用v1.0.0

order_class

作者 hunnyc

The class an order carries into `hk_order` (#1103): reaction, chain, window, background, owner.

pack.json
"requires": { "order_class": "^1.0" }
你的 lua
local order_class = require("lib/order_class")
0 个脚本在用v1.0.0