damage_old (ch, ch, dam, sn, DAM_LIGHTNING, TRUE);
if (killed_by_chain) {
killed_by_chain = FALSE;
return;
}
level -= 4; /* decrement damage */
if (ch == NULL || ch->fighting == NULL)
return;
}
damage_old (ch, ch, dam, sn, DAM_LIGHTNING, TRUE);
if (killed_by_chain) {
killed_by_chain = FALSE;
return;
}
level -= 4; /* decrement damage */
if (ch == NULL || ch->fighting == NULL)
return;
}
for (list<CHAR_DATA>::iterator i=CharList.begin(); i!=CharList.end(); i++)
{
CHAR_DATA TempChar=*i;
// Smack the dude with your lightning storm
*i.damage(lightning_damage_variable);
if (TempChar!=*i) <– Quix said this will now point to the next character if the lightning storm killed the first one.
}
for (list<CHAR_DATA>::iterator i=CharList.begin(); i!=CharList.end(); i++)
{
CHAR_DATA TempChar=*i;
// Smack the dude with your lightning storm
*i.damage(lightning_damage_variable);
if (TempChar!=*i) <– Quix said this will now point to the next character if the lightning storm killed the first one.
}
So what happens on tbaMUD when one casts an area spell that loops through the room damaging characters (like a chain lightning),
and a HITPRCNT trigger is run off a damaged mob that %teleports% the caster out of the room?
The *smart* way to do that kind of thing would be to decide if you want spells like this to be channeled, or fire-and-forget. If a spell is channeled, then interrupting the caster would make it stop at that point. If not, the spell would go through it's entire sequence, regardless. In the former case, you could stop the spell at the point the mobprog trigger took hit, stopping the chain reaction. In the latter, you could simply avoid processing the trigger until the spell routine finished (put all such triggers on a stack and process them at the bottom of the current round, in order).