0.3.3


Devlog — Combat & Turn System Stability Update

Fixed battle softlocks after defeat

Resolved an issue where the battle could remain partially active after the player reached 0 HP.

Symptoms

  • Skills became unusable
  • Tiles could still be moved
  • battleEnding stayed stuck at true
  • Combat never fully ended
  • Restarting a level sometimes left the board unplayable

Fixes

  • Added proper battleEnding reset during level initialization
  • Forced combat state cleanup when a battle ends
  • Prevented gameplay interaction while battle termination is in progress
  • Ensured combat transitions correctly into defeat/victory flow

Fixed skill interaction desynchronization

Resolved a bug where skills visually appeared clickable but failed to activate.

Root cause

renderHud() rebuilt skill buttons during click execution while inputLocked was active, causing stale handlers and inconsistent button state.

Fixes

  • Removed unsafe HUD rebuild during skill activation
  • Added explicit button disabling during skill execution
  • Properly restored interaction state after skill completion
  • Added safety unlocks for:
    • inputLocked
    • animating

Fixed stun duration logic

Resolved an issue where stun effects were instantly removed or behaved inconsistently.

Root cause

handleStun() used duration while statuses used turns.

Fixes

  • Unified stun processing using turns
  • Correctly decremented stun duration
  • Prevented accidental instant stun removal
  • Added cleanup for expired stun statuses

Improved status effect handling

Enhanced the robustness of the status system.

Improvements

  • Added detailed debug logging for status application
  • Prevented infinite stun stacking
  • Added proper status refresh logic
  • Added defensive checks for invalid actors

Fixed render crashes during cascade resolution

Resolved crashes occurring when the player died during tile cascades.

Symptoms

  • Cannot read properties of null (reading 'type')
  • Render failures during resolveMatches()

Root cause

renderBoard() attempted to render temporary null board cells during destruction/cascade animations.

Fixes

  • Added null tile protection inside renderBoard()
  • Added safe board rendering during battle termination
  • Prevented invalid tile access during match resolution

Improved battle state consistency

Combat state transitions are now fully synchronized.

Added protections for:

  • battleEnding
  • active
  • turn
  • inputLocked
  • animating
  • selectedTile

Result

Prevents invalid hybrid states such as:

  • Player dead but combat still active
  • Skills blocked while tiles remain playable
  • Endless enemy turn loops
  • Stuck combat after defeat

Added extensive debugging tools

Implemented deep runtime diagnostics for combat systems.

Added debug categories

  • [SKILL DEBUG]
  • [STUN DEBUG]
  • [STATUS DEBUG]
  • [BOARD DEBUG]
  • [BATTLE DEBUG]

Logged systems

  • Skill execution flow
  • Input locks
  • Animation states
  • Status application/removal
  • Turn transitions
  • Board rendering
  • Battle ending logic
  • Match/cascade resolution

These logs made it possible to isolate:

  • incorrect battle termination
  • stale UI state
  • stun mismanagement
  • interaction locks
  • render timing issues

Overall Result

The combat system is now significantly more stable:

  • Defeat/victory flows resolve correctly
  • Skills and tile interactions remain synchronized
  • Status effects behave consistently
  • Cascades no longer crash rendering
  • Battle resets properly after restart
  • Softlocks and infinite blocked states were eliminated

Leave a comment

Log in with itch.io to leave a comment.