/* XdYmath.h
 * The computation (only) functions of XdY+
 *  Musus Umbra 1997
 */

#ifndef xdymath_h
#define xdymath_h

#include "tables.h"

typedef struct
{
	int		x,y;		/* as in X d Y */
	int		h,d;		/* to hit / to dam bonii */
	double	w;			/* weight */
	int		e;			/* edged? */
	int		a;			/* + to attacks */
} weapon_info;

typedef struct
{
	int		str,dex;	/* strength & dex */
	int		level;		/* exp. level */
	character_race	race;
	character_class	class;
} character_info;

typedef struct
{
	int		h,d;		/* +to hit / + to dam */
	int		ap;			/* armour penalty */
} other_info;

typedef struct
{
	weapon_info		wpn;
	character_info	chr;
	other_info		other;
} xdy_values;


typedef struct
{
	double	prob;
	double	good;
	double	great;
	double	superb;
	double	s_great;
	double	s_superb;
} crit_probs;


typedef struct
{
	int			ac;		/* NB: 'ac' is an INPUT to the calculations */
	int			blows;	/* the rest are the results */
	int			skill;
	double		hit_prob;
	double		dam_per_hit;
	int			min_dam;
	int			max_dam;
	double		dam_per_round;
	crit_probs	crit;
} xdy_result;


/* Calculate the stats for *'stats' against AC 'result->ac' and store them */
/* in the struct pointed to by 'result' */
void xdy_calculate( xdy_values *stats, xdy_result *result );
void xdy_calculate_new_ac( xdy_values *stats, xdy_result *result );
#endif

/* And... that's it! */
