Пример #1
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);
}
Пример #2
0
int CheckForAnyTrap(struct char_data *ch, struct obj_data *i)
{
    if(DEBUG) dlog("CheckForAnyTrap");
    if((ITEM_TYPE(i) == ITEM_TRAP) && (GET_TRAP_CHARGES(i) > 0))
	   return(TriggerTrap(ch, i));

  return(FALSE);
}
Пример #3
0
int check_for_get_trap(struct char_data *ch, struct obj_data *i) {
  if ((ITEM_TYPE(i) == ITEM_TRAP) &&
      (IS_SET(GET_TRAP_EFF(i), TRAP_EFF_OBJECT)) &&
      (GET_TRAP_CHARGES(i) > 0)) {
    return (trigger_trap(ch, i));
  }
  return (FALSE);
}
Пример #4
0
int CheckForGetTrap(struct char_data *ch, struct obj_data *i)
{
    if(DEBUG) dlog("CheckForGetTrap");
    if ((ITEM_TYPE(i) == ITEM_TRAP) && 
	(IS_SET(GET_TRAP_EFF(i),TRAP_EFF_OBJECT)) &&
	(GET_TRAP_CHARGES(i) > 0)) {
	   return(TriggerTrap(ch, i));  
	 }
    return(FALSE);
}
Пример #5
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);
}
Пример #6
0
int check_for_inside_trap(struct char_data *ch, struct obj_data *i) {
  struct obj_data *t;

  for (t = i->contains; t; t = t->next_content) {
    if ((ITEM_TYPE(t) == ITEM_TRAP) &&
        (IS_SET(GET_TRAP_EFF(t), TRAP_EFF_OBJECT)) &&
        (GET_TRAP_CHARGES(t) > 0)) {
      return (trigger_trap(ch, t));
    }
  }
  return (FALSE);
}
Пример #7
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);
}
Пример #8
0
int CheckForInsideTrap(struct char_data *ch, struct obj_data *i)
{
  struct obj_data *t;
if(DEBUG) dlog("CheckForInsideTrap");
  for (t = i->contains; t; t = t->next_content) 
  {
    if ((ITEM_TYPE(t) == ITEM_TRAP) && 
	(IS_SET(GET_TRAP_EFF(t),TRAP_EFF_OBJECT)) &&
	(GET_TRAP_CHARGES(t) > 0)) 
	{
	   return(TriggerTrap(ch, t));  
	 }
  }
  return(FALSE);
}
Пример #9
0
int check_for_any_trap(struct char_data *ch, struct obj_data *i) {
  if ((ITEM_TYPE(i) == ITEM_TRAP) && (GET_TRAP_CHARGES(i) > 0))
    return (trigger_trap(ch, i));

  return (FALSE);
}