Пример #1
0
void trap_teleport(struct char_data *v) {
  int to_room;
  extern int top_of_world;      /* ref to the top element of world */

  if (saves_spell(v, SAVING_SPELL)) {
    send_to_char("You feel strange, but the effect fades.\n\r", v);
    return;
  }

  do {
    to_room = number(0, top_of_world);
  } while (IS_SET(real_roomp(to_room)->room_flags, PRIVATE));

  act("$n slowly fade out of existence.", FALSE, v, 0, 0, TO_ROOM);
  char_from_room(v);
  char_to_room(v, to_room);
  act("$n slowly fade in to existence.", FALSE, v, 0, 0, TO_ROOM);

  look_room(v);

  if (IS_SET(real_roomp(to_room)->room_flags, DEATH) &&
      get_max_level(v) < LOW_IMMORTAL) {
    nail_this_sucker(v);
  }
}
Пример #2
0
void MakeNoise(int room, char *local_snd, char *distant_snd)
{
  int door;
  struct char_data *ch;
  struct room_data *rp, *orp;
  
  rp = real_roomp(room);
  
  if (rp) {
    for (ch = rp->people; ch; ch = ch->next_in_room) {
      if (!IS_NPC(ch) && (!IS_AFFECTED(ch, AFF_SILENCE))) {
         send_to_char(local_snd, ch);
      }
    }
    for (door = 0; door <= 5; door++) {
      if (rp->dir_option[door] &&
	  (orp = real_roomp(rp->dir_option[door]->to_room)) ) {
	for (ch = orp->people; ch; ch = ch->next_in_room) {
	  if (!IS_NPC(ch) && (!IS_SET(ch->specials.act, PLR_DEAF)) &&
	      (!IS_AFFECTED(ch, AFF_SILENCE))) {
   	     send_to_char(distant_snd, ch);
	  }
	}
      }
    }
  }
}
Пример #3
0
/* place a character in a room */
void char_to_room(struct char_data *ch, int room)
{
  struct room_data *rp;
  extern int pulse;
  
  rp = real_roomp(room);
  if (!rp) {
    room = 0;
    rp = real_roomp(room);
    if (!rp)
      assert(0);
  }
  ch->next_in_room = rp->people;
  rp->people = ch;
  ch->in_room = room;
  
  if (ch->equipment[WEAR_LIGHT])
    if (ch->equipment[WEAR_LIGHT]->obj_flags.type_flag == ITEM_LIGHT) 
      if (rp->sector_type != SECT_UNDERWATER) {
	if (ch->equipment[WEAR_LIGHT]->obj_flags.value[2])  /* Light is ON */
	  rp->light++;
	if (rp->light < 1)
	  rp->light = 1;
      } else {
	if (ch->equipment[WEAR_LIGHT]->obj_flags.value[2] > 0) {
	  send_to_char("Your light source is extinguished instantyl!\n\r", ch);
	  ch->equipment[WEAR_LIGHT]->obj_flags.value[2] = 0;
	} else {
	  rp->light++;
	  if (rp->light < 1)
	    rp->light = 1;
	}
      }

  if (IS_PC(ch)) {
    if (rp->tele_cnt > 0 && rp->tele_time == 0) {
      /* this is a teleport countdown room */
      rp->tele_time = pulse + rp->tele_cnt; /* now round up */
      if (rp->tele_time % 10) 
	rp->tele_time += 10 - (rp->tele_time % 10);
      
      if (rp->tele_time > 2400) {
	rp->tele_time = rp->tele_cnt;  /* start of next day */
      }
    }

    if (zone_table[rp->zone].start == 0) {
      /*
	start up the zone.
	*/      
      reset_zone(rp->zone);
    }
    
    SunProblemCheck(ch);
    
  }
}
Пример #4
0
void cast_cause_critic(byte level, struct char_data *ch, char *arg, int type,
  struct char_data *victim, struct obj_data *tar_obj )
{
	switch (type) {
    case SPELL_TYPE_SPELL:
         spell_cause_critical(level, ch, victim, 0);
         break;
    case SPELL_TYPE_SCROLL:
	 if (!victim)
	   victim = ch;
	 spell_cause_critical(level,ch,victim,0);
	 break;
    case SPELL_TYPE_WAND:
       	 if (!victim) victim = ch;
	 spell_cause_critical(level,ch,victim,0);
	 break;
    case SPELL_TYPE_POTION:
       	 if (!victim) victim = ch;
         spell_cause_critical(level, ch, victim, 0);
         break;
    case SPELL_TYPE_STAFF:
         for (victim = real_roomp(ch->in_room)->people ;
              victim ; victim = victim->next_in_room )
            if (!in_group(ch,victim))
               spell_cause_critical(level, ch, victim, 0);
         break;
    default : 
         log_msg("Serious screw-up in cause critical!");
         break;

  }
}
Пример #5
0
void UpdateRoomMenu(struct char_data *ch)
{
 char buf[255];
 struct room_data *rp;
 
 rp = real_roomp(ch->in_room);
 
 send_to_char(VT_HOMECLR, ch);
 sprintf(buf, VT_CURSPOS, 1, 1);
 send_to_char(buf, ch);
 sprintf(buf, "Room Name: %s", rp->name);
 send_to_char(buf, ch);
 sprintf(buf, VT_CURSPOS, 1, 40);
 send_to_char(buf, ch);
 sprintf(buf, "Number: %d", rp->number);
 send_to_char(buf, ch);
 sprintf(buf, VT_CURSPOS, 1, 60);
 send_to_char(buf, ch);
 sprintf(buf, "Sector Type: %s", sector_types[rp->sector_type]);
 send_to_char(buf, ch);
 sprintf(buf, VT_CURSPOS, 3, 1);
 send_to_char(buf, ch);
 send_to_char("Menu:\n\r", ch);
 send_to_char(edit_menu, ch);
 send_to_char("--> ", ch);
}
Пример #6
0
int trigger_trap(struct char_data *ch, struct obj_data *i) {
  int adj, fireperc, roll;
  struct char_data *v;

  extern struct dex_app_type dex_app[];

  if (ITEM_TYPE(i) == ITEM_TRAP) {
    if (i->obj_flags.value[TRAP_CHARGES]) {
      adj = GET_TRAP_LEV(i) - get_max_level(ch);
      adj -= dex_app[(int)GET_DEX(ch)].reaction * 5;
      fireperc = 95 + adj;
      roll = number(1, 100);
      if (roll < fireperc) {    /* trap is sprung */
        act("You hear a strange noise...", TRUE, ch, 0, 0, TO_ROOM);
        act("You hear a strange noise...", TRUE, ch, 0, 0, TO_CHAR);
        GET_TRAP_CHARGES(i) -= 1;
        if (IS_SET(GET_TRAP_EFF(i), TRAP_EFF_ROOM)) {
          for (v = real_roomp(ch->in_room)->people; v; v = v->next_in_room) {
            find_trap_damage(v, i);
          }
        }
        else {
          find_trap_damage(ch, i);
        }
        return (TRUE);
      }
    }
  }
  return (FALSE);
}
Пример #7
0
void do_redit(struct char_data *ch, char *arg, int cmd)
{
#ifndef TEST_SERVER
 struct room_data *rp;

  rp = real_roomp(ch->in_room);
#endif

 if(IS_NPC(ch))
    return;
 
  if ((IS_NPC(ch)) || (GetMaxLevel(ch)<LOW_IMMORTAL))
    return;
 
  if (!ch->desc) /* someone is forced to do something. can be bad! */
    return;      /* the ch->desc->str field will cause problems... */
 
#ifndef TEST_SERVER
  if((GetMaxLevel(ch) < 56) && (rp->zone != GET_ZONE(ch))) {
     send_to_char("Sorry, you are not authorized to edit this zone.\n\r", ch);
     return;
  }
#endif
 
 ch->specials.edit = MAIN_MENU;
 ch->desc->connected = CON_EDITING;
 
 act("$n has begun editing.", FALSE, ch, 0, 0, TO_ROOM);
 
 UpdateRoomMenu(ch);
}
Пример #8
0
struct char_data *FindAHatee( struct char_data *ch) 
{
  struct char_data *tmp_ch;

