STANDARD.C
LIB3/STD/RACES/STANDARD.C · 6.0 KB
From the archive nm4dos.zip
Download the archive « Back to the archive contents
inherit "/std/object";
/*
** Added max & min light functions, Newstyle, 08/02/94
*/
int max_l, min_l;
mixed *bits;
/* some one liners */
void set_max_light( int i )
{
max_l = i;
}
void adjust_max_light( int i )
{
max_l += i;
}
void set_min_light( int i )
{
min_l = i;
}
void adjust_min_light( int i )
{
min_l = i;
}
int query_max_light()
{
return max_l;
}
int query_min_light()
{
return min_l;
}
void start_player( object ob )
{
this_object()->set_stats( ob );
}
void add_bit( string name, string alias, mixed *varr )
{
int i;
i = member_array( name, bits );
if( i >= 0 )
{
if( pointerp( bits[ i + 1 ] ) )
i--;
bits[ i ] = name;
bits[ i + 1 ] = alias;
bits[ i + 2 ] = varr;
return;
}
bits += ({ name, alias, varr });
return;
} /* add_bit() */
void create()
{
::create();
max_l = 100;
min_l = 0;
set_name( "unknown creature" );
set_main_plural( "unknown creatures" );
set_long( "The standard boring race. Get a new one soon, this one is " +
"pretty sad.\n" );
reset_get();
bits = ({
"head", 0, ({ 0, 40, 0,
"left ear", "right ear", "left eye", "right eye", "nose", "scalp",
"tongue", "teeth", "skull" }),
"left ear", "ear", ({ "head", 1, 0 }),
"right ear", "ear", ({ "head", 1, 0 }),
"left eye", "eye", ({ "head", 1, 0 }),
"right eye", "eye", ({ "head", 1, 0 }),
"nose", "", ({ "head", 1, 0 }),
"scalp", "", ({ "head", 3, 0 }),
"tongue", "", ({ "head", 2, 0 }),
"teeth", "", ({ "head", 2, 0 }),
"skull", "cranium", ({ "head", 20, 0 }),
"left arm", "arm", ({ 0, 80, 0, "left hand" }),
"right arm", "arm", ({ 0, 80, 0, "right hand" }),
"torso", "chest", ({ 0, 400, 0, "heart", "liver", "left kidney",
"right kidney", "left lung", "right lung", "spleen" }),
"left hand", "hand", ({ "left arm", 15, 0, "left pinky",
"left third finger", "left index finger", "left ring finger",
"left thumb" }),
"right hand", "hand", ({ "right arm", 15, 0, "right pinky",
"right third finger", "right index finger", "right ring finger",
"right thumb" }),
"left pinky", "finger", ({ "left hand", 1, 0 }),
"left third finger", "finger", ({ "left hand", 1, 0 }),
"left index finger", "finger", ({ "left hand", 1, 0 }),
"left ring finger", "finger", ({ "left hand", 1, 0 }),
"left thumb", "finger", ({ "left hand", 1, 0 }),
"right pinky", "finger", ({ "right hand", 1, 0 }),
"right third finger", "finger", ({ "right hand", 1, 0 }),
"right index finger", "finger", ({ "right hand", 1, 0 }),
"right ring finger", "finger", ({ "right hand", 1, 0 }),
"right thumb", "finger", ({ "right hand", 1, 0 }),
"heart", "", ({ "torso", 10, 0 }),
"liver", "", ({ "torso", 5, 0 }),
"left kidney", "kidney", ({ "torso", 5, 0 }),
"right kidney", "kidney", ({ "torso", 5, 0 }),
"left lung", "lung", ({ "torso", 5, 0 }),
"right lung", "lung", ({ "torso", 5, 0 }),
"spleen", "", ({ "torso", 5, 0 }),
"genitals", "", ({ 0, 5, 0 }),
"left leg", "leg", ({ 0, 300, 0, "left foot" }),
"right leg", "leg", ({ 0, 300, 0, "right foot" }),
"left foot", "foot", ({ "left leg", 50, "left big toe",
"left second toe", "left third toe",
"left fourth toe", "left little toe" }),
"right foot", "foot", ({ "right leg", 50, "right big toe",
"right second toe", "right third toe",
"right fourth toe", "right little toe" }),
"right little toe", "toe", ({ "right foot", 1, 0 }),
"right second toe", "toe", ({ "right foot", 1, 0 }),
"right third toe", "toe", ({ "right foot", 1, 0 }),
"right fourth toe", "toe", ({ "right foot", 1, 0 }),
"right big toe", "toe", ({ "right foot", 1, 0 }),
"left little toe", "toe", ({ "left foot", 1, 0 }),
"left second toe", "toe", ({ "left foot", 1, 0 }),
"left third toe", "toe", ({ "left foot", 1, 0 }),
"left fourth toe", "toe", ({ "left foot", 1, 0 }),
"left big toe", "toe", ({ "left foot", 1, 0 }),
});
/* Line added by Newstyle, 10/5/94 */
catch(this_object()->setup());
} /* create() */
int query_number_type( string type )
{
if( type == "ring" )
return 2;
if( type == "decorative" )
return 10;
return 1;
} /* query_number_type() */
int query_number_wielded()
{
return 1;
}
string query_desc( object ob )
{
return "A small non descript person.\n";
}
int query_skill_bonus( int lvl, string skill )
{
return 0;
}
int player_start( object player )
{
return 1;
}
int player_quit( object player )
{
return 1;
}
int query_dark( int light )
{
if( light < min_l )
return 1;
if( light > max_l )
return -1;
return 0;
} /* query_dark() */
void set_level( object ob, int lvl )
{
call_out( "new_set_level", 0, ({ lvl, ob }) );
} /* set_level() */
void new_set_level( mixed *junk )
{
int lvl;
lvl = junk[ 0 ];
if( !junk[ 1 ] )
return;
if( lvl >= 0 )
{
junk[ 1 ]->add_attack( "standard", 0, 100, 20 + lvl, 0, 0, "blunt" );
junk[ 1 ]->add_ac( "standard blunt", "blunt", 10 + lvl / 2 );
junk[ 1 ]->add_ac( "standard sharp", "sharp", 10 + lvl / 2 );
junk[ 1 ]->add_ac( "standard pierce", "pierce", 10 + lvl / 2 );
}
else
{
junk[ 1 ]->add_attack( "standard", 0, 100, 20 / (-lvl), 0, 0, "blunt" );
junk[ 1 ]->add_ac( "standard blunt", "blunt", 10 / -lvl );
junk[ 1 ]->add_ac( "standard sharp", "sharp", 10 / -lvl );
junk[ 1 ]->add_ac( "standard piece", "pierce", 10 / -lvl );
}
} /* new_set_level() */
mixed * query_bits()
{
return bits;
}
mixed * query_bit( string s )
{
int i;
if( (i = member_array( s, bits )) == -1 )
return({ });
if( pointerp( bits[ i + 1 ] ) )
i--;
return({ bits[ i ], bits[ i + 1 ], bits[ i + 2 ] });
} /* query_bits() */
query_possible_bits( s )
{
int i;
string *poss;
poss = ({ });
for( i = 0; i < sizeof( bits ); i += 3 )
if( bits[ i ] == s || bits[ i + 1 ] == s )
poss += ({ bits[ i ] });
return poss;
} /* query_possible_bits() */