/*
 * damage.h
 *
 * Damage formulas
 *
 * Ken Stevens, 1995
 */

#ifndef _DAMAGE_H_
#define _DAMAGE_H_

#define PERCENT_DAMAGE(x) (100 * (x) / ((x) + 100))
#define DPERCENT_DAMAGE(x) ((double)(100.0 * (x) / ((x) + 100.0)))
#define DMINE_HITCHANCE(x) ((double) ( (x) / ((x)+40.0) ) )
#define DMINE_LHITCHANCE(x) ((double) ( (x) / ((x)+50.0) ) )
#define MINE_DAMAGE() (22 + random()%21)
#define MINE_LDAMAGE() (10 + random()%11)
#define DTORP_HITCHANCE(range, vis) ((double)(0.9/((range)+1)+(((vis)<6)?(5-(vis))*0.03:0)))
#define TORP_DAMAGE() (torpedo_damage + (random() % torpedo_damage))

#endif /* _DAMAGE_H_ */
