Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.97 KB | None | 0 0
  1. class mob_frost_sphere_fallen : public CreatureScript
  2. {
  3.     public:
  4.         mob_frost_sphere_fallen() : CreatureScript("mob_frost_sphere_fallen")
  5.         {
  6.         }
  7.        
  8.         CreatureAI* GetAI(Creature* creature) const
  9.         {
  10.             return new mob_frost_sphere_fallenAI(creature);
  11.         };
  12.  
  13.         struct mob_frost_sphere_fallenAI : public ScriptedAI
  14.         {
  15.             mob_frost_sphere_fallenAI(Creature* creature) : _summonerGuid(0), ScriptedAI(creature)
  16.             {
  17.             }
  18.  
  19.             void Reset()
  20.             {
  21.                 _summonerGuid = 0;
  22.                 me->SetReactState(REACT_PASSIVE);
  23.                 me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  24.                 DoCast(SPELL_PERMAFROST_MODEL);
  25.                 DoCast(SPELL_PERMAFROST_VISUAL);
  26.                 DoCast(SPELL_PERMAFROST);
  27.                     //me->SetObjectScale(2.0f);
  28.                     me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f);
  29.             }
  30.  
  31.             void DamageTaken(Unit* who, uint32& damage)
  32.             {
  33.                 damage = 0;
  34.             }
  35.  
  36.             // Called when NPC_FROST_SPHERE summons this creature
  37.             void JustSummoned(Creature* summoner)
  38.             {
  39.                 if (summoner && summoner->GetEntry() == NPC_FROST_SPHERE)
  40.                     _summonerGuid = summoner->GetGUID();
  41.  
  42.             }
  43.            
  44.             // Called when NPC_SPIKE hits this creature
  45.             void SummonedCreatureDespawn(Creature* despawner)
  46.             {
  47.                 if(despawner && despawner->GetEntry() == NPC_SPIKE)
  48.                 {
  49.                     me->DespawnOrUnsummon(3 * IN_MILLISECONDS);
  50.                     if(Creature *fallenSummoner = ObjectAccessor::GetObjectInWorld(_summonerGuid, (Creature *)NULL))
  51.                         fallenSummoner->DespawnOrUnsummon(3 * IN_MILLISECONDS);
  52.                 }
  53.             }
  54.  
  55.             private:
  56.                 uint64 _summonerGuid;
  57.  
  58.         };
  59. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement