Th issue was what list was being iterated over. As a side note, if you want to rez corpses, you have to iterate the corpse_list and not the mob_list. Code below for EntityList::AESpell fixed it.
Code:
void EntityList::AESpell(Mob *caster, Mob *center, int16 spell_id, bool affect_caster, sint16 resist_adjust)
{
if(!IsAERezSpell(spell_id))
{
LinkedListIterator<Mob*> iterator(mob_list);
Mob *curmob;
float dist = caster->GetAOERange(spell_id);
float dist2 = dist * dist;
bool bad = IsDetrimentalSpell(spell_id);
bool isnpc = caster->IsNPC();
const int MAX_TARGETS_ALLOWED = 4;
int iCounter = 0;
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
{
curmob = iterator.GetData();
if(curmob == center) //do not affect center
continue;
if(curmob == caster && !affect_caster) //watch for caster too
continue;
if(center->DistNoRoot(*curmob) > dist2) //make sure they are in range
continue;
if(isnpc && curmob->IsNPC()) { //check npc->npc casting
FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
if(bad) {
//affect mobs that are on our hate list, or
//which have bad faction with us
if( ! (caster->CheckAggro(curmob) || f == FACTION_THREATENLY || f == FACTION_SCOWLS) )
continue;
} else {
//only affect mobs we would assist.
if( ! (f <= FACTION_AMIABLE))
continue;
}
}
//finally, make sure they are within range
if(bad) {
if(!caster->IsAttackAllowed(curmob, true))
continue;
if(!center->CheckLosFN(curmob))
continue;
}
//if we get here... cast the spell.
if(IsTargetableAESpell(spell_id) && bad)
{
if(iCounter < MAX_TARGETS_ALLOWED)
{
caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust);
}
}
else
{
caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust);
}
if(!isnpc) //npcs are not target limited...
iCounter++;
}
}
else
{
LinkedListIterator<Corpse*> iterator(corpse_list);
Corpse *curcorpse;
float dist = caster->GetAOERange(spell_id);
float dist2 = dist * dist;
for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
{
curcorpse = iterator.GetData();
if(!curcorpse->IsPlayerCorpse())
continue;
if(center->DistNoRoot(*curcorpse) > dist2) //make sure they are in range
continue;
caster->SpellOnTarget(spell_id, curcorpse);
}
}
}