1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-06-15 20:07:46 +00:00

Removed redundant max_hp/max_mp

This commit is contained in:
Mordred 2023-02-21 07:58:53 +01:00
parent 065c1817bd
commit d34bddc6ae
4 changed files with 10 additions and 23 deletions

View file

@ -120,9 +120,6 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance
m_state = BNpcState::Idle;
m_status = ActorStatus::Idle;
max_hp = m_maxHp;
max_mp = 200;
memset( m_customize, 0, sizeof( m_customize ) );
memset( m_modelEquip, 0, sizeof( m_modelEquip ) );
@ -166,8 +163,6 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance
if( m_bnpcType == BNpcType::Friendly )
m_maxHp *= 5;
max_hp = m_maxHp;
}
Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstanceObject > pInfo, const Territory& zone, uint32_t hp, Common::BNpcType type ) :
@ -231,9 +226,6 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, std::shared_ptr< Common::BNPCInstance
m_state = BNpcState::Idle;
m_status = ActorStatus::Idle;
max_hp = hp;
max_mp = 200;
m_bnpcType = type;
memset( m_customize, 0, sizeof( m_customize ) );
@ -1074,5 +1066,4 @@ void Sapphire::Entity::BNpc::init()
{
m_maxHp = Sapphire::Math::CalcStats::calculateMaxHp( *getAsChara() );
m_hp = m_maxHp;
max_hp = m_maxHp;
}

View file

@ -200,13 +200,13 @@ bool Sapphire::Entity::Chara::isAlive() const
/*! \return max hp for the actor */
uint32_t Sapphire::Entity::Chara::getMaxHp() const
{
return max_hp;
return m_maxHp;
}
/*! \return max mp for the actor */
uint32_t Sapphire::Entity::Chara::getMaxMp() const
{
return max_mp;
return m_maxMp;
}
/*! \return reset hp to current max hp */

View file

@ -54,10 +54,6 @@ namespace Sapphire::Entity
uint16_t m_tp;
/*! Current GP of the actor */
uint16_t m_gp;
/*! max mp of the actor */
uint32_t max_mp = 0;
/*! max hp of the actor */
uint32_t max_hp = 0;
/*! Additional look info of the actor */
uint8_t m_customize[26];
/*! Additional model info */

View file

@ -136,12 +136,12 @@ void Player::unload()
// TODO: add a proper calculation based on race / job / level / gear
uint32_t Player::getMaxHp()
{
return max_hp;
return m_maxHp;
}
uint32_t Player::getMaxMp()
{
return max_mp;
return m_maxMp;
}
uint32_t Player::getPrevTerritoryId() const
@ -373,15 +373,15 @@ void Player::calculateStats()
setStatValue( BaseParam::PiercingResistance, 0 );
max_mp = Math::CalcStats::calculateMaxMp( *this );
m_maxMp = Math::CalcStats::calculateMaxMp( *this );
max_hp = Math::CalcStats::calculateMaxHp( *this );
m_maxHp = Math::CalcStats::calculateMaxHp( *this );
if( m_mp > max_mp )
m_mp = max_mp;
if( m_mp > m_maxMp )
m_mp = m_maxMp;
if( m_hp > max_hp )
m_hp = max_hp;
if( m_hp > m_maxHp )
m_hp = m_maxHp;
}