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
@@ -0,0 +1,18 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { createEmotes } from '../src/shared/emotes.js';
import { EMOTE_COOLDOWN_MS, EMOTE_DURATION_MS } from '../constants/emotes.js';
test('emotes validate fixed choices, rate limit each player and expire without changing battle state', () => {
const emotes = createEmotes();
assert.equal(emotes.send(0, '<script>', 1000), false);
assert.equal(emotes.send(0, 'greet', 1000), true);
assert.equal(emotes.send(0, 'taunt', 1001), false);
assert.equal(emotes.send(1, 'thanks', 1001), true);
assert.equal(emotes.view(1001)[0]?.id, 'greet');
const snapshot = emotes.view(1001);
snapshot[0]!.id = 'threaten';
assert.equal(emotes.view(1001)[0]?.id, 'greet');
assert.equal(emotes.view(1000 + EMOTE_DURATION_MS)[0], null);
assert.equal(emotes.send(0, 'taunt', 1000 + EMOTE_COOLDOWN_MS), true);
});