From 443c00bd28d27f33a8dd2aad4db5ec0af03e4d90 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 1 Sep 2017 10:59:28 -0400 Subject: [PATCH] Fixed Spirit of Redemption Removed old Spirit of Redemption code Removed unexplainable duration limit from SpellInfo::GetMaxTicks --- Game/BattleGrounds/BattleGround.cs | 2 +- Game/Entities/Unit/Unit.Combat.cs | 31 ++----------------- Game/Spells/Auras/AuraEffect.cs | 48 ++++++++++++++++++++++++++++-- Game/Spells/SpellInfo.cs | 4 --- Scripts/Spells/Priest.cs | 28 +++++++++++++++++ 5 files changed, 77 insertions(+), 36 deletions(-) diff --git a/Game/BattleGrounds/BattleGround.cs b/Game/BattleGrounds/BattleGround.cs index 6da9c4b27..e880c6e5c 100644 --- a/Game/BattleGrounds/BattleGround.cs +++ b/Game/BattleGrounds/BattleGround.cs @@ -1710,7 +1710,7 @@ namespace Game.BattleGrounds if (pair.Value.Team == Team) { Player player = Global.ObjAccessor.FindPlayer(pair.Key); - if (player && player.IsAlive() && player.GetShapeshiftForm() != ShapeShiftForm.SpiritOfRedemption) + if (player && player.IsAlive()) ++count; } } diff --git a/Game/Entities/Unit/Unit.Combat.cs b/Game/Entities/Unit/Unit.Combat.cs index 215f1faf4..18ab721b5 100644 --- a/Game/Entities/Unit/Unit.Combat.cs +++ b/Game/Entities/Unit/Unit.Combat.cs @@ -1450,33 +1450,8 @@ namespace Game.Entities if (player != null) player.UpdateCriteria(CriteriaTypes.GetKillingBlows, 1, 0, 0, victim); - // if talent known but not triggered (check priest class for speedup check) - bool spiritOfRedemption = false; - if (victim.IsTypeId(TypeId.Player) && victim.GetClass() == Class.Priest) - { - AuraEffect spiritOfRedemptionEffect = GetAuraEffect(20711, 0); - if (spiritOfRedemptionEffect != null) - { - // save value before aura remove - uint ressSpellId = victim.GetUInt32Value(PlayerFields.SelfResSpell); - if (ressSpellId == 0) - ressSpellId = victim.ToPlayer().GetResurrectionSpellId(); - // Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers) - victim.RemoveAllAurasOnDeath(); - // restore for use at real death - victim.SetUInt32Value(PlayerFields.SelfResSpell, ressSpellId); - - // FORM_SPIRIT_OF_REDEMPTION and related auras - victim.CastSpell(victim, 27827, true, null, spiritOfRedemptionEffect); - spiritOfRedemption = true; - } - } - - if (!spiritOfRedemption) - { - Log.outDebug(LogFilter.Unit, "SET JUST_DIED"); - victim.setDeathState(DeathState.JustDied); - } + Log.outDebug(LogFilter.Unit, "SET JUST_DIED"); + victim.setDeathState(DeathState.JustDied); // Inform pets (if any) when player kills target) // MUST come after victim.setDeathState(JUST_DIED); or pet next target @@ -2378,7 +2353,7 @@ namespace Game.Entities // We're going to call functions which can modify content of the list during iteration over it's elements // Let's copy the list so we can prevent iterator invalidation var vSchoolAbsorbCopy = victim.GetAuraEffectsByType(AuraType.SchoolAbsorb); - vSchoolAbsorbCopy.Sort();//new AbsorbAuraOrderPred());todo fix me + vSchoolAbsorbCopy.Sort(new AbsorbAuraOrderPred()); // absorb without mana cost foreach (var eff in vSchoolAbsorbCopy) diff --git a/Game/Spells/Auras/AuraEffect.cs b/Game/Spells/Auras/AuraEffect.cs index 103f36eda..c67cfd0bc 100644 --- a/Game/Spells/Auras/AuraEffect.cs +++ b/Game/Spells/Auras/AuraEffect.cs @@ -666,7 +666,7 @@ namespace Game.Spells case AuraType.MechanicImmunity: case AuraType.ModMechanicResistance: // compare mechanic - if (spellInfo == null || !Convert.ToBoolean(spellInfo.GetAllEffectsMechanicMask() & (1 << GetMiscValue()))) + if (spellInfo == null || !Convert.ToBoolean(spellInfo.GetAllEffectsMechanicMask() & (1 << GetMiscValue()))) result = false; break; case AuraType.ModCastingSpeedNotStack: @@ -796,6 +796,7 @@ namespace Game.Spells case ShapeShiftForm.SpiritOfRedemption: spellId = 27792; spellId2 = 27795; + spellId3 = 62371; break; case ShapeShiftForm.Shadowform: if (target.HasAura(107906)) // Glyph of Shadow @@ -1225,8 +1226,6 @@ namespace Game.Spells if (!target.IsStandState()) target.SetStandState(UnitStandStateType.Stand); } - - target.SetHealth(1); } // die at aura end else if (target.IsAlive()) @@ -6235,4 +6234,47 @@ namespace Game.Spells } #endregion } + + class AbsorbAuraOrderPred : Comparer + { + public AbsorbAuraOrderPred() { } + + public override int Compare(AuraEffect aurEffA, AuraEffect aurEffB) + { + SpellInfo spellProtoA = aurEffA.GetSpellInfo(); + SpellInfo spellProtoB = aurEffB.GetSpellInfo(); + + // Fel Blossom + if (spellProtoA.Id == 28527) + return 1; + if (spellProtoB.Id == 28527) + return 0; + + // Ice Barrier + if (spellProtoA.GetCategory() == 471) + return 1; + if (spellProtoB.GetCategory() == 471) + return 0; + + // Sacrifice + if (spellProtoA.Id == 7812) + return 1; + if (spellProtoB.Id == 7812) + return 0; + + // Cauterize (must be last) + if (spellProtoA.Id == 86949) + return 0; + if (spellProtoB.Id == 86949) + return 1; + + // Spirit of Redemption (must be last) + if (spellProtoA.Id == 20711) + return 0; + if (spellProtoB.Id == 20711) + return 1; + + return 0; + } + } } diff --git a/Game/Spells/SpellInfo.cs b/Game/Spells/SpellInfo.cs index ad60d73d0..ccd2f00f9 100644 --- a/Game/Spells/SpellInfo.cs +++ b/Game/Spells/SpellInfo.cs @@ -1636,10 +1636,6 @@ namespace Game.Spells if (DotDuration == 0) return 1; - // 200% limit - if (DotDuration > 30000) - DotDuration = 30000; - foreach (SpellEffectInfo effect in GetEffectsForDifficulty(difficulty)) { if (effect != null && effect.Effect == SpellEffectName.ApplyAura) diff --git a/Scripts/Spells/Priest.cs b/Scripts/Spells/Priest.cs index 5779972c3..c5232b604 100644 --- a/Scripts/Spells/Priest.cs +++ b/Scripts/Spells/Priest.cs @@ -71,6 +71,7 @@ namespace Scripts.Spells.Priest public const uint ShadowformVisualWithoutGlyph = 107903; public const uint ShieldDisciplineEnergize = 47755; public const uint ShieldDisciplinePassive = 197045; + public const uint SpiritOfRedemption = 27827; public const uint StrengthOfSoul = 197535; public const uint StrengthOfSoulEffect = 197548; public const uint T9Healing2p = 67201; @@ -897,6 +898,33 @@ namespace Scripts.Spells.Priest } } + [Script] // 20711 - Spirit of Redemption + class spell_priest_spirit_of_redemption : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.SpiritOfRedemption); + } + + void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount) + { + Unit target = GetTarget(); + if (dmgInfo.GetDamage() >= target.GetHealth()) + { + target.CastSpell(target, SpellIds.SpiritOfRedemption, TriggerCastFlags.FullMask, null, aurEff); + target.SetFullHealth(); + return; + } + + PreventDefaultAction(); + } + + public override void Register() + { + OnEffectAbsorb.Add(new EffectAbsorbHandler(HandleAbsorb, 0)); + } + } + [Script] // 28809 - Greater Heal class spell_pri_t3_4p_bonus : AuraScript {