fix(Scripts/ZulGurub): Mandokir's Threatening Gaze. (#12095)

* fix(Scripts/ZulGurub: Mandokir's Threatening Gaze.

Boss can melee attack while casting.
Boss charges after the debuff run out.
Guillotine is casted on hit rather than on launch.
Properly coded Threatening Gaze Charge (with dot/hot exceptions)
Whirlwind is removed during charge.
Fixes #11748

* Update

* missing

* Update

* Update.

* Update.

* Update.

* Update.

* Update.
This commit is contained in:
UltraNix
2022-06-26 09:50:50 +02:00
committed by GitHub
parent 255c5d8b72
commit ea24a7b231
9 changed files with 166 additions and 23 deletions

View File

@@ -207,6 +207,9 @@ public:
static bool IsInBounds(CreatureBoundary const& boundary, Position const* who);
bool IsInBoundary(Position const* who = nullptr) const;
virtual void CalculateThreat(Unit* /*hatedUnit*/, float& /*threat*/, SpellInfo const* /*threatSpell*/) { }
protected:
virtual void MoveInLineOfSight(Unit* /*who*/);

View File

@@ -38,12 +38,23 @@ void HostileRefMgr::threatAssist(Unit* victim, float baseThreat, SpellInfo const
return;
HostileReference* ref = getFirst();
float threat = ThreatCalcHelper::calcThreat(victim, iOwner, baseThreat, (threatSpell ? threatSpell->GetSchoolMask() : SPELL_SCHOOL_MASK_NORMAL), threatSpell);
float threat = ThreatCalcHelper::calcThreat(victim, baseThreat, (threatSpell ? threatSpell->GetSchoolMask() : SPELL_SCHOOL_MASK_NORMAL), threatSpell);
threat /= getSize();
while (ref)
{
if (ThreatCalcHelper::isValidProcess(victim, ref->GetSource()->GetOwner(), threatSpell))
Unit* refOwner = ref->GetSource()->GetOwner();
if (ThreatCalcHelper::isValidProcess(victim, refOwner, threatSpell))
{
if (Creature* hatingCreature = refOwner->ToCreature())
{
if (hatingCreature->IsAIEnabled)
{
hatingCreature->AI()->CalculateThreat(victim, threat, threatSpell);
}
}
ref->GetSource()->doAddThreat(victim, threat);
}
ref = ref->next();
}

View File

@@ -32,11 +32,11 @@
//==============================================================
// The hatingUnit is not used yet
float ThreatCalcHelper::calcThreat(Unit* hatedUnit, Unit* /*hatingUnit*/, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
float ThreatCalcHelper::calcThreat(Unit* hatedUnit, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
{
if (threatSpell)
{
if (SpellThreatEntry const* threatEntry = sSpellMgr->GetSpellThreatEntry(threatSpell->Id))
if (SpellThreatEntry const* threatEntry = sSpellMgr->GetSpellThreatEntry(threatSpell->Id))
if (threatEntry->pctMod != 1.0f)
threat *= threatEntry->pctMod;
@@ -427,10 +427,19 @@ void ThreatMgr::clearReferences()
void ThreatMgr::addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
{
if (!ThreatCalcHelper::isValidProcess(victim, GetOwner(), threatSpell))
if (!ThreatCalcHelper::isValidProcess(victim, iOwner, threatSpell))
return;
doAddThreat(victim, ThreatCalcHelper::calcThreat(victim, iOwner, threat, schoolMask, threatSpell));
threat = ThreatCalcHelper::calcThreat(victim, threat, schoolMask, threatSpell);
if (Creature* hatingCreature = iOwner->ToCreature())
{
if (hatingCreature->IsAIEnabled)
{
hatingCreature->AI()->CalculateThreat(victim, threat, threatSpell);
}
}
doAddThreat(victim, threat);
}
void ThreatMgr::doAddThreat(Unit* victim, float threat)

View File

@@ -39,7 +39,7 @@ class SpellInfo;
struct ThreatCalcHelper
{
static float calcThreat(Unit* hatedUnit, Unit* hatingUnit, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
static float calcThreat(Unit* hatedUnit, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
static bool isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellInfo const* threatSpell = nullptr);
};

View File

@@ -2329,14 +2329,14 @@ void Unit::CalcHealAbsorb(HealInfo& healInfo)
healInfo.AbsorbHeal(absorbAmount);
}
void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extra)
void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BASE_ATTACK*/, bool extra /*= false*/, bool ignoreCasting /*= false*/)
{
if (HasUnitFlag(UNIT_FLAG_PACIFIED))
{
return;
}
if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) && !extra)
if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) && !extra && !ignoreCasting)
{
return;
}

View File

@@ -1533,7 +1533,7 @@ public:
void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, std::list<AuraApplication*>& procAuras);
void HandleEmoteCommand(uint32 emoteId);
void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false);
void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false, bool ignoreCasting = false);
void CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* damageInfo, WeaponAttackType attackType = BASE_ATTACK, const bool sittingVictim = false);
void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss);

View File

@@ -1363,12 +1363,6 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_0].Amplitude = 15000;
});
// Threatening Gaze
ApplySpellFix({ 24314 }, [](SpellInfo* spellInfo)
{
spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CAST;
});
// Frightening Shout
ApplySpellFix({ 19134 }, [](SpellInfo* spellInfo)
{