Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Bazoonkas_Tamagotchi/activities.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
304 lines (275 sloc)
6.82 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <conio.h> | |
#include "display.h" | |
#include "Stats.h" | |
void Food(Stats &pet) | |
{ | |
std::vector<std::string> food = {"Pizza", "Fruit", "Burger", "Menu"}; | |
if (pet.icecream) | |
{ | |
food.insert(food.begin() + food.size() - 1, "Icecream"); | |
} | |
if (pet.cabbage) | |
{ | |
food.insert(food.begin() + food.size() - 1, "Cabbage"); | |
} | |
std::string output = Display(food); | |
if (output == "Pizza"){ | |
if (pet.get_Hunger() == 100){ | |
cout << "I'm full!" << endl; | |
system("pause"); | |
} | |
else { | |
cout << "I love pizza" << endl; | |
pet.inc_Hunger(15, true); | |
system("pause"); | |
} | |
} | |
else if (output == "Fruit"){ | |
if (pet.get_Hunger() == 100){ | |
cout << "I'm full!" << endl; | |
system("pause"); | |
} | |
else{ | |
cout << "Fruit bowl it is" << endl; | |
pet.inc_Hunger(10, true); | |
system("pause"); | |
} | |
} | |
else if (output == "Burger"){ | |
if (pet.get_Hunger() == 100){ | |
cout << "I'm full!" << endl; | |
system("pause"); | |
} | |
else { | |
cout << "Burger and chips really fill me up" << endl; | |
pet.inc_Hunger(20, true); | |
system("pause"); | |
} | |
} | |
else if (output == "Icecream"){ | |
if (pet.get_Hunger() == 100){ | |
cout << "I'm full!" << endl; | |
system("pause"); | |
} | |
else { | |
cout << "Brrrr Cold!" << endl; | |
pet.inc_Hunger(10, true); | |
pet.inc_Happiness(10, true); | |
system("pause"); | |
} | |
} | |
else if (output == "Cabbage"){ | |
if (pet.get_Hunger() == 100){ | |
cout << "I'm full!" << endl; | |
system("pause"); | |
} | |
else { | |
cout << "Cabbage? I never slaw this coming" << endl; | |
pet.inc_Hunger(5, true); | |
pet.inc_Energy(10, true); | |
system("pause"); | |
} | |
} | |
else if (output == "Menu"){} | |
} | |
void Games(Stats &pet) | |
{ | |
std::vector<std::string> games = {"Football", "Swimming", "Gaming", "Menu"}; | |
if (pet.rugby) | |
{ | |
games.insert(games.begin() + games.size() - 1, "Rugby"); | |
} | |
if (pet.basketball) | |
{ | |
games.insert(games.begin() + games.size() - 1, "Basketball"); | |
} | |
std::string output = Display(games); | |
if (output == "Football") | |
{ if (pet.get_Energy() < 25){ | |
cout << "I'm too tired!" << endl; | |
system("pause"); | |
} | |
else { | |
cout << "I love playing football" << endl; | |
pet.inc_Hunger(-30, true); | |
pet.inc_Happiness(20, true); | |
pet.inc_Energy(-25, true); | |
pet.inc_xp(); | |
system("pause"); | |
} | |
} | |
else if (output == "Swimming") | |
{ | |
if (pet.get_Energy() < 35){ | |
cout << "I'm too tired!" << endl; | |
system("pause"); | |
} | |
else{ | |
cout << "I love swimming" << endl; | |
pet.inc_Hunger(-35, true); | |
pet.inc_Happiness(20, true); | |
pet.inc_Health(10, true); | |
pet.inc_Energy(-35, true); | |
pet.inc_xp(); | |
system("pause"); | |
} | |
} | |
else if (output == "Gaming") | |
{ | |
if (pet.get_Energy() < 10){ | |
cout << "I'm too tired!" << endl; | |
system("pause"); | |
} | |
else{ | |
cout << "I love playing Mario Kart" << endl; | |
pet.inc_Hunger(-10, true); | |
pet.inc_Happiness(15, true); | |
pet.inc_Energy(-10, true); | |
pet.inc_xp(); | |
system("pause"); | |
} | |
} | |
else if (output == "Rugby") | |
{ | |
if (pet.get_Energy() < 10){ | |
cout << "I'm too tired!" << endl; | |
system("pause"); | |
} | |
else{ | |
cout << "I love rugby" << endl; | |
pet.inc_Hunger(-30, true); | |
pet.inc_Happiness(25, true); | |
pet.inc_Health(15, true); | |
pet.inc_Energy(-45, true); | |
pet.inc_xp(); | |
pet.inc_xp(); | |
system("pause"); | |
} | |
} | |
else if (output == "Basketball") | |
{ | |
if (pet.get_Energy() < 10){ | |
cout << "I'm too tired!" << endl; | |
system("pause"); | |
} | |
else{ | |
cout << "I love basketball" << endl; | |
pet.inc_Hunger(-35, true); | |
pet.inc_Happiness(25, true); | |
pet.inc_Health(15, true); | |
pet.inc_Energy(-30, true); | |
pet.inc_xp(); | |
pet.inc_xp(); | |
system("pause"); | |
} | |
} | |
else if (output == "Menu") | |
{ | |
} | |
} | |
void Shop(Stats &pet) | |
{ | |
std::vector<std::string> items = {"Icecream: 6", "Cabbage: 2", "Rugby: 15", "Basketball: 20", "Menu"}; | |
if (pet.icecream) | |
{ | |
for (int i = 0; i < items.size() - 1; i++) | |
{ | |
if (items[i] == "Icecream: 6") | |
{ | |
items.erase(items.begin() + i); | |
} | |
} | |
} | |
if (pet.cabbage) | |
{ | |
for (int i = 0; i < items.size() - 1; i++) | |
{ | |
if (items[i] == "Cabbage: 2") | |
{ | |
items.erase(items.begin() + i); | |
} | |
} | |
} | |
if (pet.rugby) | |
{ | |
for (int i = 0; i < items.size() - 1; i++) | |
{ | |
if (items[i] == "Rugby: 15") | |
{ | |
items.erase(items.begin() + i); | |
} | |
} | |
} | |
if (pet.basketball) | |
{ | |
for (int i = 0; i < items.size() - 1; i++) | |
{ | |
if (items[i] == "Basketball: 20") | |
{ | |
items.erase(items.begin() + i); | |
} | |
} | |
} | |
std::string output = Display(items); | |
if (output == "Icecream: 6") | |
{ | |
if (pet.currency - 6 >= 0) | |
{ | |
cout << "Icecream now avaliable" << endl; | |
pet.icecream = true; | |
pet.inc_Currency(-6, true); | |
system("pause"); | |
} | |
else | |
{ | |
cout << "You can't afford this item as you only have " << pet.currency << endl; | |
system("pause"); | |
} | |
} | |
if (output == "Cabbage: 2") | |
{ | |
if (pet.currency - 2 >= 0) | |
{ | |
cout << "Cabbage now avaliable" << endl; | |
pet.cabbage = true; | |
pet.inc_Currency(-2, true); | |
system("pause"); | |
} | |
else | |
{ | |
cout << "You can't afford this item as you only have " << pet.currency << endl; | |
system("pause"); | |
} | |
} | |
else if (output == "Rugby: 15") | |
{ | |
if (pet.currency - 15 >= 0) | |
{ | |
cout << "Rugby now avaliable" << endl; | |
pet.rugby = true; | |
pet.inc_Currency(-15, true); | |
system("pause"); | |
} | |
else | |
{ | |
cout << "You can't afford this item as you only have " << pet.currency << endl; | |
system("pause"); | |
} | |
} | |
else if (output == "Basketball: 20") | |
{ | |
if (pet.currency - 20 >= 0) | |
{ | |
cout << "Basketball now avaliable" << endl; | |
pet.basketball = true; | |
pet.inc_Currency(-20, true); | |
system("pause"); | |
} | |
else | |
{ | |
cout << "You can't afford this item as you only have " << pet.currency << endl; | |
system("pause"); | |
} | |
} | |
} |