  if (ch->in_room < 0)
    return(0);

  for( tmp_ch=real_roomp(ch->in_room)->people; tmp_ch; 
       tmp_ch = tmp_ch->next_in_room) 
  {
    if (Hates(ch, tmp_ch) && (CAN_SEE(ch, tmp_ch))) 
    {
      if (ch->in_room == tmp_ch->in_room) 
      {
        if (ch != tmp_ch) 
        {
          return(tmp_ch);
        }
        else 
        {
          RemHated(ch,tmp_ch);
          return(0);
        }
      }
    }
  }
  return(0);
}
Пример #9
0
struct obj_data *get_obj_vis_accessible(struct char_data *ch, char *name)
{
  struct obj_data *i;
  int j, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp;
  
  strcpy(tmpname,name);
  tmp = tmpname;
  if(!(number = get_number(&tmp)))
    return(0);
  
  /* scan items carried */
  for (i = ch->carrying, j=1; i && j<=number; i = i->next_content)
    if (isname(tmp, i->name) && CAN_SEE_OBJ(ch, i))
      if (j == number)
	return(i);
      else
	j++;
  for (i = real_roomp(ch->in_room)->contents; i && j<=number; i = i->next_content)
    if (isname(tmp, i->name) && CAN_SEE_OBJ(ch, i))
      if (j==number)
	return(i);
      else
	j++;
  return 0;
}
Пример #10
0
/* remove an object from an object */
void obj_from_obj(struct obj_data *obj)
{
  struct obj_data *tmp, *obj_from;
  char buf[100];

  if (obj->carried_by) {
    sprintf(buf, "%s carried by %s in obj_from_obj\n", obj->name,
	    obj->carried_by->player.name);
    logE(buf);
  }
  if (obj->equipped_by) {
    sprintf(buf, "%s equipped by %s in obj_from_obj\n", obj->name,
	    obj->equipped_by->player.name);
    logE(buf);
  }
  if (obj->in_room != NOWHERE) {
    sprintf(buf, "%s in room %d in obj_from_obj\n", obj->name,
	    obj->in_room);
    logE(buf);
  }

  assert(!obj->carried_by && !obj->equipped_by && obj->in_room == NOWHERE);
  
  if (obj->in_obj) {
    obj_from = obj->in_obj;
    if (obj == obj_from->contains)   /* head of list */
      obj_from->contains = obj->next_content;
    else {
      for (tmp = obj_from->contains; 
	   tmp && (tmp->next_content != obj);
	   tmp = tmp->next_content); /* locate previous */
      
      if (!tmp) {
	perror("Fatal error in object structures.");
	assert(0);
      }
      
      tmp->next_content = obj->next_content;
    }
        
    /* Subtract weight from containers container */
    for(tmp = obj->in_obj; tmp->in_obj; tmp = tmp->in_obj)
      GET_OBJ_WEIGHT(tmp) -= GET_OBJ_WEIGHT(obj);
    
    GET_OBJ_WEIGHT(tmp) -= GET_OBJ_WEIGHT(obj);
    
    /* Subtract weight from char that carries the object */
    if (tmp->carried_by)
      IS_CARRYING_W(tmp->carried_by) -= GET_OBJ_WEIGHT(obj);
    
    obj->in_obj = 0;
    obj->next_content = 0;
  } else {
    perror("Trying to object from object when in no object.");
    assert(0);
  }
  if(obj_from->in_room != NOWHERE)
      if(IS_SET(real_roomp(obj_from->in_room)->room_flags, SAVE_ROOM))
         save_room(obj_from->in_room);  
}
Пример #11
0
void cast_energy_drain( byte level, struct char_data *ch, char *arg, int type,
  struct char_data *victim, struct obj_data *tar_obj )
{
  switch (type) {
    case SPELL_TYPE_SPELL:
			spell_energy_drain(level, ch, victim, 0);
			break;
    case SPELL_TYPE_POTION:
         spell_energy_drain(level, ch, ch, 0);
         break;
    case SPELL_TYPE_SCROLL:
         if(victim)
       		spell_energy_drain(level, ch, victim, 0);
         else if(!tar_obj)
            spell_energy_drain(level, ch, ch, 0);
         break;
    case SPELL_TYPE_WAND:
         if(victim)
       	       	spell_energy_drain(level, ch, victim, 0);
         break;
    case SPELL_TYPE_STAFF:
         for (victim = real_roomp(ch->in_room)->people ;
              victim ; victim = victim->next_in_room )
            if (!in_group(ch,victim))
               if (victim != ch)
                  spell_energy_drain(level, ch, victim, 0);
         break;
    default : 
         log_msg("Serious screw-up in energy drain!");
         break;
	}
}
Пример #12
0
void cast_cause_serious( byte level, struct char_data *ch, const char *arg, int type,
                         struct char_data *victim, struct obj_data *tar_obj )
{
  switch (type) 
  {
  case SPELL_TYPE_SPELL:
    spell_cause_serious(level, ch, victim, 0);
    break;
  case SPELL_TYPE_POTION:
    spell_cause_serious(level, ch, ch, 0);
    break;
  case SPELL_TYPE_WAND:
    if (tar_obj) return;
      if (!victim) victim = ch;
        spell_cause_serious(level, ch, victim, 0);
    break;
  case SPELL_TYPE_STAFF:
    for( victim = real_roomp(ch->in_room)->people ;
         victim ; victim = victim->next_in_room )
      if (!in_group(ch,victim))
        spell_cause_serious(level, ch, victim, 0);
    break;
  default : 
    mudlog( LOG_SYSERR, "Serious screw-up in cause serious wounds!");
    break;
  }
}
Пример #13
0
void TrapDamage(struct char_data *v, int damtype, int amnt, struct obj_data *t)
{
  struct char_data *tmp_ch;
  char buf[132];

  if(DEBUG) dlog("TrapDamage");
  amnt = SkipImmortals(v, amnt);
  if (amnt == -1) 
    return;

  if (IS_AFFECTED(v, AFF_SANCTUARY))
    amnt = MAX((int)(amnt/2), 0);  /* Max 1/2 damage when sanct'd */
        
   amnt = PreProcDam(v, damtype, amnt);

   if (saves_spell(v, SAVING_PETRI))
     amnt = MAX((int)(amnt/2),0);

   DamageStuff(v, damtype, amnt);
   amnt=MAX(amnt,0);
   GET_HIT(v)-=amnt;
   update_pos(v);
   TrapDam(v, damtype, amnt, t);
   InformMess(v);
   if (GET_POS(v) == POSITION_DEAD) 
   {
     if (!IS_NPC(v)) 
     {
       if (real_roomp(v->in_room)->name)
         sprintf(buf, "%s killed by a trap at %s",
	   GET_NAME(v),real_roomp(v->in_room)->name);
       log(buf);
			/* remove the hatreds of this character */
     }

     for (tmp_ch=character_list; tmp_ch; tmp_ch=tmp_ch->next) 
     {
       if (Hates(tmp_ch, v)) 
       {
         RemHated(tmp_ch, v);
       }
     }
     die(v);
  }
} 
Пример #14
0
void obj_to_room2(struct obj_data *object, int room)
{
  
  if (room == -1)
    room = 4;

  assert(!object->equipped_by && object->eq_pos == -1);

  if (object->in_room > NOWHERE) {
    obj_from_room(object);
  }

  object->next_content = real_roomp(room)->contents;
  real_roomp(room)->contents = object;
  object->in_room = room;
  object->carried_by = 0;
  object->equipped_by = 0; /* should be unnecessary */
}
Пример #15
0
/* move a player out of a room */
void char_from_room(struct char_data *ch)
{
  char buf[MAX_INPUT_LENGTH];
  struct char_data *i;
  struct room_data *rp;
  
  if (ch->in_room == NOWHERE) {
    logE("NOWHERE extracting char from room (handler.c, char_from_room)");
    return;
  }
  
  if (ch->equipment[WEAR_LIGHT])
    if (ch->equipment[WEAR_LIGHT]->obj_flags.type_flag == ITEM_LIGHT)
      if (ch->equipment[WEAR_LIGHT]->obj_flags.value[2]) /* Light is ON */
	real_roomp(ch->in_room)->light--;
  
  rp = real_roomp(ch->in_room);
  if (rp==NULL) {
    sprintf(buf, "ERROR: char_from_room: %s was not in a valid room (%d)",
	    (!IS_NPC(ch) ? (ch)->player.name : (ch)->player.short_descr),
	    ch->in_room);
    logE(buf);
    return;
  }
  
  if (ch == rp->people)  /* head of list */
    rp->people = ch->next_in_room;
  
  else {   /* locate the previous element */
    for (i = rp->people; i && i->next_in_room != ch; i = i->next_in_room)
      ;
    if (i)
      i->next_in_room = ch->next_in_room;
    else {
      sprintf(buf, "SHIT, %s was not in people list of his room %d!",
	      (!IS_NPC(ch) ? (ch)->player.name : (ch)->player.short_descr),
	      ch->in_room);
      logE(buf);
    }
  }
  
  ch->in_room = NOWHERE;
  ch->next_in_room = 0;
}
Пример #16
0
int named_mobile_in_room(int room, struct hunting_data *c_data)
{
  struct char_data	*scan;
  for (scan = real_roomp(room)->people; scan; scan = scan->next_in_room)
    if (isname(c_data->name, scan->player.name)) {
      *(c_data->victim) = scan;
      return 1;
    }
  return 0;
}
Пример #17
0
int check_for_move_trap(struct char_data *ch, int dir) {
  struct obj_data *i;

  for (i = real_roomp(ch->in_room)->contents; i; i = i->next_content) {
    if ((ITEM_TYPE(i) == ITEM_TRAP) &&
        (IS_SET(GET_TRAP_EFF(i), TRAP_EFF_MOVE)) && (GET_TRAP_CHARGES(i) > 0))
      if (IS_SET(GET_TRAP_EFF(i), TrapDir[dir]))
        return (trigger_trap(ch, i));
  }
  return (FALSE);
}
Пример #18
0
int KyussSon( struct char_data *pChar, int nCmd, const char *szArg, 
              struct char_data *pMob, int nType )
{
  struct char_data *pTar;
  struct room_data *pRoom;

