-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenemy.h
132 lines (112 loc) · 3.3 KB
/
enemy.h
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
#ifndef __ENEMY_H__
#define __ENEMY_H__
#include "character.hpp"
#include "player.hpp"
#include <iostream>
using namespace std;
class Enemy : public Character {
public:
Enemy() {};
virtual ~Enemy() {};
int attack(Character* opponent);
void set_health(int damage);
};
class Bug : public Enemy {
public:
Bug(){
this->name = "Bug";
this->power = 8;
this->defense = 2;
this->health = 15;
this->speed = 2;
};
int attack(Character* opponent) {
std::cout << "Bug attacks you and deals " << Enemy::attack(opponent) << std::endl;
return Enemy::attack(opponent);
}
};
class Worm : public Enemy {
public:
Worm() {
this->name = "Worm";
this->power = 8;
this->defense = 3;
this->health = 15;
this->speed = 4;
};
int attack(Character* opponent) {
std::cout << "Worm attacks you and deals " << Enemy::attack(opponent) << std::endl;
return Enemy::attack(opponent);
}
};
class PopUpAd : public Enemy {
public:
PopUpAd() {
this->name = "Pop-up Ad";
this->power = 9;
this->defense = 4;
this->health = 20;
this->speed = 3;
};
int attack(Character* opponent) {
std::cout << "Pop-up Ad attacks you and deals " << Enemy::attack(opponent) << std::endl;
return Enemy::attack(opponent);
}
};
class Spyware : public Enemy {
public:
Spyware() {
this->name = "Spyware";
this->power = 9;
this->defense = 4;
this->health = 15;
this->speed = 6;
};
int attack(Character* opponent) {
std::cout << "Spyware attacks you and deals " << Enemy::attack(opponent) << std::endl;
return Enemy::attack(opponent);
}
};
class Virus : public Enemy {
public:
Virus() {
this->name = "Virus";
this->power = 9;
this->defense = 6;
this->health = 15;
this->speed = 4;
};
int attack(Character* opponent) {
std::cout << "Virus attacks you and deals " << Enemy::attack(opponent) << std::endl;
return Enemy::attack(opponent);
}
};
class TrojanHorse : public Enemy {
public:
TrojanHorse() {
this->name = "Trojan Horse";
this->power = 10;
this->defense = 6;
this->health = 20;
this->speed = 6;
};
int attack(Character* opponent) {
std::cout << "Trojan Horse attacks you and deals " << Enemy::attack(opponent) << std::endl;
return Enemy::attack(opponent);
}
};
class CorruptedMotherboard : public Enemy {
public:
CorruptedMotherboard() {
this->name = "Corrupted Motherboard";
this->power = 14;
this->defense = 9;
this->health = 30;
this->speed = 6;
};
int attack(Character* opponent) {
std::cout << "Corrupted Motherboard attacks you and deals " << Enemy::attack(opponent) << std::endl;
return Enemy::attack(opponent);
}
};
#endif