Skip to content

Latest commit

 

History

History
91 lines (74 loc) · 3.88 KB

File metadata and controls

91 lines (74 loc) · 3.88 KB

Classes and Objects

Game

  • Properties:
    • currentRound: Keeps track of the current round number.
    • activePlayer: Stores the player (user or AI) currently taking their turn.
    • gameState: Represents the state of the game (e.g., "playing", "ended").
  • Methods:
    • startGame(): Initiates the game loop and sets up the initial conditions.
    • endTurn(): Handles the end of a player's turn and switches to the next player.
    • checkWinConditions(): Checks if a player has met the conditions for winning the game.
    • handlePlayerAction(): Processes the action taken by a player during their turn.

Player

  • Properties:
    • playerID: Identifies the player (user or AI) in the game.
    • pokémonTeam: Stores the player's selected Pokémon for battle.
    • resources: Represents the resources the player can use to interact with the game.
    • activePokémon: Stores the currently active Pokémon in the battle.
  • Methods:
    • choosePokémon(): Allows the player to select Pokémon from their available pool.
    • placePokémon(): Places the selected Pokémon on the battlefield grid.
    • activateAbility(): Triggers the activation of a Pokémon's ability.
    • earnResources(): Updates the player's resources after each turn.

Pokémon

  • Properties:
    • name: The name of the Pokémon.
    • type: The type of the Pokémon (e.g., fire, water, grass).
    • stats: Contains the stats of the Pokémon (health, attack, defense, etc.).
    • abilities: Lists the abilities the Pokémon possesses.
    • statusEffects: Stores any active status effects on the Pokémon.
  • Methods:
    • useAbility(): Executes the ability of the Pokémon during battles.
    • takeDamage(): Calculates and applies damage to the Pokémon based on battle mechanics.
    • applyStatusEffect(): Applies status effects like poison or paralysis to the Pokémon.

Methods and Functions

Game Loop

  • startGameLoop(): Initiates the game loop, manages rounds, and player actions.
  • Flow:
    • Starts with the first player's turn in the first round.
    • Loops through players, allowing them to take actions.
    • Ends the round and proceeds to the next round.

Battle Mechanics

  • initiateBattle(): Determines the outcome of battles between Pokémon teams.
  • calculateDamage(): Calculates the damage dealt by an attacker to a defender.
  • applyStatusEffects(): Applies status effects to affected Pokémon.

User Interaction

  • handleClick(): Manages player interactions with the grid and UI elements.
  • selectPokémon(): Enables players to select Pokémon for their team from the available pool.

Ability System

  • activateAbility(): Executes a Pokémon's ability and applies its effects.
  • applyAbilityEffects(): Implements specific effects of different abilities.

UI Interaction

  • updateUI(): Refreshes the user interface to reflect changes in the game state.
  • displayMessage(): Shows notifications or messages to players.

AI Logic (for AI Players)

  • makeDecision(): AI determines actions based on strategy and game state.
  • Flow:
    • Analyzes the current game state and available actions.
    • Makes decisions like choosing Pokémon, using abilities, or positioning.

Data Structures

Pokémon Data

  • A structured collection of Pokémon information.
  • Properties:
    • name, type, stats, abilities, sprites, etc.

Pokémon Pool

  • Stores available Pokémon for players to choose from in each round.
  • Structure:
    • Array of Pokémon objects from the Pokémon Data.

Other Components

Pokémon Sprites and Assets

  • Stores and manages Pokémon sprites and graphical assets used in the game.

Abilities and Status Effects

  • Defines a library of abilities and status effects, along with their effects and triggers.

Game Settings and Configurations

  • Defines game settings, such as round count, time limits per turn, and available Pokémon pool size.