Seen (community report 「蕾缪安3技能范围里没人好像会自动结束」, relayed by the owner): with S3 locking, the locked enemy
killed or walking out of her range and nobody else in it, the skill ended at the next lock tick — the shells fell at
once and the bullets left were thrown away (repro on 0255afd: 3 of 5 bullets lost; a walker leaving her range, 1 lost).
Cause: chess_char_6_01-lemuen.js:169 `if (!e) { if (m.lemLocks.length) skill.end('ammo'); return; }`, there since the
initial import with no decision behind it.
Official: 「攻击装有5发弹药,打完后结束(可随时停止技能)」 — an ammo skill ends when its bullets are spent or the player
stops it; PRTS 卫戍协议/帮助 技能操作 「通常不会自动关闭技能」 (only 玛露希尔's 召唤使魔 is closed automatically); the client
(charpack char_4193_lemuen, buff_template_data lemuen_s_3): the S3 lock is an attack that needs a target and the skill
buff switches to the bombardment mode on ON_BUFF_FINISH only.
Now: with nothing to lock the skill waits (bullets and locks kept, the marks following their enemies or staying where
they left), its lock ready, so the next enemy in range (or 通缉) is locked on the next tick; it ends when the bullets are
spent and the shells fall on every mark in lock order as before. The S3 'lock' fx carry `hold`: render/fx/locks.js keeps
those reticles while the shooter's skill bit (UF.SKILL) is on and starts their LOCK_T at the skill's end (they faded 5 s
into a wait otherwise); S2's aim lock keeps its timeout.
Golden — traced on both trees (SkillRuntime start / end, the round's fields, the carried SP); in each the first
divergence is an S3 the parent ended with bullets left and nothing in her range:
- roster-018: the elite 蕾缪安's S3 of 7.63 s ended at 9.63 s with 2 of 6 bullets left; now the 6th goes at 12.00 s
(first differing snapshot window 0–10 s).
- boss-boss_3-pair: her S3 of 27.8 s ended at 30.3 s with 4 of 9 left; now all 9 by 34.43 s (window 30–40 s); the boss
now falls at 199.53 s instead of the 200 s cap.
- coop2-NORMAL-14-standins: ai_0's 蕾缪安 in round 11 ended S3 at 17.2 s (6 of 8 left) and 77.97 s (7 of 9); now she
spends them, enters the 联防 with 25.96 SP instead of 10.27, casts S3 there and kills one more of h_0's leaked enemies:
h_0 loses 1 LP less (rounds 11–12 LP 18 → 19, 8 → 9; lpLost 30 → 29; ai_0 kills +1).
bonds, standins, diy unchanged.
Tests: test/sim/feedback5-lemuen-s3-wait.test.js (3; the killed target and the walker who leaves fail on the parent),
test/render/fxproj.test.js +1 (a held lock waits while the skill bit is on; fails on the parent renderer).
Docs: CHANGELOG 0.2.0 规则(按官方), docs/history/0.2.0.md §25.22.8 (also notes, unchanged: S2 spends a bullet on every
normal attack where PRTS says only the 通缉 snipe does — left to the owner).
110 lines
4.8 KiB
JavaScript
110 lines
4.8 KiB
JavaScript
// public/js/render/fx/locks.js — FxSystem lock reticles.
|
|
// Installed on FxSystem.prototype by ./system.js (a method container: never instantiated; `this` is the effect system).
|
|
|
|
import { SHOT_HEIGHT, bodyZ } from './camera.js';
|
|
import { FX_KINDS } from './kinds.js';
|
|
import { easeOut } from './limits.js';
|
|
import { UF } from '../../../../shared/constants.js';
|
|
|
|
/**
|
|
* Lock reticle: how long (game s) a lock outlives the last sign of its shooter's S3 going on — its latest lock, shell or
|
|
* bombard (a lock whose shell / shot never comes) — its fade-out (real s), and the most reticles kept at once (a long
|
|
* S3: ammo grants / reloads lock far more than the 5 base shots, ≤ 33 shells).
|
|
*/
|
|
const LOCK_T = 5, LOCK_FADE = 0.2, MAX_LOCKS = 48;
|
|
|
|
export class FxLocks {
|
|
// ---- lock-on reticles (蕾缪安) -------------------------------------------------------------------------------
|
|
|
|
/**
|
|
* fx 'lock': a reticle on the locked enemy (following its view; at the last spot once it is gone) until its shell
|
|
* lands (mortar / _landed) or the aimed shot fires ('crit' from the same shooter); at most LOCK_T game seconds after
|
|
* the shooter's last lock / shell / bombard (_touchLocks). A held lock (`hold`: 蕾缪安 S3, whose skill waits with its
|
|
* bullets and locks while nothing is in range) waits as long as its shooter's skill runs (the view's UF.SKILL), its
|
|
* LOCK_T counted from the skill's end.
|
|
*/
|
|
_lock(view, src, x, y, z, hold = false) {
|
|
let L = this.lockFree.pop();
|
|
if (!L) {
|
|
const P = this.P;
|
|
const ring = new P.Sprite(this.tex.reticle);
|
|
ring.anchor.set(0.5);
|
|
ring.blendMode = P.BLEND_MODES.ADD;
|
|
const core = new P.Sprite(this.tex.glow);
|
|
core.anchor.set(0.5);
|
|
core.blendMode = P.BLEND_MODES.ADD;
|
|
this.projLayer.addChild(ring, core);
|
|
L = { ring, core };
|
|
}
|
|
L.view = view; L.id = view ? view.id : null; L.src = src ?? null; L.x = x; L.y = y; L.z = z;
|
|
L.t = 0; L.idle = 0; L.max = LOCK_T / this._ts(); L.out = -1; L.shell = false; L.sx = x; L.sy = y; L.hold = !!hold;
|
|
L.ring.tint = L.core.tint = FX_KINDS.lock.c;
|
|
L.ring.alpha = L.core.alpha = 0;
|
|
L.ring.visible = L.core.visible = true;
|
|
this.locks.push(L);
|
|
if (this.locks.length > MAX_LOCKS) this._freeLock(this.locks.shift());
|
|
return L;
|
|
}
|
|
|
|
/** Shooter `src` is still at it (a new lock, a shell, a bombard): its live locks restart their LOCK_T wait. */
|
|
_touchLocks(src) {
|
|
if (src == null) return;
|
|
for (const L of this.locks) if (L.src === src) L.idle = 0;
|
|
}
|
|
|
|
/** The live lock of shooter `src` nearest to (x, y) within `within` tiles (`free`: only one no shell took yet). */
|
|
_nearestLock(src, x, y, within, free) {
|
|
let best = null, bd = Infinity;
|
|
for (const L of this.locks) {
|
|
if (L.out >= 0 || (free && L.shell) || (src != null && L.src != null && L.src !== src)) continue;
|
|
const d = Math.hypot(L.x - x, L.y - y);
|
|
if (d < bd - 1e-9) { bd = d; best = L; }
|
|
}
|
|
return best && bd <= within ? best : null;
|
|
}
|
|
|
|
/** Fade a lock out (it pops outwards as it goes). */
|
|
_releaseLock(L) { if (L && L.out < 0) L.out = 0; }
|
|
|
|
_freeLock(L) {
|
|
L.ring.visible = L.core.visible = false;
|
|
L.view = null;
|
|
this.lockFree.push(L);
|
|
}
|
|
|
|
_updateLocks(dt) {
|
|
if (!this.locks.length) return;
|
|
const cam = this.ctx.cam();
|
|
let w = 0;
|
|
for (const L of this.locks) {
|
|
L.t += dt;
|
|
L.idle += dt;
|
|
if (L.out < 0 && L.idle >= L.max) L.out = 0;
|
|
// the shooter knocked out / withdrawn: the sim fires no more shells — only a shell already in the air still lands;
|
|
// a held lock waits while its shooter's skill runs (蕾缪安 S3 with nothing in range: its bullets and locks wait)
|
|
if (L.out < 0 && !L.shell && L.src != null && this.ctx.view) {
|
|
const sv = this._viewOf(L.src);
|
|
if (!sv || sv.alive === false) L.out = 0;
|
|
else if (L.hold && (sv.flags & UF.SKILL)) L.idle = 0;
|
|
}
|
|
if (L.out >= 0) { L.out += dt; if (L.out >= LOCK_FADE) { this._freeLock(L); continue; } }
|
|
const v = L.view;
|
|
if (v && !v.destroyed && v.alive !== false) { L.x = v.x; L.y = v.y; L.z = bodyZ(cam, v, SHOT_HEIGHT.aim); }
|
|
const p = cam.project(L.x, L.y, L.z, this._p);
|
|
const s = p.s;
|
|
const out = L.out >= 0 ? L.out / LOCK_FADE : 0;
|
|
const pop = L.t < 0.16 ? 1.7 - 0.7 * easeOut(L.t / 0.16) : 1 + 0.05 * Math.sin(L.t * 9);
|
|
const a = (L.out >= 0 ? 1 - out : Math.min(1, L.t / 0.06));
|
|
L.ring.position.set(p.x, p.y);
|
|
L.ring.rotation = L.t * 1.8;
|
|
L.ring.scale.set((s * 0.95 * pop * (1 + out * 0.6)) / 128);
|
|
L.ring.alpha = 0.95 * a;
|
|
L.core.position.set(p.x, p.y);
|
|
L.core.scale.set(((s * 0.4) / 128) * (1 + 0.25 * Math.sin(L.t * 14)));
|
|
L.core.alpha = 0.7 * a;
|
|
this.locks[w++] = L;
|
|
}
|
|
this.locks.length = w;
|
|
}
|
|
}
|