Public feed #725549

Anonym

public text v1 · immutable
Raw Edit
·published 2007-10-04 14:44 UTC
rendered paste body
/*######
   23 ## mob_infested_root_walker
   24 ######*/
   25 
   26 struct MANGOS_DLL_DECL mob_infested_root_walkerAI : public ScriptedAI
   27 {
   28     mob_infested_root_walkerAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
   29 
   30     void EnterEvadeMode()
   31     {
   32         m_creature->RemoveAllAuras();
   33         m_creature->DeleteThreatList();
   34         m_creature->CombatStop();
   35         DoGoHome();
   36 
   37         //m_creature->CastSpell(m_creature,7941,true);//Immunity: Nature
   38     }
   39 
   40     void DamageTaken(Unit *done_by, uint32 &damage)
   41     {
   42         if (done_by->GetTypeId() == TYPEID_PLAYER)
   43         {
   44             if( ((Player*)done_by)->GetQuestStatus(10896) == QUEST_STATUS_INCOMPLETE && !((Player*)done_by)->GetReqKillOrCastCurrentCount(10896, m_creature->GetEntry()) )
   45             {
   46                 if (m_creature->GetHealth() <= damage)
   47                 {
   48                     if (rand()%100 < 75)
   49                         m_creature->CastSpell(m_creature,39130,true);//Summon Wood Mites
   50                 }
   51             }
   52         }
   53     }
   54 
   55     void AttackStart(Unit *who)
   56     {
   57         if (!who)
   58             return;
   59 
   60         if (who->isTargetableForAttack() && who!= m_creature)
   61         {
   62             //Begin melee attack if we are within range
   63             DoStartMeleeAttack(who);
   64         }
   65     }
   66 
   67     void MoveInLineOfSight(Unit *who)
   68     {
   69         if (!who || m_creature->getVictim())
   70             return;
   71 
   72         if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
   73         {
   74             float attackRadius = m_creature->GetAttackDistance(who);
   75             if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who))
   76             {
   77                 if(who->HasStealthAura())
   78                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
   79 
   80                 //Begin melee attack if we are within range
   81                 DoStartMeleeAttack(who);
   82             }
   83         }
   84     }
   85 };
   86 CreatureAI* GetAI_mob_infested_root_walker(Creature *_Creature)
   87 {
   88     return new mob_infested_root_walkerAI (_Creature);
   89 }