mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 07:07:45 +00:00
more stat calc functions, some are missing still
This commit is contained in:
parent
aee78a21e5
commit
b13c9eab18
2 changed files with 77 additions and 13 deletions
|
@ -415,3 +415,35 @@ float CalcStats::criticalHitBonus( const Sapphire::Entity::Chara& chara )
|
|||
|
||||
return std::floor( 200.f * ( baseStats.critHitRate - subVal ) / divVal + 1400.f ) / 1000.f;
|
||||
}
|
||||
|
||||
float CalcStats::physicalDefence( const Sapphire::Entity::Chara& chara )
|
||||
{
|
||||
auto level = chara.getLevel();
|
||||
const auto& baseStats = chara.getStats();
|
||||
|
||||
auto divVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::DIV ] );
|
||||
|
||||
return std::floor( 15.f * baseStats.defense ) / 100.f;
|
||||
}
|
||||
|
||||
float CalcStats::magicDefence( const Sapphire::Entity::Chara& chara )
|
||||
{
|
||||
auto level = chara.getLevel();
|
||||
const auto& baseStats = chara.getStats();
|
||||
|
||||
auto divVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::DIV ] );
|
||||
|
||||
return std::floor( 15.f * baseStats.magicDefense ) / 100.f;
|
||||
}
|
||||
|
||||
float CalcStats::blockStrength( const Sapphire::Entity::Chara& chara )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float CalcStats::healingMagicPotency( const Sapphire::Entity::Chara& chara )
|
||||
{
|
||||
const auto& baseStats = chara.getStats();
|
||||
|
||||
return std::floor( 100.f * ( baseStats.healingPotMagic - 292.f ) / 264.f + 100.f ) / 100.f;
|
||||
}
|
|
@ -18,6 +18,7 @@ namespace Sapphire::Math
|
|||
|
||||
/*!
|
||||
* @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
|
||||
|
@ -26,61 +27,61 @@ namespace Sapphire::Math
|
|||
|
||||
/*!
|
||||
* @brief Calculates the probability of a block happening
|
||||
* @return
|
||||
*/
|
||||
static float blockProbability( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the probability of a direct hit happening
|
||||
* @return
|
||||
*/
|
||||
static float directHitProbability( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the probability of a critical hit happening
|
||||
* @return
|
||||
*/
|
||||
static float criticalHitProbability( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the contribution of potency to damage output.
|
||||
*
|
||||
* @param potency The action potency
|
||||
* @return
|
||||
*/
|
||||
static float potency( uint16_t potency );
|
||||
|
||||
/*!
|
||||
* @brief Weapon damage is the contribution the weapon's damage rating
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
* @param weaponDamage the weapons physical or magic damage
|
||||
* @param isMagicDamage true if the damage is magical, otherwise it's treated as physical damage
|
||||
* @return
|
||||
*/
|
||||
static float weaponDamage( const Sapphire::Entity::Chara& chara, float weaponDamage, bool isMagicDamage );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the contribution of physical attack power to damage dealt
|
||||
* @todo Only works at level 70
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
* @return
|
||||
*/
|
||||
static float attackPower( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the contribution of magical attack power to damage dealt
|
||||
* @todo Only works at level 70
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
* @return
|
||||
*/
|
||||
static float magicAttackPower( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the contribution of healing magic power to healing dealt
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
* @return
|
||||
*/
|
||||
static float healingMagicPower( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates determinations contribution to damage and healing output.
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
* @return Returns a rational number rounded to 3 decimal places.
|
||||
*/
|
||||
|
@ -88,6 +89,7 @@ namespace Sapphire::Math
|
|||
|
||||
/*!
|
||||
* @brief Calculates the tenacity contribution to damage, mitigation and healing.
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
* @return Returns a rational number rounded to 3 decimal places.
|
||||
*/
|
||||
|
@ -95,28 +97,58 @@ namespace Sapphire::Math
|
|||
|
||||
/*!
|
||||
* @brief Calculates the bonus granted by either spell speed or skill speed depending on the casters classjob.
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
* @return
|
||||
*/
|
||||
static float speed( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the amount of bonus damaged applied on a critical hit
|
||||
* @param chara
|
||||
* @return
|
||||
* @note Called Critical Hit Rate in the TJ document but I think that name is a bit too ambiguous - f(CHR)
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
*/
|
||||
static float criticalHitBonus( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
static float physicalDefense( const Sapphire::Entity::Chara& chara );
|
||||
/*!
|
||||
* @brief Calculates how much damage you mitigate via physical defence
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
*/
|
||||
static float physicalDefence( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
static float magicDefense( const Sapphire::Entity::Chara& chara );
|
||||
/*!
|
||||
* @brief Calculates how much damage you mitigate via magical defence
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
*/
|
||||
static float magicDefence( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the percentage of damage that is mitigated on a successful block
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
*/
|
||||
static float blockStrength( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Calculates the multiplier that healing magic potency affects healing output
|
||||
*
|
||||
* @todo Only works for level 70
|
||||
*
|
||||
* @param chara The source/casting character.
|
||||
*/
|
||||
static float healingMagicPotency( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
private:
|
||||
|
||||
static uint32_t getPrimaryClassJobAttribute( const Sapphire::Entity::Chara& chara );
|
||||
|
||||
/*!
|
||||
* @brief Has the main attack power calculation allowing for de-duplication of functions.
|
||||
*
|
||||
* @param attackPower The magic/physical attack power value.
|
||||
*/
|
||||
static float calcAttackPower( uint32_t attackPower );
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue