Ejemplo n.º 1
0
/************************************************************************
*																		*
*  Processes the damage for this swing.									*
*																		*
************************************************************************/
void CAttack::ProcessDamage()
{
	// Sneak attack.
	if (m_attacker->GetMJob() == JOB_THF &&
		m_isFirstSwing &&
		m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_SNEAK_ATTACK) &&
		((abs(m_victim->loc.p.rotation - m_attacker->loc.p.rotation) < 23) ||
        m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_HIDE)))
	{			
		if (m_victim->objtype == TYPE_MOB && rand()%100 < 4) 
		{	
			((CMobEntity*)m_victim)->m_THLvl += 1;
		}
		m_trickAttackDamage = m_attacker->DEX();
	}

	// Trick attack.
	if (m_attacker->GetMJob() == JOB_THF && 
		m_isFirstSwing && 
		m_attackRound->GetTAEntity() != NULL)
	{
		m_trickAttackDamage += m_attacker->AGI();
	}

	// H2H.
	if (m_attackRound->IsH2H())
	{
		// FFXIclopedia H2H: Remove 3 dmg from weapon, DB has an extra 3 for weapon rank. h2hSkill*0.11+3
		m_naturalH2hDamage = (float)(m_attacker->GetSkill(SKILL_H2H) * 0.11f)+3;
        m_baseDamage = m_attacker->GetMainWeaponDmg()-3;
        if (m_attackType == KICK_ATTACK)
		{
            m_baseDamage = m_attacker->getMod(MOD_KICK_DMG);
        }
		m_damage = (uint32)(((m_baseDamage + m_naturalH2hDamage + m_trickAttackDamage + 
			battleutils::GetFSTR(m_attacker, m_victim, GetWeaponSlot())) * m_damageRatio));
	}
	// Not H2H.
	else
	{
		if (GetWeaponSlot() == SLOT_MAIN)
		{
			m_damage = (uint32)(((m_attacker->GetMainWeaponDmg() + m_trickAttackDamage + 
				battleutils::GetFSTR(m_attacker, m_victim, GetWeaponSlot())) * m_damageRatio));
		} 
		else if (GetWeaponSlot() == SLOT_SUB)
		{
			m_damage = (uint32)(((m_attacker->GetSubWeaponDmg() + m_trickAttackDamage + 
				battleutils::GetFSTR(m_attacker, m_victim, GetWeaponSlot())) * m_damageRatio));
		}
	}

	// Soul eater.
	if (m_attacker->objtype == TYPE_PC)
	{
		m_damage = battleutils::doSoulEaterEffect((CCharEntity*)m_attacker, m_damage);
	}

	// Try zanshin (hasso - non miss)
	if (m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_HASSO))
	{
		m_attackRound->CreateZanshinAttacks();
	}

	// Set attack type to Samba if the attack type is normal.  Don't overwrite other types.  Used for Samba double damage.
	if (m_attackType == ATTACK_NORMAL && m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_DRAIN_SAMBA))
	{
		SetAttackType(SAMBA_ATTACK);
	}

	// Get damage multipliers.
	m_damage = attackutils::CheckForDamageMultiplier((CCharEntity*)m_attacker, m_attacker->m_Weapons[GetWeaponSlot()], m_damage, m_attackType);

	// Get critical bonus mods.
	if (m_isCritical)
	{	
		m_damage += (m_damage * (float)m_attacker->getMod(MOD_CRIT_DMG_INCREASE) / 100);
	}

	// Try Null damage chance (The target)
	if (m_victim->objtype == TYPE_PC && rand()%100 < m_victim->getMod(MOD_NULL_PHYSICAL_DAMAGE))
	{
		m_damage = 0;
	}

	// Try skill up.
	if (m_damage > 0)
	{
		charutils::TrySkillUP((CCharEntity*)m_attacker, (SKILLTYPE)m_attacker->m_Weapons[GetWeaponSlot()]->getSkillType(), m_victim->GetMLevel());
	}
}
Ejemplo n.º 2
0
/************************************************************************
*																		*
*  Processes the damage for this swing.									*
*																		*
************************************************************************/
void CAttack::ProcessDamage()
{
    // Sneak attack.
    if (m_attacker->GetMJob() == JOB_THF &&
        m_isFirstSwing &&
        m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_SNEAK_ATTACK) &&
        ((abs(m_victim->loc.p.rotation - m_attacker->loc.p.rotation) < 23) ||
            m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_HIDE)))
    {
        m_trickAttackDamage += m_attacker->DEX() * (1 + m_attacker->getMod(Mod::SNEAK_ATK_DEX) / 100);
    }

    // Trick attack.
    if (m_attacker->GetMJob() == JOB_THF &&
        m_isFirstSwing &&
        m_attackRound->GetTAEntity() != nullptr)
    {
        m_trickAttackDamage += m_attacker->AGI() * (1 + m_attacker->getMod(Mod::TRICK_ATK_AGI) / 100);
    }

    // H2H.
    if (m_attackRound->IsH2H())
    {
        // FFXIclopedia H2H: Remove 3 dmg from weapon, DB has an extra 3 for weapon rank. h2hSkill*0.11+3
        m_naturalH2hDamage = (int32)(m_attacker->GetSkill(SKILL_H2H) * 0.11f);
        m_baseDamage = std::max<uint16>(m_attacker->GetMainWeaponDmg(), 3);
        if (m_attackType == PHYSICAL_ATTACK_TYPE::KICK)
        {
            m_baseDamage = m_attacker->getMod(Mod::KICK_DMG) + 3;
        }
        m_damage = (uint32)(((m_baseDamage + m_naturalH2hDamage + m_trickAttackDamage +
            battleutils::GetFSTR(m_attacker, m_victim, GetWeaponSlot())) * m_damageRatio));
    }
    // Not H2H.
    else
    {
        if (GetWeaponSlot() == SLOT_MAIN)
        {
            m_damage = (uint32)(((m_attacker->GetMainWeaponDmg() + m_trickAttackDamage +
                battleutils::GetFSTR(m_attacker, m_victim, GetWeaponSlot())) * m_damageRatio));
        }
        else if (GetWeaponSlot() == SLOT_SUB)
        {
            m_damage = (uint32)(((m_attacker->GetSubWeaponDmg() + m_trickAttackDamage +
                battleutils::GetFSTR(m_attacker, m_victim, GetWeaponSlot())) * m_damageRatio));
        }
    }

    // Soul eater.
    if (m_attacker->objtype == TYPE_PC)
    {
        m_damage = battleutils::doSoulEaterEffect((CCharEntity*)m_attacker, m_damage);
    }

    // Set attack type to Samba if the attack type is normal.  Don't overwrite other types.  Used for Samba double damage.
    if (m_attackType == PHYSICAL_ATTACK_TYPE::NORMAL && m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_DRAIN_SAMBA))
    {
        SetAttackType(PHYSICAL_ATTACK_TYPE::SAMBA);
    }

    // Get damage multipliers.
    m_damage = attackutils::CheckForDamageMultiplier((CCharEntity*)m_attacker, m_attacker->m_Weapons[GetWeaponSlot()], m_damage, m_attackType, GetWeaponSlot());

    // Get critical bonus mods.
    if (m_isCritical)
    {
        m_damage += (int32)(m_damage * m_attacker->getMod(Mod::CRIT_DMG_INCREASE) / 100.0f);
    }

    // Apply Sneak Attack Augment Mod
    if (m_attacker->getMod(Mod::AUGMENTS_SA) > 0 && m_trickAttackDamage > 0 && m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_SNEAK_ATTACK))
    {
        m_damage += (int32)(m_damage * ((100 + (m_attacker->getMod(Mod::AUGMENTS_SA))) / 100.0f));
    }

    // Apply Trick Attack Augment Mod
    if (m_attacker->getMod(Mod::AUGMENTS_TA) > 0 && m_trickAttackDamage > 0 && m_attacker->StatusEffectContainer->HasStatusEffect(EFFECT_TRICK_ATTACK))
    {
        m_damage += (int32)(m_damage * ((100 + (m_attacker->getMod(Mod::AUGMENTS_TA))) / 100.0f));
    }

    // Try skill up.
    if (m_damage > 0)
    {
        charutils::TrySkillUP((CCharEntity*)m_attacker, (SKILLTYPE)m_attacker->m_Weapons[GetWeaponSlot()]->getSkillType(), m_victim->GetMLevel());

        if (m_attacker->objtype == TYPE_PET && m_attacker->PMaster && m_attacker->PMaster->objtype == TYPE_PC &&
            static_cast<CPetEntity*>(m_attacker)->getPetType() == PETTYPE_AUTOMATON)
        {
            puppetutils::TrySkillUP((CAutomatonEntity*)m_attacker, SKILL_AME, m_victim->GetMLevel());
        }
    }
    m_isBlocked = attackutils::IsBlocked(m_attacker, m_victim);
}