69 lines
2.0 KiB
C++
69 lines
2.0 KiB
C++
#ifndef __PLAYER_H__
|
|
#define __PLAYER_H__
|
|
|
|
#include "characters.h"
|
|
|
|
enum game_command : int;
|
|
enum direction : int;
|
|
|
|
class player_base: public character {
|
|
static const int INV_LEFT = 30;
|
|
static const int INV_RIGHT = 49;
|
|
static const int INV_TOP = 9;
|
|
static const int INV_BOTTOM = 21;
|
|
static const int INV_Y_OFFSET = 1;
|
|
static const int INV_CURSOR_OFFSET = 2;
|
|
static const int INV_POTION_OFFSET = 5;
|
|
static const int INV_MAX_CNT = 10;
|
|
protected:
|
|
int gold_cnt;
|
|
|
|
unsigned long known_potions;
|
|
|
|
struct inventory {
|
|
potion_own_list owns;
|
|
size_t curr;
|
|
bool enabled;
|
|
|
|
// second is -1 if applied, is 0-7 if thrown
|
|
std::pair<std::unique_ptr<potion>, int> run(game_command cmd,
|
|
const feature enabled_features);
|
|
void print(output *out, unsigned long known_potions);
|
|
void insert(std::unique_ptr<potion> p);
|
|
void start();
|
|
};
|
|
|
|
inventory inv;
|
|
int MAX_THROW_DIST;
|
|
|
|
long_result throw_potion(level *lvl,
|
|
std::unique_ptr<potion> p, direction dir);
|
|
public:
|
|
player_base(RNG *rng, const feature enabled_features,
|
|
const enum race &nrace);
|
|
virtual long_result move(level *lvl, const position &p);
|
|
|
|
virtual long_result apply(std::unique_ptr<potion> p);
|
|
|
|
virtual long_result attack(character *ch) override;
|
|
virtual long_result get_hit(character *ch, const int tATK,
|
|
const fraction &hit_rate) override;
|
|
|
|
virtual void add_gold(int amount);
|
|
|
|
void print(output *out) override;
|
|
|
|
std::string get_abbrev() const override;
|
|
|
|
long_result interpret_command(level *lvl, game_command cmd);
|
|
|
|
int get_gold() const;
|
|
int get_ATK() const;
|
|
int get_DEF() const;
|
|
int get_HP() const;
|
|
|
|
void set_potion_known(const potion_type &type);
|
|
};
|
|
|
|
#endif
|