Scripts/IcecrownCitadel: Prevent players from becoming inaccessible when killed by Lord Marrowgar's Impale spell (the initial damage, not the DoT). Also fix the underlying bug in vehicle logic.

Port From (https://github.com/TrinityCore/TrinityCore/commit/e69b5d8fcc44728abd189e4832a383543218e5c1)
This commit is contained in:
hondacrx
2020-08-22 15:35:55 -04:00
parent 7060f728a3
commit 51e914e0f3
3 changed files with 964 additions and 943 deletions
+7
View File
@@ -559,6 +559,13 @@ namespace Game.Entities
Target.RemovePendingEventsForSeat(Seat.Key); Target.RemovePendingEventsForSeat(Seat.Key);
Target.RemovePendingEventsForPassenger(Passenger); Target.RemovePendingEventsForPassenger(Passenger);
// Passenger might've died in the meantime - abort if this is the case
if (!Passenger.IsAlive())
{
Abort(0);
return true;
}
Passenger.SetVehicle(Target); Passenger.SetVehicle(Target);
Seat.Value.Passenger.Guid = Passenger.GetGUID(); Seat.Value.Passenger.Guid = Passenger.GetGUID();
Seat.Value.Passenger.IsUnselectable = Passenger.HasUnitFlag(UnitFlags.NotSelectable); Seat.Value.Passenger.IsUnselectable = Passenger.HasUnitFlag(UnitFlags.NotSelectable);
File diff suppressed because it is too large Load Diff
@@ -41,7 +41,7 @@ namespace Scripts.Northrend.IcecrownCitadel
public const int EmoteBoneStorm = 7; public const int EmoteBoneStorm = 7;
} }
struct Spells struct SpellIds
{ {
// Lord Marrowgar // Lord Marrowgar
public const uint BoneSlice = 69055; public const uint BoneSlice = 69055;
@@ -106,7 +106,7 @@ namespace Scripts.Northrend.IcecrownCitadel
if (!unit.IsTypeId(TypeId.Player)) if (!unit.IsTypeId(TypeId.Player))
return false; return false;
if (unit.HasAura(Spells.Impaled)) if (unit.HasAura(SpellIds.Impaled))
return false; return false;
// Check if it is one of the tanks soaking Bone Slice // Check if it is one of the tanks soaking Bone Slice
@@ -136,7 +136,7 @@ namespace Scripts.Northrend.IcecrownCitadel
{ {
_Reset(); _Reset();
me.SetSpeedRate(UnitMoveType.Run, _baseSpeed); me.SetSpeedRate(UnitMoveType.Run, _baseSpeed);
me.RemoveAurasDueToSpell(Spells.BoneStorm); me.RemoveAurasDueToSpell(SpellIds.BoneStorm);
me.RemoveAurasDueToSpell(InstanceSpells.Berserk); me.RemoveAurasDueToSpell(InstanceSpells.Berserk);
_events.ScheduleEvent(Misc.EventEnableBoneSlice, 10000); _events.ScheduleEvent(Misc.EventEnableBoneSlice, 10000);
@@ -201,30 +201,30 @@ namespace Scripts.Northrend.IcecrownCitadel
switch (eventId) switch (eventId)
{ {
case Misc.EventBoneSpikeGraveyard: case Misc.EventBoneSpikeGraveyard:
if (IsHeroic() || !me.HasAura(Spells.BoneStorm)) if (IsHeroic() || !me.HasAura(SpellIds.BoneStorm))
DoCast(me, Spells.BoneSpikeGraveyard); DoCast(me, SpellIds.BoneSpikeGraveyard);
_events.ScheduleEvent(Misc.EventBoneSpikeGraveyard, RandomHelper.URand(15000, 20000), Misc.EventGroupSpecial); _events.ScheduleEvent(Misc.EventBoneSpikeGraveyard, RandomHelper.URand(15000, 20000), Misc.EventGroupSpecial);
break; break;
case Misc.EventColdflame: case Misc.EventColdflame:
_coldflameLastPos.Relocate(me); _coldflameLastPos.Relocate(me);
_coldflameTarget.Clear(); _coldflameTarget.Clear();
if (!me.HasAura(Spells.BoneStorm)) if (!me.HasAura(SpellIds.BoneStorm))
DoCastAOE(Spells.ColdflameNormal); DoCastAOE(SpellIds.ColdflameNormal);
else else
DoCast(me, Spells.ColdflameBoneStorm); DoCast(me, SpellIds.ColdflameBoneStorm);
_events.ScheduleEvent(Misc.EventColdflame, 5000, Misc.EventGroupSpecial); _events.ScheduleEvent(Misc.EventColdflame, 5000, Misc.EventGroupSpecial);
break; break;
case Misc.EventWarnBoneStorm: case Misc.EventWarnBoneStorm:
_boneSlice = false; _boneSlice = false;
Talk(Texts.SayBoneStorm); Talk(Texts.SayBoneStorm);
me.FinishSpell(CurrentSpellTypes.Melee, false); me.FinishSpell(CurrentSpellTypes.Melee, false);
DoCast(me, Spells.BoneStorm); DoCast(me, SpellIds.BoneStorm);
_events.DelayEvents(3000, Misc.EventGroupSpecial); _events.DelayEvents(3000, Misc.EventGroupSpecial);
_events.ScheduleEvent(Misc.EventBoneStormBegin, 3050); _events.ScheduleEvent(Misc.EventBoneStormBegin, 3050);
_events.ScheduleEvent(Misc.EventWarnBoneStorm, RandomHelper.URand(90000, 95000)); _events.ScheduleEvent(Misc.EventWarnBoneStorm, RandomHelper.URand(90000, 95000));
break; break;
case Misc.EventBoneStormBegin: case Misc.EventBoneStormBegin:
Aura pStorm = me.GetAura(Spells.BoneStorm); Aura pStorm = me.GetAura(SpellIds.BoneStorm);
if (pStorm != null) if (pStorm != null)
pStorm.SetDuration((int)_boneStormDuration); pStorm.SetDuration((int)_boneStormDuration);
me.SetSpeedRate(UnitMoveType.Run, _baseSpeed * 3.0f); me.SetSpeedRate(UnitMoveType.Run, _baseSpeed * 3.0f);
@@ -263,12 +263,12 @@ namespace Scripts.Northrend.IcecrownCitadel
}); });
// We should not melee attack when storming // We should not melee attack when storming
if (me.HasAura(Spells.BoneStorm)) if (me.HasAura(SpellIds.BoneStorm))
return; return;
// 10 seconds since encounter start Bone Slice replaces melee attacks // 10 seconds since encounter start Bone Slice replaces melee attacks
if (_boneSlice && !me.GetCurrentSpell(CurrentSpellTypes.Melee)) if (_boneSlice && !me.GetCurrentSpell(CurrentSpellTypes.Melee))
DoCastVictim(Spells.BoneSlice); DoCastVictim(SpellIds.BoneSlice);
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
@@ -355,7 +355,7 @@ namespace Scripts.Northrend.IcecrownCitadel
else else
pos.Relocate(owner); pos.Relocate(owner);
if (owner.HasAura(Spells.BoneStorm)) if (owner.HasAura(SpellIds.BoneStorm))
{ {
float ang = Position.NormalizeOrientation(pos.GetAngle(me)); float ang = Position.NormalizeOrientation(pos.GetAngle(me));
me.SetOrientation(ang); me.SetOrientation(ang);
@@ -376,7 +376,7 @@ namespace Scripts.Northrend.IcecrownCitadel
} }
me.NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me.GetPositionZ(), me.GetOrientation()); me.NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me.GetPositionZ(), me.GetOrientation());
DoCast(Spells.ColdflameSummon); DoCast(SpellIds.ColdflameSummon);
_events.ScheduleEvent(Misc.EventColdflameTrigger, 500); _events.ScheduleEvent(Misc.EventColdflameTrigger, 500);
} }
@@ -388,7 +388,7 @@ namespace Scripts.Northrend.IcecrownCitadel
{ {
Position newPos = me.GetNearPosition(5.0f, 0.0f); Position newPos = me.GetNearPosition(5.0f, 0.0f);
me.NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me.GetPositionZ(), me.GetOrientation()); me.NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me.GetPositionZ(), me.GetOrientation());
DoCast(Spells.ColdflameSummon); DoCast(SpellIds.ColdflameSummon);
_events.ScheduleEvent(Misc.EventColdflameTrigger, 500); _events.ScheduleEvent(Misc.EventColdflameTrigger, 500);
} }
} }
@@ -412,7 +412,7 @@ namespace Scripts.Northrend.IcecrownCitadel
{ {
Unit trapped = summ.GetSummoner(); Unit trapped = summ.GetSummoner();
if (trapped) if (trapped)
trapped.RemoveAurasDueToSpell(Spells.Impaled); trapped.RemoveAurasDueToSpell(SpellIds.Impaled);
} }
me.DespawnOrUnsummon(); me.DespawnOrUnsummon();
@@ -421,13 +421,13 @@ namespace Scripts.Northrend.IcecrownCitadel
public override void KilledUnit(Unit victim) public override void KilledUnit(Unit victim)
{ {
me.DespawnOrUnsummon(); me.DespawnOrUnsummon();
victim.RemoveAurasDueToSpell(Spells.Impaled); victim.RemoveAurasDueToSpell(SpellIds.Impaled);
} }
public override void IsSummonedBy(Unit summoner) public override void IsSummonedBy(Unit summoner)
{ {
DoCast(summoner, Spells.Impaled); DoCast(summoner, SpellIds.Impaled);
summoner.CastSpell(me, Spells.RideVehicle, true); summoner.CastSpell(me, SpellIds.RideVehicle, true);
_events.ScheduleEvent(Misc.EventFailBoned, 8000); _events.ScheduleEvent(Misc.EventFailBoned, 8000);
_hasTrappedUnit = true; _hasTrappedUnit = true;
} }
@@ -471,7 +471,7 @@ namespace Scripts.Northrend.IcecrownCitadel
{ {
targets.Clear(); targets.Clear();
// select any unit but not the tank // select any unit but not the tank
Unit target = GetCaster().GetAI().SelectTarget(SelectAggroTarget.Random, 1, -GetCaster().GetCombatReach(), true, false, -(int)Spells.Impaled); Unit target = GetCaster().GetAI().SelectTarget(SelectAggroTarget.Random, 1, -GetCaster().GetCombatReach(), true, false, -(int)SpellIds.Impaled);
if (!target) if (!target)
target = GetCaster().GetAI().SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); // or the tank if its solo target = GetCaster().GetAI().SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); // or the tank if its solo
if (!target) if (!target)
@@ -516,7 +516,7 @@ namespace Scripts.Northrend.IcecrownCitadel
{ {
bool CanBeAppliedOn(Unit target) bool CanBeAppliedOn(Unit target)
{ {
if (target.HasAura(Spells.Impaled)) if (target.HasAura(SpellIds.Impaled))
return false; return false;
SpellEffectInfo effect = GetSpellInfo().GetEffect(0); SpellEffectInfo effect = GetSpellInfo().GetEffect(0);
@@ -573,6 +573,17 @@ namespace Scripts.Northrend.IcecrownCitadel
foreach (var target in targets) foreach (var target in targets)
{ {
target.CastSpell(target, Misc.BoneSpikeSummonId[i], true); target.CastSpell(target, Misc.BoneSpikeSummonId[i], true);
if (!target.IsAlive()) // make sure we don't get any stuck spikes on dead targets
{
Aura aura = target.GetAura(SpellIds.Impaled);
if (aura != null)
{
Creature spike = ObjectAccessor.GetCreature(target, aura.GetCasterGUID());
if (spike != null)
spike.DespawnOrUnsummon();
aura.Remove();
}
}
i++; i++;
} }