diff options
| author | Rothend <67004168+Rothend@users.noreply.github.com> | 2020-06-24 21:08:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-24 21:08:39 +0200 |
| commit | 50a9c49c888a2ab41dcc6b167ad2fe2c22644860 (patch) | |
| tree | 1e90eca52b139c4064a7bfa829c7884ce6fb051d /src | |
| parent | 93fee78c3c6b9277d884ee710b7efc20e93452ba (diff) | |
Core/Spell: fix ammo consumption for Hunter's non-damaging spells. (#24819)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index a03600a0d74..4c090b032d6 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7458,23 +7458,22 @@ void Spell::HandleLaunchPhase() HandleEffects(nullptr, nullptr, nullptr, i, SPELL_EFFECT_HANDLE_LAUNCH); } - bool usesAmmo; + PrepareTargetProcessing(); + + // Take ammunition if the ranged attack requires ammunition if (Player* player = m_caster->ToPlayer()) { - usesAmmo = m_spellInfo->HasAttribute(SPELL_ATTR0_CU_DIRECT_DAMAGE); + bool usesAmmo = m_spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO); if (player->HasAuraTypeWithAffectMask(SPELL_AURA_ABILITY_CONSUME_NO_AMMO, m_spellInfo)) usesAmmo = false; - // do not consume ammo anymore for Hunter's volley spell + // Do not consume ammo for the triggered AoE ticks of Volley (Hunter spell) if (IsTriggered() && m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->IsTargetingArea()) usesAmmo = false; - } - else - usesAmmo = false; - - PrepareTargetProcessing(); - bool ammoTaken = false; + if (usesAmmo) + TakeAmmo(); + } for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { @@ -7488,32 +7487,6 @@ void Spell::HandleLaunchPhase() if (!(mask & (1 << i))) continue; - if (usesAmmo && !ammoTaken) - { - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (!(mask & 1 << j)) - continue; - - switch (m_spellInfo->Effects[j].Effect) - { - case SPELL_EFFECT_SCHOOL_DAMAGE: - case SPELL_EFFECT_WEAPON_DAMAGE: - case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: - case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: - case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: - ammoTaken = true; - TakeAmmo(); - break; - default: - break; - } - - if (ammoTaken) - break; - } - } - DoEffectOnLaunchTarget(target, multiplier, i); } } |
