|
Recharge Spell [by Franco] |
|
|
|
Posted Wednesday, August 12th @ 11:35:11 PM, by George Greer in the Skills dept.
. Click the link below to read it or download it.
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;
}
}
}
<< Receptionists without rebooting! [by Gary Barnett] | Reply | View as text | Flattened | Recharger For Wand And Staff [by David Carver] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|