1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 15:17:46 +00:00
sapphire/src/world/Math/CalcStats.h

127 lines
4 KiB
C
Raw Normal View History

#ifndef _CALCSTATS_H
#define _CALCSTATS_H
2018-03-06 22:22:19 +01:00
#include <Common.h>
2018-02-28 11:14:25 +01:00
#include "Forwards.h"
namespace Sapphire::Math
{
2018-10-28 21:53:21 +01:00
class CalcStats
{
public:
static float calculateBaseStat( Sapphire::Entity::PlayerPtr pPlayer );
static uint32_t calculateMaxMp( Sapphire::Entity::PlayerPtr pPlayer, FrameworkPtr pFw );
static uint32_t calculateMaxHp( Sapphire::Entity::PlayerPtr pPlayer, FrameworkPtr pFw );
2019-03-23 11:53:21 +11:00
/*!
* @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 );
2019-03-23 11:53:21 +11:00
/*!
* @brief Calculates the probability of a block happening
* @return
*/
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
* @return
*/
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
* @return
*/
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.
* @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
* @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
* @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.
*/
static float determination( const Sapphire::Entity::Chara& chara );
/*!
* @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.
*/
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.
* @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
*/
static float criticalHitBonus( const Sapphire::Entity::Chara& chara );
static float physicalDefense( const Sapphire::Entity::Chara& chara );
static float magicDefense( const Sapphire::Entity::Chara& chara );
static float blockStrength( const Sapphire::Entity::Chara& chara );
2018-10-28 21:53:21 +01:00
private:
2019-03-24 14:25:00 +11:00
static uint32_t getPrimaryClassJobAttribute( const Sapphire::Entity::Chara& chara );
static float calcAttackPower( uint32_t attackPower );
2018-10-28 21:53:21 +01:00
};
}
#endif