void do_enter(string s)
{
    if(s == "cave")
	this_body()->do_game_command("in");
    else
	write(this_body()->nonsense());
}
Exemple #2
0
int drink_from_it( mixed fluid ){

   mixed taste_action;
   object fluid_ob;
   int cntinue =1;

   fluid_ob = new( is_source_of() );

   if (functionp( drink_action )) cntinue = evaluate( drink_action );
   else this_body()-> simple_action
 	( drink_action, fluid_ob -> query_primary_name(), this_object() -> the_short() );

   if (!cntinue) return 0;

   fluid_disturb = get_fluid_disturb_action();

   if (fluid_disturb)
	{
        if (functionp( fluid_disturb )) cntinue = evaluate( fluid_disturb );
	else
	this_body() -> my_action( fluid_disturb, fluid, this_object() );
	};

   if (!cntinue) return 0;

   taste_action = fluid_ob -> get_taste_action();

   if (taste_action)
	{
	if (functionp( taste_action )) return evaluate( taste_action) ;
	this_body()-> my_action( taste_action, fluid_ob );
	};

   return 1;
}
Exemple #3
0
void do_kill_liv(object ob)
{
    if (ob == this_body())     
	this_body()->commit_suicide();
    else
	this_body()->start_fight(ob);
}
Exemple #4
0
void do_kill_liv_with_obj(object liv, object ob)
{
    /* should probably do a wield in here */ 

    if (liv == this_body())
       this_body()->commit_suicide();
    else
       this_body()->start_fight(liv);
}
Exemple #5
0
mixed direct_follow_obj(object ob)
{
  if(!present(ob,environment(this_body() ) ) )
    {
      this_body()->my_action("$N $vis not here.",ob);
      return 0;
    }
  return 1;
}
Exemple #6
0
//FUNCTION do_search
// Default searching.
varargs void do_search( object with, string search_for )
{
    string str = "$N $vsearch ";
    if( this_object() == environment( this_body()))
	str += "around";
    else str += "the $o0";
    if( with ) str += " with $p $o1";
    str += ", but $vdiscover nothing.";
    this_body()->simple_action( str, this_object(), with );
}
void cast_spell(object ob, object reagent)
{
    object array targets;

    if ( !ob )
    {
	targets = filter(all_inventory(environment(this_body())),
			 (: $1 != this_body() :));
	this_body()->simple_action("$N $vcast a fireball spell!");
    }
void do_press()
{
    object wall = present( "wall", environment( this_object()));

    if( wall && wall->query_closed())
    {
	this_body()->simple_action( "$N $vpress the button.");
	wall->trigger();
    }
    else
	this_body()->simple_action( "$N $vpress the button, but nothing happes." );
}
Exemple #9
0
void do_kill() {
    string err;
    
    if (err = this_body()->continue_fight()) {
	write(err);
    }
}
Exemple #10
0
void do_on_open()
{
   object env = environment( this_body() );

load_object("/domains/std/rooms/caves/North_Tunnel.c")->set_room_state("gate_open");
   env->set_room_state("gate_open");
}
Exemple #11
0
mixed direct_unready_obj()
{
  object * readied = this_body()->query_readied();

  if(readied && member_array(this_object(), readied) == -1)
    return "#Not readied.";
  return this_object()->need_to_have();
}
Exemple #12
0
mixed source_find( string fluid )// Sees if there is, and returns, a fluid source near drinker.
{	
  object source;
  source = present( fluid +"_source", environment( this_body()));
  if (!source) return 0;
  if (source -> id( "drink_source" )) return source; 
  else return "Try putting the "+ fluid + " into something.\n";
}
Exemple #13
0
//:FUNCTION indirect_search_obj_for_str_with_obj
//Default
mixed indirect_search_obj_for_str_with_obj( object ob1, string str, object ob2 )
{
    if(!default_object_checks())
      return 0;
    if( environment( this_object()) != this_body())
	return "Maybe you should search it with something you're holding.";
    return 1;
}
Exemple #14
0
string modify(string quest)
{
  string quests = this_body()->query_quests();
  if(!sizeof(quests) || member_array(quest, quests)<0)
    return quest;
  else
    return quest + "*";
}
Exemple #15
0
mixed can_drive_obj_str(object ob, string str)
{
   mixed value = environment(this_body())->can_go_somewhere(str);
   if(!stringp(value) && (value == 1))
      return default_checks();
   if(!stringp(value) && (member_array(str, normal_directions) != -1))
      return "It doesn't appear you can go that way.\n";
   return value;
}
Exemple #16
0
void cast_spell(object ob, object reagent)
{
    mixed result = ob->magic_unlock();

    if ( stringp(result) )
    {
	this_body()->simple_action("$N $vcast a spell on $o...", ob);
	write(result);
    }
    else if ( !result )
    {
	this_body()->simple_action("$N $vtry to unlock $o with a spell, but fails.", ob);
    }
    else
    {
	this_body()->simple_action("$N $vunlock $o with a spell.", ob);
    }
}
mixed direct_open_obj() {
    object env = this_object();

    while (env = environment(env)) {
	if (env == this_body())
	    return 1;
    }
    return "#You do not have that.\n";
}
Exemple #18
0
void do_post_about_str(string str) {
    object brd = 0;

    foreach (object ob in deep_inventory(environment(this_body()))) {
        if ((int)ob->is_bulletin_board())
            brd = ob;
    }
    brd->do_post(str);
}
Exemple #19
0
//:FUNCTION direct_get_obj
//Do some checks for the parser when we are the OBJ of the "get OBJ" rule
mixed direct_get_obj(object ob)
{
    object who = owner(ob);

    if ( environment() == this_body() )
	return "#You already have it!\n";
    if ( who && who != this_body() )
	return "#Too bad you're not a skilled pickpocket.\n";
    if ( this_object() == this_body() )
	return "#You make an advance on yourself.\n";
    if (environment(this_object())!=environment(this_body()))
      return "#You cannot get that.";
    if(!default_object_checks())
      return 0;

    //:HOOK prevent_get
    //A yes/no/error hook called by direct_get_obj() if the standard conditions
    //succeed
    return call_hooks("prevent_get", HOOK_YES_NO_ERROR);
}
Exemple #20
0
void do_post_wrd_to_wrd(string wrd1, string wrd2) {
    object brd = 0;
    int id;

    foreach (object ob in deep_inventory(environment(this_body()))) {
        if ((int)ob->is_bulletin_board())
            brd = ob;
    }
    sscanf(wrd2, "%d", id);
    brd->do_followup(id);
}
Exemple #21
0
void setup( mixed who, int s_o )
{
    if ( !who ) return ;

    subj_obj = s_o;

    if ( stringp( who ) )
    {
        string used_mudname;
        sscanf( who, "%s@%s", user_name, used_mudname );

        if ( used_mudname )
            mudname = IMUD_D->canon_mudname( used_mudname );

        if ( mudname )
        {
            int gend = IMUD_D->get_gender( mudname, user_name );

            // No idea if this is silent or not ...
#if 0
            if ( this_body() ) move( this_body(), "in" );
#else
            // This is probably safer -Beek
            move_object(this_body());
#endif

            set_id( "wibblewibble"+lower_case(user_name) + " "+
                    replace_string( lower_case(used_mudname), ".", " " ) );
            set_gender( gend == -1 ? 1 : gend ); // Assume male if unknown

        } else
            remove();
    } else
    {
        set_gender( who->query_gender() );
        user_name = who->query_userid();
    }

    // we exist temporarily only
    call_out( (: remove :), 0);
}
Exemple #22
0
int open(object ob, object with)
{
    if (with) {
	try_to_acquire(with);
	if (with->is_weapon() && ob->test_flag(DESTROYABLE)) {
	    this_body()->simple_action("$N $vchop a $o up into itty bitty pieces with $p $o1 in a rather violent attempt to open it.", ob, with);
	    ob->remove();
	    return 1;
	}
    }
    return ob->open_with(with);
}
Exemple #23
0
void do_remove_wrd(string wrd) {
    object brd = 0;
    int id;

    foreach (object ob in deep_inventory(environment(this_body()))) {
        if ((int)ob->is_bulletin_board())
            brd = ob;
    }
    
    sscanf(wrd, "%d", id);
    brd->do_remove(id);
}
Exemple #24
0
//:FUNCTION direct_drop_obj
//Handle parser checks for "drop OBJ" 
mixed direct_drop_obj(object ob)
{
    if(!default_object_checks())
      return 0;
    if ( environment() != this_body() )
	return "#You don't have it!\n";

    //:HOOK prevent_drop
    //A yes/no/error hook called by direct_drop_obj() if the standard conditions
    //succeed

    return call_hooks("prevent_drop", HOOK_YES_NO_ERROR);
}
Exemple #25
0
mixed test_vendor() {
  object ob, vendor;
  foreach(ob in deep_useful_inv(parser_root_environment(environment(this_body())))) {
    if(ob->query_vendor()) {
      if (vendor)
	return "Buy from which vendor?\n";
      vendor = ob;
    }
  }
  if (!vendor) {
    return "There is no vendor here.\n";
  }
  return 1;
}
Exemple #26
0
int set_title(string str)
{
    if ( this_body() != this_object() )
	error("invalid attempt to set a title\n");

    if ( str && strsrch(str, "$N") == -1 )
	error("bad title -- needs to contain $N\n");

    if ( !str )
	title = sprintf("%s the title-less.", capitalize(query_name()));
    else
	title = replace_string(str,"$N", capitalize(query_name()));
    title += "%^RESET%^";
}
Exemple #27
0
int chance_to_hit(object weapon, object target)
{
  string attack_skill = weapon->query_skill_used();
  string defend_skill = target->query_defend_skill_used();
  int attack_value = aggregate_skill(attack_skill);
  int defend_value = target->aggregate_skill(defend_skill);
  int res;

// Skill tests to potentially increase the skills
  this_body()->test_skill(attack_skill, defend_value);
  target->test_skill(defend_skill, attack_value);

// Calculate the value
  res = attack_value-defend_value+MAX_SKILL_VALUE;
  res = res*100/(2*MAX_SKILL_VALUE);
LBUG( res );
  return res;
}
Exemple #28
0
mixed can_post_about_str(string str) {
    object brd = 0;
    mixed res;

    foreach (object ob in deep_inventory(environment(this_body()))) {
        if ((int)ob->is_bulletin_board()) {
            if (!brd)
                brd = ob;
            else
                return "Please specify on which board you want to post.\n";
        }
    }

    if (res = brd->indirect_post_on_obj_about_str(str, brd))
        return res;

    return default_checks();
}
Exemple #29
0
mixed can_remove_wrd(string wrd) {
    object brd = 0;
    mixed res;

    foreach (object ob in deep_inventory(environment(this_body()))) {
        if ((int)ob->is_bulletin_board()) {
            if (!brd)
                brd = ob;
            else
                return "Please specify on which board you want to "
                       "remove a note.\n";
        }
    }
    if (!brd)
        return "There's nothing here to remove notes from.\n";

    if ((res = brd->direct_remove_wrd_from_obj(wrd, brd)) != 1)
        return res;

    return default_checks();
}
Exemple #30
0
/* Followups are posted using 'post followup to <id>' */
mixed can_post_wrd_to_wrd(string wrd1, string wrd2) {
    object brd = 0;
    mixed res;

    if (wrd1 != "followup")
        return 0;

    foreach (object ob in deep_inventory(environment(this_body()))) {
        if ((int)ob->is_bulletin_board())
            if (!brd)
                brd = ob;
            else
                return "Please specify the board you want to post on.\n";
    }
    if (!brd)
        return "There is nothing here to post on.\n";

    if ((res = brd->direct_post_wrd_to_wrd_on_obj(wrd1, wrd2, brd)) != 1)
        return res;

    return default_checks();
}