Fix: Delay Enemy Intent generation to allow attack animation to finish
This commit is contained in:
@@ -264,6 +264,9 @@ class _BattleScreenState extends State<BattleScreen> {
|
||||
_playerAnimKey.currentState
|
||||
?.animateAttack(offset, () {
|
||||
showEffect(); // Show Effect at Impact!
|
||||
// Trigger impact logic in provider
|
||||
context.read<BattleProvider>().handleImpact(event);
|
||||
|
||||
// Shake and Explosion ONLY for Risky
|
||||
if (event.risk == RiskLevel.risky) {
|
||||
_shakeKey.currentState?.shake();
|
||||
@@ -300,6 +303,7 @@ class _BattleScreenState extends State<BattleScreen> {
|
||||
|
||||
if (!enableAnim) {
|
||||
showEffect(); // Just show effect if anim disabled
|
||||
context.read<BattleProvider>().handleImpact(event); // Process impact immediately if anim disabled
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -324,6 +328,8 @@ class _BattleScreenState extends State<BattleScreen> {
|
||||
_enemyAnimKey.currentState
|
||||
?.animateAttack(offset, () {
|
||||
showEffect(); // Show Effect at Impact!
|
||||
// Trigger impact logic in provider
|
||||
context.read<BattleProvider>().handleImpact(event);
|
||||
|
||||
// Shake and Explosion ONLY for Risky (Enemy can also do risky attacks)
|
||||
if (event.risk == RiskLevel.risky) {
|
||||
@@ -355,6 +361,8 @@ class _BattleScreenState extends State<BattleScreen> {
|
||||
} else {
|
||||
// Not a player/enemy attack movement, show immediately
|
||||
showEffect();
|
||||
// Also process impact immediately for non-animating effects (e.g., failed defense, stun)
|
||||
context.read<BattleProvider>().handleImpact(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user