Skip to content

Commit

Permalink
Spells/Druid Fix Swipe and Brutal Slash not awards Combo Point. (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
kytulendu authored and Traesh committed Aug 16, 2018
1 parent 0159407 commit 6a2195a
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sql/ashamane/world/2018_08_15_01_world_spell_druid.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (106785, 202028);
INSERT INTO `spell_script_names` VALUE
(106785, "spell_dru_swipe"),
(202028, "spell_dru_brutal_slash");
69 changes: 69 additions & 0 deletions src/server/scripts/Spells/spell_druid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2307,6 +2307,73 @@ class aura_dru_charm_woodland_creature : public AuraScript
}
};

// Swipe - 106785
class spell_dru_swipe : public SpellScript
{
PrepareSpellScript(spell_dru_swipe);

void HandleOnHit(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
return;

int32 damage = GetHitDamage();
int32 casterLevel = caster->GetLevelForTarget(caster);

// This prevent awarding multiple Combo Points when multiple targets hit with Swipe AoE
if(m_awardComboPoint)
// Awards the caster 1 Combo Point (get value from the spell data)
caster->ModifyPower(POWER_COMBO_POINTS, sSpellMgr->GetSpellInfo(SPELL_DRUID_SWIPE_CAT)->GetEffect(EFFECT_0)->BasePoints);

// If caster is level >= 44 and the target is bleeding, deals 20% increased damage (get value from the spell data)
if ((casterLevel >= 44) && target->HasAuraState(AURA_STATE_BLEEDING))
AddPct(damage, sSpellMgr->GetSpellInfo(SPELL_DRUID_SWIPE_CAT)->GetEffect(EFFECT_1)->BasePoints);

SetHitDamage(damage);

m_awardComboPoint = false;
}

void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dru_swipe::HandleOnHit, EFFECT_1, SPELL_EFFECT_DUMMY);
}

private:
bool m_awardComboPoint = true;
};

// Brutal Slash - 202028
class spell_dru_brutal_slash : public SpellScript
{
PrepareSpellScript(spell_dru_brutal_slash);

void HandleOnHit(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
return;

// This prevent awarding multiple Combo Points when multiple targets hit with Brutal Slash AoE
if(m_awardComboPoint)
// Awards the caster 1 Combo Point (get value from the spell data)
caster->ModifyPower(POWER_COMBO_POINTS, sSpellMgr->GetSpellInfo(SPELL_DRUID_SWIPE_CAT)->GetEffect(EFFECT_0)->BasePoints);

m_awardComboPoint = false;
}

void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dru_brutal_slash::HandleOnHit, EFFECT_0, SPELL_EFFECT_DUMMY);
}

private:
bool m_awardComboPoint = true;
};

void AddSC_druid_spell_scripts()
{
// Spells Scripts
Expand Down Expand Up @@ -2349,6 +2416,8 @@ void AddSC_druid_spell_scripts()
new spell_dru_travel_form_dummy();
new spell_dru_travel_form();
RegisterAuraScript(aura_dru_charm_woodland_creature);
RegisterSpellScript(spell_dru_swipe);
RegisterSpellScript(spell_dru_brutal_slash);

RegisterSpellScript(spell_dru_thrash);
RegisterAuraScript(spell_dru_thrash_periodic_damage);
Expand Down

0 comments on commit 6a2195a

Please sign in to comment.