Skip to content

Commit

Permalink
Spells/Druid Fix Shred damage (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
kytulendu authored and Traesh committed Aug 22, 2018
1 parent 6d34686 commit 895ee5b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sql/ashamane/world/2018_08_20_01_world_spell_shred.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `spell_id` = '5221';
INSERT INTO `spell_script_names` VALUE
(5221, "spell_dru_shred");
62 changes: 62 additions & 0 deletions src/server/scripts/Spells/spell_druid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2402,6 +2402,67 @@ class spell_dru_thrash_cat : public SpellScript
bool m_awardComboPoint = true;
};

// Shred - 5221
class spell_dru_shred : public SpellScript
{
PrepareSpellScript(spell_dru_shred);

bool Load() override
{
Unit* caster = GetCaster();

if (caster->HasAuraType(SPELL_AURA_MOD_STEALTH))
m_stealthed = true;

if (caster->HasAura(SPELL_DRUID_INCARNATION_KING_OF_JUNGLE))
m_incarnation = true;

m_casterLevel = caster->GetLevelForTarget(caster);

return true;
}

void HandleCritChance(Unit* /*victim*/, float& chance)
{
// If caster is level >= 56, While stealthed or have Incarnation: King of the Jungle aura,
// Double the chance to critically strike
if ((m_casterLevel >= 56) && (m_stealthed || m_incarnation))
chance *= 2.0f;
}

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

int32 damage = GetHitDamage();

// If caster is level >= 56, While stealthed or have Incarnation: King of the Jungle aura,
// deals 50% increased damage (get value from the spell data)
if ((m_casterLevel >= 56) && (m_stealthed || m_incarnation))
AddPct(damage, sSpellMgr->GetSpellInfo(SPELL_DRUID_SHRED)->GetEffect(EFFECT_3)->BasePoints);

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

SetHitDamage(damage);
}

void Register() override
{
OnCalcCritChance += SpellOnCalcCritChanceFn(spell_dru_shred::HandleCritChance);
OnEffectHitTarget += SpellEffectFn(spell_dru_shred::HandleOnEffectHitTarget, EFFECT_4, SPELL_EFFECT_DUMMY);
}

private:
bool m_stealthed = false;
bool m_incarnation = false;
int32 m_casterLevel;
};

void AddSC_druid_spell_scripts()
{
// Spells Scripts
Expand Down Expand Up @@ -2447,6 +2508,7 @@ void AddSC_druid_spell_scripts()
RegisterSpellScript(spell_dru_swipe);
RegisterSpellScript(spell_dru_brutal_slash);
RegisterSpellScript(spell_dru_thrash_cat);
RegisterSpellScript(spell_dru_shred);

RegisterSpellScript(spell_dru_thrash_bear);
RegisterAuraScript(aura_dru_thrash_bear);
Expand Down

0 comments on commit 895ee5b

Please sign in to comment.