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

+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]);
}