Example #1
0
File: Trap.c Project: jonm/SillyMUD
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);
}
Example #2
0
File: Trap.c Project: jonm/SillyMUD
void find_trap_damage(struct char_data *v, struct obj_data *i) {
/*
   trap types < 0 are special
*/

  if (GET_TRAP_DAM_TYPE(i) >= 0) {
    trap_damage(v, GET_TRAP_DAM_TYPE(i), 3 * GET_TRAP_LEV(i), i);
  }
  else {
    trap_damage(v, GET_TRAP_DAM_TYPE(i), 0, i);
  }

}
Example #3
0
void FindTrapDamage( struct char_data *v, struct obj_data *i)
{
/*
   trap types < 0 are special
*/
if(DEBUG) dlog("FindTrapDamage");

  if (GET_TRAP_DAM_TYPE(i) >= 0) 
  {
    TrapDamage(v,GET_TRAP_DAM_TYPE(i),3*GET_TRAP_LEV(i),i);
  }
  else
  {
     TrapDamage(v, GET_TRAP_DAM_TYPE(i), 0,i);
  }
}