Exemplo n.º 1
0
    void AIUpdate()
	{
		if( phase == 1 && phase_timer < getMSTime() )
		{
			phase = 2;
			phase_length = getMSTime() + WINDSERPENT_PHASE_LENGTH;
			_unit->SetDisplayId(27073);
			_unit->RemoveAllAuras();
			_unit->CastSpell(_unit, 49356, false );
		}
		if( phase == 2 && phase_length < getMSTime() )
		{
			phase = 1;
			phase_timer = getMSTime() + WINDSERPENT_PHASE_INTERVAL;
			_unit->SetDisplayId(_unit->GetNativeDisplayId() );
			_unit->RemoveAllAuras();
			_unit->CastSpell(_unit, 53463, false );
		}
		if( spells.size() > 0)
		{
			for( uint8 i = 0; i<spells.size(); i++ )
			{
				if( spells[i]->time < getMSTime() && (spells[i]->phase == phase || spells[i]->phase > PHASES_COUNT))
				{
					if( Rand( spells[i]->chance ) )
					{
						CastScriptSpell( spells[i] );
						spells[i]->time = getMSTime() + spells[i]->timer;
					}
				}
			}
		}
    }
Exemplo n.º 2
0
    void AIUpdate()
	{
		//we are not using any abilities in first phase
		if( phase == 2 && spells.size() > 0 )
		{
			for( uint8 i = 0; i<spells.size(); i++ )
			{
				if( spells[i]->time < getMSTime() )
				{
					if( Rand( spells[i]->chance ) )
					{
						CastScriptSpell( spells[i] );
						spells[i]->time = getMSTime() + spells[i]->timer;
					}
				}
			}
		}
		if( phase == 1 )
		{
			if( invasion_timer < getMSTime() )
			{
				invasion_timer = getMSTime() + INVADE_INTERVAL;
				SpawnInvader(0);
			}
			if( handler_timer < getMSTime() )
			{
				handler_timer = getMSTime() + HANDLER_INTERVAL;
				SpawnInvader(1);
			}
			bool new_phase = true;
			for( uint8 i=0; i<4; i++)
			{
				if( _unit->m_ObjectSlots[i] )
				{
					GameObject* Crystal = _unit->GetMapMgr()->GetGameObject( _unit->m_ObjectSlots[i] );
					if( Crystal && Crystal->IsInWorld() )
						new_phase = false;
				}
			}
			if( new_phase )
			{
				_unit->InterruptSpell();
				_unit->RemoveAllAuras();
				_unit->Unroot();
				_unit->GetAIInterface()->disable_melee = false;
				phase = 2;
				for( uint8 i=0; i<7; i++ )
					_unit->SchoolImmunityList[i] = 0;
			}
		}
    }
		void AIUpdate()
		{
			if(!scene && spells.size() > 0)
			{
				for(uint8 i = 0; i < spells.size(); i++)
				{
					if(spells[i]->time < getMSTime())
					{
						if(Rand(spells[i]->chance))
						{
							CastScriptSpell(spells[i]);
							spells[i]->time = getMSTime() + spells[i]->timer;
						}
					}
				}
			}
			else
			{
				//this is ugly, better ideas?
				scene = false;
				Creature* citizen = NULL;
				uint32 entry = 0;
				for(uint32 i = 0; i != _unit->GetMapMgr()->m_CreatureHighGuid; ++i)
				{
					if(_unit->GetMapMgr()->CreatureStorage[i] != NULL)
					{
						entry = _unit->GetMapMgr()->CreatureStorage[i]->GetEntry();
						if(entry == 31126 || entry == 31127 || entry == 28167 || entry == 28169)
						{
							citizen = _unit->GetMapMgr()->CreatureStorage[i];
							CreatureProto* cp = CreatureProtoStorage.LookupEntry(27737);//risen zombie
							CreatureInfo* ci = CreatureNameStorage.LookupEntry(27737);
							Creature* c = NULL;
							if(cp && ci)
							{
								c = _unit->GetMapMgr()->CreateCreature(27737);
								if(c)
								{
									//position is guessed
									c->Load(cp, citizen->GetPositionX(), citizen->GetPositionY(), citizen->GetPositionZ(), citizen->GetOrientation());
									c->PushToWorld(_unit->GetMapMgr());
								}
							}
							citizen->Despawn(0, 0);
						}
					}
				}
			}
		}
