<commit_before>#include <fstream>
#include <iostream>

#include "..\include\Common.h"
#include "..\include\Player.h"

using namespace std;
using namespace Common;

void Player::SaveGame(){
    ofstream WriteData;
    WriteData.open("data.txt");
    WriteData << player_type << endl 
			  << name << endl
              << level << endl
              << experience << endl
              << health << endl
              << arrows << endl
              << bombs << endl
              << potions << endl
              << whetstones << endl
              << weaponstrength << endl
              << coins;
    WriteData.close();
}



void Player::SetPlayerData(){
    // Primarily initializes default values at the beginning of the game.

	ifstream ReadData;
	ReadData.clear();
	ReadData.open("data.txt");

	ReadData >> player_type;
    ReadData >> name;
    ReadData >> level;
    ReadData >> experience;
    ReadData >> health;
    ReadData >> arrows;
    ReadData >> bombs;
    ReadData >> potions;
    ReadData >> whetstones;
    ReadData >> weaponstrength;
    ReadData >> coins;

    ReadData.close();
    
}

int Player::Attack(){
    // Returns the amount of attack points the player gives.
    // Also the main battle screen.

    int choice = 0;


    // Displays the inventory.
    DisplayInventory();

    // Gives player a list of moves to choose from.
	cout << "Choose your move:" << endl
		<< "1) Attack" << endl
		<< "2) Risk Attack" << endl
		<< "3) Bow and Arrow" << endl
		<< "4) Heal" << endl << endl
		<< "5) Use Bomb" << endl
		<< "6) Use Potion" << endl
		<< "7) Use Whetstone" << endl
		<< "0) Get me out of here!" << endl << endl;
	
	while (true) {
		choice = input();

		// Evaluates player's choice.
		switch (choice) {
		case 0:
			return Flee();
		case 1:
			// Player generically attacks.
			return GenericAttack();
		case 2:
			// Player takes a risk and attacks.
			return RiskAttack();
		case 3:
			// Player shoots their bow.
			if (arrows > 0)
				return BowAndArrow();
			break;
		case 4:
			// Player heals, no damage is done to enemy.
			Heal();
			return 0;
		case 5:
			// Player throws a bomb.
			// Does not execute if there are no bombs in the inventory.
			if (bombs > 0) 
				return UseBomb();
			break;
		case 6:
			// Player drinks a potion.
			// Does not execute if there are no potions in the inventory.
			if (potions > 0) {
				UsePotion();
				return 0;
			}
			break;
		case 7:
			// Player sharpens their weapon with a whetstone.
			// Does not execute if there are no whetstones in inventory.
			// No damage is done to the enemy.
			if (whetstones > 0) {
				UseWhetstone();
				return 0;
			}
			break;
		default:
			// Generically attacks by default if player's choice does not equal above cases.
			return GenericAttack();
		}
	}
}

void Player::UseItem() {
	// Use item from inventory
	int choice = 0;

	while (true) {
		ClearScreen();

		// Displays the inventory.
		DisplayInventory();

		// Gives player a list of moves to choose from.
		cout << "Choose which item use:" << endl
			<< "1) Use Potion" << endl
			<< "2) Use Whetstone" << endl
			<< "0) Quit" << endl << endl;

		choice = input();

		// Evaluates player's choice.
		switch (choice) {
		case 0:
			return;
		case 1:
			// Player drinks a potion.
			// Does not execute if there are no potions in the inventory.
			if (potions > 0) {
				UsePotion();
				Sleep(SLEEP_MS);
			}

			break;
		case 2:
			// Player sharpens their weapon with a whetstone.
			// Does not execute if there are no whetstones in inventory.
			// No damage is done to the enemy.
			if (whetstones > 0) {
				UseWhetstone();
				Sleep(SLEEP_MS);
			}

			break;
		default:
			break;
		}
	}
}
<commit_msg>Added messages when items = 0<commit_after>#include <fstream>
#include <iostream>

#include "..\include\Common.h"
#include "..\include\Player.h"

using namespace std;
using namespace Common;

void Player::SaveGame(){
    ofstream WriteData;
    WriteData.open("data.txt");
    WriteData << player_type << endl 
			  << name << endl
              << level << endl
              << experience << endl
              << health << endl
              << arrows << endl
              << bombs << endl
              << potions << endl
              << whetstones << endl
              << weaponstrength << endl
              << coins;
    WriteData.close();
}



void Player::SetPlayerData(){
    // Primarily initializes default values at the beginning of the game.

	ifstream ReadData;
	ReadData.clear();
	ReadData.open("data.txt");

	ReadData >> player_type;
    ReadData >> name;
    ReadData >> level;
    ReadData >> experience;
    ReadData >> health;
    ReadData >> arrows;
    ReadData >> bombs;
    ReadData >> potions;
    ReadData >> whetstones;
    ReadData >> weaponstrength;
    ReadData >> coins;

    ReadData.close();
    
}

int Player::Attack(){
    // Returns the amount of attack points the player gives.
    // Also the main battle screen.

    int choice = 0;


    // Displays the inventory.
    DisplayInventory();

    // Gives player a list of moves to choose from.
	cout << "Choose your move:" << endl
		<< "1) Attack" << endl
		<< "2) Risk Attack" << endl
		<< "3) Bow and Arrow" << endl
		<< "4) Heal" << endl << endl
		<< "5) Use Bomb" << endl
		<< "6) Use Potion" << endl
		<< "7) Use Whetstone" << endl
		<< "0) Get me out of here!" << endl << endl;
	
	while (true) {
		choice = input();

		// Evaluates player's choice.
		switch (choice) {
		case 0:
			return Flee();
		case 1:
			// Player generically attacks.
			return GenericAttack();
		case 2:
			// Player takes a risk and attacks.
			return RiskAttack();
		case 3:
			// Player shoots their bow.
			if (arrows > 0)
				return BowAndArrow();
			break;
		case 4:
			// Player heals, no damage is done to enemy.
			Heal();
			return 0;
		case 5:
			// Player throws a bomb.
			// Does not execute if there are no bombs in the inventory.
			if (bombs > 0) 
				return UseBomb();
			break;
		case 6:
			// Player drinks a potion.
			// Does not execute if there are no potions in the inventory.
			if (potions > 0) {
				UsePotion();
				return 0;
			}
			break;
		case 7:
			// Player sharpens their weapon with a whetstone.
			// Does not execute if there are no whetstones in inventory.
			// No damage is done to the enemy.
			if (whetstones > 0) {
				UseWhetstone();
				return 0;
			}
			break;
		default:
			// Generically attacks by default if player's choice does not equal above cases.
			return GenericAttack();
		}
	}
}

void Player::UseItem() {
	// Use item from inventory
	int choice = 0;

	while (true) {
		ClearScreen();

		// Displays the inventory.
		DisplayInventory();

		// Gives player a list of moves to choose from.
		cout << "Choose which item use:" << endl
			<< "1) Use Potion" << endl
			<< "2) Use Whetstone" << endl
			<< "0) Quit" << endl << endl;

		choice = input();

		// Evaluates player's choice.
		switch (choice) {
		case 0:
			return;
		case 1:
			// Player drinks a potion.
			// Does not execute if there are no potions in the inventory.
			if (potions > 0) {
				UsePotion();
				Sleep(SLEEP_MS);
			} else {
				cout << "No potions in the inventory!" << endl;
				Sleep(SLEEP_MS);
			}

			break;
		case 2:
			// Player sharpens their weapon with a whetstone.
			// Does not execute if there are no whetstones in inventory.
			// No damage is done to the enemy.
			if (whetstones > 0) {
				UseWhetstone();
				Sleep(SLEEP_MS);
			} else {
				cout << "No whetstones in the inventory!" << endl;
				Sleep(SLEEP_MS);
			}

			break;
		default:
			break;
		}
	}
}

{'fraction_non_alphanumeric': 0.1262033495977845, 'fraction_numerical': 0.00883555321113016, 'mean_word_length': 2.271786022433132, 'pattern_counts': {'":': 0, '<': 215, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5243600', 'n_tokens_mistral': 2845, 'n_tokens_neox': 2374, 'n_words': 850}