added potion and restore_health
This commit is contained in:
30
src/potion.h
Normal file
30
src/potion.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef __POTIONS_H__
|
||||
#define __POTIONS_H__
|
||||
|
||||
#include <vector>
|
||||
#include "constants.h"
|
||||
|
||||
// IMPORTANT: pop all potions of duration == 0, and when entering a
|
||||
// new level, pop all potions of duration == -1
|
||||
|
||||
class potion {
|
||||
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;
|
||||
int remaining_duration;
|
||||
public:
|
||||
potion(const potion_type type, const int duration);
|
||||
// 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 int get_priority() const = 0;
|
||||
potion_type get_type() const;
|
||||
int get_duration() const;
|
||||
};
|
||||
|
||||
typedef std::vector<potion> potion_list;
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user