update.c

demise/src/update.c · 140.0 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

/***************************************************************************
 *  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.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  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.                                                  *
 ***************************************************************************/

/***************************************************************************
 *  God Wars Mud improvements copyright (C) 1994, 1995, 1996 by Richard    *
 *  Woolcock.  This mud is NOT to be copied in whole or in part, or to be  *
 *  run without the permission of Richard Woolcock.  Nobody else has       *
 *  permission to authorise the use of this code.                          *
 ***************************************************************************/

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



/*
 * Local functions.
 */
int hit_gain args ((CHAR_DATA * ch));
int mana_gain args ((CHAR_DATA * ch));
int move_gain args ((CHAR_DATA * ch));
void mobile_update args ((void));
void weather_update args ((void));
void char_update args ((void));
void obj_update args ((void));
void aggr_update args ((void));
void regen_limb args ((CHAR_DATA * ch));


void
gain_exp (CHAR_DATA * ch, int gain)
{
  CHAR_DATA *mount = NULL;
  CHAR_DATA *master = NULL;

  if (IS_NPC (ch) && (mount = ch->mount) != NULL && !IS_NPC (mount))
    {
      if ((master = ch->master) == NULL || master != mount)
	{
	  mount->exp += gain;
	}
    }
  if (!IS_NPC (ch) && !IS_IMMORTAL (ch))
    {
      ch->exp += gain;
    }
  return;
}



/*
 * Regeneration stuff.
 */
int
hit_gain (CHAR_DATA * ch)
{
  int gain;
  int conamount;

  if (IS_NPC (ch))
    {
      gain = ch->level;
    }
  else
    {
      if (IS_VAMPIRE (ch))
	return 0;
      gain = number_range (10, 20);

      if ((conamount = (get_curr_con (ch) + 1)) > 1)
	{
	  switch (ch->position)
	    {
	    case POS_MEDITATING:
	      gain *= conamount * 0.5;
	      break;
	    case POS_SLEEPING:
	      gain *= conamount;
	      break;
	    case POS_RESTING:
	      gain *= conamount * 0.5;
	      break;
	    }
	}

      if (ch->pcdata->condition[COND_FULL] == 0 && !IS_HERO (ch))
	gain *= 0.5;

      if (ch->pcdata->condition[COND_THIRST] == 0 && !IS_HERO (ch))
	gain *= 0.5;

    }

  if (IS_AFFECTED (ch, AFF_POISON) || IS_AFFECTED (ch, AFF_FLAMING))
    gain *= 0.25;

  return UMIN (gain, ch->max_hit - ch->hit);
}



int
mana_gain (CHAR_DATA * ch)
{
  int gain;
  int intamount;

  if (IS_NPC (ch))
    {
      gain = ch->level;
    }
  else
    {
      if (IS_VAMPIRE (ch))
	return 0;
      gain = number_range (10, 20);

      if ((intamount = (get_curr_int (ch) + 1)) > 1)
	{
	  switch (ch->position)
	    {
	    case POS_MEDITATING:
	      gain *= intamount * ch->level;
	      break;
	    case POS_SLEEPING:
	      gain *= intamount;
	      break;
	    case POS_RESTING:
	      gain *= intamount * 0.5;
	      break;
	    }
	}

      if (!IS_HERO (ch) && ch->pcdata->condition[COND_THIRST] == 0)
	gain *= 0.5;

    }

  if (IS_AFFECTED (ch, AFF_POISON) || IS_AFFECTED (ch, AFF_FLAMING))
    gain *= 0.25;

  return UMIN (gain, ch->max_mana - ch->mana);
}



int
move_gain (CHAR_DATA * ch)
{
  int gain;
  int dexamount;

  if (IS_NPC (ch))
    {
      gain = ch->level;
    }
  else
    {
      if (IS_VAMPIRE (ch))
	return 0;
      gain = number_range (10, 20);

      if ((dexamount = (get_curr_dex (ch) + 1)) > 1)
	{
	  switch (ch->position)
	    {
	    case POS_MEDITATING:
	      gain *= dexamount * 0.5;
	      break;
	    case POS_SLEEPING:
	      gain *= dexamount;
	      break;
	    case POS_RESTING:
	      gain *= dexamount * 0.5;
	      break;
	    }
	}

      if (!IS_HERO (ch) && ch->pcdata->condition[COND_THIRST] == 0)
	gain *= 0.5;
    }

  if (IS_AFFECTED (ch, AFF_POISON) || IS_AFFECTED (ch, AFF_FLAMING))
    gain *= 0.25;

  return UMIN (gain, ch->max_move - ch->move);
}



void
gain_condition (CHAR_DATA * ch, int iCond, int value)
{
  int condition;

  if (value == 0 || IS_NPC (ch))
    return;

  if (!IS_NPC (ch) && IS_HERO (ch) && !IS_VAMPIRE (ch) && iCond != COND_DRUNK)
    return;


  condition = ch->pcdata->condition[iCond];
  if (!IS_NPC (ch) && !IS_VAMPIRE (ch))
    ch->pcdata->condition[iCond] = URANGE (0, condition + value, 48);
  else
    ch->pcdata->condition[iCond] = URANGE (0, condition + value, 100);

  if (ch->pcdata->condition[iCond] == 0)
    {
      switch (iCond)
	{
	case COND_FULL:
	  if (!IS_VAMPIRE (ch))
	    {
	      send_to_char ("You are REALLY hungry.\n\r", ch);
	      act ("You hear $n's stomach rumbling.", ch, NULL, NULL,
		   TO_ROOM);
	    }
	  break;

	case COND_THIRST:
	  if (!IS_VAMPIRE (ch))
	    send_to_char ("You are REALLY thirsty.\n\r", ch);

	  else if (ch->hit > 0)
	    {
	      send_to_char ("You are DYING from lack of #rblood#n!\n\r", ch);
	      act ("$n gets a hungry look in $s eyes.", ch, NULL, NULL,
		   TO_ROOM);
	      ch->hit -= number_range (500, 2000);
	      update_pos (ch);
	      if (number_percent () <= ch->beast && ch->beast > 0)
		vamp_rage (ch);
	      if (!IS_VAMPAFF (ch, VAM_FANGS))
		do_fangs (ch, "");
	    }

	  break;

	case COND_DRUNK:
	  if (condition != 0)
	    send_to_char ("You are sober.\n\r", ch);
	  break;
	}
    }
  else if (ch->pcdata->condition[iCond] < 10)
    {
      switch (iCond)
	{
	case COND_FULL:
	  if (!IS_VAMPIRE (ch))
	    send_to_char ("You feel hungry.\n\r", ch);
	  break;

	case COND_THIRST:
	  if (!IS_VAMPIRE (ch))
	    send_to_char ("You feel thirsty.\n\r", ch);

	  else
	    {
	      send_to_char ("You crave #rblood#n.\n\r", ch);
	      if (number_range (1, 1000) <= ch->beast && ch->beast > 0)
		vamp_rage (ch);
	      if (number_percent () >
		  (ch->pcdata->condition[COND_THIRST] + 75)
		  && !IS_VAMPAFF (ch, VAM_FANGS))
		do_fangs (ch, "");
	    }

	  break;
	}
    }

  return;
}



/*
 * Mob autonomous action.
 * This function takes 25% to 35% of ALL Merc cpu time.
 * -- Furey
 */
