/*Origional code by Ghreth, of Criminals passing*/
/*triton.darkstarllc.com 6005*/

/*This is my morph_weapon code, follow all licences where applicable:)
What this code does is allows you to flag weapons as 'morph', when 
wielding a morphing weapon you have the option of changing its actual
type, for example: It can start off as any type, we will say exotic, 
you can then morph the weapon into a sword, or if your favorite weapon
is a mace then morph it into a mace. There is also a penalty I added
for the weapon, morphing will take its toll. All the shifting and changing
earns the weapons -3 condition for each successful morph, and a -1 for an
unsuccessful morph. The only time a morph is unsuccessful is if you 
dont type in a proper weapon type. And thats it, have fun!*/

/*In merc.h along with the rest of your WEAPON_ defines.*/
#define WEAPON_MORPH            (N)

/*In handler.c with the rest of the WEAPON_ */
{	"morph",	 WEAPON_MORPH,         TRUE   },

/*In tables.c, you know where by now:)*/
if (weapon_flags & WEAPON_MORPH     ) strcat(buf, " morph");

/*Add to act_obj.c or where you feel it should go.*/
void do_morph_weapon( CHAR_DATA *ch, char *argument )
{
        OBJ_DATA *obj;
        char buf[MSL];
        char arg1[MIL], arg2[MIL];
        
        if (IS_NPC(ch))
    {
        send_to_char( "Huh?\n\r", ch );       
	return;
    }
        
        argument = one_argument( argument, arg1 );
        argument = one_argument( argument, arg2 ); 
        
        obj = get_eq_char(ch, WEAR_WIELD);     
        
        if(obj == NULL)
    {
        send_to_char( "You are not wielding a weapon to morph.\n\r", ch );       
	return;
    }
        
        if (!IS_WEAPON_STAT(obj, WEAPON_MORPH))
    {
        send_to_char( "You do not possess morphing weapon.\n\r", ch );       
	return;
    }                         
        
        if ( arg1[0] == '\0' || arg2[0] == '\0' )
    {
        send_to_char( "Syntax: morph <weapon> <type>\n\r", ch );       
	return;
    }
        
        if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL )
    {
	send_to_char( "You do not seem to be wielding that.\n\r", ch );
	return;
    }
        
        obj->condition -= 3;
        
        if (obj->condition < 2)
    {
	 act("$p crumbles under the stress!",ch,obj,NULL,TO_ALL);
 	 extract_obj( obj );
 	 return;
    }
        
        if ( !str_cmp( arg2, "exotic" ) )
    {
        obj->value[0] = WEAPON_EXOTIC;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );      
	return;
    }
        else if ( !str_cmp( arg2, "sword" ) )
    {
        obj->value[0] = WEAPON_SWORD;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) ); 
        act( buf, ch, obj, NULL, TO_ROOM );       
	return;
    }
    
        else if ( !str_cmp( arg2, "dagger" ) )
    {  
        obj->value[0] = WEAPON_DAGGER;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );      
        return;  
    }
    
        else if ( !str_cmp( arg2, "spear" ) )
    {
        obj->value[0] = WEAPON_SPEAR;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );     
        return;     
    }
    
        else if ( !str_cmp( arg2, "staff" ) )
    {
        obj->value[0] = WEAPON_STAFF;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );      
        return;    
    }
    
        else if ( !str_cmp( arg2, "mace" ) )
    {  
        obj->value[0] = WEAPON_MACE;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );     
        return;     
    }
    
        else if ( !str_cmp( arg2, "axe" ) )
    {  
        obj->value[0] = WEAPON_AXE;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );      
        return;    
    }
    
        else if ( !str_cmp( arg2, "flail" ) )
    {
        obj->value[0] = WEAPON_FLAIL;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );     
        return;     
    }
    
        else if ( !str_cmp( arg2, "whip" ) )
    {   
        obj->value[0] = WEAPON_WHIP;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );     
        return;     
    }
    
        else if ( !str_cmp( arg2, "polearm" ) )
    { 
        
        obj->value[0] = WEAPON_POLEARM;
        sprintf( buf, "You fiddle with $p and morph it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p and morphs it into a %s.", 
        flag_string( weapon_class, obj->value[0] ) );
        act( buf, ch, obj, NULL, TO_ROOM );     
        return;     
    }	 	     
        else 
        
        obj->condition += 2;
        sprintf( buf, "You fiddle with $p for a moment.");
        act( buf, ch, obj, NULL, TO_CHAR );   
        sprintf( buf, "$n fiddles with $p for a moment, then stares off into the sky.");
        act( buf, ch, obj, NULL, TO_ROOM );                
        return;
}