mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-28 12:17:46 +00:00
clean up action code
This commit is contained in:
parent
0d8c99d2af
commit
1054ee6fcd
1 changed files with 65 additions and 63 deletions
|
@ -465,9 +465,7 @@ void Action::Action::buildEffects()
|
||||||
m_lutEntry.bonusEffect, m_lutEntry.bonusRequirement, m_lutEntry.bonusDataUInt32 );
|
m_lutEntry.bonusEffect, m_lutEntry.bonusRequirement, m_lutEntry.bonusDataUInt32 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// when aoe, these effects are in the target whatever is hit first
|
bool isFirstValidVictim = true;
|
||||||
bool shouldGainPower = true;
|
|
||||||
bool shouldApplyComboSucceedEffect = true;
|
|
||||||
|
|
||||||
for( auto& actor : m_hitActors )
|
for( auto& actor : m_hitActors )
|
||||||
{
|
{
|
||||||
|
@ -520,18 +518,6 @@ void Action::Action::buildEffects()
|
||||||
else
|
else
|
||||||
m_effectBuilder->damage( actor, actor, dmg.first, dmg.second, dmg.first == 0 ? Common::ActionEffectResultFlag::Absorbed : Common::ActionEffectResultFlag::None );
|
m_effectBuilder->damage( actor, actor, dmg.first, dmg.second, dmg.first == 0 ? Common::ActionEffectResultFlag::Absorbed : Common::ActionEffectResultFlag::None );
|
||||||
|
|
||||||
|
|
||||||
if( m_isAutoAttack && m_pSource->isPlayer() )
|
|
||||||
{
|
|
||||||
if( auto player = m_pSource->getAsPlayer() )
|
|
||||||
{
|
|
||||||
if( player->getClass() == Common::ClassJob::Paladin )
|
|
||||||
{
|
|
||||||
player->gaugePldSetOath( std::min( 100, player->gaugePldGetOath() + 5 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto reflectDmg = Math::CalcStats::calcDamageReflect( m_pSource, actor, dmg.first,
|
auto reflectDmg = Math::CalcStats::calcDamageReflect( m_pSource, actor, dmg.first,
|
||||||
attackType == Common::AttackType::Physical ? Common::ActionTypeFilter::Physical :
|
attackType == Common::AttackType::Physical ? Common::ActionTypeFilter::Physical :
|
||||||
( attackType == Common::AttackType::Magical ? Common::ActionTypeFilter::Magical : Common::ActionTypeFilter::Unknown ) );
|
( attackType == Common::AttackType::Magical ? Common::ActionTypeFilter::Magical : Common::ActionTypeFilter::Unknown ) );
|
||||||
|
@ -554,29 +540,21 @@ void Action::Action::buildEffects()
|
||||||
{
|
{
|
||||||
m_effectBuilder->dodge( actor, actor );
|
m_effectBuilder->dodge( actor, actor );
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
if( dmg.first > 0 && isCorrectCombo() && shouldApplyComboSucceedEffect )
|
|
||||||
{
|
{
|
||||||
m_effectBuilder->comboSucceed( actor );
|
// todo: no effect or invulnerable
|
||||||
shouldApplyComboSucceedEffect = false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dmg.first > 0 && ( !isComboAction() || isCorrectCombo() ) )
|
if( !dodged )
|
||||||
|
{
|
||||||
|
if( ( !isComboAction() || isCorrectCombo() ) )
|
||||||
{
|
{
|
||||||
if ( !m_actionData->preservesCombo ) // this matches retail packet, on all standalone actions even casts.
|
if ( !m_actionData->preservesCombo ) // this matches retail packet, on all standalone actions even casts.
|
||||||
{
|
{
|
||||||
m_effectBuilder->startCombo( actor, getId() ); // this is on all targets hit
|
m_effectBuilder->startCombo( actor, getId() ); // this is on all targets hit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( m_lutEntry.healPotency > 0 )
|
|
||||||
{
|
|
||||||
auto heal = calcHealing( m_lutEntry.healPotency );
|
|
||||||
heal.first = Math::CalcStats::applyHealingReceiveMultiplier( *actor, heal.first );
|
|
||||||
m_effectBuilder->heal( actor, actor, heal.first, heal.second );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_lutEntry.bonusEffect & Common::ActionBonusEffect::SelfHeal )
|
if( m_lutEntry.bonusEffect & Common::ActionBonusEffect::SelfHeal )
|
||||||
{
|
{
|
||||||
|
@ -588,8 +566,24 @@ void Action::Action::buildEffects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( shouldGainPower )
|
if( isFirstValidVictim )
|
||||||
{
|
{
|
||||||
|
isFirstValidVictim = false;
|
||||||
|
|
||||||
|
if( isCorrectCombo() )
|
||||||
|
m_effectBuilder->comboSucceed( actor );
|
||||||
|
|
||||||
|
if( m_isAutoAttack && m_pSource->isPlayer() )
|
||||||
|
{
|
||||||
|
if( auto player = m_pSource->getAsPlayer() )
|
||||||
|
{
|
||||||
|
if( player->getClass() == Common::ClassJob::Paladin )
|
||||||
|
{
|
||||||
|
player->gaugePldSetOath( std::min( 100, player->gaugePldGetOath() + 5 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( m_lutEntry.bonusEffect & Common::ActionBonusEffect::GainMPPercentage )
|
if( m_lutEntry.bonusEffect & Common::ActionBonusEffect::GainMPPercentage )
|
||||||
{
|
{
|
||||||
if( checkActionBonusRequirement() )
|
if( checkActionBonusRequirement() )
|
||||||
|
@ -611,7 +605,15 @@ void Action::Action::buildEffects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shouldGainPower = false;
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_lutEntry.healPotency > 0 )
|
||||||
|
{
|
||||||
|
auto heal = calcHealing( m_lutEntry.healPotency );
|
||||||
|
heal.first = Math::CalcStats::applyHealingReceiveMultiplier( *actor, heal.first );
|
||||||
|
m_effectBuilder->heal( actor, actor, heal.first, heal.second );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_lutEntry.targetStatus != 0 )
|
if( m_lutEntry.targetStatus != 0 )
|
||||||
|
|
Loading…
Add table
Reference in a new issue