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.
- 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.
- Dynamic Fetching: Uses the
fetchAPI 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/awaitto 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).
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.
- Asynchronous JavaScript: Managing
Promisesand usingtry/catchblocks 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.
- 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).
- Download the repository.
- Open the
index.htmlfile in any modern web browser. - Select the attack type and the defender's types, then click Calculate.