changes to characters and potions, work in progress

This commit is contained in:
2024-07-13 00:59:52 -04:00
parent afc2b9fa12
commit f2d2f6f72d
22 changed files with 215 additions and 76 deletions

View File

@ -1,8 +1,9 @@
#ifndef __POTIONS_H__
#define __POTIONS_H__
#ifndef __POTION_H__
#define __POTION_H__
#include <vector>
#include "constants.h"
#include "fraction.h"
// IMPORTANT: pop all potions of duration == 0, and when entering a
// new level, pop all potions of duration == -1
@ -12,19 +13,26 @@ protected:
// Use -1 to denote that the effect will last until leaving the level
// Otherwise, use a positive number
// Single use potions have a starting duration of 1
const potion_type type;
potion_type type;
int remaining_duration;
position pos;
public:
potion(const potion_type type, const int duration);
potion(const potion &p);
potion(potion &&p);
potion &operator=(const potion &p);
potion &operator=(potion &&p);
potion(const potion_type type, const int duration, const position &pos);
// apply decrements remaining_duration if it's positive, and
// won't do anything if it's non-negative
virtual void apply(enum race &race, int &HP, int &ATK, int &DEF,
float &base_hit_rate) = 0;
virtual void apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) = 0;
virtual int get_priority() const = 0;
potion_type get_type() const;
int get_duration() const;
position get_pos() const;
void set_pos(const position &npos);
};
typedef std::vector<potion> potion_list;
typedef std::vector<potion *> potion_list;
#endif