Exemple #1
0
void SmartAI::EnterEvadeMode()
{
    if (!me->isAlive() || me->IsInEvadeMode())
        return;

    RemoveAuras();

    me->AddUnitState(UNIT_STATE_EVADE);
    me->DeleteThreatList();
    me->CombatStop(true);
    me->LoadCreaturesAddon();
    me->SetLootRecipient(NULL);
    me->ResetPlayerDamageReq();

    GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db

    SetRun(mRun);
    if (HasEscortState(SMART_ESCORT_ESCORTING))
    {
        AddEscortState(SMART_ESCORT_RETURNING);
        ReturnToLastOOCPos();
    }
    else if (mFollowGuid)
    {
        if (Unit* target = me->GetUnit(*me, mFollowGuid))
            me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
    }
    else
        me->GetMotionMaster()->MoveTargetedHome();

    // Ouput is useless, it's generic bug related to SmartAI system
    //sLog->OutPandashan("SmartAI::EnterEvadeMode Entry %u" , me->GetEntry());

    Reset();
}
void SmartAI::EnterEvadeMode()
{
    if (!me->isAlive())
        return;

    RemoveAuras();

    me->DeleteThreatList();
    me->CombatStop(true);
    me->LoadCreaturesAddon();
    me->SetLootRecipient(NULL);
    me->ResetPlayerDamageReq();

    GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db

    SetRun(mRun);
    if (HasEscortState(SMART_ESCORT_ESCORTING))
    {
        AddEscortState(SMART_ESCORT_RETURNING);
        ReturnToLastOOCPos();
    }
    else if (mFollowGuid)
    {
        if (Unit* target = me->GetUnit(*me, mFollowGuid))
            me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
    }
    else
        me->GetMotionMaster()->MoveTargetedHome();

    Reset();
}
Exemple #3
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (m_bFrozen && !m_bExploded)
        {
            if (m_uiThawTimer <= uiDiff)			// remove all slows and reset counters
            {
                RemoveAuras();
                ResetBool(0);	
				ResetBool(1);
            }
            else
                m_uiThawTimer -= uiDiff;
        }

        if(m_bExploded)
        {
            if (m_uiSetInvisTimer <= uiDiff)
            {
                SetVisible(0);
                m_creature->SetObjectScale(0.1f);
                m_creature->UpdateModelData();
            }
            else
                m_uiSetInvisTimer -= uiDiff;

            if (m_uiSetVisibleTimer <= uiDiff)
            {
               
                SetVisible(1);
                
                // set scale 0.4f scale is the smallest             
                m_creature->SetObjectScale(m_creature->GetHealthPercent() * 0.0084 + 0.358);			// set Viscidus' size depending on the blobs that are alive 1/ too small?   
                m_creature->UpdateModelData();
                m_creature->RemoveAllAuras(AuraRemoveMode::AURA_REMOVE_BY_DEFAULT);
                if(!m_creature->HasAura(SPELL_MEMBRANE_VISCIDUS))                    
                    m_creature->CastSpell(m_creature, SPELL_MEMBRANE_VISCIDUS, true); // reapply dmg reduction
            }
            else
                m_uiSetVisibleTimer -= uiDiff;

            if (!m_bSummoned)
            {
                if (m_uiGlobSpawnTimer <= uiDiff)
                {
                    SpawnGlobs();
                    m_bSummoned = true;
                }
                else
                    m_uiGlobSpawnTimer -= uiDiff;
            }
        }

        if (m_bCanDoDamage)
        {
            if (m_uiPoisonBoltCastTimer)
            {
                if (m_uiPoisonBoltCastTimer > uiDiff)
                {
                    m_uiPoisonBoltCastTimer -= uiDiff;

                    Unit* pTarget = m_creature->GetMap()->GetUnit(m_PoisonTargetGuid);
                    if (m_uiPoisonBoltCastTimer < 500 && pTarget)
                    {
                        m_creature->SetTargetGuid(pTarget->GetObjectGuid());
                        m_creature->SetFacingToObject(pTarget);
                        return;
                    }
                }
                else
                {
                    if (m_creature->SelectHostileTarget() && m_creature->getVictim())
                        m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid());

                    m_uiPoisonBoltCastTimer = 0;
                    return;
                }
            }

            //Return since we have no target
            if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
                return;

            if (m_uiPoisonShockTimer <= uiDiff)
            {
                m_creature->CastSpell(m_creature, SPELL_POISON_SHOCK, false);
                m_uiPoisonShockTimer = 10000;
            }
            else
                m_uiPoisonShockTimer -= uiDiff;

            if (m_uiPoisonVolleyTimer <= uiDiff)
            {
                m_creature->CastSpell(m_creature, SPELL_POISONBOLT_VOLLEY, false);
                m_uiPoisonVolleyTimer = 10000;
            }
            else
                m_uiPoisonVolleyTimer -= uiDiff;

            if (m_uiToxicCloudTimer <= uiDiff)				// redo this, should probably not cast a spell, just visually cast it. Missing that the boss should turn towards the victim during cast.
            {
                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                {
                    m_creature->CastSpell(pTarget, SPELL_POISON_BOLT, true); 
                    m_PoisonTargetGuid = pTarget->GetObjectGuid();
                    m_uiPoisonBoltCastTimer = 2800;
                }
                m_uiToxicCloudTimer = urand(30000,40000);
                return;
            }
            else
                m_uiToxicCloudTimer -= uiDiff;

            DoMeleeAttackIfReady();
            
            EnterEvadeIfOutOfCombatArea(uiDiff);
        }
    }