コード例 #1
0
ファイル: arcatraz.cpp プロジェクト: AwkwardDev/mangos-d3
 void AttackStart(Unit* pWho) override
 {
     if (m_creature->Attack(pWho, true))
     {
         m_creature->AddThreat(pWho);
         m_creature->SetInCombatWith(pWho);
         pWho->SetInCombatWith(m_creature);
         HandleMovementOnAttackStart(pWho);
     }
 }
コード例 #2
0
ファイル: sc_creature.cpp プロジェクト: AlexHjelm/Core
/**
 * This function sets the TargetGuid for the creature if required
 * Also it will handle the combat movement (chase movement), depending on SetCombatMovement(bool)
 */
void ScriptedAI::AttackStart(Unit* pWho)
{
    if (pWho && m_creature->Attack(pWho, true))             // The Attack function also uses basic checks if pWho can be attacked
    {
        m_creature->AddThreat(pWho);
        m_creature->SetInCombatWith(pWho);
        pWho->SetInCombatWith(m_creature);

        HandleMovementOnAttackStart(pWho);
    }
}
コード例 #3
0
ファイル: UnitAI.cpp プロジェクト: michalpolko/cmangos
void UnitAI::AttackStart(Unit* who)
{
    if (!who || HasReactState(REACT_PASSIVE))
        return;

    if (m_unit->Attack(who, m_meleeEnabled))
    {
        m_unit->AddThreat(who);
        m_unit->SetInCombatWith(who);
        who->SetInCombatWith(m_unit);

        HandleMovementOnAttackStart(who);
    }
}
コード例 #4
0
ファイル: PetAI.cpp プロジェクト: ErYayo/mangos-cata
void PetAI::AttackStart(Unit* u)
{
    if (!u || (m_creature->IsPet() && ((Pet*)m_creature)->getPetType() == MINI_PET))
        return;

    if (m_creature->Attack(u, true))
    {
        // TMGs call CreatureRelocation which via MoveInLineOfSight can call this function
        // thus with the following clear the original TMG gets invalidated and crash, doh
        // hope it doesn't start to leak memory without this :-/
        // i_pet->Clear();
        HandleMovementOnAttackStart(u);
        inCombat = true;
    }
}
コード例 #5
0
ファイル: GuardAI.cpp プロジェクト: Chuck5ta/server-4
void GuardAI::AttackStart(Unit* u)
{
    if (!u)
        return;

    if (m_creature->Attack(u, true))
    {
        i_victimGuid = u->GetObjectGuid();
        m_creature->AddThreat(u);
        m_creature->SetInCombatWith(u);
        u->SetInCombatWith(m_creature);

        HandleMovementOnAttackStart(u);
    }
}
コード例 #6
0
ファイル: sc_creature.cpp プロジェクト: wow0/ScriptDev3
/**
 * This function sets the TargetGuid for the creature if required
 * Also it will handle the combat movement (chase movement), depending on SetCombatMovement(bool)
 */
void ScriptedAI::AttackStart(Unit* pWho)
{
#if defined (WOTLK)
    if (!m_creature->CanAttackByItself())
        return;
#endif    
    if (pWho && m_creature->Attack(pWho, true))             // The Attack function also uses basic checks if pWho can be attacked
    {
        m_creature->AddThreat(pWho);
        m_creature->SetInCombatWith(pWho);
        pWho->SetInCombatWith(m_creature);

        HandleMovementOnAttackStart(pWho);
    }
}
コード例 #7
0
ファイル: AggressorAI.cpp プロジェクト: mangosR2/mangos3
void AggressorAI::AttackStart(Unit* u)
{
    if (!u || !m_creature->CanAttackByItself())
        return;

    if (m_creature->Attack(u, true))
    {
        i_victimGuid = u->GetObjectGuid();

        m_creature->AddThreat(u);
        m_creature->SetInCombatWith(u);
        u->SetInCombatWith(m_creature);

        HandleMovementOnAttackStart(u);
    }
}
コード例 #8
0
ファイル: ReactorAI.cpp プロジェクト: jobba/mangos3
void
ReactorAI::AttackStart(Unit *p)
{
    if(!p)
        return;

    if(m_creature->Attack(p,true))
    {
        DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Tag unit GUID: %u (TypeId: %u) as a victim", p->GetGUIDLow(), p->GetTypeId());
        i_victimGuid = p->GetObjectGuid();
        m_creature->AddThreat(p);

        m_creature->SetInCombatWith(p);
        p->SetInCombatWith(m_creature);

        HandleMovementOnAttackStart(p);
    }
}
コード例 #9
0
ファイル: PetAI.cpp プロジェクト: conan513/mangos-wotlk
void PetAI::AttackStart(Unit* u)
{
    Pet* pet = (m_unit->GetTypeId() == TYPEID_UNIT && static_cast<Creature*>(m_unit)->IsPet()) ? static_cast<Pet*>(m_unit) : nullptr;

    if (!u || (pet && pet->GetModeFlags() & PET_MODE_DISABLE_ACTIONS))
        return;

    if (m_unit->Attack(u, true))
    {
        // TMGs call CreatureRelocation which via MoveInLineOfSight can call this function
        // thus with the following clear the original TMG gets invalidated and crash, doh
        // hope it doesn't start to leak memory without this :-/
        // i_pet->Clear();
        HandleMovementOnAttackStart(u);

        inCombat = true;
    }
}
コード例 #10
0
ファイル: CreatureAI.cpp プロジェクト: Ghaster/mangos-classic
void CreatureAI::AttackStart(Unit* who)
{
    if (!who || HasReactState(REACT_PASSIVE))
        return;

    if (m_creature->Attack(who, m_meleeEnabled))
    {
        m_creature->AddThreat(who);
        m_creature->SetInCombatWith(who);
        who->SetInCombatWith(m_unit);

        // Cast "Spawn Guard" to help Civilian
        if (m_creature->IsCivilian())
            m_creature->CastSpell(m_creature, 43783, TRIGGERED_OLD_TRIGGERED);

        HandleMovementOnAttackStart(who);
    }
}