Pelf

Pelf bloodworm 1

Apr 25th, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.94 KB | None | 0 0
  1. diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
  2. index 206518b..10757d6 100644
  3. --- a/src/server/scripts/World/npcs_special.cpp
  4. +++ b/src/server/scripts/World/npcs_special.cpp
  5. @@ -2971,6 +2971,78 @@ public:
  6.      }
  7.  };
  8.  
  9. +class npc_bloodworm : public CreatureScript
  10. +{
  11. +public:
  12. +    npc_bloodworm() : CreatureScript("npc_bloodworm") { }
  13. +
  14. +   CreatureAI *GetAI(Creature *creature) const
  15. +    {
  16. +        return new npc_bloodwormAI(creature);
  17. +    }
  18. +
  19. +    struct npc_bloodwormAI : public ScriptedAI
  20. +    {
  21. +        npc_bloodwormAI(Creature *c) : ScriptedAI(c)
  22. +       {
  23. +       }
  24. +
  25. +       uint32 uiBurstTimer;
  26. +
  27. +       void Burst()
  28. +       {
  29. +           if (!me->isInCombat())
  30. +               return;
  31. +
  32. +           if (Aura* aura = me->GetAura(81277))
  33. +           {
  34. +               uint32 stacks = aura->GetStackAmount();
  35. +               stacks = (stacks <= 10)? stacks: 10;
  36. +               int32 damage = stacks * (me->GetMaxHealth() / 10);
  37. +               me->CastCustomSpell(me, 81280, &damage, NULL, NULL, true);
  38. +           }
  39. +       }
  40. +
  41. +        void EnterCombat(Unit * /*who*/)
  42. +       {
  43. +       }
  44. +
  45. +       void JustDied(Unit* killer)
  46. +       {
  47. +           Burst();
  48. +       }
  49. +
  50. +        void Reset()
  51. +        {
  52. +           if (SpellEntry* spell = GET_SPELL(81280))
  53. +               spell->EffectRadiusIndex[0] = 13;
  54. +
  55. +           if (me->GetOwner())
  56. +           {
  57. +               me->SetMaxHealth(0.35 * me->GetOwner()->GetHealth());
  58. +               me->SetHealth(0.35 * me->GetOwner()->GetHealth());
  59. +           }
  60. +
  61. +           DoCast(me, 50453);
  62. +
  63. +           uiBurstTimer = 19000;
  64. +        }
  65. +
  66. +        void UpdateAI(const uint32 diff)
  67. +        {
  68. +           if (uiBurstTimer <= diff)
  69. +               Burst();
  70. +           else
  71. +               uiBurstTimer -= diff;
  72. +
  73. +            if (!UpdateVictim())
  74. +                return;
  75. +
  76. +           DoMeleeAttackIfReady();
  77. +        }
  78. +    };
  79. +};
  80. +
  81.  void AddSC_npcs_special()
  82.  {
  83.      new npc_air_force_bots;
  84. @@ -3004,6 +3076,6 @@ void AddSC_npcs_special()
  85.      new npc_ring_of_frost;
  86.      new npc_flame_orb;
  87.      new npc_power_word_barrier;
  88. -
  89. +   new npc_bloodworm();
  90.  }
Advertisement
Add Comment
Please, Sign In to add comment