mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
More cleanup of actions
This commit is contained in:
parent
aafb77ecbb
commit
33463f45a9
13 changed files with 106 additions and 116 deletions
|
@ -948,74 +948,64 @@ namespace Sapphire::Common
|
||||||
LimitBreak = 8,
|
LimitBreak = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ActionEffectType : uint8_t
|
enum CalcResultType : uint8_t
|
||||||
{
|
{
|
||||||
CALC_RESULT_TYPE_NONE = 0x0,
|
TypeNone = 0x0,
|
||||||
CALC_RESULT_TYPE_MISS = 0x1,
|
TypeMiss = 0x1,
|
||||||
CALC_RESULT_TYPE_RESIST = 0x2,
|
TypeResist = 0x2,
|
||||||
CALC_RESULT_TYPE_DAMAGE_HP = 0x3,
|
TypeDamageHp = 0x3,
|
||||||
CALC_RESULT_TYPE_RECOVER_HP = 0x4,
|
TypeRecoverHp = 0x4,
|
||||||
CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP = 0x5,
|
TypeCriticalDamageHp = 0x5,
|
||||||
CALC_RESULT_TYPE_CRITICAL_RECOVER_HP = 0x6,
|
TypeCriticalRecoverHp = 0x6,
|
||||||
CALC_RESULT_TYPE_GUARD = 0x7,
|
TypeGuard = 0x7,
|
||||||
CALC_RESULT_TYPE_PARRY = 0x8,
|
TypeParry = 0x8,
|
||||||
CALC_RESULT_TYPE_INVALID = 0x9,
|
TypeInvalid = 0x9,
|
||||||
CALC_RESULT_TYPE_UNEFFECTIVE = 0xA,
|
TypeUneffective = 0xA,
|
||||||
CALC_RESULT_TYPE_NEGLECT = 0xB,
|
TypeNeglect = 0xB,
|
||||||
CALC_RESULT_TYPE_DAMAGE_MP = 0xC,
|
TypeDamageMp = 0xC,
|
||||||
CALC_RESULT_TYPE_RECOVER_MP = 0xD,
|
TypeRecoverMp = 0xD,
|
||||||
CALC_RESULT_TYPE_DAMAGE_TP = 0xE,
|
TypeDamageTp = 0xE,
|
||||||
CALC_RESULT_TYPE_RECOVER_TP = 0xF,
|
TypeRecoverTp = 0xF,
|
||||||
CALC_RESULT_TYPE_RECOVER_GP = 0x10,
|
TypeRecoverGp = 0x10,
|
||||||
CALC_RESULT_TYPE_SET_STATUS = 0x11,
|
TypeSetStatus = 0x11,
|
||||||
CALC_RESULT_TYPE_SET_STATUS_ME = 0x12,
|
TypeSetStatusMe = 0x12,
|
||||||
CALC_RESULT_TYPE_RESET_STATUS = 0x13,
|
TypeResetStatus = 0x13,
|
||||||
CALC_RESULT_TYPE_RESET_STATUS_ME = 0x14,
|
TypeResetStatusMe = 0x14,
|
||||||
CALC_RESULT_TYPE_RESET_BAD_STATUS = 0x15,
|
TypeResetBadStatus = 0x15,
|
||||||
CALC_RESULT_TYPE_UNEFFECTIVE_STATUS = 0x16,
|
TypeUneffectiveStatus = 0x16,
|
||||||
CALC_RESULT_TYPE_HALF_GOOD_STATUS = 0x17,
|
TypeHalfGoodStatus = 0x17,
|
||||||
CALC_RESULT_TYPE_HATE_DIRECT = 0x18,
|
TypeHateDirect = 0x18,
|
||||||
CALC_RESULT_TYPE_HATE_INDIRECTION = 0x19,
|
TypeHateIndirection = 0x19,
|
||||||
CALC_RESULT_TYPE_HATE_TOP = 0x1A,
|
TypeHateTop = 0x1A,
|
||||||
CALC_RESULT_TYPE_HATE_ADD = 0x1B,
|
TypeHateAdd = 0x1B,
|
||||||
CALC_RESULT_TYPE_HATE_MULT = 0x1C,
|
TypeHateMult = 0x1C,
|
||||||
CALC_RESULT_TYPE_COMBO = 0x1D,
|
TypeCombo = 0x1D,
|
||||||
CALC_RESULT_TYPE_COMBO_HIT = 0x1E,
|
TypeComboHit = 0x1E,
|
||||||
CALC_RESULT_TYPE_COUNTER = 0x1F,
|
TypeCounter = 0x1F,
|
||||||
CALC_RESULT_TYPE_DESTRUCT = 0x20,
|
TypeDestruct = 0x20,
|
||||||
CALC_RESULT_TYPE_PARALYSIS = 0x21,
|
TypeParalysis = 0x21,
|
||||||
CALC_RESULT_TYPE_KNOCK_BACK = 0x22,
|
TypeKnockBack = 0x22,
|
||||||
CALC_RESULT_TYPE_DRAW_UP_CHAIRS = 0x23,
|
TypeDrawUpChairs = 0x23,
|
||||||
CALC_RESULT_TYPE_SUCKED = 0x24,
|
TypeSucked = 0x24,
|
||||||
CALC_RESULT_TYPE_CT_DRAW_UP_CHAIRS = 0x25,
|
TypeCtDrawUpChairs = 0x25,
|
||||||
CALC_RESULT_TYPE_LIVE_CALLBACK = 0x26,
|
TypeLiveCallback = 0x26,
|
||||||
CALC_RESULT_TYPE_MOUNT = 0x27,
|
TypeMount = 0x27,
|
||||||
CALC_RESULT_ARCHER_DOT = 0x28,
|
TypeArcherDot = 0x28,
|
||||||
CALC_RESULT_MASTER_DOT = 0x29,
|
TypeMasterDot = 0x29,
|
||||||
CALC_RESULT_BLESSINGS_OF_GODDESS = 0x2A,
|
TypeBlessingOfGoddess = 0x2A,
|
||||||
CALC_RESULT_BAD_BREATH = 0x2B,
|
TypeBadBreath = 0x2B,
|
||||||
CALC_RESULT_REVIVAL = 0x2C,
|
TypeRevival = 0x2C,
|
||||||
CALC_RESULT_PET = 0x2D,
|
TypePet = 0x2D,
|
||||||
CALC_RESULT_TYPE_BLOW = 0x2E,
|
TypeBlow = 0x2E,
|
||||||
CALC_RESULT_TYPE_STATUS_RESIST = 0x2F,
|
TypeStatusResist = 0x2F,
|
||||||
CALC_RESULT_TYPE_CLEAR_PHYSICAL = 0x30,
|
TypeClearPhysical = 0x30,
|
||||||
CALC_RESULT_BNPC_STATE = 0x31,
|
TypeBNpcState = 0x31,
|
||||||
CALC_RESULT_TYPE_VFX = 0x32,
|
TypeVfx = 0x32,
|
||||||
CALC_RESULT_TYPE_HARD_CODE = 0x33,
|
TypeHardCode = 0x33,
|
||||||
CALC_RESULT_CALC_ID = 0x34,
|
TypeCalcId = 0x34,
|
||||||
CALC_RESULT_TYPE_CLEAR_PVP_POINT = 0x35,
|
TypeClearPvpPoint = 0x35,
|
||||||
CALC_RESULT_TYPE_CHECK_BARRIER = 0x36,
|
TypeCheckBarrier = 0x36,
|
||||||
CALC_RESULT_TYPE_REFLEC = 0x37,
|
TypeReflect = 0x37,
|
||||||
};
|
|
||||||
|
|
||||||
enum class ActionHitSeverityType : uint8_t
|
|
||||||
{
|
|
||||||
NormalDamage = 0,
|
|
||||||
CritHeal = 0,
|
|
||||||
CritDamage = 1,
|
|
||||||
NormalHeal = 1,
|
|
||||||
DirectHitDamage = 2,
|
|
||||||
CritDirectHitDamage = 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ActionResultFlag : uint8_t
|
enum class ActionResultFlag : uint8_t
|
||||||
|
|
|
@ -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?
|
// todo: what do for npcs?
|
||||||
auto wepDmg = 1.f;
|
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 );
|
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;
|
auto wepDmg = 1.f;
|
||||||
|
|
||||||
|
|
|
@ -122,9 +122,9 @@ namespace Sapphire::World::Action
|
||||||
*/
|
*/
|
||||||
void addDefaultActorFilters();
|
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();
|
std::vector< Entity::CharaPtr >& getHitCharas();
|
||||||
|
|
|
@ -21,7 +21,7 @@ ActionResult::ActionResult( Entity::CharaPtr target ) :
|
||||||
m_result.Arg2 = 0;
|
m_result.Arg2 = 0;
|
||||||
m_result.Value = 0;
|
m_result.Value = 0;
|
||||||
m_result.Flag = static_cast< uint8_t >( Common::ActionResultFlag::None );
|
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
|
Entity::CharaPtr ActionResult::getTarget() const
|
||||||
|
@ -29,7 +29,7 @@ Entity::CharaPtr ActionResult::getTarget() const
|
||||||
return m_target;
|
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.Arg0 = hitEffect;
|
||||||
m_result.Value = static_cast< int16_t >( amount );
|
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;
|
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.Arg0 = hitEffect;
|
||||||
m_result.Value = static_cast< int16_t >( amount );
|
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.Value = static_cast< int16_t >( amount );
|
||||||
m_result.Flag = static_cast< uint8_t >( flag );
|
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 )
|
void ActionResult::startCombo( uint16_t actionId )
|
||||||
{
|
{
|
||||||
m_result.Value = static_cast< int16_t >( actionId );
|
m_result.Value = static_cast< int16_t >( actionId );
|
||||||
m_result.Flag = static_cast< uint8_t >( Common::ActionResultFlag::EffectOnSource );
|
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()
|
void ActionResult::comboSucceed()
|
||||||
{
|
{
|
||||||
// no EffectOnSource flag on this
|
// 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 )
|
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.Value = static_cast< int16_t >( id );
|
||||||
m_result.Arg2 = param;
|
m_result.Arg2 = param;
|
||||||
m_result.Type = Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS;
|
m_result.Type = Common::CalcResultType::TypeSetStatus;
|
||||||
|
|
||||||
m_bOverrideStatus = shouldOverride;
|
m_bOverrideStatus = shouldOverride;
|
||||||
m_pStatus = StatusEffect::make_StatusEffect( id, source.getAsChara(), m_target, duration, 3000 );
|
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.Value = static_cast< int16_t >( id );
|
||||||
m_result.Arg2 = param;
|
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_result.Flag = static_cast< uint8_t >( Common::ActionResultFlag::EffectOnSource );
|
||||||
|
|
||||||
m_bOverrideStatus = shouldOverride;
|
m_bOverrideStatus = shouldOverride;
|
||||||
|
@ -92,7 +92,7 @@ void ActionResult::mount( uint16_t mountId )
|
||||||
{
|
{
|
||||||
m_result.Value = static_cast< int16_t >( mountId );
|
m_result.Value = static_cast< int16_t >( mountId );
|
||||||
m_result.Arg0 = 1;
|
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
|
const Common::CalcResultParam& ActionResult::getCalcResultParam() const
|
||||||
|
@ -112,28 +112,28 @@ void ActionResult::execute()
|
||||||
|
|
||||||
switch( m_result.Type )
|
switch( m_result.Type )
|
||||||
{
|
{
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP:
|
case Common::CalcResultType::TypeDamageHp:
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_DAMAGE_HP:
|
case Common::CalcResultType::TypeCriticalDamageHp:
|
||||||
{
|
{
|
||||||
m_target->takeDamage( m_result.Value );
|
m_target->takeDamage( m_result.Value );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP:
|
case Common::CalcResultType::TypeRecoverHp:
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_CRITICAL_RECOVER_HP:
|
case Common::CalcResultType::TypeCriticalRecoverHp:
|
||||||
{
|
{
|
||||||
m_target->heal( m_result.Value );
|
m_target->heal( m_result.Value );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_RECOVER_MP:
|
case Common::CalcResultType::TypeRecoverMp:
|
||||||
{
|
{
|
||||||
m_target->restoreMP( m_result.Value );
|
m_target->restoreMP( m_result.Value );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS:
|
case Common::CalcResultType::TypeSetStatus:
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_SET_STATUS_ME:
|
case Common::CalcResultType::TypeSetStatusMe:
|
||||||
{
|
{
|
||||||
if( !m_bOverrideStatus )
|
if( !m_bOverrideStatus )
|
||||||
m_target->addStatusEffectByIdIfNotExist( m_pStatus );
|
m_target->addStatusEffectByIdIfNotExist( m_pStatus );
|
||||||
|
@ -142,7 +142,7 @@ void ActionResult::execute()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Common::ActionEffectType::CALC_RESULT_TYPE_MOUNT:
|
case Common::CalcResultType::TypeMount:
|
||||||
{
|
{
|
||||||
auto pPlayer = m_target->getAsPlayer();
|
auto pPlayer = m_target->getAsPlayer();
|
||||||
pPlayer->setMount( m_result.Value );
|
pPlayer->setMount( m_result.Value );
|
||||||
|
|
|
@ -14,8 +14,8 @@ namespace Sapphire::World::Action
|
||||||
public:
|
public:
|
||||||
explicit ActionResult( Entity::CharaPtr target );
|
explicit ActionResult( Entity::CharaPtr target );
|
||||||
|
|
||||||
void damage( 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::ActionEffectType 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 restoreMP( uint32_t amount, Common::ActionResultFlag flag = Common::ActionResultFlag::None );
|
||||||
void startCombo( uint16_t actionId );
|
void startCombo( uint16_t actionId );
|
||||||
void comboSucceed();
|
void comboSucceed();
|
||||||
|
|
|
@ -47,7 +47,7 @@ void ActionResultBuilder::addResultToActor( Entity::CharaPtr& chara, ActionResul
|
||||||
it->second.push_back( std::move( result ) );
|
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 );
|
ActionResultPtr nextResult = make_ActionResult( healingTarget );
|
||||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||||
|
@ -63,7 +63,7 @@ void ActionResultBuilder::restoreMP( Entity::CharaPtr& target, Entity::CharaPtr&
|
||||||
addResultToActor( target, nextResult );
|
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 );
|
ActionResultPtr nextResult = make_ActionResult( damagingTarget );
|
||||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||||
|
@ -174,7 +174,7 @@ std::shared_ptr< FFXIVPacketBase > ActionResultBuilder::createActionResultPacket
|
||||||
{
|
{
|
||||||
auto effect = result->getCalcResultParam();
|
auto effect = result->getCalcResultParam();
|
||||||
if( result->getTarget() == m_sourceChara &&
|
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 );
|
actionResult->addSourceEffect( effect );
|
||||||
else
|
else
|
||||||
actionResult->addTargetEffect( effect );
|
actionResult->addTargetEffect( effect );
|
||||||
|
|
|
@ -11,14 +11,14 @@ namespace Sapphire::World::Action
|
||||||
ActionResultBuilder( Entity::CharaPtr source, uint32_t actionId, uint32_t resultId, uint16_t requestId );
|
ActionResultBuilder( Entity::CharaPtr source, uint32_t actionId, uint32_t resultId, uint16_t requestId );
|
||||||
|
|
||||||
void heal( Entity::CharaPtr& effectTarget, Entity::CharaPtr& healingTarget, uint32_t amount,
|
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 );
|
Common::ActionResultFlag flag = Common::ActionResultFlag::None );
|
||||||
|
|
||||||
void restoreMP( Entity::CharaPtr& effectTarget, Entity::CharaPtr& restoringTarget, uint32_t amount,
|
void restoreMP( Entity::CharaPtr& effectTarget, Entity::CharaPtr& restoringTarget, uint32_t amount,
|
||||||
Common::ActionResultFlag flag = Common::ActionResultFlag::None );
|
Common::ActionResultFlag flag = Common::ActionResultFlag::None );
|
||||||
|
|
||||||
void damage( Entity::CharaPtr& effectTarget, Entity::CharaPtr& damagingTarget, uint32_t amount,
|
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 );
|
Common::ActionResultFlag flag = Common::ActionResultFlag::None );
|
||||||
|
|
||||||
void startCombo( Entity::CharaPtr& target, uint16_t actionId );
|
void startCombo( Entity::CharaPtr& target, uint16_t actionId );
|
||||||
|
|
|
@ -78,7 +78,7 @@ void ItemAction::interrupt()
|
||||||
void ItemAction::handleVFXItem()
|
void ItemAction::handleVFXItem()
|
||||||
{
|
{
|
||||||
Common::CalcResultParam effect{};
|
Common::CalcResultParam effect{};
|
||||||
effect.Type = Common::ActionEffectType::CALC_RESULT_TYPE_CHECK_BARRIER;
|
effect.Type = Common::CalcResultType::TypeCheckBarrier;
|
||||||
effect.Value = m_itemAction->data().Calcu0Arg[ 0 ];
|
effect.Value = m_itemAction->data().Calcu0Arg[ 0 ];
|
||||||
|
|
||||||
auto effectPacket = std::make_shared< EffectPacket >( getSourceChara()->getId(), getSourceChara()->getId(), getId() );
|
auto effectPacket = std::make_shared< EffectPacket >( getSourceChara()->getId(), getSourceChara()->getId(), getId() );
|
||||||
|
|
|
@ -475,8 +475,8 @@ void Chara::autoAttack( CharaPtr pTarget )
|
||||||
|
|
||||||
Common::CalcResultParam effectEntry{};
|
Common::CalcResultParam effectEntry{};
|
||||||
effectEntry.Value = static_cast< int16_t >( damage );
|
effectEntry.Value = static_cast< int16_t >( damage );
|
||||||
effectEntry.Type = ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP;
|
effectEntry.Type = CalcResultType::TypeDamageHp;
|
||||||
effectEntry.Arg0 = static_cast< uint8_t >( ActionHitSeverityType::NormalDamage );
|
effectEntry.Arg0 = 1;
|
||||||
effectEntry.Arg2 = 0x71;
|
effectEntry.Arg2 = 0x71;
|
||||||
effectPacket->addTargetEffect( effectEntry );
|
effectPacket->addTargetEffect( effectEntry );
|
||||||
|
|
||||||
|
@ -763,13 +763,13 @@ void Chara::onTick()
|
||||||
{
|
{
|
||||||
takeDamage( thisTickDmg );
|
takeDamage( thisTickDmg );
|
||||||
Network::Util::Packet::sendActorControl( getInRangePlayerIds( isPlayer() ), getId(), HPFloatingText, 0,
|
Network::Util::Packet::sendActorControl( getInRangePlayerIds( isPlayer() ), getId(), HPFloatingText, 0,
|
||||||
ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP, thisTickDmg );
|
CalcResultType::TypeDamageHp, thisTickDmg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( thisTickHeal != 0 )
|
if( thisTickHeal != 0 )
|
||||||
{
|
{
|
||||||
heal( thisTickHeal );
|
heal( thisTickHeal );
|
||||||
Network::Util::Packet::sendActorControl( getInRangePlayerIds( isPlayer() ), getId(), HPFloatingText, 0,
|
Network::Util::Packet::sendActorControl( getInRangePlayerIds( isPlayer() ), getId(), HPFloatingText, 0,
|
||||||
ActionEffectType::CALC_RESULT_TYPE_RECOVER_HP, thisTickHeal );
|
CalcResultType::TypeRecoverMp, thisTickHeal );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -534,8 +534,8 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr<
|
||||||
|
|
||||||
Common::CalcResultParam entry{};
|
Common::CalcResultParam entry{};
|
||||||
entry.Value = static_cast< int16_t >( param1 );
|
entry.Value = static_cast< int16_t >( param1 );
|
||||||
entry.Type = Common::ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP;
|
entry.Type = Common::CalcResultType::TypeDamageHp;
|
||||||
entry.Arg0 = static_cast< uint8_t >( Common::ActionHitSeverityType::NormalDamage );
|
entry.Arg0 = 1;
|
||||||
|
|
||||||
effectPacket->addTargetEffect( entry, static_cast< uint64_t >( player.getId() ) );
|
effectPacket->addTargetEffect( entry, static_cast< uint64_t >( player.getId() ) );
|
||||||
effectPacket->setResultId( pCurrentZone->getNextActionResultId() );
|
effectPacket->setResultId( pCurrentZone->getNextActionResultId() );
|
||||||
|
|
|
@ -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;
|
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) ⌋ ×
|
// 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... ⌋
|
// 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
|
// todo: everything after tenacity
|
||||||
auto factor = Common::Util::trunc( pot * aa * ap * det, 0 );
|
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
|
// todo: traits
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ std::pair< float, Sapphire::Common::ActionEffectType > CalcStats::calcAutoAttack
|
||||||
if( criticalHitProbability( chara ) > getRandomNumber0To100() )
|
if( criticalHitProbability( chara ) > getRandomNumber0To100() )
|
||||||
{
|
{
|
||||||
factor *= criticalHitBonus( chara );
|
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 );
|
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 );
|
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 ⌋
|
// 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... ⌋
|
// × 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 det = determination( chara );
|
||||||
|
|
||||||
auto factor = Common::Util::trunc( pot * wd * ap * det, 0 );
|
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() )
|
if( criticalHitProbability( chara ) > getRandomNumber0To100() )
|
||||||
{
|
{
|
||||||
factor *= criticalHitBonus( chara );
|
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 );
|
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 );
|
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
|
// lol just for testing
|
||||||
float det = chara.getStatValue( Common::BaseParam::Determination );
|
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 );
|
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() )
|
if( criticalHitProbability( chara ) > getRandomNumber0To100() )
|
||||||
{
|
{
|
||||||
factor *= criticalHitBonus( chara );
|
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 );
|
factor *= 1.0f + ( ( getRandomNumber0To100() - 50.0f ) / 1000.0f );
|
||||||
|
|
|
@ -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 );
|
static uint32_t primaryStatValue( const Sapphire::Entity::Chara& chara );
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -52,8 +52,8 @@ void ActionIntegrityTask::execute()
|
||||||
if( actionResult && actionResult->getTarget() )
|
if( actionResult && actionResult->getTarget() )
|
||||||
actionResult->execute();
|
actionResult->execute();
|
||||||
|
|
||||||
if( ( actionResult->getCalcResultParam().Type == Common::CALC_RESULT_TYPE_SET_STATUS ) ||
|
if( ( actionResult->getCalcResultParam().Type == Common::TypeSetStatus ) ||
|
||||||
( actionResult->getCalcResultParam().Type == Common::CALC_RESULT_TYPE_SET_STATUS_ME ) )
|
( actionResult->getCalcResultParam().Type == Common::TypeSetStatusMe ) )
|
||||||
{
|
{
|
||||||
auto& status = data.Status[ statusIdx++ ];
|
auto& status = data.Status[ statusIdx++ ];
|
||||||
auto pEffect = actionResult->getStatusEffect();
|
auto pEffect = actionResult->getStatusEffect();
|
||||||
|
|
Loading…
Add table
Reference in a new issue