luck.c

src_3.00/luck.c · 573 B

From the archive Mordor_3.00.tar.gz

Download the archive   « Back to the archive contents

#include <mstruct.h>
#include <mextern.h>
#include <mtype.h>

/****************************************************************/
/*			luck					*/
/****************************************************************/

/* This sets the luck value for a given player			*/

int luck(ply_ptr)
creature	*ply_ptr;
{
	int	fd, num;

	
	if(!ply_ptr)
		return(0);
	
	fd = ply_ptr->fd;

	num = ((6*ply_ptr->intelligence+2*ply_ptr->constitution)/abs(ply_ptr->alignment)+1)-(ply_ptr->gold/50,000);
	
	if(num>100)
		num=100;
	if(num<1)
		num=1;
	
	Ply[fd].extr->luck = num;

	return(num);
}

Site Stats

Snippets: 1791
Codebases: 571