From 205aba1ff3a6f1ff92a8b26af646fd25f139c697 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 9 May 2023 05:20:35 +0200 Subject: Core/Battlegrounds: Moved AreaSpiritHealer resurrection handling to respective npc flags (#28508) * UNIT_NPC_FLAG_AREA_SPIRIT_HEALER * UNIT_NPC_FLAG_2_AREA_SPIRIT_HEALER_INDIVIDUAL --- src/server/game/Spells/SpellEffects.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/server/game/Spells/SpellEffects.cpp') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 2dab2a3d9c5..1dbc2269e84 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4488,26 +4488,29 @@ void Spell::EffectSkill() TC_LOG_DEBUG("spells", "WORLD: SkillEFFECT"); } -/* There is currently no need for this effect. We handle it in Battleground.cpp - If we would handle the resurrection here, the spiritguide would instantly disappear as the - player revives, and so we wouldn't see the spirit heal visual effect on the npc. - This is why we use a half sec delay between the visual effect and the resurrection itself */ void Spell::EffectSpiritHeal() { + Unit* caster = GetCaster()->ToUnit(); + if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT) + caster->CastSpell(nullptr, SPELL_RESURRECTION_VISUAL, true); + if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - /* - if (unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - if (!unitTarget->IsInWorld()) - return; + if (Player* playerTarget = unitTarget->ToPlayer()) + { + if (!playerTarget->IsInWorld()) + return; + + // skip if player does not want to live + if (!playerTarget->CanAcceptAreaSpiritHealFrom(caster)) + return; - //m_spellInfo->Effects[i].BasePoints; == 99 (percent?) - //unitTarget->ToPlayer()->setResurrect(m_caster->GetGUID(), unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), unitTarget->GetMaxHealth(), unitTarget->GetMaxPower(POWER_MANA)); - unitTarget->ToPlayer()->ResurrectPlayer(1.0f); - unitTarget->ToPlayer()->SpawnCorpseBones(); - */ + playerTarget->ResurrectPlayer(1.0f); + playerTarget->CastSpell(playerTarget, SPELL_PET_SUMMONED, true); + playerTarget->CastSpell(playerTarget, SPELL_SPIRIT_HEAL_MANA, true); + playerTarget->SpawnCorpseBones(false); + } } // remove insignia spell effect -- cgit v1.2.3