Make the game engine use a start/end round and do healing if you don't make any mistakes.

This commit is contained in:
Zed A. Shaw 2024-08-21 18:44:32 -04:00
parent e35536c7e3
commit c52bc8fafd
4 changed files with 25 additions and 8 deletions

View file

@ -136,16 +136,28 @@ int GameEngine::determine_damage(string &type) {
}
}
void GameEngine::start_round() {
hits_taken = 0;
}
void GameEngine::end_round() {
if(hits_taken == 0) {
heal();
}
}
bool GameEngine::hit(string &type) {
int damage = determine_damage(type);
hit_points -= damage;
++hits_taken;
// super dumb but I'll clean it up later
return is_dead();
}
void GameEngine::heal(int amount) {
hit_points += amount;
void GameEngine::heal() {
hit_points = hit_points * 1.10;
if(hit_points > 100) hit_points = 100;
}
bool GameEngine::is_dead() {