Deploy-timed skills run the normal duration lifecycle: one charge on deployment, a duration bar, a real end, again on the next deployment (#109)
宴 S2, 斯卡蒂 S2, 野鬃 S1, 砾 S1 / S2, 伊内丝 S3, 缄默德克萨斯 S1–S3 and 耀骑士临光 S2 used a separate timed buff while the skill stayed active; equipment and bond effects that read the skill state now see it end. 伊内丝's first sentry placement starts no skill. Contributed by @Sukvii.
This commit is contained in:
1 parent
ede8e7e773
commit
ffdb1293c4
22 files changed
+607
-104
No files matched your search
@@ -71,6 +71,28 @@ test('迅捷: member skill end +12 SP (p=1 at high L), ≥40 layers every operat
|
||||
assert.equal(off.s_x, 0);
|
||||
});
|
||||
|
||||
test('迅捷 / 突袭: SP gifts after end do not recharge a zero-SP deployment skill or trigger a ready raid', () => {
|
||||
const h = makeBattle({
|
||||
defs: { chess: { t_deploy: chessRec({ id: 't_deploy', bonds: ['swiftShip', 'raidShip'], skill: { spCost: 0 } }) } },
|
||||
units: [{ chessId: 't_deploy', row: 10, col: 4 }],
|
||||
bonds: { swiftShip: bond(1, 1000), raidShip: bond(1) }, captureNoisy: true,
|
||||
kits: { t_deploy: () => ({ skill: {
|
||||
kind: 'duration', activateOnDeploy: true, duration: 2, spCost: 0, spType: 'none', trigger: 'NEVER',
|
||||
} }) },
|
||||
});
|
||||
h.b.start();
|
||||
const u = h.unit('t_deploy'), seq = u.deploySeq;
|
||||
h.run(5);
|
||||
assert.deepEqual(h.hooksOf('skillEnd').map((c) => c.reason), ['duration']);
|
||||
assert.ok(h.hooksOf('spGain').some((c) => c.unit === u), 'swift end handler attempted SP gain');
|
||||
assert.equal(u.skill.sp, 0);
|
||||
assert.equal(u.skill.charges, 0);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(u.skill.activations, 1);
|
||||
assert.equal(u.deploySeq, seq, 'skill end alone does not meet raid readiness');
|
||||
checkInvariants(h.b);
|
||||
});
|
||||
|
||||
test('迅捷 / 不屈 proc chances: p = min(1, base + per·L) at each layer count', () => {
|
||||
const sw = bondBb('swiftShip'), ind = bondBb('indomShip');
|
||||
close(procChance(sw, 0), 0.20);
|
||||
|
||||
@@ -165,6 +165,24 @@ test('炎国短刀: each skill activation ATK +5 % / +8 % (one multiplier), at m
|
||||
}
|
||||
});
|
||||
|
||||
test('炎国短刀: timed deployment skill adds one stack per deployment, including carry.skillActive', () => {
|
||||
const id = 'chess_char_1_19_a';
|
||||
for (const [item, per] of [[A('3_04'), 0.05], [B('3_04'), 0.08]]) {
|
||||
const h = makeBattle({ units: [{ chessId: id, row: 10, col: 4, skillIndex: 0, items: [item], carryState: { skillActive: true } }] });
|
||||
h.b.start();
|
||||
const u = h.unit(id);
|
||||
assert.equal(u.skill.activations, 1);
|
||||
close(u.s.atk, u.base.atk * (1 + per), 'one deployment stack');
|
||||
h.run(u.skill.duration + 1);
|
||||
close(u.s.atk, u.base.atk * (1 + per), 'no extra stack on end');
|
||||
h.b.retreat(u);
|
||||
assert.ok(h.b.redeploy(u, { free: true }));
|
||||
assert.equal(u.skill.activations, 2);
|
||||
close(u.s.atk, u.base.atk * (1 + per * 2), 'one more on redeployment');
|
||||
checkInvariants(h.b);
|
||||
}
|
||||
});
|
||||
|
||||
test('迅捷作战粮: on deploy SP +3 / +6, plus as much per other operator sharing a bond', () => {
|
||||
for (const [id, each] of [[A('3_05'), 3], [B('3_05'), 6]]) {
|
||||
const ops = { t_op: op('t_op', { bonds: ['swiftShip'] }), t_a: op('t_a', { bonds: ['swiftShip'] }), t_b: op('t_b', { bonds: ['yanShip'] }) };
|
||||
|
||||
@@ -444,6 +444,8 @@ test('1_18 宴 S1 分神: no attacks, block 0 (releases), DEF +def, regenerates
|
||||
assert.equal(u.s.blockCnt, 0);
|
||||
assert.equal(u.blocking.length, 0);
|
||||
assert.equal(e.blockedBy, null, 'blocked enemy released');
|
||||
h.b.dealDamage(u, e, { amount: 100, type: 'phys', isAttack: true });
|
||||
assert.equal(dealt(h, u).at(-1).type, 'phys', 'active S1 does not inherit S2 arts conversion');
|
||||
approx(u.s.def, u.base.def * (1 + bb.def), `${id} DEF`);
|
||||
approx(u.s.hpRegen, u.s.maxHp * bb.hp_recovery_per_sec_by_max_hp_ratio, 'regen');
|
||||
u.hp = u.s.maxHp * 0.3;
|
||||
@@ -462,23 +464,71 @@ test('1_18 宴 S1 分神: no attacks, block 0 (releases), DEF +def, regenerates
|
||||
}
|
||||
});
|
||||
|
||||
test('1_19 野鬃 S1 骑枪刺击 (PASSIVE): ASPD +attack_speed for `duration` s after every deployment', () => {
|
||||
test('1_18 宴 S2: deployment loses current HP once; ATK and normal-attack arts conversion end with the duration', () => {
|
||||
for (const id of pair('18')) {
|
||||
const s = rec(id, 'skchr_utage_2'), bb = s.bb;
|
||||
const h = run({ defs: { chess: noGarrison(id), enemies: { e: dummy('e') } },
|
||||
units: [entry(id, s.skillId, { row: 10, col: 4, carryState: { hpPct: 0.5, skillActive: true } })] });
|
||||
h.b.start();
|
||||
const u = h.unit(id);
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.activations, 1);
|
||||
assert.equal(u.skill.charges, 0);
|
||||
approx(u.hp, u.s.maxHp * 0.5 * (1 - bb.hp_ratio), 'one loss from carried current HP');
|
||||
approx(u.s.atk, u.base.atk * (1 + bb.atk));
|
||||
const e = h.spawn('e', { pos: [10, 8] });
|
||||
const hit = () => { h.b.dealDamage(u, e, { amount: 100, type: 'phys', isAttack: true }); return dealt(h, u).at(-1); };
|
||||
assert.equal(hit().type, 'arts');
|
||||
assert.ok(!hit().dmg.isSkill, 'normal attack marker retained');
|
||||
h.run(bb.duration / 2);
|
||||
approx(u.skill.timeLeft, bb.duration / 2);
|
||||
h.run(bb.duration / 2 + 0.1);
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.ready, false);
|
||||
approx(u.s.atk, u.base.atk);
|
||||
assert.equal(hit().type, 'phys');
|
||||
assert.deepEqual(ended(h, u).map((c) => c.reason), ['duration']);
|
||||
const hp = u.hp;
|
||||
h.run(3);
|
||||
approx(u.hp, hp, 'no second loss while staying deployed');
|
||||
h.b.retreat(u);
|
||||
assert.ok(h.b.redeploy(u, { free: true }));
|
||||
assert.equal(u.skill.activations, 2);
|
||||
approx(u.hp, u.s.maxHp * (1 - bb.hp_ratio), 'new deployment loses current HP once');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
test('1_19 野鬃 S1 骑枪刺击: ASPD +attack_speed for `duration` s after every deployment', () => {
|
||||
for (const id of pair('19')) {
|
||||
const s = rec(id, 'skchr_wildmn_1');
|
||||
const h = run({ defs: { chess: noGarrison(id) }, units: [entry(id, s.skillId, { row: 9, col: 5 })] });
|
||||
const u = sel(h, id, s.skillId);
|
||||
assert.equal(u.skill.kind, 'passive');
|
||||
h.step();
|
||||
h.b.start();
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.active, true);
|
||||
assert.equal(u.skill.activations, 1);
|
||||
assert.equal(u.skill.charges, 0);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(started(h, u)[0].reason, 'deploy');
|
||||
approx(u.s.aspd, u.base.aspd + s.bb.attack_speed, `${id} ASPD after deployment`);
|
||||
h.run(s.duration - 0.5);
|
||||
h.run(s.duration / 2);
|
||||
approx(u.skill.timeLeft, s.duration / 2);
|
||||
assert.deepEqual(h.snapshot().units.find((t) => t[0] === u.id).slice(5, 7), [s.duration / 2, s.duration]);
|
||||
h.run(s.duration / 2 - 0.5);
|
||||
approx(u.s.aspd, u.base.aspd + s.bb.attack_speed, 'still up');
|
||||
h.run(1);
|
||||
approx(u.s.aspd, u.base.aspd, `expired after ${s.duration} s`);
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.deepEqual(ended(h, u).map((c) => c.reason), ['duration']);
|
||||
h.b.kill(u, null);
|
||||
h.step();
|
||||
assert.ok(h.b.redeploy(u, { free: true }));
|
||||
h.step();
|
||||
approx(u.s.aspd, u.base.aspd + s.bb.attack_speed, 'again after the redeployment');
|
||||
assert.equal(u.skill.activations, 2);
|
||||
assert.equal(ended(h, u).length, 1, 'expired skill does not end again on death');
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -342,12 +342,20 @@ test('2_12 砾 S1 影袭: at deployment DEF +def decaying to 0 over `duration` s
|
||||
h.run(0.5);
|
||||
approx(u.s.def, u.base.def * (1 + aura + bb.def), `${id} full bonus`);
|
||||
assert.equal(u.s.shield, 0, 'no 鼠群 barrier');
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.active, true);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(h.snapshot().units.find((t) => t[0] === u.id)[6], bb.duration);
|
||||
h.run(1);
|
||||
approx(u.s.def, u.base.def * (1 + aura + bb.def * (bb.duration - 1) / bb.duration), 'one step down after 1 s');
|
||||
h.run(0.4);
|
||||
approx(u.s.def, u.base.def * (1 + aura + bb.def * (bb.duration - 1) / bb.duration), 'steps once per second');
|
||||
h.run(bb.duration);
|
||||
approx(u.s.def, u.base.def * (1 + aura), 'gone');
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(u.findBuff('gravel:shadow'), null);
|
||||
assert.equal(h.hooksOf('skillEnd').filter((c) => c.unit === u && c.reason === 'duration').length, 1);
|
||||
done(h);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -368,19 +368,34 @@ test('3_05 斯卡蒂 S1 迅捷打击·γ型 ATK/ASPD; S2 跃浪击 ATK + for `du
|
||||
const g = makeBattle({ timeLimit: 60, units: [U(id, 'skchr_skadi_2', 10, 4)] });
|
||||
const v = g.unit(id);
|
||||
g.step();
|
||||
assert.equal(v.skill.kind, 'passive');
|
||||
assert.equal(v.skill.kind, 'duration');
|
||||
assert.equal(v.skill.active, true);
|
||||
assert.equal(v.skill.charges, 0);
|
||||
assert.equal(v.skill.ready, false);
|
||||
assert.equal(g.hooksOf('skillStart')[0].reason, 'deploy');
|
||||
approx(v.s.atk, v.base.atk * (1 + b2.atk + own));
|
||||
if (id.endsWith('_b')) {
|
||||
const left = v.skill.timeLeft;
|
||||
g.b.dealDamage(null, v, { type: 'true', amount: 1e7 });
|
||||
assert.equal(v.alive, true, 'DRE-Y revives in place during the window');
|
||||
assert.equal(v.skill.activations, 1);
|
||||
approx(v.skill.timeLeft, left, 1e-9, 'revival preserves the remaining skill time');
|
||||
}
|
||||
g.run(b2.duration - 0.5);
|
||||
approx(v.s.atk, v.base.atk * (1 + b2.atk + own));
|
||||
g.run(1);
|
||||
approx(v.s.atk, v.base.atk * (1 + own), 1e-6, 'gone after its duration');
|
||||
assert.equal(v.skill.active, false);
|
||||
assert.equal(v.skill.ready, false);
|
||||
assert.deepEqual(g.hooksOf('skillEnd').map((c) => c.reason), ['duration']);
|
||||
// redeployed ⇒ again
|
||||
g.b.dealDamage(null, v, { type: 'true', amount: 1e7 });
|
||||
if (!v.alive) {
|
||||
g.b.redeploy(v, { free: true });
|
||||
g.step();
|
||||
approx(v.s.atk, v.base.atk * (1 + b2.atk + own), 1e-6, 'every deployment');
|
||||
}
|
||||
assert.equal(v.skill.activations, 1, 'DRE-Y in-place revival does not deploy or restart S2');
|
||||
if (v.alive) g.b.retreat(v);
|
||||
assert.ok(g.b.redeploy(v, { free: true }));
|
||||
approx(v.skill.timeLeft, b2.duration);
|
||||
assert.equal(v.skill.activations, 2);
|
||||
approx(v.s.atk, v.base.atk * (1 + b2.atk + own), 1e-6, 'every deployment');
|
||||
done(g);
|
||||
}
|
||||
// DRE-X: ×atk_scale on blocked enemies; no DRE-Y revive
|
||||
|
||||
@@ -265,6 +265,13 @@ test('伊内丝 S3 独影归途: first deployment leaves a sentry and retreats;
|
||||
const sk = D(id, 2).skill, bb = sk.bb;
|
||||
const h = battle([U(id, 10, 5, 2)], { flags: { dpInit: 99, dpPerSec: 0 } });
|
||||
const u = h.unit(id);
|
||||
h.b.start();
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.active, false, 'first deployment does not activate the skill');
|
||||
assert.equal(u.skill.activations, 0);
|
||||
assert.equal(h.hooksOf('skillStart').filter((c) => c.unit === u).length, 0, 'placing a sentry emits no skillStart');
|
||||
assert.equal(u.skill.timeLeft, 0, 'first deployment places the sentry without a full effect window');
|
||||
assert.equal(u.findBuff('ines:s3'), null);
|
||||
const near = [];
|
||||
for (let i = 0; i < 3; i++) near.push(h.spawn('enemy_dummy', { pos: [10, 6] }), h.spawn('enemy_dummy', { pos: [10, 4] }));
|
||||
const far = h.spawn('enemy_dummy', { pos: [10, 8] });
|
||||
@@ -273,9 +280,14 @@ test('伊内丝 S3 独影归途: first deployment leaves a sentry and retreats;
|
||||
assert.ok(left && left.reason === 'retreat', `${id}: leaves right after the first deployment`);
|
||||
assert.ok(h.runUntil(() => u.alive && u.deployed, 2), 'redeploy timer refreshed: back at once');
|
||||
const buff = u.findBuff('ines:s3');
|
||||
assert.ok(buff, 'passive buff on the redeploy');
|
||||
assert.ok(buff, 'ATK effect on the redeploy');
|
||||
approx(buff.mods.atkPct, bb.atk, 1e-9);
|
||||
approx(buff.timeLeft, sk.duration, 0.1);
|
||||
approx(u.skill.timeLeft, sk.duration, 0.1);
|
||||
assert.equal(u.skill.active, true);
|
||||
assert.equal(u.skill.activations, 1);
|
||||
assert.equal(h.hooksOf('skillStart').filter((c) => c.unit === u).length, 1, 'the redeployment starts the skill once');
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(h.snapshot().units.find((t) => t[0] === u.id)[6], sk.duration);
|
||||
const recall = dmgBy(h, u, tagged('sentryRecall'));
|
||||
assert.equal(recall.length, bb.max_target, `${id}: recall hits ≤ ${bb.max_target} of 6`);
|
||||
assert.ok(recall.every((c) => near.includes(c.target)) && !recall.some((c) => c.target === far));
|
||||
@@ -287,6 +299,15 @@ test('伊内丝 S3 独影归途: first deployment leaves a sentry and retreats;
|
||||
assert.ok(hits > 0);
|
||||
assert.equal(h.b.getPlayer('p1').dp, dpAt + hits * bb.cost, 'one DP per damage while the passive lasts');
|
||||
assert.equal(h.hooksOf('death').filter((c) => c.unit === u).length, 1, 'only the first deployment leaves');
|
||||
h.run(sk.duration);
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(u.findBuff('ines:s3'), null);
|
||||
const dpEnd = h.b.getPlayer('p1').dp;
|
||||
h.run(2);
|
||||
assert.equal(h.b.getPlayer('p1').dp, dpEnd, 'no skill DP after the actual window ends');
|
||||
assert.equal(h.hooksOf('death').filter((c) => c.unit === u).length, 1, 'stays deployed after the window');
|
||||
assert.deepEqual(h.hooksOf('skillEnd').filter((c) => c.unit === u).map((c) => c.reason), ['duration']);
|
||||
checkInvariants(h.b);
|
||||
}
|
||||
});
|
||||
@@ -611,10 +632,11 @@ test('缄默德克萨斯 S1 细雨无声: passive ATK up for its duration; hits
|
||||
const h = battle([U(id, 10, 4, 0)]);
|
||||
h.step();
|
||||
const u = h.unit(id);
|
||||
const buff = u.findBuff('texas2:drizzle');
|
||||
assert.ok(buff, `${id}: passive active on deployment`);
|
||||
approx(buff.mods.atkPct, bb.atk, 1e-9);
|
||||
assert.ok(u.findBuff('texas2:rainAtk'), 'talent 德克萨斯传统 ATK during the passive');
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.active, true);
|
||||
assert.equal(u.skill.charges, 0);
|
||||
approx(u.skill.spec.mods.atkPct, bb.atk + D(id, 0).talents[0].bb.atk, 1e-9, 'skill and 德克萨斯传统 ATK');
|
||||
assert.equal(h.snapshot().units.find((t) => t[0] === u.id)[6], sk.duration);
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 5] });
|
||||
h.run(3);
|
||||
assert.ok(e.s.flags.silence, 'hit target silenced (失去特殊能力)');
|
||||
@@ -623,7 +645,10 @@ test('缄默德克萨斯 S1 细雨无声: passive ATK up for its duration; hits
|
||||
assert.ok(dot.length >= 2, `a DoT tick every second although she re-hits faster (${dot.length})`);
|
||||
for (const c of dot) approx(c.amount, bb['attack@texas2_s_1[dot].dot_damage'], 1e-9, 'fixed arts per second (RES 0)');
|
||||
h.run(sk.duration);
|
||||
assert.ok(!u.findBuff('texas2:drizzle'), 'ends with the skill duration');
|
||||
assert.equal(u.skill.active, false, 'ends with the skill duration');
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(h.hooksOf('skillEnd').filter((c) => c.unit === u && c.reason === 'duration').length, 1);
|
||||
assert.ok(e.s.flags.silence && e.findBuff(`texas2:drizzleDot:${u.id}`), 'applied enemy effects keep their own duration');
|
||||
h.run(bb['attack@silence'] + 1);
|
||||
assert.ok(!e.s.flags.silence && !e.findBuff(`texas2:drizzleDot:${u.id}`), 'no new silence / DoT after the passive');
|
||||
}
|
||||
@@ -657,8 +682,8 @@ test('缄默德克萨斯 S2 阵雨连绵: deploy burst atk_scale arts + RES down
|
||||
approx(burst[0].amount, u.s.atk * bb.atk_scale * 0.5, 1e-6, 'arts burst vs RES 50');
|
||||
approx(e.s.res, 50 * (1 + bb.magic_resistance), 1e-6, 'RES down');
|
||||
assert.equal(far.s.res, 50);
|
||||
approx(u.findBuff('texas2:shower').mods.atkPct, bb.atk, 1e-9);
|
||||
approx(u.findBuff('texas2:shower').timeLeft, sk.duration, 1e-6);
|
||||
approx(u.skill.spec.mods.atkPct, bb.atk + D(id, 1).talents[0].bb.atk, 1e-9);
|
||||
approx(u.skill.timeLeft, sk.duration, 1e-6);
|
||||
h.run(2);
|
||||
const hits = dmgBy(h, u, (c) => c.dmg.isAttack);
|
||||
assert.ok(hits.length >= 2 && hits.every((c) => c.type === 'arts'), 'arts attacks');
|
||||
@@ -666,6 +691,8 @@ test('缄默德克萨斯 S2 阵雨连绵: deploy burst atk_scale arts + RES down
|
||||
for (const c of hits) per.set(c.dmg.attackId, (per.get(c.dmg.attackId) ?? 0) + 1);
|
||||
assert.ok([...per.values()].every((v) => v === 2), 'double hits');
|
||||
h.run(sk.duration);
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.ready, false);
|
||||
const n0 = dmgBy(h, u, (c) => c.dmg.isAttack).length;
|
||||
h.run(3);
|
||||
const late = dmgBy(h, u, (c) => c.dmg.isAttack).slice(n0);
|
||||
@@ -673,6 +700,57 @@ test('缄默德克萨斯 S2 阵雨连绵: deploy burst atk_scale arts + RES down
|
||||
}
|
||||
});
|
||||
|
||||
test('缄默德克萨斯 S1/S2/S3: first kill reopens a full window, including a kill inside the deployment burst', () => {
|
||||
for (const id of pair('chess_char_4_16_a')) for (const index of [0, 1, 2]) {
|
||||
const life = [];
|
||||
const h = battle([U(id, 10, 4, index)], { extra: { setup(b) {
|
||||
for (const name of ['skillStart', 'skillEnd']) b.on(name, (c) => life.push([name, c.reason]), { priority: 1000 });
|
||||
} } });
|
||||
h.b.start();
|
||||
const u = h.unit(id), sk = u.skill;
|
||||
h.run(2);
|
||||
u.hp = u.s.maxHp / 2;
|
||||
const e = h.spawn('enemy_dummy', { pos: [10, 5] });
|
||||
h.b.kill(e, u);
|
||||
assert.equal(u.mem.texasKilled, true);
|
||||
approx(u.hpRatio, 1);
|
||||
assert.equal(u.findBuff('texas2:swordplay'), null);
|
||||
assert.equal(sk.activations, 2);
|
||||
approx(sk.timeLeft, sk.duration);
|
||||
assert.equal(sk.charges, 0);
|
||||
assert.equal(sk.ready, false);
|
||||
assert.deepEqual(h.hooksOf('skillEnd').map((c) => c.reason), ['recast']);
|
||||
h.b.kill(h.spawn('enemy_dummy', { pos: [10, 5] }), u);
|
||||
assert.equal(sk.activations, 2, 'only first kill recasts');
|
||||
h.run(sk.duration + 0.1);
|
||||
assert.equal(sk.active, false);
|
||||
assert.deepEqual(h.hooksOf('skillEnd').map((c) => c.reason), ['recast', 'duration']);
|
||||
assert.deepEqual(h.hooksOf('skillStart').map((c) => c.reason), ['deploy', 'kill']);
|
||||
h.b.retreat(u);
|
||||
const lifeAt = life.length;
|
||||
const weak = h.spawn('enemy_dummy', { pos: [10, 5] });
|
||||
weak.hp = 1;
|
||||
assert.ok(h.b.redeploy(u, { free: true }));
|
||||
if (index === 0) h.b.kill(weak, u); // S1 has no deployment burst
|
||||
assert.equal(u.mem.texasKilled, true);
|
||||
assert.equal(sk.activations, 4, 'new deployment and first-kill recast, including synchronous burst reentry');
|
||||
assert.deepEqual(life.slice(lifeAt), [['skillStart', 'deploy'], ['skillEnd', 'recast'], ['skillStart', 'kill']]);
|
||||
assert.equal(u.findBuff('texas2:swordplay'), null);
|
||||
approx(sk.timeLeft, sk.duration);
|
||||
if (index === 2) {
|
||||
const target = h.spawn('enemy_dummy', { pos: [10, 5] });
|
||||
h.run(sk.duration + 0.1);
|
||||
const waves = new Set(dmgBy(h, u, tagged('swordRain')).filter((c) => c.target === target).map((c) => c.t));
|
||||
assert.equal(waves.size, sk.duration, 'reentrant deployment keeps a full set of rain waves');
|
||||
const n = dmgBy(h, u, tagged('swordRain')).length;
|
||||
h.run(2);
|
||||
assert.equal(dmgBy(h, u, tagged('swordRain')).length, n, 'rain stops at skill end');
|
||||
assert.ok(target.alive);
|
||||
}
|
||||
checkInvariants(h.b);
|
||||
}
|
||||
});
|
||||
|
||||
test('缄默德克萨斯 module none: no ATK +10 % when alone (EXE-Y default has it)', () => {
|
||||
const has = (m) => { const h = battle([U('chess_char_4_16_b', 10, 4, null, m)]); h.run(0.5); return !!h.unit('chess_char_4_16_b').findBuff('texas2:module'); };
|
||||
assert.equal(has(null), true);
|
||||
|
||||
@@ -999,7 +999,11 @@ test('6_17 耀骑士临光 S2 逐夜烁光: on deploy ATK + and 3 护盾 layers
|
||||
const u = h.unit(id);
|
||||
usesSkill(u, sid);
|
||||
h.step();
|
||||
approx(u.findBuff('nearl2:night').mods.atkPct, bb.atk);
|
||||
approx(u.skill.spec.mods.atkPct, bb.atk);
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.active, true);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(h.snapshot().units.find((t) => t[0] === u.id)[6], dur);
|
||||
assert.equal(u.findBuff('nearl2:shield').shieldHits, bb.times);
|
||||
h.run(bb.times * 1.2 + 1);
|
||||
const taken = h.hooksOf('damaged').filter((c) => c.target === u);
|
||||
@@ -1009,15 +1013,30 @@ test('6_17 耀骑士临光 S2 逐夜烁光: on deploy ATK + and 3 护盾 layers
|
||||
assert.ok(h.runUntil(() => !u.alive, dur + 1));
|
||||
approx(h.b.time, dur, 'withdraws when it ends', 0.05);
|
||||
approx(u.respawnAt - h.b.time, u.base.respawnTime * bb.respawn_time, 'this redeploy ×1.25', 1e-3);
|
||||
assert.equal(u.removeReason, 'retreat');
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.deepEqual(h.hooksOf('skillEnd').filter((c) => c.unit === u).map((c) => c.reason), ['duration']);
|
||||
done(h);
|
||||
|
||||
const k = run({ defs: { chess: { kaz: plain('kaz', { bonds: ['kazimierzShip'] }) } }, units: [U(id, sid, 10, 4), { chessId: 'kaz', row: 12, col: 4 }] });
|
||||
const ku = k.unit(id);
|
||||
k.step(2);
|
||||
assert.ok(ku.alive && ku.findBuff('nearl2:night'));
|
||||
assert.ok(ku.alive && ku.skill.active);
|
||||
assert.ok(k.runUntil(() => !ku.alive, dur + 1));
|
||||
approx(ku.respawnAt - k.b.time, ku.base.respawnTime, '卡西米尔 before her: no extension', 1e-3);
|
||||
done(k);
|
||||
|
||||
const dead = run({ units: [U(id, sid, 10, 4, { moduleId: 'none' })] });
|
||||
dead.step();
|
||||
const du = dead.unit(id);
|
||||
dead.b.kill(du);
|
||||
const respawnAt = du.respawnAt;
|
||||
approx(respawnAt - dead.b.time, du.base.respawnTime, 'early death keeps ordinary redeployment');
|
||||
assert.equal(du.findBuff('nearl2:shield'), null);
|
||||
dead.run(dur + 1);
|
||||
assert.equal(du.respawnAt, respawnAt, 'no delayed retreat or multiplier after death');
|
||||
assert.deepEqual(dead.hooksOf('skillEnd').filter((c) => c.unit === du).map((c) => c.reason), ['death']);
|
||||
done(dead);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -942,6 +942,10 @@ test('2_12 砾: 鼠群 barrier hp_ratio × max HP decaying over `duration` s;
|
||||
assert.equal(u.base.cost, raw(id).stats.cost + t.cost);
|
||||
h.step();
|
||||
const full = u.s.maxHp * bb.hp_ratio;
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.active, true);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.deepEqual(h.snapshot().units.find((t) => t[0] === u.id).slice(5, 7), [Math.round(u.skill.timeLeft * 10) / 10, bb.duration]);
|
||||
approx(u.s.shield, full, 'full barrier', 1e-2);
|
||||
h.run(bb.duration / 2 + 0.5);
|
||||
approx(u.s.shield, full / 2, 'half decayed', 1e-2);
|
||||
@@ -949,6 +953,9 @@ test('2_12 砾: 鼠群 barrier hp_ratio × max HP decaying over `duration` s;
|
||||
approx(u.s.shield, full / 2, 'PRTS: the capacity steps once per second', 1e-2);
|
||||
h.run(bb.duration / 2);
|
||||
assert.equal(u.s.shield, 0);
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.equal(u.findBuff('gravel:rats'), null);
|
||||
done(h);
|
||||
// PRTS "受到伤害后,剩余容量根据屏障最大容量等比变化": a damaged barrier shrinks in proportion, not to the capacity
|
||||
const hd = run({ units: [{ chessId: id, row: 9, col: 5 }] });
|
||||
@@ -960,6 +967,12 @@ test('2_12 砾: 鼠群 barrier hp_ratio × max HP decaying over `duration` s;
|
||||
hd.run(bb.duration / 2 + 0.5);
|
||||
approx(ud.s.shield, cap0 * 0.4 / 2, 'remaining × capacity ratio (a plain cap would keep 40 %)', 1e-2);
|
||||
assert.ok(ud.hp === ud.s.maxHp);
|
||||
hd.b.retreat(ud);
|
||||
assert.equal(ud.findBuff('gravel:rats'), null);
|
||||
assert.equal(ud.skill.active, false);
|
||||
assert.ok(hd.b.redeploy(ud, { free: true }));
|
||||
approx(ud.skill.timeLeft, bb.duration);
|
||||
approx(ud.s.shield, cap0, 'fresh shield on redeployment');
|
||||
done(hd);
|
||||
const idb = 'chess_char_2_12_b', tb = tal(idb);
|
||||
const cheapRec = chessRec({ id: 't_cheap', stats: { cost: tb['cond.cost'] } });
|
||||
|
||||
@@ -645,7 +645,8 @@ test('缄默德克萨斯 S3 (passive): deploy burst 2 × 115 % arts + 1.5 s stun
|
||||
assert.equal(waves.size, D(id).skill.duration, 'one rain per second while the passive lasts');
|
||||
assert.ok([...waves.values()].every((n) => n === bb.max_target), '≤ 2 distinct targets');
|
||||
approx(rain[0].amount, u.base.atk * (1 + t0.atk) * bb.atk_scale, 1e-6);
|
||||
assert.equal(u.findBuff('texas2:rainAtk'), null, 'ATK bonus ends with the passive');
|
||||
assert.equal(u.skill.active, false, 'ATK bonus ends with the skill');
|
||||
approx(u.s.atk, u.base.atk);
|
||||
});
|
||||
|
||||
test('缄默德克萨斯: first kill ⇒ full heal + recast; 剑术 buff removed', () => {
|
||||
@@ -660,7 +661,8 @@ test('缄默德克萨斯: first kill ⇒ full heal + recast; 剑术 buff removed
|
||||
assert.ok(u.mem.texasKilled);
|
||||
approx(u.hpRatio, 1, 1e-3, 'full heal');
|
||||
assert.equal(u.findBuff('texas2:swordplay'), null);
|
||||
assert.ok(u.findBuff('texas2:rainAtk'), 'passive recast');
|
||||
assert.equal(u.skill.active, true, 'skill recast');
|
||||
assert.equal(u.skill.activations, 2);
|
||||
});
|
||||
|
||||
test('星熊 S2 (passive): DEF +13 % and 65 % ATK thorns; 战术装甲 negates ~25 % of hits; 重装 aura DEF +6 %', () => {
|
||||
|
||||
@@ -78,7 +78,7 @@ test('耀骑士临光 S2: withdrawn at the skill end, she lies down on her tile
|
||||
const h = field([{ chessId: NEARL2, row: 10, col: 4, skillIndex: idx }]);
|
||||
const u = h.unit(NEARL2);
|
||||
h.step();
|
||||
assert.ok(u.alive && u.findBuff('nearl2:night'), 'S2 on deploy');
|
||||
assert.ok(u.alive && u.skill.active, 'S2 on deploy');
|
||||
assert.ok(h.runUntil(() => !u.alive, 40), 'withdraws when the skill ends');
|
||||
assert.equal(u.removeReason, 'retreat');
|
||||
const d = downOf(h, u);
|
||||
|
||||
@@ -4,15 +4,160 @@ import assert from 'node:assert/strict';
|
||||
import { makeBattle, chessRec, enemyRec } from '../helpers/battleHarness.js';
|
||||
import { genericSkillSpec, genericKind } from '../../server/sim/content/generic.js';
|
||||
import { getDefaultSource } from '../../server/sim/simdata.js';
|
||||
import { UF } from '../../shared/constants.js';
|
||||
|
||||
const approx = (a, b, eps = 1e-6) => assert.ok(Math.abs(a - b) <= eps, `${a} ≈ ${b}`);
|
||||
const RANGE3 = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [-1, 0], [-1, 1], [-1, 2], [-1, 3]];
|
||||
const dummy = (o = {}) => enemyRec({ key: 'enemy_dummy', hp: 1e7, speed: 0, ...o });
|
||||
|
||||
test('deployment duration: synchronous start, one charge, countdown, carry and fresh redeployment', () => {
|
||||
for (const carryState of [undefined, { hpPct: 0.5, sp: 0, skillActive: true }]) {
|
||||
const order = [];
|
||||
const h = makeBattle({
|
||||
defs: { chess: { t_deploy: sniperWith({ spCost: 0 }, { id: 't_deploy' }) } },
|
||||
units: [{ chessId: 't_deploy', row: 10, col: 4, carryState }], timeLimit: 120,
|
||||
kits: { t_deploy: () => ({ skill: {
|
||||
kind: 'duration', activateOnDeploy: true, duration: 4, spCost: 0, spType: 'none', trigger: 'NEVER', mods: { atkPct: 1 },
|
||||
} }) },
|
||||
setup(b) {
|
||||
for (const name of ['skillStart', 'deploy']) b.on(name, (c) => order.push([name, c.reason, c.unit.skill.timeLeft]));
|
||||
},
|
||||
});
|
||||
h.b.start();
|
||||
const u = h.unit('t_deploy'), sk = u.skill;
|
||||
assert.deepEqual(order, [['skillStart', 'deploy', 4], ['deploy', undefined, 4]]);
|
||||
assert.equal(sk.active, true);
|
||||
assert.equal(sk.activations, 1);
|
||||
assert.equal(sk.charges, 0);
|
||||
assert.equal(sk.ready, false);
|
||||
approx(u.s.atk, 200);
|
||||
const tuple = () => h.snapshot().units.find((t) => t[0] === u.id);
|
||||
assert.ok(tuple()[7] & UF.SKILL);
|
||||
assert.deepEqual(tuple().slice(5, 7), [4, 4]);
|
||||
h.run(2);
|
||||
approx(sk.timeLeft, 2);
|
||||
assert.deepEqual(tuple().slice(5, 7), [2, 4]);
|
||||
h.run(2.1);
|
||||
assert.equal(sk.active, false);
|
||||
assert.equal(sk.ready, false);
|
||||
assert.equal(sk.charges, 0);
|
||||
assert.equal(sk.sp, 0);
|
||||
approx(u.s.atk, 100);
|
||||
assert.ok(!(tuple()[7] & UF.SKILL));
|
||||
assert.deepEqual(tuple().slice(5, 7), [0, 0]);
|
||||
assert.deepEqual(h.hooksOf('skillEnd').map((c) => c.reason), ['duration']);
|
||||
assert.equal(sk.gainSp(100, 'talent'), 0);
|
||||
h.run(5);
|
||||
assert.equal(sk.activations, 1);
|
||||
h.b.retreat(u);
|
||||
assert.equal(h.hooksOf('skillEnd').length, 1, 'expired skill does not end again on retreat');
|
||||
assert.ok(h.b.redeploy(u, { free: true }));
|
||||
assert.equal(sk.activations, 2);
|
||||
approx(sk.timeLeft, 4);
|
||||
assert.equal(sk.charges, 0);
|
||||
h.invariants();
|
||||
}
|
||||
});
|
||||
|
||||
test('deployment duration: early retreat/death cleans effects and leaves no stale end on redeployment', () => {
|
||||
for (const remove of ['retreat', 'kill']) {
|
||||
const h = makeBattle({
|
||||
defs: { chess: { t_deploy: sniperWith({ spCost: 0 }, { id: 't_deploy' }) } },
|
||||
units: [{ chessId: 't_deploy', row: 10, col: 4 }],
|
||||
kits: { t_deploy: () => ({ skill: {
|
||||
kind: 'duration', activateOnDeploy: true, duration: 4, spCost: 0, spType: 'none', trigger: 'NEVER', mods: { aspd: 50 },
|
||||
} }) },
|
||||
});
|
||||
const u = h.unit('t_deploy');
|
||||
h.run(1);
|
||||
h.b[remove](u);
|
||||
assert.equal(u.skill.active, false);
|
||||
approx(u.s.aspd, u.base.aspd);
|
||||
assert.deepEqual(h.hooksOf('skillEnd').map((c) => c.reason), ['death']);
|
||||
assert.ok(h.b.redeploy(u, { free: true }));
|
||||
h.run(3.1);
|
||||
assert.equal(u.skill.active, true, 'old deployment deadline does not end the new window');
|
||||
assert.equal(h.hooksOf('skillEnd').length, 1);
|
||||
h.run(1);
|
||||
assert.deepEqual(h.hooksOf('skillEnd').map((c) => c.reason), ['death', 'duration']);
|
||||
assert.equal(u.skill.ready, false);
|
||||
h.invariants();
|
||||
}
|
||||
});
|
||||
|
||||
function sniperWith(skill, o = {}) {
|
||||
return chessRec({ id: 't_sn', profession: 'SNIPER', subProfessionId: 'closerange', stats: { atk: 100, bat: 1, ...(o.stats || {}) }, rangeGrid: RANGE3, skill, ...o });
|
||||
}
|
||||
|
||||
test('generic timed passive: deployment window owns stats and arts hits without reinterpreting passive proc parameters; permanent passive stays on', () => {
|
||||
const h = makeBattle({
|
||||
defs: { chess: {
|
||||
t_sn: sniperWith({ skillType: 'PASSIVE', duration: 0, spCost: 0,
|
||||
description: '部署后在4秒内攻击力+100%,攻击造成法术伤害',
|
||||
bb: { atk: 1, duration: 4, max_target: 2, 'attack@cold': 1, ability_range_forward_extend: 1 } }),
|
||||
t_p: sniperWith({ skillType: 'PASSIVE', duration: 0, spCost: 0, description: '攻击力+100%', bb: { atk: 1, duration: 4 } }, { id: 't_p' }),
|
||||
}, enemies: { enemy_dummy: dummy() } },
|
||||
units: [{ chessId: 't_sn', row: 10, col: 4 }, { chessId: 't_p', row: 12, col: 4 }],
|
||||
content: 'generic', captureNoisy: true,
|
||||
});
|
||||
h.b.start();
|
||||
const u = h.unit('t_sn'), p = h.unit('t_p');
|
||||
assert.equal(u.skill.kind, 'duration');
|
||||
assert.equal(u.skill.activations, 1);
|
||||
assert.equal(u.skill.ready, false);
|
||||
assert.deepEqual(u.rangeKeys, u.baseRangeKeys, 'passive parameters do not extend the attack range');
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.spawn('enemy_dummy', { pos: [10, 6] });
|
||||
h.run(2);
|
||||
approx(u.s.atk, 200);
|
||||
const hits = h.hooksOf('damaged').filter((c) => c.source === u);
|
||||
assert.ok(hits.length && hits.every((c) => c.type === 'arts'));
|
||||
assert.equal(new Set(hits.map((c) => c.target)).size, 1, 'passive max_target does not turn normal attacks into multi-target attacks');
|
||||
assert.deepEqual(h.snapshot().units.find((t) => t[0] === u.id).slice(5, 7), [2, 4]);
|
||||
h.run(2.1);
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.charges, 0);
|
||||
approx(u.s.atk, 100);
|
||||
assert.deepEqual(u.rangeKeys, u.baseRangeKeys);
|
||||
h.run(2);
|
||||
const late = h.hooksOf('damaged').filter((c) => c.source === u && c.t > 4.5);
|
||||
assert.ok(late.length && late.every((c) => c.type === 'phys'));
|
||||
assert.equal(h.hooksOf('statusApplied').filter((c) => c.source === u && c.status === 'cold').length, 0,
|
||||
'passive proc parameters do not become attack statuses');
|
||||
assert.equal(p.skill.kind, 'passive');
|
||||
assert.equal(p.skill.active, true);
|
||||
approx(p.s.atk, 200);
|
||||
h.invariants();
|
||||
});
|
||||
|
||||
test('generic 宴 S2: real normal/elite descriptions convert damage to arts only during the deployment window', () => {
|
||||
const ds = getDefaultSource();
|
||||
for (const id of ['chess_char_1_18_a', 'chess_char_1_18_b']) {
|
||||
const index = ds.rawChess(id).skills.find((s) => s.skillId === 'skchr_utage_2').index;
|
||||
const h = makeBattle({
|
||||
content: 'generic', timeLimit: 40, captureNoisy: true,
|
||||
units: [{ chessId: id, skillIndex: index, row: 10, col: 4 }],
|
||||
defs: { enemies: { enemy_dummy: dummy({ atk: 0 }) } },
|
||||
});
|
||||
h.b.start();
|
||||
const u = h.unit(id);
|
||||
h.spawn('enemy_dummy', { pos: [10, 4] });
|
||||
const hits = () => h.hooksOf('damaged').filter((c) => c.source === u && c.dmg.isAttack);
|
||||
h.run(2);
|
||||
assert.ok(hits().length > 0 && hits().every((c) => c.type === 'arts'), `${id}: active S2 deals arts damage`);
|
||||
h.run(u.skill.timeLeft + h.TICK);
|
||||
assert.equal(u.skill.active, false);
|
||||
assert.equal(u.skill.ready, false);
|
||||
const endedAt = hits().length;
|
||||
h.run(3);
|
||||
const late = hits().slice(endedAt);
|
||||
assert.ok(late.length > 0 && late.every((c) => c.type === 'phys'), `${id}: normal physical attacks after expiry`);
|
||||
assert.equal(u.skill.activations, 1);
|
||||
assert.deepEqual(h.b.errors, []);
|
||||
h.invariants();
|
||||
}
|
||||
});
|
||||
|
||||
test('SP: time regen, starts at initSp, capped at cost; DEFAULT waits for an enemy in the initial range', () => {
|
||||
const h = makeBattle({
|
||||
defs: { chess: { t_sn: sniperWith({ spCost: 5, initSp: 2, duration: 3, bb: { atk: 1 } }) }, enemies: { enemy_dummy: dummy() } },
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// The chess: elite 野鬃 (chess_char_1_19_b). Default = S2 夹枪冲锋 (25/40 SP) + module 长枪替补套装 (ATK +40, ASPD +3).
|
||||
// Chosen here: S1 骑枪刺击 (ON_DEPLOY: "部署后攻击速度+100" for 25 s) + 不装备 — so right after the unit deploys the
|
||||
// local battle must show the S1 buff (wildmn:s1, ASPD +100, skill active) and the no-module stats (ATK 524, ASPD 100).
|
||||
// local battle must show S1 active with a draining duration bar, ASPD +100 and the no-module stats (ATK 524, ASPD 100).
|
||||
// The server is test/e2e/fastServer.mjs with its starter-kit hook (SP_START_CHESS: the elite in the hand at round 1);
|
||||
// everything else is the real match engine and the real UI driven by real mouse input.
|
||||
// Screenshots: test/e2e/out/loadout-battle-*.png.
|
||||
@@ -16,6 +16,9 @@ import assert from 'node:assert/strict';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { Client, ROOT, sleep, hasChrome, startRealServer, problemsOf } from '../e2e/client.mjs';
|
||||
import { makeBattle } from '../helpers/battleHarness.js';
|
||||
import { UF } from '../../shared/constants.js';
|
||||
import { COLORS } from '../../public/js/render/style.js';
|
||||
|
||||
const ENABLED = process.env.SP_E2E === '1' && hasChrome() && existsSync(path.join(ROOT, 'public/assets'));
|
||||
const BASE = 'chess_char_1_19_a';
|
||||
@@ -129,15 +132,16 @@ describe('user playtest #2 item 1 — loadout chosen in the UI fights in the loc
|
||||
const e = r && [...r._entries.values()].find((x) => x.own && x.battle);
|
||||
if (!e) return false;
|
||||
const u = e.battle.allyUnits.find((x) => x.uid === uid);
|
||||
if (!u || !u.findBuff?.('wildmn:s1')) return false;
|
||||
const b = u.findBuff('wildmn:s1');
|
||||
if (!u?.skill?.active || u.skill.id !== 'skchr_wildmn_1') return false;
|
||||
const tuple = e.battle.snapshot().units.find((t) => t[0] === u.id);
|
||||
const entry = (e.spec.players || []).flatMap((p) => p.units || []).find((x) => x.uid === uid) || null;
|
||||
return {
|
||||
authoritative: e.authoritative, t: e.battle.time,
|
||||
spec: entry && { chessId: entry.chessId, skillIndex: entry.skillIndex, moduleId: entry.moduleId },
|
||||
skill: u.skill?.id ?? null, source: u.kit?.skillSource ?? null, active: !!u.skill?.active,
|
||||
loadout: u.def?.loadout ?? null, atk: u.def?.stats?.atk, aspd: u.def?.stats?.aspd,
|
||||
buff: { aspd: b.mods?.aspd ?? null },
|
||||
liveAspd: u.s.aspd, timeLeft: u.skill.timeLeft, duration: u.skill.duration, ready: u.skill.ready,
|
||||
bar: tuple && { value: tuple[5], max: tuple[6] },
|
||||
};
|
||||
}, { timeout: 30000, polling: 100 }, piece.uid).then((h) => h.jsonValue())
|
||||
.catch(async (err) => {
|
||||
@@ -157,7 +161,11 @@ describe('user playtest #2 item 1 — loadout chosen in the UI fights in the loc
|
||||
assert.equal(got.atk, rec.statsBase.atk, 'no module: base ATK (the default module adds +40)');
|
||||
assert.equal(got.aspd, rec.statsBase.aspd, 'no module: base ASPD');
|
||||
assert.notEqual(rec.stats.atk, rec.statsBase.atk, 'control: the default module would change ATK');
|
||||
assert.equal(got.buff.aspd, s1.bb.attack_speed, 'S1 signature: ASPD +100 on deploy');
|
||||
assert.equal(got.liveAspd - got.aspd, s1.bb.attack_speed, 'S1 signature: ASPD +100 on deploy');
|
||||
assert.equal(got.ready, false, 'deployment consumed its sole charge');
|
||||
assert.equal(got.duration, s1.duration);
|
||||
assert.equal(got.bar.max, s1.duration, 'zero-SP skill has a duration bar');
|
||||
assert.ok(Math.abs(got.bar.value - got.timeLeft) <= 0.06);
|
||||
assert.ok(got.active, 'S1 is active right after deploying');
|
||||
assert.ok(got.t < 10, `S1 fires on deploy (t = ${got.t}), long before S2 could charge (25/40 SP)`);
|
||||
await sleep(800);
|
||||
@@ -171,4 +179,63 @@ describe('user playtest #2 item 1 — loadout chosen in the UI fights in the loc
|
||||
await srv.stop();
|
||||
}
|
||||
});
|
||||
|
||||
test('野鬃 S1 duration bar: full on deploy, half remaining, hidden after expiry (real renderer)', { timeout: 120000 }, async () => {
|
||||
const h = makeBattle({
|
||||
stageId: 'act2autochess_m01', autoFinish: false, timeLimit: 60,
|
||||
units: [{ chessId: ELITE, skillIndex: 0, moduleId: 'none', row: 9, col: 5 }],
|
||||
});
|
||||
h.b.start();
|
||||
const u = h.unit(ELITE);
|
||||
assert.equal(u.skill.id, 'skchr_wildmn_1');
|
||||
const meta = { ...h.b.fieldMeta(), stageId: 'act2autochess_m01' };
|
||||
const frames = [];
|
||||
for (const [name, elapsed, share] of [['full', 0, 1], ['half', u.skill.duration / 2, 0.5], ['ended', u.skill.duration / 2 + h.TICK, 0]]) {
|
||||
h.run(elapsed);
|
||||
const { t, ...rest } = h.snapshot();
|
||||
frames.push({ name, share, snap: { ...rest, t: 'b.snap', gt: t } });
|
||||
assert.equal(u.skill.ready, false, `${name}: no remaining deploy charge`);
|
||||
assert.equal(u.skill.active, name !== 'ended');
|
||||
}
|
||||
const srv = await startRealServer();
|
||||
const P = (await import('puppeteer-core')).default;
|
||||
const c = new Client(P, srv.base, 'duration', { prefix: 'loadout-battle' });
|
||||
try {
|
||||
await c.open();
|
||||
await c.page.goto(`${srv.base}/dev/render-demo.html?scene=normal-m01&paused=1&panel=0`);
|
||||
await c.page.waitForFunction('window.__demo && (window.__demo.ready || window.__demo.error)', { timeout: 30000 });
|
||||
assert.equal(await c.page.evaluate(() => window.__demo.error ?? null), null);
|
||||
for (const f of frames) {
|
||||
await c.page.evaluate((meta, snap) => {
|
||||
const v = window.__demo.view;
|
||||
v.enterBattle(meta);
|
||||
v.setCamera('normal', { rect: meta.rect, side: 'L', instant: true });
|
||||
v.setLocalFeed({ on: true, speed: 2 });
|
||||
v.pushSnapshot(snap);
|
||||
}, meta, f.snap);
|
||||
await c.page.waitForFunction((id, spMax) => {
|
||||
const x = window.__demo.view.debug.views.get(id);
|
||||
return x?.spineReady && x.hud.visible && x.hud.alpha > 0.99 && x.hpFill.visible && x.spMax === spMax;
|
||||
}, { timeout: 15000 }, u.id, f.snap.units.find((t) => t[0] === u.id)[6]);
|
||||
const bar = await c.page.evaluate((id) => {
|
||||
const x = window.__demo.view.debug.views.get(id);
|
||||
return { visible: x.spFill.visible, bg: x.spBg.visible, share: x.spFill.width / (x.spBg.width - 2),
|
||||
tint: x.spFill.tint, flags: x.flags, glow: x.spGlow.visible, sp: x.sp, max: x.spMax };
|
||||
}, u.id);
|
||||
assert.equal(bar.glow, false, `${f.name}: no ready highlight`);
|
||||
assert.equal(!!(bar.flags & UF.SKILL), f.name !== 'ended');
|
||||
assert.equal(bar.visible, f.name !== 'ended');
|
||||
assert.equal(bar.bg, f.name !== 'ended');
|
||||
if (bar.visible) {
|
||||
assert.ok(Math.abs(bar.share - f.share) < 0.002, `${f.name}: drawn share ${bar.share}`);
|
||||
assert.equal(bar.tint, COLORS.spActive);
|
||||
} else assert.deepEqual([bar.sp, bar.max], [0, 0]);
|
||||
await c.shot(`duration-${f.name}`);
|
||||
}
|
||||
assert.deepEqual(problemsOf([c]), []);
|
||||
} finally {
|
||||
await c.close();
|
||||
await srv.stop();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user