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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }