SHARE
TWEET

Untitled

a guest Apr 21st, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct npc_trilliax_sludgerax : public ScriptedAI
  2. {
  3.     npc_trilliax_sludgerax(Creature* creature) : ScriptedAI(creature), putridDies(0)
  4.     {
  5.         instance = me->GetInstanceScript();
  6.         me->SetReactState(REACT_PASSIVE);
  7.         me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_ATTACKABLE_1);
  8.     }
  9.  
  10.     InstanceScript* instance;
  11.     uint8 putridDies = 0;
  12.  
  13.     void Reset() override {}
  14.  
  15.     void IsSummonedBy(Unit* summoner) override
  16.     {
  17.         for (const auto & sludgeraxSumPo : sludgeraxSumPos)
  18.             me->SummonCreature(NPC_PUTRID_SLUDGE, sludgeraxSumPo);
  19.  
  20.         putridDies = 0;
  21.         DoCast(me, SPELL_BURSTING_SLIME, true);
  22.         DoCast(me, SPELL_DEATH_COSMETIC_2, true);
  23.     }
  24.  
  25.     void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
  26.     {
  27.         if (summon->GetEntry() == NPC_PUTRID_SLUDGE)
  28.         {
  29.             if (++putridDies == 8)
  30.             {
  31.                 me->SetReactState(REACT_AGGRESSIVE);
  32.                 me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_ATTACKABLE_1);
  33.                 me->RemoveAurasDueToSpell(SPELL_DEATH_COSMETIC_2);
  34.             }
  35.         }
  36.     }
  37.  
  38.     void JustDied(Unit* /*killer*/) override
  39.     {
  40.         if (instance->GetData(DATA_TRILLIAX_INTRO) != DONE)
  41.         {
  42.             instance->SetData(DATA_TRILLIAX_INTRO, DONE);
  43.  
  44.             if (Unit* owner = me->GetAnyOwner())
  45.                 owner->GetAI()->DoAction(ACTION_1);
  46.         }
  47.     }
  48.  
  49.     void UpdateAI(uint32 diff) override
  50.     {
  51.         if (!UpdateVictim())
  52.             return;
  53.  
  54.         if (me->HasUnitState(UNIT_STATE_CASTING))
  55.             return;
  56.  
  57.         DoMeleeAttackIfReady();
  58.     }
  59. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top