This repository was archived by the owner on Aug 2, 2024. It is now read-only.
forked from aNdReA9111/1-VS-All-phabet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.hpp
More file actions
49 lines (46 loc) · 2.03 KB
/
Player.hpp
File metadata and controls
49 lines (46 loc) · 2.03 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
#include "Character.hpp"
#include <ncurses.h>
#include <unistd.h>
using namespace std;
#define NUM_COLORS 8
// struct di interi necessaria a identificare ciò che si trova intorno al player
struct arnd {
int right;
int under;
int left;
int above;
};
class Player : public Character {
protected:
char nick[20]; // nome del player
char psw[20]; // psw del player
int money; // numero di monete del giocatore
int current_level; // livello corrente in cui si trova il player
int score; // score del player
public:
Player();
Player(char *nick, char *psw, char look); // costruttore
double fight(double m_hp, bool tur); // interazione tra mostro e player
char *getNick(); // ritorna l'attributo nick di player
int getMoney(); // ritorna l'attributo monete di player
void pay(int p); // decrementa il valore delle monete di p
void takeMoney(int value); // incrementa il valore delle monete di value
arnd check_around(
Map &m); // ritorna una struct con 4 interi che dicono cosa si trova nelle
// 4 posizioni intorno al player: 0 vuoto, 1 mostro, 2 moneta
int choice_menu(); // menu iniziale che ritorna se il player vuole effettuare
// il login, sign in o uscire dal gioco
void getCredentials(
char username[],
char password[]); // chiede all'utente di inserire username e password
bool signIn(char *user, char *psw); // metoto per creare un nuovo account
bool login(char *user,
char *psw); // metodo per accedere ad un account già esistente
void saveStats(); // salva su file le statistiche del player
void setCurrentLevel(
int l); // metodo che setta il livello alla quale si trova il player
int getCurrentLevel(); // ritorna l'attributo current_level di player
void incScore(int score); // incrementa lo score del player del valore dato
int getScore(); // ritorna l'attributo score del player
void setScore(int score); // setta il valore dell'attributo Score in player
};