-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemy.h
More file actions
125 lines (103 loc) · 2.8 KB
/
Enemy.h
File metadata and controls
125 lines (103 loc) · 2.8 KB
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
//
// Created by Atticus Tarleton on 3/1/25.
//
#ifndef ENEMY_H
#define ENEMY_H
#include "Question.h"
#include <iostream>
class Enemy {
private:
public:
int health;
int max_health;
bool dead;
int x_location;
int y_location;
int attack_mod;
int crit_chance;
int experience;
int type;
Enemy(int starting_health, int enemy_attack_mod, int x_location_start, int y_location_start){
health = starting_health;
max_health = starting_health;
dead = false;
attack_mod = enemy_attack_mod;
crit_chance = 3;
experience = 2;
x_location = x_location_start;
y_location = y_location_start;
type = rand() % 3;
}
int randomize_attack(){
int attack_val = rand()%3 + attack_mod;
if (rand() % crit_chance == 0){
return attack3(attack_val)*2;
}
if (rand() % crit_chance == 1){
return attack1(attack_val);
}
if (rand() % crit_chance == 2){
return attack2(attack_val);
}
}
int attack1(int attack_damage){
return (attack_damage) + 1;
}
int attack2(int attack_damage){
return (attack_damage) + 2;
}
int attack3(int attack_damage){
std::cout << "CRITICAL HIT" << std::endl;
return (attack_damage);
}
void move(vector<int> pos){
x_location = x_location+pos[0];
y_location = y_location+pos[1];
}
vector<int> get_location(){
vector<int> location;
location.push_back(x_location);
location.push_back(y_location);
return location;
}
bool is_dead(){
return dead;
}
bool hit(int damage){
health -= damage;
if(health <= 0){
dead = true;
}
return dead;
}
string get_type(){
string string_type = "ITS BROKEN";
switch (type) {
case 0:
string_type = "goat";
break;
case 1:
string_type = "sheep";
break;
case 2:
string_type = "bat";
break;
}
return string_type;
}
int get_health(){
return health;
}
int get_max_health(){
return max_health;
}
string return_image(){
if (type == 0)
return "BAAAAAAAAAA";
if (type == 1)
return "FLUFFFFFFFF";
if (type == 2)
return "Not Quite a Vampire";
}
};
#endif //ENEMY_H