Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <windows.h>
- class explore
- {
- private:
- bool isExploring = true;
- bool isInCombat = false;
- int playerLocationX=0;
- int playerLocationY=0;
- int encounterEnemy = 0;
- public:
- bool InitializeBattle()
- {
- if (encounterEnemy == 1)
- {
- isInCombat = true;
- return isInCombat;
- }
- else
- {
- isInCombat = false;
- return isInCombat;
- }
- }
- bool ExploreMode()
- {
- if (encounterEnemy == 0)
- {
- isExploring = true;
- }
- else{ isExploring = false; }
- return isExploring;
- }
- int RunExploring()
- {
- std::string exploreInput = "";
- std::cin >> exploreInput;
- if (exploreInput == "N")
- {
- GoNorth();
- }
- if (exploreInput == "E")
- {
- GoEast();
- }
- if (exploreInput == "W")
- {
- GoWest();
- }
- if (exploreInput == "S")
- {
- GoSouth();
- }
- return 0;
- }
- int GoNorth()
- {
- playerLocationY += 1;
- return playerLocationY;
- }
- int GoEast()
- {
- playerLocationX += 1;
- return playerLocationX;
- }
- int GoWest()
- {
- playerLocationX -= 1;
- return playerLocationX;
- }
- int GoSouth()
- {
- playerLocationY -=1;
- return playerLocationY;
- }
- int ShowPlayerLocation
- ()
- {
- std::cout << playerLocationX<<playerLocationY<<std::endl;
- return 0;
- }
- };
- class player
- {
- private:
- int playerIntelligence;
- int playerStrength;
- int playerAgility;
- int playerDamage;
- int playerGold;
- int playerHealth;
- public:
- player()
- {}
- int setPlayer()
- {
- playerIntelligence = 10;
- playerStrength = 10;
- playerAgility = 10;
- playerDamage = 10;
- playerGold = 100;
- playerHealth = 10;
- return playerHealth;
- return playerIntelligence;
- return playerStrength;
- return playerAgility;
- return playerDamage;
- return playerGold;
- }
- int getPlayer()
- {
- std::cout << "Your have " << playerGold << "gold coins " << std::endl;
- std::cout << "====================================================" << std::endl;
- std::cout << "======\nStats\n======\n" << " Your Intelligence is " << playerIntelligence << std::endl;
- std::cout << "====================================================" << std::endl;
- std::cout << "Your Strength is " << playerStrength << std::endl;
- std::cout << "====================================================" << std::endl;
- std::cout << "Your Agility is " << playerAgility << std::endl;
- std::cout << "====================================================" << std::endl;
- std::cout << "Your totall Damage is " << playerDamage << std::endl;
- std::cout << "====================================================" << std::endl;
- std::cout << "Your Health is " << playerHealth << std::endl;
- return 0;
- }
- int playerTakeDamage(int p_ienemyDamage, int p_ienemyHitrate)
- {
- playerHealth -= p_ienemyDamage; //<---- Leder ej till att man tar skada
- return playerHealth;
- }
- };
- class BattleScene
- {
- private:
- bool enemyIsDead;
- int enemyDamage = 0;
- int enemyHp = 0;
- int enemyAttackTime;
- int enemyGold;
- int playerdamage = 0;
- int playerhp;
- int playerAttackTime;
- std::string playerCommand;
- std::string enemyName;
- public:
- BattleScene() //Konstruktor körs vid kall på medtoden
- {
- }
- int fireball()
- {
- }
- int BattleStart(std::string p_senemyname, int p_ienemydamage, int p_ienemyHealth, int p_igold) //initierar variabler i start av fight
- {
- enemyIsDead = false;
- enemyName = p_senemyname;
- enemyDamage = p_ienemydamage;
- enemyHp = p_ienemyHealth;
- enemyGold = p_igold;
- std::cout << "A Battle has begun the enemy is a " << enemyName;
- return 0;
- }
- int playerTurn(int p_iplayerdamage, int p_ienemyhealth) //spelarens tur
- {
- std::string enemyCondition;
- std::cout << "The Battle Keeps Going"<<std::endl;//ska göra enemycondition till egen metod.
- playerCommand = "";
- enemyCondition = "stands before you";
- if (enemyHp <= 15 && enemyHp>0)
- {
- enemyCondition = "is nearly Dead";
- }
- if (enemyHp <= 30 && enemyHp >= 15)
- {
- enemyCondition = "is bleeding ";
- }
- if (enemyHp <= 0)
- {
- enemyCondition = "is Dead";
- }
- std::cout << "Enemy " << enemyName << std::endl;
- std::cout << "Enemy Health " << enemyHp << std::endl;
- std::cout << "The fearsome " << enemyName << enemyCondition << std::endl << " Choose your action either [A]ttack or [P]laceholder or [C}heckstats" << std::endl;
- std::cin >> playerCommand;
- if (playerCommand == "A")
- {
- Beep(400, 500);
- std::cout << "You attack the " << enemyName << " and it loses " << p_iplayerdamage << " Hp \n " << std::endl;
- enemyHp -= p_iplayerdamage;
- }
- else if (playerCommand == "P")
- {
- std::cout << "PlaceHolder" << std::endl;
- }
- else if (playerCommand == "C")
- {
- player playerCall; //gör inget för tillfället
- playerCall.getPlayer(); //gör inget för tillfället
- }
- else
- {
- std::cout << "You skip your turn because of ignorace" << std::endl;
- }
- playerCommand = "";
- return enemyHp;
- }
- void DeathChecker()
- {
- if (enemyHp <= 0)
- {
- std::cout << "The Enemy is Dead";
- WinBattle();
- }
- }
- int WinBattle() //winbattle metod
- {
- std::cout << std::string(20, '\n');
- std::cout << " Win Battle PlaceHolder for epic loot";
- VictoryMusic(); //kallar på funky ljud
- return 0;
- }
- int enemyTurn(int p_ienemyDamage) //fiendens tur
- {
- player playerCall;
- std::cout << "THE ENEMY ATTACKS" << std::endl;
- Beep(1300, 200);
- playerCall.playerTakeDamage(enemyDamage, 100); //<---- Leder ej till att man tar skada
- return 0;
- }
- void VictoryMusic() //spelar funky ljud
- {
- Beep(400, 500);
- Beep(500, 400);
- Beep(600, 300);
- Beep(700, 200);
- Beep(800, 550);
- Beep(900, 600);
- Beep(1000, 800);
- Beep(1300, 200);
- }
- };
- int main(int argc, char*argv[])
- {
- player playerInitialize;
- BattleScene btc;
- explore objExplore;
- objExplore.ShowPlayerLocation();
- if (objExplore.ExploreMode() == true)
- {
- while (objExplore.ExploreMode()== true)
- {
- objExplore.ShowPlayerLocation();
- objExplore.RunExploring();
- }
- }
- if (objExplore.InitializeBattle())
- {
- playerInitialize.setPlayer(); //object av battlescene
- btc.BattleStart("Minotaur ", 50, 50, 200); //Initierar fight med en fiende
- for (int i = 0; i < 10000; i++)
- {
- btc.playerTurn(5, 50); //playerturn behöver fixa proper parameters
- btc.enemyTurn(10); //enemyTurn
- btc.DeathChecker(); //kollar ifall fienden är död
- if (i = 10000)
- {
- i = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement