2017-11-21 03:19:08 -02:00
|
|
|
#ifndef _CALCSTATS_H
|
|
|
|
#define _CALCSTATS_H
|
2017-08-20 02:46:06 -03:00
|
|
|
|
2018-03-06 22:22:19 +01:00
|
|
|
#include <Common.h>
|
2018-02-28 11:14:25 +01:00
|
|
|
#include "Forwards.h"
|
2017-08-20 02:46:06 -03:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire::Math
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2017-08-20 02:46:06 -03:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
class CalcStats
|
|
|
|
{
|
|
|
|
public:
|
2019-04-24 23:25:07 +10:00
|
|
|
static const uint32_t AUTO_ATTACK_POTENCY = 100;
|
|
|
|
|
|
|
|
static float calculateBaseStat( const Entity::Chara& chara );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-12-29 00:53:52 +01:00
|
|
|
static uint32_t calculateMaxMp( Sapphire::Entity::PlayerPtr pPlayer, FrameworkPtr pFw );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-12-29 00:53:52 +01:00
|
|
|
static uint32_t calculateMaxHp( Sapphire::Entity::PlayerPtr pPlayer, FrameworkPtr pFw );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-03-23 11:53:21 +11:00
|
|
|
/*!
|
|
|
|
* @brief Calculates the MP cost of a spell given its base cost
|
2019-03-24 16:04:04 +11:00
|
|
|
*
|
2019-03-23 11:53:21 +11:00
|
|
|
* @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
|
|
|
|
*/
|
2019-03-23 11:48:49 +11:00
|
|
|
static uint16_t calculateMpCost( const Sapphire::Entity::Chara& chara, uint16_t baseCost );
|
|
|
|
|
2019-03-23 11:53:21 +11:00
|
|
|
/*!
|
|
|
|
* @brief Calculates the probability of a block happening
|
|
|
|
*/
|
2019-03-24 14:25:00 +11:00
|
|
|
static float blockProbability( const Sapphire::Entity::Chara& chara );
|
2019-03-23 11:53:21 +11:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Calculates the probability of a direct hit happening
|
|
|
|
*/
|
2019-03-24 14:25:00 +11:00
|
|
|
static float directHitProbability( const Sapphire::Entity::Chara& chara );
|
2019-03-23 11:53:21 +11:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Calculates the probability of a critical hit happening
|
|
|
|
*/
|
2019-03-24 14:25:00 +11:00
|
|
|
static float criticalHitProbability( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Calculates the contribution of potency to damage output.
|
2019-03-24 16:04:04 +11:00
|
|
|
*
|
2019-03-24 14:25:00 +11:00
|
|
|
* @param potency The action potency
|
|
|
|
*/
|
|
|
|
static float potency( uint16_t potency );
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Weapon damage is the contribution the weapon's damage rating
|
2019-03-24 16:04:04 +11:00
|
|
|
*
|
2019-03-24 14:25:00 +11:00
|
|
|
* @param chara The source/casting character.
|
|
|
|
* @param weaponDamage the weapons physical or magic damage
|
|
|
|
*/
|
2019-04-24 23:25:07 +10:00
|
|
|
static float weaponDamage( const Sapphire::Entity::Chara& chara, float weaponDamage );
|
2019-03-24 14:25:00 +11:00
|
|
|
|
|
|
|
/*!
|
2019-04-24 23:25:07 +10:00
|
|
|
* @brief Calculates the contribution of attack power to damage dealt with consideration for the primary stat
|
2019-03-24 16:04:04 +11:00
|
|
|
* @todo Only works at level 70
|
|
|
|
*
|
2019-03-24 14:25:00 +11:00
|
|
|
* @param chara The source/casting character.
|
|
|
|
*/
|
|
|
|
static float attackPower( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Calculates determinations contribution to damage and healing output.
|
2019-03-24 16:04:04 +11:00
|
|
|
*
|
2019-03-24 14:25:00 +11:00
|
|
|
* @param chara The source/casting character.
|
|
|
|
* @return Returns a rational number rounded to 3 decimal places.
|
|
|
|
*/
|
|
|
|
static float determination( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Calculates the tenacity contribution to damage, mitigation and healing.
|
2019-03-24 16:04:04 +11:00
|
|
|
*
|
2019-03-24 14:25:00 +11:00
|
|
|
* @param chara The source/casting character.
|
|
|
|
* @return Returns a rational number rounded to 3 decimal places.
|
|
|
|
*/
|
|
|
|
static float tenacity( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Calculates the bonus granted by either spell speed or skill speed depending on the casters classjob.
|
2019-03-24 16:04:04 +11:00
|
|
|
*
|
2019-03-24 14:25:00 +11:00
|
|
|
* @param chara The source/casting character.
|
|
|
|
*/
|
|
|
|
static float speed( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @brief Calculates the amount of bonus damaged applied on a critical hit
|
2019-03-24 16:04:04 +11:00
|
|
|
* @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.
|
2019-03-24 14:25:00 +11:00
|
|
|
*/
|
|
|
|
static float criticalHitBonus( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
2019-03-24 16:04:04 +11:00
|
|
|
/*!
|
|
|
|
* @brief Calculates how much damage you mitigate via physical defence
|
|
|
|
*
|
|
|
|
* @param chara The source/casting character.
|
|
|
|
*/
|
|
|
|
static float physicalDefence( const Sapphire::Entity::Chara& chara );
|
2019-03-24 14:25:00 +11:00
|
|
|
|
2019-03-24 16:04:04 +11:00
|
|
|
/*!
|
|
|
|
* @brief Calculates how much damage you mitigate via magical defence
|
|
|
|
*
|
|
|
|
* @param chara The source/casting character.
|
|
|
|
*/
|
|
|
|
static float magicDefence( const Sapphire::Entity::Chara& chara );
|
2019-03-24 14:25:00 +11:00
|
|
|
|
2019-03-24 16:04:04 +11:00
|
|
|
/*!
|
|
|
|
* @brief Calculates the percentage of damage that is mitigated on a successful block
|
|
|
|
*
|
|
|
|
* @param chara The source/casting character.
|
|
|
|
*/
|
2019-03-24 14:25:00 +11:00
|
|
|
static float blockStrength( const Sapphire::Entity::Chara& chara );
|
2019-03-23 11:48:49 +11:00
|
|
|
|
2019-04-24 23:25:07 +10:00
|
|
|
static float autoAttack( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
2019-03-24 16:04:04 +11:00
|
|
|
/*!
|
|
|
|
* @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 );
|
|
|
|
|
2019-04-24 23:25:07 +10:00
|
|
|
////////////////////////////////////////////
|
|
|
|
|
|
|
|
static float calculateAutoAttackDamage( const Sapphire::Entity::Chara& chara );
|
2018-10-28 21:53:21 +01:00
|
|
|
|
2019-04-24 23:25:07 +10:00
|
|
|
private:
|
2019-03-24 14:25:00 +11:00
|
|
|
|
2019-03-24 16:04:04 +11:00
|
|
|
/*!
|
|
|
|
* @brief Has the main attack power calculation allowing for de-duplication of functions.
|
|
|
|
*
|
|
|
|
* @param attackPower The magic/physical attack power value.
|
|
|
|
*/
|
2019-04-24 23:47:35 +10:00
|
|
|
static float calcAttackPower( const Sapphire::Entity::Chara& chara, uint32_t attackPower );
|
2019-03-24 14:25:00 +11:00
|
|
|
|
2019-04-24 23:25:07 +10:00
|
|
|
static uint32_t primaryStatValue( const Sapphire::Entity::Chara& chara );
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
};
|
2017-08-20 02:46:06 -03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-12-08 15:38:25 +01:00
|
|
|
#endif
|