1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 21:57:44 +00:00

cap level to 80, enable shadowbringers, new mp calc

This commit is contained in:
NotAdam 2019-06-30 19:51:18 +10:00
parent 050465bd73
commit 0efcfefa8c
6 changed files with 23 additions and 97 deletions

View file

@ -21,6 +21,9 @@ namespace Sapphire::Common
const int32_t INVALID_GAME_OBJECT_ID = 0xE0000000; const int32_t INVALID_GAME_OBJECT_ID = 0xE0000000;
const uint64_t INVALID_GAME_OBJECT_ID64 = 0xE0000000; const uint64_t INVALID_GAME_OBJECT_ID64 = 0xE0000000;
const uint16_t MAX_PLAYER_LEVEL = 80;
const uint8_t CURRENT_EXPANSION_ID = 3;
/*! /*!
* @brief The maximum length (in ms) of a combo before it is canceled/voided. * @brief The maximum length (in ms) of a combo before it is canceled/voided.
* *

View file

@ -466,7 +466,7 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
{ {
auto curMp = m_pSource->getMp(); auto curMp = m_pSource->getMp();
auto cost = Math::CalcStats::calculateMpCost( *m_pSource, m_primaryCost ); auto cost = m_primaryCost * 100;
if( curMp < cost ) if( curMp < cost )
return false; return false;

View file

@ -695,7 +695,7 @@ void Sapphire::Entity::Player::gainExp( uint32_t amount )
queuePacket( makeActorControl143( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) ); queuePacket( makeActorControl143( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
if( level >= 70 ) // temporary fix for leveling over levelcap if( level >= Common::MAX_PLAYER_LEVEL ) // temporary fix for leveling over levelcap
{ {
queuePacket( makeActorControl143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) ); queuePacket( makeActorControl143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
return; return;

View file

@ -15,7 +15,7 @@
using namespace Sapphire::Math; using namespace Sapphire::Math;
using namespace Sapphire::Entity; using namespace Sapphire::Entity;
const int levelTable[71][7] = const int levelTable[81][7] =
{ {
// PIE, MP, MAIN,SUB,DIV,HP,ELMT,THREAT // PIE, MP, MAIN,SUB,DIV,HP,ELMT,THREAT
{ 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1 },
@ -88,7 +88,19 @@ const int levelTable[71][7] =
{ 830, 10560, 268, 361, 1643, 3300, 292 }, { 830, 10560, 268, 361, 1643, 3300, 292 },
{ 860, 10980, 276, 362, 1802, 3400, 293 }, { 860, 10980, 276, 362, 1802, 3400, 293 },
{ 890, 11450, 284, 363, 1978, 3500, 294 }, { 890, 11450, 284, 363, 1978, 3500, 294 },
{ 890, 12000, 292, 364, 2170, 3600, 295 } { 890, 12000, 292, 364, 2170, 3600, 295 },
// todo: add proper shbr values
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
{ 890, 12000, 292, 364, 2170, 3600, 295 },
}; };
/* /*
@ -115,8 +127,8 @@ float CalcStats::calculateBaseStat( const Chara& chara )
float base = 0.0f; float base = 0.0f;
uint8_t level = chara.getLevel(); uint8_t level = chara.getLevel();
if( level > 70 ) if( level > Common::MAX_PLAYER_LEVEL )
level = 70; level = Common::MAX_PLAYER_LEVEL;
return static_cast< float >( levelTable[level][2] ); return static_cast< float >( levelTable[level][2] );
} }
@ -187,86 +199,6 @@ uint32_t CalcStats::calculateMaxMp( PlayerPtr pPlayer, Sapphire::FrameworkPtr pF
return result; return result;
} }
uint16_t CalcStats::calculateMpCost( const Sapphire::Entity::Chara& chara, uint16_t baseCost )
{
auto level = chara.getLevel();
// each level range is 1-10, 11-20, 21-30, ... therefore:
// level 50 should be in the 4th group, not the 5t
// dividing by 10 on the border will break this unless we subtract 1
auto levelGroup = std::max< uint8_t >( level - 1, 1 ) / 10;
float cost = baseCost;
// thanks to andrew for helping me figure this shit out
// played with this some more and it seems to be accurate for everything i've tried
switch( levelGroup )
{
// level 1-10
case 0:
{
// r^2 = 0.9999
cost = 0.0952f * level + 0.9467f;
break;
}
// level 11-20
case 1:
{
// r^2 = 1
cost = 0.19f * level;
break;
}
// level 21-30
case 2:
{
// r^2 = 1
cost = 0.38f * level - 3.8f;
break;
}
// level 31-40
case 3:
{
// r^2 = 1
cost = 0.6652f * level - 12.358f;
break;
}
// level 41-50
case 4:
{
// r^2 = 1
cost = 1.2352f * level - 35.159f;
break;
}
// level 51-60
case 5:
{
// r^2 = 1
cost = 0.0654f * std::exp( 0.1201f * level );
break;
}
// level 61-70
case 6:
{
// r^2 = 0.9998
cost = 0.2313f * ( level * level ) - 26.98f * level + 875.21f;
break;
}
default:
{
return 0;
}
}
return static_cast< uint16_t >( std::round( cost * baseCost ) );
}
float CalcStats::blockProbability( const Chara& chara ) float CalcStats::blockProbability( const Chara& chara )
{ {
auto level = chara.getLevel(); auto level = chara.getLevel();

View file

@ -19,15 +19,6 @@ namespace Sapphire::Math
static uint32_t calculateMaxHp( Sapphire::Entity::PlayerPtr pPlayer, FrameworkPtr pFw ); static uint32_t calculateMaxHp( Sapphire::Entity::PlayerPtr pPlayer, FrameworkPtr pFw );
/*!
* @brief Calculates the MP cost of a spell given its base cost
*
* @param chara The Chara that is casting the action
* @param baseCost The action cost
* @return The total MP to be consumed by a successful cast
*/
static uint16_t calculateMpCost( const Sapphire::Entity::Chara& chara, uint16_t baseCost );
/*! /*!
* @brief Calculates the probability of a block happening * @brief Calculates the probability of a block happening
*/ */

View file

@ -71,8 +71,8 @@ namespace Sapphire::Network::Packets::Server
memcpy( m_data.howto, player.getHowToArray(), sizeof( m_data.howto ) ); memcpy( m_data.howto, player.getHowToArray(), sizeof( m_data.howto ) );
// possibly max level or current level // possibly max level or current level
m_data.maxLevel = 0x46; m_data.maxLevel = Common::MAX_PLAYER_LEVEL;
m_data.expansion = 2; m_data.expansion = Common::CURRENT_EXPANSION_ID;
// df stuff // df stuff
// todo: actually do this properly // todo: actually do this properly