Line | Branch | Exec | Source |
---|---|---|---|
1 | |||
2 | #ifndef PLAYER_HPP | ||
3 | #define PLAYER_HPP | ||
4 | |||
5 | #include <vector> | ||
6 | #include <string> | ||
7 | |||
8 | |||
9 | enum Actions | ||
10 | { | ||
11 | EGGING, | ||
12 | PUSHED, | ||
13 | INCANTATING, | ||
14 | PICKUP, | ||
15 | DROP, | ||
16 | MOVING, | ||
17 | LVLUP, | ||
18 | NONE | ||
19 | }; | ||
20 | |||
21 | |||
22 | 38 | class Event { | |
23 | public: | ||
24 | std::vector<int> params; | ||
25 | Actions action; | ||
26 | |||
27 | 10 | Event(Actions action, std::vector<int> params) : params(params), action(action) {}; | |
28 | 13 | Event(Actions action) : params(std::vector<int>()), action(action) {}; | |
29 | 27 | ~Event() {}; | |
30 | }; | ||
31 | |||
32 | enum Orientation | ||
33 | { | ||
34 | UP = 1, | ||
35 | RIGHT = 2, | ||
36 | DOWN = 3, | ||
37 | LEFT = 4 | ||
38 | }; | ||
39 | |||
40 | class Player | ||
41 | { | ||
42 | private: | ||
43 | std::vector<int> position = {0, 0}; | ||
44 | std::vector<std::vector<int>> nextPositions = {}; | ||
45 | int orientation = UP; | ||
46 | |||
47 | int lvl = 1; | ||
48 | int id = 0; | ||
49 | bool isAlive = true; | ||
50 | std::string team = "default"; | ||
51 | |||
52 | std::vector<int> inventory = {0, 0, 0, 0, 0, 0, 0}; | ||
53 | std::vector<Event> events = {}; | ||
54 | |||
55 | void popNextPosition(); | ||
56 | |||
57 | public: | ||
58 | 18 | Player() {}; | |
59 | 21 | Player(int id, std::vector<int> position, int orientation, int lvl, std::string team) : position(position), orientation(orientation), lvl(lvl), id(id), team(team) {}; | |
60 | 72 | ~Player() {}; | |
61 | |||
62 | void setPosition(std::vector<int> newPos); | ||
63 | void setOrientation(int newOrientation); | ||
64 | void setIncanting(); | ||
65 | void setEgging(); | ||
66 | void setPushed(); | ||
67 | void setPickup(int res); | ||
68 | void setDrop(int res); | ||
69 | void setAlive(bool alive); | ||
70 | void setLvl(int newLvl); | ||
71 | void setTeam(std::string newTeam); | ||
72 | void setPlayerNb(int newId); | ||
73 | void setInventory(std::vector<int> inventoryVals); | ||
74 | |||
75 | std::vector<int> getInventory(); | ||
76 | std::vector<int> getPosition(); | ||
77 | int getOrientation(); | ||
78 | int getPlayerNb(); | ||
79 | int getLvl(); | ||
80 | std::string getTeam(); | ||
81 | Event getNextEvent(); | ||
82 | bool getAlive(); | ||
83 | }; | ||
84 | |||
85 | #endif // PLAYER_HPP | ||
86 |