From 5be03870b5db1827fd1828271e9fe980b0e78dbc Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 23 Aug 2020 00:51:52 +0200 Subject: [PATCH] Core/Spells: * fixed Hunter Fervor talent * fixed Hunter Killing Streak talent * fixed Crouching Tiger, Hidden Chimera talent * allow controlled units to proc the auras of their owner when dealing spell damage --- .../world/4.3.4/2020_08_23_00_world.sql | 18 +++ src/server/game/Spells/Spell.cpp | 4 + src/server/scripts/Spells/spell_hunter.cpp | 137 ++++++++++++++++++ src/server/scripts/Spells/spell_warlock.cpp | 3 - 4 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/4.3.4/2020_08_23_00_world.sql diff --git a/sql/updates/world/4.3.4/2020_08_23_00_world.sql b/sql/updates/world/4.3.4/2020_08_23_00_world.sql new file mode 100644 index 0000000000..1328e79c68 --- /dev/null +++ b/sql/updates/world/4.3.4/2020_08_23_00_world.sql @@ -0,0 +1,18 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_hun_fervor', +'spell_hun_killing_streak', +'spell_hun_crouching_tiger_hidden_chimera'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(82726, 'spell_hun_fervor'), +(-82748, 'spell_hun_killing_streak'), +(-82898, 'spell_hun_crouching_tiger_hidden_chimera'); + +DELETE FROM `spell_proc` WHERE `SpellId` IN (-82748, 94006, 94007, -82898); +INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellFamilyMask1`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `Chance`, `AttributesMask`) VALUES +(-82748, 9, 0x800, 0x00055554, 1, 2, 0, 100, 0x20), +(94006, 9, 0x800, 0, 4, 2, 0, 0, 0x8 | 0x20), +(94007, 9, 0x800, 0, 4, 2, 0, 0, 0x8 | 0x20); + +INSERT INTO `spell_proc` (`SpellId`, `Cooldown`) VALUES +(-82898, 2000); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index fb3e731f6e..33ca1a6894 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2676,6 +2676,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) DamageInfo spellDamageInfo(damageInfo, SPELL_DIRECT_DAMAGE, m_attackType, hitMask); caster->ProcSkillsAndAuras(unitTarget, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, this, &spellDamageInfo, nullptr); + // Controlled units should trigger procs for their owner as well + if (Unit* owner = caster->GetOwner()) + owner->ProcSkillsAndAuras(unitTarget, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, this, &spellDamageInfo, nullptr); + if (caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET) && !m_spellInfo->HasAttribute(SPELL_ATTR4_CANT_TRIGGER_ITEM_SPELLS) && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) caster->ToPlayer()->CastItemCombatSpell(spellDamageInfo); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 8fa2a5c3bc..8a0aea6cdd 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -45,6 +45,9 @@ enum HunterSpells SPELL_HUNTER_CAMOUFLAGE_PERIODIC_TRIGGERED = 80325, SPELL_HUNTER_CHIMERA_SHOT = 53209, SPELL_HUNTER_CHIMERA_SHOT_HEAL = 53353, + SPELL_HUNTER_DISENGAGE = 781, + SPELL_HUNTER_DETERRENCE = 19263, + SPELL_HUNTER_FERVOR_PET_ENERGIZE = 82728, SPELL_HUNTER_FIRE = 82926, SPELL_HUNTER_FRENZY_EFFECT = 19615, SPELL_HUNTER_FOCUS_FIRE_ENERGIZE = 83468, @@ -56,6 +59,8 @@ enum HunterSpells SPELL_HUNTER_INSANITY = 95809, SPELL_HUNTER_INVIGORATION_TRIGGERED = 53398, SPELL_HUNTER_GLYPH_OF_KILL_SHOT_COOLDOWN = 90967, + SPELL_HUNTER_KILLING_STREAK_TRIGGERED_R1 = 94006, + SPELL_HUNTER_KILLING_STREAK_TRIGGERED_R2 = 94007, SPELL_HUNTER_LOCK_AND_LOAD = 56453, SPELL_HUNTER_MARKED_FOR_DEATH_TRIGGERED = 88691, SPELL_HUNTER_MASTERS_CALL_TRIGGERED = 62305, @@ -1717,6 +1722,135 @@ class spell_hun_kill_command: public SpellScript } }; +// 82726 - Fervor +class spell_hun_fervor : public SpellScript +{ + PrepareSpellScript(spell_hun_fervor); + + bool Load() override + { + return GetCaster()->IsPlayer(); + } + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HUNTER_FERVOR_PET_ENERGIZE }); + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + Player* player = caster->ToPlayer(); + if (Pet* pet = player->GetPet()) + player->CastSpell(pet, SPELL_HUNTER_FERVOR_PET_ENERGIZE, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_hun_fervor::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_ENERGIZE); + } +}; + +std::array const KillingStreakTriggerSpells = +{ + SPELL_HUNTER_KILLING_STREAK_TRIGGERED_R1, + SPELL_HUNTER_KILLING_STREAK_TRIGGERED_R2 +}; + +// -82748 - Killing Streak +class spell_hun_killing_streak : public AuraScript +{ + PrepareAuraScript(spell_hun_killing_streak); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_HUNTER_KILLING_STREAK_TRIGGERED_R1, + SPELL_HUNTER_KILLING_STREAK_TRIGGERED_R2 + }); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + if (!(eventInfo.GetHitMask() & PROC_HIT_CRITICAL)) + _firstCrit = false; + else + { + if (_firstCrit) + { + GetTarget()->CastSpell(GetTarget(), KillingStreakTriggerSpells[GetSpellInfo()->GetRank() - 1], true, nullptr, aurEff); + _firstCrit = false; + } + else + _firstCrit = true; + } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_hun_killing_streak::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } + +private: + bool _firstCrit = false; +}; + +// -82898 - Crouching Tiger, Hidden Chimera +class spell_hun_crouching_tiger_hidden_chimera : public AuraScript +{ + PrepareAuraScript(spell_hun_crouching_tiger_hidden_chimera); + + bool Load() override + { + return GetCaster()->IsPlayer(); + } + + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetDamageInfo(); + } + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_HUNTER_DISENGAGE, + SPELL_HUNTER_DETERRENCE + }); + } + + void HandleDisengageProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + if (eventInfo.GetDamageInfo()->GetAttackType() != BASE_ATTACK && eventInfo.GetDamageInfo()->GetAttackType() != OFF_ATTACK) + return; + + GetTarget()->GetSpellHistory()->ModifyCooldown(SPELL_HUNTER_DISENGAGE, -aurEff->GetAmount()); + } + + void HandleDeterrenceProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + if (eventInfo.GetDamageInfo()->GetAttackType() != RANGED_ATTACK) + return; + + GetTarget()->GetSpellHistory()->ModifyCooldown(SPELL_HUNTER_DETERRENCE, -aurEff->GetAmount()); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_hun_crouching_tiger_hidden_chimera::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_hun_crouching_tiger_hidden_chimera::HandleDisengageProc, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectProc += AuraEffectProcFn(spell_hun_crouching_tiger_hidden_chimera::HandleDeterrenceProc, EFFECT_1, SPELL_AURA_DUMMY); + } +}; + void AddSC_hunter_spell_scripts() { new spell_hun_ancient_hysteria(); @@ -1726,13 +1860,16 @@ void AddSC_hunter_spell_scripts() RegisterAuraScript(spell_hun_camouflage_triggered); new spell_hun_chimera_shot(); new spell_hun_cobra_shot(); + RegisterAuraScript(spell_hun_crouching_tiger_hidden_chimera); new spell_hun_disengage(); + RegisterSpellScript(spell_hun_fervor); new spell_hun_fire(); RegisterAuraScript(spell_hun_focus_fire); RegisterAuraScript(spell_hun_frenzy_effect); RegisterAuraScript(spell_hun_glyph_of_kill_shot); new spell_hun_improved_mend_pet(); RegisterSpellScript(spell_hun_invigoration); + RegisterAuraScript(spell_hun_killing_streak); RegisterSpellScript(spell_hun_kill_command); new spell_hun_last_stand_pet(); new spell_hun_lock_and_load(); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 4bbb3fbcd7..2231065ee4 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -1868,9 +1868,6 @@ class spell_warl_burning_embers : public AuraScript { PreventDefaultAction(); Unit* target = GetTarget(); - if (target->IsCreature() && target->GetOwner()) - target = GetTarget()->GetOwner(); - uint8 maxTicks = sSpellMgr->AssertSpellInfo(SPELL_WARLOCK_BURNING_EMBERS_DAMAGE)->GetMaxTicks(); int32 damageBp = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / maxTicks; float coefficient = GetSpellInfo()->GetRank() * 0.7f;