Fix persist through death for things like food/drink spell effects

This commit is contained in:
Emagi 2025-06-12 09:49:04 -04:00
parent e79cffd658
commit 8b48f9f902

View File

@ -2056,14 +2056,17 @@ void SpellProcess::RemoveSpellTimersFromSpawn(Spawn* spawn, bool remove_all, boo
MutexList<LuaSpell*>::iterator itr = active_spells.begin(); MutexList<LuaSpell*>::iterator itr = active_spells.begin();
while(itr.Next()){ while(itr.Next()){
spell = itr->value; spell = itr->value;
if (!spell)
if (!spell || !spell->spell || !spell->spell->GetSpellData())
continue; continue;
if (spell->spell->GetSpellData()->persist_through_death)
continue;
if(spell->caster == spawn && call_expire_function){ if(spell->caster == spawn && call_expire_function){
DeleteCasterSpell(spell, "expired", remove_all, nullptr, false, lock_spell_process); DeleteCasterSpell(spell, "expired", remove_all, nullptr, false, lock_spell_process);
continue; continue;
} }
if (spell->spell->GetSpellData()->persist_through_death)
continue;
bool foundMatch = false; bool foundMatch = false;