From 33463f45a9fad006c8653ede65b142502c715f50 Mon Sep 17 00:00:00 2001 From: Mordred Date: Wed, 15 Mar 2023 15:21:03 +0100 Subject: [PATCH] More cleanup of actions --- src/common/Common.h | 124 +++++++++++------------ src/world/Action/Action.cpp | 4 +- src/world/Action/Action.h | 4 +- src/world/Action/ActionResult.cpp | 34 +++---- src/world/Action/ActionResult.h | 4 +- src/world/Action/ActionResultBuilder.cpp | 6 +- src/world/Action/ActionResultBuilder.h | 4 +- src/world/Action/ItemAction.cpp | 2 +- src/world/Actor/Chara.cpp | 8 +- src/world/Manager/DebugCommandMgr.cpp | 4 +- src/world/Math/CalcStats.cpp | 18 ++-- src/world/Math/CalcStats.h | 6 +- src/world/Task/ActionIntegrityTask.cpp | 4 +- 13 files changed, 106 insertions(+), 116 deletions(-) diff --git a/src/common/Common.h b/src/common/Common.h index 4e07628f..18e529d1 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -948,74 +948,64 @@ namespace Sapphire::Common LimitBreak = 8, }; - enum ActionEffectType : uint8_t + enum CalcResultType : uint8_t { - CALC_RESULT_TYPE_NONE = 0x0, - CALC_RESULT_TYPE_MISS = 0x1, - CALC_RESULT_TYPE_RESIST = 0x2, - CALC_RESULT_TYPE_DAMAGE_HP = 0x3, - CALC_RESULT_TYPE_RECOVER_HP = 0x4, - CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP = 0x5, - CALC_RESULT_TYPE_CRITICAL_RECOVER_HP = 0x6, - CALC_RESULT_TYPE_GUARD = 0x7, - CALC_RESULT_TYPE_PARRY = 0x8, - CALC_RESULT_TYPE_INVALID = 0x9, - CALC_RESULT_TYPE_UNEFFECTIVE = 0xA, - CALC_RESULT_TYPE_NEGLECT = 0xB, - CALC_RESULT_TYPE_DAMAGE_MP = 0xC, - CALC_RESULT_TYPE_RECOVER_MP = 0xD, - CALC_RESULT_TYPE_DAMAGE_TP = 0xE, - CALC_RESULT_TYPE_RECOVER_TP = 0xF, - CALC_RESULT_TYPE_RECOVER_GP = 0x10, - CALC_RESULT_TYPE_SET_STATUS = 0x11, - CALC_RESULT_TYPE_SET_STATUS_ME = 0x12, - CALC_RESULT_TYPE_RESET_STATUS = 0x13, - CALC_RESULT_TYPE_RESET_STATUS_ME = 0x14, - CALC_RESULT_TYPE_RESET_BAD_STATUS = 0x15, - CALC_RESULT_TYPE_UNEFFECTIVE_STATUS = 0x16, - CALC_RESULT_TYPE_HALF_GOOD_STATUS = 0x17, - CALC_RESULT_TYPE_HATE_DIRECT = 0x18, - CALC_RESULT_TYPE_HATE_INDIRECTION = 0x19, - CALC_RESULT_TYPE_HATE_TOP = 0x1A, - CALC_RESULT_TYPE_HATE_ADD = 0x1B, - CALC_RESULT_TYPE_HATE_MULT = 0x1C, - CALC_RESULT_TYPE_COMBO = 0x1D, - CALC_RESULT_TYPE_COMBO_HIT = 0x1E, - CALC_RESULT_TYPE_COUNTER = 0x1F, - CALC_RESULT_TYPE_DESTRUCT = 0x20, - CALC_RESULT_TYPE_PARALYSIS = 0x21, - CALC_RESULT_TYPE_KNOCK_BACK = 0x22, - CALC_RESULT_TYPE_DRAW_UP_CHAIRS = 0x23, - CALC_RESULT_TYPE_SUCKED = 0x24, - CALC_RESULT_TYPE_CT_DRAW_UP_CHAIRS = 0x25, - CALC_RESULT_TYPE_LIVE_CALLBACK = 0x26, - CALC_RESULT_TYPE_MOUNT = 0x27, - CALC_RESULT_ARCHER_DOT = 0x28, - CALC_RESULT_MASTER_DOT = 0x29, - CALC_RESULT_BLESSINGS_OF_GODDESS = 0x2A, - CALC_RESULT_BAD_BREATH = 0x2B, - CALC_RESULT_REVIVAL = 0x2C, - CALC_RESULT_PET = 0x2D, - CALC_RESULT_TYPE_BLOW = 0x2E, - CALC_RESULT_TYPE_STATUS_RESIST = 0x2F, - CALC_RESULT_TYPE_CLEAR_PHYSICAL = 0x30, - CALC_RESULT_BNPC_STATE = 0x31, - CALC_RESULT_TYPE_VFX = 0x32, - CALC_RESULT_TYPE_HARD_CODE = 0x33, - CALC_RESULT_CALC_ID = 0x34, - CALC_RESULT_TYPE_CLEAR_PVP_POINT = 0x35, - CALC_RESULT_TYPE_CHECK_BARRIER = 0x36, - CALC_RESULT_TYPE_REFLEC = 0x37, - }; - - enum class ActionHitSeverityType : uint8_t - { - NormalDamage = 0, - CritHeal = 0, - CritDamage = 1, - NormalHeal = 1, - DirectHitDamage = 2, - CritDirectHitDamage = 3 + TypeNone = 0x0, + TypeMiss = 0x1, + TypeResist = 0x2, + TypeDamageHp = 0x3, + TypeRecoverHp = 0x4, + TypeCriticalDamageHp = 0x5, + TypeCriticalRecoverHp = 0x6, + TypeGuard = 0x7, + TypeParry = 0x8, + TypeInvalid = 0x9, + TypeUneffective = 0xA, + TypeNeglect = 0xB, + TypeDamageMp = 0xC, + TypeRecoverMp = 0xD, + TypeDamageTp = 0xE, + TypeRecoverTp = 0xF, + TypeRecoverGp = 0x10, + TypeSetStatus = 0x11, + TypeSetStatusMe = 0x12, + TypeResetStatus = 0x13, + TypeResetStatusMe = 0x14, + TypeResetBadStatus = 0x15, + TypeUneffectiveStatus = 0x16, + TypeHalfGoodStatus = 0x17, + TypeHateDirect = 0x18, + TypeHateIndirection = 0x19, + TypeHateTop = 0x1A, + TypeHateAdd = 0x1B, + TypeHateMult = 0x1C, + TypeCombo = 0x1D, + TypeComboHit = 0x1E, + TypeCounter = 0x1F, + TypeDestruct = 0x20, + TypeParalysis = 0x21, + TypeKnockBack = 0x22, + TypeDrawUpChairs = 0x23, + TypeSucked = 0x24, + TypeCtDrawUpChairs = 0x25, + TypeLiveCallback = 0x26, + TypeMount = 0x27, + TypeArcherDot = 0x28, + TypeMasterDot = 0x29, + TypeBlessingOfGoddess = 0x2A, + TypeBadBreath = 0x2B, + TypeRevival = 0x2C, + TypePet = 0x2D, + TypeBlow = 0x2E, + TypeStatusResist = 0x2F, + TypeClearPhysical = 0x30, + TypeBNpcState = 0x31, + TypeVfx = 0x32, + TypeHardCode = 0x33, + TypeCalcId = 0x34, + TypeClearPvpPoint = 0x35, + TypeCheckBarrier = 0x36, + TypeReflect = 0x37, }; enum class ActionResultFlag : uint8_t diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index 944ae4cf..5ea83d07 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -454,7 +454,7 @@ void Action::Action::execute() } } -std::pair< uint32_t, Common::ActionEffectType > Action::Action::calcDamage( uint32_t potency ) +std::pair< uint32_t, Common::CalcResultType > Action::Action::calcDamage( uint32_t potency ) { // todo: what do for npcs? auto wepDmg = 1.f; @@ -478,7 +478,7 @@ std::pair< uint32_t, Common::ActionEffectType > Action::Action::calcDamage( uint return Math::CalcStats::calcActionDamage( *m_pSource, potency, wepDmg ); } -std::pair< uint32_t, Common::ActionEffectType > Action::Action::calcHealing( uint32_t potency ) +std::pair< uint32_t, Common::CalcResultType > Action::Action::calcHealing( uint32_t potency ) { auto wepDmg = 1.f; diff --git a/src/world/Action/Action.h b/src/world/Action/Action.h index 83b5dbe3..3b0e5a9d 100644 --- a/src/world/Action/Action.h +++ b/src/world/Action/Action.h @@ -122,9 +122,9 @@ namespace Sapphire::World::Action */ void addDefaultActorFilters(); - std::pair< uint32_t, Common::ActionEffectType > calcDamage( uint32_t potency ); + std::pair< uint32_t, Common::CalcResultType > calcDamage( uint32_t potency ); - std::pair< uint32_t, Common::ActionEffectType > calcHealing( uint32_t potency ); + std::pair< uint32_t, Common::CalcResultType > calcHealing( uint32_t potency ); std::vector< Entity::CharaPtr >& getHitCharas(); diff --git a/src/world/Action/ActionResult.cpp b/src/world/Action/ActionResult.cpp index caedd31f..e07c308c 100644 --- a/src/world/Action/ActionResult.cpp +++ b/src/world/Action/ActionResult.cpp @@ -21,7 +21,7 @@ ActionResult::ActionResult( Entity::CharaPtr target ) : m_result.Arg2 = 0; m_result.Value = 0; m_result.Flag = static_cast< uint8_t >( Common::ActionResultFlag::None ); - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_NONE; + m_result.Type = Common::CalcResultType::TypeNone; } Entity::CharaPtr ActionResult::getTarget() const @@ -29,7 +29,7 @@ Entity::CharaPtr ActionResult::getTarget() const return m_target; } -void ActionResult::damage( uint32_t amount, Common::ActionEffectType hitType, uint8_t hitEffect, Common::ActionResultFlag flag ) +void ActionResult::damage( uint32_t amount, Common::CalcResultType hitType, uint8_t hitEffect, Common::ActionResultFlag flag ) { m_result.Arg0 = hitEffect; m_result.Value = static_cast< int16_t >( amount ); @@ -37,7 +37,7 @@ void ActionResult::damage( uint32_t amount, Common::ActionEffectType hitType, ui m_result.Type = hitType; } -void ActionResult::heal( uint32_t amount, Common::ActionEffectType hitType, uint8_t hitEffect, Common::ActionResultFlag flag ) +void ActionResult::heal( uint32_t amount, Common::CalcResultType hitType, uint8_t hitEffect, Common::ActionResultFlag flag ) { m_result.Arg0 = hitEffect; m_result.Value = static_cast< int16_t >( amount ); @@ -49,27 +49,27 @@ void ActionResult::restoreMP( uint32_t amount, Common::ActionResultFlag flag ) { 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_MP; + m_result.Type = Common::CalcResultType::TypeRecoverMp; } void ActionResult::startCombo( uint16_t actionId ) { m_result.Value = static_cast< int16_t >( actionId ); m_result.Flag = static_cast< uint8_t >( Common::ActionResultFlag::EffectOnSource ); - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_COMBO; + m_result.Type = Common::CalcResultType::TypeCombo; } void ActionResult::comboSucceed() { // no EffectOnSource flag on this - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_COMBO_HIT; + m_result.Type = Common::CalcResultType::TypeComboHit; } void ActionResult::applyStatusEffect( uint32_t id, int32_t duration, Entity::Chara& source, uint8_t param, bool shouldOverride ) { m_result.Value = static_cast< int16_t >( id ); m_result.Arg2 = param; - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS; + m_result.Type = Common::CalcResultType::TypeSetStatus; m_bOverrideStatus = shouldOverride; m_pStatus = StatusEffect::make_StatusEffect( id, source.getAsChara(), m_target, duration, 3000 ); @@ -80,7 +80,7 @@ void ActionResult::applyStatusEffectSelf( uint32_t id, int32_t duration, uint8_t { m_result.Value = static_cast< int16_t >( id ); m_result.Arg2 = param; - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS_ME; + m_result.Type = Common::CalcResultType::TypeSetStatusMe; m_result.Flag = static_cast< uint8_t >( Common::ActionResultFlag::EffectOnSource ); m_bOverrideStatus = shouldOverride; @@ -92,7 +92,7 @@ void ActionResult::mount( uint16_t mountId ) { m_result.Value = static_cast< int16_t >( mountId ); m_result.Arg0 = 1; - m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_MOUNT; + m_result.Type = Common::CalcResultType::TypeMount; } const Common::CalcResultParam& ActionResult::getCalcResultParam() const @@ -112,28 +112,28 @@ void ActionResult::execute() switch( m_result.Type ) { - case Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP: - case Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP: + case Common::CalcResultType::TypeDamageHp: + case Common::CalcResultType::TypeCriticalDamageHp: { m_target->takeDamage( m_result.Value ); break; } - case Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP: - case Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_RECOVER_HP: + case Common::CalcResultType::TypeRecoverHp: + case Common::CalcResultType::TypeCriticalRecoverHp: { m_target->heal( m_result.Value ); break; } - case Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_MP: + case Common::CalcResultType::TypeRecoverMp: { m_target->restoreMP( m_result.Value ); break; } - case Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS: - case Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS_ME: + case Common::CalcResultType::TypeSetStatus: + case Common::CalcResultType::TypeSetStatusMe: { if( !m_bOverrideStatus ) m_target->addStatusEffectByIdIfNotExist( m_pStatus ); @@ -142,7 +142,7 @@ void ActionResult::execute() break; } - case Common::ActionEffectType::CALC_RESULT_TYPE_MOUNT: + case Common::CalcResultType::TypeMount: { auto pPlayer = m_target->getAsPlayer(); pPlayer->setMount( m_result.Value ); diff --git a/src/world/Action/ActionResult.h b/src/world/Action/ActionResult.h index f951fbb0..b4ba479e 100644 --- a/src/world/Action/ActionResult.h +++ b/src/world/Action/ActionResult.h @@ -14,8 +14,8 @@ namespace Sapphire::World::Action public: explicit ActionResult( Entity::CharaPtr target ); - void damage( uint32_t amount, Common::ActionEffectType hitType, uint8_t hitEffect, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); - void heal( uint32_t amount, Common::ActionEffectType hitType, uint8_t hitEffect, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); + void damage( uint32_t amount, Common::CalcResultType hitType, uint8_t hitEffect, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); + void heal( uint32_t amount, Common::CalcResultType hitType, uint8_t hitEffect, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); void restoreMP( uint32_t amount, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); void startCombo( uint16_t actionId ); void comboSucceed(); diff --git a/src/world/Action/ActionResultBuilder.cpp b/src/world/Action/ActionResultBuilder.cpp index 23e82c16..66ba8c6c 100644 --- a/src/world/Action/ActionResultBuilder.cpp +++ b/src/world/Action/ActionResultBuilder.cpp @@ -47,7 +47,7 @@ void ActionResultBuilder::addResultToActor( Entity::CharaPtr& chara, ActionResul it->second.push_back( std::move( result ) ); } -void ActionResultBuilder::heal( Entity::CharaPtr& effectTarget, Entity::CharaPtr& healingTarget, uint32_t amount, Common::ActionEffectType hitType, Common::ActionResultFlag flag ) +void ActionResultBuilder::heal( Entity::CharaPtr& effectTarget, Entity::CharaPtr& healingTarget, uint32_t amount, Common::CalcResultType hitType, Common::ActionResultFlag flag ) { ActionResultPtr nextResult = make_ActionResult( healingTarget ); auto& exdData = Common::Service< Data::ExdData >::ref(); @@ -63,7 +63,7 @@ void ActionResultBuilder::restoreMP( Entity::CharaPtr& target, Entity::CharaPtr& addResultToActor( target, nextResult ); } -void ActionResultBuilder::damage( Entity::CharaPtr& effectTarget, Entity::CharaPtr& damagingTarget, uint32_t amount, Common::ActionEffectType hitType, Common::ActionResultFlag flag ) +void ActionResultBuilder::damage( Entity::CharaPtr& effectTarget, Entity::CharaPtr& damagingTarget, uint32_t amount, Common::CalcResultType hitType, Common::ActionResultFlag flag ) { ActionResultPtr nextResult = make_ActionResult( damagingTarget ); auto& exdData = Common::Service< Data::ExdData >::ref(); @@ -174,7 +174,7 @@ std::shared_ptr< FFXIVPacketBase > ActionResultBuilder::createActionResultPacket { auto effect = result->getCalcResultParam(); if( result->getTarget() == m_sourceChara && - result->getCalcResultParam().Type != Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS_ME ) + result->getCalcResultParam().Type != Common::CalcResultType::TypeSetStatusMe ) actionResult->addSourceEffect( effect ); else actionResult->addTargetEffect( effect ); diff --git a/src/world/Action/ActionResultBuilder.h b/src/world/Action/ActionResultBuilder.h index a70773e8..a5d1b936 100644 --- a/src/world/Action/ActionResultBuilder.h +++ b/src/world/Action/ActionResultBuilder.h @@ -11,14 +11,14 @@ namespace Sapphire::World::Action ActionResultBuilder( Entity::CharaPtr source, uint32_t actionId, uint32_t resultId, uint16_t requestId ); void heal( Entity::CharaPtr& effectTarget, Entity::CharaPtr& healingTarget, uint32_t amount, - Common::ActionEffectType hitType = Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP, + Common::CalcResultType hitType = Common::CalcResultType::TypeRecoverMp, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); void restoreMP( Entity::CharaPtr& effectTarget, Entity::CharaPtr& restoringTarget, uint32_t amount, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); void damage( Entity::CharaPtr& effectTarget, Entity::CharaPtr& damagingTarget, uint32_t amount, - Common::ActionEffectType hitType = Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP, + Common::CalcResultType hitType = Common::CalcResultType::TypeDamageHp, Common::ActionResultFlag flag = Common::ActionResultFlag::None ); void startCombo( Entity::CharaPtr& target, uint16_t actionId ); diff --git a/src/world/Action/ItemAction.cpp b/src/world/Action/ItemAction.cpp index fdb09aeb..ed096782 100644 --- a/src/world/Action/ItemAction.cpp +++ b/src/world/Action/ItemAction.cpp @@ -78,7 +78,7 @@ void ItemAction::interrupt() void ItemAction::handleVFXItem() { Common::CalcResultParam effect{}; - effect.Type = Common::ActionEffectType::CALC_RESULT_TYPE_CHECK_BARRIER; + effect.Type = Common::CalcResultType::TypeCheckBarrier; effect.Value = m_itemAction->data().Calcu0Arg[ 0 ]; auto effectPacket = std::make_shared< EffectPacket >( getSourceChara()->getId(), getSourceChara()->getId(), getId() ); diff --git a/src/world/Actor/Chara.cpp b/src/world/Actor/Chara.cpp index 58fefc9e..cf237326 100644 --- a/src/world/Actor/Chara.cpp +++ b/src/world/Actor/Chara.cpp @@ -475,8 +475,8 @@ void Chara::autoAttack( CharaPtr pTarget ) Common::CalcResultParam effectEntry{}; effectEntry.Value = static_cast< int16_t >( damage ); - effectEntry.Type = ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP; - effectEntry.Arg0 = static_cast< uint8_t >( ActionHitSeverityType::NormalDamage ); + effectEntry.Type = CalcResultType::TypeDamageHp; + effectEntry.Arg0 = 1; effectEntry.Arg2 = 0x71; effectPacket->addTargetEffect( effectEntry ); @@ -763,13 +763,13 @@ void Chara::onTick() { takeDamage( thisTickDmg ); Network::Util::Packet::sendActorControl( getInRangePlayerIds( isPlayer() ), getId(), HPFloatingText, 0, - ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP, thisTickDmg ); + CalcResultType::TypeDamageHp, thisTickDmg ); } if( thisTickHeal != 0 ) { heal( thisTickHeal ); Network::Util::Packet::sendActorControl( getInRangePlayerIds( isPlayer() ), getId(), HPFloatingText, 0, - ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP, thisTickHeal ); + CalcResultType::TypeRecoverMp, thisTickHeal ); } } \ No newline at end of file diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 7dcbe84c..2442c679 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -534,8 +534,8 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr< Common::CalcResultParam entry{}; entry.Value = static_cast< int16_t >( param1 ); - entry.Type = Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP; - entry.Arg0 = static_cast< uint8_t >( Common::ActionHitSeverityType::NormalDamage ); + entry.Type = Common::CalcResultType::TypeDamageHp; + entry.Arg0 = 1; effectPacket->addTargetEffect( entry, static_cast< uint64_t >( player.getId() ) ); effectPacket->setResultId( pCurrentZone->getNextActionResultId() ); diff --git a/src/world/Math/CalcStats.cpp b/src/world/Math/CalcStats.cpp index 4dbaa36e..e0b6fe28 100644 --- a/src/world/Math/CalcStats.cpp +++ b/src/world/Math/CalcStats.cpp @@ -549,7 +549,7 @@ float CalcStats::healingMagicPotency( const Sapphire::Entity::Chara& chara ) return std::floor( 100.f * ( chara.getStatValue( Common::BaseParam::HealingMagicPotency ) - 292.f ) / 264.f + 100.f ) / 100.f; } -std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcAutoAttackDamage( const Sapphire::Entity::Chara& chara ) +std::pair< float, Sapphire::Common::CalcResultType > CalcStats::calcAutoAttackDamage( const Sapphire::Entity::Chara& chara ) { // D = ⌊ f(ptc) × f(aa) × f(ap) × f(det) × f(tnc) × traits ⌋ × f(ss) ⌋ × // f(chr) ⌋ × f(dhr) ⌋ × rand[ 0.95, 1.05 ] ⌋ × buff_1 ⌋ × buff... ⌋ @@ -562,7 +562,7 @@ std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcAutoAttack // todo: everything after tenacity auto factor = Common::Util::trunc( pot * aa * ap * det, 0 ); - Sapphire::Common::ActionEffectType hitType = Sapphire::Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP; + Sapphire::Common::CalcResultType hitType = Sapphire::Common::CalcResultType::TypeDamageHp; // todo: traits @@ -571,7 +571,7 @@ std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcAutoAttack if( criticalHitProbability( chara ) > getRandomNumber0To100() ) { factor *= criticalHitBonus( chara ); - hitType = Sapphire::Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP; + hitType = Sapphire::Common::CalcResultType::TypeCriticalDamageHp; } factor *= 1.0f + ( ( getRandomNumber0To100() - 50.0f ) / 1000.0f ); @@ -592,7 +592,7 @@ std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcAutoAttack return std::pair( factor, hitType ); } -std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ) +std::pair< float, Sapphire::Common::CalcResultType > CalcStats::calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ) { // D = ⌊ f(pot) × f(wd) × f(ap) × f(det) × f(tnc) × traits ⌋ // × f(chr) ⌋ × f(dhr) ⌋ × rand[ 0.95, 1.05 ] ⌋ buff_1 ⌋ × buff_1 ⌋ × buff... ⌋ @@ -603,12 +603,12 @@ std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcActionDama auto det = determination( chara ); auto factor = Common::Util::trunc( pot * wd * ap * det, 0 ); - Sapphire::Common::ActionEffectType hitType = Sapphire::Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP; + Sapphire::Common::CalcResultType hitType = Sapphire::Common::CalcResultType::TypeDamageHp; if( criticalHitProbability( chara ) > getRandomNumber0To100() ) { factor *= criticalHitBonus( chara ); - hitType = Sapphire::Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP; + hitType = Sapphire::Common::CalcResultType::TypeCriticalDamageHp; } factor *= 1.0f + ( ( getRandomNumber0To100() - 50.0f ) / 1000.0f ); @@ -629,7 +629,7 @@ std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcActionDama return std::pair( factor, hitType ); } -std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcActionHealing( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ) +std::pair< float, Sapphire::Common::CalcResultType > CalcStats::calcActionHealing( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ) { // lol just for testing float det = chara.getStatValue( Common::BaseParam::Determination ); @@ -637,12 +637,12 @@ std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcActionHeal auto factor = std::floor( ( wepDmg * ( mnd / 200 ) + ( det / 10 ) ) * ( ptc / 100 ) * 1.3f ); - Sapphire::Common::ActionEffectType hitType = Sapphire::Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP; + Sapphire::Common::CalcResultType hitType = Sapphire::Common::CalcResultType::TypeRecoverHp; if( criticalHitProbability( chara ) > getRandomNumber0To100() ) { factor *= criticalHitBonus( chara ); - hitType = Sapphire::Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_RECOVER_HP; + hitType = Sapphire::Common::CalcResultType::TypeCriticalRecoverHp; } factor *= 1.0f + ( ( getRandomNumber0To100() - 50.0f ) / 1000.0f ); diff --git a/src/world/Math/CalcStats.h b/src/world/Math/CalcStats.h index a4c69ecc..ad1d5b94 100644 --- a/src/world/Math/CalcStats.h +++ b/src/world/Math/CalcStats.h @@ -136,11 +136,11 @@ namespace Sapphire::Math //////////////////////////////////////////// - static std::pair< float, Common::ActionEffectType > calcAutoAttackDamage( const Sapphire::Entity::Chara& chara ); + static std::pair< float, Common::CalcResultType > calcAutoAttackDamage( const Sapphire::Entity::Chara& chara ); - static std::pair< float, Common::ActionEffectType > calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ); + static std::pair< float, Common::CalcResultType > calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ); - static std::pair< float, Common::ActionEffectType > calcActionHealing( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ); + static std::pair< float, Common::CalcResultType > calcActionHealing( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg ); static uint32_t primaryStatValue( const Sapphire::Entity::Chara& chara ); private: diff --git a/src/world/Task/ActionIntegrityTask.cpp b/src/world/Task/ActionIntegrityTask.cpp index 7443a839..3f2d0749 100644 --- a/src/world/Task/ActionIntegrityTask.cpp +++ b/src/world/Task/ActionIntegrityTask.cpp @@ -52,8 +52,8 @@ void ActionIntegrityTask::execute() if( actionResult && actionResult->getTarget() ) actionResult->execute(); - if( ( actionResult->getCalcResultParam().Type == Common::CALC_RESULT_TYPE_SET_STATUS ) || - ( actionResult->getCalcResultParam().Type == Common::CALC_RESULT_TYPE_SET_STATUS_ME ) ) + if( ( actionResult->getCalcResultParam().Type == Common::TypeSetStatus ) || + ( actionResult->getCalcResultParam().Type == Common::TypeSetStatusMe ) ) { auto& status = data.Status[ statusIdx++ ]; auto pEffect = actionResult->getStatusEffect();