TheCOSCGameProject  1.0
Functions
combat.cpp File Reference

Implementation of combat functions for the game. More...

#include "../lib/dependencies.h"
#include "../lib/combat.h"
#include "../lib/toolkit.h"
Include dependency graph for combat.cpp:

Functions

void printHealth (int playerHealth, int enemyHealth, const std::string &name)
 Print the current health status of the player and enemy. More...
 
bool combatV1 (int *playerHealth, int enemyHealth, int difficulty, const std::string &name, int playerDamage, int enemyDamage, int resistance)
 First version of the combat system. More...
 
void combatV2 (int playerHealth, int enemyHealth)
 Placeholder for the second version of the combat system. More...
 

Detailed Description

Implementation of combat functions for the game.

This file contains two versions of combat systems used in the game. The first version involves quick reflexes to match directional inputs, while the second version is a placeholder for a more strategic combat system.

Function Documentation

◆ combatV1()

bool combatV1 ( int *  playerHealth,
int  enemyHealth,
int  difficulty,
const std::string &  name,
int  playerDamage,
int  enemyDamage,
int  resistance 
)

First version of the combat system.

Handles combat mechanics for version 1.

Parameters
playerHealthThe initial health of the player.
enemyHealthThe initial health of the enemy.
difficultyThe difficulty level of the combat, influencing the response time allowed.
nameThe name of the enemy G.
Returns
True if the player wins, false if the player loses.

This combat system involves the player quickly matching directional inputs to attack the enemy. The enemy's attacks decrease the player's health if the player fails to respond correctly or quickly enough.

◆ combatV2()

void combatV2 ( int  playerHealth,
int  enemyHealth 
)

Placeholder for the second version of the combat system.

Handles combat mechanics for version 2.

Parameters
playerHealthThe initial health of the player.
enemyHealthThe initial health of the enemy.

This version of the combat system is intended to be more strategic, allowing the player to choose different combat styles (Offensive, Sneaky, Defensive). The implementation details are yet to be completed.

◆ printHealth()

void printHealth ( int  playerHealth,
int  enemyHealth,
const std::string &  name 
)

Print the current health status of the player and enemy.

Prints the health status of the player and the enemy.

Parameters
playerHealthThe current health of the player.
enemyHealthThe current health of the enemy.
nameThe name of the enemy.

This function prints the player's and enemy's health in a formatted health bar.