changes to characters and potions, work in progress
This commit is contained in:
@ -6,13 +6,12 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "fraction.h"
|
||||
#include "position.h"
|
||||
#include "potion.h"
|
||||
#include "potions.h"
|
||||
#include "gold.h"
|
||||
#include "rng.h"
|
||||
|
||||
// #include "inventory.h" // Reserved for later
|
||||
|
||||
class character; // forward declaration
|
||||
|
||||
// Note: player should not be in the character list
|
||||
@ -20,7 +19,7 @@ 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); // 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
|
||||
@ -33,10 +32,13 @@ public:
|
||||
virtual result move_or_attack(const direction dir,
|
||||
const position_list &available_positions,
|
||||
character_list &chlist);
|
||||
virtual result apply(direction &dir,
|
||||
const potion_list &potions);
|
||||
virtual void apply(direction &dir,
|
||||
potion_list &potions);
|
||||
virtual result get_hit(const enum race &race, const int atk,
|
||||
const float hitrate) = 0;
|
||||
const fraction hitrate) = 0;
|
||||
result apply_effects();
|
||||
void discard_level_effects();
|
||||
void start_turn();
|
||||
|
||||
enum race get_race() const;
|
||||
position get_position() const;
|
||||
@ -44,7 +46,8 @@ public:
|
||||
int get_ATK() const;
|
||||
int get_DEF() const;
|
||||
int get_gold() const;
|
||||
float get_hitrate() const;
|
||||
float get_hitrate_real() const;
|
||||
fraction get_hitrate() const;
|
||||
bool is_hostile() const;
|
||||
|
||||
void set_position(const position &npos);
|
||||
@ -52,7 +55,7 @@ public:
|
||||
void set_ATK(const int nATK);
|
||||
void set_DEF(const int nDEF);
|
||||
void set_gold(const int ngold);
|
||||
void set_hitrate(const float nhitrate);
|
||||
void set_hitrate(const fraction nhitrate);
|
||||
void set_hostile(const bool is_hostile);
|
||||
|
||||
// if stat is hostile, positive to set it to hostile,
|
||||
@ -61,7 +64,7 @@ public:
|
||||
// void apply_buff(const stat_name statn, const float mul);
|
||||
// reserved for later
|
||||
protected:
|
||||
RNG &rng;
|
||||
RNG *rng;
|
||||
const enum race race;
|
||||
|
||||
int HP;
|
||||
@ -69,15 +72,17 @@ protected:
|
||||
// IMPORTANT: keep track of ATK and DEF in game at turn time
|
||||
int ATK;
|
||||
int DEF;
|
||||
fraction base_hit_rate;
|
||||
|
||||
position pos;
|
||||
|
||||
int gold; // characters spawn with gold
|
||||
potion_list potions;// inventory inventory; // Reserved
|
||||
|
||||
float base_hit_rate; // requires: between [0,1]
|
||||
potion_list potions; // inventory
|
||||
potion_list effects; // applied potions
|
||||
|
||||
bool hostile;
|
||||
private:
|
||||
void insert_potion(potion *p);
|
||||
};
|
||||
|
||||
int calc_dmg(const int ATK, const int DEF);
|
||||
|
Reference in New Issue
Block a user