From d374e537b92735cc328d276ddb27c0905d014bb4 Mon Sep 17 00:00:00 2001 From: sganggs Date: Sat, 3 Oct 2026 04:06:08 +0800 Subject: [PATCH] =?UTF-8?q?feedback1d=20WM:=20=E9=87=8E=E9=AC=83=20S2=20pu?= =?UTF-8?q?shes=20along=20her=20direction;=20=E7=90=B3=E7=90=85=E8=AF=97?= =?UTF-8?q?=E6=80=80=E9=9B=85=20S3=20coin=20push=20radial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Player report D2: 野鬃's skill sometimes pushed enemies the opposite way. Her S2 text "往攻击方向…推开" is the 推击手 wording that PRTS 推与拉 calls a directional force; the remake pushed radially at full force, so an enemy grabbed behind her centre (or at her back) flew 1.7-2.14 tiles towards the objective. Now directional with the official correction (> 45 deg off or < 0.25 tile: radial at force level -2, at most 0.44 tile). Direction audit: 琳琅诗怀雅 S3's coin push is radial (PRTS note), it was pushed along her facing. The generic kit reads 往攻击方向 as directional. --- docs/SIM.md | 6 +- server/sim/Battle.js | 6 +- server/sim/constants.js | 4 +- server/sim/content/generic.js | 8 +- server/sim/content/kits/tier1.js | 11 +- server/sim/content/kits/tier3.js | 9 +- test/sim/feedback1d-push.test.js | 210 +++++++++++++++++++++++++++++++ 7 files changed, 234 insertions(+), 20 deletions(-) create mode 100644 test/sim/feedback1d-push.test.js diff --git a/docs/SIM.md b/docs/SIM.md index 3894bb29..ed49e8ce 100644 --- a/docs/SIM.md +++ b/docs/SIM.md @@ -570,7 +570,7 @@ or guard with a per-unit flag while dealing it. When the guard trips, the logged | `addDp(playerId, n)`, `retreat(unit, {reason, permanent})`, `relocate(unit, r, c)` | | | `redeploy(unit, { free=true, tile, keepSp })` | immediate (re)deployment of a dead/retreated ally (full HP, `deploy {initial:false}`); `free: false` pays `base.cost` DP (refused without it); `tile: [r, c]` lands on that tile once (home unchanged — later redeploys use the board tile; refused when off-rect or occupied, no fallback); `keepSp` keeps SP/charges (保留技力), restored before `deploy` fires — 突袭 raids, 阿戈尔 revive in place | | `refreshRange(unit)`, `setExtraRange(unit, keys)`, `rangeChanged(unit)` | rebuild the ranges after changing `unit.rangeGrid` (流形 copies); extra targetable tiles (absolute keys; merged into every later rebuild until set again; `null` clears; never in `baseRangeKeys`): 蕾缪安 wanted, 维娜 S3 | -| `push(enemy, force, {from, dir, fixed, fixedAngle, inward, effect})`, `pull(enemy, force, {to, center, stop})`, `pullToFront(enemy, unit, force)`, `forceLevel(enemy, force)`, `pushDistance(enemy, force, {effect})` | the official 位移 (PRTS 游戏数据基础 §重量公式 / 推与拉; user playtest #6 item 14): 受力等级 = 力度 (微小力 −1, 小力 0, 中力 1, 较大力 2, 大力 3 …) − current 重量等级 (massLevel, 失重 counts). Push distance per level (`constants.js PUSH_TILES`, PRTS 推与拉's 弹道 column): ≤ −3 → 0, −2 → 0.12, −1 → 0.44, 0 → 1.7, 1 → 2.14, 2 → 2.96, ≥ 3 → 3.53 tiles; `effect` = a 特效 push (`PUSH_TILES_EFFECT`: −2 → 0.085, −1 → 0.374, 0 → 1.562, 1 → 1.987, 2 → 2.773, ≥ 3 → 3.331 — 见行者 S1 / S2, `PUSH_EFFECT_SKILLS`; every other pusher uses the 弹道 column [ASSUMED]); radial (away from `from`) unless `dir` (directional: 推击手, 朝部署方向 — > 45° off or < 0.25 tile ⇒ radial and level −2; `fixed` waives both (圣聆初雪 S1), `fixedAngle` only the angle (见行者 S2)); `inward` = a push towards `from` (薄绿 S2), stopping at the 急停 radius. Pull: level ≥ 0 → to `to` / the 急停 radius around `center`, −1 → 35 % of the way, −2 → 0.03, ≤ −3 → 0; `pullToFront` aims at the 拉力起点 0.5 tile ahead of the unit with the 急停 radius 0.6708 around it (never moves an enemy the unit itself blocks — nor does a pull towards an ally's centre, e.g. the 流形 S3 pulse) | +| `push(enemy, force, {from, dir, fixed, fixedAngle, inward, effect})`, `pull(enemy, force, {to, center, stop})`, `pullToFront(enemy, unit, force)`, `forceLevel(enemy, force)`, `pushDistance(enemy, force, {effect})` | the official 位移 (PRTS 游戏数据基础 §重量公式 / 推与拉; user playtest #6 item 14): 受力等级 = 力度 (微小力 −1, 小力 0, 中力 1, 较大力 2, 大力 3 …) − current 重量等级 (massLevel, 失重 counts). Push distance per level (`constants.js PUSH_TILES`, PRTS 推与拉's 弹道 column): ≤ −3 → 0, −2 → 0.12, −1 → 0.44, 0 → 1.7, 1 → 2.14, 2 → 2.96, ≥ 3 → 3.53 tiles; `effect` = a 特效 push (`PUSH_TILES_EFFECT`: −2 → 0.085, −1 → 0.374, 0 → 1.562, 1 → 1.987, 2 → 2.773, ≥ 3 → 3.331 — 见行者 S1 / S2, `PUSH_EFFECT_SKILLS`; every other pusher uses the 弹道 column [ASSUMED]); radial (away from `from`: 莫斯提马 S3, 山 S3, 琳琅诗怀雅 S3 — PRTS 备注 "推开效果为径向推动") unless `dir` (directional: 推击手 and the same "往攻击方向" wording — 野鬃 S2 —, 朝部署方向 — > 45° off or < 0.25 tile ⇒ radial and level −2; `fixed` waives both (圣聆初雪 S1), `fixedAngle` only the angle (见行者 S2)); `inward` = a push towards `from` (薄绿 S2), stopping at the 急停 radius. Pull: level ≥ 0 → to `to` / the 急停 radius around `center`, −1 → 35 % of the way, −2 → 0.03, ≤ −3 → 0; `pullToFront` aims at the 拉力起点 0.5 tile ahead of the unit with the 急停 radius 0.6708 around it (never moves an enemy the unit itself blocks — nor does a pull towards an ally's centre, e.g. the 流形 S3 pulse) | | `displace(enemy, {x, y}, tiles)` | the raw mover behind push / pull: along passable tiles (by `motion`: FLY in the rect, else ground-passable), no weight rule; nothing for 失衡免疫 (`noDisplace`: 近地悬浮, 浮空) and leaders; unblocks + re-paths | | `after(seconds, fn, {owner})`, `every(seconds, fn, {owner, immediate})` | return `{cancel()}`; fn(battle, sched) | | `fx(kind, params)`, `rng()` (+ `rng.int/range/chance/pick/shuffle/weighted`) | never use Math.random | @@ -730,8 +730,8 @@ whose skill "恢复…友方/友军…生命" heals the most injured ally in ran `ep_damage_ratio` + "附带…凋亡/灼燃/神经损伤" ⇒ element damage on hit (凋亡 → `apoptosis`; × damage dealt when the text says "伤害N%的…损伤", else × ATK); "屏障" + `shield_max_hp_ratio`/`hp_ratio` ⇒ decaying self shield at start (砾, 新约能天使); "立即流失N%当前生命" ⇒ self HP loss at start (宴, 风丸); `hp_ratio` + "恢复/回复…生命" ⇒ self heal at start; `force` ⇒ on-hit -displacement by the official 力度 − 重量 rules (拖拽/hookmaster: `pullToFront`; else `push`, directional for 朝部署方向 / 向前 / -身前方向 and 推击手, radial otherwise — §6). **Passive** skills only apply stat mods (timed when the text says "N秒内": +displacement by the official 力度 − 重量 rules (拖拽/hookmaster: `pullToFront`; else `push`, directional for 往攻击方向 / 朝部署方向 / +向前 / 身前方向 and 推击手, radial otherwise — §6). **Passive** skills only apply stat mods (timed when the text says "N秒内": 宴 +65 % ATK for 14 s) and the self/counter effects — their scales describe procs that need a kit. Instant skills with mods/targeting but no attack override apply them to the next attack (the skill range is switched in for that attack). diff --git a/server/sim/Battle.js b/server/sim/Battle.js index 68187bb4..4738c7da 100644 --- a/server/sim/Battle.js +++ b/server/sim/Battle.js @@ -1803,9 +1803,9 @@ export class Battle { * Push enemy `e` with 力度 `force` (PRTS 推与拉 §推力): the official distance of its 受力等级 (constants.js PUSH_TILES: * a 中力 push moves a weight-1 enemy 1.7 tiles, a weight-2 one 0.44, weight 3 0.12, weight ≥ 4 not at all). Radial * (the default: away from `from`, the pusher's centre — "沿着干员向自身中心点的射线方向") or directional (`dir` = the - * pusher's direction {x, y}: 推击手, "朝部署方向" / "向前推开"); a directional push on a target more than 45° off `dir` - * or nearer than 0.25 tile becomes radial with 受力等级 −2 ("特殊修正"). `fixed` waives both corrections (PRTS 圣聆初雪 S1 - * 备注 "不会因角度过大或距离过近而变化方向与力度"); `fixedAngle` only the angle one (PRTS 见行者 S2 备注 "不会因为角度过大 + * pusher's direction {x, y}: 推击手 and the same "往攻击方向" wording (野鬃 S2), "朝部署方向"); a directional push on a + * target more than 45° off `dir` or nearer than 0.25 tile becomes radial with 受力等级 −2 ("特殊修正"). `fixed` waives + * both corrections (PRTS 圣聆初雪 S1 备注 "不会因角度过大或距离过近而变化方向与力度"); `fixedAngle` only the angle one (PRTS 见行者 S2 备注 "不会因为角度过大 * 而改变推动的方向或削减力度" — the < 0.25 tile rule still applies). `inward` = a radial push towards `from` (薄绿 S2's "拖拽", PRTS 备注 "实际为 * 反方向(指向薄绿方向)的推开"), never nearer than PULL_STOP_RADIUS to its centre [ASSUMED: "至面前"]. `effect` = a 特效 * push (PRTS 推与拉: one frame less of travel than a 弹道 push — constants.js PUSH_TILES_EFFECT / PUSH_EFFECT_SKILLS). diff --git a/server/sim/constants.js b/server/sim/constants.js index 8103d7d7..ce2fdc99 100644 --- a/server/sim/constants.js +++ b/server/sim/constants.js @@ -99,8 +99,8 @@ export const PALSY_MAX = 3; * ≥ 0 → all the way to the pull point (必定拉至身前), −1 → PULL_WEAK_SHARE of the starting distance, −2 → PULL_CRAWL * tiles, ≤ −3 → nothing. A pull "至面前" aims at the point PULL_ORIGIN tiles in front of the puller (拉力起点 "干员前方0.5格 * 距离处") and stops once the target is within PULL_STOP_RADIUS of the puller's centre (急停 "拖拽者中心半径0.6708"). - * A directional push (推击手 / 朝部署方向) on a target more than 45° off the direction or nearer than - * PUSH_DIRECTIONAL_MIN_DIST becomes radial with 受力等级 −2 (推与拉 "特殊修正"). + * A directional push (推击手 and the same "往攻击方向" wording — 野鬃 S2 —, 朝部署方向) on a target more than 45° off the + * direction or nearer than PUSH_DIRECTIONAL_MIN_DIST becomes radial with 受力等级 −2 (推与拉 "特殊修正"). * PRTS 推与拉 gives two columns of 理想移动距离: 弹道 (a push carried by a projectile — "温蒂的23技能、阿消的12技能"; equal * to the 游戏数据基础 table above) and 特效 (an effect push, one frame less of travel — "食铁兽的12技能、见行者的12技能"): * PUSH_TILES_EFFECT, used by the skills in PUSH_EFFECT_SKILLS (见行者 S1 护身射击 / S2 惊爆射击, the only 特效 pushers of diff --git a/server/sim/content/generic.js b/server/sim/content/generic.js index db99ac3e..c4ac9e3a 100644 --- a/server/sim/content/generic.js +++ b/server/sim/content/generic.js @@ -31,9 +31,9 @@ // Passive skills only apply stat mods (for bb.duration s when the text says "N秒内": 宴) and the self/counter effects // above — their scales describe procs (bombs, sword rain, counters) that need a hand-authored kit. // force→onHit displacement with the official 力度 − 重量 rules (Battle.push / pullToFront): a pull "至面前" when the text says -// 拖拽 or for hookmasters, else a push — along the unit's direction when the text says 朝部署方向 / 向前 / 身前方向 or for -// 推击手 (directional), otherwise away from the unit (radial); a skill of constants.js PUSH_EFFECT_SKILLS (见行者 S1) pushes -// by PRTS 推与拉's 特效 column. +// 拖拽 or for hookmasters, else a push — along the unit's direction when the text says 往攻击方向 (the 推击手 wording, PRTS +// 推与拉 方向力) / 朝部署方向 / 向前 / 身前方向 or for 推击手 (directional), otherwise away from the unit (radial); a skill of +// constants.js PUSH_EFFECT_SKILLS (见行者 S1) pushes by PRTS 推与拉's 特效 column. import { normalizeSkill } from '../simdata.js'; import { sortEnemyTargets } from '../targeting.js'; @@ -218,7 +218,7 @@ export function genericSkillSpec(sk, bb = sk?.bb ?? {}, def = null) { const hasForce = !passive && forceRaw !== undefined; const force = forceRaw ?? 0; // 力度 (微小力 −1 … 特大力 5) const pull = /拖拽/.test(desc) || (!/推开|击退/.test(desc) && def && def.subProf === 'hookmaster'); - const directional = !pull && (/朝部署方向|向前|身前方向/.test(desc) || (def && def.subProf === 'pusher')); + const directional = !pull && (/攻击方向|朝部署方向|向前|身前方向/.test(desc) || (def && def.subProf === 'pusher')); const effectPush = PUSH_EFFECT_SKILLS.has(sk.id); const hitElement = element && !counterText; diff --git a/server/sim/content/kits/tier1.js b/server/sim/content/kits/tier1.js index 288c6e33..50e43556 100644 --- a/server/sim/content/kits/tier1.js +++ b/server/sim/content/kits/tier1.js @@ -927,9 +927,12 @@ export default { }, // --------------------------------------------------------------------------------------------------------------- - // 1_19 野鬃 夹枪冲锋: wider range (skill grid), ATK +atk, hits push the target away (attack@force 1 = 中力; radial — away - // from her centre, PRTS 推与拉: every push but the 推击手' is radial) by the official 力度 − 重量 distance (Battle.push: - // weight 0 → 2.14 tiles, 1 → 1.7, 2 → 0.44, 3 → 0.12, ≥ 4 → none; user playtest #6 item 14). + // 1_19 野鬃 夹枪冲锋: wider range (skill grid), ATK +atk, "攻击会把目标往攻击方向中等力度地推开" (attack@force 1 = 中力) by + // the official 力度 − 重量 distance (Battle.push: weight 0 → 2.14 tiles, 1 → 1.7, 2 → 0.44, 3 → 0.12, ≥ 4 → none; user + // playtest #6 item 14). "往攻击方向" is the 推击手 wording (阿消 S1 / S2, 温蒂 S1, 食铁兽 S1, 见行者 S1), which PRTS 推与拉 + // calls 方向力: a push along her direction, radial at 受力等级 −2 for a target > 45° off it or < 0.25 tile away (特殊修正) + // — so an enemy she grabs behind her centre (the hand-over after a push freed her block) is not thrown 1.7 tiles + // towards the objective (player feedback D2, "往攻击方向相反方向推"; it was a radial push before). // 一致向前: after deploying (normal flag 0: first deployment only; elite flag 1: every deployment) every undeployed // 【近卫】 operator of the player costs `value` less DP to deploy (≤ max_stack_cnt per operator until it deploys). // Alternate S1 骑枪刺击 (PASSIVE, ON_DEPLOY): for `duration` s after every deployment ASPD +attack_speed. @@ -954,7 +957,7 @@ export default { attack: { onHit({ battle, unit, target }) { if (!target || !target.alive || target.side !== 'enemy') return; - battle.push(target, force, { from: unit }); + battle.push(target, force, { from: unit, dir: { x: unit.fwd[1], y: unit.fwd[0] } }); }, }, }, diff --git a/server/sim/content/kits/tier3.js b/server/sim/content/kits/tier3.js index e6c50a7a..4f38241d 100644 --- a/server/sim/content/kits/tier3.js +++ b/server/sim/content/kits/tier3.js @@ -399,8 +399,8 @@ const KITS = { // 大买家: coin at skill start + coin & ATK stack per trait payment; 破财消灾: DP-paid revive (cost doubles) // S1 仗义疏财 (passive, 2 coins): an attack spends a coin to heal the most injured ally (< 70 % HP) of the 8 // surrounding tiles for attack@heal_scale × ATK. S3 千金一掷 (持续时间无限): attacks hit twice, kills give a coin; - // closing it spends every coin on random ground enemies of the front range (atk_scale phys + small push forward; - // PRTS 备注: 地面敌方单位, 弹道不可对空). + // closing it spends every coin on random ground enemies of the front range (atk_scale phys + a small push, radial + // — PRTS 备注 "推开效果为径向推动" despite the text's 向前; 地面敌方单位, 弹道不可对空). // Auto-close (the mode casts everything itself; the player's "主动关闭" is not available): once the purse is full // (10) and an enemy stands in range. 精锐 module MER-Y: ATK +4 % per trait payment (≤ 5 stacks). chess_char_3_04_a: (bb, chess, def) => { @@ -492,8 +492,9 @@ const KITS = { if (!e) break; spent++; battle.dealDamage(unit, e, { amount: unit.s.atk * cash, type: 'phys', isSkill: true, tags: ['skill', 'swire2Cash'] }); - // "将目标小力地向前推开": a directional push along her direction (Battle.push, official 力度 − 重量 distance) - if (e.alive) battle.push(e, force, { from: unit, dir: { x: unit.fwd[1], y: unit.fwd[0] } }); + // "将目标小力地向前推开" — PRTS 备注 "金币弹道…推开效果为径向推动": a radial push away from her centre (not + // along her direction, so no 45° / 0.25-tile 特殊修正), official 力度 − 重量 distance (Battle.push) + if (e.alive) battle.push(e, force, { from: unit }); } fx(battle, 'coin', unit, { n: 0, spent, skill: 'swire2_3' }); }, diff --git a/test/sim/feedback1d-push.test.js b/test/sim/feedback1d-push.test.js new file mode 100644 index 00000000..ff239ae2 --- /dev/null +++ b/test/sim/feedback1d-push.test.js @@ -0,0 +1,210 @@ +// Player feedback after 0.1.0, batch 4, workstream WM — D2 "干员野鬃的技能有时会把怪物往攻击方向相反方向推". +// +// Official: 野鬃 S2 夹枪冲锋 "攻击会把目标往攻击方向中等力度地推开" — the very wording of the 推击手 pushes (阿消 S1 / S2, 温蒂 S1, +// 食铁兽 S1, 见行者 S1: "往攻击方向…推开"), which PRTS 推与拉 calls 方向力 ("如果该目标被沿着设定的方向推动,则该力是方向力… +// 常见的推击手特种干员的推力即为此种力"): a push along her deploy direction, turned radial at 受力等级 −2 when the target +// is more than 45° off that direction or nearer than 0.25 tile ("特殊修正"). The remake pushed her targets radially at +// full force, so an enemy behind her centre — one that walked through her tile while her block was full and that she +// grabbed once a push freed it (the hand-over, DESIGN §19.2), or one coming at her back — was thrown 1.7–2.14 tiles +// the other way, towards the protection objective (real act2 m01 R5: 7 % of her pushes facing RIGHT, up to 42 % in +// other facings). Now: directional, so such a target moves at most the −2 distance (≤ 0.44 tile). +// Audit (direction only): 琳琅诗怀雅 S3's coin push "向前推开" is radial — PRTS 备注 "推开效果为径向推动" — and the remake +// pushed it along her facing (and at −2 off the 45° cone); now radial from her centre, full force. + +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { makeBattle, enemyRec } from '../helpers/battleHarness.js'; +import { getDefaultSource, hasGeneratedData } from '../../server/sim/simdata.js'; +import { PUSH_TILES, PUSH_DIRECTIONAL_MIN_DIST } from '../../server/sim/constants.js'; +import { rotateOffset, toLocal } from '../../server/sim/dir.js'; +import { Battle } from '../../server/sim/Battle.js'; +import { getData } from '../../server/data.js'; +import { GameData } from '../../server/match/gamedata.js'; +import { setupMatchWaves, buildNormalWave } from '../../server/match/waves.js'; +import { createRng } from '../../server/sim/rng.js'; + +const REAL = { skip: !hasGeneratedData() }; +const approx = (a, b, eps, msg) => assert.ok(Math.abs(a - b) <= eps, `${msg ?? ''} ${a} ≈ ${b}`); +const WILDMN = 'chess_char_1_19_a'; +const foe = (key, o = {}) => enemyRec({ key, hp: 1e8, speed: 0, atk: 0, ...o }); +const FULL = PUSH_TILES[0]; // 中力 (1) vs weight 1 = 受力等级 0 +const WEAK = PUSH_TILES[-2]; // the same push turned radial by the 特殊修正 (受力等级 −2) + +// her tile per facing on the flat stage: room ahead for a full push and behind for a short one +const HOME = { RIGHT: [10, 4], LEFT: [10, 7], UP: [10, 5], DOWN: [11, 5] }; + +/** + * 野鬃 (S2 ready) facing `dir`, one static weight-1 enemy at `off` = [dRow, dCol] from her centre in her facing-RIGHT + * frame. Returns the enemy's displacement by her first skill hit in that frame: { fwd, side, len }. + */ +function wildmnHit(dir, off, { side = 'L', kind = 'normal', mass = 1 } = {}) { + const [hr, hc] = HOME[dir]; + // the mirrored right half of a boss field: board (r, c) → field (r − 7, 20 − c), RIGHT ↔ LEFT + const fr = kind === 'boss' ? hr - 7 : hr, fc = side === 'R' ? 20 - hc : hc; + const fieldDir = side === 'R' ? { RIGHT: 'LEFT', LEFT: 'RIGHT', UP: 'UP', DOWN: 'DOWN' }[dir] : dir; + const [ar, ac] = rotateOffset(off[0], off[1], fieldDir); + let before = null, moved = null; + const h = makeBattle({ + kind, timeLimit: 30, autoFinish: false, hooks: [], + defs: { enemies: { enemy_t: foe('enemy_t', { mass }) } }, + players: [{ playerId: 'p1', seat: 0, side, colOffset: 0, units: [{ uid: 1, kind: 'chess', chessId: WILDMN, row: hr, col: hc, dir, carryState: { sp: 1e3 } }], bonds: {}, playerEffects: [] }], + enemies: [{ key: 'enemy_t', pos: [fr + ar, fc + ac] }], + setup(b) { + b.on('beforeAttack', (c) => { if (c.attacker.defId === WILDMN && c.isSkill && c.targets[0]) before = [c.targets[0].y, c.targets[0].x]; }, { priority: -2000 }); + b.on('attack', (c) => { if (c.attacker.defId === WILDMN && c.isSkill && before && !moved) moved = [c.targets[0].y - before[0], c.targets[0].x - before[1]]; }, { priority: -2000 }); + }, + }); + const u = h.unit(WILDMN); + assert.equal(u.dir, fieldDir, 'field direction'); + assert.ok(h.runUntil(() => moved != null, 6), `${side} ${dir} ${off}: a skill hit`); + const [lf, ll] = toLocal(moved[0], moved[1], fieldDir); // [left (+row in the RIGHT frame), forward] + return { fwd: ll, side: lf, len: Math.hypot(lf, ll) }; +} + +test('D2 野鬃 S2 pushes along her direction ("往攻击方向", the 推击手 wording) — straight ahead the full 中力 distance, every facing', REAL, () => { + const ds = getDefaultSource(); + assert.match(ds.rawChess(WILDMN).skill.desc, /往攻击方向/, 'data: the directional wording'); + assert.equal(ds.rawChess(WILDMN).skill.bb['attack@force'], 1, 'data: 中等力度 = 1'); + for (const dir of ['RIGHT', 'UP', 'LEFT', 'DOWN']) { + const m = wildmnHit(dir, [0, 0.7]); + approx(m.fwd, FULL, 1e-6, `${dir}: forward`); + approx(m.side, 0, 1e-9, `${dir}: no sideways`); + } +}); + +test('D2 野鬃 S2: a target within 45° of her direction goes straight along it (not radially sideways)', REAL, () => { + for (const dir of ['RIGHT', 'UP', 'LEFT', 'DOWN']) { + for (const lat of [0.3, -0.3]) { + const m = wildmnHit(dir, [lat, 0.6]); // 26.6° off, inside her block radius and her range (tile ahead) + approx(m.fwd, FULL, 1e-6, `${dir} ${lat}: along her direction`); + approx(m.side, 0, 1e-9, `${dir} ${lat}: no sideways (radial would be ${(FULL * lat / Math.hypot(lat, 0.6)).toFixed(2)})`); + } + } +}); + +test('D2 野鬃 S2: a target behind her, beside her (> 45° off) or on her centre — radial at 受力等级 −2, never a full throw backwards', REAL, () => { + for (const dir of ['RIGHT', 'UP', 'LEFT', 'DOWN']) { + // behind her centre (blocked by her, as after the hand-over): the user's case — it used to fly 1.7 tiles backwards + const back = wildmnHit(dir, [0, -0.45]); + approx(back.len, WEAK, 1e-6, `${dir} behind: the −2 distance`); + assert.ok(back.fwd < 0 && Math.abs(back.side) < 1e-9, `${dir} behind: radial (away from her)`); + // beside her, 63° off: radial, −2 + const beside = wildmnHit(dir, [0.6, 0.3]); + approx(beside.len, WEAK, 1e-6, `${dir} beside: the −2 distance`); + approx(beside.side / beside.len, 0.6 / Math.hypot(0.6, 0.3), 1e-6, `${dir} beside: radial`); + // nearer than 0.25 tile: radial, −2 + const near = wildmnHit(dir, [0.1, 0.1]); + assert.ok(Math.hypot(0.1, 0.1) < PUSH_DIRECTIONAL_MIN_DIST); + approx(near.len, WEAK, 1e-6, `${dir} near: the −2 distance`); + approx(near.side, near.fwd, 1e-6, `${dir} near: radial`); + } +}); + +test('D2 野鬃 S2 on the mirrored right half of the Final Assault field: the same pushes in its own direction', REAL, () => { + for (const dir of ['RIGHT', 'LEFT']) { + const ahead = wildmnHit(dir, [0, 0.7], { side: 'R', kind: 'boss' }); + approx(ahead.fwd, FULL, 1e-6, `R ${dir}: forward`); + approx(ahead.side, 0, 1e-9, `R ${dir}: no sideways`); + const diag = wildmnHit(dir, [0.3, 0.6], { side: 'R', kind: 'boss' }); + approx(diag.fwd, FULL, 1e-6, `R ${dir} diagonal: along its direction`); + approx(diag.side, 0, 1e-9, `R ${dir} diagonal: no sideways`); + const back = wildmnHit(dir, [0, -0.45], { side: 'R', kind: 'boss' }); + approx(back.len, WEAK, 1e-6, `R ${dir} behind: the −2 distance`); + assert.ok(back.fwd < 0, `R ${dir} behind: away from her`); + } +}); + +// --------------------------------------------------------------------------------------------------------------------- +// The real product path: the act2 m01 lane, the match's own R5 wave (server/match/waves.js), 野鬃 on the melee tiles +// next to the lower lane's last bend. Enemies walk through her tile while she holds one; when a push frees her block +// she grabs the one behind her centre — and threw it towards the objective. + +function realRun(chessId, r, c, dir, round = 5) { + const quiet = { warn() {}, error() {}, info() {}, debug() {} }; + const data = getData({ log: quiet }); + const modeId = 'mode_multi_normal'; + const gd = new GameData(data, modeId); + const setup = setupMatchWaves(gd, createRng(11 + round)); + const w = buildNormalWave(gd, createRng(11 + round + round), setup.factions, round); + const b = new Battle({ + seed: 7 + r * 31 + c, kind: 'normal', modeId, round, stageId: 'act2autochess_m01', timeLimit: w.timeLimit || 60, + routes: w.routes, spawns: w.spawns, enemyOverrides: w.overrides ?? {}, fieldId: 'n:P1', logger: quiet, + players: [{ playerId: 'P1', seat: 0, side: 'L', colOffset: 0, units: [{ uid: 1, kind: 'chess', chessId, row: r, col: c, dir }] }], + flags: { layerGainsEnabled: true, dpInit: 10, dpPerSec: 1, dpMax: 99 }, + }); + const u = b.allyUnits.find((x) => x.defId === chessId); + const pushes = []; + const orig = b.push.bind(b); + b.push = (e, force, o = {}) => { + if (o.from !== u) return orig(e, force, o); + const x0 = e.x, y0 = e.y, behind = (x0 - u.x) * u.fwd[1] + (y0 - u.y) * u.fwd[0] < 0; + const moved = orig(e, force, o); + if (moved > 1e-6) pushes.push({ dx: e.x - x0, dy: e.y - y0, moved, behind, massLevel: e.s.massLevel }); + return moved; + }; + for (let n = 0; !b.finished && n < 30 * 120; n++) b.step(); + return { u, pushes }; +} + +test('D2 real battle (act2 m01, R5 official wave): no push of 野鬃 throws an enemy behind her backwards further than the −2 distance', REAL, () => { + let behind = 0, total = 0; + for (const [r, c] of [[9, 3], [9, 4], [9, 5]]) { + for (const chessId of ['chess_char_1_19_a', 'chess_char_1_19_b']) { + const { u, pushes } = realRun(chessId, r, c, 'RIGHT'); + const [fr, fc] = u.fwd; + for (const p of pushes) { + total++; + const along = p.dx * fc + p.dy * fr; + if (p.behind) behind++; + // either straight along her direction, or the −2 radial push (受力等级 = 1 − weight − 2) + if (along < p.moved * (1 - 1e-6)) { + assert.ok(p.moved <= PUSH_TILES[-1] + 1e-6, `(${r},${c}) ${chessId}: off-direction push of ${p.moved.toFixed(2)} tiles (weight ${p.massLevel})`); + } + } + } + } + assert.ok(total > 50, `pushes ${total}`); + assert.ok(behind > 0, 'the hand-over case happens (an enemy grabbed behind her centre)'); +}); + +// --------------------------------------------------------------------------------------------------------------------- +// 琳琅诗怀雅 S3 千金一掷 — PRTS 备注 "金币弹道…推开效果为径向推动": the coin push is radial from her centre. + +function swireCoin(off, dir = 'RIGHT') { + const id = 'chess_char_3_04_a'; + const [hr, hc] = [10, 5]; + const [ar, ac] = rotateOffset(off[0], off[1], dir); + const h = makeBattle({ + timeLimit: 30, autoFinish: false, hooks: [], + defs: { enemies: { enemy_t: foe('enemy_t', { mass: 1 }) } }, + units: [{ chessId: id, row: hr, col: hc, dir, skillIndex: 2 }], + enemies: [{ key: 'enemy_t', pos: [hr + ar, hc + ac] }], + }); + const u = h.unit(id); + assert.equal(u.skill.id, 'skchr_swire2_3'); + h.step(); + const e = h.enemies()[0]; + assert.ok(u.skill.active || u.skill.activate('test', { free: true }), 'S3 on'); + u.mem.coins = 1; + const y0 = e.y, x0 = e.x; + u.skill.end('manual'); + const [ls, lf] = toLocal(e.y - y0, e.x - x0, dir); + return { fwd: lf, side: ls, len: Math.hypot(ls, lf) }; +} + +test('D2 audit: 琳琅诗怀雅 S3 coins push radially from her centre at full force (PRTS 备注 "推开效果为径向推动")', REAL, () => { + const ds = getDefaultSource(); + const s3 = ds.rawChess('chess_char_3_04_a').skills.find((s) => s.skillId === 'skchr_swire2_3'); + assert.equal(s3.bb.force, 0, 'data: 小力 (normal)'); + const full = PUSH_TILES[-1]; // 小力 (0) vs weight 1 + for (const dir of ['RIGHT', 'UP']) { + // 20.6° off her direction: radial, so partly sideways (the remake pushed it straight along her facing) + const a = swireCoin([0.3, 0.8], dir); + approx(a.len, full, 1e-6, `${dir} cone: full distance`); + approx(a.side / a.len, 0.3 / Math.hypot(0.3, 0.8), 1e-6, `${dir} cone: radial`); + // 66° off: radial at full force (the remake turned it into a −2 push: nothing at all) + const b = swireCoin([0.45, 0.2], dir); + approx(b.len, full, 1e-6, `${dir} beside: full distance`); + approx(b.side / b.len, 0.45 / Math.hypot(0.45, 0.2), 1e-6, `${dir} beside: radial`); + } +});