/RPG_JS

simple text-based rpg in javascript

Primary LanguageJavaScript

Hero Creation and Battle System

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.

Features

  • 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.

Getting Started

  1. Clone the repository:
git clone https://github.com/your-username/hero-creation-battle.git
  1. Navigate to the project directory:
cd hero-creation-battle
  1. Open the index.html file in your preferred web browser to use the application.

Usage

  • 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.

Mechanics

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.

Future Enhancements

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.

License

This project is licensed under the MIT License.