- #1 #2 skill / device summons (赫默's drone, 巫恋's doll, 凯瑟琳's devices) are hand cards placed by the player; placed summons deploy once at battle start, then a skill summon re-appears at its tile on each cast (the user's call) - #3 叙拉古 隐匿 ends on time (32 + 0.4 × layers s); 忍冬 S3 迷彩 lasts until her next cast (official), kept apart from 隐匿 - #4 multi-round bounty cards last two battles (the user's call; MULTI_ROUND_BOUNTY_BATTLES), blue / red card text - #5 the shared boss pool's float dust (≈3.6e-12 HP) stalled Final Assault leaders at 0 %; < 1 HP now clears the pool, and the team LP reaching 0 first is a defeat (PRTS) - #6 #10 机变 cards show their official effect text; an invisible 详情 button no longer swallows the confirming tap on phones - #7 live ×N counter of a leaker's enemies still on the 联防 field (LP loss stays capped at 10) - #8 #15 #16 skill triggers per 技能策略: skill-range triggers, injured-ally heals (古米, 塞雷娅), tank take-damage triggers with a 3 s cooldown; 新约能天使 S2 shields the highest-aggro operator in range - #9 official per-enemy model scales (威龙) - #11 element bar under the unit's HP bar (white = 元素值 left, element-coloured refill after a burst), floor rounding - #12 枯朽战车 kit per PRTS; every ranged enemy reaches its target's 0.25 collider - #13 恐惧 wander (萨科塔之翼 at half HP, operator fears make enemies flee) with re-planning after pushes - #14 push / pull distance by 力度 − 重量 (PRTS table); #17 every blocker attacks what it blocks; ASPD floor 20 - #18 炎佑 is 孤立: no heals or ally buffs - #19 every free pick-one chess offer (promotion reward, 信标, 寻呼模块) shows different operators - DESIGN §20 and the normative lines, SIM / META / DATA / PLAYING updated; 2747 unit tests and all 27 browser suites green; dev recordings regenerated
58 lines
3.3 KiB
JavaScript
58 lines
3.3 KiB
JavaScript
// User playtest #6 item 5 (HUD part) — the boss bar read "0.0%" while the leader kept fighting. The leader's death is a
|
|
// sim / match fix (test/match/playtest6-bosspool.test.js: a pool never holds less than 1 HP, so 0 on the HUD means the
|
|
// leader is down); the bar itself now (ui/gameLogic.js bossPctText, ui/hud.js PhaseCapsule)
|
|
// * never reads 0.0 % while the leader has HP left (a sliver reads "<0.1%"),
|
|
// * shows the live pool of the battle on screen (its snapshot: the local simulation's own damage on top of b.pool)
|
|
// before the ~1 Hz m.public.bossHp, which lagged the leader's death.
|
|
|
|
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { PHASE } from '../../shared/constants.js';
|
|
|
|
const { bossPctText, bossFrac } = await import('../../public/js/ui/gameLogic.js');
|
|
const { PhaseCapsule } = await import('../../public/js/ui/hud.js');
|
|
|
|
/** The text of a vnode tree in document order. */
|
|
const textOf = (v) => {
|
|
if (v == null || typeof v === 'boolean') return '';
|
|
if (typeof v === 'string' || typeof v === 'number') return String(v);
|
|
if (Array.isArray(v)) return v.map(textOf).join('');
|
|
return typeof v === 'object' ? textOf(v.props?.children) : '';
|
|
};
|
|
function* walk(v) {
|
|
if (Array.isArray(v)) { for (const x of v) yield* walk(x); return; }
|
|
if (!v || typeof v !== 'object') return;
|
|
yield v;
|
|
yield* walk(v.props?.children);
|
|
}
|
|
const barText = (vnode) => {
|
|
for (const v of walk(vnode)) if (typeof v.props?.class === 'string' && v.props.class.includes('bossbar__txt')) return textOf(v);
|
|
return null;
|
|
};
|
|
|
|
test('bossPctText: whole percents from 10 %, one decimal below, never 0.0 % for a living leader', () => {
|
|
assert.equal(bossPctText(1), '100%');
|
|
assert.equal(bossPctText(0.456), '46%');
|
|
assert.equal(bossPctText(0.1), '10%');
|
|
assert.equal(bossPctText(0.0934), '9.3%');
|
|
assert.equal(bossPctText(0.001), '0.1%');
|
|
assert.equal(bossPctText(800 / 1800000), '<0.1%', 'the user\'s screenshot: a leader a few hundred HP from death');
|
|
assert.equal(bossPctText(1 / 3600000), '<0.1%', 'the last HP point of the largest pool');
|
|
assert.equal(bossPctText(0), '0.0%', 'only a leader that is down reads 0.0 %');
|
|
assert.equal(bossPctText(null), null);
|
|
assert.equal(bossPctText(NaN), null);
|
|
assert.equal(bossPctText(bossFrac({ hp: 1, max: 1800000 })), '<0.1%');
|
|
});
|
|
|
|
test('PhaseCapsule: the live pool of the battle on screen wins over the ~1 Hz m.public value', () => {
|
|
const pub = { phase: PHASE.FINAL_ASSAULT, bossHp: { hp: 900, max: 1800000 } };
|
|
// the local battle already saw the leader die (its snapshot pool is 0): the bar says so at once
|
|
assert.equal(barText(PhaseCapsule({ pub, hud: { killed: 15, total: 20, boss: { hp: 0, max: 1800000 } } })), '0.0%');
|
|
// a living leader never reads 0.0 %
|
|
assert.equal(barText(PhaseCapsule({ pub, hud: { killed: 15, total: 20, boss: { hp: 700, max: 1800000 } } })), '<0.1%');
|
|
// no snapshot yet (the battle is loading): m.public
|
|
assert.equal(barText(PhaseCapsule({ pub, hud: null })), '0.1%', '900 of 1 800 000 = 0.05 %');
|
|
assert.equal(barText(PhaseCapsule({ pub: { phase: PHASE.FINAL_ASSAULT, bossHp: { hp: 900000, max: 1800000 } }, hud: { killed: 1, total: 20, boss: null } })), '50%');
|
|
assert.equal(barText(PhaseCapsule({ pub: { phase: PHASE.FINAL_ASSAULT }, hud: null })), '敌方领袖');
|
|
});
|