Pelf

boss_lord_marrogar

Jun 29th, 2011
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 22.95 KB | None | 0 0
  1. diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_lord_marrowgar.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_lord_marrowgar.cpp
  2. index c8cd603..bde5606 100644
  3. --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_lord_marrowgar.cpp
  4. +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_lord_marrowgar.cpp
  5. @@ -37,12 +37,26 @@ enum
  6.          SPELL_COLD_FLAME                        = 69146,
  7.          SPELL_COLD_FLAME_0                      = 69145,
  8.          SPELL_COLD_FLAME_1                      = 69147,
  9. -        SPELL_BONE_STRIKE                       = 69057,
  10. +        SPELL_BONE_STRIKE_10N                   = 69057,
  11. +       SPELL_BONE_STRIKE_25N                   = 70826,
  12. +       SPELL_BONE_STRIKE_10H                   = 72088,
  13. +       SPELL_BONE_STRIKE_25H                   = 72089,
  14.          SPELL_BONE_STORM                        = 69076,
  15.          SPELL_BONE_STRIKE_IMPALE                = 69065,
  16.          SPELL_VEHICLE_HARDCODED                 = 46598,
  17. -        SPELL_BONE_STORM_STRIKE                 = 69075,
  18. +        SPELL_BONE_STORM_STRIKE_10H             = 73144,
  19. +       SPELL_BONE_STORM_STRIKE_25H             = 73145,
  20. +       // Ачивки
  21. +       ACHIEVEMENT_BONED_10                    = 4534, // 10 игроков
  22. +       ACHIEVEMENT_BONED_25                    = 4610, // 25 игроков
  23.  };
  24. +/* Нужно записать в базу мангоса:
  25. +UPDATE `creature_template` SET `ScriptName`='mob_bone_spike' WHERE `entry`=36619;
  26. +UPDATE `creature_template` SET `ScriptName`='mob_bone_spike' WHERE `entry`=38712;
  27. +*/
  28. +float Xangle[4];                    // Массив углов
  29. +uint32 m_uiColdFlameDuration;       // Длительность лужи
  30. +bool m_bBonedAchieve;               // Ачив
  31.  
  32.  struct MANGOS_DLL_DECL boss_lord_marrowgarAI : public BSWScriptedAI
  33.  {
  34. @@ -55,6 +69,33 @@ struct MANGOS_DLL_DECL boss_lord_marrowgarAI : public BSWScriptedAI
  35.      ScriptedInstance *pInstance;
  36.      bool intro;
  37.  
  38. +   bool _cleave;                       // Включатель клива
  39. +   uint32 _uiCleaveTimer;              // Таймер до клива
  40. +   uint32 uiCleaveTimer;               // Таймер клива
  41. +   uint32 uiBoneStormTimer;            // Таймер вихря костей
  42. +   uint32 uiStormDuration;             // Длительность вихря костей
  43. +   uint32 uiColdFlameTimer;            // Таймер луж
  44. +   uint32 uiBoneStrikeTimer;           // Таймер костяного шипа
  45. +
  46. +
  47. +   // Функция для определения сложности и соответствующих таймеров и скиллов
  48. +   uint32 _getmode(uint32 mod1, uint32 mod2, uint32 mod3, uint32 mod4)
  49. +   {
  50. +       switch (m_creature->GetMap()->GetDifficulty())
  51. +       {
  52. +           case RAID_DIFFICULTY_10MAN_NORMAL:
  53. +               return mod1;
  54. +           case RAID_DIFFICULTY_25MAN_NORMAL:
  55. +               return mod2;
  56. +           case RAID_DIFFICULTY_10MAN_HEROIC:
  57. +               return mod3;
  58. +           case RAID_DIFFICULTY_25MAN_HEROIC:
  59. +               return mod4;
  60. +           default:
  61. +               return mod1;
  62. +       };
  63. +   }
  64. +
  65.      void Reset()
  66.      {
  67.          if (!pInstance) return;
  68. @@ -62,7 +103,22 @@ struct MANGOS_DLL_DECL boss_lord_marrowgarAI : public BSWScriptedAI
  69.          resetTimers();
  70.          m_creature->SetSpeedRate(MOVE_RUN, 1);
  71.          m_creature->SetSpeedRate(MOVE_WALK, 1);
  72. -//        m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
  73. +
  74. +       Xangle[0] = M_PI_F / 4;                 // 1й угол пи / 4
  75. +       Xangle[1] = (3 * M_PI_F) / 4.0f;        // 2й угол 3пи / 4
  76. +       Xangle[2] = (5 * M_PI_F) / 4.0f;        // 3й угол 5пи / 4
  77. +       Xangle[3] = (7 * M_PI_F) / 4.0f;        // 4й угол 7пи / 4
  78. +
  79. +       m_bBonedAchieve = false;
  80. +       _cleave = false;
  81. +       _uiCleaveTimer = 10000;                    
  82. +       uiCleaveTimer = 2000;
  83. +       uiBoneStormTimer = 45000;
  84. +       uiColdFlameTimer = 8000;
  85. +       m_uiColdFlameDuration = _getmode(3000, 3000, 8000, 8000);
  86. +       uiStormDuration = _getmode(20000, 20000, 30000, 30000);
  87. +       uiBoneStrikeTimer = 17000;
  88. +              
  89.      }
  90.  
  91.      void MoveInLineOfSight(Unit* pWho)
  92. @@ -93,11 +149,12 @@ struct MANGOS_DLL_DECL boss_lord_marrowgarAI : public BSWScriptedAI
  93.  
  94.      void KilledUnit(Unit* pVictim)
  95.      {
  96. -    switch (urand(0,1)) {
  97. -        case 0:
  98. -               DoScriptText(-1631006,m_creature,pVictim);
  99. -               break;
  100. -        case 1:
  101. +       switch (urand(0,1))
  102. +       {
  103. +           case 0:
  104. +              DoScriptText(-1631006,m_creature,pVictim);
  105. +              break;
  106. +           case 1:
  107.                 DoScriptText(-1631007,m_creature,pVictim);
  108.                 break;
  109.          };
  110. @@ -105,11 +162,16 @@ struct MANGOS_DLL_DECL boss_lord_marrowgarAI : public BSWScriptedAI
  111.  
  112.      void JustDied(Unit *killer)
  113.      {
  114. +       // Ачивка
  115. +       if ((pInstance) && (m_bBonedAchieve))
  116. +           pInstance->DoCompleteAchievement(_getmode(4534, 4610, 4534, 4610));
  117. +
  118.          if(pInstance) pInstance->SetData(TYPE_MARROWGAR, DONE);
  119.          DoScriptText(-1631009,m_creature);
  120.      }
  121.  
  122. -    void doSummonSpike(Unit* pTarget)
  123. +   // Функция как будто не нужна, в ядре шип уже кастуется под себя проткнутым игроком
  124. +    /*void doSummonSpike(Unit* pTarget)
  125.      {
  126.          if (!pTarget || !pTarget->isAlive()) return;
  127.          float fPosX, fPosY, fPosZ;
  128. @@ -120,97 +182,209 @@ struct MANGOS_DLL_DECL boss_lord_marrowgarAI : public BSWScriptedAI
  129.              pSpike->SetInCombatWith(pTarget);
  130.              pSpike->AddThreat(pTarget, 1000.0f);
  131.          }
  132. -    }
  133. +    }*/
  134.  
  135.      void UpdateAI(const uint32 diff)
  136.      {
  137. +       float fX, fY;
  138.          if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  139.              return;
  140.  
  141.          switch(getStage())
  142.          {
  143. -            case 0:
  144. -                    if (timedQuery(SPELL_BONE_STRIKE, diff))
  145. -                        if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f, isHeroic()))
  146. -                            if (doCast(SPELL_BONE_STRIKE, pTarget) == CAST_OK)
  147. -                            {
  148. -                                doSummonSpike(pTarget);
  149. -                                switch (urand(0,1)) {
  150. -                                                   case 0:
  151. -                                                   DoScriptText(-1631003,m_creature,pTarget);
  152. -                                                   break;
  153. -                                                   case 1:
  154. -                                                   DoScriptText(-1631004,m_creature,pTarget);
  155. -                                                   break;
  156. -                                                   case 2:
  157. -                                                   DoScriptText(-1631005,m_creature,pTarget);
  158. -                                                   break;
  159. -                                                   };
  160. -
  161. -                            };
  162. -
  163. -                    if (timedQuery(SPELL_BONE_STORM, diff)) setStage(1);
  164. -
  165. -                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff))
  166. -                    {
  167. -                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
  168. -                            else  doCast(SPELL_CALL_COLD_FLAME_1);
  169. -
  170. -                        if (m_creature->GetHealthPercent() <= 30.0f)
  171. -                        {
  172. -                            if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
  173. -                                else  doCast(SPELL_CALL_COLD_FLAME_1);
  174. -                        }
  175. -                    }
  176. -
  177. -                    timedCast(SPELL_SABER_LASH, diff);
  178. -
  179. -                    DoMeleeAttackIfReady();
  180. -
  181. -                    break;
  182. +            case 0:
  183. +
  184. +               // Костяной шип
  185. +               if (uiBoneStrikeTimer <= diff)
  186. +               {
  187. +                   if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
  188. +                   {
  189. +                       DoCast(pTarget, _getmode(
  190. +                           SPELL_BONE_STRIKE_10N,
  191. +                           SPELL_BONE_STRIKE_25N,
  192. +                           SPELL_BONE_STRIKE_10H,
  193. +                           SPELL_BONE_STRIKE_25H));
  194. +                        //doSummonSpike(pTarget);
  195. +                        switch (urand(0,2))
  196. +                       {
  197. +                           case 0:
  198. +                               DoScriptText(-1631003,m_creature,pTarget);
  199. +                                break;
  200. +                            case 1:
  201. +                                DoScriptText(-1631004,m_creature,pTarget);
  202. +                                break;
  203. +                           case 2:
  204. +                               DoScriptText(-1631005,m_creature,pTarget);
  205. +                               break;
  206. +                       };
  207. +                   }  
  208. +                   uiBoneStrikeTimer = 17000;
  209. +               }
  210. +               else
  211. +                   uiBoneStrikeTimer -= diff;
  212. +
  213. +                // Вихрь костей
  214. +               if (uiBoneStormTimer <= diff)
  215. +               {
  216. +                   uiBoneStormTimer = 90000 - _getmode(20000, 20000, 30000, 30000);
  217. +                   setStage(1);
  218. +               }
  219. +               else
  220. +                   uiBoneStormTimer -= diff;
  221. +
  222. +               // Холодное пламя
  223. +               if (uiColdFlameTimer <= diff)
  224. +                   {
  225. +                   // Ищем рдд и кастуем в его сторону лужу
  226. +                   // Если нету, то кастуем в сторону танка
  227. +                    Unit* mPlayers[25];
  228. +                   uint32 uiRCount = 0;
  229. +                   Map* pMap = m_creature->GetMap();
  230. +                   Map::PlayerList const& pPlayers = pMap->GetPlayers();
  231. +                   if (!pPlayers.isEmpty())
  232. +                   {
  233. +                       for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr)
  234. +                       {
  235. +                           Unit* pTarget = itr->getSource();
  236. +                           if (pTarget && pTarget->IsInWorld())
  237. +                           {
  238. +                               if (m_creature->GetDistance(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()) > 12.0f)
  239. +                               {
  240. +                                   uiRCount++;
  241. +                                   mPlayers[uiRCount-1] = itr->getSource();
  242. +                               }
  243. +                      
  244. +                           }
  245. +                       }
  246. +                   }
  247. +                   Unit* pTarget;
  248. +                   if (uiRCount>0)
  249. +                       pTarget = mPlayers[urand(0, uiRCount-1)];
  250. +                   else
  251. +                       pTarget = m_creature->getVictim();
  252. +                   float t = m_creature->GetAngle(pTarget->GetPositionX(), pTarget->GetPositionY());
  253. +                   m_creature->GetNearPoint2D(fX, fY, 10.0f, t);
  254. +                   m_creature->SummonCreature(NPC_COLD_FLAME, fX, fY,
  255. +                           m_creature->GetPositionZ(), t,
  256. +                           TEMPSUMMON_TIMED_DESPAWN, m_uiColdFlameDuration);
  257. +                   uiColdFlameTimer = 8000;
  258. +                   }
  259. +               else
  260. +                   uiColdFlameTimer -= diff;
  261. +              
  262. +               if (!_cleave)
  263. +                   {
  264. +                   // Косторез включается через 10сек
  265. +                   if (_uiCleaveTimer <= diff)
  266. +                   {
  267. +                       _cleave = true;
  268. +                       _uiCleaveTimer = 10000;
  269. +                   }
  270. +                   else
  271. +                       _uiCleaveTimer -= diff;
  272. +               }
  273. +               else
  274. +               {
  275. +                   // Косторез
  276. +                   if (uiCleaveTimer <= diff)
  277. +                   {
  278. +                       DoCast(m_creature->getVictim(), SPELL_SABER_LASH);
  279. +                       uiCleaveTimer = 2000;
  280. +                   }
  281. +                   else
  282. +                       uiCleaveTimer -= diff;
  283. +               }
  284. +              
  285. +               DoMeleeAttackIfReady();
  286. +               break;
  287.              case 1:
  288. -                    m_creature->InterruptNonMeleeSpells(true);
  289. -                    doCast(SPELL_BONE_STORM);
  290. -                    setStage(2);
  291. -                    DoScriptText(-1631002,m_creature);
  292. -                    DoResetThreat();
  293. -                    m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
  294. -                    m_creature->SetSpeedRate(MOVE_RUN, 3);
  295. -                    m_creature->SetSpeedRate(MOVE_WALK, 3);
  296. -                    break;
  297. +                m_creature->InterruptNonMeleeSpells(true);
  298. +                doCast(SPELL_BONE_STORM);
  299. +                setStage(2);
  300. +                DoScriptText(-1631002,m_creature);
  301. +                DoResetThreat();
  302. +                m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
  303. +                m_creature->SetSpeedRate(MOVE_RUN, 3);
  304. +                m_creature->SetSpeedRate(MOVE_WALK, 3);
  305. +                break;
  306.              case 2:
  307. -                    if (!m_creature->IsNonMeleeSpellCasted(false)) setStage(3);
  308. -                    break;
  309. +                if (!m_creature->IsNonMeleeSpellCasted(false)) setStage(3);
  310. +                break;
  311.              case 3:
  312. -                    if (isHeroic())
  313. -                        if (timedQuery(SPELL_BONE_STRIKE, diff, true))
  314. -                            if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f))
  315. -                                doSummonSpike(pTarget);
  316. -
  317. -                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff, true)
  318. -                        && m_creature->IsWithinDistInMap(m_creature->getVictim(),2.0f))
  319. -                    {
  320. -                        pInstance->SetData(DATA_DIRECTION, (uint32)(1000*2.0f*M_PI_F*((float)urand(1,16)/16.0f)));
  321. -//                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
  322. -//                            else  doCast(SPELL_CALL_COLD_FLAME_1);
  323. -                        float fPosX, fPosY, fPosZ;
  324. -                        m_creature->GetPosition(fPosX, fPosY, fPosZ);
  325. -                        doSummon(NPC_COLD_FLAME, fPosX, fPosY, fPosZ);
  326. -                        DoResetThreat();
  327. -                        if (Unit* pTarget = doSelectRandomPlayerAtRange(60.0f))
  328. -                            AttackStart(pTarget);
  329. -                    }
  330. -                    if (!hasAura(SPELL_BONE_STORM_STRIKE, m_creature) && !hasAura(SPELL_BONE_STORM, m_creature)) setStage(4);
  331. -                    break;
  332. +              
  333. +               // Костяной шип во время вихря
  334. +               if ((_getmode(0,0,1,1)) && (uiBoneStrikeTimer <= diff))
  335. +               {
  336. +                   if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
  337. +                   {
  338. +                       DoCast(pTarget, _getmode(0, 0,
  339. +                       SPELL_BONE_STORM_STRIKE_10H,
  340. +                       SPELL_BONE_STORM_STRIKE_25H));
  341. +                       switch (urand(0,2))
  342. +                       {
  343. +                           case 0:
  344. +                               DoScriptText(-1631003,m_creature,pTarget);
  345. +                                break;
  346. +                            case 1:
  347. +                                DoScriptText(-1631004,m_creature,pTarget);
  348. +                                break;
  349. +                           case 2:
  350. +                               DoScriptText(-1631005,m_creature,pTarget);
  351. +                               break;
  352. +                       };
  353. +                       //doSummonSpike(pTarget);
  354. +                   }
  355. +                   uiBoneStrikeTimer = 17000;
  356. +               }
  357. +               else
  358. +                   uiBoneStrikeTimer -= diff;
  359. +
  360. +               // Холодное пламя
  361. +                if ((uiColdFlameTimer <= diff)
  362. +                    && (m_creature->IsWithinDistInMap(m_creature->getVictim(),2.0f)))
  363. +                {
  364. +                   m_creature->GetNearPoint2D(fX, fY, 0.1f, Xangle[0]);           
  365. +                   m_creature->SummonCreature(NPC_COLD_FLAME, fX, fY, m_creature->GetPositionZ(),
  366. +                       Xangle[0],
  367. +                       TEMPSUMMON_TIMED_DESPAWN, m_uiColdFlameDuration);
  368. +                   m_creature->GetNearPoint2D(fX, fY, 0.1f, Xangle[1]);           
  369. +                   m_creature->SummonCreature(NPC_COLD_FLAME, fX, fY, m_creature->GetPositionZ(),
  370. +                       Xangle[1],
  371. +                       TEMPSUMMON_TIMED_DESPAWN, m_uiColdFlameDuration);
  372. +                   m_creature->GetNearPoint2D(fX, fY, 0.1f, Xangle[2]);           
  373. +                   m_creature->SummonCreature(NPC_COLD_FLAME, fX, fY, m_creature->GetPositionZ(),
  374. +                       Xangle[2],
  375. +                       TEMPSUMMON_TIMED_DESPAWN, m_uiColdFlameDuration);
  376. +                   m_creature->GetNearPoint2D(fX, fY, 0.1f, Xangle[3]);           
  377. +                   m_creature->SummonCreature(NPC_COLD_FLAME, fX, fY, m_creature->GetPositionZ(),
  378. +                       Xangle[3],
  379. +                       TEMPSUMMON_TIMED_DESPAWN, m_uiColdFlameDuration);
  380. +                   uiColdFlameTimer = 8000;
  381. +               }
  382. +               else
  383. +                   uiColdFlameTimer -= diff;
  384. +              
  385. +               // Если прошло 20 или 30сек, то вихрь кончается
  386. +               if (uiStormDuration <= diff)
  387. +               {
  388. +                   m_creature->RemoveAurasDueToSpell(SPELL_BONE_STORM_STRIKE_10H);
  389. +                   m_creature->RemoveAurasDueToSpell(SPELL_BONE_STORM_STRIKE_25H);
  390. +                   m_creature->RemoveAurasDueToSpell(SPELL_BONE_STORM);
  391. +                   uiStormDuration = _getmode(20000, 20000, 30000, 30000);
  392. +               }
  393. +               else
  394. +                   uiStormDuration -= diff;
  395. +              
  396. +               if (!hasAura(SPELL_BONE_STORM_STRIKE_10H, m_creature) && !hasAura(SPELL_BONE_STORM_STRIKE_25H, m_creature) && !hasAura(SPELL_BONE_STORM, m_creature)) setStage(4);
  397. +                break;
  398.              case 4:
  399. -                    pInstance->SetData(DATA_DIRECTION, 0);
  400. -                    m_creature->SetSpeedRate(MOVE_RUN, 1);
  401. -                    m_creature->SetSpeedRate(MOVE_WALK, 1);
  402. -//                    m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
  403. -                    setStage(0);
  404. -                    break;
  405. +                pInstance->SetData(DATA_DIRECTION, 0);
  406. +                m_creature->SetSpeedRate(MOVE_RUN, 1);
  407. +                m_creature->SetSpeedRate(MOVE_WALK, 1);
  408. +                setStage(0);
  409. +                break;
  410.              default:
  411. -                    break;
  412. +                break;
  413.              }
  414.  
  415.          if (timedQuery(SPELL_BERSERK, diff))
  416. @@ -232,26 +406,26 @@ struct MANGOS_DLL_DECL mob_coldflameAI : public BSWScriptedAI
  417.      }
  418.  
  419.      ScriptedInstance* m_pInstance;
  420. -    bool isFirst;
  421. -    bool isXmode;
  422. -    float m_direction;
  423. -    float x, y, radius;
  424. -    bool isCreator;
  425. +   bool canSum;
  426. +    float x, y;
  427. +   uint32 uiCF;
  428. +   uint32 uiCF1;
  429. +
  430.  
  431.      void Reset()
  432.      {
  433.          if(!m_pInstance) return;
  434. -//        m_creature->SetDisplayId(10045);
  435.          m_creature->SetRespawnDelay(7*DAY);
  436.  
  437.          m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  438.          m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  439.  
  440. -        setStage(0);
  441. -        isCreator = false;
  442. +       canSum = true;
  443. +       uiCF = 800;        // Время, через которое появляются новые куски лужи
  444. +       uiCF1 = 100;           // Через это время появится дамаг аура вокруг нпц-лужи
  445.  
  446.          SetCombatMovement(false);
  447. -        doCast(SPELL_COLD_FLAME_0);
  448. +        doCast(SPELL_COLD_FLAME);
  449.      }
  450.  
  451.      void AttackStart(Unit *who)
  452. @@ -267,55 +441,32 @@ struct MANGOS_DLL_DECL mob_coldflameAI : public BSWScriptedAI
  453.      void UpdateAI(const uint32 uiDiff)
  454.      {
  455.          if(m_pInstance && m_pInstance->GetData(TYPE_MARROWGAR) != IN_PROGRESS)
  456. -        {
  457.              m_creature->ForcedDespawn();
  458. -        }
  459.  
  460.          if (m_creature->GetCreatorGuid().IsEmpty()) return;
  461.  
  462. -        if (!isCreator)
  463. -        {
  464. -            if (m_creature->GetCreatorGuid().GetRawValue() == m_pInstance->GetData64(NPC_LORD_MARROWGAR))
  465. -            {
  466. -                isFirst = true;
  467. -                uint32 m_tmpDirection = m_pInstance->GetData(DATA_DIRECTION);
  468. -                m_pInstance->SetData(DATA_DIRECTION,0);
  469. -                if (m_tmpDirection)
  470. -                {
  471. -                    m_direction = m_tmpDirection/1000.0f;
  472. -                    isXmode = true;
  473. -                }
  474. -                else
  475. -                {
  476. -                    m_direction = 2.0f*M_PI_F*((float)urand(1,16)/16.0f);
  477. -                    isXmode = false;
  478. -                }
  479. -            } else isFirst = false;
  480. -            isCreator = true;
  481. -        }
  482. -
  483. -        if (timedQuery(SPELL_COLD_FLAME_0, uiDiff) && !isFirst)
  484. -            m_creature->ForcedDespawn();
  485. -
  486. -        if (isFirst && timedQuery(SPELL_COLD_FLAME_1, uiDiff, true))
  487. +        if ((uiCF <= uiDiff) && (canSum))
  488.          {
  489. -            if (getStage() < getSpellData(SPELL_COLD_FLAME_0))
  490. -            {
  491. -                setStage(getStage()+1);
  492. -                radius = getStage()*5;
  493. -                m_creature->GetNearPoint2D(x, y, radius, m_direction);
  494. -                doSummon(NPC_COLD_FLAME, x, y, m_creature->GetPositionZ(), TEMPSUMMON_TIMED_DESPAWN, getSpellData(SPELL_COLD_FLAME_1));
  495. -                if (isXmode)
  496. -                {
  497. -                    m_creature->GetNearPoint2D(x, y, radius, m_direction+M_PI_F/2);
  498. -                    doSummon(NPC_COLD_FLAME, x, y, m_creature->GetPositionZ(), TEMPSUMMON_TIMED_DESPAWN, getSpellData(SPELL_COLD_FLAME_1));
  499. -                    m_creature->GetNearPoint2D(x, y, radius, m_direction+M_PI_F);
  500. -                    doSummon(NPC_COLD_FLAME, x, y, m_creature->GetPositionZ(), TEMPSUMMON_TIMED_DESPAWN, getSpellData(SPELL_COLD_FLAME_1));
  501. -                    m_creature->GetNearPoint2D(x, y, radius, m_direction+M_PI_F*1.5f);
  502. -                    doSummon(NPC_COLD_FLAME, x, y, m_creature->GetPositionZ(), TEMPSUMMON_TIMED_DESPAWN, getSpellData(SPELL_COLD_FLAME_1));
  503. -                }
  504. -            } else m_creature->ForcedDespawn();
  505. -        } else timedCast(SPELL_COLD_FLAME, uiDiff);
  506. +            Creature* tCreature = m_pInstance->GetSingleCreatureFromStorage(NPC_LORD_MARROWGAR);
  507. +           if (m_creature->GetDistance2d(tCreature) > 100)
  508. +               return;
  509. +           m_creature->GetNearPoint2D(x, y, 6.0f, tCreature->GetAngle(m_creature));           
  510. +           m_creature->SummonCreature(NPC_COLD_FLAME, x, y, m_creature->GetPositionZ(),
  511. +               tCreature->GetAngle(m_creature),
  512. +               TEMPSUMMON_TIMED_DESPAWN, m_uiColdFlameDuration);
  513. +           canSum = false;
  514. +           uiCF = 800;
  515. +        }
  516. +       else
  517. +           uiCF -= uiDiff;
  518. +
  519. +       if (uiCF1 <= uiDiff)
  520. +       {
  521. +           doCast(SPELL_COLD_FLAME);              
  522. +           uiCF1 = 10000;
  523. +       }
  524. +       else
  525. +           uiCF1 -= uiDiff;
  526.  
  527.      }
  528.  };
  529. @@ -330,25 +481,42 @@ struct MANGOS_DLL_DECL mob_bone_spikeAI : public BSWScriptedAI
  530.  
  531.      ScriptedInstance* m_pInstance;
  532.      ObjectGuid victimGuid;
  533. +   uint32 _uiBonedTimer;
  534. +   uint32 uiBonedTimer;                    // Таймер ачивки
  535.  
  536.      void Reset()
  537.      {
  538. -        SetCombatMovement(false);
  539. +       // Шип саммонится игроком, его и берем
  540. +       if (!m_creature->GetCreator()) return;
  541. +       Unit* tCreator = m_creature->GetCreator();
  542. +       if (tCreator->GetTypeId() == TYPEID_PLAYER)
  543. +       {
  544. +           victimGuid = tCreator->GetObjectGuid();
  545. +           if (Player* pVictim = m_creature->GetMap()->GetPlayer(victimGuid))
  546. +           {
  547. +               m_creature->SetInCombatWith(pVictim);
  548. +               DoCast(pVictim, SPELL_BONE_STRIKE_IMPALE);
  549. +               DoCast(pVictim, SPELL_VEHICLE_HARDCODED);
  550. +               uiBonedTimer = 0;
  551. +               _uiBonedTimer = 1000;
  552. +           }
  553. +       }
  554. +      
  555. +       SetCombatMovement(false);
  556.          m_creature->SetRespawnDelay(7*DAY);
  557. -        victimGuid = ObjectGuid();
  558.          m_creature->SetInCombatWithZone();
  559.      }
  560.  
  561. -    void Aggro(Unit* pWho)
  562. +
  563. +    /*void Aggro(Unit* pWho)
  564.      {
  565. -        if (victimGuid.IsEmpty() && pWho && pWho->GetTypeId() == TYPEID_PLAYER)
  566. -        {
  567. -            victimGuid = pWho->GetObjectGuid();
  568. -            m_creature->SetInCombatWith(pWho);
  569. -            doCast(SPELL_BONE_STRIKE_IMPALE,pWho);
  570. -            doCast(SPELL_VEHICLE_HARDCODED,pWho);
  571. +        if (Player* pVictim = m_creature->GetMap()->GetPlayer(victimGuid))
  572. +       {
  573. +            m_creature->SetInCombatWith(pVictim);
  574. +            doCast(SPELL_BONE_STRIKE_IMPALE,pVictim);
  575. +            doCast(SPELL_VEHICLE_HARDCODED,pVictim);
  576.          }
  577. -    }
  578. +    }*/
  579.  
  580.      void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
  581.      {
  582. @@ -370,12 +538,24 @@ struct MANGOS_DLL_DECL mob_bone_spikeAI : public BSWScriptedAI
  583.  
  584.      void JustDied(Unit* Killer)
  585.      {
  586. +       if (uiBonedTimer < 9) m_bBonedAchieve = true;
  587. +
  588.          if (Player* pVictim = m_creature->GetMap()->GetPlayer(victimGuid))
  589.              doRemove(SPELL_BONE_STRIKE_IMPALE,pVictim);
  590. +       m_creature->ForcedDespawn(1000);
  591.      }
  592.  
  593.      void UpdateAI(const uint32 uiDiff)
  594.      {
  595. +       // Ачивка
  596. +       if (_uiBonedTimer <= uiDiff)
  597. +       {
  598. +           uiBonedTimer++;
  599. +           _uiBonedTimer = 1000;
  600. +       }
  601. +       else
  602. +           _uiBonedTimer -= uiDiff;
  603. +
  604.          if(m_pInstance && m_pInstance->GetData(TYPE_MARROWGAR) != IN_PROGRESS)
  605.          {
  606.              if (Player* pVictim = m_creature->GetMap()->GetPlayer(victimGuid))
Advertisement
Add Comment
Please, Sign In to add comment