From 405569dbffb0867952daf704c3f7db07471de42d Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 17 Jul 2020 16:21:37 +0200 Subject: [PATCH] Core/Spells: * fixed Kill Command * fixed Improved Kill Command crit chance bonus * fixed Frenzy not triggering Focus Fire's visual effect correctly closes #78 --- .../world/4.3.4/2020_07_17_00_world.sql | 3 ++ src/server/game/Entities/Unit/Unit.cpp | 13 ++++++- src/server/scripts/Spells/spell_hunter.cpp | 36 +++++++++++++++++-- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 sql/updates/world/4.3.4/2020_07_17_00_world.sql diff --git a/sql/updates/world/4.3.4/2020_07_17_00_world.sql b/sql/updates/world/4.3.4/2020_07_17_00_world.sql new file mode 100644 index 00000000000..a133f2ac1c5 --- /dev/null +++ b/sql/updates/world/4.3.4/2020_07_17_00_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_hun_kill_command'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(34026, 'spell_hun_kill_command'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 98a64b9d7ac..1705d0ca3c8 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6714,6 +6714,10 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin // Hunter Pet basic attacks (RAP * 0.4 * 0.2) if (spellProto->SpellFamilyFlags[0] & 0x00080000) DoneTotal += (owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.4f) * 0.2f; + + // Kill Command + if (spellProto->SpellFamilyFlags[1] & 0x00000800) + DoneTotal += owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.516f; break; case SPELLFAMILY_WARLOCK: // Warlock Minions inherit 50% of their owner's spell power @@ -7282,7 +7286,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto && spellProto->SpellIconID == 1680 && victim->HasAuraState(AURA_STATE_BLEEDING)) { - if (AuraEffect const* rendAndTear = GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1)) + if (AuraEffect const* rendAndTear = GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, EFFECT_1)) crit_chance += rendAndTear->GetAmount(); break; } @@ -7294,6 +7298,13 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto if (victim->GetHealthPct() >= healthAuraEff->GetAmount()) crit_chance += critAuraEff->GetAmount(); break; + case SPELLFAMILY_HUNTER: + // Kill Command - Improved Kill Command + if (spellProto->SpellFamilyFlags[1] & 0x00000800) + if (Player* player = GetSpellModOwner()) + if (AuraEffect const* improvedKillCommand = player->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 2221, EFFECT_0)) + crit_chance += improvedKillCommand->GetAmount(); + break; } } /* fallthrough - Calculate critical strike chance for both Ranged and Melee spells*/ diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 62ec33f9f3e..65019d42486 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -49,6 +49,7 @@ enum HunterSpells SPELL_HUNTER_FRENZY_EFFECT = 19615, SPELL_HUNTER_FOCUS_FIRE_ENERGIZE = 83468, SPELL_HUNTER_FOCUS_FIRE_DUMMY = 88843, + SPELL_HUNTER_FOCUS_FIRE = 82692, SPELL_HUNTER_GENERIC_ENERGIZE_FOCUS = 91954, SPELL_HUNTER_IMPROVED_MEND_PET = 24406, SPELL_HUNTER_IMPROVED_SERPENT_STING_DAMAGE = 83077, @@ -1670,14 +1671,19 @@ class spell_hun_frenzy_effect : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo({ SPELL_HUNTER_FOCUS_FIRE_DUMMY }); + return ValidateSpellInfo( + { + SPELL_HUNTER_FOCUS_FIRE_DUMMY, + SPELL_HUNTER_FOCUS_FIRE + }); } void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { if (GetStackAmount() == GetSpellInfo()->StackAmount) if (Unit* owner = GetTarget()->GetOwner()) - owner->CastSpell(owner, SPELL_HUNTER_FOCUS_FIRE_DUMMY, true, nullptr, aurEff); + if (owner->HasSpell(SPELL_HUNTER_FOCUS_FIRE)) + owner->CastSpell(owner, SPELL_HUNTER_FOCUS_FIRE_DUMMY, true, nullptr, aurEff); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -1688,11 +1694,34 @@ class spell_hun_frenzy_effect : public AuraScript void Register() override { - AfterEffectApply += AuraEffectApplyFn(spell_hun_frenzy_effect::AfterApply, EFFECT_0, SPELL_AURA_MOD_MELEE_HASTE_3, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + AfterEffectApply += AuraEffectApplyFn(spell_hun_frenzy_effect::AfterApply, EFFECT_0, SPELL_AURA_MOD_MELEE_HASTE_3, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); AfterEffectRemove += AuraEffectRemoveFn(spell_hun_frenzy_effect::AfterRemove, EFFECT_0, SPELL_AURA_MOD_MELEE_HASTE_3, AURA_EFFECT_HANDLE_REAL); } }; +// 34026 - Kill Command +class spell_hun_kill_command: public SpellScript +{ + PrepareSpellScript(spell_hun_kill_command); + + void HandleScriptEffect(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (!caster || !caster->IsPlayer()) + return; + + Player* player = caster->ToPlayer(); + if (Pet* pet = player->GetPet()) + if (Unit* target = pet->GetVictim()) + pet->CastSpell(target, GetSpellInfo()->Effects[effIndex].BasePoints, false); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_hun_kill_command::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_hunter_spell_scripts() { new spell_hun_ancient_hysteria(); @@ -1709,6 +1738,7 @@ void AddSC_hunter_spell_scripts() RegisterAuraScript(spell_hun_glyph_of_kill_shot); new spell_hun_improved_mend_pet(); RegisterSpellScript(spell_hun_invigoration); + RegisterSpellScript(spell_hun_kill_command); new spell_hun_last_stand_pet(); new spell_hun_lock_and_load(); RegisterAuraScript(spell_hun_marked_for_death);