/*
 * Description - This file contains all information
 *		   for random mobs. Condition of use of
 *		   this file is as follows:
 *			1. All Diku/Merc/Rom licences must be followed
 *			2. A help file with the keyword 'RMOB'
 *			   containing my AIM/ICQ number and credit for
 *			   this code.
 *			3. An email/AIM telling me you are using this code.
 *		   Please do not use this code if you cannot follow these simple
 *		   steps. I have put in alot of work on this, and i would like credit
 *		   where credit is due.
 *
 *	-Thri
 *	AIM: CalibanL
 *	ICQ: 5335308
 *	Email: cyhawk@comcast.net
 */



	Q: What is rmob?
	A: Rmob is a Snipplet writen by Thri of the mud
	   Soulblight (soulblight.slayn.net:5500)
	   (Down for renovations at the time of writing)
	   to create Randomized mobs for various 'filler' areas.

	Ok, So this is my random mob snip. Its fairly straight forward.
	Basicly, its a set of specs and tables to create a fairly randomzied
	mob of a specific type. (like orcs for example ;)
	This Snipplet is a Template to create your own rmob specs with.
	The possibilitys are endless ;)

	Warning: Over-use of these types of specs will result in areas
	that are considered bad. (ie repeative room descriptions type of bad)
	I honestly feel you should use these in Filler areas, or on mobs
	with a high frequency. (Uh, Fido's in Midgaard, Cityguards, Goblins
	in some sort of 'Random D&D style dungeon' etc).

	This code is mine ;) and id like to keep it that way. All i ask in return is..

	1. Follow all Previous Licences (Diku/Merc/Rom)
	2. A helpfile at level 1 with keyword RMOB (or _RMOB) with who wrote
	   this sniplet, my contact info.
	3. An Email/AIM/ICQ telling me your using it.
	NEW: 4. Attempt to not over-use color in everything. ;)
	NEW: 5. Stay away from blinky text

	Remember, what comes around, goes around :P

	Installation:
		Ok installation is really simple.

	Step 1:	Put special.h and special_table.c
			in your src directory, add it to your makefile
	Step 2:	put the spec into special.c declare it, put
			it into the table, etc.
	Step 3:	Clean Complie (always a good idea ;)
	Step 4:	Make a Test Mob, set the spec, and start mass loading the test
			mob to see how it works.
	Step 5:	Email Thri at cyhawk@comcast.net telling him your using it.
	Step 6:	Expand the code to fit your needs.
	Step 7:	Don't over-do it. (You know, like Color, Dont over do either)


	Thats about it. Now for a little explination on how this works.


	Ok, First of all, the tables hold a few pieces of critical info.
	the name table holds all possible names for the mob, long table
	holds all long descriptions for the mob.

	Now, when the mob is created, it will take the name, set the keywords to
	"<name> orc warrior" Thus all rmobs of this spec have orc warrior and their name
	Short description is..
	"<name> the orc warrior"
	Personaly, i dont like 'the orc warrior' so in mine its just their name.
	(adds kinda a cool thing to it when every mob has a name, George Lucas
	feels the same way :P *all charaters in Star wars have a name.. the
	way he explained it was so cool..*

	Long description is just the long description.

	Now, because not all mobs are created equal.. theres a level ranzomizer
	The upper and lower range is set in the _other_table. So the mob
	could be anywhere from 3 levels under, or 3 levels over.

	Hitroll/Damroll work the same way (number_range(lower, upper)

	Well since we want the mobs to have some sort of abilitys,
	we zero out the aff flags (i had problems with adding to ch->affected_by so its zeroed)
	and we set the affect flags to those in the _other_table. If you have
	aff2 flags, you can add another line to the other_table to accomidate this.


	Hitpoints works with dice. dice(mob->level, other_table.dice_size)
	So if you set the dicesize to 20, and the mob is level 10, would
	have 10d20 for hitpoints.
	Mana/move is 100 since mobs dont use them, but some spells
	affect it.. saves on issues.

	Then we set the damtype, I was lazy, so i made a switch statement for it.
	Slash/Pound/pierce equal chance.

	So everything is set.

	Oh.. ch->wimpy is used as a check to prevent the mobs from changing every
	fight_pulse. (Which was very annoying) Since mobiles dont use ch->wimpy, and
	its set to 0 on creation, we make it 1 to return the spec before the mob can change.

	And thats about it ;)

	-Thri
	EMAIL:	cyhawk@comcast.net
	ICQ:	5335308
	AIM:	CalibanL
	MUD:	soulblight.slayn.net:5500 (in renovations)

/* heres the spec ;) */

bool spec_random_orc (CHAR_DATA * ch)
{
	char mob_long[MSL];
	char mob_name[MSL];
	char mob_short[MSL];
	int name_range  = number_range(1, MAX_RMOB_ORC_NAME - 1);
	int long_range  = number_range(1, MAX_RMOB_ORC_LONG - 1);
	int other_range = number_range(1, MAX_RMOB_OTHER - 1);

	if (ch->wimpy != 0)
	{
		return FALSE;
	}

	/* Wimpy isn't used by mobs, so we'll use this as a check. if Wimpy == 1, dont do the script
	   prevents mobs from changing every 8 pulses. */
	ch->wimpy = 1;

	/* Select Keyword/Short/long */
	sprintf (mob_name,  "%s orc warrior", 		rmob_orc_name_table[name_range].name);		// Set keywords
	sprintf (mob_short, "The orc, %s", 		rmob_orc_name_table[name_range].name);		// Set Short_descr
	sprintf (mob_long,  "%s", 				rmob_orc_long_table[long_range].long_descr);	// Set Long_descr

	/* Now set the names */
	ch->name 		= str_dup (mob_name);
	ch->short_descr 	= str_dup (mob_short);
	ch->long_descr 	= str_dup (mob_long);


	/* play with level ranges a bit, dont want static mobs */
	int level_range  = number_range( rmob_orc_other_table[other_range].low_level_range, rmob_orc_other_table[other_range].hig_level_range );
	ch->level       += level_range;

	/* Set hitroll/dam/affected flags */
	ch->hitroll	   = number_range( rmob_orc_other_table[other_range].l_hitroll, rmob_orc_other_table[other_range].h_hitroll );
	ch->damroll	   = number_range( rmob_orc_other_table[other_range].l_damroll, rmob_orc_other_table[other_range].h_damroll );
	ch->affected_by  = 0;
	ch->affected_by  = rmob_orc_other_table[other_range].affect_flags;

	// Set Hitpoints/mana/move
	int hit_points = dice(ch->level, rmob_orc_other_table[other_range].hit_dice);
	ch->hit	 = hit_points;
	ch->max_hit	 = hit_points;
	ch->mana	 = 100;
	ch->max_mana	 = 100;
	ch->move 	 = 100;
	ch->max_move 	 = 100;

	// Give them a Randomized Dam message. I would of put this in a table, but thats overkill
	switch (number_range (1, 3))
        {
        case (1):
          ch->dam_type = 3;
          break;                /* slash */
        case (2):
          ch->dam_type = 7;
          break;                /* pound */
        case (3):
          ch->dam_type = 11;
          break;                /* pierce */
        }

	// And were done!
	return TRUE;

}


