-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy.cpp
149 lines (131 loc) · 3.42 KB
/
Enemy.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
#include <time.h>
#include "Enemy.h"
using namespace std;
//CS1300 Fall 2019
//Author: Char Donaldson
//Recitation: 105 - Michael Bradshaw
/*Algorithim:
Defines constructors and functions from Enemy.h */
/* Private:
int attack;
int speed;
int charisma;
int end;
string name;
*/
Enemy::Enemy(){
//This is probably not going to be used
attack = 0;
speed = 0; //speed of enemy (who attacks first)
end = 0; //end doesn't really matter
health = 0; //health is replacement for end to make things easier
reward = 0;
name = "";
}
void Enemy::rat(){
attack = 6;
speed = 8;
health = 15;
name = "Giant Rat";
reward = 20;
currency = 3;
}
void Enemy::goblin(){
attack = 8;
speed = 9;
health = 26;
name = "Bulky Goblin";
reward = 25;
currency = 3;
}
void Enemy::shredder(){
attack = 13;
speed = 10;
health = 15;
name = "Bloodthirsty Shredder";
reward = 30;
currency = 5;
}
void Enemy::beefBoy(){ //BEEF BOY
attack = 3;
speed = 12;
health = 40;
name = "Beef Boy";
reward = 60;
currency = 4;
}
void Enemy::knight(){
attack = 11;
speed = 13;
health = 28;
name = "Possessed Knight";
reward = 40;
currency = 6;
}
void Enemy::dragon(){
attack = 10;
speed = 12;
health = 32;
name = "Adolescent Dragon";
reward = 45;
currency = 6;
}
void Enemy::final(User user){ //FINAL BOSS
speed = 100; //NO RUNNING
int char1 = user.getChar();
if(char1 > 16 && user.getLevel() > 7){
attack = char1 - 1;
if(user.getLevel() > 8){
attack = char1;
}
}
if(user.getStr() > 17 && user.getLevel() > 7){
attack = user.getStr() - 4;
}
else{
attack = 15; //low level players are gonna get CLOBBERED
}
int userEnd = user.getEnd();
if(user.canUseSpells() == true && user.getLevel() > 8 && user.getChar() > 14){
health = (6 * userEnd) + 10; //balancing, as high level spells are overpowered
}
else{
health = (5 * userEnd) - 30; //balancing
}
name = "Unmaker";
reward = 100;
currency = 150;
}
void Enemy::spawn(){
spawnChance = rand() % 8; //makes a random integer between 1 and 7
//This will determine enemy spawned
}
void Enemy::setHealth(int h1){
health = h1;
}
int Enemy::getHealth(){
return health;
}
//attack IS ALL AN ENEMY NEEDS TO CALCULATE THEIR ATTACK
string Enemy::getName(){
return name;
}
void Enemy::takeDamage(double dam){
health = health - dam;
}
double Enemy::getDamage(){
return attack;
}
int Enemy::getDex(){
return speed;
}
int Enemy::getReward(){
return reward;
}
int Enemy::getCurrency(){
return currency;
}