Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Library.h"
- //Demon battle
- int GenerateMonsterNumber();
- void GenerateMonsterByType(MONSTER* genlist,int gencount,MONSTER* monsterlist,int monstercount);
- bool DemonicBattle(PLAYER* player,int monstergroup)
- {
- //display message describing area
- cout << "You come to a demonice battle ground";
- GenerateMonsterNumber();
- Wait();
- cout << endl;
- //ask player if they want to summon something
- cout << "Do you wish to fight? (y/n)\n";
- char answer[10];
- while (true)
- {
- cout << ">";
- cin >> answer;
- cin.ignore(20,'\n');
- if (answer[0] == 'n')
- {
- //display generic exit
- cout << "You exit, going back to the crossroad.\n";
- Wait();
- cout << endl;
- return false;
- }
- if (answer[0] == 'y')
- break;
- }
- //generate an enemy based upon monstergroup
- MONSTER* list;
- int monstercount = 0;
- //how many monsters?
- monstercount = (rand()%2)+1; // 1 - 2 monsters
- list = new MONSTER[monstercount];
- //which group
- if (monstergroup == 1)
- {
- /*
- Wolf – HP: 10, MP: 0, ATT: 3, AP: 0, G: 2, XP: 1
- Giant Snake – HP: 8, MP:0, ATT 6, AP: 0, G: 5, XP 2
- Hawk – HP: 5, MP: 0, ATT: 2, AP: 0, G: 1, XP: 1
- */
- MONSTER monsterlist[3];
- monsterlist[0].CreateMonster("Demonic dog",10,0,3,0,2,1);
- monsterlist[1].CreateMonster("Snake",8,0,6,0,5,2);
- monsterlist[2].CreateMonster("Skeletal bird",5,0,2,0,1,1);
- GenerateMonsterByType(list,monstercount,monsterlist,3);
- }
- else if (monstergroup == 2)
- {
- MONSTER monsterlist[3];
- monsterlist[0].CreateMonster("Demonic footsoldier",25,0,10,0,10,5);
- monsterlist[1].CreateMonster("Demonic wizard",15,15,5,0,8,8);
- monsterlist[2].CreateMonster("Demonic Elite Guard",30,0,15,3,15,10);
- GenerateMonsterByType(list,monstercount,monsterlist,3);
- }
- else if (monstergroup == 3)
- {
- MONSTER monsterlist[3];
- monsterlist[0].CreateMonster("Creature of the Earth",75,0,10,10,50,35);
- monsterlist[1].CreateMonster("Giant Skeletal Demon",60,10,25,0,30,20);
- monsterlist[2].CreateMonster("Demonic water creature",100,0,35,5,40,25);
- GenerateMonsterByType(list,monstercount,monsterlist,3);
- }
- else if (monstergroup == 4)
- {
- MONSTER monsterlist[3];
- monsterlist[0].CreateMonster("Demon Warrior",250,0,50,0,120,75);
- monsterlist[1].CreateMonster("Demon Knight",300,0,20,15,200,100);
- monsterlist[2].CreateMonster("Demonic Prince",200,0,40,0,80,50);
- monsterlist[3].CreateMonster("Demonic Overlord", 400,0,70,0,120,100);
- GenerateMonsterByType(list,monstercount,monsterlist,3);
- }
- /*
- Goblin – HP: 25, MP: 0, ATT: 10, AP: 0, G:10, XP: 5
- Goblin Mage – HP: 15, MP: 15, ATT: 5, AP: 0, G: 8, XP: 8 (casts fireball and heal)
- Goblin Elite Guard – HP: 30, MP: 0, ATT: 15, AP: 3, G: 15, XP: 10
- Mud Monster – HP: 75, MP: 0, ATT: 10, AP: 10, G: 50, XP: 35
- Giant Fly – HP 60, MP: 10, ATT: 25, AP: 0, G: 30, XP: 20 (casts poison)
- Alligator – HP 100: MP: 0, ATT: 35, AP: 5, G: 40, XP: 25;
- Skeleton – HP: 250, MP: 0, ATT: 50, AP: 0, G:120, XP: 75
- Zombie – HP: 300, MP: 0, ATT: 20, AP: 15, G: 200, XP: 100
- Vampire Bat – HP: 200, MP: 0, ATT: 40, AP: 0, G: 80, XP: 50
- */
- //enter battle
- if (!Battle(player,list,monstercount))
- {
- //battle failed
- delete list;
- //lose half your gold and start in town
- return false;
- }
- delete list;
- return true;
- }
- int GenerateMonsterNumber()
- {
- return (int)(rand()%3);
- }
- void GenerateMonsterByType(MONSTER* genlist,int gencount,MONSTER* monsterlist,int monstercount)
- {
- for (int loop = 0; loop < gencount; loop++)
- {
- //which monster to spawn?
- int monsternumber = rand()%monstercount;
- genlist[loop] = monsterlist[monsternumber];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment