Skip to content

1N-i/Pokemon-damage-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

⚔️ Pokémon Type Effectiveness Calculator

HTML5 CSS3 JavaScript API

A web-based tool that calculates type effectiveness for Pokémon battles. It fetches real-time data from the PokéAPI to determine damage multipliers against single or dual-type defenders.

📋 Summary


🛠 Technologies

  • HTML5: Structured interface using tables and dropdown selections.
  • CSS3: Layout design using Flexbox for centering and responsive scaling.
  • JavaScript (ES6+): Handles asynchronous API calls and damage logic.
  • PokéAPI: The source for all Pokémon type relationship data.

✨ Features

  • Dynamic Fetching: Uses the fetch API to get the most accurate type data directly from the PokéAPI database.
  • Dual-Type Support: Calculates the combined multiplier for Pokémon with two types (e.g., Flying/Dragon).
  • Asynchronous Logic: Implements async/await to ensure data is retrieved before calculating the final result.
  • Visual Feedback: Large, clear display of the damage multiplier (0x, 0.25X, 0.5x, 1x, 2x, or 4x).

📂 Project Architecture

The project is built with a standard web structure:

  • index.html: Contains the dropdown menus for attack and defense types.
  • style.css: Manages the visual presentation, including the minimalist gray theme and centered layout.
  • script.js: The "brain" of the app. It handles the API requests and the mathematical logic for type effectiveness.

📚 What I Learned

  • Asynchronous JavaScript: Managing Promises and using try/catch blocks for robust API interactions.
  • Complex Conditionals: Logic implementation using .some() to check for matches within nested JSON arrays from the API.
  • DOM Integration: Efficiently updating the UI based on user input and API responses.

🔮 Future Improvements

  • Add Pokémon sprites based on selected types.
  • Implement a search bar to find Pokémon by name instead of manual type selection.
  • Dark mode toggle for the interface.
  • Support for abilities that change type effectiveness (e.g., Levitate).

🚀 How to Run

  1. Download the repository.
  2. Open the index.html file in any modern web browser.
  3. Select the attack type and the defender's types, then click Calculate.