feat: select paired emote lines from own character
This commit is contained in:
+11
-2
@@ -7,12 +7,21 @@ test('emotes validate fixed choices, rate limit each player and expire without c
|
||||
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(0, 'mistake', 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);
|
||||
assert.equal(emotes.send(0, 'mistake', 1000 + EMOTE_COOLDOWN_MS), true);
|
||||
});
|
||||
|
||||
test('emote variants are fixed when sent and invalid variants are rejected', () => {
|
||||
const emotes = createEmotes();
|
||||
assert.equal(emotes.send(0, 'greet', 0, 2), false);
|
||||
assert.equal(emotes.send(0, 'greet', 0, 0), true);
|
||||
assert.equal(emotes.send(1, 'greet', 0, 1), true);
|
||||
assert.equal(emotes.view(1)[0]?.variant, 0);
|
||||
assert.equal(emotes.view(2)[1]?.variant, 1);
|
||||
});
|
||||
|
||||
@@ -39,9 +39,10 @@ test('peer emotes reach the correct slot without exposing choices or changing th
|
||||
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);
|
||||
assert.equal(a.sendEmote('mistake'), false);
|
||||
await h.clock.advance(1);
|
||||
assert.equal(b.view().emotes?.[0]?.id, 'greet');
|
||||
assert.equal(b.view().emotes?.[0]?.variant, a.view().emotes?.[0]?.variant);
|
||||
assert.equal(b.view().ownAction, null);
|
||||
assert.equal(b.view().turnId, before.turnId);
|
||||
assert.deepEqual(b.view().energy, before.energy);
|
||||
|
||||
Reference in New Issue
Block a user