This commit introduces a comprehensive turn-based system that controls when players can interact with cards. The changes include:
- Adding turnPhase state tracking with draw, player_play, and cpu_play phases
- Setting initial turn phase to player_play for proper game flow
- Implementing conditional logic in card interaction handlers (hover, click)
- Restricting all interactive card behaviors to only occur during the player's turn phase
- Updating documentation comments to reflect the new turn-based control system
These changes establish the foundation for a structured gameplay sequence where players can only play cards during their designated turn phase, preventing actions outside of proper game flow.
This commit adds full opponent functionality to the game including:
- Shuffling and dealing cards to both player and CPU decks
- Displaying opponent's hand face-down at top of screen
- Implementing CPU turn logic that automatically plays random cards
- Adding animations for CPU card placement on field with stats display
- Switching turns between player and CPU after card plays
The changes enable a complete two-player gameplay experience where the CPU automatically responds to player actions, creating a more engaging game flow.
This change adds visual indicators for attack, shield, and health values to each card displayed in the player's hand. The stats are shown in specific corners of each card:
- Attack value in upper left corner
- Shield value in lower left corner
- Health value in lower right corner
The stat text elements are properly positioned relative to the card sprite and maintain their positions during hover animations. Each card now stores references to its stat text elements for consistent positioning and updates.
- Added card-data.js file to define four different decks (Player default, Warrior, Mage, Archer)
- Each deck contains 10 creature cards with randomized attack, shield, and health values
- Updated index.html to load the new card data script before main.js
- Modified main.js to initialize player deck using predefined deck1 instead of generating random cards
- Removed old deck generation code from main.js
- Implemented card locking functionality that prevents cards from being dragged after clicking
- Added visual feedback for locked cards (raised position)
- Created Play and Cancel buttons above locked cards to confirm or revert actions
- Implemented game logic for moving cards to player field and returning them to hand
- Enhanced user interaction with proper button handling and state management
- Updated card display system to handle repositioning of remaining hand cards after interactions