Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <windows.h>
- using namespace std;
- //funktion för text på dialog
- void txtDia(){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
- }
- //funktion för att återställa färg på text
- void* txtNorm(){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
- }
- //Function for Highligting choices in colour
- void txtChoice(){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE);
- }
- //Funktion för UI input
- void uiInput(){
- cout << "--> ";
- }
- //Klass för att skapa en karaktär, hålla koll på stats och inventory.
- class Hero{
- public:
- string name;
- int str;
- int dex;
- int inte;
- int gold;
- int sword;
- int knife;
- int magic;
- int health;
- //Hero (string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic);
- void createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health);
- void statsScr(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health);
- };
- //Konstruktor till klassen Hero
- /*Hero::Hero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic){
- name = _name;
- str = _str;
- dex = _dex;
- inte = _inte;
- gold = _gold;
- sword = _sword;
- knife = _knife;
- magic = _magic;
- } */
- void Hero::createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health){
- cout << "Your goal is to survive one day in this crazy and messed up world.\n"
- "In order to survive you must know that every action has a consequence. Choose\nwisely who you are,"
- " your life depends on it...\n\n\n";
- cout << "Your name: "; cin >> _name;
- string choice1;
- do{
- cout << "\nYour parents are since long dead, they left you with a small hut\nin the poorer districts of the city. But they also left you something else.\n\n"
- "A) Your father, whom was a soldier, left you his "; txtChoice(); cout << "sword\n\n"; txtNorm();
- cout << "B) Your mother was a fierce rogue while alive, she left you her beloved "; txtChoice(); cout << "dagger"; txtNorm(); cout << ".\n\n";
- cout << "C) Your parents were always poor while alive, but they had managed to save up a\nsmall pile of "; txtChoice(); cout << "gold"; txtNorm(); cout << " for you.\n\n";
- cout << "D) A dusty"; txtChoice(); cout << " book"; txtNorm(); cout << " that your mother always hid away from your father.\n\n";
- uiInput(); cin >> choice1;
- if (choice1 == "sword" || choice1 == "Sword"){
- _sword = 1;
- _knife = 0;
- _str = 1;
- _health = 12;
- cout << "\n\nYour fathers sword is still sharp, it feels heavy in your arms.\nIt will come of good use to you in the future\n\n";
- break;
- }
- else if (choice1 == "Dagger" || choice1 == "dagger"){
- _knife = 1;
- _sword = 0;
- _dex = 1;
- _health = 10;
- cout << "\n\nHer dagger has saved you more times than you can remember.\nThe poor district is a harsh place.\n\n";
- break;
- }
- else if (choice1 == "gold" || choice1 == "Gold"){
- _gold = 100;
- _health = 10;
- _sword = 0;
- _knife = 0;
- cout << "\n\nAll that remains of the hefty sum they left you is only a hundred gold pieces,\nstill enough money for a years living\n\n";
- break;
- }
- else if (choice1 == "book" || choice1 == "Book"){
- _inte = 1;
- _magic = 1;
- _health = 8;
- _sword = 0;
- _knife = 0;
- cout << "\n\nWhile reading the book for the first time, you realise it's a book \nexplaining the principles and basics of blood magic.\n"
- "You're able to do some basic magic from the book, but the cost is always in\nblood. You only use your magic if your life depends on it.\n\n";
- break;
- }
- else {
- system ("cls");
- continue;
- }
- }
- while (true);
- system ("PAUSE");
- name = _name;
- str = _str;
- dex = _dex;
- inte = _inte;
- gold = _gold;
- sword = _sword;
- knife = _knife;
- magic = _magic;
- health = _health;
- }
- void Hero::statsScr(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health){
- cout << "_____________________________________\n"
- " \n"
- "Name: " << name << " \n"
- " \n"
- "Weapon: ";
- //För att kontrollera vilket vapen man har
- if ( knife > 0){
- cout << "Dagger \n";
- }
- else if (sword > 0 ){
- cout << "Sword \n";
- }
- else {
- cout << "No weapon \n";
- }
- // Kontrollerar vilken magi typ man använder.
- cout << "Magic: ";
- if (magic == 1){
- cout << "Blood Magic \n";
- }
- else {
- cout << "No magic \n";
- }
- // guld och health
- cout << endl << "Gold: " << gold << endl;
- cout << endl << "Health: " << health << endl;
- cout << "_____________________________________\n";
- }
- //Funktion för titlescreeen
- void titleScr(){
- cout << "Please extend the console window until it reaches a congenial size\n"
- "Choices in this game will be highlighted in"; txtChoice(); cout << " purple"; txtNorm(); cout << ".\nEnjoy:\n";
- system ("PAUSE");
- system ("cls");
- cout <<"___________________¶¶¶¶ \n"
- "_______________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶ \n"
- "___________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶_¶¶¶ \n"
- "_________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______¶¶¶¶¶¶¶¶_______¶¶¶¶¶¶¶¶¶___¶¶¶¶\n"
- "_____¶¶¶¶¶¶¶______________________¶¶\n"
- "_____¶¶¶¶¶¶___¶¶¶¶¶________________¶\n"
- "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
- "____¶¶¶¶¶¶___¶¶111¶¶\n"
- "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
- "____¶¶¶¶¶¶____¶¶1¶¶\n"
- "_____¶¶¶¶¶¶___¶¶1¶¶\n"
- "_____¶¶¶¶¶¶¶¶_¶¶¶¶¶\n"
- "______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "_______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "_________¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "__¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "____¶¶¶¶11111111111111111¶¶¶¶¶\n"
- "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶\n"
- "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶¶¶\n"
- "_____________¶¶¶¶¶¶¶¶¶¶\n"
- "____________¶¶¶¶¶¶¶¶¶\n"
- "___________¶¶¶¶¶¶¶_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "___________¶¶¶¶¶_1_¶¶\n"
- "____________¶¶¶¶_1_¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶_¶¶¶¶¶\n"
- "______________¶¶_1_¶¶__¶¶¶¶¶\n"
- "______________¶¶___¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶___¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶\n"
- "_____________¶¶¶¶¶¶¶¶¶\n"
- "____________¶¶¶¶¶¶¶¶¶\n"
- "___________¶¶¶¶¶___¶¶\n"
- "___________¶¶¶¶¶___¶¶\n"
- "___________¶¶¶¶¶___¶¶\n"
- "____________¶¶¶¶___¶¶\n"
- "____________¶¶¶¶___¶¶\n"
- "______________¶¶___¶¶¶¶¶¶\n"
- "______________¶¶___¶¶¶¶¶¶¶\n"
- "______________¶¶___¶¶_¶¶¶¶¶\n"
- "______________¶¶___¶¶___¶¶¶¶\n"
- "_______________¶¶_¶¶_____¶¶¶\n"
- "________________¶¶¶______¶¶¶\n"
- "_________________¶_______¶¶\n"
- " _ \n "
- "___ _ _ _ __ __ __ (_) __ __ ___ \n"
- "/ __| | | | | | '__| \\ \\ / / | | \\ \\ / / / _ \\ \n"
- "\\__ \\ | |_| | | | \\ V / | | \\ V / | __/ \n"
- "|___/ \\__,_| |_| \\_/ |_| \\_/ \\___| \n";
- system ("PAUSE");
- system ("cls");
- }
- void chap1(Hero& myHero){
- system ("cls");
- myHero.statsScr(myHero.name, myHero.str, myHero.dex, myHero.inte, myHero.gold, myHero.sword, myHero.knife, myHero.magic, myHero.health);
- cout << "\n\nYou're lying in your bed, dreaming of another life. A life without poverty\n"
- "Even before your parents died, life was harsh. As long as you could remember\n"
- "Temolia had always been a cruel city to live in, but when your parents where\n"
- "still alive they told you about how it used to be. What seemed like distant\n"
- "tales from now, tales about a prosperous small town, with an excellent harbor\n"
- "and economy, getting a work would be no problem for almost anyone. But as the \n"
- "war with the neighboruing countries went on, Temolia quickly became\n"
- "overpopulated. And when the capital was destroyed, rulers decided to make\n"
- "Temolia the new capital and move their basis of operation there, things just\n"
- "got worse. The city was being expanded in a quick rate, which resulted in\n"
- "sloppy work. Nowadays it wasn't unusual for buildings in the poorer district\n"
- "to fall in. The city were still being expanded. but only mansions and buildings\n"
- "for the rich was being manufactured. The war was over, but no one could really\n"
- "tell who won and who lost the war. Temolia was untouched by the battles of the\n"
- "war, but the whole as an empire was fundamentally shaken the the bones, the \n"
- "economy collapsed and the remaining politicians greedily tried to clutch on\n"
- "the last remaining resources for their own use.";
- }
- int main() {
- titleScr();
- //Skapa ett objekt av klassen Hero
- Hero myHero;
- myHero.createHero(myHero.name, myHero.str, myHero.dex, myHero.inte, myHero.gold, myHero.sword, myHero.knife, myHero.magic, myHero.health);
- chap1(myHero);
- system ("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment