Add character emotes across bot friend and ranked matches

This commit is contained in:
2026-10-14 23:56:32 +09:00
parent c798753418
commit 493af700aa
14 changed files with 177 additions and 7 deletions
+18
View File
@@ -32,6 +32,24 @@ class Wire {
close() { this.connected = false; }
disconnect() { this.connected = false; for (const h of this.states) h('disconnected'); }
}
test('peer emotes reach the correct slot without exposing choices or changing the turn', async () => {
const h = setup(), [a, b] = h.controllers;
try {
await Promise.all(h.controllers.map(c => c.start())); await h.clock.advance(4000);
await a.submitAction('charge'); await h.clock.advance(1);
const before = b.view();
assert.equal(a.sendEmote('greet'), true);
assert.equal(a.sendEmote('taunt'), false);
await h.clock.advance(1);
assert.equal(b.view().emotes?.[0]?.id, 'greet');
assert.equal(b.view().ownAction, null);
assert.equal(b.view().turnId, before.turnId);
assert.deepEqual(b.view().energy, before.energy);
assert.equal(b.view().phase, 'selecting');
await b.leave();
assert.equal(b.sendEmote('threaten'), false);
} finally { h.close(); }
});
function setup(onRematch?: () => Promise<void>, guestClockOffset = 0, guestStartDelay = 0) {
const clock = new ManualClock(); clock.time = 1000;
const a = new Wire(), b = new Wire(); a.remote = b; b.remote = a;