Pelf

lord marrogar 1.07.2011

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