#ifndef _player_h
#define _player_h

#define PWR_HEAL       0  // should go from 0-10, and heals that number
#define PWR_DIRECT     1  // should go from 0-10, where direct attack damage is multiplied by (1 + (.1 * num))
#define PWR_RANGED     2  // same as direct in terms of damage boost
#define PWR_DAMAGE     3  // should go from 0-5, and damages that number
#define PWR_RANDKILL   4  // should go from 0-5, where 1 is "each enemy has a 10% chance of being destroyed", 2 is 20%, etc...
#define PWR_DOUBLESHOT 5  // should go from 0-4.  1 is 25% chance of doubleshot, 2 is 50%, etc...
#define NUM_POWERS     6

typedef struct _player
{
  int number;
  int playing;
  int everplaying;
  int cash;
  int powered;
  int power;
  int controller;
  int team;
  int tookturn;
  _unit unit[50];
  void reset();
  void clear_units();
  void ready_units();
  void sort_units();
  void mergesort_units(int min, int max);
  bool defeated(int pnum);
  int create_unit(int type, int x, int y, int player);
  int units_in_play();
  int noncritical_units_in_play();
} _player;

class _character
{
	char *name;
	char *description;
	char *powername;
public:
  int strength;
  int weakness;
  int power[NUM_POWERS];
	int powerneeded;
	Bitmap *picture;
	
	void setname(const char *n);
	void setdescription(const char *d);
	void setpowername(const char *pn);
  void create(const char *n, const char *d, int s, int w, int p[NUM_POWERS], const char *pn, Bitmap *pic);
  void destroy();
	char *getname();
	char *getdescription();
	char *getpowername();

	_character();
  ~_character();
};

void load_character(ifstream *str, _character *c);
void save_currentcharacters(const char *savefilename);
int pow_needed(int power[NUM_POWERS]);

#endif
