Esempio n. 1
0
void event_heart_beat( void ) {
  object sp;

  sp = this_player();
  set_this_player(this_object());

  if( this_object()->query_hp() < this_object()->query_max_hp() && this_object()->is_alive() ) {
    heal_time++;
    if( heal_time > heal_rate ) {
        heal_time = 0;
        this_object()->increase_hp( random( heal_amount ) + 1 );
    }
  }
  /* Check here to see is we are in combat, if so, continue battle */
  if( this_object()->is_fighting() ) {
    this_object()->do_fight();
  } else {
    if( function_object( "event_wander", this_object()) ) {
      call_other( this_object(), "event_wander" );
    }
  }

  set_this_player(sp);

  if(!this_object()->is_player())  /* NPC routines */ {
    if(this_object()->is_dead()) {
      EVENT_D->unsubscribe_event("heart_beat");
      this_object()->destruct();
    }
  } else  /* Player routines */ {
    if(this_object()->query_idle() < 60)  /* A player ages when not idle */
    player_age += HEART_BEAT_INTERVAL;
  }
}
Esempio n. 2
0
void do_game_command( string message ) {
  mixed result;
  string cmd;
  string arg;
  int flag;
  object save_player;
   
  arg = "";
   
  save_player = this_player();
  set_this_player( this_object() );

  catch {
    if( sscanf( message, "%s %s", cmd, arg ) != 2 ) {
Esempio n. 3
0
void die(void) {
   object killer, obj, *inv;
   int i;

   killer = this_object()->query_killer();
   if (killer) {
      if (killer->is_player() ) {
         set_this_player(killer);
      }

      killer->message("%^BOLD%^%^CYAN%^You killed " +
         this_object()->query_Name() + ".%^RESET%^");
   }

   this_object()->simple_action("$N $vfall to the ground...dead.");

   obj = clone_object(DOMAINS_DIR + "/required/objects/corpse");

   inv = this_object()->query_inventory();
   for (i = sizeof(inv) - 1; i>=0; i--) {
      if (inv[i]->query_worn()) {
         this_object()->do_remove(inv[i]);
      }
      if (inv[i]->query_wielded()) {
         this_object()->do_unwield(inv[i]);
      }
      inv[i]->move(obj);
   }

   obj->set_name(this_object()->query_name());
   obj->move(this_object()->query_environment());

   if (this_object()->is_player()) {
      this_object()->set_dead(1);
      this_object()->move(VOID);
      this_object()->message("You have died.");
      this_object()->clear_money();
   } else {
      if (this_object()<-"/std/monster") {
         this_object()->monster_died();
      }
      EVENT_D->unsubscribe_event("heart_beat");
      this_object()->destruct();
   }
}
Esempio n. 4
0
File: paralyze.c Progetto: xxx/cdlib
/*
 * Function name: stop_paralyze
 * Description  : This function is called if the paralyze shall stop due to 
 *		  the time running out.
 */
void
stop_paralyze()
{
    if (!objectp(environment()))
    {
        remove_object();
        return;
    }

    set_this_player(environment());

    if (objectp(stop_object) && stringp(stop_fun) &&
        (stop_object != this_object()))
    {
        call_other(stop_object, stop_fun, environment());
    }
    else if (strlen(stop_message))
    {
        environment()->catch_msg(stop_message);
    }

    remove_object();
}