assure we remove the spell from all targets even if the caster is not set/present

This commit is contained in:
Emagi 2025-08-21 08:59:48 -04:00
parent 14a03bf255
commit 765a110732

View File

@ -460,6 +460,7 @@ bool SpellProcess::DeleteCasterSpell(LuaSpell* spell, string reason, bool removi
return target_valid; return target_valid;
} }
if (!zone_shutting_down && spell->caster) { // spell->caster ptr cannot be trusted during zone shutdown if (!zone_shutting_down && spell->caster) { // spell->caster ptr cannot be trusted during zone shutdown
if(spell->caster) {
if(spell->caster->GetThreatTransfer() && spell->caster->GetThreatTransfer()->Spell == spell) { if(spell->caster->GetThreatTransfer() && spell->caster->GetThreatTransfer()->Spell == spell) {
spell->caster->SetThreatTransfer(nullptr); spell->caster->SetThreatTransfer(nullptr);
} }
@ -492,6 +493,8 @@ bool SpellProcess::DeleteCasterSpell(LuaSpell* spell, string reason, bool removi
spell->caster->RemoveProc(0, spell); spell->caster->RemoveProc(0, spell);
spell->caster->RemoveMaintainedSpell(spell); spell->caster->RemoveMaintainedSpell(spell);
CheckRemoveTargetFromSpell(spell, removing_all_spells, removing_all_spells); CheckRemoveTargetFromSpell(spell, removing_all_spells, removing_all_spells);
}
ZoneServer* zone = spell->zone; ZoneServer* zone = spell->zone;
if(zone) { if(zone) {
LogWrite(SPELL__DEBUG, 0, "Spell", "SpellProcess::DeleteCasterSpell RemoveTargets Spell: %s.", LogWrite(SPELL__DEBUG, 0, "Spell", "SpellProcess::DeleteCasterSpell RemoveTargets Spell: %s.",