bast/
bast/area/
bast/backup/
bast/clans/
bast/doc/MSP/
bast/doc/OLC11/
bast/doc/OLC11/doc/
bast/doc/OLC11/options/
bast/log/
bast/mobprogs/
bast/player/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  Envy Diku Mud improvements copyright (C) 1994 by Michael Quan, David   *
 *  Love, Guilherme 'Willie' Arnold, and Mitchell Tse.                     *
 *                                                                         *
 *  EnvyMud 2.0 improvements copyright (C) 1995 by Michael Quan and        *
 *  Mitchell Tse.                                                          *
 *                                                                         *
 *  In order to use any part of this Envy Diku Mud, you must comply with   *
 *  the original Diku license in 'license.doc', the Merc license in        *
 *  'license.txt', as well as the Envy license in 'license.nvy'.           *
 *  In particular, you may not remove either of these copyright notices.   *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/

#if defined( macintosh )
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"



/*
 * The following special functions are available for objects.
 */
DECLARE_OBJ_FUN(        spec_giggle             );
DECLARE_OBJ_FUN(        spec_soul_moan          );
DECLARE_OBJ_FUN(        spec_hum                );
DECLARE_OBJ_FUN(        spec_haste              );
DECLARE_OBJ_FUN(        spec_stoneskin          );
DECLARE_OBJ_FUN(        spec_sneak              );
DECLARE_OBJ_FUN(        spec_hide               );
DECLARE_OBJ_FUN(        spec_invisibility       );
DECLARE_OBJ_FUN(        spec_wp_lightning       );


OBJ_FUN *spec_obj_lookup( const char *name )
{
    int cmd;

    for ( cmd = 0; *spec_obj_table[cmd].spec_name; cmd++ )
	if ( !str_cmp( name, spec_obj_table[cmd].spec_name ) )
	    return spec_obj_table[cmd].spec_fun;

    return 0;
}


char *spec_obj_string( OBJ_FUN *fun )
{
    int cmd;

    for ( cmd = 0; *spec_obj_table[cmd].spec_fun; cmd++ )
	if ( fun == spec_obj_table[cmd].spec_fun )
	    return spec_obj_table[cmd].spec_name;

    return 0;
}

/*
 * Object special function commands.
 */
const   struct  spec_obj_type   spec_obj_table  [ ]     =
{
    { "spec_giggle",            spec_giggle             },
    { "spec_soul_moan",         spec_soul_moan          },
    { "spec_hum",               spec_hum                },
    { "spec_haste",             spec_haste              }, 
    { "spec_stoneskin",         spec_stoneskin          },
    { "spec_sneak",             spec_sneak              },
    { "spec_hide",              spec_hide               },
    { "spec_invisibility",      spec_invisibility       },
    { "spec_wp_lightning",      spec_wp_lightning       },
    { "",                       0                       }
};  



/*
 * Special procedures for objects.
 */
bool spec_giggle( OBJ_DATA *obj, CHAR_DATA *keeper )
{
    if ( !keeper || !keeper->in_room )
	return FALSE;

    if ( number_percent( ) < 5 )
    {
	act( "$p&n carried by $n&n starts giggling to itself!",
	    keeper, obj, NULL, TO_ROOM );
	act( "$p&n carried by you starts giggling to itself!",
	    keeper, obj, NULL, TO_CHAR );
	return TRUE;
    }

    return FALSE;
}

bool spec_hum( OBJ_DATA *obj, CHAR_DATA *keeper )
{
    log_string( "obj: checking humming" );
    if ( !keeper || !keeper->in_room )
	return FALSE;

    if ( number_percent( ) < 4 )
    {
	act( "A faint hum can be heard from $p&n carried by $n&n.",
	    keeper, obj, NULL, TO_ROOM );
	act( "Your $p&n hums faintly.",
	    keeper, obj, NULL, TO_CHAR );
	return TRUE;
    }

    return FALSE;
}


bool spec_soul_moan( OBJ_DATA *obj, CHAR_DATA *keeper )
{
    log_string( "obj: checking soul moan" );
    if ( !keeper || !keeper->in_room )
	return FALSE;

    if ( number_percent( ) < 2 )
    {
	act( "The soul in $p&n carried by $n&n moans in agony.",
	    keeper, obj, NULL, TO_ROOM );
	act( "The soul in $p&n carried by you moans to be set free!",
	    keeper, obj, NULL, TO_CHAR );
	return TRUE;
    }

    if ( number_percent( ) < 2 )
    {
	act( "The soul in $p&n carried by $n&n tries to free itself!",
	    keeper, obj, NULL, TO_ROOM );
	act( "The soul in $p&n carried by you starts writhing!",
	    keeper, obj, NULL, TO_CHAR );
	return TRUE;
    }

    return FALSE;
}

// Haste proc disabled until haste spell coded - Veygoth
bool spec_haste( OBJ_DATA *obj, CHAR_DATA *keeper )
{
/*   log_string( "obj: now doing check for perm haste procs on items." );
   if( !IS_AFFECTED( keeper, AFF_HASTE ))
     {
      spell_haste( spl_haste, 30, keeper, keeper );
      log_string( "obj: perm haste activate ok" );
      return TRUE;
     }
*/
   return FALSE;
}

bool spec_sneak( OBJ_DATA *obj, CHAR_DATA *keeper )
{
	return FALSE;
}

bool spec_hide( OBJ_DATA *obj, CHAR_DATA *keeper )
{
	return FALSE;
}

bool spec_invisibility( OBJ_DATA *obj, CHAR_DATA *keeper )
{
	return FALSE;
}

bool spec_stoneskin( OBJ_DATA *obj, CHAR_DATA *keeper )
{
	return FALSE;
}

bool spec_wp_lightning( OBJ_DATA *obj, CHAR_DATA *keeper )
{
	return FALSE;
}