  if( pMob == NULL )
  {
    mudlog( LOG_SYSERR, "pMob == NULL in KyussSon( carceri.c )" );
    return FALSE;
  }

  if( nType == EVENT_TICK )
  {
    UpdateList( (CharElem **)&pMob->act_ptr );
    
    if( ( pRoom = real_roomp( pMob->in_room ) ) != NULL )
    {
      struct char_data *pNext;
      for( pTar = pRoom->people; pTar; pTar = pNext )
      {
        pNext = pTar->next_in_room;
        if( CAN_SEE( pTar, pMob ) && 
            !IsInList( (CharElem *)pMob->act_ptr, pTar ) && 
            ( ( IS_PC( pTar ) && 
                !IS_SET( pTar->specials.act, PLR_NOHASSLE ) ) ||
              ( IS_NPC( pTar ) && 
                ( ( pTar->specials.zone != pMob->specials.zone &&
                    !strchr( zone_table[ pTar->specials.zone ].races, 
                             GET_RACE( pTar ) ) ) ||
                  IS_SET( pTar->specials.act, ACT_ANNOYING ) ) ) ) )
        {
          if( !saves_spell( pTar, SAVING_PARA ) )
          {
            act( "Quando vedi $N, sei preso da un incontrollabile panico!",
                 TRUE, pTar, 0, pMob, TO_CHAR );
            do_flee( pTar, "", 0 );
          }
          else
          {
            InsertInList( (CharElem **)&pMob->act_ptr, pTar, 
                          ( SECS_PER_MUD_HOUR * 48 ) / PULSE_MOBILE );
          }
        }
      }
    }
    else
      mudlog( LOG_SYSERR, "pMob in invalid room in KyussSon( carceri.c )" );
  }
  else if( nType == EVENT_DEATH )
    FreeList( (CharElem **)&pMob->act_ptr );
  return FALSE;
}
Пример #19
0
void sun_problem_check(struct char_data *ch) {
  if (SUNPROBLEM(ch)) {
    if ((time_info.hours > 5 && time_info.hours < 18) &&
        (OUTSIDE(ch) && !IS_SET(real_roomp(ch->in_room)->room_flags, DARK))) {
      if (!IS_AFFECTED2(ch, AFF2_SUN_BLIND)) {
        sun_blind(ch);
      }
    }
    else if (IS_AFFECTED2(ch, AFF2_SUN_BLIND)) {
      remove_sun_blind(ch);
    }
  }
}
Пример #20
0
void Teleport( int pulse )
{
   struct char_data *ch;
   struct obj_data *obj_object, *temp_obj;
   int or;

   if(DEBUG) dlog("Teleport");
   if (pulse < 0) 
      return;

   if(MOUNTED(ch))
   {
     FallOffMount(ch,MOUNTED(ch));
     Dismount(ch,MOUNTED(ch),POSITION_SITTING);
   }
   else
   if(RIDDEN(ch))
   {
     FallOffMount(RIDDEN(ch),ch);
     Dismount(RIDDEN(ch),ch,POSITION_SITTING);
   }

   for (ch = character_list; ch; ch = ch->next) 
   {
     if (ch->in_room != NOWHERE) 
     {
	if (real_roomp(ch->in_room)->tele_targ > 0) 
	{
           if (real_roomp(ch->in_room)->tele_time > 0) 
	   {
              if ((pulse % real_roomp(ch->in_room)->tele_time)==0) 
	      {
		 obj_object = real_roomp(ch->in_room)->contents;
		 while (obj_object) 
		 {
		   temp_obj = obj_object->next_content;
                   obj_from_room(obj_object);
   	           obj_to_room(obj_object, real_roomp(ch->in_room)->tele_targ);
		   obj_object = temp_obj;
		 }

		 or = ch->in_room;
		 char_from_room(ch); 
		 char_to_room(ch, real_roomp(or)->tele_targ);
       	         if (real_roomp(or)->tele_look) 
		 {
                   do_look(ch, "\0",15);
		 }
	       }
	    }
	 }
      }
   }
}
Пример #21
0
int CheckForMoveTrap(struct char_data *ch, int dir)
{
  struct obj_data *i;
if(DEBUG) dlog("CheckForMoveTrap");
  for (i = real_roomp(ch->in_room)->contents; i; i = i->next_content) 
  {
    if ((ITEM_TYPE(i) == ITEM_TRAP) && 
	(IS_SET(GET_TRAP_EFF(i),TRAP_EFF_MOVE)) &&
	(GET_TRAP_CHARGES(i) > 0))
        if (IS_SET(GET_TRAP_EFF(i), TrapDir[dir])) 
	   return(TriggerTrap(ch, i));
  }
  return(FALSE);
}
Пример #22
0
/*search the entire world for an object, and return a pointer  */
struct obj_data *get_obj_vis(struct char_data *ch, char *name)
{
  struct obj_data *i;
  
