jordan83221

Guile

Aug 31st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.89 KB | None | 0 0
  1. /// Bandit's Guile - 84654
  2. class spell_rog_bandits_guile : public SpellScriptLoader
  3. {
  4. public:
  5.     spell_rog_bandits_guile() : SpellScriptLoader("spell_rog_bandits_guile") { }
  6.  
  7.     class spell_rog_bandits_guile_SpellScript : public SpellScript
  8.     {
  9.         PrepareSpellScript(spell_rog_bandits_guile_SpellScript);
  10.  
  11.         void HandleOnHit()
  12.         {
  13.             if (Player* _player = GetCaster()->ToPlayer())
  14.             {
  15.                 if (Unit* target = GetHitUnit())
  16.                 {
  17.                     _player->insightCount++;
  18.  
  19.                     // it takes a total of 4 strikes to get a proc, or a level up
  20.                     if (_player->insightCount >= 4)
  21.                     {
  22.                         _player->insightCount = 0;
  23.  
  24.                         // it takes 4 strikes to get Shallow insight
  25.                         // than 4 strikes to get Moderate insight
  26.                         // and than 4 strikes to get Deep Insight
  27.  
  28.                         // Shallow Insight
  29.                         if (_player->HasAura(84745))
  30.                         {
  31.                             _player->RemoveAura(84745);
  32.                             _player->AddAura(84746, _player); // Moderate Insight
  33.                         }
  34.                         else if (_player->HasAura(84746))
  35.                         {
  36.                             _player->RemoveAura(84746);
  37.                             _player->AddAura(84747, _player); // Deep Insight
  38.                         }
  39.                         // the cycle will begin
  40.                         else if (!_player->HasAura(84747))
  41.                             _player->AddAura(84745, _player); // Shallow Insight
  42.                     }
  43.                     else
  44.                     {
  45.                         // Each strike refreshes the duration of shallow insight or Moderate insight
  46.                         // but you can't refresh Deep Insight without starting from shallow insight.
  47.                         // Shallow Insight
  48.                         if (AuraPtr shallowInsight = _player->GetAura(84745))
  49.                             shallowInsight->RefreshDuration();
  50.                         // Moderate Insight
  51.                         else if (AuraPtr moderateInsight = _player->GetAura(84746))
  52.                             moderateInsight->RefreshDuration();
  53.                     }
  54.                 }
  55.             }
  56.         }
  57.         void Register()
  58.         {
  59.             OnHit += SpellHitFn(spell_rog_bandits_guile_SpellScript::HandleOnHit);
  60.         }
  61.     };
  62.     SpellScript* GetSpellScript() const
  63.     {
  64.         return new spell_rog_bandits_guile_SpellScript();
  65.     }
  66. };
Add Comment
Please, Sign In to add comment