void
mobile_update (void)
{
  char buf[MSL];
  CHAR_DATA *ch;
  CHAR_DATA *ch_next;
  OBJ_DATA *stake;
  EXIT_DATA *pexit;
  int door, chance, travto;

  /* Examine all mobs. */
  for (ch = char_list; ch != NULL; ch = ch_next)
    {
      ch_next = ch->next;

      if (ch->in_room == NULL)
	continue;

      if (ch->hunting != NULL)
	{
	  check_hunt (ch);
	  continue;
	}

      if (ch->sat != NULL)
	{
	  if (!CAN_SIT (ch) || ch->in_room == NULL ||
	      ch->sat->in_room == NULL || ch->sat->in_room != ch->in_room)
	    {
	      ch->sat->sat = NULL;
	      ch->sat = NULL;
	    }
	}
      if (IS_EXTRA (ch, EXTRA_DYING))
	{
	  act ("$n falls to the ground and dies from $s wounds.", ch, NULL,
	       NULL, TO_ROOM);
	  send_to_char
	    ("You fall to the ground and die from your wounds.\n\r", ch);
	  ch->form = 16;
	  raw_kill (ch, ch);
	  continue;
	}
      if (!IS_NPC (ch) && IS_VAMPIRE (ch) && IS_XXX (ch, XXX_THIRST)
	  && ch->blood[BLOOD_CURRENT] >= 2)
	{
	  ch->blood[BLOOD_CURRENT] -=
	    number_range (1, ch->blood[BLOOD_CURRENT]);
	}
      if (!IS_NPC (ch) && IS_VAMPIRE (ch) && IS_XXX (ch, XXX_THIRST))
	{
	  if (number_percent () <= 20)
	    REMOVE_BIT (ch->xxxbits, XXX_THIRST);
	}
      if (IS_NPC (ch) && ch->demontimer > 0)
	{
	  if (--ch->demontimer < 1)
	    {
	      if (ch->fighting != NULL)
		stop_fighting (ch, TRUE);
	      do_say (ch,
		      "My service is completed, it is time I returned to where hence I came!");
	      act
		("$p stops for a second, then rips $s own heart out of $s chest and throws it to the floor.",
		 ch, NULL, NULL, TO_ROOM);
	      make_part (ch, "heart");
	      raw_kill (ch, ch);
	      continue;
	    }
	}
      if (IS_NPC (ch) && ch->pIndexData->vnum == 3011)
	{
	  if (ch->hit < ch->max_hit || ch->move < ch->max_move
	      || ch->mana < ch->max_mana)
	    {
	      if (number_range (1, 10) > 6)
		{
		  ch->hit += number_range (10000, 50000);
		  ch->move += number_range (10000, 50000);
		  ch->mana += number_range (10000, 50000);
		  act ("$n wounds glow lightly and close up.#n", ch, NULL,
		       NULL, TO_ROOM);
		}

	      if (ch->hit > ch->max_hit)
		ch->hit = ch->max_hit;
	      if (ch->move > ch->max_move)
		ch->move = ch->max_move;
	      if (ch->mana > ch->max_mana)
		ch->mana = ch->max_mana;
	    }
	  if (ch->loc_hp[6] > 0)
	    {
	      int sn = skill_lookup ("clot");
	      (*skill_table[sn].spell_fun) (sn, ch->level, ch, ch);
	    }
	  else
	    {
	      if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
		   ch->loc_hp[3] + ch->loc_hp[4] + ch->loc_hp[5]) != 0)
		reg_mend (ch);
	    }
	  update_pos (ch);
	}
      if (!IS_NPC (ch))
	{
	  if (!IS_RNPC (ch))
	    {
//          sprintf (buf, "rnpc check, bypassing...");
//          do_say (ch, buf);
	      if (ch->desc == NULL || !IS_PLAYING (ch->desc))
		continue;
	    }
	  if (IS_RNPC (ch))
	    {
//          sprintf (buf, "rnpc check, bypassed... safe timer %d", ch->safetimer);
//          do_say (ch, buf);
	      if (ch->safetimer >= 1)
		{
		  if (--ch->safetimer <= 0)
		    {
		      OBJ_DATA *obj;
		      OBJ_DATA *obj_next;
		      CHAR_DATA *newdemon;
		      for (obj = ch->carrying; obj != NULL; obj = obj_next)
			{
			  obj_next = obj->next_content;
			  if (obj->item_type == ITEM_PIECE)
			    {
			      act
				("$p fades from $n's hands and scatters to the wind.\n\r",
				 ch, obj, NULL, TO_ROOM);
			      do_hideaway (ch, obj->name);
			      continue;
			    }

			  if (obj->wear_loc == WEAR_NONE)
			    continue;
			  if (!IS_NPC (ch)
			      &&
			      ((obj->chobj != NULL && !IS_NPC (obj->chobj)
				&& obj->chobj->pcdata->obj_vnum != 0)
			       || obj->item_type == ITEM_KEY))
			    {
			      unequip_char (ch, obj);
			      extract_obj (obj);
			    }
			}
		      newdemon = create_mobile (get_mob_index (45792));
		      char_to_room (newdemon,
				    get_room_index (ch->in_room->vnum));
		      if (ch->in_room != NULL)
			char_from_room (ch);
		      char_to_room (ch,
				    get_room_index (ROOM_VNUM_DISCONNECTION));
		      extract_char (ch, TRUE);
		      continue;
		    }		//reverett
		}
	    }
	  if (IS_EXTRA (ch, EXTRA_OSWITCH) && IS_MORE (ch, MORE_STAKED)
	      && (stake = get_eq_char (ch, WEAR_STAKE)) == NULL)
	    {
	      OBJ_DATA *obj;

	      REMOVE_BIT (ch->more, MORE_STAKED);
	      ch->pcdata->obj_vnum = 0;
	      REMOVE_BIT (ch->affected_by, AFF_POLYMORPH);
	      REMOVE_BIT (ch->extra, EXTRA_OSWITCH);
	      free_string (ch->morph);
	      ch->morph = str_dup ("");
	      send_to_char ("You recover from torpor.\n\r", ch);
	      if ((obj = ch->pcdata->chobj) != NULL)
		{
		  obj->chobj = NULL;
		  if (obj->carried_by != NULL)
		    {
		      if (ch != obj->carried_by)
			{
			  act ("You drop $N onto the floor.", obj->carried_by,
			       NULL, ch, TO_CHAR);
			  act ("$n drops $N onto the floor.", obj->carried_by,
			       NULL, ch, TO_NOTVICT);
			  act ("$n drops you onto the floor.",
			       obj->carried_by, NULL, ch, TO_VICT);
			}
		    }
		}
	      ch->pcdata->chobj = NULL;
	      act ("$n scrambles to $s feet.", ch, NULL, NULL, TO_ROOM);
	      act ("You scrambles back to your feet.", ch, NULL, NULL,
		   TO_CHAR);
	      extract_obj (obj);
	      if (ch->in_room->vnum == ROOM_VNUM_IN_OBJECT)
		{
		  char_from_room (ch);
		  char_to_room (ch, get_room_index (ROOM_VNUM_ALTAR));
		}
	    }
	  if (ch->position < POS_SLEEPING
	      && (ch->pcdata->wolf > 0 || ch->pcdata->vamprage > 0))
	    {
	      ch->pcdata->wolf = 0;
	      ch->pcdata->vamprage = 0;
	      if (IS_WEREWOLF (ch))
		do_unwerewolf (ch, "");
	      if (IS_VAMPAFF (ch, VAM_NIGHTSIGHT)
		  && !IS_POLYAFF (ch, POLY_ZULO))
		do_nightsight (ch, "");
	      if (IS_VAMPAFF (ch, VAM_FANGS) && !IS_POLYAFF (ch, POLY_ZULO))
		do_fangs (ch, "");
	      if (IS_VAMPAFF (ch, VAM_CLAWS) && !IS_POLYAFF (ch, POLY_ZULO))
		do_claws (ch, "");
	      send_to_char ("You feel your beast release its hold.\n\r", ch);
	    }
	  else if (ch->pcdata->song > 0)
	    {
	      OBJ_DATA *obj;
	      if ((obj = ch->pcdata->memorised) == NULL)
		{
		  ch->pcdata->memorised = NULL;
		  ch->pcdata->song = 0;
		}
	      else
		sing_song (ch, obj);
	    }
	  else if (ch->pcdata->condition[COND_DRUNK] > 10
		   && number_range (1, 10) == 1)
	    {
	      send_to_char ("You hiccup loudly.\n\r", ch);
	      act ("$n hiccups.", ch, NULL, NULL, TO_ROOM);
	    }
	  if (ch->embraced == ARE_EMBRACING)
	    {
	      CHAR_DATA *vch;
	      int amount = number_range (5, 15);
	      if (ch->position < POS_STANDING)
		{
		  if ((vch = ch->embrace) != NULL)
		    {
		      vch->embrace = NULL;
		      vch->embraced = ARE_NONE;
		    }
		  ch->embrace = NULL;
		  ch->embraced = ARE_NONE;
		}
	      else if ((vch = ch->embrace) == NULL)
		ch->embraced = ARE_NONE;
	      else if (vch->position == POS_FIGHTING)
		{
		  vch->embrace = NULL;
		  vch->embraced = ARE_NONE;
		  ch->embrace = NULL;
		  ch->embraced = ARE_NONE;
		}
	      else if (vch->in_room == NULL || ch->in_room == NULL ||
		       ch->in_room != vch->in_room || is_safe (ch, vch))
		{
		  ch->embrace = NULL;
		  ch->embraced = ARE_NONE;
		  vch->embrace = NULL;
		  vch->embraced = ARE_NONE;
		}
	      else if (!IS_NPC (vch) && !IS_NPC (ch)
		       && IS_SET (mudconfig->world_affects, WORLD_ARMAGEDDON))
		{
		  ch->embrace = NULL;
		  ch->embraced = ARE_NONE;
		  vch->embrace = NULL;
		  vch->embraced = ARE_NONE;
		}
	      else if (vch->level > 100 && vch->position > POS_STUNNED)
		{
		  if (vch->position < POS_FIGHTING)
		    {
		      act ("You scramble to your feet.", vch, NULL, NULL,
			   TO_CHAR);
		      act ("$n scramble to $s feet.", vch, NULL, NULL,
			   TO_ROOM);
		      vch->position = POS_STANDING;
		    }
		  act
		    ("$N rips your head away from $S throat and hurls you across the room.",
		     ch, NULL, vch, TO_CHAR);
		  act
		    ("You rip $n's head away from your throat and hurl $m across the room.",
		     ch, NULL, vch, TO_VICT);
		  act
		    ("$N rips $n's head away from $S throat and hurls $m across the room.",
		     ch, NULL, vch, TO_NOTVICT);
		  act ("You have been knocked on your ass.", ch, NULL, NULL,
		       TO_CHAR);
		  act ("$n has been knocked on $s ass.", ch, NULL, NULL,
		       TO_ROOM);
		  stop_fighting (ch, TRUE);
		  ch->position = POS_STUNNED;
		  ch->embrace = NULL;
		  ch->embraced = ARE_NONE;
		  vch->embrace = NULL;
		  vch->embraced = ARE_NONE;
		}
	      else
		{
		  act
		    ("You shudder with ecstacy as you drain $N's lifeblood from $S throat.",
		     ch, NULL, vch, TO_CHAR);
		  act
		    ("The gentle motion of $n's lips on your throat sends electric shivers through your body.",
		     ch, NULL, vch, TO_VICT);
		  act ("$n drinks deeply from $N's throat.", ch, NULL, vch,
		       TO_NOTVICT);
		  if (vch->position == POS_STUNNED)
		    update_pos (vch);
		  if (!IS_NPC (vch) && ((IS_WEREWOLF (vch) &&
					 get_tribe (vch,
						    TRIBE_GET_OF_FENRIS) > 0)
					|| IS_DEMON (vch)))
		    {
		      int dam =
			(number_range (25, 50) * amount *
			 vch->blood[BLOOD_POTENCY]);
		      act
			("Your lips blister and burn as $N's #rblood#n enters your mouth!",
			 ch, NULL, vch, TO_CHAR);
		      ch->hit -= dam;
		      ch->agg += dam * 0.005;
		      if (ch->agg > 100)
			ch->agg = 100;
		      if (ch->hit < -10)
			ch->hit = -10;
		      update_pos (ch);
		      if (ch->position <= POS_STUNNED)
			{
			  act ("$n keels over and collapses on the floor.",
			       ch, NULL, NULL, TO_ROOM);
			  ch->embrace = NULL;
			  ch->embraced = ARE_NONE;
			  vch->embrace = NULL;
			  vch->embraced = ARE_NONE;
			}
		    }
		  if (IS_MORE (vch, MORE_BRISTLES))
		    {
		      int dam = number_range (4000, 5000);
		      damage (vch, ch, dam, gsn_spines, DAM_NORMAL, FALSE,
			      TRUE, TRUE);
		      stop_fighting (vch, TRUE);
		      update_pos (ch);
		      if (ch->position <= POS_STUNNED)
			{
			  act ("$n keels over and collapses on the floor.",
			       ch, NULL, NULL, TO_ROOM);
			  ch->embrace = NULL;
			  ch->embraced = ARE_NONE;
			  vch->embrace = NULL;
			  vch->embraced = ARE_NONE;
			}
		    }
		  if (IS_NPC (vch))
		    amount = amount * 3;

		  if (vch->blood[BLOOD_CURRENT] > amount &&
		      (vch->blood[BLOOD_CURRENT] - amount) <= 50)
		    {
		      ch->blood[BLOOD_CURRENT] +=
			(amount * vch->blood[BLOOD_POTENCY]);
		      vch->blood[BLOOD_CURRENT] -= amount;
		      if (!IS_VAMPIRE (vch))
			{
			  act ("$N sways weakly in your arms.", ch, NULL, vch,
			       TO_CHAR);
			  act ("You sway weakly in $n's arms.", ch, NULL, vch,
			       TO_VICT);
			  act ("$N sways weakly in $n's arms.", ch, NULL, vch,
			       TO_NOTVICT);
			}
		      if (vch->blood[BLOOD_CURRENT] <= 25)
			{
			  if (IS_VAMPIRE (vch))
			    {
			      act
				("You can feel that $N is very low on #rblood#n.",
				 ch, NULL, vch, TO_CHAR);
			      send_to_char
				("You are very low on #rblood#n.\n\r", vch);
			    }
			  else
			    {
			      act
				("You can feel that $N is on the verge of death.",
				 ch, NULL, vch, TO_CHAR);
			      send_to_char ("You feel very faint.\n\r", vch);
			    }
			}
		    }
		  else if (vch->blood[BLOOD_CURRENT] - amount <= 0)
		    {
		      if (!IS_NPC (vch)
			  && ((vch->race < 1 && ch->race > 0)
			      || (ch->race - vch->race > 10))
			  && artisafe (ch, vch))
			{
			  if (!IS_CREATOR (ch))
			    {
			      sprintf (buf,
				       "%s has tried to diablerize %s for no status, but failed.",
				       ch->name, vch->name);
			      do_fatality (ch, buf);
			      sprintf (log_buf,
				       "%s tried to diablerize %s at %d for no status.",
				       ch->name, vch->name,
				       vch->in_room->vnum);
			      log_string (log_buf);
			      vch->blood[BLOOD_CURRENT] = 5;
			      restoring (vch);
			      paradox (ch);
			    }
			}
		      else
			{

			  ch->blood[BLOOD_CURRENT] +=
			    vch->blood[BLOOD_CURRENT];
			  vch->blood[BLOOD_CURRENT] = 0;
			  act ("Your body falls limply to the ground.", vch,
			       NULL, NULL, TO_CHAR);
			  act ("$n's body falls limply to the ground.", vch,
			       NULL, NULL, TO_ROOM);
			  if (!IS_NPC (ch) && !IS_NPC (vch)
			      && ch->pcdata->vamprituals[0] < 33554431)
			    {
			      vampgain (ch, "");
			    }
			  if (!IS_NPC (vch) && IS_VAMPIRE (vch))
			    {
			      act ("You suck $N's soul out of $S body.", ch,
				   NULL, vch, TO_CHAR);
			      act ("$n sucks your soul out of your body.", ch,
				   NULL, vch, TO_VICT);
			      send_to_char ("You have been Diablerised!\n\r",
					    vch);
			      sprintf (buf, "%s has been diablerised by %s.",
				       vch->name, ch->name);
			      do_info (ch, buf);
			      if (ch->beast == 0)
				{
				  send_to_char ("You have lost Golconda!\n\r",
						ch);
				  sprintf (buf, "%s has lost Golconda!",
					   ch->name);
				  do_info (ch, buf);
				  if (IS_IMMUNE (ch, IMM_SUNLIGHT))
				    REMOVE_BIT (ch->immune, IMM_SUNLIGHT);
				  ch->beast = 1;
				  ch->truebeast = 1;
				}
			      ch->pcdata->diableries[DIAB_TIME] += 10000;
			      ch->pcdata->diableries[DIAB_EVER]++;
			      ch->beast += 100;
			      ch->truebeast += 100;
			      if (ch->beast > 100)
				ch->beast = 100;
			      if (ch->truebeast > 100)
				ch->truebeast = 100;
			      if (is_affected (vch, gsn_potency))
				affect_strip (vch, gsn_potency);
			    }
			  if (vch->exp > 0 && !IS_NPC (vch) && !IS_NPC (ch))
			    {
			      int expstolen = 0;
			      int expstolen2 = 0;
			      int exptoken = 0;
			      OBJ_INDEX_DATA *pObjIndex;
			      OBJ_DATA *token;
			      char theft[MSL];
			      expstolen = vch->exp / 2;
			      if ((ch->exp + expstolen) > 2100000000)
				{
				  expstolen2 = 2100000000 - ch->exp;
				  exptoken = expstolen - expstolen2;
				}
			      else
				{
				  expstolen2 = expstolen;
				}

			      sprintf (theft,
				       "#C[#RYou steal #y%d#R exp from #n$N#R as you drain the life blood from $S throat.#C]#n",
				       expstolen2);
			      act (theft, ch, NULL, vch, TO_CHAR);
			      sprintf (theft,
				       "#C[#n$n#R steals #y%d#R exp from you as $e drains the life blood from your throat.#C]#n",
				       expstolen2);
			      act (theft, ch, NULL, vch, TO_VICT);
			      ch->exp += expstolen2;
			      if (exptoken > 0)
				{
				  token = create_object (pObjIndex, 56);
				  token->value[0] = exptoken;
				  token->level = 1;
				  token->cost = exptoken * 1000;
				  token->item_type = ITEM_EXP;
				  obj_to_char (token, ch);
				  if (token->questmaker != NULL)
				    free_string (token->questmaker);
				  token->questmaker = str_dup (ch->name);
				  free_string (token->name);
				  token->name = str_dup ("exp token");
				  sprintf (theft, "a %d point exp token",
					   exptoken);
				  free_string (token->short_descr);
				  token->short_descr = str_dup (theft);
				  sprintf (theft,
					   "A %d point credit token lies on the floor.",
					   exptoken);
				  free_string (token->description);
				  token->description = str_dup (theft);
				  sprintf (theft,
					   "Since you dont have room for any more exp the remaining %d exp generates a $p.",
					   exptoken);
				  act (theft, ch, token, vch, TO_CHAR);
				  act ("$n creates a $p.", ch, token, vch,
				       TO_VICT);
				  act ("$n creates a $p.", ch, token, vch,
				       TO_NOTVICT);
				}
			      vch->exp -= expstolen;
			    }
			  if ((ch->race - vch->race) <= 10 && vch->race > 0
			      && !IS_NPC (vch) && !IS_NPC (ch))
			    {
			      ch->race++;
			      vch->race--;
			    }
			  ch->embrace = NULL;
			  ch->embraced = ARE_NONE;
			  vch->embrace = NULL;
			  vch->embraced = ARE_NONE;
			  if (IS_NPC (vch))
			    {
			      demon_gain (ch, vch);
			      group_gain (ch, vch);
			    }
			  vch->form = 0;
			  if (!IS_WRAITH (vch))
			    killperson (ch, vch);
			}
		    }
		  else
		    {
		      ch->blood[BLOOD_CURRENT] +=
			(amount * vch->blood[BLOOD_POTENCY]);
		      vch->blood[BLOOD_CURRENT] -= amount;
		    }
		  if (ch->blood[BLOOD_CURRENT] >= ch->blood[BLOOD_POOL])
		    {
		      ch->blood[BLOOD_CURRENT] = ch->blood[BLOOD_POOL];
		      stc ("Your #rblood#0lust#n has been satiated.\n\r", ch);
		    }
		}
	    }
	  if (!IS_NPC (ch)
	      && (ch->pcdata->stage[0] > 0 || ch->pcdata->stage[2] > 0))
	    {
	      CHAR_DATA *vch;
	      if (ch->pcdata->stage[1] > 0 && ch->pcdata->stage[2] >= 225)
		{
		  ch->pcdata->stage[2]++;
		  if ((vch = ch->pcdata->partner) != NULL &&
		      !IS_NPC (vch) && vch->pcdata->partner == ch &&
		      ((vch->pcdata->stage[2] >= 200
			&& vch->sex == SEX_FEMALE)
		       || (ch->pcdata->stage[2] >= 200
			   && ch->sex == SEX_FEMALE)))
		    {
		      if (ch->in_room != vch->in_room)
			continue;
		      if (vch->pcdata->stage[2] >= 225 &&
			  ch->pcdata->stage[2] >= 225 &&
			  vch->pcdata->stage[2] < 240 &&
			  ch->pcdata->stage[2] < 240)
			{
			  ch->pcdata->stage[2] = 240;
			  vch->pcdata->stage[2] = 240;
			}
		      if (ch->sex == SEX_MALE && vch->pcdata->stage[2] >= 240)
			{
			  act
			    ("You thrust deeply between $N's warm, damp thighs.",
			     ch, NULL, vch, TO_CHAR);
			  act
			    ("$n thrusts deeply between your warm, damp thighs.",
			     ch, NULL, vch, TO_VICT);
			  act
			    ("$n thrusts deeply between $N's warm, damp thighs.",
			     ch, NULL, vch, TO_NOTVICT);
			  if (vch->pcdata->stage[2] > ch->pcdata->stage[2])
			    ch->pcdata->stage[2] = vch->pcdata->stage[2];
			}
		      else if (ch->sex == SEX_FEMALE
			       && vch->pcdata->stage[2] >= 240)
			{
			  act
			    ("You squeeze your legs tightly around $N, moaning loudly.",
			     ch, NULL, vch, TO_CHAR);
			  act
			    ("$n squeezes $s legs tightly around you, moaning loudly.",
			     ch, NULL, vch, TO_VICT);
			  act
			    ("$n squeezes $s legs tightly around $N, moaning loudly.",
			     ch, NULL, vch, TO_NOTVICT);
			  if (vch->pcdata->stage[2] > ch->pcdata->stage[2])
			    ch->pcdata->stage[2] = vch->pcdata->stage[2];
			}
		    }
		  if (ch->pcdata->stage[2] >= 250)
		    {
		      if ((vch = ch->pcdata->partner) != NULL &&
			  !IS_NPC (vch) && vch->pcdata->partner == ch &&
			  ch->in_room == vch->in_room)
			{
			  vch->pcdata->stage[2] = 250;
			  if (ch->sex == SEX_MALE)
			    {
			      stage_update (ch, vch, 2);
			      stage_update (vch, ch, 2);
			    }
			  else
			    {
			      stage_update (vch, ch, 2);
			      stage_update (ch, vch, 2);
			    }
			  ch->pcdata->stage[0] = 0;
			  vch->pcdata->stage[0] = 0;
			  if (!IS_EXTRA (ch, EXTRA_EXP))
			    {
			      send_to_char
				("Congratulations on achieving a simultanious orgasm!  Recieve 100000 exp!\n\r",
				 ch);
			      SET_BIT (ch->extra, EXTRA_EXP);
			      ch->exp += 100000;
			    }
			  if (!IS_EXTRA (vch, EXTRA_EXP))
			    {
			      send_to_char
				("Congratulations on achieving a simultanious orgasm!  Recieve 100000 exp!\n\r",
				 vch);
			      SET_BIT (vch->extra, EXTRA_EXP);
			      vch->exp += 100000;
			    }
			}
		    }
		}
	      else
		{
		  if (ch->pcdata->stage[0] > 0 && ch->pcdata->stage[2] < 1 &&
		      ch->position != POS_RESTING)
		    {
		      if (ch->pcdata->stage[0] > 1)
			ch->pcdata->stage[0] -= 1;
		      else
			ch->pcdata->stage[0] = 0;
		    }
		  else if (ch->pcdata->stage[2] > 0
			   && ch->pcdata->stage[0] < 1)
		    {
		      if (ch->pcdata->stage[2] > 10)
			ch->pcdata->stage[2] -= 10;
		      else
			ch->pcdata->stage[2] = 0;
		      if (ch->sex == SEX_MALE && ch->pcdata->stage[2] == 0)
			send_to_char ("You feel fully recovered.\n\r", ch);
		    }
		}
	    }

	  if (!IS_NPC (ch) && IS_ABOMINATION (ch))
	    {
	      if (ch->position == POS_FIGHTING
		  && !IS_ITEMAFF (ch, ITEMA_RAGER))
		{
		  if (get_tribe (ch, TRIBE_BLACK_FURIES) < 6)
		    {
		      if (ch->pcdata->wolf < 300)
			{
			  if (get_tribe (ch, TRIBE_GET_OF_FENRIS) > 4)
			    ch->pcdata->wolf += number_range (15, 30);
			  else
			    ch->pcdata->wolf += number_range (5, 10);
			}
		    }
		  else
		    {
		      if (ch->pcdata->wolf < 600)
			{
			  if (get_tribe (ch, TRIBE_GET_OF_FENRIS) > 4)
			    ch->pcdata->wolf += number_range (15, 30);
			  else
			    ch->pcdata->wolf += number_range (5, 10);
			}
		    }
		  if (!IS_SET (ch->act, PLR_WOLFMAN) &&
		      ch->pcdata->wolf >= 100
		      && ch->pcdata->wolfform[1] == FORM_HOMID)
		    do_werewolf (ch, "");
		}
	      else if (ch->pcdata->wolf > 0 && !IS_ITEMAFF (ch, ITEMA_RAGER))
		{
		  ch->pcdata->wolf--;
		  if (ch->pcdata->wolf < 100
		      && ch->pcdata->wolfform[1] == FORM_HOMID)
		    do_unwerewolf (ch, "");
		}
	      if (IS_MORE (ch, MORE_ANGER))
		beast_rage (ch);
	    }
	  if (!IS_NPC (ch) && IS_ABOMINATION (ch))
	    {
	      if (ch->truebeast < 100)
		ch->truebeast = 100;
//             if (ch->beast < 100)
//             ch->beast = 100;

	    }
	  if (!IS_NPC (ch) && !IS_IMMORTAL (ch))
	    {
	      if (!IS_NPC (ch) && !IS_COR (ch, COR_FOUNDER))
		{
		  if (IS_EMPEROR (ch))
		    {
		      SET_BIT (ch->corbits, COR_FOUNDER);
		    }

		}
	      else
		{
		  if (!IS_EMPEROR (ch))
		    {
		      REMOVE_BIT (ch->corbits, COR_FOUNDER);
		    }
		}

	    }
	  if (IS_XX (ch, XX_ADVPOISON))
	    {
	      if (ch->pcdata->advpoison > 0)
		{
		  ch->hit -= ch->pcdata->advpoison;
		  stc
		    ("You grow weaker as the poison circulates through your system.\n\r",
		     ch);
		  act
		    ("$n grows weaker as the poison curculates through $s body.",
		     ch, NULL, NULL, TO_ROOM);
		  ch->pcdata->advpoison -= 500;
		}
	      else
		{
		  if (ch->pcdata->advpoison < 1)
		    {
		      stc
			("You feel better as the poison finally leaves your system.\n\r",
			 ch);
		      act
			("$n feels better as the poison finally leaves their system.",
			 ch, NULL, NULL, TO_ROOM);
		      ch->pcdata->advpoison = 0;
		      REMOVE_BIT (ch->xxbits, XX_ADVPOISON);
		    }
		}
	    }

	  if (!IS_NPC (ch) && ch->in_room->wardtime > 0)
	    {
	      if (--ch->in_room->wardtime <= 0)
		{
		  REMOVE_BIT (ch->in_room->added_flags, ROOM2_CMIST);
		  act ("The mist in the room fades to nothing.", ch, NULL,
		       NULL, TO_ROOM);
		}
	    }
	  if (!IS_NPC (ch) && IS_XX (ch, XX_DREAMWORLD)
	      && ch->fighting == NULL && !IS_XBITS (ch, X_SLEEP)
	      && IS_TAKARRA (ch))
	    {
	      if (ch->pcdata->dreamtime > 0)
		ch->pcdata->dreamtime--;
	      if (ch->pcdata->dreamtime == 0)
		{
		  stc ("You wake up from the nightmare.\n\r", ch);
		  act ("$n wakes up from their nightmare.\n\r", ch, NULL,
		       NULL, TO_ROOM);
		  REMOVE_BIT (ch->xxbits, XX_DREAMWORLD);
		}
	    }			/*
				   if (!IS_NPC (ch) && IS_NYM (ch, NYM_DEATHPLANE) && !IS_WRAITH (ch) && (ch->fighting != NULL || ch->fight_timer <= 0 || ch->position == POS_STANDING ))
				   {
				   REMOVE_BIT (ch->nymbits, NYM_DEATHPLANE);
				   stc ("You fade out of the death plane.\n\r", ch);
				   act ("$n fades in from the death plane.\n\r", ch, NULL, NULL, TO_ROOM);
				   } */
	  if (!IS_NPC (ch) && (IS_HYBRID (ch) || HAS_EVOLVED (ch))
	      && ch->in_room->area->plane == PLANE_TRANQ
	      && !IS_SET (ch->in_room->room_flags, ROOM_NO_TRAVEL)
	      && !IS_IMMORTAL (ch)
	      && !IS_SET (mudconfig->world_affects, WORLD_ARMAGEDDON))
	    {
	      stc ("You are not allowed in that part of Tranquility.\n\r",
		   ch);
	      act ("$n is thrown from the room by a powerful force.", ch,
		   NULL, NULL, TO_ROOM);
	      char_from_room (ch);
	      char_to_room (ch, get_room_index (45841));
	      act ("$n is thrown into the room by a powerful force.", ch,
		   NULL, NULL, TO_ROOM);
	      do_look (ch, "auto");
	    }
	  if (!IS_NPC (ch) && IS_XX (ch, XX_DREAMWORLD)
	      && ch->fighting == NULL && !IS_XBITS (ch, X_SLEEP)
	      && !IS_TAKARRA (ch))
	    {
	      stc ("You wake up from the nightmare.\n\r", ch);
	      act ("$n wakes up from their nightmare.\n\r", ch, NULL, NULL,
		   TO_ROOM);
	      REMOVE_BIT (ch->xxbits, XX_DREAMWORLD);
	    }
	  if (!IS_NPC (ch) && IS_MONK (ch) && ch->fighting == NULL)
	    {
	      if (ch->monkcrap != 0)
		{
		  stc ("#CYour aura fades.#n\n\r", ch);
		  act ("#C$n's aura fades.#n", ch, NULL, NULL, TO_ROOM);
		  ch->monkcrap = 0;
		}

	    }
	  if (!IS_NPC (ch) && IS_KENSAI (ch) && ch->fighting == NULL)
	    {
	      if (IS_COMBO (ch, COMBO_BEGUN))
		{
		  stc ("#cYour pulsating essence fades away.#n\n\r", ch);
		  act ("#c$n's pulsating essence fades away.#n", ch,
		       NULL, NULL, TO_ROOM);
		  ch->combocrap = 0;
		  SET_BIT (ch->combocrap, COMBO_FAILED);
		}
	      if (ch->battlefury > 0 && ch->pcdata->kensaihymn < 1)
		{
		  ch->battlefury -= number_range (2, 4);
		  if (ch->battlefury < 1)
		    {
		      stc ("#rYou relax your battle fury.#n\n\r", ch);
		      act ("#r$n's relax's $s battle fury.#n", ch, NULL, NULL,
			   TO_ROOM);
		      ch->battlefury = 0;
		    }
		}
	    }
/*	  if (IS_EM (ch, EM_ARMOR) && IS_WRAITH (ch)
	      && !IS_NYM (ch, NYM_HASARTI))
	    REMOVE_BIT (ch->evenmore, EM_ARMOR);*/
	  if (IS_WRAITH (ch) && !IS_NYM (ch, NYM_DEATHSIGHT))
	    SET_BIT (ch->nymbits, NYM_DEATHSIGHT);
/*
	  if (!IS_NPC (ch) && IS_WRAITH (ch) && !IS_NEWBIE (ch))
	    {
	      if (!IS_NYM (ch, NYM_DEATHPLANE) && ch->pcdata->shadow > 0)
		{
		  if (ch->pcdata->shadow >= 0)
		    ch->move -= number_range (300, 600);
		  if (ch->pcdata->shadow >= 25)
		    ch->move -= number_range (300, 600);
		  if (ch->pcdata->shadow >= 50)
		    ch->move -= number_range (300, 600);
		  if (ch->pcdata->shadow >= 75)
		    ch->move -= number_range (300, 600);
		  if (ch->pcdata->shadow >= 100)
		    ch->move -= number_range (300, 600);

		  if (ch->move < 700)
		    {
		      stc
			("You lack the strength to stay manifested on the material plane so you are thrown back into the plane of death.",
			 ch);
		      SET_BIT (ch->nymbits, NYM_DEATHPLANE);
		      do_look (ch, "");
		    }
		}
	    }
   */
	  if (!IS_NPC (ch) && IS_SET (ch->evenmore, EM_JAILED))
	    {
	      if (unjail_yet (ch))
		{
		  REMOVE_BIT (ch->evenmore, EM_JAILED);
		  ch->pcdata->jaildate = 0;
		  char_from_room (ch);
		  char_to_room (ch, get_room_index (3001));
		  do_look (ch, "auto");
		  sprintf (buf, "#C%s#c has been released from prison!#n",
			   ch->name);
		  do_info (ch, buf);
		}
	    }
	  if (!IS_NPC (ch) && IS_SET (ch->act, PLR_SILENCE))
	    {
	      if (unjail_yet (ch))
		{
		  REMOVE_BIT (ch->act, PLR_SILENCE);
		  ch->pcdata->jaildate = 0;
		  stc ("You may use channels again.\n\r", ch);
		}
	    }
	  if (!IS_NPC (ch)
	      && IS_SET (ch->pcdata->empire[EMP_BITS], BITS_PROBATION))
	    {
	      if (unprob_yet (ch))
		{
		  char sexy[10];
		  int empire;
		  empire = ch->pcdata->empire[0];

		  if (ch->sex == 2)
		    sprintf (sexy, "her");
		  else if (ch->sex == 1)
		    sprintf (sexy, "his");
		  else
		    sprintf (sexy, "its");

		  REMOVE_BIT (ch->pcdata->empire[EMP_BITS], BITS_PROBATION);
		  ch->pcdata->empire2[EMP2_PROBTIME] = 0;

		  sprintf (buf,
			   "#c%s#n has completed %s probation time and is now a full subject of the %s#n Empire!",
			   ch->name, sexy, clantable[empire].name);
		  do_info (ch, buf);
		}
	    }

	  if (!IS_NPC (ch) && !IS_NYM (ch, NYM_DEAD))
	    {
	      int max_skl = 200;

	      if (IS_MONK (ch))
		max_skl = 400;
	      if (IS_HL (ch))
		max_skl = 500;
	      if (IS_WM (ch))
		max_skl = 600;
	      if (IS_DRAC_WARRIOR (ch))
		max_skl = 300;

	      if (ch->pcdata->wpntrain > 0)
		max_skl += (ch->pcdata->wpntrain * 10);

	      if (IS_MONK (ch))
		{
		  if (ch->wpn[0] > max_skl + 400)
		    ch->wpn[0] = max_skl + 400;
		}
	      else if (IS_KAHN (ch))
		{
		  if (ch->wpn[0] > max_skl + 200)
		    ch->wpn[0] = max_skl + 200;
		}
	      else
		{
		  if (ch->wpn[0] > max_skl)
		    ch->wpn[0] = max_skl;
		}
	      if (IS_WM (ch))
		{
		  if (ch->wpn[1] > max_skl + 600)
		    ch->wpn[1] = max_skl + 600;
		}
	      else if (IS_HL (ch))
		{
		  if (ch->wpn[1] > max_skl + 500)
		    ch->wpn[1] = max_skl + 500;
		}
	      else
		{
		  if (ch->wpn[1] > max_skl)
		    ch->wpn[1] = max_skl;
		}

	      if (ch->wpn[2] > max_skl)
		ch->wpn[2] = max_skl;
	      if (ch->wpn[3] > max_skl)
		ch->wpn[3] = max_skl;
	      if (ch->wpn[4] > max_skl)
		ch->wpn[4] = max_skl;
	      if (ch->wpn[5] > max_skl)
		ch->wpn[5] = max_skl;
	      if (ch->wpn[6] > max_skl)
		ch->wpn[6] = max_skl;
	      if (ch->wpn[7] > max_skl)
		ch->wpn[7] = max_skl;
	      if (ch->wpn[8] > max_skl)
		ch->wpn[8] = max_skl;
	      if (ch->wpn[9] > max_skl)
		ch->wpn[9] = max_skl;
	      if (ch->wpn[10] > max_skl)
		ch->wpn[10] = max_skl;
	      if (ch->wpn[11] > max_skl)
		ch->wpn[11] = max_skl;
	      if (ch->wpn[12] > max_skl)
		ch->wpn[12] = max_skl;
	    }
	  if (!IS_NPC (ch) && !IS_NYM (ch, NYM_DEAD))
	    {
	      int max_skl = 200;

	      if ((IS_MAGE (ch) || IS_DRAC_MAGE (ch))
		  && get_trust (ch) >= LEVEL_ARCHMAGE)
		max_skl = 400;
	      else if ((IS_MAGE (ch) || IS_DRAC_MAGE (ch))
		       && get_trust (ch) >= LEVEL_MAGE)
		max_skl = 300;
	      else if ((IS_MAGE (ch) || IS_DRAC_MAGE (ch) || IS_RAKSHASA (ch))
		       && get_trust (ch) >= LEVEL_APPRENTICE)
		max_skl = 240;

	      if (IS_DRAC_MAGE (ch) && max_skl > 300)
		max_skl -= 40;

	      if (ch->pcdata->runes[0] == 0 && IS_MAGE (ch))
		{
		  if (ch->spl[0] > (max_skl + 50))
		    {
		      ch->spl[0] = max_skl + 50;
		    }
		}
	      else
		{
		  if (ch->spl[0] > max_skl)
		    {
		      ch->spl[0] = max_skl;
		    }
		}

	      if (ch->pcdata->runes[0] == 1 && IS_MAGE (ch))
		{
		  if (ch->spl[1] > (max_skl + 50))
		    {
		      ch->spl[1] = max_skl + 50;
		    }
		}
	      else
		{
		  if (ch->spl[1] > max_skl)
		    {
		      ch->spl[1] = max_skl;
		    }
		}

	      if (ch->pcdata->runes[0] == 2 && IS_MAGE (ch))
		{
		  if (ch->spl[2] > (max_skl + 50))
		    {
		      ch->spl[2] = max_skl + 50;
		    }
		}
	      else
		{
		  if (ch->spl[2] > max_skl)
		    {
		      ch->spl[2] = max_skl;
		    }
		}

	      if (ch->pcdata->runes[0] == 3 && IS_MAGE (ch))
		{
		  if (ch->spl[3] > (max_skl + 50))
		    {
		      ch->spl[3] = max_skl + 50;
		    }
		}
	      else
		{
		  if (ch->spl[3] > max_skl)
		    {
		      ch->spl[3] = max_skl;
		    }
		}

	      if (ch->pcdata->runes[0] == 4 && IS_MAGE (ch))
		{
		  if (ch->spl[4] > (max_skl + 50))
		    {
		      ch->spl[4] = max_skl + 50;
		    }
		}
	      else
		{
		  if (ch->spl[4] > max_skl)
		    {
		      ch->spl[4] = max_skl;
		    }
		}
	    }
	  if (!IS_NPC (ch) && IS_MAGE (ch) && ch->pcdata->runes[0] == 5)
	    {
	      ch->pcdata->runes[0] = 6;
	    }
	  if (!IS_NPC (ch) && IS_DRAC_MAGE (ch) && !IS_SOUL (ch)
	      && !IS_GHOST (ch))
	    {
	      ch->pcdata->runes[0] = DRAGON_MAGIC;
	      ch->pcdata->runes[1] = 2047;
	      ch->pcdata->runes[2] = 1023;
	      ch->pcdata->runes[3] = 15;

	      if (ch->pcdata->cpowers[DRAC_MAGIC] > 2 && get_trust (ch) < 4)
		{
		  ch->level = 4;
		  ch->trust = 4;
		}
	    }
	}

      if (IS_AFFECTED (ch, AFF_CHARM) || IS_EXTRA (ch, EXTRA_ILLUSION) ||
	  ch->wizard != NULL)
	continue;

      /* Examine call for special procedure */
      if (IS_RNPC (ch))
	{
	  if (ch->spec_fun != 0)
	    {
	      if ((*ch->spec_fun) (ch))
		continue;
	      if (ch == NULL)
		continue;
	    }

	  if (ch->position == POS_FIGHTING
	      && IS_SET (ch->act, ACT_SKILLED) && ch->stance[0] < 1)
	    {
	      switch (number_range (1, 5))
		{
		default:
		case 1:
		  do_stance (ch, "viper");
		  break;
		case 2:
		  do_stance (ch, "crane");
		  break;
		case 3:
		  do_stance (ch, "mongoose");
		  break;
		case 4:
		  do_stance (ch, "bull");
		  break;
		case 5:
		  do_stance (ch, "crab");
		  break;
		}
	    }

	  /* That's all for sleeping / busy monster */
	  if (ch->position != POS_STANDING)
	    continue;

	  /* Scavenge */
	  if (IS_SET (ch->act, ACT_SCAVENGER)
	      && ch->in_room->contents != NULL && number_bits (2) == 0)
	    {
	      OBJ_DATA *obj;
	      OBJ_DATA *obj_best;
	      int max;

	      max = 1;
	      obj_best = 0;
	      for (obj = ch->in_room->contents; obj; obj = obj->next_content)
		{
		  if (obj->item_type == ITEM_CORPSE_PC)
		    continue;
		  if (CAN_WEAR (obj, ITEM_TAKE) && obj->cost > max)
		    {
		      obj_best = obj;
		      max = obj->cost;
		    }
		}

	      if (obj_best)
		{
		  obj_from_room (obj_best);
		  obj_to_char (obj_best, ch);
		  act ("$n picks $p up.", ch, obj_best, NULL, TO_ROOM);
		  act ("You pick $p up.", ch, obj_best, NULL, TO_CHAR);
		}
	    }
	  if (IS_NPC (ch) && IS_SET (ch->act, ACT_WONDER)
	      && strlen (ch->clan) < 2)
	    {
	      update_guard (ch, ch->in_room->vnum);
	    }
	  /* Wander */
	  if (IS_NPC (ch) && IS_SET (ch->act, ACT_WANDERER))
	    {
	      if ((door = number_bits (5)) <= 5
		  && (pexit = ch->in_room->exit[door]) != NULL
		  && pexit->to_room != NULL
		  && !IS_SET (pexit->exit_info, EX_CLOSED)
		  && !IS_SET (pexit->to_room->room_flags, ROOM_NO_MOB)
		  && ch->fighting == NULL
		  && (ch->hunting == NULL || strlen (ch->hunting->name) < 2)
		  && ((!IS_SET (ch->act, ACT_STAY_AREA) && ch->level < 900)
		      || pexit->to_room->area == ch->in_room->area))
		{
		  move_char (ch, door);
		}
	    }

	  /* Flee */
	  if (ch->hit < ch->max_hit / 2
	      && (door = number_bits (3)) <= 5
	      && (pexit = ch->in_room->exit[door]) != NULL
	      && pexit->to_room != NULL
	      && !IS_AFFECTED (ch, AFF_WEBBED)
	      && ch->level < 900
	      && !IS_SET (pexit->exit_info, EX_CLOSED)
	      && !IS_SET (pexit->to_room->room_flags, ROOM_NO_MOB))
	    {
	      CHAR_DATA *rch;
	      bool found;

	      found = FALSE;
	      for (rch = pexit->to_room->people;
		   rch != NULL; rch = rch->next_in_room)
		{
		  if (!IS_NPC (rch))
		    {
		      found = TRUE;
		      break;
		    }
		}
	      if (!found)
		move_char (ch, door);
	    }
	}

    }

  return;
}



