finished the bulk of game
This commit is contained in:
@ -5,7 +5,6 @@
|
||||
#include <memory>
|
||||
#include <math.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "display.h"
|
||||
#include "fraction.h"
|
||||
#include "position.h"
|
||||
@ -13,62 +12,38 @@
|
||||
#include "gold.h"
|
||||
#include "rng.h"
|
||||
|
||||
class character; // forward declaration
|
||||
|
||||
// Note: player should not be in the character list
|
||||
|
||||
class level;
|
||||
typedef unsigned int feature;
|
||||
struct long_result;
|
||||
enum result : int;
|
||||
|
||||
class character {
|
||||
public:
|
||||
character(RNG *rng, const race &nrace,
|
||||
const position &pos); // fills out the starting stats
|
||||
character(RNG *rng, const feature enabled_features,
|
||||
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
|
||||
// IMPORTANT: available_positions do NOT have characters in them
|
||||
direction_list moveable(const position_list &available_positions) const;
|
||||
virtual result move(const direction dir,
|
||||
const position_list &available_positions);
|
||||
virtual long_result move(level *lvl, const position &p);
|
||||
|
||||
struct attack_result {
|
||||
result res;
|
||||
std::string msg;
|
||||
};
|
||||
virtual long_result attack(character *ch) = 0;
|
||||
virtual long_result get_hit(character *ch, const int tATK,
|
||||
const fraction &hit_rate) = 0;
|
||||
|
||||
struct apply_result {
|
||||
result res;
|
||||
std::string msg;
|
||||
};
|
||||
virtual result move(position_list spots, const direction &dir);
|
||||
virtual void apply_effect(potion *effect);
|
||||
|
||||
virtual attack_result attack(const direction dir, character *ch) = 0;
|
||||
// override for different types
|
||||
virtual void print(display *out) = 0;
|
||||
|
||||
virtual apply_result apply(const direction &dir,
|
||||
potion_list &potions);
|
||||
virtual attack_result get_hit(const enum race &race, const int atk,
|
||||
const fraction hitrate) = 0;
|
||||
|
||||
// overload for different races
|
||||
virtual void print(display *out);
|
||||
|
||||
virtual result calc_effects();
|
||||
result calc_effects();
|
||||
void discard_level_effects();
|
||||
virtual void start_turn();
|
||||
|
||||
virtual const char *get_race_name() const = 0;
|
||||
enum race get_race() const;
|
||||
position get_pos() const;
|
||||
virtual std::string get_abbrev() const = 0;
|
||||
void set_pos(const position &npos);
|
||||
|
||||
int get_HP() const;
|
||||
int get_ATK() const;
|
||||
int get_DEF() const;
|
||||
fraction get_hitrate() const;
|
||||
int get_room_num() const;
|
||||
void set_HP(const int nHP);
|
||||
void set_ATK(const int nATK);
|
||||
void set_DEF(const int nDEF);
|
||||
void set_hitrate(const fraction nhitrate);
|
||||
void set_room_num(const int room);
|
||||
bool is_dead() const;
|
||||
|
||||
protected:
|
||||
RNG *rng;
|
||||
@ -79,18 +54,22 @@ protected:
|
||||
int HP;
|
||||
position pos;
|
||||
|
||||
// IMPORTANT: keep track of ATK and DEF in game at turn time
|
||||
// IMPORTANT: keep track at turn time
|
||||
int ATK;
|
||||
int DEF;
|
||||
fraction base_hit_rate;
|
||||
fraction base_hit_rate_reset;
|
||||
|
||||
potion_list effects;
|
||||
|
||||
int calc_dmg(const int ATK, const int DEF);
|
||||
private:
|
||||
void insert_effect(potion *effect);
|
||||
};
|
||||
|
||||
int calc_dmg(const int ATK, const int DEF);
|
||||
|
||||
typedef std::vector<character *> character_list;
|
||||
|
||||
character *get_ch_at(const position &pos, const character_list &chlist);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user