A simple web application for hero creation and battle simulation, built using HTML, CSS, and JavaScript. This project demonstrates the use of ES6 modules, event listeners, and basic game mechanics.
- Create heroes with different professions: Barbarian, Assassin, Sorceress, Archer.
- Simulate battles between heroes using an attack and dodge mechanic.
- Save and load hero data to continue your progress.
- Clone the repository:
git clone https://github.com/your-username/hero-creation-battle.git
- Navigate to the project directory:
cd hero-creation-battle
- Open the
index.html
file in your preferred web browser to use the application.
- Choose a hero profession from the dropdown menu and click the "Create Hero 1" or "Create Hero 2" button to create heroes.
- Click the "Save Heroes" button to save hero data locally.
- Click the "Load Heroes" button to load previously saved hero data.
- Initiate battles between heroes using the attack and dodge mechanic.
The attacking
function simulates battles between two heroes:
- The attacker's profession and attack value are displayed.
- The defender's profession and current hit points (hp) are displayed.
- A random dodge chance is calculated for the defender.
- If the defender successfully dodges (dodge chance >= 100), the attack is evaded.
- Otherwise, the defender loses hit points equal to the attacker's attack value.
- If the defender's hit points drop to 0 or below, they are defeated.
This project has potential for expansion:
- Introduce a leveling up system for heroes.
- Implement monsters with experience and gold rewards.
- Add a shop system for purchasing items and equipment.
- Incorporate equipment slots and gear management.
This project is licensed under the MIT License.