/*
 * Update the weather.
 */
void
weather_update (void)
{
  char buf[MSL];
  DESCRIPTOR_DATA *d;
  CHAR_DATA *ch = NULL;
  int diff, recover;
  bool char_up;
  bool mes_all = FALSE;

  strcpy (buf, "Buf - Please inform Corim.\n\r");

  for (d = descriptor_list; d != NULL; d = d->next)
    {
      if (d->connected == CON_PLAYING
	  && (ch = d->character) != NULL
	  && !IS_NPC (ch)
	  && !IS_EXTRA (ch, EXTRA_OSWITCH) && !IS_HEAD (ch, LOST_HEAD))
	{
	  if (!IS_NPC (ch) && IS_WEREWOLF (ch)
	      && ch->pcdata->gnosis[0] < ch->pcdata->gnosis[1])
	    {
	      ch->pcdata->gnosis[0] += number_range (5, 10);
	      if (ch->pcdata->gnosis[0] > ch->pcdata->gnosis[1])
		ch->pcdata->gnosis[0] = ch->pcdata->gnosis[1];
	    }
	  recover = number_range (5, 10) + (ch->pcdata->willpower[1] * 0.1);
	  if (ch->pcdata->willpower[0] < ch->pcdata->willpower[1])
	    ch->pcdata->willpower[0] += recover;
	  if (ch->pcdata->willpower[0] > ch->pcdata->willpower[1])
	    ch->pcdata->willpower[0] = ch->pcdata->willpower[1];
	  if (IS_MORE (ch, MORE_INFORM))
	    REMOVE_BIT (ch->more, MORE_INFORM);
	  if (IS_MORE (ch, MORE_COURAGE) && number_percent () < 50)
	    {
	      send_to_char ("You no longer feel quite so brave.\n\r", ch);
	      REMOVE_BIT (ch->more, MORE_COURAGE);
	    }
	  if (!IS_NPC (ch) && IS_MORE (ch, MORE_CALM)
	      && number_percent () < 50)
	    {
	      send_to_char ("You no longer feel so apathetic.\n\r", ch);
	      REMOVE_BIT (ch->more, MORE_CALM);
	    }
	  if (!IS_NPC (ch) && IS_MORE (ch, MORE_CONFUSED)
	      && number_percent () < 75)
	    {
	      send_to_char ("You no longer feel confused.\n\r", ch);
	      REMOVE_BIT (ch->more, MORE_CONFUSED);
	    }
	  if (!IS_NPC (ch) && IS_XXX (ch, XXX_CALTROPS)
	      && number_percent () < 75)
	    {
	      send_to_char
		("You may now throw more caltrops if you wish.\n\r", ch);
	      REMOVE_BIT (ch->xxxbits, XXX_CALTROPS);
	    }

	  if (IS_MORE (ch, MORE_ANGER) && number_percent () < 50
	      && ch->pcdata->wolf < 1)
	    {
	      send_to_char ("You no longer feel so angry.\n\r", ch);
	      REMOVE_BIT (ch->more, MORE_ANGER);
	    }
	}
    }
  if (IS_SET (mudconfig->world_affects, WORLD_ECLIPSE))
    {
      strcpy (buf, "The #ysun#n emerges from behind the #0moon#n.\n\r");
      REMOVE_BIT (mudconfig->world_affects, WORLD_ECLIPSE);
      mes_all = TRUE;
    }
  else if (IS_SET (mudconfig->world_affects, WORLD_FOG)
	   && number_range (1, 5) == 1)
    {
      strcpy (buf, "The #0fog#n slowly rolls away.\n\r");
      REMOVE_BIT (mudconfig->world_affects, WORLD_FOG);
      mes_all = TRUE;
    }
  else if (IS_SET (mudconfig->world_affects, WORLD_RAIN)
	   && number_range (1, 5) == 1)
    {
      strcpy (buf,
	      "LRain#n falls from the #Csky#n like perfectly formed #cJewels#n.\n\r");
      REMOVE_BIT (mudconfig->world_affects, WORLD_RAIN);
      mes_all = TRUE;
    }

  if (mes_all)
    {
      for (d = descriptor_list; d != NULL; d = d->next)
	{
	  if (d->connected == CON_PLAYING
	      && (ch = d->character) != NULL
	      && !IS_NPC (ch)
	      && !IS_EXTRA (ch, EXTRA_OSWITCH)
	      && !IS_HEAD (ch, LOST_HEAD)
	      && ch->in_room != NULL
	      && ch->in_room->sector_type != SECT_INSIDE && IS_OUTSIDE (ch))
	    send_to_char (buf, ch);
	}
    }
  buf[0] = '\0';
  switch (++time_info.hour)
    {
    case 4:
      for (d = descriptor_list; d != NULL; d = d->next)
	{
	  if (d->connected == CON_PLAYING
	      && (ch = d->character) != NULL
	      && !IS_NPC (ch)
	      && !IS_EXTRA (ch, EXTRA_OSWITCH)
	      && !IS_HEAD (ch, LOST_HEAD) && IS_VAMPIRE (ch))
	    send_to_char
	      ("You feel #cweary#n as the #0night#n begins to come to an end.\n\r",
	       ch);
	}
      break;

    case 5:
      weather_info.sunlight = SUN_LIGHT;
      strcat (buf,
	      "As a new #yday#n begins, your #Chopes#n and #cdreams#n are once more restored.\n\r");
      break;

    case 6:
      weather_info.sunlight = SUN_RISE;
      strcat (buf,
	      "The #ySuns#n brilliant colors #CSpray#n the Eastern #cSky#n.\n\r");
      break;

    case 19:
      weather_info.sunlight = SUN_SET;
      strcat (buf,
	      "The brilliant colors of the #ySun#n fade #0reluctantly#n in the West.\n\r");
      break;

    case 20:
      weather_info.sunlight = SUN_DARK;
      strcat (buf,
	      "The #Cheavens#n are #lshowered#n with an array of #7stars#n as the #0night#n creeps slowly into view.\n\r");
      break;

    case 24:
      time_info.hour = 0;
      time_info.day++;
      for (d = descriptor_list; d != NULL; d = d->next)
	{
	  char_up = FALSE;
	  if (d->connected == CON_PLAYING
	      && (ch = d->character) != NULL
	      && !IS_NPC (ch)
	      && !IS_EXTRA (ch, EXTRA_OSWITCH) && !IS_HEAD (ch, LOST_HEAD))
	    {
	      if (!IS_SET (ch->corbits, COR_NATURAL)
		  && ch->monkab[SPIRIT] >= 2)
		{
		  stc ("The passing of the day empowers you.\n\r", ch);
		  SET_BIT (ch->corbits, COR_NATURAL);
		}
	      if (IS_SET (ch->corbits, COR_PRAYER))
		{
		  stc
		    ("The extra strength granted you by the Light fades away.\n\r",
		     ch);
		  REMOVE_BIT (ch->corbits, COR_PRAYER);
		}
	      if (IS_SET (ch->nymbits, NYM_SOULBIND))
		{
		  stc
		    ("#0The #RUnholy#0 protection granted you by your #rDiabolic#c Ritual#0 drains away.#n\n\r",
		     ch);
		  REMOVE_BIT (ch->nymbits, NYM_SOULBIND);
		}
	      if (IS_SET (ch->monkstuff, MONK_DEATH))
		{
		  stc
		    ("You feel the magical forces leave your body.\n\r", ch);
		  act ("The magical forces leave $n's body.",
		       ch, NULL, NULL, TO_ROOM);
		  REMOVE_BIT (ch->monkstuff, MONK_DEATH);
		}
	      send_to_char
		("The #0faint#n toll of the #cpassing#n of yet another day #rrings#n true in the #0distance#n.\n\r",
		 ch);
	      if (IS_MORE (ch, MORE_NOPAIN))
		{
		  REMOVE_BIT (ch->more, MORE_NOPAIN);
		  send_to_char
		    ("You no longer feel so oblivious to pain.\n\r", ch);
		}
	      if (IS_VAMPIRE (ch))
		{
		  if (ch->beast > ch->truebeast && ch->beast > 0
		      && ch->beast < 100)
		    {
		      if (number_range (1, 5) == 1)
			{
			  if (--ch->beast == 0)
			    {
			      if (!IS_SET (ch->corbits, COR_GOLCONDA))
				{
				  if (ch->exp > 2000000000)
				    {
				      stc
					("You have to much exp to safely attain Golconda at the moment, train some and try again.\n\r",
					 ch);
				    }
				  else
				    {
				      send_to_char
					("You have attained #oGolconda#n!\n\r",
					 ch);
				      if (!IS_IMMUNE (ch, IMM_SUNLIGHT))
					SET_BIT (ch->immune, IMM_SUNLIGHT);
				      SET_BIT (ch->corbits, COR_GOLCONDA);
				      ch->exp += 100000000;
				      send_to_char
					("You recieve 100000000 experience points]\n\r",
					 ch);
				    }
				}
			    }
			}
		    }
		  if (ch->hit < ch->max_hit)
		    {
		      ch->hit = ch->max_hit;
		      char_up = TRUE;
		    }
		  if (ch->move < ch->max_move)
		    {
		      ch->move = ch->max_move;
		      char_up = TRUE;
		    }
		  ch->loc_hp[0] = 0;
		  ch->loc_hp[1] = 0;
		  ch->loc_hp[2] = 0;
		  ch->loc_hp[3] = 0;
		  ch->loc_hp[4] = 0;
		  ch->loc_hp[5] = 0;
		  ch->loc_hp[6] = 0;
		  if (char_up)
		    send_to_char
		      ("You feel the #cstrength#n of the #rkindred#n flow through your veins!\n\r",
		       ch);
		  update_pos (ch);
		}
	    }
	}
      break;
    }

  if (time_info.day >= 35)
    {
      time_info.day = 0;
      time_info.month++;
    }

  if (time_info.month >= 17)
    {
      time_info.month = 0;
      time_info.year++;
    }

  /*
   * Weather change.
   */
  if (time_info.month >= 9 && time_info.month <= 16)
    diff = weather_info.mmhg > 985 ? -2 : 2;
  else
    diff = weather_info.mmhg > 1015 ? -2 : 2;

  weather_info.change += diff * dice (1, 4) + dice (2, 6) - dice (2, 6);
  weather_info.change = UMAX (weather_info.change, -12);
  weather_info.change = UMIN (weather_info.change, 12);

  weather_info.mmhg += weather_info.change;
  weather_info.mmhg = UMAX (weather_info.mmhg, 960);
  weather_info.mmhg = UMIN (weather_info.mmhg, 1040);

  switch (weather_info.sky)
    {
    default:
      bug ("Weather_update: bad sky %d.", weather_info.sky);
      weather_info.sky = SKY_CLOUDLESS;
      break;

    case SKY_CLOUDLESS:
      if (weather_info.mmhg < 990
	  || (weather_info.mmhg < 1010 && number_bits (2) == 0))
	{
	  strcat (buf, "#CClouds#n begin to roll through the #csky#n.\n\r");
	  weather_info.sky = SKY_CLOUDY;
	}
      break;

    case SKY_CLOUDY:
      if (weather_info.mmhg < 970
	  || (weather_info.mmhg < 990 && number_bits (2) == 0))
	{
	  strcat (buf,
		  "#LRain#n falls from the #cSky#n like perfectly formed #rJewels#n.\n\r");
	  weather_info.sky = SKY_RAINING;
	}

      if (weather_info.mmhg > 1030 && number_bits (2) == 0)
	{
	  strcat (buf,
		  "The #Cclouds#n disappear like #Pcotton candy#n in a child's hands.\n\r");
	  weather_info.sky = SKY_CLOUDLESS;
	}
      break;

    case SKY_RAINING:
      if (IS_SET (mudconfig->world_affects, WORLD_RAIN))
	{
	  if (weather_info.mmhg < 970)
	    weather_info.mmhg += 10;
	  else if (weather_info.mmhg > 1010)
	    weather_info.mmhg -= 10;
	  strcat (buf,
		  "The #Lrain#n pours down heavily from the #csky#n.\n\r");
	  break;
	}
      if (weather_info.mmhg < 970 && number_bits (2) == 0)
	{
	  strcat (buf,
		  "The air around you #rsizzles#n as #ylightning#n dances across the sky.\n\r");
	  weather_info.sky = SKY_LIGHTNING;
	}

      if (weather_info.mmhg > 1030
	  || (weather_info.mmhg > 1010 && number_bits (2) == 0))
	{
	  strcat (buf,
		  "The world around you #Cbreathes#n anew as the #LRain#n fades from existance.\n\r");
	  weather_info.sky = SKY_CLOUDY;
	}
      break;

    case SKY_LIGHTNING:
      if (weather_info.mmhg > 1010
	  || (weather_info.mmhg > 990 && number_bits (2) == 0))
	{
	  strcat (buf,
		  "The #csky#n is calm once again as the dance of #ylightning#n fades.\n\r");
	  weather_info.sky = SKY_RAINING;
	  break;
	}
      break;
    }

  if (buf[0] != '\0')
    {
      for (d = descriptor_list; d != NULL; d = d->next)
	{
	  if (d->connected == CON_PLAYING
	      && IS_OUTSIDE (d->character)
	      && IS_AWAKE (d->character) && !IS_NPC (d->character))
	    send_to_char (buf, d->character);
	}
    }

  return;
}



