1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-28 20:27:46 +00:00

Merge branch 'crit_and_dh' into develop_c

This commit is contained in:
collett 2020-01-08 20:29:45 +09:00
commit 7f5a6c8203
9 changed files with 27 additions and 26 deletions

View file

@ -668,14 +668,14 @@ namespace Sapphire::Common
struct EffectEntry
{
Common::ActionEffectType effectType;
Common::ActionHitSeverityType hitSeverity;
Common::ActionHitSeverityType healSeverity;
uint8_t param0;
uint8_t param1;
/*!
* @brief Shows an additional percentage in the battle log
*
* Has no effect on what is shown and stored in value
*/
uint8_t param; // this one is the real param
uint8_t param2;
uint8_t valueMultiplier; // This multiplies whatever value is in the 'value' param by 10. Possibly a workaround for big numbers
uint8_t flags;
int16_t value;

View file

@ -12,10 +12,10 @@ EffectResult::EffectResult( Entity::CharaPtr target, uint64_t runAfter ) :
m_target( std::move( target ) ),
m_delayMs( runAfter ),
m_value( 0 ),
m_hitSeverity( Common::ActionHitSeverityType::NormalDamage ),
m_healSeverity( Common::ActionHitSeverityType::NormalHeal ),
m_param0( 0 ),
m_param1( 0 ),
m_type( Common::ActionEffectType::Nothing ),
m_param( 0 ),
m_param2( 0 ),
m_flag( Common::ActionEffectResultFlag::None )
{
@ -38,7 +38,7 @@ uint64_t EffectResult::getDelay()
void EffectResult::damage( uint32_t amount, Common::ActionHitSeverityType severity, Common::ActionEffectResultFlag flag )
{
m_hitSeverity = severity;
m_param0 = static_cast< uint8_t >( severity );
m_value = amount;
m_flag = flag;
@ -47,7 +47,7 @@ void EffectResult::damage( uint32_t amount, Common::ActionHitSeverityType severi
void EffectResult::heal( uint32_t amount, Common::ActionHitSeverityType severity, Common::ActionEffectResultFlag flag )
{
m_healSeverity = severity;
m_param1 = static_cast< uint8_t >( severity );
m_value = amount;
m_flag = flag;
@ -79,7 +79,7 @@ void EffectResult::comboSucceed()
void EffectResult::applyStatusEffect( uint16_t statusId, uint8_t param )
{
m_value = statusId;
m_param = param;
m_param2 = param;
m_type = Common::ActionEffectType::ApplyStatusEffect;
}
@ -90,10 +90,10 @@ Common::EffectEntry EffectResult::buildEffectEntry() const
// todo: that retarded shit so > u16 max numbers work
entry.value = getValue();
entry.hitSeverity = m_hitSeverity;
entry.healSeverity = m_healSeverity;
entry.param0 = m_param0;
entry.param1 = m_param1;
entry.effectType = m_type;
entry.param = m_param;
entry.param2 = m_param2;
entry.flags = static_cast< uint8_t >( m_flag );
return entry;

View file

@ -37,12 +37,13 @@ namespace Sapphire::World::Action
Entity::CharaPtr m_target;
Common::ActionHitSeverityType m_hitSeverity;
Common::ActionHitSeverityType m_healSeverity;
Common::ActionEffectType m_type;
uint8_t m_param0;
uint8_t m_param1;
uint8_t m_param2;
uint32_t m_value;
uint8_t m_param;
Common::ActionEffectResultFlag m_flag;
};
}

View file

@ -699,8 +699,8 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
Common::EffectEntry effectEntry{};
effectEntry.value = static_cast< int16_t >( damage.first );
effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = damage.second;
effectEntry.param = 0x71;
effectEntry.param0 = static_cast< uint8_t >( damage.second );
effectEntry.param2 = 0x71;
effectPacket->addEffect( effectEntry );
sendToInRangeSet( effectPacket );

View file

@ -508,8 +508,8 @@ void Sapphire::Entity::Chara::autoAttack( CharaPtr pTarget )
Common::EffectEntry effectEntry{};
effectEntry.value = static_cast< int16_t >( damage );
effectEntry.effectType = ActionEffectType::Damage;
effectEntry.hitSeverity = ActionHitSeverityType::NormalDamage;
effectEntry.param = 0x71;
effectEntry.param0 = static_cast< uint8_t >( ActionHitSeverityType::NormalDamage );
effectEntry.param2 = 0x71;
effectPacket->addEffect( effectEntry );
sendToInRangeSet( effectPacket );

View file

@ -1587,8 +1587,8 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
Common::EffectEntry entry{};
entry.value = damage.first;
entry.effectType = Common::ActionEffectType::Damage;
entry.hitSeverity = damage.second;
entry.param = 0x72;
entry.param0 = static_cast< uint8_t >( damage.second );
entry.param2 = 0x72;
effectPacket->addEffect( entry );
@ -1602,8 +1602,8 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
Common::EffectEntry entry{};
entry.value = damage.first;
entry.effectType = Common::ActionEffectType::Damage;
entry.hitSeverity = damage.second;
entry.param = 0x73;
entry.param0 = static_cast< uint8_t >( damage.second );
entry.param2 = 0x73;
effectPacket->addEffect( entry );

View file

@ -513,7 +513,7 @@ void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player&
Common::EffectEntry entry{};
entry.value = static_cast< int16_t >( param1 );
entry.effectType = Common::ActionEffectType::Damage;
entry.hitSeverity = Common::ActionHitSeverityType::NormalDamage;
entry.param0 = static_cast< uint8_t >( Common::ActionHitSeverityType::NormalDamage );
effectPacket->addEffect( entry );

View file

@ -548,7 +548,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActio
std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActionHealing( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg )
{
// lol just for testing
auto factor = std::floor( ptc * chara.getLevel() / 4.0f );
auto factor = std::floor( ptc * ( wepDmg / 10.0f ) + ptc );
Sapphire::Common::ActionHitSeverityType hitType = Sapphire::Common::ActionHitSeverityType::NormalHeal;
if( criticalHitProbability( chara ) > range100( rng ) )

View file

@ -147,7 +147,7 @@ namespace Sapphire::Math
static std::random_device dev;
static std::mt19937 rng;
static std::uniform_int_distribution<std::mt19937::result_type> range100;
static std::uniform_int_distribution< std::mt19937::result_type > range100;
};
}