TODO: modify other races constructors
did some reworking
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "display.h"
|
||||
#include "fraction.h"
|
||||
#include "position.h"
|
||||
#include "potions.h"
|
||||
@ -15,11 +16,12 @@
|
||||
class character; // forward declaration
|
||||
|
||||
// Note: player should not be in the character list
|
||||
typedef std::vector<character> character_list;
|
||||
typedef std::vector<character *> character_list;
|
||||
|
||||
class character {
|
||||
public:
|
||||
character(RNG *rng, const race &nrace); // fills out the starting stats
|
||||
character(RNG *rng, const race &nrace,
|
||||
const position &pos); // fills out the starting stats
|
||||
|
||||
// usually I wouldn't do this but considering that the map has
|
||||
// a super small size an O(n) solution is acceptable
|
||||
@ -36,6 +38,10 @@ public:
|
||||
potion_list &potions);
|
||||
virtual result get_hit(const enum race &race, const int atk,
|
||||
const fraction hitrate) = 0;
|
||||
|
||||
// overload for different races
|
||||
virtual void print(display *out, bool color = false, bool player = false);
|
||||
|
||||
result apply_effects();
|
||||
void discard_level_effects();
|
||||
void start_turn();
|
||||
@ -49,6 +55,7 @@ public:
|
||||
float get_hitrate_real() const;
|
||||
fraction get_hitrate() const;
|
||||
bool is_hostile() const;
|
||||
int get_room_num() const;
|
||||
|
||||
void set_position(const position &npos);
|
||||
void set_HP(const int nHP);
|
||||
@ -56,7 +63,8 @@ public:
|
||||
void set_DEF(const int nDEF);
|
||||
void set_gold(const int ngold);
|
||||
void set_hitrate(const fraction nhitrate);
|
||||
void set_hostile(const bool is_hostile);
|
||||
virtual void set_hostile(const bool is_hostile);
|
||||
void set_room_num(const int room);
|
||||
|
||||
// if stat is hostile, positive to set it to hostile,
|
||||
// negative to set it to peaceful
|
||||
@ -81,6 +89,7 @@ protected:
|
||||
potion_list effects; // applied potions
|
||||
|
||||
bool hostile;
|
||||
int room_num;
|
||||
private:
|
||||
void insert_potion(potion *p);
|
||||
};
|
||||
|
Reference in New Issue
Block a user