/*
 * Update all chars, including mobs.
 * This function is performance sensitive.
 */
void
char_update (void)
{
  CHAR_DATA *ch;
  CHAR_DATA *ch_next;
  CHAR_DATA *ch_save;
  CHAR_DATA *ch_quit;
  bool is_obj;
  bool drop_out = FALSE;
  int sn;
  time_t save_time;

  save_time = current_time;
  ch_save = NULL;
  ch_quit = NULL;
  for (ch = char_list; ch != NULL; ch = ch_next)
    {
      AFFECT_DATA *paf;
      AFFECT_DATA *paf_next;

      ch_next = ch->next;
      drop_out = FALSE;

      if (!IS_NPC (ch)
	  && (IS_HEAD (ch, LOST_HEAD) || IS_EXTRA (ch, EXTRA_OSWITCH)))
	is_obj = TRUE;
      else if (!IS_NPC (ch) && ch->pcdata->obj_vnum != 0)
	{
	  is_obj = TRUE;
	  SET_BIT (ch->extra, EXTRA_OSWITCH);
	}
      else
	is_obj = FALSE;
      /*
       * Find dude with oldest save time.
       */
      if (!IS_RNPC (ch)
	  && (ch->desc == NULL || ch->desc->connected == CON_PLAYING)
	  && ch->level >= 2 && ch->save_time < save_time)
	{
	  ch_save = ch;
	  save_time = ch->save_time;
	}

/*	if (!IS_NPC(ch) &&  ch->position > POS_STUNNED && !is_obj)
	{
	    if ( ch->hit  < ch->max_hit )
		ch->hit  += hit_gain(ch);

	    if ( ch->mana < ch->max_mana )
		ch->mana += mana_gain(ch);

	    if ( ch->move < ch->max_move )
		ch->move += move_gain(ch);
	}


	if ( ch->position == POS_STUNNED && !is_obj)
	{
            ch->hit = ch->hit + number_range(2,4);
	    update_pos( ch );
	}
*/
      if (!IS_NPC (ch) && ch->level < LEVEL_IMMORTAL && !is_obj)
	{
	  OBJ_DATA *obj;

	  if (((obj = get_eq_char (ch, WEAR_WIELD)) != NULL
	       && obj->item_type == ITEM_LIGHT
	       && obj->value[2] > 0)
	      || ((obj = get_eq_char (ch, WEAR_HOLD)) != NULL
		  && obj->item_type == ITEM_LIGHT && obj->value[2] > 0))
	    {
	      if (--obj->value[2] == 0 && ch->in_room != NULL)
		{
		  --ch->in_room->light;
		  act ("$p goes out.", ch, obj, NULL, TO_ROOM);
		  act ("$p goes out.", ch, obj, NULL, TO_CHAR);
		  extract_obj (obj);
		}
	    }
	  if (!IS_RNPC (ch))
	    {
	      if (++ch->timer >= 12)
		{
		  if (ch->was_in_room == NULL && ch->in_room != NULL)
		    {
		      ch->was_in_room = ch->in_room;
		      if (ch->fighting != NULL)
			stop_fighting (ch, TRUE);
		      send_to_char ("You disappear into the void.\n\r", ch);
		      act ("$n disappears into the void.",
			   ch, NULL, NULL, TO_ROOM);
		      if (!IS_NPC (ch) && ch->pcdata->chobj != NULL)
			{
			  OBJ_DATA *chobj = ch->pcdata->chobj;
			  if (chobj->in_room != NULL)
			    obj_from_room (chobj);
			  else if (chobj->carried_by != NULL)
			    obj_from_char (chobj);
			  else if (chobj->in_obj != NULL)
			    obj_from_obj (chobj);
			  obj_to_room (chobj,
				       get_room_index (ROOM_VNUM_LIMBO));
			}
		      do_autosave (ch, "");
		      char_from_room (ch);
		      char_to_room (ch, get_room_index (ROOM_VNUM_LIMBO));
		    }
		}
	    }
	  if (ch->timer > 30)
	    ch_quit = ch;

	  gain_condition (ch, COND_DRUNK, -1);
	  if (!IS_VAMPIRE (ch))
	    {
	      gain_condition (ch, COND_FULL, -1);
	      gain_condition (ch, COND_THIRST, -1);
	    }
/*	    else
	    {
		gain_condition( ch, COND_THIRST, blood );

	    }
	}
*/

	  if (IS_SET (ch->mflags, MAGE_EMBRACED2))
	    {
	      send_to_char
		("The earth surrounding you starts to slowly crack.\n\r", ch);
	      SET_BIT (ch->mflags, MAGE_EMBRACED1);
	      REMOVE_BIT (ch->mflags, MAGE_EMBRACED2);
	    }
	  else if (IS_SET (ch->mflags, MAGE_EMBRACED1))
	    {
	      send_to_char ("The earth surrounding you falls away.\n\r", ch);
	      REMOVE_BIT (ch->mflags, MAGE_EMBRACED1);
	    }

	  for (paf = ch->affected; paf != NULL; paf = paf_next)
	    {
	      paf_next = paf->next;
	      if (paf->duration > 0)
		paf->duration--;
	      else if (paf->duration < 0)
		;
	      else
		{
		  if (paf_next == NULL
		      || paf_next->type != paf->type
		      || paf_next->duration > 0)
		    {
		      if (paf->type > 0 && skill_table[paf->type].msg_off
			  && !is_obj)
			{
			  send_to_char (skill_table[paf->type].msg_off, ch);
			  send_to_char ("\n\r", ch);
			}
		    }

		  affect_remove (ch, paf);
		}
	    }

	  /*
	   * Careful with the damages here,
	   *   MUST NOT refer to ch after damage taken,
	   *   as it may be lethal damage (on NPC).
	   */
	  if (ch->loc_hp[6] < 1 && !is_obj && ch->in_room != NULL
	      && !IS_VAMPIRE (ch))
	    {
	      if (ch->blood[0] < 100)
		ch->blood[0]++;
	    }
	  if (ch->loc_hp[6] > 0 && !is_obj && ch->in_room != NULL
	      && !IS_VAMPIRE (ch))
	    {
	      if (IS_BLEEDING (ch, BLEEDING_HEAD))
		{
		  act
		    ("A spray of #rblood#n shoots from the stump of $n's neck.",
		     ch, NULL, NULL, TO_ROOM);
		  send_to_char
		    ("A spray of #rblood#n shoots from the stump of your neck.\n\r",
		     ch);
		  if (!IS_NPC (ch))
		    bloodsquirt (ch);
		  if (ch->blood[BLOOD_CURRENT] > 10)
		    ch->blood[BLOOD_CURRENT] -= 10;
		  else
		    ch->blood[BLOOD_CURRENT] = 0;
		}
	      if (IS_BLEEDING (ch, BLEEDING_THROAT))
		{
		  act ("#rBlood#n pours from the slash in $n's throat.", ch,
		       NULL, NULL, TO_ROOM);
		  send_to_char
		    ("#rBlood#n pours from the slash in your throat.\n\r",
		     ch);
		  if (!IS_NPC (ch))
		    bloodsquirt (ch);
		  if (ch->blood[BLOOD_CURRENT] > 3)
		    ch->blood[BLOOD_CURRENT] -= 3;
		  else
		    ch->blood[BLOOD_CURRENT] = 0;
		}
	      if (IS_BLEEDING (ch, BLEEDING_CHEST))

		act ("#rBlood#n pours from the deep wound in $n's chest.",
		     ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("#rBlood#n pours from the deep wound in your chest.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 5)
		ch->blood[BLOOD_CURRENT] -= 5;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  if (IS_BLEEDING (ch, BLEEDING_STOMACH))
	    {
	      act ("#rBlood#n pours from $n's torn-open stomach.", ch, NULL,
		   NULL, TO_ROOM);
	      send_to_char
		("#rBlood#n pours from your torn-open stomach.\n\r", ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (number_percent () > 50 && !IS_BODY (ch, LOST_ENTRAILS))
		{
		  act ("$n's entrails pour out onto the floor.", ch, NULL,
		       NULL, TO_ROOM);
		  send_to_char
		    ("Your entrails pour out onto the floor.\n\r", ch);
		  SET_BIT (ch->loc_hp[LOC_BODY], LOST_ENTRAILS);
		  make_part (ch, "entrails");
		  if (!is_undying (ch))
		    {
		      act ("$n collapses weakly and dies from $s wounds.",
			   ch, NULL, NULL, TO_ROOM);
		      send_to_char ("You collapse weakly from your wounds.",
				    ch);
		      ch->form = 12;
		      killperson (ch, ch);
		      drop_out = TRUE;
		      continue;
		    }
		}
	      if (ch->blood[BLOOD_CURRENT] > 5)
		ch->blood[BLOOD_CURRENT] -= 5;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  if (IS_BLEEDING (ch, BLEEDING_ARM_L))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's left arm.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your left arm.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 5)
		ch->blood[BLOOD_CURRENT] -= 5;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  else if (IS_BLEEDING (ch, BLEEDING_HAND_L))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's left wrist.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your left wrist.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 2)
		ch->blood[BLOOD_CURRENT] -= 2;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  else if (IS_BLEEDING (ch, BLEEDING_WRIST_L))
	    {
	      act
		("A spray of #rblood#n shoots from $n's slashed left wrist.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from your slashed left wrist.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 2)
		ch->blood[BLOOD_CURRENT] -= 2;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  if (IS_BLEEDING (ch, BLEEDING_ARM_R))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's right arm.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your right arm.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 5)
		ch->blood[BLOOD_CURRENT] -= 5;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  else if (IS_BLEEDING (ch, BLEEDING_HAND_R))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's right wrist.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your right wrist.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 2)
		ch->blood[BLOOD_CURRENT] -= 2;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  else if (IS_BLEEDING (ch, BLEEDING_WRIST_R))
	    {
	      act
		("A spray of #rblood#n shoots from $n's slashed right wrist.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rbloods#n hoots from your slashed right wrist.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 2)
		ch->blood[BLOOD_CURRENT] -= 2;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  if (IS_BLEEDING (ch, BLEEDING_LEG_L))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's left leg.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your left leg.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 5)
		ch->blood[BLOOD_CURRENT] -= 5;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  else if (IS_BLEEDING (ch, BLEEDING_FOOT_L))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's left ankle.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your left ankle.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 2)
		ch->blood[BLOOD_CURRENT] -= 2;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  if (IS_BLEEDING (ch, BLEEDING_LEG_R))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's right leg.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your right leg.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 5)
		ch->blood[BLOOD_CURRENT] -= 5;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  else if (IS_BLEEDING (ch, BLEEDING_FOOT_R))
	    {
	      act
		("A spray of #rblood#n shoots from the stump of $n's right ankle.",
		 ch, NULL, NULL, TO_ROOM);
	      send_to_char
		("A spray of #rblood#n shoots from the stump of your right ankle.\n\r",
		 ch);
	      if (!IS_NPC (ch))
		bloodsquirt (ch);
	      if (ch->blood[BLOOD_CURRENT] > 2)
		ch->blood[BLOOD_CURRENT] -= 2;
	      else
		ch->blood[BLOOD_CURRENT] = 0;
	    }
	  if (ch->blood[BLOOD_CURRENT] == 0 && !is_undying (ch))
	    {
	      act ("$n collapses weakly and dies from #rblood#n loss.", ch,
		   NULL, NULL, TO_ROOM);
	      send_to_char
		("You collapse weakly to the floor from blood loss.", ch);
	      ch->form = 13;
	      killperson (ch, ch);
	      drop_out = TRUE;
	      continue;
	    }
	  else if (ch->blood[BLOOD_CURRENT] <= 20 && !IS_VAMPIRE (ch))
	    {
	      act ("$n sways weakly.", ch, NULL, NULL, TO_ROOM);
	      send_to_char ("You sway weakly from #rblood#n loss.\n\r", ch);
	    }
	  ch->in_room->blood += number_range (1, 10);
	  if (ch->in_room->blood > 1000)
	    ch->in_room->blood = 1000;
	}
      if (IS_NYM (ch, NYM_NEPHFURY) && !is_obj && !drop_out)
	{
	  if (!IS_AFFECTED (ch, AFF_FLAMING) || !IS_MORE (ch, MORE_FLAMES))
	    {
	      SET_BIT (ch->more, MORE_FLAMES);
	      SET_BIT (ch->affected_by, AFF_FLAMING);
	      stc
		("The infernal flames laying dormant within you flares up enveloping your entire body.\n\r",
		 ch);
	      act ("$n is suddenly enveloped in infernal flames.", ch, NULL,
		   NULL, TO_ROOM);
	    }
	}
      if (IS_AFFECTED (ch, AFF_FLAMING) && !is_obj && !drop_out
	  && ch->in_room != NULL && !IS_NYM (ch, NYM_NEPHFURY))
	{
	  int dam = number_range (2000, 4000);

	  if (IS_MORE (ch, MORE_FLAMES))
	    dam *= 2;
	  if (IS_NPC (ch) || !IS_NPC (ch))
	    {
	      bool aggy = FALSE;

	      if (!IS_NPC (ch) && get_disc (ch, DISC_DAIMOINON) > 5
		  && !IS_MORE (ch, MORE_FLAMES))
		{
		  stc
		    ("The flames covering your body flickers and dies out as it can't seem to consume your flesh.\n\r",
		     ch);
		  act ("The flames covering $n's body flickers and dies.",
		       ch, NULL, NULL, TO_ROOM);
		  REMOVE_BIT (ch->affected_by, AFF_FLAMING);
		}
	      else if (!IS_NPC (ch) && IS_EFRETI (ch))
                {
		  stc
		    ("The flames covering your body invigorates you, healing some of your wounds.",
		     ch);
		  act
		    ("The flames covering $n's body seems to make $n stronger healing some of $s wounds.",
		     ch, NULL, NULL, TO_ROOM);
		  ch->hit += dam;
		  if (ch->hit > (ch->max_hit + 10000))
		    ch->hit = ch->max_hit + 10000;
		  update_pos (ch);
		}
	      else
		{
		  act ("$n's flesh burns and crisps.", ch, NULL, NULL,
		       TO_ROOM);
		  send_to_char ("Your flesh burns and crisps.\n\r", ch);

		  if (IS_VAMPIRE (ch) && !IS_IMMUNE (ch, IMM_SUNLIGHT))
		    dam *= 2;

		  ch->hit -= dam;
		  update_pos (ch);
		  if (IS_NPC (ch) && ch->position == POS_DEAD)
		    raw_kill (ch, ch);
		}
	    }
	}

      else if (IS_VAMPIRE (ch) && (!IS_AFFECTED (ch, AFF_SHADOWPLANE)) &&
	       (!IS_NPC (ch) && !IS_IMMUNE (ch, IMM_SUNLIGHT))
	       && ch->in_room != NULL
	       && (!ch->in_room->sector_type == SECT_INSIDE) && !is_obj
	       && (!room_is_dark (ch->in_room))
	       && (weather_info.sunlight != SUN_DARK))
	{
	  act ("$n's flesh smolders in the sunlight!", ch, NULL, NULL,
	       TO_ROOM);
	  send_to_char ("Your flesh smolders in the sunlight!\n\r", ch);
	  if (IS_POLYAFF (ch, POLY_SERPENT))
	    ch->hit = ch->hit - number_range (2, 4);
	  else
	    ch->hit = ch->hit - number_range (5, 10);
	  update_pos (ch);
	  if ((!IS_NPC (ch) && ch->hit < -10) || (IS_NPC (ch) && ch->hit < 0))
	    {
	      ch->form = 15;
	      killperson (ch, ch);
	      drop_out = TRUE;
	      continue;
	    }
	}
      if (IS_AFFECTED (ch, AFF_ROT) && !is_obj && !drop_out)
	{
	  act ("Pieces of rotting flesh fall from $n's body.", ch, NULL,
	       NULL, TO_ROOM);
	  send_to_char ("Pieces of rotting flesh fall from your body.\n\r",
			ch);
	  ch->hit -= number_range (10, 100);
	  update_pos (ch);
	  if (ch == NULL || ch->position == POS_DEAD)
	    continue;
	  else if (get_curr_con (ch) > 0 &&
		   (sn = skill_lookup ("rotting flesh")) >= 0)
	    {
	      AFFECT_DATA af;
	      af.type = sn;
	      af.location = APPLY_CON;
	      af.modifier = -1;
	      af.duration = 0;
	      af.bitvector = AFF_ROT;
	      affect_join (ch, &af);
	    }
	}
      else if (IS_AFFECTED (ch, AFF_POISON) && !is_obj && !drop_out)
	{
	  if (!IS_NPC (ch) && IS_WEREWOLF (ch)
	      && get_tribe (ch, TRIBE_FIANNA) > 1)
	    {
	      stc
		("You feel your blood burn as your body purges itself of the poison, fueling your rage.\n\r",
		 ch);
	      act
		("$n roars with rage and $s body exudes a tremendous amount of heat.",
		 ch, NULL, NULL, TO_ROOM);
	      ch->pcdata->wolf += number_range (15, 35);
	      affect_strip (ch, gsn_poison);
	    }
	  else
	    {
	      act ("$n shivers and suffers.", ch, NULL, NULL, TO_ROOM);
	      send_to_char ("You shiver and suffer.\n\r", ch);
	      ch->hit -= number_range (10, 100);
	      update_pos (ch);
	      if (ch == NULL || ch->position == POS_DEAD)
		continue;
	    }
	}
      else if (!IS_NPC (ch) && ch->paradox[1] > 0)
	{
	  if (ch->paradox[1] > 50)
	    paradox (ch);
	  else if (ch->paradox[2] == 0 && ch->paradox[1] > 0)
	    {
	      ch->paradox[1]--;
	      ch->paradox[2] = PARADOX_TICK;
	    }
	  else
	    ch->paradox[3]--;
	}
      else if (ch->position == POS_INCAP && !is_obj && !drop_out)
	{
	  if (IS_HERO (ch))
	    ch->hit = ch->hit + number_range (2, 4);
	  else
	    ch->hit = ch->hit - number_range (1, 2);
	  update_pos (ch);
	  if (ch->position > POS_INCAP)
	    {
	      act ("$n's wounds stop bleeding and seal up.", ch, NULL, NULL,
		   TO_ROOM);
	      send_to_char ("Your wounds stop bleeding and seal up.\n\r", ch);
	    }
	  if (ch->position > POS_STUNNED)
	    {
	      act ("$n scrambles back to $s feet.", ch, NULL, NULL, TO_ROOM);
	      send_to_char ("You scramble back to your feet.\n\r", ch);
	    }
	}
      else if (ch->position == POS_MORTAL && !is_obj && !drop_out)
	{
	  drop_out = FALSE;
	  if (IS_HERO (ch))
	    ch->hit = ch->hit + number_range (2, 4);
	  else
	    {
	      ch->hit = ch->hit - number_range (1, 2);
	      if ((!IS_NPC (ch) && ch->hit < -10)
		  || (IS_NPC (ch) && ch->hit < 1))
		{
/* kavirp */
		  ch->form = 16;
		  killperson (ch, ch);
		  continue;
		}
	    }
	  if (!drop_out)
	    {
	      update_pos (ch);
	      if (ch->position == POS_INCAP)
		{
		  act
		    ("$n's wounds begin to close, and $s bones pop back into place.",
		     ch, NULL, NULL, TO_ROOM);
		  send_to_char
		    ("Your wounds begin to close, and your bones pop back into place.\n\r",
		     ch);
		}
	    }
	}
      else if (ch->position == POS_DEAD && !is_obj && !drop_out)
	{
/*
	    update_pos(ch);
*/
	  if (!IS_NPC (ch))
	    {
	      ch->form = 16;
	      killperson (ch, ch);
	      continue;
	    }
	}
      drop_out = FALSE;
    }

  /*
   * Autosave and autoquit.
   * Check that these chars still exist.
   */

  if (ch_save != NULL || ch_quit != NULL)
    {
      for (ch = char_list; ch != NULL; ch = ch_next)
	{
	  ch_next = ch->next;
	  if (IS_NPC (ch))
	    continue;
	  if (ch == ch_save)
	    do_autosave (ch, "");
	  if (ch == ch_quit)
	    do_quit (ch, "");
	}
    }

  return;
}



/*
 * Update all objs.
 * This function is performance sensitive.
 */
void
obj_update (void)
{
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;
  OBJ_DATA *cont_obj;
  OBJ_DATA *cont_obj_next;

  for (obj = object_list; obj != NULL; obj = obj_next)
    {
      CHAR_DATA *rch;
      char *message;

      obj_next = obj->next;

      if (obj->item_type != ITEM_PAGE && IS_SET (obj->quest, QUEST_FOLLOWING))
	{
	  if (regenerate_part (obj))
	    continue;
	}

      if (IS_SET(obj->quest, QUEST_ARTIFACT) && (obj->pIndexData->vnum < 29500 || obj->pIndexData->vnum > 29599) && obj->pIndexData->vnum != 3054)
	{
	  REMOVE_BIT (obj->quest, QUEST_ARTIFACT);
	}

      if (obj->item_type != ITEM_PAGE
	  && IS_SET (obj->spectype, SITEM_MESSAGE))
	{
	  if (strlen (obj->chpoweruse) > 1 && strlen (obj->victpoweruse) > 1
	      && number_range (1, 20) == 1)
	    {
	      if (IS_SET (obj->weapflags, WEAPON_GAIAINQ)
		  || IS_SET (obj->weapflags, WEAPON_IKIRYU))
		{
		  if (obj->wear_loc != WEAR_SCABBARD_L
		      && obj->wear_loc != WEAR_SCABBARD_R
		      && obj->wear_loc != WEAR_SCABBARD_BACK
		      && obj->wear_loc != WEAR_STAKE && obj->wear_loc != -1)
		    {
		      if (((rch = obj->carried_by) != NULL) && !IS_NPC (rch)
			  && rch->position > POS_INCAP)
			{
			  if ((number_range (1, 14) == 3
			       && rch->hit < rch->max_hit
			       || rch->mana < rch->max_mana
			       || rch->move < rch->max_move || rch->agg > 0))
			    {
			      act_brief (obj->chpoweruse, obj->carried_by,
					 obj, NULL, TO_CHAR, PLR_BRIEF3);
			      act_brief (obj->victpoweruse, obj->carried_by,
					 obj, NULL, TO_ROOM, PLR_BRIEF4);
			      item_regen (rch, obj, 1);
			      if (IS_SET (obj->weapflags, WEAPON_IKIRYU))
				{
				  if (--obj->specpower < 1)
				    {
				      free_string (obj->chpoweruse);
				      obj->chpoweruse = str_dup ("");
				      free_string (obj->victpoweruse);
				      obj->victpoweruse = str_dup ("");
				      obj->specpower = 0;
				      REMOVE_BIT (obj->spectype,
						  SITEM_MESSAGE);
				      REMOVE_BIT (obj->weapflags,
						  WEAPON_IKIRYU);
				      if ((rch = obj->carried_by) != NULL)
					{
					  act
					    ("All the #rblood#n has dripped off $p.",
					     rch, obj, NULL, TO_CHAR);
					}
				    }
				}

			    }
			}
		    }
		}
	      else if (obj->carried_by != NULL)
		{
		  act_brief (obj->chpoweruse, obj->carried_by, obj, NULL,
			     TO_CHAR, PLR_BRIEF3);
		  act_brief (obj->victpoweruse, obj->carried_by, obj, NULL,
			     TO_ROOM, PLR_BRIEF4);
		}
	      else if (obj->in_room != NULL
		       && (rch = obj->in_room->people) != NULL)
		{
		  act_brief (obj->chpoweruse, rch, obj, NULL, TO_ROOM,
			     PLR_BRIEF4);
		  act_brief (obj->chpoweruse, rch, obj, NULL, TO_CHAR,
			     PLR_BRIEF3);
		}
	      if (IS_SET (obj->quest, QUEST_BLOODAGONY))
		{
		  if (--obj->specpower < 1)
		    {
		      free_string (obj->chpoweruse);
		      obj->chpoweruse = str_dup ("");
		      free_string (obj->victpoweruse);
		      obj->victpoweruse = str_dup ("");
		      obj->specpower = 0;
		      REMOVE_BIT (obj->spectype, SITEM_MESSAGE);
		      REMOVE_BIT (obj->quest, QUEST_BLOODAGONY);
		      if ((rch = obj->carried_by) != NULL)
			{
			  act ("All the #rblood#n has dripped off $p.", rch,
			       obj, NULL, TO_CHAR);
			  if (obj->wear_loc == WEAR_WIELD)
			    REMOVE_BIT (rch->itemaffect, ITEMA_RIGHT_AGG);
			  else if (obj->wear_loc == WEAR_HOLD)
			    REMOVE_BIT (rch->itemaffect, ITEMA_LEFT_AGG);
			}
		    }
		}
	    }
	}

      if (obj->timer <= 0 || --obj->timer > 0)
	continue;

      if (IS_SET (obj->extra_flags, ITEM_VANISH))
	message = "$p slowly fades away to nothing.";
      else if (IS_SET (obj->spectype, SITEM_DEMONIC))
	message = "$p vanishes in a blast of flames.";
      else
	switch (obj->item_type)
	  {
	  default:
	    message = "$p vanishes.";
	    break;
	  case ITEM_FOUNTAIN:
	    message = "$p dries up.";
	    break;
	  case ITEM_CORPSE_NPC:
	    message = "$p decays into dust.";
	    break;
	  case ITEM_CORPSE_PC:
	    message = "$p decays into dust.";
	    break;
	  case ITEM_FOOD:
	    message = "$p decomposes.";
	    break;
	  case ITEM_TRASH:
	    message = "$p crumbles into dust.";
	    break;
	  case ITEM_EGG:
	    message = "$p cracks open.";
	    break;
	  case ITEM_WEAPON:
	    message = "$p crumbles into dust.";
	    break;
	  case ITEM_WALL:
	    message = "$p sinks back into the ground.";
	    break;
	  case ITEM_STAKE:
	    message = "$p crumbles into dust.";
	    break;
	  case ITEM_BOMB:
	    message = "$p blows up!";
	    break;
	  }

      if (obj->carried_by != NULL)
	{
	  act (message, obj->carried_by, obj, NULL, TO_CHAR);
	  if (obj->item_type == ITEM_BOMB)
	    explodebomb (obj->carried_by);
	}
      else if (obj->in_room != NULL
	       && (rch = obj->in_room->people) != NULL && !IS_NPC (rch))
	{
	  act (message, rch, obj, NULL, TO_ROOM);
	  act (message, rch, obj, NULL, TO_CHAR);
	}

      /* If the item is an egg, we need to create a mob and shell!
       * KaVir
       */
      if (obj->item_type == ITEM_EGG)
	{
	  CHAR_DATA *creature;
	  OBJ_DATA *egg;
	  if (get_mob_index (obj->value[0]) != NULL)
	    {
	      if (obj->carried_by != NULL && obj->carried_by->in_room != NULL)
		{
		  creature = create_mobile (get_mob_index (obj->value[0]));
		  char_to_room (creature, obj->carried_by->in_room);
		}
	      else if (obj->in_room != NULL)
		{
		  creature = create_mobile (get_mob_index (obj->value[0]));
		  char_to_room (creature, obj->in_room);
		}
	      else
		{
		  creature = create_mobile (get_mob_index (obj->value[0]));
		  char_to_room (creature, get_room_index (ROOM_VNUM_HELL));
/*
		    obj->timer = 1;
		    continue;
*/
		}
	      egg = create_object (get_obj_index (OBJ_VNUM_EMPTY_EGG), 0);
	      egg->timer = 2;
	      obj_to_room (egg, creature->in_room);
	      act ("$n clambers out of $p.", creature, obj, NULL, TO_ROOM);
	    }
	  else if (obj->in_room != NULL)
	    {
	      egg = create_object (get_obj_index (OBJ_VNUM_EMPTY_EGG), 0);
	      egg->timer = 2;
	      obj_to_room (egg, obj->in_room);
	    }
	}
      if ((obj->item_type == ITEM_CORPSE_NPC
	   || obj->item_type == ITEM_CONTAINER) && obj->in_room != NULL)
	{
	  for (cont_obj = obj->contains; cont_obj; cont_obj = cont_obj_next)
	    {
	      cont_obj_next = cont_obj->next_content;
	      obj_from_obj (cont_obj);
	      obj_to_room (cont_obj, obj->in_room);
	      if (strlen (cont_obj->questowner) < 2
		  && cont_obj->item_type != ITEM_QUEST
		  && cont_obj->item_type != ITEM_EXP && cont_obj->item_type != ITEM_PIECE
		  && cont_obj->item_type != ITEM_CRYSTAL
		  && !IS_SET (cont_obj->quest, QUEST_ARTIFACT))
		{
		  cont_obj->timer = number_range (30, 40);
		  SET_BIT (cont_obj->weapflags, WEAPON_CRUMBLE);
		}
	    }
	}
      extract_obj (obj);
    }

  return;
}



/*
 * Aggress.
 *
 * for each mortal PC
 *     for each mob in room
 *         aggress on some random PC
 *
 * This function takes 25% to 35% of ALL Merc cpu time.
 * Unfortunately, checking on each PC move is too tricky,
 *   because we don't want the mob to just attack the first PC
 *   who leads the party into the room.
 *
 * -- Furey
 */
void
aggr_update (void)
{
  CHAR_DATA *wch;
  CHAR_DATA *wch_next;
  CHAR_DATA *ch;
  CHAR_DATA *ch_next;
  CHAR_DATA *vch;
  CHAR_DATA *vch_next;
  CHAR_DATA *victim = NULL;

  OBJ_DATA *obj = NULL;
  OBJ_DATA *chobj = NULL;
  ROOM_INDEX_DATA *objroom = NULL;
  DESCRIPTOR_DATA *d;

  for (d = descriptor_list; d != NULL; d = d->next)
    {
/*
	if ( d->connected == CON_PLAYING
	&& ( ch = d->character ) != NULL
	&&   !IS_NPC(ch)
	&&   ch->pcdata->stage[1] > 0
	&& ( victim = ch->pcdata->partner ) != NULL
	&&   !IS_NPC(victim)
	&&   ch->in_room != NULL
	&&   victim->in_room != NULL
	&&   victim->in_room != ch->in_room )
	{
	    ch->pcdata->stage[1] = 0;
	    victim->pcdata->stage[1] = 0;
	}
*/
      if (d->connected == CON_PLAYING
	  && (ch = d->character) != NULL
	  && !IS_NPC (ch)
	  && ch->pcdata != NULL && (obj = ch->pcdata->chobj) != NULL)
	{
	  if (obj->in_room != NULL)
	    objroom = obj->in_room;
	  else if (obj->in_obj != NULL)
	    objroom = get_room_index (ROOM_VNUM_IN_OBJECT);
	  else if (obj->carried_by != NULL)
	    {
	      if (obj->carried_by != ch && obj->carried_by->in_room != NULL)
		objroom = obj->carried_by->in_room;
	      else
		continue;
	    }
	  else
	    continue;
	  if (ch->in_room != objroom && objroom != NULL)
	    {
	      char_from_room (ch);
	      char_to_room (ch, objroom);
	      do_look (ch, "auto");
	    }
	}
      else if (d->connected == CON_PLAYING
	       && (ch = d->character) != NULL
	       && !IS_NPC (ch)
	       && ch->pcdata != NULL
	       && (IS_HEAD (ch, LOST_HEAD) || IS_EXTRA (ch, EXTRA_OSWITCH)
		   || ch->pcdata->obj_vnum != 0))
	{
	  if (ch->pcdata->obj_vnum != 0)
	    {
	      bind_char (ch);
	      continue;
	    }
	  if (IS_HEAD (ch, LOST_HEAD))
	    {
	      REMOVE_BIT (ch->loc_hp[0], LOST_HEAD);
	      send_to_char ("Your soul is freed as a ghost.\n\r", ch);
	      ch->hit = 1;
	      if (ch->level < 3)
		ch->level = 3;
	      SET_BIT (ch->nymbits, NYM_DEAD);
	    }
	  else
	    {
	      send_to_char ("Your regain your body.\n\r", ch);
	      REMOVE_BIT (ch->extra, EXTRA_OSWITCH);
	    }
	  REMOVE_BIT (ch->affected_by, AFF_POLYMORPH);
	  free_string (ch->morph);
	  ch->morph = str_dup ("");
	  if ((chobj = ch->pcdata->chobj) != NULL)
	    chobj->chobj = NULL;
	  ch->pcdata->chobj = NULL;
	}
      continue;
    }

  for (wch = char_list; wch != NULL; wch = wch_next)
    {
      wch_next = wch->next;
      if (IS_RNPC (wch)
	  || (wch->desc != NULL && wch->desc->connected != CON_PLAYING)
	  || wch->position <= POS_STUNNED
	  || wch->level >= LEVEL_IMMORTAL
	  || wch->pcdata == NULL
	  || ((chobj = wch->pcdata->chobj) != NULL) || wch->in_room == NULL)
	continue;
      /*         if (IS_RNPC (ch))
         {
         char buf[MSL];
         sprintf (buf, "rnpc check, bypassed2...");
         do_say (ch, buf);
         } */
      if (!IS_NPC (wch) && (IS_WEREWOLF (wch) ||
			    IS_ITEMAFF (wch, ITEMA_STALKER)))
	{
	  if (wch->hunting != NULL && wch->hunting != '\0' &&
	      strlen (wch->hunting->name) > 1
	      && get_auspice (wch, AUSPICE_RAGABASH) > 2)
	    {
	      ROOM_INDEX_DATA *old_room = wch->in_room;
	      check_hunt (wch);
	      if (wch->in_room == old_room)
		{
//                free_string (wch->hunting);
		  wch->hunting = NULL;
		  continue;
		}
	      check_hunt (wch);
	      if (wch->in_room == old_room)
		{
//                free_string (wch->hunting);
		  wch->hunting = NULL;
		}
	      continue;
	    }
	}

      for (ch = wch->in_room->people; ch != NULL; ch = ch_next)
	{
	  int count;

	  ch_next = ch->next_in_room;

	  if (!IS_NPC (ch)
	      || !IS_SET (ch->act, ACT_AGGRESSIVE)
	      || no_attack (ch, wch)
	      || ch->fighting != NULL
	      || IS_AFFECTED (ch, AFF_CHARM)
	      || !IS_AWAKE (ch)
	      || (IS_SET (ch->act, ACT_WIMPY) && IS_AWAKE (wch))
	      || !can_see (ch, wch))
	    continue;

	  /*
	   * Ok we have a 'wch' player character and a 'ch' npc aggressor.
	   * Now make the aggressor fight a RANDOM pc victim in the room,
	   *   giving each 'vch' an equal chance of selection.
	   */
	  count = 0;
	  victim = NULL;
	  for (vch = wch->in_room->people; vch != NULL; vch = vch_next)
	    {
	      vch_next = vch->next_in_room;

	      if (!IS_NPC (vch)
		  && (vch->desc == NULL || IS_PLAYING (vch->desc)
		      || IS_RNPC (vch)) && !no_attack (ch, vch)
		  && vch->pcdata != NULL
		  && ((chobj = vch->pcdata->chobj) == NULL)
		  && vch->level < LEVEL_IMMORTAL
		  && vch->position > POS_STUNNED
		  && (!IS_SET (ch->act, ACT_WIMPY) || !IS_AWAKE (vch))
		  && can_see (ch, vch))
		{
		  if (number_range (0, count) == 0)
		    victim = vch;
		  count++;
		}
	    }

	  if (victim == NULL)
	    {
/*
		bug( "Aggr_update: null victim attempt by mob %d.", ch->pIndexData->vnum );
*/
	      continue;
	    }

	  multi_hit (ch, victim, TYPE_UNDEFINED);
	}
    }

  return;
}



/*
 * Handle all kinds of updates.
 * Called once per pulse from game loop.
 * Random times to defeat tick-timing clients and players.
 */
void
update_handler (void)
{
  static int pulse_gain_exp;
  static int pulse_area;
  static int pulse_mobile;
  static int pulse_violence;
  static int pulse_point;
  static int pulse_minute;
  static int pulse_second;
  static int pulse_empire;
  static int pulse_save;
  static int pulse_misc;
//    DESCRIPTOR_DATA *dnew, *dnew_next;
  //  dnew->outsize       = 2000;
  //dnew->outbuf        = alloc_mem( dnew->outsize );


/*    for (dnew = descriptor_list; dnew ; dnew = dnew_next)
    {
	dnew_next = dnew->next;
	{
    		free_mem( dnew->outbuf, dnew->outsize );
	}
    }*/
  if (--pulse_minute <= 0)
    {
      pulse_minute = PULSE_MINUTE;
      update_triviatime ();
    }

  if (--pulse_gain_exp <= 0)
    {
      char buf[MSL];
      DESCRIPTOR_DATA *d, *d_next;
      CHAR_DATA *ch = NULL;
      CHAR_DATA *ch_next = NULL;
      int sn;
      extern int bootcount;

      pulse_gain_exp = PULSE_GAIN_EXP;

      if (mudconfig->armtimer > 0)
	mudconfig->armtimer--;
      if (mudconfig->helltimer > 0)
	mudconfig->helltimer--;

//      if (mudconfig->world_affects != 0)
//      mudconfig->world_affects = 0; for when somthing goes wrong and i need to clear this thing. Corim

      if (mudconfig->maxemp > 0)
	mudconfig->maxemp = 0;

      if (mudconfig->hellstorm > 0)
	{
	  mudconfig->hellstorm--;
	  if (mudconfig->hellstorm <= 0)
	    {
	      gamemes
		("#0The #cStorm#0 of #rBelial#0 finally settles, the powers of #RHell#0 fading from the realm.#n");
	      REMOVE_BIT (mudconfig->world_affects, WORLD_HELLSTORM);
	      mudconfig->helltimer = 21600;
	    }
	}

      if (mudconfig->doubletimer > 0
	  && !IS_SET (mudconfig->world_affects, WORLD_AUTOCOPY))
	{
	  if (mudconfig->doubletimer > 10800)
	    mudconfig->doubletimer = 10800;

	  mudconfig->doubletimer--;
	  if (mudconfig->doubletimer <= 0)
	    {
	      mudconfig->cdtimer = 12;
	      mudconfig->doubletimer = 10800;
	    }
	}

      if (mudconfig->dexptimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_DOUBLEXP))
	{
	  mudconfig->dexptimer--;
	  if (mudconfig->dexptimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_DOUBLEXP);
	      mudconfig->dexptimer = 0;
	      bonusmes ("#7The System has turned off Double Exp.#n");
	    }
	}
      if (mudconfig->ddctimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_DOUBLEDAMCAP))
	{
	  mudconfig->ddctimer--;
	  if (mudconfig->ddctimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_DOUBLEDAMCAP);
	      mudconfig->ddctimer = 0;
	      bonusmes ("#7The System has turned off Double Damcap.#n");
	    }
	}
      if (mudconfig->dtrtimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_DOUBLETRAIN))
	{
	  mudconfig->dtrtimer--;
	  if (mudconfig->dtrtimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_DOUBLETRAIN);
	      mudconfig->dtrtimer = 0;
	      bonusmes ("#7The System has turned off Double Train.#n");
	    }
	}
      if (mudconfig->dcrtimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_DOUBLECREDITS))
	{
	  mudconfig->dcrtimer--;
	  if (mudconfig->dcrtimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_DOUBLECREDITS);
	      mudconfig->dcrtimer = 0;
	      bonusmes ("#7The System has turned off Double Credits.#n");
	    }
	}
      if (mudconfig->hexptimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_HALFEXP))
	{
	  mudconfig->hexptimer--;
	  if (mudconfig->hexptimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_HALFEXP);
	      mudconfig->hexptimer = 0;
	      bonusmes ("#7The System has turned off Half Exp.#n");
	    }
	}
      if (mudconfig->hdctimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_HALFDAMCAP))
	{
	  mudconfig->hdctimer--;
	  if (mudconfig->hdctimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_HALFDAMCAP);
	      mudconfig->hdctimer = 0;
	      bonusmes ("#7The System has turned off Half Damcap.#n");
	    }
	}
      if (mudconfig->htrtimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_HALFTRAIN))
	{
	  mudconfig->htrtimer--;
	  if (mudconfig->htrtimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_HALFTRAIN);
	      mudconfig->htrtimer = 0;
	      bonusmes ("#7The System has turned off Half Train.#n");
	    }
	}
      if (mudconfig->hcrtimer > 0
	  && IS_SET (mudconfig->world_affects, WORLD_HALFCREDITS))
	{
	  mudconfig->hcrtimer--;
	  if (mudconfig->hcrtimer < 1)
	    {
	      REMOVE_BIT (mudconfig->world_affects, WORLD_HALFCREDITS);
	      mudconfig->hcrtimer = 0;
	      bonusmes ("#7The System has turned off Half Credits.#n");
	    }
	}

      if (mudconfig->cdtimer > 0)
	{
	  mudconfig->cdtimer--;
	  if (mudconfig->cdtimer == 11)
	    {
	      sysmes ("#7Automatic Copyover in #y10#7 seconds.#n");
	    }
	  else if (mudconfig->cdtimer == 6)
	    sysmes ("#7Copyover in #y5#7 seconds, brace for impact.#n");
	  else if (mudconfig->cdtimer == 5)
	    sysmes ("#7Copyover in #y4#7 seconds.#n");
	  else if (mudconfig->cdtimer == 4)
	    sysmes ("#7Copyover in #y3#7 seconds.#n");
	  else if (mudconfig->cdtimer == 3)
	    sysmes ("#7Copyover in #y2#7 seconds.#n");
	  else if (mudconfig->cdtimer == 2)
	    sysmes ("#7Copyover in #y1#7 second.#n");
	  else if (mudconfig->cdtimer == 1)
	    sysmes ("#7Initiating Copyover");
	  else if (mudconfig->cdtimer <= 0)
	    {
	      for (d = descriptor_list; d != NULL; d = d->next)
		{
		  d_next = d->next;

		  if ((ch = d->character) != NULL)
		    {

		      if (!IS_NPC (ch))
			{
			  //copymove(ch);
			  if (ch->stance[0] != -1)
			    ch->stance[0] = -1;
			  stop_fighting (ch, TRUE);
			  restoring (ch);
			  do_stand (ch, "");
			  call_all (ch);
			  do_save (ch, "");
			}
		    }
		}
	      copyover ();
	    }

	}
      if (bootcount > 0)
	{
	  bootcount--;
	  switch (bootcount)
	    {
	    default:
	      strcpy (buf, " ");
	      break;
	    case 600:
	      strcpy (buf, "Reboot in ten minutes");
	      break;
	    case 300:
	      strcpy (buf, "Reboot in five minutes");
	      break;
	    case 120:
	      strcpy (buf, "Reboot in two minutes");
	      break;
	    case 60:
	      strcpy (buf, "Reboot in one minute");
	      break;
	    case 30:
	      strcpy (buf, "Reboot in thirty seconds");
	      break;
	    case 10:
	      strcpy (buf, "Reboot in ten seconds");
	      break;
	    case 0:
	      strcpy (buf, "Reboot NOW");
	      break;
	    }
	  if (strlen (buf) > 2)
	    sysmes (buf);
	  if (bootcount < 1)
	    {
	      extern bool merc_down;
	      for (ch = char_list; ch != NULL; ch = ch_next)
		{
		  ch_next = ch->next;
		  if (!IS_NPC (ch))
		    do_autosave (ch, "");
		}
	      sprintf (log_buf, "Timed reboot.");
	      log_string (log_buf);
	      merc_down = TRUE;
	      return;
	    }
	}
      for (d = descriptor_list; d != NULL; d = d->next)
	{
	  if (d->connected == CON_PLAYING
	      && (ch = d->character) != NULL && !IS_NPC (ch))
	    {
	      ch->exp += ch->beast ? 1 : 10;
	      if (ch->position == POS_FIGHTING && ch->move > 0
		  && !IS_HERO (ch))
		ch->move--;
	      if (ch->pcdata->bpoints > 0)
		{
		  ch->pcdata->bpoints--;
		  if (ch->pcdata->bpoints < 1)
		    send_to_char
		      ("You are once more able to use Blood Agony.\n\r", ch);
		}

	      if (ch->pcdata->dpoints > 0)
		{
		  ch->pcdata->dpoints--;
		  if (ch->pcdata->dpoints < 1)
		    {
		      if (IS_GHOUL (ch))
			{
			  bool lost_disc = FALSE;
			  mortal_vamp (ch);
			  for (sn = 0; sn <= DISC_MAX; sn++)
			    {
			      if (ch->pcdata->powers[sn] > 0)
				lost_disc = TRUE;
			      ch->pcdata->powers[sn] = 0;
			    }
			  if (lost_disc)
			    send_to_char
			      ("You have lost your blood powers.\n\r", ch);
			}
		      else
			send_to_char
			  ("You are once more able to sire a childe.\n\r",
			   ch);
		    }
		}
	      if (ch->agitated < 1 && ch->position == POS_AGITATED)
		{
		  ch->position = POS_STANDING;
		  ch->agitated = 0;
		}
	      else if (ch->agitated > 0 && ch->position > POS_RESTING)
		{
		  if (ch->agitated > 1)
		    npc_retal (ch);

		  ch->agitated--;
		  if (ch->agitated < 1)
		    {
		      stc ("You feel calm and less agitated.\n\r", ch);
		      ch->position = POS_STANDING;
		    }
		}

	      if (!IS_NPC (ch))
		{
		  if (IS_DRAGON (ch) && !IS_SET (ch->evenmore, EM_DRAGONFIX))
		    {
		      ch->pcdata->dpowers[BREATH_WEAPON] = 0;
		      ch->pcdata->dpowers[BREATH] = 0;
		      SET_BIT (ch->evenmore, EM_DRAGONFIX);
		      stc
			("#y#bYour breaths have been cleared please remeber to set them again.#n\n\r",
			 ch);
		    }
		  if (IS_ELF (ch) && IS_XX (ch, XX_ELFLISTEN))
		    {
		      if (--ch->serpent < 1)
			{
			  surlisten (ch, "");
			}
		    }


		  if (IS_DRAGON (ch) && ch->serpent > 0
		      && IS_NYM (ch, NYM_SERPENT))
		    {
		      if (--ch->serpent < 1)
			{
			  serpscan (ch, "");
			}
		    }
		  if (IS_NINJA (ch) && ch->pcdata->npowers[HARA_KIRI] > 0
		      && number_range (1, 4) == 2)
		    {
		      ch->pcdata->npowers[HARA_KIRI]--;
		      if (ch->pcdata->npowers[HARA_KIRI] < 1)
			{
			  stc ("You lose the power of the harakiri.\n\r", ch);
			}
		    }


		  if (IS_NINJA (ch))
		    {
		      if (ch->pcdata->npowers[NPATH_LIGHT] > 0
			  && ch->pcdata->npowers[NPATH_LIGHT] >
			  ch->pcdata->npowers[NPATH_DARK])
			{
			  if (IS_XBITS (ch, X_DARKPATH))
			    {
			      REMOVE_BIT (ch->xbits, X_DARKPATH);
			      ch->pcdata->npowers[NPATH_DARK] = 0;
			    }
			  if (!IS_XBITS (ch, X_LIGHTPATH))
			    SET_BIT (ch->xbits, X_LIGHTPATH);
			}
		      else if (ch->pcdata->npowers[NPATH_DARK] > 0
			       && ch->pcdata->npowers[NPATH_LIGHT] <
			       ch->pcdata->npowers[NPATH_DARK])
			{
			  if (IS_XBITS (ch, X_LIGHTPATH))
			    {
			      REMOVE_BIT (ch->xbits, X_LIGHTPATH);
			      ch->pcdata->npowers[NPATH_LIGHT] = 0;
			    }
			  if (!IS_XBITS (ch, X_DARKPATH))
			    SET_BIT (ch->xbits, X_DARKPATH);
			}
		    }
		  if (IS_XBITS (ch, X_YANG_MIGHT))
		    {
		      if (IS_NINJA (ch) && ch->alignment != -1000)
			do_yangmight (ch, "");
		      else if (!IS_NINJA (ch))
			REMOVE_BIT (ch->xbits, X_YANG_MIGHT);
		    }
		  if (IS_XBITS (ch, X_DEATH_SHIELD))
		    {
		      if (IS_NINJA (ch) && ch->alignment != -1000)
			do_yheal (ch, "");
		      else if (!IS_NINJA (ch))
			REMOVE_BIT (ch->xbits, X_DEATH_SHIELD);
		    }
		  if (IS_XBITS (ch, X_YANG_AURA))
		    {
		      if (IS_NINJA (ch) && ch->alignment != -1000)
			do_yang_aura (ch, "");
		      else if (!IS_NINJA (ch))
			REMOVE_BIT (ch->xbits, X_YANG_AURA);
		    }
		  if (IS_XBITS (ch, X_YING_AURA))
		    {
		      if (IS_NINJA (ch) && ch->alignment != 1000)
			do_ying_aura (ch, "");
		      else if (!IS_NINJA (ch))
			REMOVE_BIT (ch->xbits, X_YING_AURA);
		    }
		  if (IS_XBITS (ch, X_YING_SPEED))
		    {
		      if (IS_NINJA (ch) && ch->alignment != 1000)
			do_yingspeed (ch, "");
		      else if (!IS_NINJA (ch))
			REMOVE_BIT (ch->xbits, X_YING_SPEED);
		    }
		  if (IS_XBITS (ch, X_FAE_FORCEWALL))
		    {
		      if (IS_NINJA (ch) && ch->alignment != 1000)
			do_ying_force (ch, "");
		      else if (!IS_NINJA (ch))
			REMOVE_BIT (ch->xbits, X_FAE_FORCEWALL);
		    }
		}

	      if (!IS_NPC (ch) && IS_NINJA (ch))
		{
		  if (ch->position == POS_MEDITATING)
		    {
		      if (ch->pcdata->npowers[NINJAKI] < 250)
			{
			  ch->pcdata->npowers[NINJAKI] +=
			    number_range (50, 100);
			}
		    }
		  if (ch->position != POS_FIGHTING
		      && number_range (1, 3) == 2 && ch->fight_timer < 1)
		    {
		      if (ch->pcdata->npowers[NINJAKI] < 250)
			{
			  ch->pcdata->npowers[NINJAKI] +=
			    number_range (5, 20);
			}
		    }

		  if (ch->pcdata->npowers[NINJAKI] > 250)
		    ch->pcdata->npowers[NINJAKI] = 250;
		}
	      if (!IS_NPC (ch))
		{
		  if (ch->pcdata->silence > 0)
		    {
		      ch->pcdata->silence--;
		      if (ch->pcdata->silence < 1)
			{
			  if (IS_MORE (ch, MORE_SILENCE))
			    {
			      act ("The room is no longer silent.", ch,
				   NULL, NULL, TO_CHAR);
			      act ("The room is no longer silent.", ch,
				   NULL, NULL, TO_ROOM);
			      REMOVE_BIT (ch->in_room->added_flags,
					  ROOM2_SILENCE);
			      REMOVE_BIT (ch->more, MORE_SILENCE);
			      ch->pcdata->silence = 60;
			    }
			  else
			    send_to_char
			      ("Your ability to call the Silence of Death has returned.\n\r",
			       ch);
			}
		    }
		  if (ch->pcdata->necromancy > 0)
		    {
		      ch->pcdata->necromancy--;
		      if (ch->pcdata->necromancy < 1)
			send_to_char
			  ("Your powers of Necromancy have replenished themselves.\n\r",
			   ch);
		    }
		  if (ch->pcdata->rpoints > 0)
		    {
		      ch->pcdata->rpoints--;
		      if (ch->pcdata->rpoints < 1)
			send_to_char
			  ("You have regained sufficient strength to use another ritual.\n\r",
			   ch);
		    }
		  if (ch->pcdata->wpoints > 0)
		    {
		      ch->pcdata->wpoints--;
		      if (ch->pcdata->wpoints < 1)
			send_to_char
			  ("Your powers of weather control have replenished themselves.\n\r",
			   ch);
		    }
		  if (ch->pcdata->spirit > 0)
		    {
		      ch->pcdata->spirit--;
		      if (ch->pcdata->spirit < 1)
			send_to_char
			  ("Your powers over the spirits have replenished themselves.\n\r",
			   ch);
		    }
		  if (ch->pcdata->conjure > 0)
		    {
		      ch->pcdata->conjure--;
		      if (ch->pcdata->conjure < 1)
			send_to_char
			  ("Your powers of conjuration have replenished themselves.\n\r",
			   ch);
		    }
		  if (ch->pcdata->wisdoms[ELF_MIGHT] > 0)
		    {
		      ch->pcdata->wisdoms[ELF_MIGHT]--;
		      if (ch->pcdata->wisdoms[ELF_MIGHT] < 1)
			send_to_char
			  ("The strength of the Bull leaves you.\n\r", ch);
		    }
		  if (ch->pcdata->wisdoms[ELF_HASTE] > 0)
		    {
		      ch->pcdata->wisdoms[ELF_HASTE]--;
		      if (ch->pcdata->wisdoms[ELF_HASTE] < 1)
			{
			  send_to_char
			    ("Your movements loses its supernatural Quickness.\n\r",
			     ch);
			  act
			    ("$n is no longer moving with a supernatural quickness.",
			     ch, NULL, NULL, TO_ROOM);
			}
		    }
		  if (ch->pcdata->celerity > 0)
		    {
		      ch->pcdata->celerity--;
		      if (ch->pcdata->celerity < 1)
			{
			  if (IS_WILLPOWER (ch, RES_CELERITY)
			      && ch->position == POS_FIGHTING)
			    {
			      if (ch->blood[BLOOD_CURRENT] < 10)
				{
				  send_to_char
				    ("Not enough #rblood#n to renew Celerity.\n\r",
				     ch);
				  send_to_char
				    ("Your movements slow down.\n\r", ch);
				  act
				    ("$n is no longer moving with supernatural speed.",
				     ch, NULL, NULL, TO_ROOM);
				}
			      else
				{
				  ch->blood[BLOOD_CURRENT] -= 10;
				  ch->pcdata->celerity += 60;
				  send_to_char
				    ("You burn #rblood#n to continue using your Celerity.\n\r",
				     ch);
				}
			    }
			  else
			    {
			      send_to_char ("Your movements slow down.\n\r",
					    ch);
			      act
				("$n is no longer moving with supernatural speed.",
				 ch, NULL, NULL, TO_ROOM);
			    }
			}
		    }
		  if (IS_SET (ch->act, PLR_WATCHER))
		    REMOVE_BIT (ch->act, PLR_WATCHER);
		  if (ch->saintly > 0)
		    {
		      ch->saintly--;
		      if (ch->saintly < 0)
			{
			  stc ("Your Saintly Might leaves you.\n\r", ch);
			  ch->saintly = 0;
			}
		    }

		  if (!IS_NPC (ch) && IS_NINJA (ch)
		      && IS_XBITS (ch, X_YANG_MIGHT))
		    {
		      ch->mana -= number_range (50, 100);

		      if (ch->mana < 200)
			do_yangmight (ch, "");

		      if (ch->mana < 0)
			ch->mana = 0;

		    }
		  if (!IS_NPC (ch) && IS_HIGHLANDER (ch)
		      && IS_COR (ch, COR_FOCUS))
		    {
		      ch->move -=
			number_range (100, 150) * ch->pcdata->kensaifocus;

		      if (ch->move < 2000)
			{
			  stc ("You are unable to maintain your focus.\n\r",
			       ch);
			  act ("$n looks drained and tierd.", ch, NULL, NULL,
			       TO_ROOM);
			  do_focus (ch, "");
			}
		      if (ch->move < 0)
			ch->move = 0;
		    }
		  if (!IS_NPC (ch) && IS_BETRAYER (ch)
		      && IS_XX (ch, XX_FSTAND))
		    {
		      ch->move -= 100;

		      if (ch->move < 100)
			{
			  stc ("You are unable to maintain your Final stand",
			       ch);
			  act ("$n leaves the final stand.", ch, NULL, NULL,
			       TO_ROOM);
			  if (IS_XX (ch, XX_FSTAND))
			    {
			      stc
				("You are no longer making your final stand.\n\r",
				 ch);
			      act
				("$n looks less scary as $e is no longer making $s final stand.",
				 ch, NULL, NULL, TO_ROOM);
			      ch->max_hit -= 10000;
			      ch->max_move -= 10000;
			      ch->max_mana -= 10000;
			      REMOVE_BIT (ch->xxbits, XX_FSTAND);
			      return;
			    }

			}

		      if (ch->move < 0)
			ch->move = 0;
		    }

		  if (!IS_NPC (ch) && IS_HIGHLANDER (ch)
		      && IS_XXX (ch, XXX_BARRIER))
		    {
		      ch->mana -= number_range (500, 1000);

		      if (ch->mana < 2000)
			{
			  stc
			    ("You are unable to maintain your Mystic Barrier and it fades away.\n\r",
			     ch);
			  act ("The faint barrier around $n fades away.", ch,
			       NULL, NULL, TO_ROOM);
			  REMOVE_BIT (ch->xxxbits, XXX_BARRIER);
			}

		      if (ch->mana < 0)
			ch->mana = 0;

		    }

		  if (!IS_NPC (ch) && IS_NINJA (ch)
		      && IS_XBITS (ch, X_YING_SPEED))
		    {
		      ch->mana -= number_range (50, 100);

		      if (ch->mana < 200)
			do_yingspeed (ch, "");

		      if (ch->mana < 0)
			ch->mana = 0;

		    }

		  if (!IS_NPC (ch) && IS_NINJA (ch)
		      && IS_XBITS (ch, X_FAE_FORCEWALL))
		    {
		      ch->mana -= number_range (50, 150);

		      if (ch->mana < 200)
			do_ying_force (ch, "");

		      if (ch->mana < 0)
			ch->mana = 0;
		    }

		  if (!IS_NPC (ch) && IS_NINJA (ch)
		      && IS_XBITS (ch, X_NINJA_HIDE)
		      && number_range (1, 4) > 3)
		    {
		      int min = ch->max_move / 20;
		      int max = ch->max_move / 10;

		      min *= 2;
		      max *= 4;

		      if (min > 2000)
			min = 2000;

		      if (max > 4000)
			max = 4000;

		      ch->move -= number_range (min, max);

		      if (ch->move < (max + min))
			{
			  stc
			    ("You are unable to stay hidden any more and appears from the shadows.\n\r",
			     ch);
			  act ("$n appears from the shadows.", ch, NULL,
			       NULL, TO_ROOM);
			  REMOVE_BIT (ch->xbits, X_NINJA_HIDE);
			}
		    }

		  if (!IS_NPC (ch))
		    {
		      if (IS_DRAC_SCOUT (ch) && IS_DRACWEAP (ch, DRAC_INVIS)
			  && number_range (1, 4) > 3)
			{
			  int min = ch->max_move / 20;
			  int max = ch->max_move / 10;

			  min *= 2;
			  max *= 4;

			  if (min > 2000)
			    min = 2000;

			  if (max > 4000)
			    max = 4000;

			  ch->move -= number_range (min, max);

			  if (ch->move < (max + min))
			    {
			      stc
				("You are unable to stay cloaked any more and discard your cloaking shadows.\n\r",
				 ch);
			      act ("$n removes $s cloaking shadows.", ch,
				   NULL, NULL, TO_ROOM);
			      REMOVE_BIT (ch->pcdata->
					  cpowers[DRAC_WEAPONRY], DRAC_INVIS);
			    }
			}
		    }

		  if (!IS_NPC (ch) && IS_NINJA (ch)
		      && IS_XBITS (ch, X_DEATH_SHIELD)
		      && ch->position != POS_FIGHTING
		      && number_range (1, 5) == 1)
		    {
		      int food = ch->spl[YELLOW_MAGIC] * number_range (5, 8);

		      if (number_percent () < 31)
			{
			  ch->hit -= food;
			  ch->mana -= food;
			  if (ch->mana < 0)
			    ch->mana = 0;
			  ch->move -= food;
			  if (ch->move < 0)
			    ch->move = 0;
			  update_pos (ch);
			  act
			    ("The hunger of your #0shield spirits#n overcomes them, and they lash out at you.",
			     ch, NULL, NULL, TO_CHAR);
			  act
			    ("Suddenly $n #0shield spirits#n lashes out at $m, feeding on $s life force.",
			     ch, NULL, NULL, TO_ROOM);
			  if (ch->hit < 0)
			    do_yheal (ch, "");
			}
		      else
			{
			  act
			    ("A low hissing can be heard from your #0shield spirits#n '#yFeeeeed Usssss!#n'",
			     ch, NULL, NULL, TO_CHAR);
			  act
			    ("A low hissing can be heard from $n #0shield spirits#n '#yFeeeeed Usssss!#n'.",
			     ch, NULL, NULL, TO_ROOM);
			}
		    }
		  if (!IS_NPC (ch) && IS_NINJA (ch))
		    {
		      if (ch->pcdata->npowers[NPATH_LIGHT] > 3
			  && ch->alignment == 1000)
			{
			  if (ch->position == POS_FIGHTING
			      && ch->pcdata->npowers[NINJA_RAGE] < 500
			      && !IS_ITEMAFF (ch, ITEMA_RAGER))
			    {
			      ch->pcdata->npowers[NINJA_RAGE] += 1;
			    }
			}
		      else
			{
			  if (ch->position == POS_FIGHTING
			      && ch->pcdata->npowers[NINJA_RAGE] < 250
			      && !IS_ITEMAFF (ch, ITEMA_RAGER))
			    {
			      ch->pcdata->npowers[NINJA_RAGE] += 1;
			    }
			}
		      if (ch->position == POS_MEDITATING
			  && ch->pcdata->npowers[NINJA_RAGE] > 0
			  && ch->pcdata->npowers[NINJA_RAGE] < 500
			  && number_range (1, 6) == 3)
			{
			  ch->pcdata->npowers[NINJA_RAGE] -= 20;
			  if (ch->pcdata->npowers[NINJA_RAGE] < 1)
			    {
			      stc ("Your Michi fades away.\n\r", ch);
			    }
			}
		      else if (ch->position != POS_FIGHTING
			       && ch->pcdata->npowers[NINJA_RAGE] > 0
			       && number_range (1, 8) == 2)
			{
			  ch->pcdata->npowers[NINJA_RAGE] -= 20;
			  if (ch->pcdata->npowers[NINJA_RAGE] < 1)
			    {
			      stc ("Your Michi fades away.\n\r", ch);
			    }
			}

		    }
		  if (!IS_NPC (ch) && IS_VAMPIRE (ch))
		    {
		      if (ch->position == POS_FIGHTING
			  && ch->pcdata->vamprage > 0
			  && ch->pcdata->vamprage < ch->beast
			  && !IS_ITEMAFF (ch, ITEMA_RAGER))
			ch->pcdata->vamprage++;
		      else if (ch->pcdata->vamprage > 0
			       && !IS_ITEMAFF (ch, ITEMA_RAGER))
			{
			  if (number_percent () <= ch->beast)
			    beast_rage (ch);
			  else
			    ch->pcdata->vamprage--;
			  if (ch->pcdata->vamprage < 1)
			    send_to_char
			      ("You feel the beast release it's hold 

Showing the first 100 KB of 140.0 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571