Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.89 KB | None | 0 0
  1. #include "precompiled.h"
  2. #include "gundrak.h"
  3.  
  4.        
  5.    
  6. //Eck the Ferocious
  7.      
  8.    
  9.       #define POINT_X      1643.877930
  10.       #define POINT_Y      936.278015
  11.       #define POINT_Z      107.204948
  12.       #define POINT_O      0.668432
  13.      
  14.  
  15.        
  16. enum Spells
  17.  
  18.       {
  19.  
  20.            EMOTE_ECK_BERSERK            = -1533021,
  21.            
  22.        SPELL_ECK_BERSERK               = 55816,
  23.            SPELL_ECK_BITE                  = 55813,
  24.            SPELL_ECK_SPIT                  = 55814,
  25.            SPELL_ECK_SPRING_1              = 55815,
  26.            SPELL_ECK_SPRING_2              = 55837
  27.  
  28.            
  29.        
  30.  
  31.       };
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. struct MANGOS_DLL_DECL boss_EckAI : public ScriptedAI
  39.  
  40.       {
  41.  
  42.           boss_EckAI(Creature* pCreature) : ScriptedAI(pCreature)
  43.  
  44.           {
  45.  
  46.               m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
  47.               m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  48.  
  49.               Reset();
  50.  
  51.        
  52.  
  53.           }
  54.  
  55.           ScriptedInstance* m_pInstance;
  56.  
  57.               bool m_bIsRegularMode;
  58.  
  59.        
  60.  
  61.               uint32 m_uiSPELL_ECK_BERSERK_TIMER;
  62.               uint32 m_uiSPELL_ECK_BITE_TIMER;
  63.               uint32 m_uiSPELL_ECK_SPIT_TIMER;
  64.               uint32 m_uiSPELL_ECK_SPRING_TIMER;
  65.  
  66.               bool m_bBerserk;
  67.  
  68. void Reset()
  69.  
  70.               {
  71.  
  72.                       m_uiSPELL_ECK_BERSERK_TIMER = urand(60000, 90000);
  73.                       m_uiSPELL_ECK_BITE_TIMER = 5000;
  74.                       m_uiSPELL_ECK_SPIT_TIMER = 15000;
  75.                       m_uiSPELL_ECK_SPRING_TIMER = 8000;
  76.  
  77.               m_bBerserk = false;
  78.  
  79.                 if (m_pInstance)
  80.  
  81.                       m_pInstance->SetData(TYPE_ECK, NOT_STARTED);
  82.  
  83.               }
  84.  
  85.        
  86.  
  87. void Aggro(Unit* who)
  88.  
  89.               {
  90.  
  91.                       if(m_pInstance)
  92.                        m_pInstance->SetData(TYPE_ECK, IN_PROGRESS);
  93.  
  94.               }
  95.  
  96.        
  97.  
  98. void DeleteFromThreatList(uint64 TargetGUID)
  99.  
  100.               {
  101.  
  102.                     for (std::list<HostileReference*>::const_iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr !=      m_creature->getThreatManager().getThreatList().end(); ++itr)
  103.  
  104.                       {
  105.  
  106.                               if ((*itr)->getUnitGuid() == TargetGUID)
  107.  
  108.                               {
  109.  
  110.                                       (*itr)->removeReference();
  111.                                       break;
  112.  
  113.                               }
  114.  
  115.                       }
  116.  
  117.               }
  118.  
  119.        
  120.  
  121. void UpdateAI(const uint32 uidiff)
  122.  
  123.               {
  124.  
  125.  
  126.         if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  127.  
  128.                          return;
  129.  
  130.  
  131.                       if(m_bIsRegularMode)
  132.  
  133.                       {
  134.  
  135.                               m_creature->SetVisibility(VISIBILITY_ON);
  136.                               m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  137.  
  138.                       }
  139.  
  140.        
  141.  
  142.        
  143.  
  144.        
  145.  
  146.                       if(m_uiSPELL_ECK_BITE_TIMER <= uidiff)
  147.  
  148.                       {
  149.  
  150.                               DoCastSpellIfCan(m_creature->getVictim(), SPELL_ECK_BITE);
  151.                               m_uiSPELL_ECK_BITE_TIMER = urand(8000, 12000);
  152.  
  153.                       }else m_uiSPELL_ECK_BITE_TIMER -= uidiff;
  154.  
  155.                      
  156.  
  157.                       if (m_uiSPELL_ECK_SPIT_TIMER <= uidiff)
  158.  
  159.                       {
  160.  
  161.                               DoCastSpellIfCan(m_creature->getVictim(), SPELL_ECK_SPIT);
  162.                               m_uiSPELL_ECK_SPIT_TIMER = urand(12000, 14000);
  163.  
  164.                       }else m_uiSPELL_ECK_SPIT_TIMER -= uidiff;
  165.  
  166.        
  167.  
  168.                      if (m_uiSPELL_ECK_SPRING_TIMER <= uidiff)
  169.                      {
  170.                          if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  171.                          {
  172.                              pTarget=pTarget->GetCharmerOrOwnerPlayerOrPlayerItself();
  173.                              if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
  174.                              {
  175.                                  DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_ECK_SPRING_1 : SPELL_ECK_SPRING_2);
  176.                                  m_creature->getThreatManager().modifyThreatPercent(pTarget, -100);
  177.                                  m_uiSPELL_ECK_SPRING_TIMER = urand(5000, 10000);
  178.                              }
  179.                          }
  180.                      }else m_uiSPELL_ECK_SPRING_TIMER -= uidiff;
  181.  
  182.        
  183.  
  184.                       //Berserk on timer
  185.  
  186.        
  187.  
  188.                       if (!m_bBerserk)
  189.  
  190.                       {
  191.  
  192.                               if (m_uiSPELL_ECK_BERSERK_TIMER <= uidiff)
  193.  
  194.                 {
  195.                                       DoCastSpellIfCan(m_creature, SPELL_ECK_BERSERK);
  196.                                       DoScriptText(EMOTE_ECK_BERSERK, m_creature);
  197.                                       m_bBerserk = true;
  198.                                       m_uiSPELL_ECK_BERSERK_TIMER = urand(60000, 90000);
  199.                 }
  200.  
  201.                               else
  202.  
  203.                 {
  204.                                       m_uiSPELL_ECK_BERSERK_TIMER -= uidiff;
  205.                 }
  206.  
  207.  
  208.                       }
  209.  
  210.    
  211.                       DoMeleeAttackIfReady();
  212.  
  213. }
  214.  
  215.        
  216.  
  217. void JustDied(Unit* killer)
  218.               {
  219.                       if (m_pInstance)
  220.                          m_pInstance->SetData(TYPE_ECK, DONE);
  221.               }
  222.  
  223.       };
  224.  
  225.        
  226.  
  227. CreatureAI* GetAI_boss_Eck(Creature* pCreature)
  228.  
  229.       {
  230.           return new boss_EckAI (pCreature);
  231.       }
  232.  
  233.  
  234.  
  235. void AddSC_boss_Eck()
  236.  
  237.       {
  238.            Script *newScript;
  239.  
  240.           newScript = new Script;
  241.           newScript->Name = "boss_Eck";
  242.           newScript->GetAI = &GetAI_boss_Eck;
  243.           newScript->RegisterSelf();
  244.  
  245.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement