There is an energy drain snippet available from
Chris Rehbein that I was looking at - I started
modifying it for my own purposes, but ended up
re-writing about 99% of it ;)
Here's my version, intended to be a VERY high level
spell, and I also strongly recommend you use
mag_materials for this spell, requiring some hard to
get item. Alternately, just allow a saving throw ;)
I'm assuming you know how to add a manual spell...
-- spells.c --
/* The bad things that happen to the caster when casting energy drain... */
void do_drain_stuff(struct char_data *ch) {
/* Immorts can use the spell with impunity */
if (GET_LEVEL(ch) >= LVL_IMMORT)
return;
GET_ALIGNMENT(ch) -= 100; /* This is an EVIL spell! */
if (dice(1, 20) == 1) {
GET_CON(ch) -= 1;
send_to_char("The exposure to such negative energies has over-taxed "
"your body!\r\n", ch);
if (GET_CON(ch) <= 0) {
send_to_char("Your body was unable to handle the massive influx of "
"negative energy!\r\n", ch);
die(ch);
}
}
return;
}
ASPELL(spell_energy_drain) {
int hp_loss = 0;
/* No saving throw! */
/* drain 2 levels and caster has 5% chance of losing 1 point of con */
GET_LEVEL(victim) -= 2;
if (GET_LEVEL(victim) <= 0) {
act("$n drains away the last of your life energy...",
FALSE, ch, 0, victim, TO_VICT);
die(victim);
act("$N collapses, dead!", FALSE, ch, 0, victim, TO_ROOM);
act("$N collapses, dead from your energy draining!",
FALSE, ch, 0, victim, TO_CHAR);
do_drain_stuff(ch);
return;
}
/* We could keep track of how many hp a player gained at each level,
but what a pain! And what to do about NPCs?! Just find the
average HP per level and subtract HP based on this average. */
hp_loss = ((float)GET_MAX_HIT(victim) / (float)GET_LEVEL(victim)) * 2.0;
GET_MAX_HIT(victim) -= hp_loss;
GET_HIT(victim) -= hp_loss;
if (GET_HIT(victim) > 0) {
act("A cold chill comes over you as you feel $n drain away your life "
"energy!", FALSE, ch, 0, victim, TO_VICT);
act("You drain the life energy from $N!", FALSE, ch, 0, victim, TO_CHAR);
do_drain_stuff(ch);
if (IS_NPC(victim))
hit(victim, ch, TYPE_UNDEFINED);
return;
} else {
act("$n drains away the last of your life energy...",
FALSE, ch, 0, victim, TO_VICT);
die(victim);
act("$N collapses, dead!", FALSE, ch, 0, victim, TO_ROOM);
act("$N collapses, dead from your energy draining!",
FALSE, ch, 0, victim, TO_CHAR);
do_drain_stuff(ch);
return;
}
return;
}
---
eglamkowski@angelfire.com
http://www.angelfire.com/nj/eglamkowski/null.html <- Null webring
http://www.angelfire.com/nj/eglamkowski/eia.html <- EiA webring
Angelfire for your free web-based e-mail. http://www.angelfire.com
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST