이클립스 사전 경고 연출 · 브리핑 출처·게시시각 · PASSPORT 역사적 사건 Stamp

This commit is contained in:
Sn-Kinos
2026-10-08 15:43:12 +09:00
parent 62b9637db9
commit 586039da0a
26 changed files with 1223 additions and 1013 deletions
+17 -2
View File
@@ -158,6 +158,7 @@ class Repositories {
var isEclipsed = false;
var eclipseFailed = false;
String? eclipseSuccessId;
(DateTime, DateTime)? eclipseWarning;
var isHeroTime = false;
Set<String>? heroEventIds;
Timer? heroExpiry;
@@ -178,6 +179,8 @@ class Repositories {
isEclipsed: isEclipsed,
eclipseFailed: eclipseFailed,
eclipseSuccessId: eclipseSuccessId,
eclipseWarnAt: eclipseWarning?.$1,
eclipseStartAt: eclipseWarning?.$2,
isHeroTime: isHeroTime,
heroEventIds: heroEventIds,
heroEndsAt: heroEndsAt,
@@ -196,8 +199,12 @@ class Repositories {
emit();
}, onError: out.addError);
// 판정 결과까지 받는다 — 활성 회차만 보면 마감 순간 null 이 되어 성공 · 실패를 가를 수 없다.
final danger = eclipse.watch(fandomId: fandomId, includeResults: true).listen((state) {
// 경보 단계 회차도 받는다 — 사전 경고 「그림자 접근」(v1.5 §5).
final danger = eclipse
.watch(fandomId: fandomId, includeResults: true, includeScheduled: true)
.listen((state) {
(isEclipsed, eclipseFailed, eclipseSuccessId) = eclipseLook(state, DateTime.now());
eclipseWarning = eclipseWarnWindow(state);
emit();
}, onError: out.addError);
// 기존 선물 이벤트만 읽는다. 구매 시도/로컬 캐시는 축제 확정이 아니다.
@@ -272,7 +279,9 @@ class Repositories {
/// 최근 이클립스 회차 → 행성 표현 (진행 중 감소 · 실패 감소 · 성공 회차 ID).
/// 판정 대기(마감 후 결과 전)는 셋 다 아니다 — 오류를 실패처럼 보이지 않는다(v1.5 §5 집계 오류).
(bool, bool, String?) eclipseLook(EclipseState? state, DateTime now) {
if (state == null) return (false, false, null);
// 경보 단계는 아직 이클립스가 아니다(그림자 접근은 [eclipseWarnWindow]). 다음 회차가 열렸으니
// 이전 회차의 실패 감소도 여기서 풀린다.
if (state == null || state.scheduled) return (false, false, null);
final won = state.defended || state.result == EclipseResult.success;
return (
state.result == null && !won && !state.isExpired(now),
@@ -280,3 +289,9 @@ class Repositories {
won ? state.eclipseId : null,
);
}
/// 경보 단계 회차의 (warnAt, startAt). 경보가 아니거나 시각이 없으면 null.
(DateTime, DateTime)? eclipseWarnWindow(EclipseState? state) => switch (state) {
EclipseState(scheduled: true, warnAt: final warn?, startAt: final start?) => (warn, start),
_ => null,
};