https://github.com/web3batman/monster-brawl-app
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
https://github.com/web3batman/monster-brawl-app
ddd import-csv postgre rust
Last synced: 7 months ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/web3batman/monster-brawl-app
- Owner: web3batman
- Created: 2024-05-09T07:53:00.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-26T15:02:06.000Z (about 1 year ago)
- Last Synced: 2024-06-20T05:34:32.702Z (about 1 year ago)
- Topics: ddd, import-csv, postgre, rust
- Language: Rust
- Homepage:
- Size: 34.2 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
* [Rust](https://www.rust-lang.org/learn/get-started)
* [Docker and Docker Compose](https://docs.docker.com/get-docker/)
* [Diesel CLI](https://diesel.rs/guides/getting-started/)### Throubleshooting
To install the Diesel CLI, you need to have the `libpq-dev` package installed. You can install it with the following command:
```bash
sudo apt-get install libpq-dev
```## Setup
```bash
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:
```bash
cp .env.example .env
```## Run
```bash
make run # or cargo run
```Now, you can access the API at `http://localhost:8000`.