SkyFire_548 icon indicating copy to clipboard operation
SkyFire_548 copied to clipboard

[SPELL/ROGUE/ASSASSINATION] Venomous Wounds

Open lingxDEV opened this issue 5 years ago • 1 comments

Current behaviour:

Venomous Wounds does nothing.

Does not restore energy on bleed ticks. Does not restore energy when a target afflicted by Rupture dies.

Expected behaviour:

Read tooltip.

Steps to reproduce the problem:

  1. Make a rogue
  • 2a - Spec into Assassination > Stack combo points > Use Rupture > Make sure you have poisons on > see that no energy is when Rupture does damage
  • 2b - Spec into Assassination > Stack combo points > Use Rupture > kill target > see that no energy is restored

SF rev. hash/commit:

Skyfire rev. 164451ca0b0b

SFDB version:

stable5

Operating system:

win10 64

lingxDEV avatar Sep 17 '20 20:09 lingxDEV

Found this script. It fixes the first point, bleeds now restores energy on ticks.

But the logic for Rupture restoring energy if target dies, does not work.

    ROGUE_SPELL_VENOMOUS_VIM_ENERGIZE               = 51637,
    ROGUE_SPELL_VENOMOUS_WOUND_DAMAGE               = 79136,
    ROGUE_SPELL_GARROTE_DOT                         = 703,
    ROGUE_SPELL_RUPTURE_DOT                         = 1943


// Called by Garrote - 703 and Rupture - 1943
// Venomous Wounds - 79134
class spell_rog_venomous_wounds : public SpellScriptLoader
{
public:
    spell_rog_venomous_wounds() : SpellScriptLoader("spell_rog_venomous_wounds") { }

    class spell_rog_venomous_wounds_AuraScript : public AuraScript
    {
        PrepareAuraScript(spell_rog_venomous_wounds_AuraScript);

        void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
        {
            if (Unit* caster = GetCaster())
            {
                if (Unit* target = GetTarget())
                {
                    if (caster->HasAura(79134))
                    {
                        // Each time your Rupture or Garrote deals damage to an enemy that you have poisoned ...
                        if (target->HasAura(8680, caster->GetGUID())
                            || target->HasAura(2818, caster->GetGUID())
                            || target->HasAura(5760, caster->GetGUID())
                            || target->HasAura(3409, caster->GetGUID())
                            || target->HasAura(113952, caster->GetGUID())
                            || target->HasAura(112961, caster->GetGUID()))
                        {
                            if (Aura* rupture = target->GetAura(ROGUE_SPELL_RUPTURE_DOT, caster->GetGUID()))
                            {
                                // ... you have a 75% chance ...
                                if (roll_chance_i(75))
                                {
                                    // ... to deal [ X + 16% of AP ] additional Nature damage and to regain 10 Energy
                                    caster->CastSpell(target, ROGUE_SPELL_VENOMOUS_WOUND_DAMAGE, true);
                                    int32 bp = 10;
                                    caster->CastCustomSpell(caster, ROGUE_SPELL_VENOMOUS_VIM_ENERGIZE, &bp, NULL, NULL, true);
                                }
                            }
                            // Garrote will not trigger this effect if the enemy is also afflicted by your Rupture
                            else if (Aura* garrote = target->GetAura(ROGUE_SPELL_GARROTE_DOT, caster->GetGUID()))
                            {
                                // ... you have a 75% chance ...
                                if (roll_chance_i(75))
                                {
                                    // ... to deal [ X + 16% of AP ] additional Nature damage and to regain 10 Energy
                                    caster->CastSpell(target, ROGUE_SPELL_VENOMOUS_WOUND_DAMAGE, true);
                                    int32 bp = 10;
                                    caster->CastCustomSpell(caster, ROGUE_SPELL_VENOMOUS_VIM_ENERGIZE, &bp, NULL, NULL, true);
                                }
                            }
                        }
                    }
                }
            }
        }

        void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
        {
            if (Unit* caster = GetCaster())
            {
                if (Unit* target = GetTarget())
                {
                    AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
                    if (removeMode == AURA_REMOVE_BY_DEATH && caster->ToPlayer()->GetSpecializationId(caster->ToPlayer()->GetActiveSpec()) == SPEC_ROGUE_ASSASSINATION)
                    {
                        if (Aura* rupture = aurEff->GetBase())
                        {
                            // If an enemy dies while afflicted by your Rupture, you regain energy proportional to the remaining Rupture duration
                            int32 duration = int32(rupture->GetDuration() / 1000);
                            caster->CastCustomSpell(caster, ROGUE_SPELL_VENOMOUS_VIM_ENERGIZE, &duration, NULL, NULL, true);
                        }
                    }
                }
            }
        }

        void Register()
        {
            OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_venomous_wounds_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
            AfterEffectRemove += AuraEffectRemoveFn(spell_rog_venomous_wounds_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
        }
    };

    AuraScript* GetAuraScript() const
    {
        return new spell_rog_venomous_wounds_AuraScript();
    }
};


new spell_rog_venomous_wounds();


INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('703', 'spell_rog_venomous_wounds');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('1943', 'spell_rog_venomous_wounds');

lingxDEV avatar Sep 19 '20 11:09 lingxDEV