ProjectSkyfire / SkyFire_548

SkyFireEMU is a full featured World of Warcraft: Mists of Pandaria emulator written in C++. || Compatible with World of Warcraft client 5.4.8 (Build: 18414) Project Established in 2011 || Support on Discord https://discord.gg/DnKZycD
http://www.projectskyfire.org
GNU General Public License v3.0
499 stars 421 forks source link

[SPELL/ROGUE] Relentless Strikes #943

Open lingxDEV opened 4 years ago

lingxDEV commented 4 years ago

Current behaviour:

Relentless Strikes does nothing.

Expected behaviour:

As the tooltip states.

Steps to reproduce the problem:

  1. Make a rogue
  2. Stack 5 combo points > use a finisher > see that you do not restore any energy

SF rev. hash/commit:

Skyfire rev. 7f1a4abd1b9f+

SFDB version:

stable5

Operating system:

win10 64

lingxDEV commented 4 years ago

This is what I have so far - working as intended.

    SPELL_ROGUE_RELENTLESS_STRIKES                  = 58423,
    SPELL_ROGUE_RELENTLESS_STRIKES_ENERGIZE         = 98440

// Called by all finishing moves (Eviscerate 2098, Kidney Shot 408, Slice and Dice 5171, Rupture 1943, Crimson Tempest 121411)
// Relentless Strikes - 58423
class spell_rog_relentless_strikes : public SpellScriptLoader
{
public:
    spell_rog_relentless_strikes() : SpellScriptLoader("spell_rog_relentless_strikes") { }

    class spell_rog_relentless_strikes_SpellScript : public SpellScript
    {
        PrepareSpellScript(spell_rog_relentless_strikes_SpellScript);

        void HandleAfterHit()
        {
            if (!GetCaster())
                return;

            if (Player* _player = GetCaster()->ToPlayer())
            {
                if (Unit* target = GetHitUnit())
                {
                    if (_player->HasAura(SPELL_ROGUE_RELENTLESS_STRIKES))
                    {
                        uint32 cp = _player->GetComboPoints();
                        if (roll_chance_i(cp * 20))
                            _player->CastSpell(_player, SPELL_ROGUE_RELENTLESS_STRIKES_ENERGIZE, true);
                    }
                }
            }
        }

        void Register()
        {
            AfterHit += SpellHitFn(spell_rog_relentless_strikes_SpellScript::HandleAfterHit);
        }
    };

    SpellScript* GetSpellScript() const
    {
        return new spell_rog_relentless_strikes_SpellScript();
    }
};

    new spell_rog_relentless_strikes();

INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('408', 'spell_rog_relentless_strikes');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('1943', 'spell_rog_relentless_strikes');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('2098', 'spell_rog_relentless_strikes');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('5171', 'spell_rog_relentless_strikes');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('121411', 'spell_rog_relentless_strikes');