Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- //1: Here is Mainirk.cpp
- #include <windows.h>
- #include "include/irrKlang.h"
- #include <conio.h>
- #include "stats.h"
- #pragma comment(lib, "irrKlang.lib")
- using namespace std;
- using namespace irrklang;
- int choose();
- void charmander1();
- void bulbasaur1();
- void squirtle1();
- void yourpokemon();
- void enemypokemon();
- void battle();
- void bchoice();
- void aichoice();
- void attack();
- void defend();
- double y;
- double z;
- double m;
- double n;
- int achoice;
- pokemon charmander (25,3);
- pokemon bulbasaur (20,4);
- pokemon squirtle (30,2);
- int main()
- {
- choose();
- yourpokemon();
- cout<<"\nPress any key to continue.";
- _getch();
- system("cls");
- cout<<"Your rival Chuy walks in and challenges you to a battle\n\n";
- _getch();
- do
- {
- battle();
- aichoice();
- _getch();
- }
- while (y>0 && m>0);
- return 0;
- }
- int choose()
- {
- cout<<"Choose your pokemon!!!\n\n";
- cout<<"********************************\n\n";
- cout<<" Charmander has "<<charmander.hp()<<" hp and "<<charmander.dmg()<<" damage.\n\n";
- cout<<" Bulbasaur has "<<bulbasaur.hp()<<" hp and "<<bulbasaur.dmg()<<" damage.\n\n";
- cout<<" Squirtle has "<<squirtle.hp()<<" hp and "<<squirtle.dmg()<<" damage.\n\n";
- cout<<"--------------------------------\n\n";
- cout<<"Type [a] to choose Charmander\n\n";
- cout<<"Type [b] to choose Bulbasaur\n\n";
- cout<<"Type [c] to choose Squirtle\n\n";
- char answer;
- cin>>answer;
- if (answer == 'a'||answer == 'A')
- {
- answer = 'a';
- }
- if (answer == 'b'||answer == 'B')
- {
- answer = 'b';
- }
- if (answer == 'c'||answer == 'C')
- {
- answer = 'c';
- }
- switch (answer)
- {
- if (answer =='a')
- {
- case 'a': charmander1();
- y= charmander.hp();
- z= charmander.dmg();
- m= squirtle.hp();
- n= squirtle.dmg();
- }
- if (answer == 'b')
- {
- case 'b': bulbasaur1();
- y = bulbasaur.hp();
- z = bulbasaur.dmg();
- m = charmander.hp();
- n = charmander.dmg();
- }
- if (answer == 'c')
- {
- case 'c': squirtle1();
- y = squirtle.hp();
- z = squirtle.dmg();
- m = bulbasaur.hp();
- n = bulbasaur.dmg();
- }
- }return 0;
- }
- void charmander1()
- {
- cout<<"You have chosen the Pokemon Charmander!!!\n";
- cout<<"Charmander is a fire type!\n";
- }
- void bulbasaur1()
- {
- cout<<"You have chosen the Pokemon Bulbasaur!!!\n";
- cout<<"Bulbasaur is a grass type!\n";
- }
- void squirtle1()
- {
- cout<<"You have chosen the Pokemon Squirtle!!!\n";
- cout<<"Squirtle is a water type!\n";
- }
- void yourpokemon()
- {
- cout<<"HP is "<<y<<" and damage is "<<z;
- }
- void battle()
- {
- cout<<"\n\t\tStatus\t\t";
- cout<<"\n-----------------------\n";
- cout<<"Your Pokemon\t\tEnemy Pokemon\n";
- cout<<"HP: "<<y<<"\t\tHP: "<<m<<"\n";
- ISoundEngine* se = createIrrKlangDevice();
- se->play2D("Kalimba.mp3");
- bchoice();
- }
- void bchoice()
- {
- cout<<"\n\nType 1 to attack or 2 to defend\n";
- cin>>achoice;
- if (achoice ==1)
- {
- attack();
- }
- else if (achoice ==2)
- {
- defend();
- }
- else
- {
- cout<<"Retype your choice"<<endl;
- }
- }
- void attack()
- {
- m = m-z;
- cout<<"\nYour Pokemon attacks!";
- }
- void defend()
- {
- cout<<"\nYour pokemon defends!";
- }
- void aichoice()
- {
- if (achoice ==1)
- {
- cout<<"\nThe enemy pokemon attacks!";
- y = (y-n);
- }
- else if (achoice ==2)
- {
- cout<<"\nThe enemy pokemon defends!";
- }
- }
- // 2. Here is stats.h
- #include <iostream>
- using namespace std;
- class pokemon
- {
- int health, damage;
- public:
- pokemon (int,int);
- int hp()
- {
- return (health);
- }
- int dmg()
- {
- return (damage);
- }
- };
- pokemon::pokemon (int hp, int dmg)
- {
- health = hp;
- damage = dmg;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement