Core/Battlegrounds: Moved AreaSpiritHealer resurrection handling to respective npc flags

Port From (https://github.com/TrinityCore/TrinityCore/commit/205aba1ff3a6f1ff92a8b26af646fd25f139c697)
This commit is contained in:
hondacrx
2023-05-21 18:38:55 -04:00
parent 3e72da9f1e
commit 35961a0121
17 changed files with 248 additions and 331 deletions
+20 -4
View File
@@ -4221,14 +4221,30 @@ namespace Game.Spells
Log.outDebug(LogFilter.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 EffectSpiritHeal()
{
Unit caster = GetCaster().ToUnit();
if (effectHandleMode == SpellEffectHandleMode.Hit)
caster.CastSpell(null, BattlegroundConst.SpellResurrectionVisual, true);
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
return;
Player playerTarget = unitTarget.ToPlayer();
if (playerTarget != null)
{
if (!playerTarget.IsInWorld)
return;
// skip if player does not want to live
if (!playerTarget.CanAcceptAreaSpiritHealFrom(caster))
return;
playerTarget.ResurrectPlayer(1.0f);
playerTarget.CastSpell(playerTarget, BattlegroundConst.SpellPetSummoned, true);
playerTarget.CastSpell(playerTarget, BattlegroundConst.SpellSpiritHealMana, true);
playerTarget.SpawnCorpseBones(false);
}
}
// remove insignia spell effect