@qianhaoq/dsh-dota2ai 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -5
- package/lib/client.js +207 -102
- package/lib/index.js +388 -114
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -7166,6 +7166,7 @@ var goals_exports = {};
|
|
|
7166
7166
|
__export(goals_exports, {
|
|
7167
7167
|
HABITS: () => HABITS,
|
|
7168
7168
|
HABIT_KEYS: () => HABIT_KEYS,
|
|
7169
|
+
RETIRED_HABITS: () => RETIRED_HABITS,
|
|
7169
7170
|
evaluateGoal: () => evaluateGoal,
|
|
7170
7171
|
evaluateHabit: () => evaluateHabit,
|
|
7171
7172
|
goalFor: () => goalFor,
|
|
@@ -7293,6 +7294,7 @@ function habitGoal(habit, summary, of = null) {
|
|
|
7293
7294
|
}
|
|
7294
7295
|
function evaluateHabit(goal, summary, minutes) {
|
|
7295
7296
|
const out = (result2, evidence, count) => ({ result: result2, evidence, ...Number.isInteger(count) ? { count } : {} });
|
|
7297
|
+
if (RETIRED_HABITS.includes(goal?.habit)) return out("unknown", t("This goal is no longer counted: deaths with no ally nearby said little about a decision. Pick another goal.", "\u8FD9\u4E2A\u76EE\u6807\u5DF2\u4E0D\u518D\u7EDF\u8BA1\uFF1A\u8EAB\u8FB9\u6709\u6CA1\u6709\u961F\u53CB\u8BF4\u660E\u4E0D\u4E86\u51B3\u7B56\u5BF9\u9519\u3002\u8BF7\u6362\u4E00\u4E2A\u76EE\u6807\u3002", "\u042D\u0442\u0430 \u0446\u0435\u043B\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044F: \u043D\u0430\u043B\u0438\u0447\u0438\u0435 \u0441\u043E\u044E\u0437\u043D\u0438\u043A\u043E\u0432 \u0440\u044F\u0434\u043E\u043C \u043C\u0430\u043B\u043E \u0433\u043E\u0432\u043E\u0440\u0438\u0442 \u043E \u0440\u0435\u0448\u0435\u043D\u0438\u0438. \u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0443\u044E \u0446\u0435\u043B\u044C."));
|
|
7296
7298
|
const h = HABITS[goal?.habit];
|
|
7297
7299
|
if (!h || !Number.isFinite(goal.max) || h.from === "audit" && !(goal.name?.en && goal.name?.zh)) return out("unknown", t("Unknown goal.", "\u65E0\u6CD5\u8BC6\u522B\u7684\u76EE\u6807\u3002", "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0446\u0435\u043B\u044C."));
|
|
7298
7300
|
if (!summary) return out("unknown", t("Needs this game's replay: check the goal or open its replay review.", "\u9700\u8981\u8FD9\u5C40\u7684\u5F55\u50CF\uFF1A\u68C0\u67E5\u76EE\u6807\uFF0C\u6216\u6253\u5F00\u8FD9\u5C40\u7684\u5F55\u50CF\u590D\u76D8\u3002", "\u041D\u0443\u0436\u0435\u043D \u0440\u0435\u043F\u043B\u0435\u0439 \u044D\u0442\u043E\u0439 \u0438\u0433\u0440\u044B: \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0446\u0435\u043B\u044C \u0438\u043B\u0438 \u043E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u043E\u0440 \u0440\u0435\u043F\u043B\u0435\u044F."));
|
|
@@ -7400,7 +7402,7 @@ function evaluateGoal(goal, report, slot, replay = null) {
|
|
|
7400
7402
|
return result("unknown", t("Unknown goal.", "\u65E0\u6CD5\u8BC6\u522B\u7684\u76EE\u6807\u3002", "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0446\u0435\u043B\u044C."));
|
|
7401
7403
|
}
|
|
7402
7404
|
}
|
|
7403
|
-
var t, r12, GAP, clock4, HABITS, HABIT_KEYS, MIN_MINUTES, result;
|
|
7405
|
+
var t, r12, GAP, clock4, HABITS, HABIT_KEYS, RETIRED_HABITS, MIN_MINUTES, result;
|
|
7404
7406
|
var init_goals = __esm({
|
|
7405
7407
|
"lib/coach/goals.js"() {
|
|
7406
7408
|
"use strict";
|
|
@@ -7411,11 +7413,7 @@ var init_goals = __esm({
|
|
|
7411
7413
|
clock4 = (sec) => `${Math.floor(Math.max(0, sec) / 60)}:${String(Math.round(Math.max(0, sec)) % 60).padStart(2, "0")}`;
|
|
7412
7414
|
HABITS = {
|
|
7413
7415
|
low_health: { from: "deaths", at: ["deaths_where", "health_below_half_at_window_start"], unsure: "health_at_window_start", label: () => t("deaths that began below half health (12 s before)", "\u6B7B\u524D 12 \u79D2\u5DF2\u4E0D\u5230\u534A\u8840\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0441 \u043C\u0435\u043D\u0435\u0435 \u0447\u0435\u043C \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u043E\u0439 HP (\u0437\u0430 12 \u0441 \u0434\u043E \u0441\u043C\u0435\u0440\u0442\u0438)") },
|
|
7414
|
-
|
|
7415
|
-
// The lone deaths that bought nothing: no ally within 2200, and no enemy hero died within 15 s of it. A lone death
|
|
7416
|
-
// that was traded is not this habit (see the calibration in docs/GAME_UNDERSTANDING.md).
|
|
7417
|
-
alone_not_traded: { from: "deaths", at: ["deaths_where", "no_ally_within_2200_at_death_and_not_traded"], unsure: "allies_at_death", label: () => t("deaths with no ally within 2200 and no enemy hero back within 15 s", "\u8EAB\u8FB9 2200 \u7801\u5185\u6CA1\u6709\u961F\u53CB\u300115 \u79D2\u5185\u4E5F\u6CA1\u6362\u5230\u4EBA\u5934\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432 \u043E\u0434\u0438\u043D\u043E\u0447\u043A\u0443 (\u0431\u0435\u0437 \u0441\u043E\u044E\u0437\u043D\u0438\u043A\u043E\u0432 \u0432 2200) \u0438 \u0431\u0435\u0437 \u0440\u0430\u0437\u043C\u0435\u043D\u0430 \u0437\u0430 15 \u0441") },
|
|
7418
|
-
// The same two, outside the game's fights only: for a hero whose job is to be in them, that is where the habit shows.
|
|
7416
|
+
// Low health, and outnumbered, outside the game's fights only: for a hero whose job is to be in them, that is where the habit shows.
|
|
7419
7417
|
low_health_outside_fights: { from: "deaths", at: ["deaths_where", "health_below_half_at_window_start_outside_fights"], unsure: "health_below_half_at_window_start_outside_fights", label: () => t("deaths outside fights that began below half health (12 s before)", "\u56E2\u6218\u4E4B\u5916\u3001\u6B7B\u524D 12 \u79D2\u5DF2\u4E0D\u5230\u534A\u8840\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432\u043D\u0435 \u0434\u0440\u0430\u043A \u0441 \u043C\u0435\u043D\u0435\u0435 \u0447\u0435\u043C \u043F\u043E\u043B\u043E\u0432\u0438\u043D\u043E\u0439 HP (\u0437\u0430 12 \u0441)") },
|
|
7420
7418
|
outnumbered_outside_fights: { from: "deaths", at: ["deaths_where", "three_or_more_enemy_heroes_dealing_damage_outside_fights"], unsure: "three_or_more_enemy_heroes_dealing_damage_outside_fights", label: () => t("deaths outside fights to three or more enemy heroes", "\u56E2\u6218\u4E4B\u5916\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u56F4\u6740\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0432\u043D\u0435 \u0434\u0440\u0430\u043A \u043E\u0442 \u0442\u0440\u0451\u0445 \u0438 \u0431\u043E\u043B\u0435\u0435 \u0432\u0440\u0430\u0433\u043E\u0432") },
|
|
7421
7419
|
outnumbered: { from: "deaths", at: ["deaths_where", "three_or_more_enemy_heroes_dealing_damage"], unsure: null, label: () => t("deaths to three or more enemy heroes", "\u88AB\u4E09\u4E2A\u4EE5\u4E0A\u654C\u65B9\u82F1\u96C4\u56F4\u6740\u7684\u9635\u4EA1", "\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u043E\u0442 \u0442\u0440\u0451\u0445 \u0438 \u0431\u043E\u043B\u0435\u0435 \u0432\u0440\u0430\u0433\u043E\u0432") },
|
|
@@ -7427,6 +7425,7 @@ var init_goals = __esm({
|
|
|
7427
7425
|
died_holding: { from: "audit", at: ["deaths_with_it_ready_and_not_cast_total"], unsure: null, label: (n) => t(`deaths with ${n.en} ready and not cast`, `${n.zh}\u5C31\u7EEA\u5374\u6CA1\u653E\u7684\u9635\u4EA1`, `\u0441\u043C\u0435\u0440\u0442\u0435\u0439 \u0441 \u0433\u043E\u0442\u043E\u0432\u044B\u043C, \u043D\u043E \u043D\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u043D\u044B\u043C ${n.en}`) }
|
|
7428
7426
|
};
|
|
7429
7427
|
HABIT_KEYS = Object.keys(HABITS);
|
|
7428
|
+
RETIRED_HABITS = Object.freeze(["alone", "alone_not_traded"]);
|
|
7430
7429
|
MIN_MINUTES = 10;
|
|
7431
7430
|
result = (r, evidence) => ({ result: r, evidence });
|
|
7432
7431
|
}
|
|
@@ -10783,6 +10782,7 @@ function needHero(trace, hero) {
|
|
|
10783
10782
|
return h < 0 ? { err: fail("unknown_hero", { heroes: heroKeys(trace) }) } : { h, npc: nameId(trace, trace.heroes[h].npc) };
|
|
10784
10783
|
}
|
|
10785
10784
|
var DEATH_TRIGGERED_ABILITIES = /* @__PURE__ */ new Set(["skeleton_king_reincarnation", "undying_ceaseless_dirge"]);
|
|
10785
|
+
var AUTO_TRIGGERED_ACTIVE_ABILITIES = /* @__PURE__ */ new Set(["abaddon_borrowed_time"]);
|
|
10786
10786
|
var NON_CAST_LOGGED_ABILITIES = /* @__PURE__ */ new Set([
|
|
10787
10787
|
"ancient_apparition_chilling_touch",
|
|
10788
10788
|
"bounty_hunter_jinada",
|
|
@@ -10825,10 +10825,52 @@ function castable(trace, h, npc) {
|
|
|
10825
10825
|
const set = /* @__PURE__ */ new Set();
|
|
10826
10826
|
for (const c of trace.casts) if (c[1] === npc) set.add(trace.names[c[2]]);
|
|
10827
10827
|
for (const [k3, e] of Object.entries(trace.abilities[h])) {
|
|
10828
|
-
if (e.mana > 0 && !DEATH_TRIGGERED_ABILITIES.has(k3) && !isNonCastLogged(trace, npc, k3)) set.add(k3);
|
|
10828
|
+
if ((e.mana > 0 || AUTO_TRIGGERED_ACTIVE_ABILITIES.has(k3)) && !DEATH_TRIGGERED_ABILITIES.has(k3) && !isNonCastLogged(trace, npc, k3)) set.add(k3);
|
|
10829
10829
|
}
|
|
10830
10830
|
return set;
|
|
10831
10831
|
}
|
|
10832
|
+
var REFRESHER_ITEMS = /* @__PURE__ */ new Set(["item_refresher", "item_refresher_shard"]);
|
|
10833
|
+
function refresherTimes(trace, npc) {
|
|
10834
|
+
const out = [];
|
|
10835
|
+
for (const u of trace?.item_uses ?? []) {
|
|
10836
|
+
if (u[1] === npc && REFRESHER_ITEMS.has(trace.names?.[u[2]])) out.push(u[0]);
|
|
10837
|
+
}
|
|
10838
|
+
return out;
|
|
10839
|
+
}
|
|
10840
|
+
function cooldownActivations(entry, manualRows, refreshers = []) {
|
|
10841
|
+
if (!Array.isArray(entry?.cd)) return null;
|
|
10842
|
+
const sorted = [...entry.cd].sort((a, b) => a[0] - b[0]);
|
|
10843
|
+
const starts = [];
|
|
10844
|
+
let prev = null;
|
|
10845
|
+
for (let i = 0; i < sorted.length; i += 1) {
|
|
10846
|
+
const curr = sorted[i];
|
|
10847
|
+
const [from, to, init] = curr;
|
|
10848
|
+
if (abilityLevel(entry, from + 0.5) <= 0) continue;
|
|
10849
|
+
const prevRem = prev != null && typeof prev[2] === "number" ? Math.max(0, prev[2] - (from - prev[0])) : 0;
|
|
10850
|
+
const refreshed = refreshers.some((rt) => rt >= from - 2 && rt <= from + 0.5);
|
|
10851
|
+
const isCut = prev != null && from === prev[1] && !refreshed && typeof prev[2] === "number" && typeof init === "number" && prevRem > 2 && init < prevRem - 0.5;
|
|
10852
|
+
prev = curr;
|
|
10853
|
+
if (isCut) continue;
|
|
10854
|
+
starts.push({ t: from, clock: clock3(from), cooldown: typeof init === "number" ? init : Math.round((to - from) * 10) / 10 });
|
|
10855
|
+
}
|
|
10856
|
+
const usedManual = /* @__PURE__ */ new Set();
|
|
10857
|
+
const auto = [];
|
|
10858
|
+
for (const st of starts) {
|
|
10859
|
+
let bestIdx = -1;
|
|
10860
|
+
let bestDt = Infinity;
|
|
10861
|
+
for (let j = 0; j < manualRows.length; j += 1) {
|
|
10862
|
+
if (usedManual.has(j)) continue;
|
|
10863
|
+
const d = Math.abs(manualRows[j][0] - st.t);
|
|
10864
|
+
if (d <= 2 && d < bestDt) {
|
|
10865
|
+
bestDt = d;
|
|
10866
|
+
bestIdx = j;
|
|
10867
|
+
}
|
|
10868
|
+
}
|
|
10869
|
+
if (bestIdx >= 0) usedManual.add(bestIdx);
|
|
10870
|
+
else auto.push(st);
|
|
10871
|
+
}
|
|
10872
|
+
return { auto, allStarts: starts };
|
|
10873
|
+
}
|
|
10832
10874
|
function matchFights(trace) {
|
|
10833
10875
|
return fights(trace);
|
|
10834
10876
|
}
|
|
@@ -11264,6 +11306,16 @@ function nearbyObjectiveFor(trace, h, t6, atPos, allSieges, traceEnd) {
|
|
|
11264
11306
|
}
|
|
11265
11307
|
return unknown || traceEnd == null || t6 + 20 > traceEnd ? null : false;
|
|
11266
11308
|
}
|
|
11309
|
+
function heroNearKnown(trace, j, t6) {
|
|
11310
|
+
const st = stateAt(trace, j, t6);
|
|
11311
|
+
if (st) {
|
|
11312
|
+
const rawAlive = trace.states?.[j]?.alive?.[st.t - trace.t0];
|
|
11313
|
+
if (rawAlive === 0) return true;
|
|
11314
|
+
return rawAlive === 1 && st.x != null && st.y != null;
|
|
11315
|
+
}
|
|
11316
|
+
const k0 = Math.round(t6) - trace.t0;
|
|
11317
|
+
return k0 >= 0 && k0 < trace.n && trace.states?.[j]?.alive?.[k0] === 0;
|
|
11318
|
+
}
|
|
11267
11319
|
function deathContext(trace, args = {}, ctx = {}) {
|
|
11268
11320
|
const view = viewer(trace, ctx);
|
|
11269
11321
|
const { h, npc, err } = needHero(trace, args.hero);
|
|
@@ -11276,38 +11328,45 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11276
11328
|
if (args.index != null && !all[args.index - 1]) return fail("no_such_death", { deaths: all.length });
|
|
11277
11329
|
const pick2 = all.map((d, i) => [d, i + 1]);
|
|
11278
11330
|
const can = castable(trace, h, npc);
|
|
11331
|
+
const autoByAbility = /* @__PURE__ */ new Map();
|
|
11332
|
+
let autoCooldownMissing = false;
|
|
11333
|
+
const myRefreshers = refresherTimes(trace, npc);
|
|
11334
|
+
for (const [k3, e] of Object.entries(trace.abilities?.[h] ?? {})) {
|
|
11335
|
+
if (!AUTO_TRIGGERED_ACTIVE_ABILITIES.has(k3)) continue;
|
|
11336
|
+
const aid = nameId(trace, k3);
|
|
11337
|
+
const manual = aid >= 0 ? trace.casts.filter((c) => c[1] === npc && c[2] === aid).sort((a, b) => a[0] - b[0]) : [];
|
|
11338
|
+
const info = cooldownActivations(e, manual, myRefreshers);
|
|
11339
|
+
if (!info && (e?.levels ?? []).some(([, lv]) => lv > 0)) autoCooldownMissing = true;
|
|
11340
|
+
autoByAbility.set(k3, info);
|
|
11341
|
+
}
|
|
11279
11342
|
const allFights = fights(trace);
|
|
11280
11343
|
const fought = new Set(allFights.flatMap((f) => f.deaths));
|
|
11281
11344
|
const fightInfos = allFights.map((f, fi) => ({ ref: `fight:${fi + 1}`, f, part: fightParticipation(trace, f) }));
|
|
11282
11345
|
const allSieges = Array.isArray(trace.damage) ? sieges(trace) : [];
|
|
11283
|
-
const heroNearKnown = (j, t6) => {
|
|
11284
|
-
const st = stateAt(trace, j, t6);
|
|
11285
|
-
if (st) {
|
|
11286
|
-
const rawAlive = trace.states?.[j]?.alive?.[st.t - trace.t0];
|
|
11287
|
-
if (rawAlive === 0) return true;
|
|
11288
|
-
return rawAlive === 1 && st.x != null && st.y != null;
|
|
11289
|
-
}
|
|
11290
|
-
const k0 = Math.round(t6) - trace.t0;
|
|
11291
|
-
return k0 >= 0 && k0 < trace.n && trace.states?.[j]?.alive?.[k0] === 0;
|
|
11292
|
-
};
|
|
11293
11346
|
const fountain = ownFountain(trace, h, npc);
|
|
11294
11347
|
const hasDamageLog = Array.isArray(trace.damage);
|
|
11295
11348
|
const out = pick2.map(([d, n]) => {
|
|
11296
11349
|
const t6 = d[0];
|
|
11297
11350
|
const from = t6 - window;
|
|
11298
|
-
const
|
|
11351
|
+
const snaps = [...new Set([window, 8, 4, 1].filter((x) => x <= window))].map((back) => {
|
|
11299
11352
|
const { me, allies, enemies } = nearby(trace, h, t6 - back, 2200);
|
|
11300
11353
|
const doing = me ? heroStateAt(trace, h, t6 - back).doing ?? null : null;
|
|
11301
11354
|
return { dt: -back, me: me ? { hp: me.hp, max_hp: me.max_hp, mana: me.mana, ...where(me), doing, to_own_fountain: fountain && me.alive ? dist(me, fountain) : null } : null, allies, enemies };
|
|
11302
11355
|
});
|
|
11356
|
+
const snapshots2 = snaps.map(({ allies: _allies, ...rest }) => rest);
|
|
11303
11357
|
const atDeath = nearby(trace, h, t6, 2200);
|
|
11304
11358
|
const atPos = stateAt(trace, h, t6 - 1);
|
|
11305
|
-
let mostAllies = atDeath.me &&
|
|
11359
|
+
let mostAllies = atDeath.me && snaps.every((x) => x.me) ? Math.max(atDeath.allies.length, ...snaps.map((x) => x.allies.length)) : null;
|
|
11306
11360
|
for (let sec = Math.floor(from); mostAllies != null && sec < t6; sec += 1) {
|
|
11307
11361
|
const at = nearby(trace, h, sec, 2200);
|
|
11308
11362
|
mostAllies = at.me ? Math.max(mostAllies, at.allies.length) : null;
|
|
11309
11363
|
}
|
|
11310
|
-
const abilities = Object.entries(trace.abilities[h]).filter(([k3, e]) => can.has(k3) && abilityLevel(e, from) > 0).map(([k3, e]) => ({
|
|
11364
|
+
const abilities = Object.entries(trace.abilities[h]).filter(([k3, e]) => can.has(k3) && abilityLevel(e, from) > 0).map(([k3, e]) => ({
|
|
11365
|
+
ability: k3,
|
|
11366
|
+
level: abilityLevel(e, from),
|
|
11367
|
+
cooldown_left: AUTO_TRIGGERED_ACTIVE_ABILITIES.has(k3) && !Array.isArray(e?.cd) ? null : cooldownLeft(e, from),
|
|
11368
|
+
mana_cost: manaCost(e, from, t6)
|
|
11369
|
+
}));
|
|
11311
11370
|
const mana = mostMana(trace, h, from, t6);
|
|
11312
11371
|
const noMana = (a) => a.mana_cost != null && mana != null && mana < a.mana_cost;
|
|
11313
11372
|
const items = Object.entries(trace.items[h]).filter(([, e]) => heldAt(e, from)).map(([k3, e]) => ({ item: k3.replace(/^item_/, ""), ...e.cd.length ? { cooldown_left: cooldownLeft(e, from) } : {} }));
|
|
@@ -11350,23 +11409,24 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11350
11409
|
}
|
|
11351
11410
|
for (const m of trace.modifiers) if (m[1] === npc && m[4] === 1 && m[6] !== "i" && inWindow(m[0]) && (disabledAt == null || m[0] < disabledAt)) disabledAt = m[0];
|
|
11352
11411
|
const castNames = new Set(myCasts.map((c) => trace.names[c[2]]));
|
|
11412
|
+
const autoTriggered = [];
|
|
11413
|
+
const triggeredNames = /* @__PURE__ */ new Set();
|
|
11414
|
+
for (const [k3, info] of autoByAbility) {
|
|
11415
|
+
if (!info) continue;
|
|
11416
|
+
for (const st of info.allStarts) {
|
|
11417
|
+
if (st.t >= from && st.t <= t6 + 0.5) triggeredNames.add(k3);
|
|
11418
|
+
}
|
|
11419
|
+
for (const tr2 of info.auto) {
|
|
11420
|
+
if (tr2.t >= from && tr2.t <= t6 + 0.5) autoTriggered.push({ dt: dt(tr2.t), clock: tr2.clock, ability: k3 });
|
|
11421
|
+
}
|
|
11422
|
+
}
|
|
11423
|
+
autoTriggered.sort((a, b) => a.dt - b.dt);
|
|
11353
11424
|
const kKind = killerKind(trace, d[2], h, npc);
|
|
11354
11425
|
const killerOwnSideCreep = kKind === "lane_creep" && myCreepSide.test(trace.names?.[d[2]] ?? "");
|
|
11355
11426
|
const involvesDominatableCreep = kKind === "neutral" || kKind === "lane_creep" || neutralOrCreepDamage;
|
|
11356
11427
|
const possiblePlayerControlledCreep = ownSideCreepDamage || killerOwnSideCreep || involvesDominatableCreep && enemyCouldControlCreep(trace, trace.heroes[h].team, t6);
|
|
11357
11428
|
const nonHeroNoEnemy = !hasDamageLog || kKind == null ? null : !NON_HERO_SUICIDE_KINDS.has(kKind) || attackers.size > 0 || otherUnitDamage ? false : unknownDamageSource || possiblePlayerControlledCreep ? null : true;
|
|
11358
11429
|
const traceEnd = typeof trace.t0 === "number" && typeof trace.n === "number" ? trace.t0 + trace.n - 1 : null;
|
|
11359
|
-
const alliesKnownAtDeath = Boolean(atDeath.me && atDeath.me.x != null && atDeath.me.y != null) && trace.heroes.every((o, j) => j === h || o.team !== trace.heroes[h].team || heroNearKnown(j, t6));
|
|
11360
|
-
const alliesSurvived10s = !alliesKnownAtDeath ? null : (() => {
|
|
11361
|
-
const winStart = Math.min(t6, Math.floor(t6));
|
|
11362
|
-
const survivors = atDeath.allies.map((a) => a.hero).filter((ak) => {
|
|
11363
|
-
const ai = trace.heroes.findIndex((x) => x.key === ak);
|
|
11364
|
-
const anpc = ai >= 0 ? nameId(trace, trace.heroes[ai].npc) : -1;
|
|
11365
|
-
return !real.some((o) => o[1] === anpc && o[0] >= winStart && o[0] <= t6 + 10);
|
|
11366
|
-
});
|
|
11367
|
-
if (survivors.length > 0 && (traceEnd == null || t6 + 10 > traceEnd)) return null;
|
|
11368
|
-
return survivors;
|
|
11369
|
-
})();
|
|
11370
11430
|
const stH = trace.states?.[h];
|
|
11371
11431
|
let windowSampled = Boolean(Array.isArray(trace.controls) && trace.controls[h] && stH?.alive);
|
|
11372
11432
|
for (let sec = Math.floor(from); windowSampled && sec <= Math.floor(t6); sec += 1) {
|
|
@@ -11392,8 +11452,9 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11392
11452
|
snapshots: snapshots2,
|
|
11393
11453
|
at_window_start: { abilities, items },
|
|
11394
11454
|
most_mana_in_window: mana,
|
|
11395
|
-
ready_not_cast: abilities.filter((a) => a.cooldown_left === 0 && !castNames.has(a.ability) && !noMana(a)).map((a) => a.ability),
|
|
11396
|
-
off_cooldown_without_the_mana: abilities.filter((a) => a.cooldown_left === 0 && !castNames.has(a.ability) && noMana(a)).map((a) => a.ability),
|
|
11455
|
+
ready_not_cast: abilities.filter((a) => a.cooldown_left === 0 && !castNames.has(a.ability) && !triggeredNames.has(a.ability) && !noMana(a)).map((a) => a.ability),
|
|
11456
|
+
off_cooldown_without_the_mana: abilities.filter((a) => a.cooldown_left === 0 && !castNames.has(a.ability) && !triggeredNames.has(a.ability) && noMana(a)).map((a) => a.ability),
|
|
11457
|
+
...autoTriggered.length ? { auto_triggered: autoTriggered } : {},
|
|
11397
11458
|
health_share_at_window_start: share(snapshots2[0]?.me),
|
|
11398
11459
|
// How much closer to their own fountain the hero was at the last snapshot than at the window's start: positive
|
|
11399
11460
|
// heading home, negative heading away from it. Null when either distance is unknown. Over 1089 deaths outside
|
|
@@ -11412,10 +11473,6 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11412
11473
|
nearby_objective: nearObj,
|
|
11413
11474
|
// Killed by neutral/tower/Roshan/Tormentor/lane creep with zero enemy hero or summon damage in the window.
|
|
11414
11475
|
non_hero_death_without_enemy_hero_damage: nonHeroNoEnemy,
|
|
11415
|
-
// Null where the hero's own position was not sampled: no ally listed is then unknown, not alone.
|
|
11416
|
-
// "At death" is the moment itself, not the last snapshot a second before: an ally can arrive in that second.
|
|
11417
|
-
allies_within_2200: { at_window_start: snapshots2[0].me ? snapshots2[0].allies.length : null, at_death: atDeath.me ? atDeath.allies.length : null, most_in_any_second: mostAllies },
|
|
11418
|
-
allies_near_who_survived_10s: alliesSurvived10s,
|
|
11419
11476
|
first_hero_damage_dt: firstHero == null ? null : Math.round(firstHero - t6),
|
|
11420
11477
|
// Counted over every damage row of the window, not over the ten largest listed below.
|
|
11421
11478
|
enemy_heroes_dealing_damage: attackers.size,
|
|
@@ -11436,8 +11493,6 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11436
11493
|
const v = heroOfName(trace, o[1]);
|
|
11437
11494
|
return v >= 0 && trace.heroes[v].team !== trace.heroes[h].team && Math.abs(o[0] - t6) <= TRADE_SECONDS;
|
|
11438
11495
|
}),
|
|
11439
|
-
// The allies who were not within 2200 at the death: what the replay shows them doing, where, how far.
|
|
11440
|
-
allies_elsewhere: alliesElsewhere(trace, h, t6, atDeath),
|
|
11441
11496
|
// Observer wards standing within 1600 of where the hero died, each side's. Null: the trace has no ward list.
|
|
11442
11497
|
observers_within_1600: wardsAt(trace, h, atDeath, t6),
|
|
11443
11498
|
// The clock of a buyback after this death, false when none, null when the trace does not record buybacks.
|
|
@@ -11453,8 +11508,7 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11453
11508
|
const myRes = resurrections(trace).filter((r) => r.heroIndex === h).map((r, i) => {
|
|
11454
11509
|
const atRes = nearby(trace, h, r.t, 2200);
|
|
11455
11510
|
const meKnown = Boolean(atRes.me && atRes.me.x != null && atRes.me.y != null);
|
|
11456
|
-
const
|
|
11457
|
-
const enemiesKnown = meKnown && trace.heroes.every((o, j) => o.team === trace.heroes[h].team || heroNearKnown(j, r.t));
|
|
11511
|
+
const enemiesKnown = meKnown && trace.heroes.every((o, j) => o.team === trace.heroes[h].team || heroNearKnown(trace, j, r.t));
|
|
11458
11512
|
const nextIdx = all.findIndex((d) => d[0] > r.t);
|
|
11459
11513
|
const nextReal = nextIdx >= 0 ? all[nextIdx] : null;
|
|
11460
11514
|
const diedSoon = !nextReal ? false : r.revived_at != null ? nextReal[0] - r.revived_at <= 20 ? { ref: `death:${heroKey}:${nextIdx + 1}`, clock: clock3(nextReal[0]), killer: nameOf(trace, nextReal[2]), seconds_after_revive: Math.round((nextReal[0] - r.revived_at) * 10) / 10 } : false : nextReal[0] - r.t <= 20 ? { ref: `death:${heroKey}:${nextIdx + 1}`, clock: clock3(nextReal[0]), killer: nameOf(trace, nextReal[2]), seconds_after_revive: null } : nextReal[0] - r.t <= 27 ? null : false;
|
|
@@ -11469,7 +11523,6 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11469
11523
|
row: r.row,
|
|
11470
11524
|
revived_at: r.revived_at == null ? null : clock3(r.revived_at),
|
|
11471
11525
|
at: meKnown ? where(atRes.me) : null,
|
|
11472
|
-
allies_within_2200: alliesKnown ? atRes.allies.map((a) => a.hero) : null,
|
|
11473
11526
|
enemies_within_2200: enemiesKnown ? atRes.enemies.map((e) => e.hero) : null,
|
|
11474
11527
|
died_for_real_within_20s: diedSoon
|
|
11475
11528
|
};
|
|
@@ -11492,7 +11545,10 @@ function deathContext(trace, args = {}, ctx = {}) {
|
|
|
11492
11545
|
...leftUnused(out, heroKey),
|
|
11493
11546
|
deaths: args.index == null ? out : [out[args.index - 1]],
|
|
11494
11547
|
...myRes.length ? { resurrections: myRes } : {},
|
|
11495
|
-
gaps:
|
|
11548
|
+
gaps: [
|
|
11549
|
+
...gapsFor(trace, ["vision", "creeps", "unused_free_abilities"]),
|
|
11550
|
+
...autoCooldownMissing ? [{ topic: "ability_casts", reason: "auto_triggered_cooldowns_missing_in_trace" }] : []
|
|
11551
|
+
]
|
|
11496
11552
|
};
|
|
11497
11553
|
}
|
|
11498
11554
|
var share = (me) => me?.max_hp ? Math.round(me.hp / me.max_hp * 100) / 100 : null;
|
|
@@ -11525,17 +11581,6 @@ function wardsAt(trace, h, atDeath, t6) {
|
|
|
11525
11581
|
return { my_team: near[team], enemy: near[team === 2 ? 3 : 2] };
|
|
11526
11582
|
}
|
|
11527
11583
|
var TRADE_SECONDS = 15;
|
|
11528
|
-
function alliesElsewhere(trace, h, t6, atDeath) {
|
|
11529
|
-
if (!atDeath?.me) return [];
|
|
11530
|
-
const near = new Set(atDeath.allies.map((a) => a.hero));
|
|
11531
|
-
const from = { x: atDeath.me.x, y: atDeath.me.y };
|
|
11532
|
-
return trace.heroes.map((o, i) => i).filter((i) => i !== h && trace.heroes[i].team === trace.heroes[h].team && !near.has(trace.heroes[i].key)).map((i) => {
|
|
11533
|
-
const s = heroStateAt(trace, i, t6, { from });
|
|
11534
|
-
if (!s.known) return { hero: s.hero, known: false };
|
|
11535
|
-
if (!s.alive) return { hero: s.hero, doing: "dead", respawn_in: s.respawn_in };
|
|
11536
|
-
return { hero: s.hero, ...s.doing !== "none_of_these" ? { doing: s.doing } : {}, place: s.place, distance: s.distance, ...s.tp_ready != null ? { tp_ready: s.tp_ready } : {} };
|
|
11537
|
-
});
|
|
11538
|
-
}
|
|
11539
11584
|
function deathPatterns(trace, deaths, { allSources = false } = {}) {
|
|
11540
11585
|
const of = (test) => deaths.filter(test).map((d) => d.clock);
|
|
11541
11586
|
const by = /* @__PURE__ */ new Map();
|
|
@@ -11552,9 +11597,8 @@ function deathPatterns(trace, deaths, { allSources = false } = {}) {
|
|
|
11552
11597
|
return {
|
|
11553
11598
|
deaths_where: {
|
|
11554
11599
|
health_below_half_at_window_start: of((d) => d.below_half_health_at_window_start === true),
|
|
11555
|
-
//
|
|
11556
|
-
|
|
11557
|
-
no_ally_within_2200_at_death: of((d) => d.allies_within_2200.at_death === 0),
|
|
11600
|
+
// No count of deaths with no ally within 2200 (owner, 2026-11-27: meaningless): an offlaner alone in a lane, a
|
|
11601
|
+
// core farming a free lane, a support rotating are all "alone"; each death still says who was near.
|
|
11558
11602
|
three_or_more_enemy_heroes_dealing_damage: of((d) => d.enemy_heroes_dealing_damage >= 3),
|
|
11559
11603
|
// In a fight (one of three or more hero deaths close together in time, with an ally within 2200 before it)
|
|
11560
11604
|
// or not. Dying low or to several enemies in a fight is what fights are; outside one it is where the hero
|
|
@@ -11573,7 +11617,6 @@ function deathPatterns(trace, deaths, { allSources = false } = {}) {
|
|
|
11573
11617
|
// Whether the team got an enemy hero back within 15 s. A death not traded bought nothing.
|
|
11574
11618
|
traded_within_15s: of((d) => d.traded_within_15s),
|
|
11575
11619
|
not_traded_within_15s: of((d) => !d.traded_within_15s),
|
|
11576
|
-
no_ally_within_2200_at_death_and_not_traded: of((d) => d.allies_within_2200.at_death === 0 && !d.traded_within_15s),
|
|
11577
11620
|
// Only where the trace has wards (a death with no ward list is in neither).
|
|
11578
11621
|
no_own_observer_within_1600: of((d) => d.observers_within_1600?.my_team === 0),
|
|
11579
11622
|
enemy_observer_within_1600: of((d) => d.observers_within_1600?.enemy > 0),
|
|
@@ -11585,7 +11628,6 @@ function deathPatterns(trace, deaths, { allSources = false } = {}) {
|
|
|
11585
11628
|
// Deaths a list above could not be decided for (health or position not sampled): a count over the game is only as sure as these are few.
|
|
11586
11629
|
deaths_not_known: {
|
|
11587
11630
|
health_at_window_start: deaths.filter((d) => d.below_half_health_at_window_start == null).length,
|
|
11588
|
-
allies_at_death: deaths.filter((d) => d.allies_within_2200.at_death == null).length,
|
|
11589
11631
|
// Whether a death was in a fight is unknown where the hero's position was not sampled.
|
|
11590
11632
|
in_a_fight: deaths.filter((d) => d.in_a_fight == null).length,
|
|
11591
11633
|
// For each outside-fights list, the deaths it can neither include nor rule out: neither in a fight for sure
|
|
@@ -11646,10 +11688,10 @@ function abilityAudit(trace, args = {}, ctx = {}) {
|
|
|
11646
11688
|
const abilityId = nameId(trace, key);
|
|
11647
11689
|
const immune = immunityIntervals(trace);
|
|
11648
11690
|
const learned = entry.levels.find(([, lv]) => lv > 0)?.[0] ?? null;
|
|
11649
|
-
const rows = trace.casts.filter((c) => c[1] === npc && c[2] === abilityId).sort((a, b) => a[0] - b[0]);
|
|
11691
|
+
const rows = abilityId >= 0 ? trace.casts.filter((c) => c[1] === npc && c[2] === abilityId).sort((a, b) => a[0] - b[0]) : [];
|
|
11650
11692
|
const byTarget = {};
|
|
11651
11693
|
const short = key.startsWith(`${trace.heroes[h].key}_`) ? key.slice(trace.heroes[h].key.length + 1) : key;
|
|
11652
|
-
const damaging = trace.damage.some((r) => r[1] === npc && r[3] === abilityId);
|
|
11694
|
+
const damaging = abilityId >= 0 && trace.damage.some((r) => r[1] === npc && r[3] === abilityId);
|
|
11653
11695
|
const real = realDeaths(trace);
|
|
11654
11696
|
const intoImmunity = [];
|
|
11655
11697
|
const targetLived = [];
|
|
@@ -11753,6 +11795,94 @@ function abilityAudit(trace, args = {}, ctx = {}) {
|
|
|
11753
11795
|
gaps: [...gapsFor(trace, ["ability_immunity", "vision"]), { topic: "ability_casts", reason: "attack_modifier_or_passive_casts_not_logged_in_combat_log" }]
|
|
11754
11796
|
};
|
|
11755
11797
|
}
|
|
11798
|
+
const autoActive = AUTO_TRIGGERED_ACTIVE_ABILITIES.has(key);
|
|
11799
|
+
if (autoActive) {
|
|
11800
|
+
const autoInfo = cooldownActivations(entry, rows, refresherTimes(trace, npc));
|
|
11801
|
+
if (!autoInfo) {
|
|
11802
|
+
return {
|
|
11803
|
+
ref: `audit:${trace.heroes[h].key}:${short}`,
|
|
11804
|
+
ref_scope: "summary",
|
|
11805
|
+
hero: trace.heroes[h].key,
|
|
11806
|
+
ability: key,
|
|
11807
|
+
learned_at: learned == null ? null : { t: learned, clock: clock3(learned) },
|
|
11808
|
+
casts_total: null,
|
|
11809
|
+
manual_casts_total: casts.length,
|
|
11810
|
+
auto_triggered_total: null,
|
|
11811
|
+
by_target: byTarget,
|
|
11812
|
+
casts_on_spell_immune_target: casts.filter((c) => c.target_spell_immune).length,
|
|
11813
|
+
of_those_target_was_stunned: casts.filter((c) => c.target_spell_immune && c.target_stunned_seconds > 0).length,
|
|
11814
|
+
casts_where: {
|
|
11815
|
+
target_spell_immune_and_not_stunned: intoImmunity,
|
|
11816
|
+
enemy_hero_target_alive_12s_later: targetLived,
|
|
11817
|
+
...damaging ? { no_hero_target_near_enemies_at_most_one_damaged_and_none_died: cameToLittle } : {}
|
|
11818
|
+
},
|
|
11819
|
+
...damaging ? { casts_not_known: { enemy_heroes_near: nearNotKnown } } : {},
|
|
11820
|
+
seconds_alive_since_learned: alive,
|
|
11821
|
+
seconds_alive_and_ready: null,
|
|
11822
|
+
deaths_with_it_ready_and_not_cast_total: null,
|
|
11823
|
+
deaths_with_it_ready_and_not_cast: null,
|
|
11824
|
+
casts: casts.map((c) => ({ ...c, trigger: "manual" })),
|
|
11825
|
+
note: "This ability can trigger automatically without emitting a combat-log cast event, and cooldown samples are missing in this trace; auto-triggered activations, total activations, ready time, and unused deaths are unknown (null).",
|
|
11826
|
+
gaps: [...gapsFor(trace, ["ability_immunity", "vision"]), { topic: "ability_casts", reason: "auto_triggered_cooldowns_missing_in_trace" }]
|
|
11827
|
+
};
|
|
11828
|
+
}
|
|
11829
|
+
const autoRows = autoInfo.auto.map((tr2) => {
|
|
11830
|
+
const { me, allies, enemies } = nearby(trace, h, tr2.t, 1300);
|
|
11831
|
+
const meKnown = Boolean(me && me.x != null && me.y != null);
|
|
11832
|
+
const alliesKnown = meKnown && trace.heroes.every((o, j) => j === h || o.team !== trace.heroes[h].team || heroNearKnown(trace, j, tr2.t));
|
|
11833
|
+
const enemiesKnown = meKnown && trace.heroes.every((o, j) => o.team === trace.heroes[h].team || heroNearKnown(trace, j, tr2.t));
|
|
11834
|
+
return {
|
|
11835
|
+
ref: "",
|
|
11836
|
+
t: tr2.t,
|
|
11837
|
+
clock: tr2.clock,
|
|
11838
|
+
row: null,
|
|
11839
|
+
trigger: "auto",
|
|
11840
|
+
target: null,
|
|
11841
|
+
target_hp: null,
|
|
11842
|
+
target_spell_immune: null,
|
|
11843
|
+
target_stunned_seconds: null,
|
|
11844
|
+
me: meKnown ? { hp: me.hp, max_hp: me.max_hp, ...where(me) } : null,
|
|
11845
|
+
allies_within_1300: alliesKnown ? allies.map((a) => a.hero) : null,
|
|
11846
|
+
enemies_within_1300: enemiesKnown ? enemies.map((e) => e.hero) : null,
|
|
11847
|
+
deaths_within_12s: real.filter((d) => d[0] >= tr2.t && d[0] - tr2.t <= 12).map((d) => deathRow(trace, d, tr2.t, view))
|
|
11848
|
+
};
|
|
11849
|
+
});
|
|
11850
|
+
const autoProximityMissing = autoRows.some((r) => r.allies_within_1300 == null || r.enemies_within_1300 == null);
|
|
11851
|
+
const combined = [
|
|
11852
|
+
...casts.map((c) => ({ ...c, trigger: "manual" })),
|
|
11853
|
+
...autoRows
|
|
11854
|
+
].sort((a, b) => a.t - b.t || (a.row ?? Infinity) - (b.row ?? Infinity)).map((c, idx) => ({ ...c, ref: `cast:${trace.heroes[h].key}:${short}:${idx + 1}` }));
|
|
11855
|
+
const unusedAuto = myDeaths.filter((d) => abilityLevel(entry, d[0]) > 0 && cooldownLeft(entry, d[0] - 0.5) === 0 && !combined.some((c) => c.t >= d[0] - 12 && c.t <= d[0] + 0.5) && !autoInfo.allStarts.some((st) => st.t >= d[0] - 12 && st.t <= d[0] + 0.5)).filter(afford);
|
|
11856
|
+
return {
|
|
11857
|
+
ref: `audit:${trace.heroes[h].key}:${short}`,
|
|
11858
|
+
ref_scope: "summary",
|
|
11859
|
+
hero: trace.heroes[h].key,
|
|
11860
|
+
ability: key,
|
|
11861
|
+
learned_at: learned == null ? null : { t: learned, clock: clock3(learned) },
|
|
11862
|
+
casts_total: combined.length,
|
|
11863
|
+
manual_casts_total: casts.length,
|
|
11864
|
+
auto_triggered_total: autoRows.length,
|
|
11865
|
+
by_target: byTarget,
|
|
11866
|
+
casts_on_spell_immune_target: casts.filter((c) => c.target_spell_immune).length,
|
|
11867
|
+
of_those_target_was_stunned: casts.filter((c) => c.target_spell_immune && c.target_stunned_seconds > 0).length,
|
|
11868
|
+
casts_where: {
|
|
11869
|
+
target_spell_immune_and_not_stunned: intoImmunity,
|
|
11870
|
+
enemy_hero_target_alive_12s_later: targetLived,
|
|
11871
|
+
...damaging ? { no_hero_target_near_enemies_at_most_one_damaged_and_none_died: cameToLittle } : {}
|
|
11872
|
+
},
|
|
11873
|
+
...damaging ? { casts_not_known: { enemy_heroes_near: nearNotKnown } } : {},
|
|
11874
|
+
seconds_alive_since_learned: alive,
|
|
11875
|
+
seconds_alive_and_ready: idle,
|
|
11876
|
+
deaths_with_it_ready_and_not_cast_total: unusedAuto.length,
|
|
11877
|
+
deaths_with_it_ready_and_not_cast: unusedAuto.map((d) => ({ ref: `death:${trace.heroes[h].key}:${myDeaths.indexOf(d) + 1}`, t: d[0], clock: clock3(d[0]), killer: nameOf(trace, d[2]), row: d[3] })),
|
|
11878
|
+
casts: combined,
|
|
11879
|
+
note: 'Includes both manual casts (trigger: "manual", from combat log) and automatic activations (trigger: "auto", detected from ability cooldown starts, which emit no combat-log cast event).',
|
|
11880
|
+
gaps: [
|
|
11881
|
+
...gapsFor(trace, ["ability_immunity", "vision"]),
|
|
11882
|
+
...autoProximityMissing ? [{ topic: "hero_positions", reason: "position_samples_missing_around_auto_trigger" }] : []
|
|
11883
|
+
]
|
|
11884
|
+
};
|
|
11885
|
+
}
|
|
11756
11886
|
const unused = passiveOnDeath ? [] : myDeaths.filter((d) => abilityLevel(entry, d[0]) > 0 && cooldownLeft(entry, d[0] - 0.5) === 0 && !rows.some((c) => d[0] - c[0] >= 0 && d[0] - c[0] <= 12)).filter(afford);
|
|
11757
11887
|
return {
|
|
11758
11888
|
ref: `audit:${trace.heroes[h].key}:${short}`,
|
|
@@ -11856,6 +11986,25 @@ function fightTimeline(trace, args = {}, ctx = {}) {
|
|
|
11856
11986
|
for (const m of trace.modifiers) if (m[6] === "i" && m[4] === 1 && inWindow(m[0])) rows.push({ p: 0, t: m[0], kind: "spell_immune", hero: nameOf(trace, m[1]), ...sideOf(view, trace, heroOfName(trace, m[1])), modifier: trace.names[m[2]].replace(/^modifier_/, ""), ...m[7] == null ? {} : { row: m[7] } });
|
|
11857
11987
|
for (const u of trace.item_uses) if (inWindow(u[0]) && !NOISE_ITEMS.test(trace.names[u[2]])) rows.push({ p: 1, t: u[0], kind: "item", hero: nameOf(trace, u[1]), item: trace.names[u[2]].replace(/^item_/, ""), row: u[3] });
|
|
11858
11988
|
for (const c of trace.casts) if (inWindow(c[0])) rows.push({ p: heroOfName(trace, c[3]) >= 0 ? 1 : 2, t: c[0], kind: "cast", hero: nameOf(trace, c[1]), ability: trace.names[c[2]], ...c[3] >= 0 ? { target: nameOf(trace, c[3]) } : {}, row: c[4] });
|
|
11989
|
+
let timelineAutoCooldownMissing = false;
|
|
11990
|
+
for (let i = 0; i < trace.heroes.length; i += 1) {
|
|
11991
|
+
const heroAbs = trace.abilities?.[i] ?? {};
|
|
11992
|
+
const hNpc = nameId(trace, trace.heroes[i].npc);
|
|
11993
|
+
const hRefreshers = refresherTimes(trace, hNpc);
|
|
11994
|
+
for (const [k3, e] of Object.entries(heroAbs)) {
|
|
11995
|
+
if (!AUTO_TRIGGERED_ACTIVE_ABILITIES.has(k3)) continue;
|
|
11996
|
+
const aid = nameId(trace, k3);
|
|
11997
|
+
const manual = aid >= 0 ? trace.casts.filter((c) => c[1] === hNpc && c[2] === aid).sort((a, b) => a[0] - b[0]) : [];
|
|
11998
|
+
const info = cooldownActivations(e, manual, hRefreshers);
|
|
11999
|
+
if (!info) {
|
|
12000
|
+
if (abilityLevel(e, to) > 0) timelineAutoCooldownMissing = true;
|
|
12001
|
+
continue;
|
|
12002
|
+
}
|
|
12003
|
+
for (const tr2 of info.auto) {
|
|
12004
|
+
if (inWindow(tr2.t)) rows.push({ p: 0, t: tr2.t, kind: "auto_trigger", hero: trace.heroes[i].key, ...sideOf(view, trace, i), ability: k3 });
|
|
12005
|
+
}
|
|
12006
|
+
}
|
|
12007
|
+
}
|
|
11859
12008
|
let kept = rows;
|
|
11860
12009
|
let truncated = false;
|
|
11861
12010
|
for (const drop of [2, 1]) {
|
|
@@ -11895,7 +12044,10 @@ function fightTimeline(trace, args = {}, ctx = {}) {
|
|
|
11895
12044
|
...truncated ? { truncated: "casts_without_a_hero_target_dropped_first" } : {},
|
|
11896
12045
|
damage_to_heroes_by_unit: top(dealt),
|
|
11897
12046
|
damage_taken_by_hero: top(taken),
|
|
11898
|
-
gaps:
|
|
12047
|
+
gaps: [
|
|
12048
|
+
...gapsFor(trace, ["vision", "ability_immunity"]),
|
|
12049
|
+
...timelineAutoCooldownMissing ? [{ topic: "ability_casts", reason: "auto_triggered_cooldowns_missing_in_trace" }] : []
|
|
12050
|
+
]
|
|
11899
12051
|
};
|
|
11900
12052
|
}
|
|
11901
12053
|
var CONSUMABLE = /^item_(tango|clarity|flask|faerie_fire|branches|ward_|enchanted_mango|famango|great_famango|tpscroll|smoke_of_deceit|dust|blood_grenade|tome_of_knowledge|infused_raindrop|bottle|madstone|recipe_)/;
|
|
@@ -12003,8 +12155,6 @@ function tempoReport(trace, args = {}, ctx = {}) {
|
|
|
12003
12155
|
let dead = 0;
|
|
12004
12156
|
const sides = { own: 0, river: 0, enemy: 0 };
|
|
12005
12157
|
const places = /* @__PURE__ */ new Map();
|
|
12006
|
-
const company = [0, 0, 0];
|
|
12007
|
-
let companyKnown = 0;
|
|
12008
12158
|
let crowded = 0;
|
|
12009
12159
|
let crowdKnown = 0;
|
|
12010
12160
|
let unsampled = 0;
|
|
@@ -12034,10 +12184,6 @@ function tempoReport(trace, args = {}, ctx = {}) {
|
|
|
12034
12184
|
}
|
|
12035
12185
|
if (at.alive && dist(me, at) <= NEAR) near[o.team] += 1;
|
|
12036
12186
|
});
|
|
12037
|
-
if (!unseen[team]) {
|
|
12038
|
-
companyKnown += 1;
|
|
12039
|
-
company[Math.min(2, near[team])] += 1;
|
|
12040
|
-
}
|
|
12041
12187
|
if (!unseen[other2]) {
|
|
12042
12188
|
crowdKnown += 1;
|
|
12043
12189
|
if (near[other2] >= 3) crowded += 1;
|
|
@@ -12080,9 +12226,6 @@ function tempoReport(trace, args = {}, ctx = {}) {
|
|
|
12080
12226
|
on_own_side_of_the_map: whole(sides.own),
|
|
12081
12227
|
around_the_river: whole(sides.river),
|
|
12082
12228
|
on_the_opponents_side: whole(sides.enemy),
|
|
12083
|
-
with_no_ally_within_2200: whole(company[0], companyKnown),
|
|
12084
|
-
with_one_ally_within_2200: whole(company[1], companyKnown),
|
|
12085
|
-
with_two_or_more_allies_within_2200: whole(company[2], companyKnown),
|
|
12086
12229
|
with_three_or_more_opponents_within_2200: whole(crowded, crowdKnown)
|
|
12087
12230
|
},
|
|
12088
12231
|
// Null (not an empty list) when the stretch was not sampled throughout: the place they spent most time in may be one never seen.
|
|
@@ -12154,13 +12297,13 @@ var TRACE_TOOLS = [
|
|
|
12154
12297
|
},
|
|
12155
12298
|
{
|
|
12156
12299
|
name: "death_context",
|
|
12157
|
-
description: "What led to a hero's real deaths: for the seconds before each one, where they were, which
|
|
12300
|
+
description: "What led to a hero's real deaths: for the seconds before each one, where they were, which enemies were within 2200 units, health and mana, which of their abilities and items were ready, who dealt the damage, the disables that landed (`disable_seconds_in_window`), enemy ultimates absorbed (`enemy_ultimates_absorbed`), what they cast, nearby fights within [-30 s before engagement, +15 s after] (`nearby_fight`), nearby building/Roshan activity (`nearby_objective`), killer kind and whether it was a neutral/tower/Roshan/Tormentor/creep death with zero enemy hero damage (`non_hero_death_without_enemy_hero_damage`), and who else died around it. Without `index`, every real death. In-place revivals (Wraith King's Reincarnation, Aegis of the Immortal) are not counted as deaths; when the hero had any, they are listed apart under `resurrections` (`resurrection:<hero>:<n>`, with `died_for_real_within_20s` when the hero died again right after reviving), and for Wraith King each real death gives `reincarnation_at_death` (`not_learned`, `on_cooldown`, `insufficient_mana`). Auto-triggerable active abilities that fired automatically without a combat-log cast (e.g. Abaddon's Borrowed Time below 400 HP, detected from cooldown starts) are listed under `auto_triggered` and excluded from `ready_not_cast`. An ability off cooldown that the hero never had the mana for in the window is listed apart (`off_cooldown_without_the_mana`), not as ready; attack modifiers whose uses are not logged as ability casts are excluded from `ready_not_cast`. `deaths_where` lists, by game time, the deaths that have something in common (began below half health, no ally near, three or more enemies, before a nearby fight within 30 s, non-hero without enemy hero damage, absorbed enemy ultimate) and `damage_share_in_death_windows` says where the damage came from \u2014 use them for what to change, and for which item answers the damage. `most_left_unused` lists all the hero's deaths in a fixed order of how much they still had (rule in `most_left_unused_rule`): the first is the answer to \"which death was the most avoidable\".",
|
|
12158
12301
|
input_schema: { type: "object", properties: { hero: HERO, index: { type: "integer", minimum: 1, description: "Which death, counting from 1. Omit for all." }, window: { type: "number", minimum: 4, maximum: 30, description: "Seconds before the death to look at (default 12)." } }, required: ["hero"], additionalProperties: false },
|
|
12159
12302
|
run: deathContext
|
|
12160
12303
|
},
|
|
12161
12304
|
{
|
|
12162
12305
|
name: "ability_audit",
|
|
12163
|
-
description:
|
|
12306
|
+
description: 'Every cast of one ability by one hero: the target and its health, whether the target was spell immune at that moment, who was near, which enemy heroes it damaged in the 15 seconds after, or until its next cast (`enemy_heroes_damaged_within_15s`, for an ability that deals damage), and which heroes died in the next 12 seconds. Also how long the ability sat ready while the hero was alive, and the hero\'s real deaths with it ready and not cast (for passive death-triggered abilities such as `skeleton_king_reincarnation` or `undying_ceaseless_dirge`, `triggered_on_death` lists when it triggered instead; for auto-triggerable active abilities such as `abaddon_borrowed_time`, `casts` includes both `trigger: "manual"` casts and `trigger: "auto"` cooldown-detected activations with `manual_casts_total` and `auto_triggered_total`; for attack modifiers or passives whose uses are not logged as ability casts, `casts_logged: false` with `casts_total: null` and `damage_to_enemy_heroes_total` instead of 0 casts).',
|
|
12164
12307
|
input_schema: { type: "object", properties: { hero: HERO, ability: { type: "string", description: 'Ability key, with or without the hero prefix, e.g. "primal_roar".' } }, required: ["hero", "ability"], additionalProperties: false },
|
|
12165
12308
|
run: abilityAudit
|
|
12166
12309
|
},
|
|
@@ -12172,7 +12315,7 @@ var TRACE_TOOLS = [
|
|
|
12172
12315
|
},
|
|
12173
12316
|
{
|
|
12174
12317
|
name: "fight_timeline",
|
|
12175
|
-
description: "A stretch of the game second by second (at most 180 s): where all ten heroes stood at the start and at the first death, then every cast, key item use, spell-immunity activation, death, in-place revival (`reincarnation`, `aegis`) and building kill in order, how many heroes each side lost in it (`hero_deaths_in_window`, real deaths only), and who dealt and took the damage.",
|
|
12318
|
+
description: "A stretch of the game second by second (at most 180 s): where all ten heroes stood at the start and at the first death, then every cast, auto-triggered ultimate (`auto_trigger`, e.g. Abaddon Borrowed Time), key item use, spell-immunity activation, death, in-place revival (`reincarnation`, `aegis`) and building kill in order, how many heroes each side lost in it (`hero_deaths_in_window`, real deaths only), and who dealt and took the damage.",
|
|
12176
12319
|
input_schema: { type: "object", properties: { from: TIME, to: TIME }, required: ["from", "to"], additionalProperties: false },
|
|
12177
12320
|
run: fightTimeline
|
|
12178
12321
|
},
|
|
@@ -12750,10 +12893,11 @@ function proItemsLine(hero, vs, lifts) {
|
|
|
12750
12893
|
zh: `\u804C\u4E1A\u6BD4\u8D5B\u91CC${hero.zh}\u5BF9\u4E0A${vs.zh}\uFF08${IV.since} \u4EE5\u6765 ${n} \u573A\uFF09\uFF1A${lifts.map((x) => `${pctS(x.rate)} \u51FA\u4E86${name2(x.key, "zh")}\uFF08\u5E73\u65F6 ${pctS(x.base)}\uFF09`).join("\uFF0C")}`
|
|
12751
12894
|
};
|
|
12752
12895
|
}
|
|
12753
|
-
function answersByPro(h, vsHeroes, answers) {
|
|
12896
|
+
function answersByPro(h, vsHeroes, answers, pool = answers) {
|
|
12897
|
+
const allowed = /* @__PURE__ */ new Set([...pool, ...answers]);
|
|
12754
12898
|
const lifted = /* @__PURE__ */ new Map();
|
|
12755
12899
|
for (const v of vsHeroes) {
|
|
12756
|
-
for (const x of itemLifts(h, v.id)) if (
|
|
12900
|
+
for (const x of itemLifts(h, v.id)) if (allowed.has(x.key) && !lifted.has(x.key)) lifted.set(x.key, { ...x, vs: v });
|
|
12757
12901
|
}
|
|
12758
12902
|
return { ordered: [...lifted.keys(), ...answers.filter((a) => !lifted.has(a))], lifted };
|
|
12759
12903
|
}
|
|
@@ -13354,9 +13498,11 @@ function fightCauses(ctx, fights2) {
|
|
|
13354
13498
|
const kind = ctx.role.kind;
|
|
13355
13499
|
const pierced = tag === "disable" && carrier.tags?.has?.("piercing");
|
|
13356
13500
|
const valid = (k3) => !(pierced && k3 === "black_king_bar");
|
|
13357
|
-
const
|
|
13358
|
-
const
|
|
13359
|
-
const
|
|
13501
|
+
const both = (arch2) => [.../* @__PURE__ */ new Set([...answersFor(tag, "core", match.patch, arch2), ...answersFor(tag, "support", match.patch, arch2)])].filter(valid);
|
|
13502
|
+
const pool = tag ? new Set(both(null)) : /* @__PURE__ */ new Set();
|
|
13503
|
+
const arch = archetypeOf(ctx.me.hero, ctx.role);
|
|
13504
|
+
const answers = tag ? answersByPro(ctx.me.hero.id, [carrier.hero], answersFor(tag, kind, match.patch, arch).filter(valid), both(arch)).ordered : [];
|
|
13505
|
+
const covering = tag ? [.../* @__PURE__ */ new Set([...answersFor(tag, kind, match.patch).filter(valid), ...answersByPro(ctx.me.hero.id, [carrier.hero], [], both(null)).lifted.keys()])] : [];
|
|
13360
13506
|
const teamHas = players.filter((p) => ours.has(p.slot)).flatMap((p) => p.items.filter((i) => pool.has(i)).map((i) => ({ p, i })));
|
|
13361
13507
|
const iName = (k3, lang) => ctx.itemInfo(k3)[lang];
|
|
13362
13508
|
const facts = abilityFacts(carrier.hero.id);
|
|
@@ -13537,7 +13683,7 @@ var phaseOf = (sec) => (PHASES.find((p) => sec >= p.from && sec < p.to) ?? PHASE
|
|
|
13537
13683
|
var FIGHT_EDGE = 600;
|
|
13538
13684
|
var LANE_DRAW = 0.08;
|
|
13539
13685
|
var LANE_STOMP = 0.25;
|
|
13540
|
-
var AUTO_TRIGGERED = /* @__PURE__ */ new Set(["skeleton_king_reincarnation"]);
|
|
13686
|
+
var AUTO_TRIGGERED = /* @__PURE__ */ new Set(["skeleton_king_reincarnation", "abaddon_borrowed_time"]);
|
|
13541
13687
|
function ultimateOf(heroId) {
|
|
13542
13688
|
const u = ABILITIES2.ultimates?.[String(heroId)];
|
|
13543
13689
|
if (!u || u.passive || AUTO_TRIGGERED.has(u.key)) return null;
|
|
@@ -14393,9 +14539,12 @@ function itemFinding(ctx) {
|
|
|
14393
14539
|
if (x.tag === "evasion" && !me.hero.roles.includes("Carry")) continue;
|
|
14394
14540
|
const pierced = x.tag === "disable" && x.heroes.some((h) => enemyProfile.piercing.has(h.slug));
|
|
14395
14541
|
const valid = (a) => !(pierced && a === "black_king_bar");
|
|
14396
|
-
const
|
|
14397
|
-
const
|
|
14398
|
-
|
|
14542
|
+
const patch = ctx.match.patch;
|
|
14543
|
+
const both = (arch) => [.../* @__PURE__ */ new Set([...answersFor(x.tag, "core", patch, arch), ...answersFor(x.tag, "support", patch, arch)])].filter(valid);
|
|
14544
|
+
const { ordered: answers, lifted } = answersByPro(me.hero.id, x.heroes, answersFor(x.tag, kind, patch, ctx.archetype).filter(valid), both(ctx.archetype));
|
|
14545
|
+
const proOwned = answersByPro(me.hero.id, x.heroes, [], both(null)).lifted;
|
|
14546
|
+
const have = [.../* @__PURE__ */ new Set([...answersFor(x.tag, kind, patch).filter(valid), ...proOwned.keys()])].filter((a) => inv.has(a));
|
|
14547
|
+
(have.length ? covered : missing).push({ ...x, have, answers, lifted, pierced });
|
|
14399
14548
|
}
|
|
14400
14549
|
const evidence = [
|
|
14401
14550
|
{ k: t4("Your final items", "\u4F60\u7684\u7EC8\u5C40\u88C5\u5907"), items: me.items },
|
|
@@ -14403,9 +14552,8 @@ function itemFinding(ctx) {
|
|
|
14403
14552
|
];
|
|
14404
14553
|
if (missing.length && diedOften) {
|
|
14405
14554
|
const m = missing[0];
|
|
14406
|
-
const
|
|
14407
|
-
const
|
|
14408
|
-
for (const x of lifted.values()) {
|
|
14555
|
+
const sample = m.answers.slice(0, 4).map((a) => itemInfo(a));
|
|
14556
|
+
for (const x of m.lifted.values()) {
|
|
14409
14557
|
const it = itemInfo(x.key);
|
|
14410
14558
|
evidence.push({
|
|
14411
14559
|
k: t4(`Pro ${me.hero.en} vs ${x.vs.en}: ${it.en}`, `\u804C\u4E1A${me.hero.zh}\u5BF9\u4E0A${x.vs.zh}\uFF1A${it.zh}`),
|
|
@@ -16751,6 +16899,9 @@ import { createRequire as createRequire4 } from "node:module";
|
|
|
16751
16899
|
init_knowledge();
|
|
16752
16900
|
var require5 = createRequire4(import.meta.url);
|
|
16753
16901
|
var ITEM_NAMES4 = names_default.items;
|
|
16902
|
+
var ABILITY_TEXT = abilities_default2;
|
|
16903
|
+
var DMG_WORD2 = { P: "physical", M: "magical", U: "pure" };
|
|
16904
|
+
var TOP_KILLERS = 2;
|
|
16754
16905
|
var BY_SLUG2 = HEROES_BY_KEY;
|
|
16755
16906
|
var slugOf2 = (hero) => String(hero ?? "").trim().toLowerCase().replace(/^npc_dota_hero_/, "").replace(/[\s-]+/g, "_");
|
|
16756
16907
|
var r22 = (n) => Math.round(n * 100) / 100;
|
|
@@ -16982,18 +17133,40 @@ function buildCheck(trace, args = {}, ctx = {}) {
|
|
|
16982
17133
|
goldBy[p].gold += i.gold_on_top_of_items_already_held ?? i.cost ?? 0;
|
|
16983
17134
|
goldBy[p].items.push(i.name);
|
|
16984
17135
|
}
|
|
16985
|
-
const
|
|
16986
|
-
const
|
|
16987
|
-
|
|
16988
|
-
const
|
|
16989
|
-
|
|
16990
|
-
return keys.map((k3) => {
|
|
16991
|
-
const lift = lifts.get(k3);
|
|
16992
|
-
const facts = itemFacts(k3, pd.items);
|
|
16993
|
-
const farmMin = economy?.gold_per_min > 0 && Number.isFinite(facts.cost) ? Math.round(facts.cost / economy.gold_per_min * 10) / 10 : null;
|
|
16994
|
-
return { item: k3, name: itemName2(k3, lang), ...facts, ...farmMin != null ? { estimated_minutes_of_my_farm: farmMin } : {}, player_first_held: firstHeld.get(k3)?.clock ?? null, ...lift ? { pros_on_this_hero_against_the_top_killer: { share: lift.rate, share_usually: lift.base, pro_games: lift.n } } : {} };
|
|
16995
|
-
});
|
|
17136
|
+
const killers = [...byEnemy].sort((a, b) => b.kills_of_me - a.kills_of_me || b.share_from_their_attacks + b.share_from_their_abilities_and_items - (a.share_from_their_attacks + a.share_from_their_abilities_and_items)).filter((e) => e.kills_of_me > 0).slice(0, TOP_KILLERS);
|
|
17137
|
+
const itemEntry = (k3) => {
|
|
17138
|
+
const facts = itemFacts(k3, pd.items);
|
|
17139
|
+
const farmMin = economy?.gold_per_min > 0 && Number.isFinite(facts.cost) ? Math.round(facts.cost / economy.gold_per_min * 10) / 10 : null;
|
|
17140
|
+
return { item: k3, name: itemName2(k3, lang), ...facts, ...farmMin != null ? { estimated_minutes_of_my_farm: farmMin } : {}, player_first_held: firstHeld.get(k3)?.clock ?? null };
|
|
16996
17141
|
};
|
|
17142
|
+
const answersToTopKillers = killers.map((e) => {
|
|
17143
|
+
const other2 = BY_SLUG2.get(e.enemy);
|
|
17144
|
+
const abilities = other2 ? pd.heroAbilities(other2.id) : null;
|
|
17145
|
+
const pro = other2 ? itemLifts(hero.id, other2.id).filter((x) => pd.has(x.key)) : [];
|
|
17146
|
+
const tags = curatedTraits(e.enemy);
|
|
17147
|
+
return {
|
|
17148
|
+
killer: e.enemy,
|
|
17149
|
+
kills_of_me: e.kills_of_me,
|
|
17150
|
+
share_from_their_attacks: e.share_from_their_attacks,
|
|
17151
|
+
share_from_their_abilities_and_items: e.share_from_their_abilities_and_items,
|
|
17152
|
+
their_abilities: Array.isArray(abilities) ? abilities.map((a) => {
|
|
17153
|
+
const text = ABILITY_TEXT[a.id]?.desc;
|
|
17154
|
+
return {
|
|
17155
|
+
ability: a.id,
|
|
17156
|
+
name: a[lang] ?? a.en,
|
|
17157
|
+
...a.ult ? { ultimate: true } : {},
|
|
17158
|
+
...a.dmg ? { damage_type: DMG_WORD2[a.dmg] } : {},
|
|
17159
|
+
// Absent means Valve's data does not say; it is not "no".
|
|
17160
|
+
...typeof a.pierces === "boolean" ? { goes_through_spell_immunity: a.pierces } : {},
|
|
17161
|
+
...a.dispel ? { dispelled_by: a.dispel } : {},
|
|
17162
|
+
...text ? { valve_text: String(text).replace(/\s+/g, " ").slice(0, 320) } : {}
|
|
17163
|
+
};
|
|
17164
|
+
}) : null,
|
|
17165
|
+
// Null, not [], when no item stood out: too few pro games of the pair, or none built clearly more often.
|
|
17166
|
+
pro_items_against_this_killer: pro.length ? pro.map((x) => ({ ...itemEntry(x.key), share_of_pro_games_against_this_hero: x.rate, share_usually: x.base, pro_games: x.n })) : null,
|
|
17167
|
+
...tags.length ? { known_for: tags } : {}
|
|
17168
|
+
};
|
|
17169
|
+
});
|
|
16997
17170
|
const sample = proItemsFor(hero.id, pd);
|
|
16998
17171
|
const fromBefore = Boolean(sample?.few_games && sample.games < MIN_FEW_GAMES);
|
|
16999
17172
|
const row = fromBefore ? sample.before_this_patch ?? null : sample;
|
|
@@ -17047,12 +17220,12 @@ function buildCheck(trace, args = {}, ctx = {}) {
|
|
|
17047
17220
|
disables_or_silences: heldFor("answer_to_disables", "answer_to_silences"),
|
|
17048
17221
|
initiation_or_gap_closer: heldFor("initiation_or_gap_closer")
|
|
17049
17222
|
},
|
|
17050
|
-
|
|
17051
|
-
|
|
17223
|
+
// Null when the deaths could not be read: no deaths known is not "nobody killed me".
|
|
17224
|
+
answers_to_top_killers: deaths.error ? null : answersToTopKillers,
|
|
17052
17225
|
most_built_in_this_bracket: bracketCore,
|
|
17053
17226
|
most_built_by_pros_on_this_hero: core.length ? { pro_games: row.games, played_on_releases: row.releases, ...fromBefore ? { from_the_patch_before_this_game: true } : sample.few_games ? { few_games: true } : {}, window: "finished between 10:00 and 24:59", items: core } : null,
|
|
17054
17227
|
gap_closers: { mine: myGap ? { item: myGap.item, name: itemName2(myGap.item, lang), first_held: myGap.first_held.clock } : null, enemies: theirGaps },
|
|
17055
|
-
note: `built_for is what the site's curated lists and Valve's item stats say an item is for; an empty list means "not classified", not "offensive".
|
|
17228
|
+
note: `answers_to_top_killers is per enemy who killed the player most: Valve's text of that hero's abilities (valve_text is the current release's wording; the flags are this game's release), the items pros on this hero build clearly more often against it (association, not proof); known_for is the site's curated threat tags of that hero. built_for is what the site's curated lists and Valve's item stats say an item is for; an empty list means "not classified", not "offensive". estimated_minutes_of_my_farm = item cost / my_economy.gold_per_min when that is known; "gives" and "does" are Valve's data. player_already_held_for_this_purpose groups big items the player already finished by the threats they cover. Shares of damage are over the 12 seconds before each death, of all damage taken in them (the two sums count enemy heroes only). An item built from a big item already held counts only the gold on top of it (gold_on_top_of_items_already_held). Pro shares are professional games, not this bracket; most_built_in_this_bracket (when present) is public games of this bracket and role (STRATZ).`,
|
|
17056
17229
|
gaps: [
|
|
17057
17230
|
...role.kind ? [] : [{ topic: "role", reason: ctx.match ? role.gaps[0] ?? "role_not_established" : "no_match_data_for_this_game" }],
|
|
17058
17231
|
...economy ? [
|
|
@@ -17063,6 +17236,9 @@ function buildCheck(trace, args = {}, ctx = {}) {
|
|
|
17063
17236
|
...row && sample.few_games ? [{ topic: "pro_mid_game_items", reason: `only_${sample.games}_pro_games_of_this_hero_in_${pd.major}_up_to_${pd.name}: shares are from ${row.releases.join(", ")}` }] : [],
|
|
17064
17237
|
...pub.gaps,
|
|
17065
17238
|
...patchGap(pd),
|
|
17239
|
+
...answersToTopKillers.filter((k3) => !k3.pro_items_against_this_killer).map((k3) => ({ topic: `pro_items_against_${k3.killer}`, reason: `no_item_built_clearly_more_often_or_too_few_pro_games_since_${ITEM_VS_SOURCE.since}` })),
|
|
17240
|
+
...answersToTopKillers.some((k3) => k3.pro_items_against_this_killer) ? [{ topic: "pro_items_against_killers", reason: `professional_matches_since_${ITEM_VS_SOURCE.since}_all_releases_together` }] : [],
|
|
17241
|
+
...answersToTopKillers.length && !pd.exact ? [{ topic: "killer_ability_data_of_this_game_patch", reason: `${pd.reason}; ${pd.name} data used` }] : [],
|
|
17066
17242
|
{ topic: "damage_type_of_abilities", reason: "spell_damage_is_not_split_into_magical_and_physical_here" },
|
|
17067
17243
|
{ topic: "gold_spent_on_small_items", reason: "only_big_items_are_counted" }
|
|
17068
17244
|
]
|
|
@@ -17164,7 +17340,7 @@ var HERO2 = { type: "string", description: `Hero key as in match_overview, e.g.
|
|
|
17164
17340
|
var SITUATION_TOOLS = [
|
|
17165
17341
|
{
|
|
17166
17342
|
name: "build_check",
|
|
17167
|
-
description: "The player's build against what killed them. Gives their role and 1\u20135 position (from parsed match lanes or inferred from the replay), their economy (`my_economy`: GPM, net worth / 20:00 gold when known), where the damage in their deaths came from (which enemy, attacks or abilities), each big item they bought in order with its cost, what Valve lists for it and what it is for (built_for: an answer to attack damage, to spell damage, to disables, a gap closer, magic resistance, armor \u2014 empty means not classified), the gold put into each purpose, which big items the player already held for each purpose (player_already_held_for_this_purpose), the
|
|
17343
|
+
description: "The player's build against what killed them. Gives their role and 1\u20135 position (from parsed match lanes or inferred from the replay), their economy (`my_economy`: GPM, net worth / 20:00 gold when known), where the damage in their deaths came from (which enemy, attacks or abilities), each big item they bought in order with its cost, what Valve lists for it and what it is for (built_for: an answer to attack damage, to spell damage, to disables, a gap closer, magic resistance, armor \u2014 empty means not classified), the gold put into each purpose, which big items the player already held for each purpose (player_already_held_for_this_purpose), for each of the (up to two) enemies who killed them most what that hero's abilities do in Valve's words and the items pros on this hero build clearly more often against that hero (answers_to_top_killers), each with what it does, `estimated_minutes_of_my_farm` (item cost divided by the player's GPM) and whether the player held it, what players of this bracket and role build on the hero in public games (most_built_in_this_bracket, when known), the hero's most-built professional items with when the player had them, and when each side got its first gap closer (Blink Dagger and the like). Use it before saying anything about what an item is, what the player's build answered, or what to buy.",
|
|
17168
17344
|
input_schema: { type: "object", properties: { hero: HERO2 }, required: ["hero"], additionalProperties: false },
|
|
17169
17345
|
run: buildCheck
|
|
17170
17346
|
},
|
|
@@ -19726,7 +19902,7 @@ function goalFromReview(pick2, { trace, hero, findings, match = null, bracketDat
|
|
|
19726
19902
|
|
|
19727
19903
|
// lib/agent/review/schema.js
|
|
19728
19904
|
var DEEP_REVIEW_SCHEMA = "dota2.ai/deep-review@1";
|
|
19729
|
-
var DEEP_REVIEW_PROMPT_VERSION =
|
|
19905
|
+
var DEEP_REVIEW_PROMPT_VERSION = 73;
|
|
19730
19906
|
var MAX_REFS = 3;
|
|
19731
19907
|
var MAX_FINDINGS = 3;
|
|
19732
19908
|
var MAX_PLAN_EVIDENCE = 4;
|
|
@@ -19815,7 +19991,7 @@ var SUBMIT_REVIEW = {
|
|
|
19815
19991
|
when: { ...STR, description: 'The situation, as the player meets it in game, from what is on their own screen at that moment: their health and mana, who stands next to them, what an enemy just used, the clock, what is in the shop. Not hindsight ("before you die"), not a mood ("when it is dangerous").' },
|
|
19816
19992
|
do: { ...STR, description: 'One action for that situation: where to go, what to buy and by when, what to hold or wait for. Not "be careful", "position better" or "react faster".' },
|
|
19817
19993
|
this_game: { ...STR, description: "How often that situation came up in this game and went the other way: the count a tool states and the times (for example three of the twelve deaths, then their times), written in the language of the review like everything else. Every time and number must be in a tool result." },
|
|
19818
|
-
counted_by: { type: "string", enum: HABIT_KEYS, description: "Which count a tool keeps that this rule is about, if one is \u2014 the next game's replay is counted the same way to see whether the rule was followed. From death_context.deaths_where \u2014 low_health_outside_fights: health_below_half_at_window_start_outside_fights. outnumbered_outside_fights: three_or_more_enemy_heroes_dealing_damage_outside_fights.
|
|
19994
|
+
counted_by: { type: "string", enum: HABIT_KEYS, description: "Which count a tool keeps that this rule is about, if one is \u2014 the next game's replay is counted the same way to see whether the rule was followed. From death_context.deaths_where \u2014 low_health_outside_fights: health_below_half_at_window_start_outside_fights. outnumbered_outside_fights: three_or_more_enemy_heroes_dealing_damage_outside_fights. nothing_pressed: nothing_cast_and_no_item_used. (low_health and outnumbered count the same over every death, fights included: use them only when the finding is about the fights themselves.) From ability_audit of one of the player's own abilities (name it in counted_ability) \u2014 cast_into_immunity: casts_where.target_spell_immune_and_not_stunned. target_survived: casts_where.enemy_hero_target_alive_12s_later. reached_few: casts_where.no_hero_target_and_at_most_one_enemy_hero_damaged. died_holding: deaths_with_it_ready_and_not_cast_total. Omit when the rule is about something else (an item)." },
|
|
19819
19995
|
counted_ability: { type: "string", description: 'For the four ability counts: the ability key as ability_audit names it (e.g. "tidehunter_ravage").' }
|
|
19820
19996
|
}
|
|
19821
19997
|
},
|
|
@@ -19894,7 +20070,7 @@ READING THE TOOLS
|
|
|
19894
20070
|
INVESTIGATION & STRUCTURE
|
|
19895
20071
|
1. Map the whole game first in \`story\` (2\u20136 causal links in game order, each with \`phase\`, \`what_changed\`, \`because\`, \`whose\`, and cited \`evidence\`): start with \`match_overview\` and \`key_moments\`, then inspect the phases that shaped this game \u2014 lanes (\`draft_report\`, \`lane_report\` including \`how_the_lane_went\` and \`my_rotations_before_10_00\`), economy & windows (\`farm_report\`, \`window_report\`, \`tempo_report\`, \`lineup_timing\`), objectives (\`siege_report\`, \`roshan_report\`, \`decision_points\`), and key fights (\`fight_report\`, \`fight_timeline\`, \`game_state\`). Let the replay guide which tools you call; do not force topics that did not matter here.
|
|
19896
20072
|
2. Drill into the player's own decisions:
|
|
19897
|
-
- **Deaths** (\`death_context\`): read each death as a decision using \`me.doing\`, \`moved_toward_own_fountain\`, \`in_a_fight\` / \`_outside_fights\`, \`nearby_fight\`, \`nearby_objective\`, \`
|
|
20073
|
+
- **Deaths** (\`death_context\`): read each death as a decision using \`me.doing\`, \`moved_toward_own_fountain\`, \`in_a_fight\` / \`_outside_fights\`, \`nearby_fight\`, \`nearby_objective\`, \`traded_within_15s\`, \`ready_not_cast\`, and \`off_cooldown_without_the_mana\` (an ability under off_cooldown_without_the_mana could not be cast). Group deaths into one finding only when they share the same decision, never just a condition like "low health" or "alone".
|
|
19898
20074
|
- **Abilities & spells** (\`hero_abilities\`, \`ability_audit\`, \`immunity_windows\`): check what Valve lists (including spell-immunity piercing) and what happened in this game (\`target_stunned_seconds\`, \`enemy_heroes_damaged_within_15s\`). A cast that damaged several enemies was not wasted because one was spell immune; an ability with \`casts_logged: false\` (auto-cast orbs/passives) was never "0 casts".
|
|
19899
20075
|
- **Build & spikes** (\`build_check\`, \`power_spikes\`, \`pro_item_choices\`): weigh what killed the player against \`built_for\`, \`player_already_held_for_this_purpose\`, \`my_economy\` (\`estimated_minutes_of_my_farm\`), \`most_built_in_this_bracket\` / \`public_items_in_this_bracket\`, and \`most_built_by_pros_on_this_hero\`. Make the build a finding only when an item choice or timing contributed to what went wrong \u2014 never just for deviating from a standard build. Check Valve's \`does\` drawbacks, state which item an advised purchase replaces or follows, and keep any target minute reachable by the player's own gold.
|
|
19900
20076
|
- **Supports**: inspect \`ward_report\`, \`save_report\`, and \`lane_report.how_the_lane_went.my_rotations_before_10_00\`. Compare against corpus references honestly (a reference across all ranks is context, not a bracket average or quota).
|
|
@@ -20117,7 +20293,7 @@ function resolveRef(trace, ref, { hero, lang = "en", match = null, bracketData }
|
|
|
20117
20293
|
if (!record || record.ref !== ref) return null;
|
|
20118
20294
|
const { tool, gaps, ...rest } = record;
|
|
20119
20295
|
const places = kind === "phase" || kind === "fights" || kind === "state" || kind === "sieges" || kind === "death" || kind === "resurrection" || kind === "roshan" || kind === "decision" || kind === "lane" ? placeNames(lang) : null;
|
|
20120
|
-
const placed = kind === "phase" ? (rest.hero_most_time_in ?? []).map((x) => x.place) : kind === "fights" ? [rest.my_team, rest.enemy].flatMap((s) => (s?.not_in_it ?? []).map((x) => x.place)) : kind === "state" ? [rest.my_team, rest.enemy].flatMap((s) => (s?.heroes ?? []).map((x) => x.place)) : kind === "sieges" ? [...rest.pushing_side_not_hitting ?? [], ...rest.owners_not_near ?? [], ...rest.me_when_it_fell ? [rest.me_when_it_fell] : []].map((x) => x.place) : kind === "
|
|
20296
|
+
const placed = kind === "phase" ? (rest.hero_most_time_in ?? []).map((x) => x.place) : kind === "fights" ? [rest.my_team, rest.enemy].flatMap((s) => (s?.not_in_it ?? []).map((x) => x.place)) : kind === "state" ? [rest.my_team, rest.enemy].flatMap((s) => (s?.heroes ?? []).map((x) => x.place)) : kind === "sieges" ? [...rest.pushing_side_not_hitting ?? [], ...rest.owners_not_near ?? [], ...rest.me_when_it_fell ? [rest.me_when_it_fell] : []].map((x) => x.place) : kind === "resurrection" ? [rest.at?.region] : kind === "roshan" ? [rest.place, ...(rest.attempt?.other_side_when_it_began ?? []).map((x) => x.place)] : kind === "decision" ? [rest.my_place] : kind === "lane" ? (rest.how_the_lane_went?.my_rotations_before_10_00?.trips ?? []).map((x) => x.destination_region) : [];
|
|
20121
20297
|
return { ref, kind, record: rest, names: { ...namesIn(rest, lang), ...places ? Object.fromEntries(placed.filter(Boolean).map((p) => [p, places[p] ?? p])) : {} } };
|
|
20122
20298
|
}
|
|
20123
20299
|
|
|
@@ -20602,19 +20778,97 @@ function verifyText(text, sources, accepted = []) {
|
|
|
20602
20778
|
return { ok: problems.length === 0, problems: problems.map(({ kind, text: t6 }) => ({ kind, text: t6 })) };
|
|
20603
20779
|
}
|
|
20604
20780
|
|
|
20781
|
+
// lib/agent/webSearch.js
|
|
20782
|
+
var ENDPOINT = "https://api.deepseek.com/v1/tools/search";
|
|
20783
|
+
var MAX_CALLS = 4;
|
|
20784
|
+
var RESULTS = 5;
|
|
20785
|
+
var TIMEOUT_MS = 15e3;
|
|
20786
|
+
var SUMMARY_CHARS = 800;
|
|
20787
|
+
var WEB_SEARCH_TOOL = {
|
|
20788
|
+
name: "web_search",
|
|
20789
|
+
description: "Search the web (DeepSeek Search) for how something in Dota 2 works or how players deal with it \u2014 an ability's mechanics, what beats a hero, why an item is built against it. Pages come back with title, url, site, date and a summary, next to this game's patch and its release date. A page is a reference, not a fact: it may be wrong, or about an older patch (before_this_game_patch). Before you use what it says, look the hero, ability or item up for this game's patch (hero_abilities, item_info, hero_info, patch_changes); where they disagree, this patch's data stands. Pages cannot be cited (no ref) and a number from them cannot be stated in the review. Ask about heroes, abilities and items, never about this match or its players. At most 4 searches.",
|
|
20790
|
+
input_schema: {
|
|
20791
|
+
type: "object",
|
|
20792
|
+
properties: { query: { type: "string", description: 'What to search for, at most 128 characters, e.g. "Ursa Fury Swipes counter items" or "\u718A\u6218\u58EB \u514B\u5236 \u88C5\u5907".' } },
|
|
20793
|
+
required: ["query"],
|
|
20794
|
+
additionalProperties: false
|
|
20795
|
+
}
|
|
20796
|
+
};
|
|
20797
|
+
var isWebSearchResult = (r) => r?.tool === "web_search";
|
|
20798
|
+
var NOTE = "Pages from the web, not this game's data and not checked by the site: a reference, not a fact. Check what a page says against this game's patch with hero_abilities, item_info, hero_info and patch_changes before you use it; where they disagree, the patch data stands and the page is wrong or out of date. A page dated before this_game_patch.released (before_this_game_patch) may describe an older version. Cite only the lookup tools, and state no number from these pages.";
|
|
20799
|
+
var CHECK_WITH = ["hero_abilities", "item_info", "hero_info", "patch_changes"];
|
|
20800
|
+
function createWebSearch({ apiKey = null, fetchImpl = globalThis.fetch, maxCalls = MAX_CALLS, timeoutMs = TIMEOUT_MS } = {}) {
|
|
20801
|
+
let calls = 0;
|
|
20802
|
+
const search = async (args = {}, { patch = null } = {}) => {
|
|
20803
|
+
const query = typeof args.query === "string" ? args.query.trim() : "";
|
|
20804
|
+
const base = { tool: "web_search", query };
|
|
20805
|
+
if (!apiKey) return { ...base, error: "web_search_not_configured" };
|
|
20806
|
+
if (query.length < 2 || [...query].length > 128) return { ...base, error: "query_must_be_2_to_128_characters" };
|
|
20807
|
+
if (/\d{6,}/.test(query)) return { ...base, error: "query_has_an_id: search for heroes, abilities and items, not this match or its players" };
|
|
20808
|
+
if (calls >= maxCalls) return { ...base, error: `web_search_limit_reached: ${maxCalls} searches` };
|
|
20809
|
+
calls += 1;
|
|
20810
|
+
let res;
|
|
20811
|
+
try {
|
|
20812
|
+
res = await fetchImpl(ENDPOINT, {
|
|
20813
|
+
method: "POST",
|
|
20814
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
20815
|
+
body: JSON.stringify({ query, count: RESULTS }),
|
|
20816
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
20817
|
+
});
|
|
20818
|
+
} catch {
|
|
20819
|
+
return { ...base, error: "web_search_unreachable" };
|
|
20820
|
+
}
|
|
20821
|
+
if (!res.ok) return { ...base, error: `web_search_failed_${res.status}` };
|
|
20822
|
+
let body;
|
|
20823
|
+
try {
|
|
20824
|
+
body = await res.json();
|
|
20825
|
+
} catch {
|
|
20826
|
+
return { ...base, error: "web_search_bad_answer" };
|
|
20827
|
+
}
|
|
20828
|
+
if (!Array.isArray(body?.results)) return { ...base, error: "web_search_bad_answer" };
|
|
20829
|
+
const released = patch?.released ? Date.parse(patch.released) : NaN;
|
|
20830
|
+
const results = body.results.slice(0, RESULTS).map((r) => {
|
|
20831
|
+
const at = typeof r?.date === "string" ? Date.parse(r.date) : NaN;
|
|
20832
|
+
const date2 = Number.isFinite(at) ? r.date.slice(0, 10) : null;
|
|
20833
|
+
return {
|
|
20834
|
+
title: String(r?.title ?? ""),
|
|
20835
|
+
url: String(r?.url ?? ""),
|
|
20836
|
+
...r?.site_name ? { site: String(r.site_name) } : {},
|
|
20837
|
+
date: date2,
|
|
20838
|
+
// Unknown (null) when either date is: an undated page is not "current".
|
|
20839
|
+
// Set against the page's own time, not its day: a page from the release day after the release is not older.
|
|
20840
|
+
before_this_game_patch: Number.isFinite(at) && Number.isFinite(released) ? at < released : null,
|
|
20841
|
+
summary: String(r?.summary || r?.snippet || "").replace(/\s+/g, " ").slice(0, SUMMARY_CHARS)
|
|
20842
|
+
};
|
|
20843
|
+
}).filter((r) => r.url);
|
|
20844
|
+
return { ...base, source: "DeepSeek Search", this_game_patch: patch ? { name: patch.name ?? null, released: patch.released ?? null, ...patch.reason ? { unknown_because: patch.reason } : {} } : null, check_with: CHECK_WITH, results, note: NOTE };
|
|
20845
|
+
};
|
|
20846
|
+
search.spend = (n) => {
|
|
20847
|
+
if (Number.isInteger(n) && n > 0) calls += n;
|
|
20848
|
+
};
|
|
20849
|
+
return search;
|
|
20850
|
+
}
|
|
20851
|
+
function webSearchFromEnv(env = process.env) {
|
|
20852
|
+
return createWebSearch({ apiKey: env.AGENT_WEB_SEARCH === "0" ? null : env.DEEPSEEK_API_KEY || null });
|
|
20853
|
+
}
|
|
20854
|
+
|
|
20605
20855
|
// lib/agent/review/toolkit.js
|
|
20606
|
-
function reviewToolkit({ trace, hero, lang, match = null }) {
|
|
20856
|
+
function reviewToolkit({ trace, hero, lang, match = null, webSearch = webSearchFromEnv() }) {
|
|
20607
20857
|
const language = normalizeUiLang(lang);
|
|
20608
20858
|
const seat = trace.heroes.find((h) => h.key === String(hero).trim().toLowerCase().replace(/^npc_dota_hero_/, "").replace(/[\s-]+/g, "_"));
|
|
20609
20859
|
if (!seat) return null;
|
|
20610
|
-
const lookups = [...TRACE_TOOLS, ...KNOWLEDGE_TOOLS];
|
|
20860
|
+
const lookups = [...TRACE_TOOLS, ...KNOWLEDGE_TOOLS, WEB_SEARCH_TOOL];
|
|
20611
20861
|
const ctx = { match, perspective: seat.key, lang: language, ultimateOf: ultimateOf2, ultimatesOf };
|
|
20612
20862
|
const knowledge = new Map(KNOWLEDGE_TOOLS.map((t6) => [t6.name, t6]));
|
|
20863
|
+
const pd = patchForGame(trace.match_id, match);
|
|
20864
|
+
const gamePatch2 = pd.exact || /hotfix/.test(pd.reason ?? "") ? { name: pd.name, released: RELEASES.find((r) => r.name === pd.name)?.rollout_by ?? null } : { name: null, released: null, reason: pd.reason ?? "patch_not_established" };
|
|
20613
20865
|
return {
|
|
20614
20866
|
seat,
|
|
20615
20867
|
language,
|
|
20616
20868
|
tools: lookups.map(({ name: name2, description, input_schema }) => ({ name: name2, description, input_schema })),
|
|
20617
|
-
|
|
20869
|
+
/** Count n web searches already made (a resumed review's): the limit is per review, not per restart. */
|
|
20870
|
+
spendSearches: (n) => webSearch?.spend?.(n),
|
|
20871
|
+
runTool: (name2, args) => name2 === WEB_SEARCH_TOOL.name ? webSearch(args ?? {}, { patch: gamePatch2 }) : roshanGapPointsToTool(knowledge.has(name2) ? { tool: name2, ...knowledge.get(name2).run(trace, args, ctx) } : runTraceTool(trace, name2, args, ctx), trace),
|
|
20618
20872
|
patch: (({ name: name2, hotfix, exact, how, reason }) => ({ name: name2, ...hotfix ? { hotfix } : {}, exact, ...how ? { known_from: how } : {}, ...exact ? {} : { reason } }))(patchForGame(trace.match_id, match)),
|
|
20619
20873
|
context: { match_id: trace.match_id, player_hero: seat.key, hero_names: heroNames(trace, language), place_names: placeNames(language), ...scoreboard(match, seat.key) ? { scoreboard: scoreboard(match, seat.key) } : {} }
|
|
20620
20874
|
};
|
|
@@ -21845,8 +22099,8 @@ function lookupAnswers(messages) {
|
|
|
21845
22099
|
}
|
|
21846
22100
|
return out;
|
|
21847
22101
|
}
|
|
21848
|
-
async function runDeepReview({ complete, trace, hero, lang, plan = null, match = null, signal, onEvent, maxSteps, maxToolCalls, checkpoint = null, onCheckpoint = null, translate = false }) {
|
|
21849
|
-
const kit = reviewToolkit({ trace, hero, lang, match });
|
|
22102
|
+
async function runDeepReview({ complete, trace, hero, lang, plan = null, match = null, signal, onEvent, maxSteps, maxToolCalls, checkpoint = null, onCheckpoint = null, translate = false, webSearch }) {
|
|
22103
|
+
const kit = reviewToolkit({ trace, hero, lang, match, webSearch });
|
|
21850
22104
|
if (!kit) return { status: "unknown_hero", heroes: trace.heroes.map((h) => h.key) };
|
|
21851
22105
|
const { seat, language, context } = kit;
|
|
21852
22106
|
const maxToolChars = AGENT_DEFAULTS.maxToolChars;
|
|
@@ -21879,6 +22133,10 @@ ${JSON.stringify(context)}`;
|
|
|
21879
22133
|
const out = [];
|
|
21880
22134
|
for (const c of calls) {
|
|
21881
22135
|
let result2;
|
|
22136
|
+
if (c.name === WEB_SEARCH_TOOL.name) {
|
|
22137
|
+
out.push({ name: c.name, args: c.args ?? {}, result: { tool: "web_search", not_asked_again: true } });
|
|
22138
|
+
continue;
|
|
22139
|
+
}
|
|
21882
22140
|
try {
|
|
21883
22141
|
result2 = await kit.runTool(c.name, c.args ?? {});
|
|
21884
22142
|
} catch {
|
|
@@ -21895,10 +22153,11 @@ ${JSON.stringify(context)}`;
|
|
|
21895
22153
|
if (from) {
|
|
21896
22154
|
firstAgain = from.first ? await again(from.first.calls) : null;
|
|
21897
22155
|
runAgain = from.run ? await again(from.run.calls) : null;
|
|
21898
|
-
const same = (t6, answers) => t6.length === answers.length && t6.every((x, i) => toolContent(x.result, maxToolChars) === answers[i]);
|
|
22156
|
+
const same = (t6, answers) => t6.length === answers.length && t6.every((x, i) => x.name === WEB_SEARCH_TOOL.name || toolContent(x.result, maxToolChars) === answers[i]);
|
|
21899
22157
|
const firstAnswers = from.first ? lookupAnswers(from.first.messages) : [];
|
|
21900
22158
|
if (from.first && !same(firstAgain, firstAnswers) || from.run && !same(runAgain, lookupAnswers(from.run.messages).slice(firstAnswers.length))) from = null;
|
|
21901
22159
|
}
|
|
22160
|
+
if (from) kit.spendSearches([...from.first?.calls ?? [], ...from.run?.calls ?? []].filter((c) => c.name === WEB_SEARCH_TOOL.name).length);
|
|
21902
22161
|
const resumed = (s) => ({ steps: s.steps, calls: s.tool_count, usage: s.usage, transcript: runAgain });
|
|
21903
22162
|
if (from) onEvent?.({ type: "resumed", tools: [...from.first?.calls ?? [], ...from.run?.calls ?? []] });
|
|
21904
22163
|
let first;
|
|
@@ -21920,7 +22179,7 @@ ${JSON.stringify(context)}`;
|
|
|
21920
22179
|
}
|
|
21921
22180
|
let review = first.final;
|
|
21922
22181
|
let transcript = first.transcript;
|
|
21923
|
-
const sources = () => [context, ...transcript.map((t6) => t6.result)];
|
|
22182
|
+
const sources = () => [context, ...transcript.map((t6) => t6.result).filter((r) => !isWebSearchResult(r))];
|
|
21924
22183
|
let check = verifyReview(review, sources());
|
|
21925
22184
|
const firstProblems = check.problems;
|
|
21926
22185
|
let repaired = false;
|
|
@@ -22111,7 +22370,7 @@ RULES
|
|
|
22111
22370
|
- When the player says what they were trying to do ("my plan was to take towers early"), take that as their plan \u2014 it is theirs to say, the replay cannot show it \u2014 and answer three things in this order. One: did what they did fit it, from their own numbers \u2014 their items (build_for_plan with that plan: the first item for it and when, the gold in other items before it), where they were, the fights they were at, the buildings they damaged. Two: does the public data on these ten heroes support it (lineup_timing); when it shows no lean, say the data does not settle it. Three: where it broke \u2014 their own play, the team's (they were there and the team still took nothing, or had a window and took little in it), or what the enemy did (their fights turned into buildings; what they had finished by the time the window ended, from window_report; who on their side got richest while the team was ahead, and whether they stood by the buildings the team took, from farm_report). An item finished before a window ended is listed beside it, not proven to have ended it: say when it came, not that it closed the window. Name the one the numbers point to, and say so plainly when it was not the player's doing. Never tell the player what they "intended" when they have not said it.
|
|
22112
22371
|
- tempo_report has no creeps: where the player stood is not what they were doing there. Say "pushing" only with their damage to buildings, never "farming". lineup_timing measures each hero alone: say "public games", name the heroes, and do not call a mean of five heroes the line-up's win rate.
|
|
22113
22372
|
- Asked about a fight, why it was lost, or where everyone was at a moment: fight_report for the player (how many heroes each side brought, which ultimates and Black King Bars were ready, what each hero not in it was doing and whether their TP was ready), or game_state at that second. A hero not in a fight dealt and took no damage from enemy heroes in it: say so and what the replay shows them doing, never that they refused or were farming.
|
|
22114
|
-
- Asked about a death: death_context says whether it was traded (an enemy hero died within 15 s)
|
|
22373
|
+
- Asked about a death: death_context says whether it was traded (an enemy hero died within 15 s). A death not traded bought nothing; that is the cost to name.
|
|
22115
22374
|
- Asked about wards or vision: death_context (observers_within_1600 at each death) and fight_report (each side's observers near each fight). A ward near a spot is not proof the spot was seen; null means the replay of this game has no ward list.
|
|
22116
22375
|
- Asked why fights were won but the game was not, or what to do after a won fight: decision_points for the player (after each won fight, the enemies still dead and for how long, whether their richest hero was one of them, and whether the winners took a building, Roshan, pushed for nothing, or took nothing; and after each tier 1\u20133 tower, what its takers did next, what they lost meanwhile, and where the player was). Asked why a tower was lost: the same tool's after_a_tower_fell points. Asked whether a fight was taken into an enemy's fresh item (BKB, Blink\u2026): its fight_after_a_big_item points.
|
|
22117
22376
|
- Asked about Roshan, the Aegis or a Tormentor: roshan_report for the player (each Roshan: who took it, who was there, used or expired, what each side took in the 300 s after; and when the replay kept the kill, who hit it, for how long, and where each hero of the other side stood when it began \u2014 where they stood, not what they saw). With read_from "aegis_pickups_only", no Aegis in it is not proof no Roshan died.
|
|
@@ -22156,7 +22415,7 @@ Review of this game: ${review ? JSON.stringify(review) : "none yet"}`;
|
|
|
22156
22415
|
if (run.status !== "answered" || !run.text.trim()) return { status: "no_answer", usage };
|
|
22157
22416
|
let transcript = run.transcript;
|
|
22158
22417
|
const checked = checkedPart(review);
|
|
22159
|
-
const sources = () => [kit.context, checked, history.filter((h) => h.clean).map((h) => h.a), ...transcript.map((t6) => t6.result)];
|
|
22418
|
+
const sources = () => [kit.context, checked, history.filter((h) => h.clean).map((h) => h.a), ...transcript.map((t6) => t6.result).filter((r) => !isWebSearchResult(r))];
|
|
22160
22419
|
const accepted = [...checked ? [JSON.stringify(checked)] : [], ...history.filter((h) => h.clean).map((h) => h.a)];
|
|
22161
22420
|
let check = verifyText(run.text, sources(), accepted);
|
|
22162
22421
|
if (!check.ok) {
|
|
@@ -23988,10 +24247,12 @@ async function replayReview(api, args) {
|
|
|
23988
24247
|
if (!avail.can_parse) return { status: "unavailable", reason: "replay_parsing_off", message: "This server cannot fetch replays, so it cannot review this game." };
|
|
23989
24248
|
const p = avail.parse ?? { status: "none" };
|
|
23990
24249
|
if (p.status === "failed" && p.final) return replayGone(p.reason);
|
|
24250
|
+
if (p.status === "failed" && args?.retry !== true) return parseFailed(matchId, p);
|
|
23991
24251
|
if (p.status !== "running") {
|
|
23992
24252
|
const r = await api.prepare(matchId);
|
|
23993
24253
|
if (r.status === 429 || r.status === 503 && r.body?.retryAfterSec) throw refusal2(r);
|
|
23994
24254
|
if (r.body?.status === "failed" && r.body.final) return replayGone(r.body.reason);
|
|
24255
|
+
if (r.body?.status === "failed") return parseFailed(matchId, r.body);
|
|
23995
24256
|
if (r.body?.status === "unavailable") return { status: "unavailable", reason: "replay_parsing_off", message: "This server cannot fetch replays, so it cannot review this game." };
|
|
23996
24257
|
}
|
|
23997
24258
|
return {
|
|
@@ -24044,6 +24305,19 @@ async function replayReview(api, args) {
|
|
|
24044
24305
|
poll_after_sec: POLL_AFTER_SEC
|
|
24045
24306
|
};
|
|
24046
24307
|
}
|
|
24308
|
+
function parseFailed(matchId, p) {
|
|
24309
|
+
const reason = p?.reason ?? "parse_failed";
|
|
24310
|
+
const retryIn = Number.isFinite(p?.retry_in_sec) && p.retry_in_sec > 0 ? Math.ceil(p.retry_in_sec) : null;
|
|
24311
|
+
const waitHint = retryIn != null ? ` Wait about ${retryIn} s and call replay_review again with retry: true.` : " Call replay_review again with retry: true to try fetching the replay again.";
|
|
24312
|
+
return {
|
|
24313
|
+
status: "failed",
|
|
24314
|
+
stage: "parse",
|
|
24315
|
+
match_id: matchId,
|
|
24316
|
+
reason,
|
|
24317
|
+
...retryIn != null ? { retry_in_sec: retryIn } : {},
|
|
24318
|
+
message: `Could not fetch or parse the replay right now (${reason}).${waitHint} coach_report still has the scoreboard-level review.`
|
|
24319
|
+
};
|
|
24320
|
+
}
|
|
24047
24321
|
function replayGone(reason) {
|
|
24048
24322
|
return reason === "replay_gone" ? { status: "replay_unavailable", reason, message: "Valve keeps replays for about two weeks; this one is gone, so there is nothing to review honestly. coach_report still has the scoreboard-level review." } : { status: "replay_unavailable", reason: reason ?? "parse_failed", message: "The replay could not be fetched or read. coach_report still has the scoreboard-level review." };
|
|
24049
24323
|
}
|