feedback2: merge WI — 归溟幽灵鲨's 替身 is drawn (form + status icon), makes no attack and casts nothing, S2's end switches her (GitHub #44)

This commit is contained in:
sganggs committed 2026-10-04 00:13:31 +08:00
commit 0ac7dc7dd2
17 files changed
+572 -67

No files matched your search

+16 -11
View File
@@ -29,7 +29,7 @@
// every MANUAL skill; AUTO skills never take a class row).
// - fx kinds emitted (battle.fx(kind, {x, y, id, …})): 'aoe' {r, skill}, 'healAoe' {r}, 'summon' {token}, 'anchor'
// {fromX, fromY, r}, 'teleport', 'zone' {r, duration}, 'iceSpike' {r}, 'extraAttack', 'downed', 'revive' {r},
// 'overload', 'ember', 'bloodBattle', 'reborn', 'candle', 'wake' {scale}, 'mote', 'hpShare', 'knockout', 'crit',
// 'overload', 'ember', 'bloodBattle', 'reborn', 'candle', 'wake' {scale}, 'mote', 'hpShare', 'crit',
// 'meltdown', 'soul', 'sleepGuard', 'weightless'; engine kinds used: 'dodge'.
import { COLS } from '../../constants.js';
@@ -1642,10 +1642,13 @@ const KITS = {
},
// ---------------------------------------------------------------------------------------------------------------
// 归溟幽灵鲨 — dollkeeper. S2 生存的渴望 (15/17 s): ATK/ASPD +, HP never below 1; afterwards she counts as knocked out
// (→ substitute, or death if already one). T1 拥抱自我: the substitute slows nearby enemies −40 % and deals 40 % ATK
// arts/s to them (PRTS 备注 "伤害与减速不可对空": ground enemies only). T2 阿戈尔的深邃: Abyssal Hunters in the team
// max HP +20 %. Module (elite): substitute ATK +15 %.
// 归溟幽灵鲨 — dollkeeper (professions.js installDollkeeper: the 替身 form, its switch animations, 阻回). Her <替身> makes
// no normal attack (PRTS 特性备注 "<替身>不进行普通攻击") and so casts no skill (kit trait `dollNoAttack`).
// S2 生存的渴望 (15/17 s): ATK/ASPD +, HP never below 1 (PRTS 备注: 不死 — a lethal hit does not switch her meanwhile);
// when it ends she switches to the 替身 at once (PRTS 修正 "技能结束后立刻切换为<替身>", the text's 视为被击倒: no lethal
// HP loss, so no 不死 / 复活 effect takes it). T1 拥抱自我: the 替身 slows nearby enemies −40 % and deals 40 % ATK
// arts/s to them (PRTS 备注 "伤害与减速不可对空": ground enemies only) — once it fights (not during its switch
// animation). T2 阿戈尔的深邃: Abyssal Hunters in the team max HP +20 %. Module (elite): substitute ATK +15 %.
// S1 生存的技巧 (duration): swaps HP ratios with the other operator of the skill area (周围) with the lowest HP ratio,
// ATK +. S3 生存的重压 (duration): BAT +1 s, hits every blocked enemy, ATK +, max HP +; an attacked enemy whose HP ratio
// is ≥ hers takes attack@atk_scale_ex × ATK phys more, otherwise she loses attack@hp_ratio of her max HP.
@@ -1685,21 +1688,23 @@ const KITS = {
skill: {
kind: 'duration',
mods: mods({ atkPct: num(bb.atk), aspd: num(bb.attack_speed) }),
// "技能结束后立刻切换为<替身>": nothing when the skill ended with her (death) or by her switch to the 替身, or she
// already is one
onEnd({ battle, unit, reason }) {
if (reason === 'death' || !unit.alive || !unit.deployed) return;
battle.fx('knockout', { x: unit.x, y: unit.y, id: unit.id });
battle.loseHp(unit, unit.hp + 1, { source: unit });
if (reason === 'death' || reason === 'substitute' || !unit.alive || !unit.deployed || unit.trait.doll) return;
battle.emit('dollSwitch', { unit, reason: 'skill', done: false });
},
},
trait: { dollNoAttack: true },
talents: [
{ install(battle, unit) { // 拥抱自我
{ install(battle, unit) { // 拥抱自我 (the 替身 fighting: not during a switch animation)
const slow = num(t0.move_speed), scale = num(t0.atk_scale);
whileOn(battle, unit, AURA_IV, () => {
if (!unit.trait.doll || !slow) return;
if (!unit.trait.doll || unit.trait.dollSwitch || !slow) return;
for (const e of battle.unitsInGrid(unit, aroundGrid, { side: 'enemy' })) if (!e.isFlying) battle.addBuff(e, { key: 'ghost2:embrace', duration: AURA_DUR, mods: { moveMul: Math.max(0, 1 + slow) } });
});
whileOn(battle, unit, 1, () => {
if (!unit.trait.doll || !(scale > 0)) return;
if (!unit.trait.doll || unit.trait.dollSwitch || !(scale > 0)) return;
for (const e of battle.unitsInGrid(unit, aroundGrid, { side: 'enemy' })) if (!e.isFlying) battle.dealDamage(unit, e, { amount: unit.s.atk * scale, type: 'arts', tags: ['talent', 'embrace'] });
});
} },
+82 -18
View File
@@ -22,6 +22,7 @@
// dmgMul(battle, unit, target) → number afterHit(battle, unit, target, {dealt,x,y})
// canAttack(battle, unit) → bool afterAttack(battle, unit, targets)
// hitsFn(battle, unit) → n install(battle, unit) — per-unit hooks, called once at setup
// dollNoAttack bool (傀儡师: its <替身> makes no normal attack and casts no skill — 归溟幽灵鲨, kit trait)
// tb — the unit's trait blackboard (data `trait.bb`), used for tunables (module upgrades included on elites)
// Behaviour per subprofession is documented in docs/SIM.md §Professions. Front / side tests use the unit's direction
// (`dir`, sim/dir.js): offsets are compared in its facing-RIGHT frame.
@@ -90,33 +91,96 @@ const installCharger = (battle, unit) => {
}, { owner: unit });
};
/**
* 傀儡师 (dollkeeper) trait "受到致命伤时不撤退,切换成<替身>作战(替身阻挡数为0),持续20秒后自身再次替换<替身>" with the
* branch rules of PRTS 分支特性信息 傀儡师: a lethal hit on the <本体> (one it survives with 不死 does not count) starts a
* switch animation, after which the operator fights as its <替身> for the trait's 20 s (bb duration) holding 阻回; then
* it switches back the same way. A switch animation clears the operator's Buffs and resets its HP to the max of the form
* it switches to; during one the operator holds 不死, 无敌, 阻回, 禁疗, 孤立, 强制缴械 and is immune to 眩晕 / 冻结 / 睡眠.
* The 替身 blocks nothing from the start of the switch to it until the switch back starts; a lethal hit on it knocks the
* operator out. Content may switch the operator at once (hook `dollSwitch` { unit, reason, done }: 归溟幽灵鲨 S2 "技能结束
* 后立刻切换为<替身>"). A kit's `dollNoAttack` profile flag (归溟幽灵鲨, PRTS 特性备注 "<替身>不进行普通攻击") disarms the 替身
* and keeps it from casting (the basic 技能策略 casts on an attack the 替身 never makes; [ASSUMED] every other rule — S1's
* 技能范围 — likewise); 风丸's 替身 attacks (PRTS: "<替身>状态下可对空").
* The form is the unit's model state (`unit.form` 'doll', snapshot.js unitInfo; fx 'substitute' / 'swap' / 'dollEnd' with
* `form`, shared/protocol.js fxForm): the client draws the 替身 on the skeleton's *_B clips (render/units.js FORMS).
* [ASSUMED]: a switch animation lasts DOLL_SWITCH (the skeletons' 1 s Start_B — the 替身 appearing — and Start_2 — the
* 本体 back); "清除自身一切Buff" ends the running skill and removes the statuses (buffs with a catalogue `status`) — the
* remake's bond / item / talent effects are buffs too and stay; a dollkeeper without a 替身 token of its own (归溟幽灵鲨) keeps
* its own max HP (PRTS: HP "重设…至最大值"; character_table has no 替身 of hers, and 风丸's 纸偶 token has her HP).
*/
export const DOLL_SWITCH = 1;
const DOLL_SWITCH_IMMUNE = new Set(['stun', 'freeze', 'sleep']);
const installDollkeeper = (battle, unit) => {
// the substitute's HP comes from the unit's own substitute token (风丸 纸偶) for its selected skill / module
// (DESIGN §16); a dollkeeper without one (归溟幽灵鲨) must not borrow another operator's token stats → 50 % of its
// own max HP
const dollHp = () => {
// the 替身's max HP comes from the unit's own 替身 token (风丸 纸偶) for its selected skill / module (DESIGN §16); a
// dollkeeper without one (归溟幽灵鲨) must not borrow another operator's token stats: its own max HP (header)
const dollHpMul = () => {
const tokId = (unit.def.tokens || []).map((t) => (typeof t === 'string' ? t : t?.tokenId)).find((t) => t && /shadow|doll/.test(t));
const tok = tokId ? battle.data.getToken?.(tokId, unit.defId, unit.def?.loadout ?? null) : null;
return tok && tok.stats.maxHp > 0 ? tok.stats.maxHp : unit.base.maxHp * 0.5;
return tok && tok.stats.maxHp > 0 ? Math.max(0.05, tok.stats.maxHp / Math.max(1, unit.base.maxHp)) : 1;
};
battle.on('fatal', (ctx) => {
if (ctx.unit !== unit || ctx.prevented || unit.trait.doll) return;
ctx.prevented = true;
unit.trait.doll = true;
const at = (extra) => ({ x: unit.x, y: unit.y, id: unit.id, ...extra });
// a switch animation: "切换动画开始时会清除自身一切Buff" (header: the running skill and the statuses), then 1 s of 不死
// (the fatal hook below) 无敌 阻回 禁疗 孤立 强制缴械 and 眩晕 / 冻结 / 睡眠 immunity (beforeStatus below)
const startSwitch = () => {
const sk = unit.skill;
if (sk && sk.active && sk.kind !== 'passive') sk.end('substitute');
for (const b of unit.buffs.slice()) if (b.status) battle.removeBuff(unit, b);
unit.trait.dollSwitch = true;
const done = () => { unit.trait.dollSwitch = false; };
battle.addBuff(unit, {
key: 'trait:substitute', duration: unit.profile.dollDuration ?? 20, visible: true,
mods: { blockCnt: -99, hpMul: Math.max(0.05, dollHp() / Math.max(1, unit.base.maxHp)) },
onExpire: () => {
unit.trait.doll = false;
if (unit.alive) { unit.markDirty(); unit.hp = unit.s.maxHp; battle.fx('swap', { x: unit.x, y: unit.y, id: unit.id }); }
},
key: 'trait:dollSwitch', duration: DOLL_SWITCH, onExpire: done, onRemove: done,
flags: { invulnerable: true, noSp: true, noHeal: true, isolated: true, disarm: true },
});
battle.releaseBlocked(unit);
};
const leave = () => {
if (!unit.trait.doll) return;
unit.trait.doll = false;
unit.form = null;
if (!unit.alive || !unit.deployed) return;
startSwitch();
unit.markDirty();
unit.hp = unit.s.maxHp;
battle.fx('substitute', { x: unit.x, y: unit.y, id: unit.id });
battle.fx('swap', at({ form: null }));
};
const enter = () => {
if (unit.trait.doll || !unit.alive || !unit.deployed) return false;
unit.trait.doll = true;
startSwitch();
const dur = DOLL_SWITCH + (unit.profile.dollDuration ?? 20);
const mul = dollHpMul();
battle.addBuff(unit, {
key: 'trait:substitute', duration: dur, visible: true, onExpire: leave, onRemove: leave,
mods: { blockCnt: -99, ...(mul !== 1 ? { hpMul: mul } : null) },
// 阻回 for the whole form; a 替身 that makes no normal attack casts no skill either (header)
flags: { noSp: true, ...(unit.profile.dollNoAttack ? { disarm: true, silence: true } : null) },
});
battle.releaseBlocked(unit);
unit.form = 'doll';
unit.markDirty();
unit.hp = unit.s.maxHp;
// `dur`: until the switch back (the client times the 替身's closing clip with it)
battle.fx('substitute', at({ form: 'doll', dur }));
return true;
};
battle.on('fatal', (ctx) => {
if (ctx.unit !== unit || ctx.prevented) return;
if (unit.trait.dollSwitch) { ctx.prevented = true; return; } // 不死 while switching (a 流失 ignores 无敌)
if (unit.trait.doll) return; // the 替身 is knocked out
ctx.prevented = enter();
}, { owner: unit, priority: -100 });
battle.on('death', (ctx) => { if (ctx.unit === unit) unit.trait.doll = false; }, { owner: unit });
battle.on('dollSwitch', (ctx) => { if (ctx.unit === unit && !ctx.done) ctx.done = enter(); }, { owner: unit });
battle.on('beforeStatus', (ctx) => {
if (ctx.target === unit && unit.trait.dollSwitch && DOLL_SWITCH_IMMUNE.has(ctx.status)) ctx.cancel = true;
}, { owner: unit });
battle.on('death', (ctx) => {
if (ctx.unit !== unit) return;
unit.trait.doll = false;
unit.trait.dollSwitch = false;
// knocked out as the 替身: its death clip has played (the 'die' event came first); the redeploy is the 本体 again
if (unit.form) { unit.form = null; battle.fx('dollEnd', at({ form: null })); }
}, { owner: unit });
};
const installLibrator = (battle, unit) => {
+5 -5
View File
@@ -2,9 +2,9 @@
//
// b.snap = { fieldId, t, units: [[id, x, y, hp, maxHp, sp, spMax, flags, anim]], dp, killed, total }
// UnitInfo = { id, kind, side, ownerId, defId, name, tier, golden, spine, avatar, x, y, facing, dir, maxHp, motion?, boss?, uid?,
// form?, skillIndex?, moduleId?, items? } (form = an enemy's current model form, content/enemies.js setForm — 掠海漂移体
// 'crawl', 暴鸰 'bombed', 转译基底·α's forms …: a view built after the change, a field opened mid-battle, draws it —
// render/units.js FORMS)
// form?, skillIndex?, moduleId?, items? } (form = the unit's current model form — an enemy's, content/enemies.js setForm:
// 掠海漂移体 'crawl', 暴鸰 'bombed', 转译基底·α's forms …; a 傀儡师 fighting as its 替身 'doll', professions.js — a view built
// after the change, a field opened mid-battle, draws it: render/units.js FORMS)
// dir = 'UP'|'RIGHT'|'DOWN'|'LEFT' (allies: the deploy direction, sim/dir.js); facing = its horizontal sign (±1).
// items = an ally operator's equipped item ids (absent without any).
// flags bits & anim codes come from shared/constants.js (UF / ANIM); an enemy's stealth bit = its 隐匿 is on (not while it
@@ -37,8 +37,8 @@ export function unitInfo(u) {
maxHp: Math.max(1, Math.round(u.s.maxHp)),
motion: u.motion === 'FLY' ? 'FLY' : undefined,
boss: u.isBoss ? true : undefined,
// an enemy's current model form (content/enemies.js setForm, render/units.js FORMS): a view built mid-battle
// (fieldMeta — a watched teammate's field, 联防 observers, a reconnect) starts on that clip set
// the unit's current model form (an enemy's content/enemies.js setForm, a 傀儡师's 替身 — render/units.js FORMS): a
// view built mid-battle (fieldMeta — a watched teammate's field, 联防 observers, a reconnect) starts on that clip set
form: typeof u.form === 'string' ? u.form : undefined,
uid: u.uid ?? undefined,
// DESIGN §16: the equipped skill's index (the renderer / audio pick that skill's Spine clip and sound)
+1 -1
View File
@@ -85,7 +85,7 @@ export class Unit {
this.stats = { dmg: 0, kills: 0, heal: 0, taken: 0, attacks: 0 };
this.hidden = false; // enemies inside a DISAPPEAR segment
this.moving = false; // enemies: walked this tick (drawn on the move clip; ai.js updateEnemy)
this.form = null; // enemies: the model's current form (content/enemies.js setForm → snapshot.js unitInfo)
this.form = null; // the model's current form (content/enemies.js setForm, a 傀儡师's 替身 'doll' → snapshot.js unitInfo)
this.anim = 0;
this.persist = { redeployMul: 1, freeRedeploys: 0 };
this.isBoss = false;