Ok, here is the code for random lightning strikes on pc's
that I mentioned before. You can vary ythe percenatages, damage
values, etc...in weather.c
Please note: I did _not_ write this. As noted in the
comments, I ported it from EltaninMUD code, which was by Miikka.
I just don't wanna take or be given credit for something that is
not mine.
Enjoy.
--
-axl @)-->--- "Beneath the stain of time, the feeling disappears.
axl@mindwarp You are someone else. I am still right here." - NIN
---- In comm.c ----
Around line 100, add:
void beware_lightning(void);
Around line 687, add:
if (!(pulse % (SECS_PER_MUD_HOUR/3))){
beware_lightning();
}
--- In weather.c ---
Around line 24, add:
extern struct char_data *character_list; /* lightning */
extern struct room_data *world;
void die(struct char_data * ch);
Around line 36, add:
/* ported from Eltanin by AxL, 2feb97 */
/* added by Miikka M. Kangas 8-14-91 (note this is called with own pulses!) */
/* I was getting bored so I wanted to add some edge to weather. */
void beware_lightning(void)
{
int dam = 0;
struct char_data *victim = NULL, *temp = NULL;
char buf[256];
if (!(weather_info.sky == SKY_LIGHTNING))
return; /* go away if its not even stormy! */
if (!(number(0, 9) == 0))
return; /* Bolt only 10% of time */
if (number(0,99) == 0) { /* nobody targeted 99% */
send_to_outdoor("You hear the clap of distant thunder.\n\r");
} else
for (victim = character_list; victim; victim = temp) {
temp = victim->next;
if ( (OUTSIDE(victim) == TRUE) && (!IS_NPC(victim)) ) { /* PCs only */
if ( (number(0, 9) == 0) ) { /* hit 10% */
/* damage routine here */
dam = number(1, (GET_MAX_HIT(victim) * 2));
if ((GET_LEVEL(victim) >= LVL_IMMORT) && !IS_NPC(victim))
/* You can't damage an immortal! */
dam = 0;
if (IS_AFFECTED(victim, AFF_SANCTUARY))
dam = MIN(dam, 18); /* Max 18 damage when sanctuary */
dam = MIN(dam, 100); /* no more than 100 hp per round */
dam = MAX(dam, 0); /* no less than 0 hp per round */
GET_HIT(victim) -= dam;
act("KAZAK! a lightning bolt hits $n. You hear a sick sizzle.",
TRUE, victim, 0, 0, TO_ROOM);
act("KAZAK! a lightning bolt hits you. You hear a sick sizzle.",
FALSE, victim, 0, 0, TO_CHAR);
if (dam > (GET_MAX_HIT(victim) >> 2))
act("That Really did HURT!",FALSE, victim, 0, 0, TO_CHAR);
send_to_outdoor("*BOOM* You hear the clap of thunder.\n\r");
update_pos(victim);
switch (GET_POS(victim)) {
case POS_MORTALLYW:
act("$n is mortally wounded, and will die soon, if not aided.",
TRUE, victim, 0, 0, TO_ROOM);
act("You are mortally wounded, and will die soon, if not aided.",
FALSE, victim, 0, 0, TO_CHAR);
case POS_INCAP:
act("$n is incapacitated and will slowly die, if not aided.",
TRUE, victim, 0, 0, TO_ROOM);
act("You are incapacitated an will slowly die, if not aided.",
FALSE, victim, 0, 0, TO_CHAR);
case POS_STUNNED:
act("$n is stunned, but will probably regain conscience again.",
TRUE, victim, 0, 0, TO_ROOM);
act("You're stunned, but will probably regain conscience again.",
FALSE, victim, 0, 0, TO_CHAR);
case POS_DEAD:
act("$n is dead! R.I.P.", TRUE, victim, 0, 0, TO_ROOM);
act("You are dead! Sorry...", FALSE, victim, 0, 0, TO_CHAR);
default: /* >= POS_SLEEPING */
if (GET_HIT(victim) < (GET_MAX_HIT(victim) >> 2)) {
act("You wish that your wounds would stop BLEEDING that much!",
FALSE,victim,0,0,TO_CHAR);
} /* if BLEEDING */
} /* switch */
if (GET_POS(victim) == POS_DEAD) {
sprintf(buf, "Thunderstorm killed %s", GET_NAME(victim));
log(buf);
die(victim);
} /* of death */
return;
} /* number(0,10) */
else {
act("KAZAK! a lightning bolt hits nearby", FALSE, victim, 0, 0, TO_ROOM);
act("KAZAK! a lightning bolt hits nearby", FALSE, victim, 0, 0, TO_CHAR);
send_to_outdoor("*BOOM* You hear the clap of thunder.\n\r");
return; /* only 1 bolt at a time */
}
} /* if outside=true */
} /* of for victim hunt */
} /* of procedure */
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
| Or send 'info circle' to majordomo@cspo.queensu.ca |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST