-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
56 lines (44 loc) · 1.69 KB
/
player.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
#ifndef PLAYER_H
#define PLAYER_H
#include "actor.h"
#include "map.h"
#include <memory>
#include <iostream>
#include "monsters.h"
class Game;
///////////////////////////////////////////////////////////////////////////
// Player is derived from actor class
///////////////////////////////////////////////////////////////////////////
class Player : public Actor {
public:
Player(int x, int y, int hitPoints = 20, int armorPoints = 2, int strengthPoints = 2, int dexterityPoints = 2);
void Move(char direction, const Map& map, const Game& game) override;
// player statistics
void regenerateHealth();
void increaseArmorPoints(int amount) { armorPoints += amount; }
void increaseStrengthPoints(int amount) { strengthPoints += amount; }
void increaseDexterityPoints(int amount) { dexterityPoints += amount; }
int GetLevel() const;
void SetLevel(int level);
// player attack functionality
void Attack(Monster& monster, Game& game);
void OnDeath(Game& game) override;
bool HasAttacked() const { return attacked; }
bool IsFinalBlow() const { return currentTargetMonster && currentTargetMonster->IsDead(); }
Monster* GetCurrentTargetMonster() const { return currentTargetMonster; }
void SetTargetMonster(Monster* monster);
void ClearTargetMonster();
bool DidAttackHit() const { return attackedHit; }
// inventory system
void addItem(std::shared_ptr<GameObjects> item);
void displayInventory() const;
private:
int level;
// attacking system
bool attacked;
bool finalBlow;
Monster* currentTargetMonster;
// inventory system
std::vector<std::shared_ptr<GameObjects>> inventory;
};
#endif // PLAYER_H