fix(Scripts/ZulGurub): Hakkar's Blood Siphon (#12196)

This commit is contained in:
UltraNix
2022-07-09 16:05:09 +02:00
committed by GitHub
parent 32ba21d029
commit 346150c92a
12 changed files with 90 additions and 44 deletions

View File

@@ -3439,7 +3439,7 @@ bool Creature::IsMovementPreventedByCasting() const
{
Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL];
// first check if currently a movement allowed channel is active and we're not casting
if (spell && spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive() && spell->GetSpellInfo()->IsMoveAllowedChannel())
if (spell && spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive() && spell->GetSpellInfo()->IsActionAllowedChannel())
{
return false;
}

View File

@@ -3622,8 +3622,12 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
{
// generic spells always break channeled not delayed spells
if (Spell* s = GetCurrentSpell(CURRENT_CHANNELED_SPELL))
if (s->GetSpellInfo()->Id != 69051) // pussywizard: FoS, boss Devourer of Souls, Mirrored Soul, does not have any special attribute
{
if (!s->GetSpellInfo()->IsActionAllowedChannel())
{
InterruptSpell(CURRENT_CHANNELED_SPELL, false);
}
}
// autorepeat breaking
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
@@ -3658,7 +3662,14 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
if (pSpell->m_spellInfo->Id != 75)
{
// generic autorepeats break generic non-delayed and channeled non-delayed spells
InterruptSpell(CURRENT_GENERIC_SPELL, false);
if (Spell* s = GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
if (!s->GetSpellInfo()->IsActionAllowedChannel())
{
InterruptSpell(CURRENT_CHANNELED_SPELL, false);
}
}
InterruptSpell(CURRENT_CHANNELED_SPELL, false);
}
// special action: set first cast flag
@@ -3793,7 +3804,7 @@ bool Unit::IsMovementPreventedByCasting() const
{
if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
{
if (spell->GetSpellInfo()->IsMoveAllowedChannel())
if (spell->GetSpellInfo()->IsActionAllowedChannel())
{
return false;
}
@@ -3804,15 +3815,6 @@ bool Unit::IsMovementPreventedByCasting() const
return true;
}
bool Unit::CanMoveDuringChannel() const
{
if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL])
if (spell->getState() != SPELL_STATE_FINISHED)
return spell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_ALLOW_ACTION_DURING_CHANNEL) && spell->IsChannelActive();
return false;
}
bool Unit::isInFrontInMap(Unit const* target, float distance, float arc) const
{
return IsWithinDistInMap(target, distance) && HasInArc(arc, target);

View File

@@ -2029,9 +2029,6 @@ public:
// delayed+channeled spells are always interrupted
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0, bool withInstant = true, bool bySelf = false);
// Check if our current channel spell has attribute SPELL_ATTR5_ALLOW_ACTION_DURING_CHANNEL
[[nodiscard]] bool CanMoveDuringChannel() const;
[[nodiscard]] Spell* GetCurrentSpell(CurrentSpellTypes spellType) const { return m_currentSpells[spellType]; }
[[nodiscard]] Spell* GetCurrentSpell(uint32 spellType) const { return m_currentSpells[spellType]; }
[[nodiscard]] Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;

View File

@@ -491,7 +491,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
if (!spellInfo)
return;
// not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
// not allow remove spells with attr SPELL_ATTR0_NO_AURA_CANCEL
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL))
{
return;
@@ -569,12 +569,33 @@ void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPacket& /*recvPacket*/
void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
{
recvData.read_skip<uint32>(); // spellid, not used
uint32 spellID = 0;
recvData >> spellID;
// ignore for remote control state (for player case)
Unit* mover = _player->m_mover;
if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
if (!mover)
{
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
if (!spellInfo)
{
return;
}
// not allow remove spells with attr SPELL_ATTR0_NO_AURA_CANCEL
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL))
{
return;
}
Spell* spell = mover->GetCurrentSpell(CURRENT_CHANNELED_SPELL);
if (!spell || spell->GetSpellInfo()->Id != spellInfo->Id)
{
return;
}
mover->InterruptSpell(CURRENT_CHANNELED_SPELL);
}

View File

@@ -3555,9 +3555,13 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT && !IsTriggered())
{
SendCastResult(SPELL_FAILED_MOVING);
finish(false);
return SPELL_FAILED_MOVING;
// 1. Has casttime, 2. Or doesn't have flag to allow action during channel
if (m_casttime || !m_spellInfo->IsActionAllowedChannel())
{
SendCastResult(SPELL_FAILED_MOVING);
finish(false);
return SPELL_FAILED_MOVING;
}
}
// xinef: if spell have nearby target entry only, do not allow to cast if no targets are found

View File

@@ -1241,7 +1241,7 @@ bool SpellInfo::IsChanneled() const
return (AttributesEx & (SPELL_ATTR1_IS_CHANNELED | SPELL_ATTR1_IS_SELF_CHANNELED));
}
bool SpellInfo::IsMoveAllowedChannel() const
bool SpellInfo::IsActionAllowedChannel() const
{
return IsChanneled() && HasAttribute(SPELL_ATTR5_ALLOW_ACTION_DURING_CHANNEL);
}

View File

@@ -457,7 +457,7 @@ public:
bool IsPositive() const;
bool IsPositiveEffect(uint8 effIndex) const;
bool IsChanneled() const;
[[nodiscard]] bool IsMoveAllowedChannel() const;
[[nodiscard]] bool IsActionAllowedChannel() const;
bool NeedsComboPoints() const;
bool IsBreakingStealth() const;
bool IsRangedWeaponSpell() const;

View File

@@ -4301,6 +4301,16 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_0].MiscValueB = 64;
});
// Blood Siphon
ApplySpellFix({ 24322, 24323 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_1].ApplyAuraName = SPELL_AURA_MOD_STUN;
spellInfo->Effects[EFFECT_2].Effect = 0;
spellInfo->Attributes |= SPELL_ATTR0_NO_AURA_CANCEL;
spellInfo->AttributesEx5 |= SPELL_ATTR5_ALLOW_ACTION_DURING_CHANNEL;
spellInfo->ChannelInterruptFlags &= ~AURA_INTERRUPT_FLAG_MOVE;
});
// Place Fake Fur
ApplySpellFix({ 46085 }, [](SpellInfo* spellInfo)
{