added throwing

This commit is contained in:
2024-07-17 21:39:10 -04:00
parent ea381c24f6
commit dbae34e3a2
10 changed files with 258 additions and 37 deletions

View File

@ -4,11 +4,37 @@
#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;
potion_own_list potions;
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;
public:
player_base(RNG *rng, const feature enabled_features,
const enum race &nrace);
@ -32,6 +58,9 @@ public:
int get_ATK() const;
int get_DEF() const;
int get_HP() const;
long_result throw_potion(level *lvl,
std::unique_ptr<potion> p, direction dir);
};
#endif