Exemplo n.º 4
0
    void AIUpdate()
	{
		if( spells.size() > 0 )
		{
			for( uint8 i = 0; i<spells.size(); i++ )
			{
				if( spells[i]->time < getMSTime() )
				{
					if( Rand( spells[i]->chance ) )
					{
						CastScriptSpell( spells[i] );
						spells[i]->time = getMSTime() + spells[i]->timer;
					}
				}
			}
		}
    }
 void AIUpdate()
 {
     if (spells.size() > 0)
     {
         for (uint8 i = 0; i < spells.size(); i++)
         {
             if (spells[i]->time < getMSTime())
             {
                 if (Rand(spells[i]->chance))
                 {
                     CastScriptSpell(spells[i]);
                     spells[i]->time = getMSTime() + spells[i]->timer;
                 }
             }
         }
     }
     if (invastion_timer < getMSTime())
     {
         invastion_timer = getMSTime() + INVASION_INTERVAL;
         //spawn invaders ;)
         for (uint8 i = 0; i < INVADERS_PER_INVASION; i++)
         {
             CreatureProto* cp = CreatureProtoStorage.LookupEntry(CN_DRAKKARI_INVADER);
             CreatureInfo* ci = CreatureNameStorage.LookupEntry(CN_DRAKKARI_INVADER);
             Creature* c = NULL;
             if (cp && ci)
             {
                 c = _unit->GetMapMgr()->CreateCreature(CN_DRAKKARI_INVADER);
                 if (c)
                 {
                     //position is guessed
                     c->Load(cp, -259.532f, -618.976f, 26.669f, 0.0f);
                     c->PushToWorld(_unit->GetMapMgr());
                     //path finding would be usefull :)
                     //c->GetAIInterface()->SetRun();
                     c->GetAIInterface()->MoveTo(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), _unit->GetOrientation());
                 }
             }
         }
     }
 }
    void AIUpdate()
	{
		if( spells.size() > 0)
		{
			for( uint8 i = 0; i<spells.size(); i++ )
			{
				if( spells[i]->time < getMSTime() && (spells[i]->phase == phase || spells[i]->phase > PHASES_COUNT))
				{
					if( Rand( spells[i]->chance ) )
					{
						CastScriptSpell( spells[i] );
						spells[i]->time = getMSTime() + spells[i]->timer;
					}
				}
			}
		}
		if( stances_timer < getMSTime() )
		{
			ChangeStance();
		}
    }
    void AIUpdate()
	{
		if( spark_timer < getMSTime() )
		{
			spark_timer = 0;
			_unit->UnRoot();
			_unit->GetAIInterface()->disable_combat = false;
			_unit->m_invisible = false;
			_unit->UpdateVisibility();
			for( uint8 i=0; i<SPARKS_COUNT; i++)
				if( sparks[i] != 0 )
				{
					UnitPointer Spark = _unit->GetMapMgr()->GetUnit( sparks[i] );
					if( Spark )
					{
						Spark->RemoveAllAuras();
						Spark->GetAIInterface()->MoveTo(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), _unit->GetOrientation());
						Spark->Root();
						Spark->GetAIInterface()->disable_combat = true;
					}
				}			
		}
		if( spark_timer == 0 && spells.size() > 0 )
		{
			for( uint8 i = 0; i<spells.size(); i++ )
			{
				if( spells[i]->time < getMSTime() )
				{
					if( Rand( spells[i]->chance ) )
					{
						CastScriptSpell( spells[i] );
						spells[i]->time = getMSTime() + spells[i]->timer;
					}
				}
			}
		}
    }