  /* scan items carried */
  if (i = get_obj_in_list_vis(ch, name, ch->carrying))
    return(i);
  
  /* scan room */
  if (i = get_obj_in_list_vis(ch, name, real_roomp(ch->in_room)->contents))
    return(i);
  
  return get_obj_vis_world(ch, name, NULL);
}
Пример #23
0
void TrapTeleport(struct char_data *v) 
{
	int to_room;
	extern int top_of_world;      /* ref to the top element of world */
        struct room_data *room;

if(DEBUG) dlog("TrapTeleport");
    if (saves_spell(v,SAVING_SPELL)) 
    {
       send_to_char("You feel strange, but the effect fades.\n\r",v);
       return;
     } 

     do {
		to_room = number(0, top_of_world);
		room = real_roomp(to_room);
		if(room)
		{
		  if(IS_SET(room->room_flags,PRIVATE))
		    room = 0;
                }
     } while(!room);

     act("$n slowly fade out of existence.", FALSE, v,0,0,TO_ROOM);
     char_from_room(v);
     char_to_room(v, to_room);
     act("$n slowly fade in to existence.", FALSE, v,0,0,TO_ROOM);

     do_look(v, "", 0);

     if (IS_SET(real_roomp(to_room)->room_flags,DEATH) && GetMaxLevel(v) < LOW_IMMORTAL) 
     {
       death_cry(v);
       zero_rent(v);
       extract_char(v);
     }
}
Пример #24
0
/* Take an object from a room */
void obj_from_room(struct obj_data *object)
{
  struct obj_data *i;
  
  /* remove object from room */

  if (object->in_room <= NOWHERE) {
    if (object->carried_by || object->equipped_by) {
       logE("Eek.. an object was just taken from a char, instead of a room");
       assert(0);
    }
    return;  /* its not in a room */
  }
  
  if (object == real_roomp(object->in_room)->contents)  /* head of list */
    real_roomp(object->in_room)->contents = object->next_content;
  
  else     /* locate previous element in list */
    {
      for (i = real_roomp(object->in_room)->contents; i && 
	   (i->next_content != object); i = i->next_content);
      
      if (i) {
         i->next_content = object->next_content;
      } else {
	logE("Couldn't find object in room");
	assert(0);
      }
    }

  if(IS_SET(real_roomp(object->in_room)->room_flags, SAVE_ROOM))
    save_room(object->in_room);  

  object->in_room = NOWHERE;
  object->next_content = 0;
}
Пример #25
0
void trap_damage(struct char_data *v, int damtype, int amnt,
                 struct obj_data *t) {
  amnt = skip_immortals(v, amnt);
  if (amnt == -1) {
    return;
  }

  if (IS_AFFECTED(v, AFF_SANCTUARY))
    amnt = MAX((int)(amnt / 2), 0);     /* Max 1/2 damage when sanct'd */

  amnt = pre_proc_dam(v, damtype, amnt);

  if (saves_spell(v, SAVING_PETRI))
    amnt = MAX((int)(amnt / 2), 0);

  damage_stuff(v, damtype, amnt);

  amnt = MAX(amnt, 0);

  GET_HIT(v) -= amnt;

  update_pos(v);

  trap_dam(v, damtype, amnt, t);

  inform_mess(v);
  if (GET_POS(v) == POSITION_DEAD) {
    if (!IS_NPC(v)) {
      if (real_roomp(v->in_room)->name)
        log_msgf("%s killed by a trap at %s",
                 GET_NAME(v), real_roomp(v->in_room)->name);
    }

    die(v);
  }
}
Пример #26
0
void cast_call_lightning( byte level, struct char_data *ch, const char *arg, int type,
                          struct char_data *victim, struct obj_data *tar_obj )
{
  extern struct weather_data weather_info;

  switch (type) 
  {
  case SPELL_TYPE_SPELL:
    if( OUTSIDE( ch ) && weather_info.sky >= SKY_RAINING )
    {
      spell_call_lightning(level, ch, victim, 0);
    } 
    else 
    {
      send_to_char( "You fail to call upon the lightning from the sky!\n\r", 
                    ch);
    }
    break;
  case SPELL_TYPE_POTION:
    if (OUTSIDE(ch) && (weather_info.sky>=SKY_RAINING)) 
    {
      spell_call_lightning(level, ch, ch, 0);
    }
    break;
  case SPELL_TYPE_SCROLL:
    if (OUTSIDE(ch) && (weather_info.sky>=SKY_RAINING)) 
    {
      if(victim) 
        spell_call_lightning(level, ch, victim, 0);
      else if(!tar_obj) 
        spell_call_lightning(level, ch, ch, 0);
    }
    break;
  case SPELL_TYPE_STAFF:
    if (OUTSIDE(ch) && (weather_info.sky>=SKY_RAINING)) 
    {
      for( victim = real_roomp(ch->in_room)->people ;
           victim ; victim = victim->next_in_room )
        if (!in_group(victim,ch))
          spell_call_lightning(level, ch, victim, 0);
    }
    break;
  default : 
    mudlog( LOG_SYSERR, "Serious screw-up in call lightning!");
    break;
  }
}
Пример #27
0
/* assign special procedures to rooms */
void assign_rooms()
{
  static struct special_proc_entry specials[] = {

    {   99,  Donation},
    { 500,   druid_challenge_prep_room},
    { 501,   druid_challenge_room},
    { 550,   monk_challenge_prep_room},
    { 551,   monk_challenge_room},
    { 3030,  dump },
    { 13547, dump },
    { 3054,  pray_for_items },

    { 2188,  Magic_Fountain},
    { 2189,  Magic_Fountain},

    { 13518, Fountain},
    { 11014, Fountain},
    { 5234,  Fountain},
    { 3141,  Fountain},
    { 13406,  Fountain},
    { 22642,  Fountain},
    { 22644,  Fountain},
    { 22646,  Fountain},
    { 22648,  Fountain},
    { 13530, pet_shops },

    { 2500, entering_turbo_lift },
    { 2639, turbo_lift },

    { 2000,  bank },
    { 13521, bank },
    { -1, NULL},
  };
  int i;
  struct room_data *rp;
  char buf[80];
  
  for (i=0; specials[i].vnum>=0; i++) {
    rp = real_roomp(specials[i].vnum);
    if (rp==NULL) {
      sprintf(buf,"assign_rooms: room %d unknown",specials[i].vnum);
      logE(buf);
    } else
      rp->funct = specials[i].proc;
  }
}
Пример #28
0
/*****************************************************************************
  Chiunque veda il Verme della Morte, viene addormentato dal suo sguardo
  ipnotico, a meno con non azzecchi un tiro salvezza contro paralisi.
*****************************************************************************/
int VermeDellaMorte( struct char_data *pChar, int nCmd, const char *szArg, 
                     struct char_data *pMob, int nType )
{
  if( nType == EVENT_TICK && AWAKE( pMob ) )
  {
    struct room_data *pRoom;
    
    if( ( pRoom = real_roomp( pMob->in_room ) ) != NULL )
    {
      struct char_data *pNext, *pTar;
      for( pTar = pRoom->people; pTar; pTar = pNext )
      {
        pNext = pTar->next_in_room;
        if( CAN_SEE( pTar, pMob ) && 
            ( ( IS_PC( pTar ) && 
                !IS_SET( pTar->specials.act, PLR_NOHASSLE ) ) ||
              ( IS_NPC( pTar ) && 
                ( ( pTar->specials.zone != pMob->specials.zone &&
                    !strchr( zone_table[ pTar->specials.zone ].races, 
                             GET_RACE( pTar ) ) ) ||
                  IS_SET( pTar->specials.act, ACT_ANNOYING ) ) ) ) && 
            GET_POS( pTar ) > POSITION_SLEEPING &&
            !IsImmune( pTar, IMM_SLEEP ) )
        {
          if( IsSusc( pTar, IMM_SLEEP ) || 
              ( !saves_spell( pTar, SAVING_PARA ) && 
                ( !IsResist( pTar, IMM_SLEEP ) || 
                  !saves_spell( pTar, SAVING_PARA ) ) ) )
          {
            act( "$N ti guarda fisso. La tua vista si sdoppia.", FALSE,
                 pTar, 0, pMob, TO_CHAR );
            act( "$n cade a terra addormentat$b.", TRUE, pTar, 0, 0, 
                 TO_ROOM );
            if( pTar->specials.fighting )
              stop_fighting( pTar );
            GET_POS( pTar ) = POSITION_SLEEPING;
          }
        }
      }
    }
    else
      mudlog( LOG_SYSERR, 
              "pMob in invalid room in VermeDellaMorte( carceri.c )" );
  }
  return FALSE;
}
Пример #29
0
static void event_rats_invade_zone(struct char_data *ch, char *arg)
{
    struct event_mob_set                    mobset[11] = {
/* vnum, hp: xdy+z, exp: xdy+z, gold: xdy+z, object %, obj vnum */
	{4618, 6, 8, 8, 1, 6, 4, 2, 6, 0, 2, 4602},	       /* special large rat */
	{4618, 4, 6, 5, 1, 6, 4, 1, 6, 0, 0, -1},	       /* large rat */
	{4618, 4, 6, 3, 1, 6, 4, 1, 4, 0, 0, -1},	       /* large rat */
	{3432, 3, 6, 1, 1, 6, 4, 1, 2, -1, 0, -1},	       /* disgusting rat */
	{3432, 2, 6, 1, 1, 6, 4, 0, 0, 0, 0, -1},	       /* disgusting rat */
	{3432, 2, 6, 1, 1, 6, 4, 0, 0, 0, 0, -1},	       /* disgusting rat */
	{3432, 2, 6, 1, 1, 6, 4, 0, 0, 0, 0, -1},	       /* disgusting rat */
	{3433, 4, 6, 1, 1, 6, 4, 1, 4, -1, 0, -1},	       /* giant rat */
	{3433, 4, 6, 1, 1, 6, 4, 1, 4, -1, 0, -1},	       /* giant rat */
	{3433, 4, 6, 5, 1, 6, 4, 1, 4, -1, 0, -1},	       /* giant rat */
	{5056, 3, 8, 5, 2, 6, 10, 1, 2, -1, 0, -1}	       /* black cat */
    };
    struct event_mob_in_zone                mobs = { 0, 0, 60, 1, 8, 11, mobset };
    int                                     zone = 0;
    struct room_data                       *rp = NULL;

    if (DEBUG > 1)
	log_info("called %s with %s, %s", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(arg));

    if ((rp = real_roomp(ch->in_room)))
	zone = rp->zone;
    else
	return;

    mobs.bottom = zone ? (zone_table[zone - 1].top + 1) : 0;
    mobs.top = zone_table[zone].top;
    if (IS_SET(ch->specials.act, PLR_STEALTH))
	zprintf(zone,
		"\r\nYou feel a great surge of power!\r\nYou hear odd scurrying sounds all around you...\r\n\r\n");
    else
	zprintf(zone,
		"\r\nIn a puff of acrid smoke, you see %s snap %s fingers!\r\nYou hear odd scurrying sounds all around you...\r\n\r\n",
		GET_NAME(ch), HSHR(ch));
    mob_count = 0;
    hash_iterate(&room_db, (funcp)event_fill_zone_with_mobs, &mobs);
    cprintf(ch, "You just added %d rats to %s [#%d].\r\n", mob_count,
	    zone_table[zone].name, zone);
    log_info("%s added %d rats to %s [#%d].", GET_NAME(ch), mob_count, zone_table[zone].name,
	     zone);
}
Пример #30
0
/* put an object in an object (quaint)  */
void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
{
  struct obj_data *tmp_obj;
  
  obj->next_content = obj_to->contains;
  obj_to->contains = obj;
  obj->in_obj = obj_to;
  /*  
    (jdb)  hopefully this will fix the object problem   
    */
  obj->carried_by = 0;
  obj->equipped_by = 0;
  
  for(tmp_obj = obj->in_obj; tmp_obj;
      GET_OBJ_WEIGHT(tmp_obj) += GET_OBJ_WEIGHT(obj), tmp_obj = tmp_obj->in_obj);
  if(obj_to->in_room != NOWHERE)
      if(IS_SET(real_roomp(obj_to->in_room)->room_flags, SAVE_ROOM))
         save_room(obj_to->in_room);  
}