/
Robot.h
101 lines (69 loc) · 1.85 KB
/
Robot.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
//
// Created by teone on 04-Apr-18.
//
#ifndef THEWALK_ROBOT_H
#define THEWALK_ROBOT_H
#include <string>
#include <vector>
#include <iostream>
#include "GameMap.h"
using namespace std;
/**
* robot will be an abstract class, memorising its position and the items accepted by the type fo the robot
*/
class Robot {
protected:
pair<int, int> position;
int resistance;
vector<string> itemsAccepted;
public:
friend class GameEngine;
Robot();
Robot(int i, int j);
void setMapPosition(pair<int, int> p, GameMap &world);
virtual ~Robot();
virtual bool round(GameMap &world)=0;
virtual void increaseResistance(int x);
virtual void decreaseResistance(int x);
int getResistance() const;
pair<int, int> getPosition() const {
return position;
};
void setPosition(int moveRow, int moveColumn) {
position.first = moveRow;
position.second = moveColumn;
}
virtual void changeAttribute(bool x) = 0;
};
class Ninja : public Robot {
bool agility;
public:
Ninja();
Ninja(int i, int j);
bool round(GameMap &world);
void changeAttribute(bool x) {
agility = x;
}
};
class Warrior : public Robot {
public:
Warrior(int i, int j);
Warrior() {};
bool round(GameMap &world);
void changeAttribute(bool x) {};
};
class Genius : public Robot {
int countIdeaBox;
/// if the robot finds an invincibility item, he will be able to avoid all the traps
bool invincibility;
int rightCol, leftCol, upRow, downRow, move;
public:
Genius(int i, int j);
Genius() {
rightCol = leftCol = upRow = downRow = 0;
move = 0;
};
bool round(GameMap &world);
void changeAttribute(bool x);
};
#endif //THEWALK_ROBOT_H