diff --git a/src/world/Action/ActionResult.cpp b/src/world/Action/ActionResult.cpp index aefdc2e3..999c05aa 100644 --- a/src/world/Action/ActionResult.cpp +++ b/src/world/Action/ActionResult.cpp @@ -37,18 +37,18 @@ uint64_t ActionResult::getDelay() void ActionResult::damage( uint32_t amount, Common::ActionHitSeverityType severity, Common::ActionResultFlag flag ) { - m_result.Arg0 = static_cast< uint8_t >( severity ); + //m_result.Arg0 = static_cast< uint8_t >( severity ); m_result.Value = static_cast< int16_t >( amount ); m_result.Flag = static_cast< uint8_t >( flag ); - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP; + m_result.Type = severity == Common::ActionHitSeverityType::CritDamage ? Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP : Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP; } void ActionResult::heal( uint32_t amount, Common::ActionHitSeverityType severity, Common::ActionResultFlag flag ) { - m_result.Arg1 = static_cast< uint8_t >( severity ); + //m_result.Arg1 = static_cast< uint8_t >( severity ); m_result.Value = static_cast< int16_t >( amount ); m_result.Flag = static_cast< uint8_t >( flag ); - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP; + m_result.Type = severity == Common::ActionHitSeverityType::CritHeal ? Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_RECOVER_HP : Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP; } void ActionResult::restoreMP( uint32_t amount, Common::ActionResultFlag flag ) @@ -119,12 +119,14 @@ void ActionResult::execute() switch( m_result.Type ) { case Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP: + case Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP: { m_target->takeDamage( m_result.Value ); break; } case Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP: + case Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_RECOVER_HP: { m_target->heal( m_result.Value ); break; diff --git a/src/world/Math/CalcStats.cpp b/src/world/Math/CalcStats.cpp index af58dad1..7c7980e9 100644 --- a/src/world/Math/CalcStats.cpp +++ b/src/world/Math/CalcStats.cpp @@ -287,19 +287,6 @@ float CalcStats::blockProbability( const Chara& chara ) return std::floor( ( 30 * blockRate ) / levelVal + 10 ); } -float CalcStats::directHitProbability( const Chara& chara ) -{ - const auto& baseStats = chara.getStats(); - auto level = chara.getLevel(); - - auto dhRate = chara.getStatValueFloat( Common::BaseParam::Accuracy ); - - auto divVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::DIV ] ); - auto subVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::SUB ] ); - - return std::floor( 550.f * ( dhRate - subVal ) / divVal ) / 10.f; -} - float CalcStats::criticalHitProbability( const Chara& chara ) { const auto& baseStats = chara.getStats(); @@ -589,14 +576,6 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcAutoA hitType = Sapphire::Common::ActionHitSeverityType::CritDamage; } - if( directHitProbability( chara ) > range100( rng ) ) - { - factor *= 1.25f; - hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ? - Sapphire::Common::ActionHitSeverityType::CritDirectHitDamage : - Sapphire::Common::ActionHitSeverityType::DirectHitDamage; - } - factor *= 1.0f + ( ( range100( rng ) - 50.0f ) / 1000.0f ); // todo: buffs @@ -634,14 +613,6 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio hitType = Sapphire::Common::ActionHitSeverityType::CritDamage; } - if( directHitProbability( chara ) > range100( rng ) ) - { - factor *= 1.25f; - hitType = hitType == Sapphire::Common::ActionHitSeverityType::CritDamage ? - Sapphire::Common::ActionHitSeverityType::CritDirectHitDamage : - Sapphire::Common::ActionHitSeverityType::DirectHitDamage; - } - factor *= 1.0f + ( ( range100( rng ) - 50.0f ) / 1000.0f ); // todo: buffs diff --git a/src/world/Math/CalcStats.h b/src/world/Math/CalcStats.h index 87625067..1e80ca81 100644 --- a/src/world/Math/CalcStats.h +++ b/src/world/Math/CalcStats.h @@ -34,11 +34,6 @@ namespace Sapphire::Math */ static float blockProbability( const Sapphire::Entity::Chara& chara ); - /*! - * @brief Calculates the probability of a direct hit happening - */ - static float directHitProbability( const Sapphire::Entity::Chara& chara ); - /*! * @brief Calculates the probability of a critical hit happening */