/*
 *	Item generator 2, a simpler approch to the creation system
 */

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"
#include "recycle.h"
#include "tables.h"

OBJ_DATA *
gen_weapon_relic (OBJ_DATA * obj, int level)
{
	int weapon_type = number_range(1, 6);
	char name_set[MSL];
	char shor_set[MSL];
	char long_set[MSL];
	obj = create_object (get_obj_index (920), 0);
       AFFECT_DATA af;

	switch(weapon_type)
	{	default:
		case 1:
		obj->level	= 35;
		obj->value[0] = 1;
		obj->value[1] = 40;
		obj->value[2] = 80;
		obj->value[3] = 1;
		sprintf(name_set, "relic drow longsword");
		sprintf(shor_set, "a Drow longsword");
		sprintf(long_set, "a drow longsword is on the ground here");
		obj->name        = str_dup (name_set);
		obj->short_descr = str_dup (shor_set);
		obj->description  = str_dup (long_set);

		// Poisoned
		af.where = TO_WEAPON;
		af.level = 99;
		af.type = 99;
		af.duration = -1;
		af.location = 0;
		af.modifier = 0;
		af.bitvector = WEAPON_POISON;
		affect_to_obj (obj, &af);

		// Vampiric
		af.bitvector = WEAPON_VAMPIRIC;
		affect_to_obj (obj, &af);

		// Sharp
		af.where = TO_WEAPON;
		af.bitvector = WEAPON_SHARP;
		affect_to_obj (obj, &af);

		gen_util_weapon_damroll(obj, 15);
		gen_util_weapon_hitroll(obj, 15);
		gen_util_relic_force(obj, 2);
		gen_util_relic_speed(obj, 2);
		break;

		case 2:
		obj->level	= 35;
		obj->value[0] = 2;
		obj->value[1] = 40;
		obj->value[2] = 80;
		obj->value[3] = 11;
		sprintf(name_set, "relic drow dagger");
		sprintf(shor_set, "a Drow dagger");
		sprintf(long_set, "a drow dagger is on the ground here");
		obj->name        = str_dup (name_set);
		obj->short_descr = str_dup (shor_set);
		obj->description  = str_dup (long_set);

		// Poisoned
		af.where = TO_WEAPON;
		af.level = 99;
		af.type = 99;
		af.duration = -1;
		af.location = 0;
		af.modifier = 0;
		af.bitvector = WEAPON_POISON;
		affect_to_obj (obj, &af);

		// Vampiric
		af.bitvector = WEAPON_VAMPIRIC;
		affect_to_obj (obj, &af);

		// Sharp
		af.where = TO_WEAPON;
		af.bitvector = WEAPON_SHARP;
		affect_to_obj (obj, &af);

		gen_util_weapon_damroll(obj, 10);
		gen_util_weapon_hitroll(obj, 10);
		gen_util_relic_force(obj, 1);
		gen_util_relic_speed(obj, 3);
		break;

		case 3:
		obj->level	= 35;
		obj->value[0] = 4;
		obj->value[1] = 40;
		obj->value[2] = 80;
		obj->value[3] = 7;
		sprintf(name_set, "relic dwarven mace");
		sprintf(shor_set, "a dwarven mace");
		sprintf(long_set, "a dwarven mace is on the ground here");
		obj->name        = str_dup (name_set);
		obj->short_descr = str_dup (shor_set);
		obj->description  = str_dup (long_set);

		// Poisoned
		af.where = TO_WEAPON;
		af.level = 99;
		af.type = 99;
		af.duration = -1;
		af.location = 0;
		af.modifier = 0;
		af.bitvector = WEAPON_FLAMING;
		affect_to_obj (obj, &af);

		// Vampiric
		af.bitvector = WEAPON_FROST;
		affect_to_obj (obj, &af);


		gen_util_weapon_damroll(obj, 14);
		gen_util_weapon_hitroll(obj, 14);
		gen_util_relic_force(obj, 3);
		gen_util_relic_speed(obj, 1);
		break;

		case 4:
		obj->level	= 35;
		obj->value[0] = 4;
		obj->value[1] = 40;
		obj->value[2] = 80;
		obj->value[3] = 0;
		sprintf(name_set, "relic dwarven hammer");
		sprintf(shor_set, "a dwarven hammer");
		sprintf(long_set, "a dwarven hammer is on the ground here");
		obj->name        = str_dup (name_set);
		obj->short_descr = str_dup (shor_set);
		obj->description  = str_dup (long_set);

		// Poisoned
		af.where = TO_WEAPON;
		af.level = 99;
		af.type = 99;
		af.duration = -1;
		af.location = 0;
		af.modifier = 0;
		af.bitvector = WEAPON_FLAMING;
		affect_to_obj (obj, &af);

		// Vampiric
		af.bitvector = WEAPON_FROST;
		affect_to_obj (obj, &af);


		gen_util_weapon_damroll(obj, 20);
		gen_util_weapon_hitroll(obj, 20);
		gen_util_relic_force(obj, 2);
		break;

		case 5:
		obj->level	= 35;
		obj->value[0] = 3;
		obj->value[1] = 40;
		obj->value[2] = 80;
		obj->value[3] = 16;
		sprintf(name_set, "relic tasoli spear");
		sprintf(shor_set, "a tasoli spear");
		sprintf(long_set, "a tasoli spear is on the ground here");
		obj->name        = str_dup (name_set);
		obj->short_descr = str_dup (shor_set);
		obj->description  = str_dup (long_set);

		// Poisoned
		af.where = TO_WEAPON;
		af.level = 99;
		af.type = 99;
		af.duration = -1;
		af.location = 0;
		af.modifier = 0;
		af.bitvector = WEAPON_FLAMING;
		affect_to_obj (obj, &af);

		// Vampiric
		af.bitvector = WEAPON_VORPAL;
		affect_to_obj (obj, &af);


		gen_util_weapon_damroll(obj, 10);
		gen_util_weapon_hitroll(obj, 10);
		gen_util_relic_speed(obj, 4);
		break;

		case 6:
		obj->level	= 35;
		obj->value[0] = 7;
		obj->value[1] = 40;
		obj->value[2] = 80;
		obj->value[3] = 17;
		sprintf(name_set, "relic drow whip");
		sprintf(shor_set, "a dark drow whip");
		sprintf(long_set, "a dark drow whip is on the ground here");
		obj->name        = str_dup (name_set);
		obj->short_descr = str_dup (shor_set);
		obj->description  = str_dup (long_set);

		// Poisoned
		af.where = TO_WEAPON;
		af.level = 99;
		af.type = 99;
		af.duration = -1;
		af.location = 0;
		af.modifier = 0;
		af.bitvector = WEAPON_FLAMING;
		affect_to_obj (obj, &af);

		// Vampiric
		af.bitvector = WEAPON_VORPAL;
		affect_to_obj (obj, &af);

		af.bitvector = WEAPON_SHARP;
		affect_to_obj (obj, &af);

		gen_util_weapon_hitroll(obj, 25);
		gen_util_relic_speed(obj, 3);
		gen_util_relic_luck(obj, 1);
		break;

	}


	return(obj);
}