fix: 빙의 전용 화면과 가오픈 갱신을 보정한다
This commit is contained in:
@@ -79,9 +79,11 @@ export class GameClock {
|
||||
if (this.mode === 'manual') {
|
||||
return this.tick;
|
||||
}
|
||||
// A wall-clock correction must never rewind already-observed gameplay.
|
||||
const elapsedTicks = this.ticksBetween(this.wallAnchor, wallNow);
|
||||
return elapsedTicks <= 0 ? this.tick : this.addTicks(this.tick, elapsedTicks);
|
||||
// A future realtime anchor represents the formal opening at anchor tick.
|
||||
// Before that instant Ref exposes the elapsed offset as a negative tick,
|
||||
// which lets PREOPEN-only actions keep their logical cooldowns moving.
|
||||
return this.addTicks(this.tick, elapsedTicks);
|
||||
}
|
||||
|
||||
now(wallNow: Date): Date {
|
||||
|
||||
@@ -35,16 +35,17 @@ describe('GameClock', () => {
|
||||
expect(clock.tickToDate(tick).getTime() - baseTime.getTime()).toBe(jumped.getTime() - wallAnchor.getTime());
|
||||
});
|
||||
|
||||
it('does not rewind game time after a backward wall-clock correction', () => {
|
||||
it('projects a negative tick before a future realtime anchor', () => {
|
||||
const clock = new GameClock({
|
||||
baseTime,
|
||||
tick: GAME_TICKS_PER_TURN * 10,
|
||||
tick: 0,
|
||||
mode: 'realtime',
|
||||
wallAnchor: new Date('2026-01-02T00:00:00.000Z'),
|
||||
wallAnchor: new Date('2026-01-01T01:00:00.000Z'),
|
||||
turnSeconds: 3_600,
|
||||
});
|
||||
|
||||
expect(clock.nowTick(new Date('2025-01-01T00:00:00.000Z'))).toBe(GAME_TICKS_PER_TURN * 10);
|
||||
expect(clock.nowTick(new Date('2026-01-01T00:30:00.000Z'))).toBe(-GAME_TICKS_PER_TURN / 2);
|
||||
expect(clock.nowTick(new Date('2026-01-01T01:00:00.000Z'))).toBe(0);
|
||||
});
|
||||
|
||||
it('projects near the safe tick boundary without unsafe intermediate multiplication', () => {
|
||||
|
||||
Reference in New Issue
Block a user