ASPELL(spell_recharge) { int restored_charges = 0, explode = 0; if (ch == NULL || obj == NULL) return; /* This is on my mud, comment off on yours */ if (GET_OBJ_EXTRA(obj) == ITEM_NO_RECHARGE) { send_to_char("This item cannot be recharged.\r\n", ch); return; } if (GET_OBJ_TYPE(obj) == ITEM_WAND) { if (GET_OBJ_VAL(obj, 2) < GET_OBJ_VAL(obj, 1)) { send_to_char("You attempt to recharge the wand.\r\n", ch); restored_charges = number(1, 5); GET_OBJ_VAL(obj, 2) += restored_charges; if (GET_OBJ_VAL(obj, 2) > GET_OBJ_VAL(obj, 1)) { send_to_char("The wand is overcharged and explodes!\r\n", ch); sprintf(buf, "%s overcharges %s and it explodes!\r\n", GET_NAME(ch), obj->name); act(buf, TRUE, 0, 0, 0, TO_NOTVICT); explode = dice(GET_OBJ_VAL(obj, 2), 2); GET_HIT(ch) -= explode; update_pos(ch); extract_obj(obj); return; } else { sprintf(buf, "You restore %d charges to the wand.\r\n", restored_charges); send_to_char(buf, ch); return; } } else { send_to_char("That item is already at full charges!\r\n", ch); return; } } else if (GET_OBJ_TYPE(obj) == ITEM_STAFF) { if (GET_OBJ_VAL(obj, 2) < GET_OBJ_VAL(obj, 1)) { send_to_char("You attempt to recharge the staff.\r\n", ch); restored_charges = number(1, 3); GET_OBJ_VAL(obj, 2) += restored_charges; if (GET_OBJ_VAL(obj, 2) > GET_OBJ_VAL(obj, 1)) { send_to_char("The staff is overcharged and explodes!\r\n", ch); sprintf(buf, "%s overcharges %s and it explodes!\r\n", GET_NAME(ch), obj->name); act(buf, TRUE, 0, 0, 0, TO_NOTVICT); explode = dice(GET_OBJ_VAL(obj, 2), 3); GET_HIT(ch) -= explode; update_pos(ch); extract_obj(obj); return; } else { sprintf(buf, "You restore %d charges to the staff.\r\n", restored_charges); send_to_char(buf, ch); return; } } else { send_to_char("That item is already at full charges!\r\n", ch); return; } } }