feedback4: a skill restarted inside its own end owns its events — Skill.end emits no trailing skillEnd / client 'skill off' when onEnd re-activated it (耀骑士临光 S2 retreats at its duration end and 不屈 redeploys her inside that call: the trailing skillEnd cleared 骑士戒律 for the whole second cast, a PR #109 regression); 伊内丝's 影哨 death hooks run before 不屈's redeploy (priority 20 over 10), so the next deployment's S3 recalls the sentry she left (0.1.4 release review); test/sim/feedback4-restart-in-end.test.js, each case fails without its fix; golden unchanged

This commit is contained in:
sganggs committed 2026-10-06 00:12:26 +08:00
1 parent cea1ad1295
commit 47789aba8d
3 files changed
+62 -5

No files matched your search

+4 -2
View File
@@ -575,11 +575,12 @@ const kits = {
} },
{ install(battle, unit) { // 影哨: reveal + −30 % move speed in range; a sentry keeps it after she leaves (max 1)
const mods = { moveMul: Math.max(0, 1 + num(t1.move_speed, -0.3)) };
// priority 20: before 不屈's redeploy (death priority 10), whose deployment starts S3 and its recall
battle.on('death', (c) => {
if (c.unit !== unit || c.reason === 'expired') return;
unit.mem.sentry = new Set(unit.baseRangeKeys || unit.rangeKeys || []);
battle.fx('sentry', { x: unit.x, y: unit.y, id: unit.id });
}, { owner: unit });
}, { owner: unit, priority: 20 });
battle.every(AURA, () => {
const set = new Set();
if (unit.alive && unit.deployed) for (const k of unit.rangeKeys || []) set.add(k);
@@ -608,7 +609,8 @@ const kits = {
}, { owner: unit });
}, { owner: unit });
// where the talent's 影哨 stays (every leave but an expiry), for the recall of the next deployment
battle.on('death', (c) => { if (c.unit === unit && c.reason !== 'expired') unit.mem.inesSentryAt = { x: unit.x, y: unit.y }; }, { owner: unit, priority: 5 });
// (priority 20: recorded before 不屈's redeploy at death priority 10 starts the next deployment's S3 and its recall)
battle.on('death', (c) => { if (c.unit === unit && c.reason !== 'expired') unit.mem.inesSentryAt = { x: unit.x, y: unit.y }; }, { owner: unit, priority: 20 });
// 技能期间每对一个敌人造成伤害就获得1点部署费用
battle.on('damaged', (c) => {
if (c.source !== unit || c.target.side !== 'enemy' || !(c.amount > 0) || c.type === 'element' || !unit.skill?.active || !(unit.skill.timeLeft > 0)) return;
+7 -3
View File
@@ -503,8 +503,8 @@ export class SkillRuntime {
/**
* End the active skill. onEnd runs while the skill's mods / range are still applied (end-of-skill effects — finishers,
* bombardments — use the skill's stats and range; `active` is already false), then they are removed (kept when onEnd
* re-activated the skill), then `skillEnd` fires.
* bombardments — use the skill's stats and range; `active` is already false), then they are removed and `skillEnd`
* fires — neither when onEnd re-activated the skill (the new cast owns both).
*/
end(reason = 'end') {
if (!this.active || this.kind === 'passive' && reason !== 'death') return;
@@ -517,7 +517,11 @@ export class SkillRuntime {
this.ammoMax = 0;
const n = this.activations;
this._call('onEnd', { reason });
if (!this.active && this.activations === n) this._removeMods();
// onEnd started the next cast (耀骑士临光 S2 retreats on its duration end and 不屈 redeploys her inside that call; the
// deploy-timed skill starts again, PR #109): that cast owns the mods and its events — a trailing skillEnd would make
// listeners (骑士戒律) clear the new cast and the client would see the skill off while it runs
if (this.active || this.activations !== n) return;
this._removeMods();
if (b._hooks.skillEnd) b.emit('skillEnd', { unit: u, skill: this, reason });
if (this.kind !== 'passive') b._ev(['skill', u.id, 0]);
}