Skip to content

This interactive game 🎮 features a diverse array of monsters 🐉, each equipped with unique statistics including attack ⚔️ and defense 🛡️ attributes, engaging in strategic battles against one another

Notifications You must be signed in to change notification settings

echooferen/Monster-Brawl-app

Repository files navigation

Monster Brawl

The "Monster Brawl" app is an interactive game where different monsters with unique statistics, such as attack and defense, face each other. The project includes an API that allows the management of monsters and battles, offering an exciting and dynamic experience.

Monster Brawl Algorithm

For calculating the battle algorithm, take into account the flow below:

  • The monster with the highest speed makes the first attack, if both speeds are equal, the monster with the higher attack goes first.
  • For calculating the damage, subtract the defense from the attack (attack - defense); the difference is the damage; if the attack is equal to or lower than the defense, the damage is 1.
  • Subtract the damage from the HP (HP = HP - damage).
  • Monsters will battle in turns until one wins; all turns should be calculated in the same request; for that reason, the battle endpoint should return winner data in just one call.
  • Who wins the battle is the monster who subtracted the enemy’s HP to zero

Requirements

Throubleshooting

To install the Diesel CLI, you need to have the libpq-dev package installed. You can install it with the following command:

sudo apt-get install libpq-dev

Setup

docker-compose -f docker-postgres.yaml up -d
diesel setup
diesel migration run

After running the commands above, the database will be created and the migrations will be executed. Then, you need to create a .env file with the following command:

cp .env.example .env

Run

make run # or cargo run

Now, you can access the API at http://localhost:8000.

About

This interactive game 🎮 features a diverse array of monsters 🐉, each equipped with unique statistics including attack ⚔️ and defense 🛡️ attributes, engaging in strategic battles against one another

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published