From 3030c09d55fb053e03ed70ce32a1be1c1cb93ab7 Mon Sep 17 00:00:00 2001 From: Horoli Date: Sun, 7 Dec 2025 19:37:17 +0900 Subject: [PATCH] Fix: Add buffer delay to Enemy Turn for animation sync --- lib/providers/battle_provider.dart | 3 ++- prompt/65_fix_text_timing.md | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 prompt/65_fix_text_timing.md diff --git a/lib/providers/battle_provider.dart b/lib/providers/battle_provider.dart index 90516dd..f7d7aee 100644 --- a/lib/providers/battle_provider.dart +++ b/lib/providers/battle_provider.dart @@ -495,7 +495,8 @@ class BattleProvider with ChangeNotifier { if (intent.risk == RiskLevel.safe) delay = GameConfig.animDelaySafe; if (intent.risk == RiskLevel.risky) delay = GameConfig.animDelayRisky; - await Future.delayed(Duration(milliseconds: delay)); + // Add small buffer to ensure visual impact happens before text (300ms) + await Future.delayed(Duration(milliseconds: delay + 300)); int incomingDamage = intent.finalValue; diff --git a/prompt/65_fix_text_timing.md b/prompt/65_fix_text_timing.md new file mode 100644 index 0000000..478b353 --- /dev/null +++ b/prompt/65_fix_text_timing.md @@ -0,0 +1,13 @@ +# 65. Fix Floating Text Timing + +## 1. 목표 (Goal) +- 적이 플레이어에게 도착하기도 전에 데미지 텍스트가 먼저 뜨는 문제를 해결합니다. + +## 2. 원인 (Cause) +- `BattleProvider`에서 주는 `Future.delayed` 시간이 실제 UI 상의 '적 돌진 애니메이션 소요 시간'보다 짧거나 비슷하여, 미세한 차이로 `DamageEvent`가 먼저 처리됨. + +## 3. 해결 방안 (Solution) +- `BattleProvider`의 `_enemyTurn` 메서드에서 사용하는 딜레이 시간에 **여유분(+300ms)**을 추가하여, 확실하게 애니메이션이 타격 지점에 도달한 후에 데미지 이벤트가 발생하도록 조정합니다. + +## 4. 기대 효과 (Expected Outcome) +- 적이 돌진 -> 타격(Impact) -> 그 순간에 데미지 텍스트 출력 순서가 자연스럽게 맞음.