This commit is contained in:
		
							
								
								
									
										5
									
								
								src/Battling/Library/BattleLibrary.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/Battling/Library/BattleLibrary.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
#include "BattleLibrary.hpp"
 | 
			
		||||
 | 
			
		||||
const CreatureLib::Battling::BattleStatCalculator *CreatureLib::Battling::BattleLibrary::GetStatCalculator() const {
 | 
			
		||||
    return _statCalculator;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										14
									
								
								src/Battling/Library/BattleLibrary.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/Battling/Library/BattleLibrary.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
#ifndef CREATURELIB_BATTLELIBRARY_HPP
 | 
			
		||||
#define CREATURELIB_BATTLELIBRARY_HPP
 | 
			
		||||
 | 
			
		||||
#include "BattleStatCalculator.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling {
 | 
			
		||||
    class BattleLibrary {
 | 
			
		||||
        BattleStatCalculator* _statCalculator;
 | 
			
		||||
    public:
 | 
			
		||||
        const BattleStatCalculator* GetStatCalculator() const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_BATTLELIBRARY_HPP
 | 
			
		||||
							
								
								
									
										39
									
								
								src/Battling/Library/BattleStatCalculator.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/Battling/Library/BattleStatCalculator.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
#include "BattleStatCalculator.hpp"
 | 
			
		||||
#include "../Models/BattleCreature.hpp"
 | 
			
		||||
 | 
			
		||||
using namespace CreatureLib;
 | 
			
		||||
 | 
			
		||||
Core::StatisticSet<uint32_t>
 | 
			
		||||
Battling::BattleStatCalculator::CalculateStats(Battling::BattleCreature *creature) const {
 | 
			
		||||
    return Core::StatisticSet<uint32_t>(
 | 
			
		||||
            CalculateStat(creature, Core::Statistic::Health),
 | 
			
		||||
            CalculateStat(creature, Core::Statistic::PhysicalAttack),
 | 
			
		||||
            CalculateStat(creature, Core::Statistic::PhysicalDefense),
 | 
			
		||||
            CalculateStat(creature, Core::Statistic::MagicalAttack),
 | 
			
		||||
            CalculateStat(creature, Core::Statistic::MagicalDefense),
 | 
			
		||||
            CalculateStat(creature, Core::Statistic::Speed)
 | 
			
		||||
            );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t CalculateHealthStat(Battling::BattleCreature *creature){
 | 
			
		||||
    auto base = creature->GetBackingCreature();
 | 
			
		||||
    auto level = creature->GetLevel();
 | 
			
		||||
    auto a = (base->GetBaseStat(Core::Statistic::Health) + base->GetStatPotential(Core::Statistic::Health)) * 2 +
 | 
			
		||||
            floor(sqrt(base->GetStatExperience(Core::Statistic::Health) / 4)) * level;
 | 
			
		||||
    return floor(a / 100) + level + 10;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t CalculateOtherStat(Battling::BattleCreature *creature, Core::Statistic stat){
 | 
			
		||||
    auto base = creature->GetBackingCreature();
 | 
			
		||||
    auto level = creature->GetLevel();
 | 
			
		||||
    auto a = (base->GetBaseStat(stat) + base->GetStatPotential(stat)) * 2 +
 | 
			
		||||
             floor(sqrt(base->GetStatExperience(stat) / 4)) * level;
 | 
			
		||||
    return floor(a / 100) + 10;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint32_t Battling::BattleStatCalculator::CalculateStat(Battling::BattleCreature *creature, Core::Statistic stat) const{
 | 
			
		||||
    if (stat == Core::Statistic::Health)
 | 
			
		||||
        return CalculateHealthStat(creature);
 | 
			
		||||
    return CalculateOtherStat(creature, stat);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								src/Battling/Library/BattleStatCalculator.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/Battling/Library/BattleStatCalculator.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
#ifndef CREATURELIB_BATTLESTATCALCULATOR_HPP
 | 
			
		||||
#define CREATURELIB_BATTLESTATCALCULATOR_HPP
 | 
			
		||||
 | 
			
		||||
#include "../../Core/StatisticSet.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling {
 | 
			
		||||
    //predeclare BattleCreature class
 | 
			
		||||
    class BattleCreature;
 | 
			
		||||
 | 
			
		||||
    class BattleStatCalculator {
 | 
			
		||||
    public:
 | 
			
		||||
        virtual Core::StatisticSet<uint32_t > CalculateStats(BattleCreature* creature) const;
 | 
			
		||||
        virtual uint32_t CalculateStat(BattleCreature* creature, Core::Statistic stat) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_BATTLESTATCALCULATOR_HPP
 | 
			
		||||
							
								
								
									
										5
									
								
								src/Battling/Models/Battle.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/Battling/Models/Battle.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
#include "Battle.hpp"
 | 
			
		||||
 | 
			
		||||
const CreatureLib::Battling::BattleLibrary *CreatureLib::Battling::Battle::GetLibrary() const {
 | 
			
		||||
    return _library;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								src/Battling/Models/Battle.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/Battling/Models/Battle.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
#ifndef CREATURELIB_BATTLE_HPP
 | 
			
		||||
#define CREATURELIB_BATTLE_HPP
 | 
			
		||||
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "BattleSide.hpp"
 | 
			
		||||
#include "../Library/BattleLibrary.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling {
 | 
			
		||||
    class Battle {
 | 
			
		||||
        const BattleLibrary* _library;
 | 
			
		||||
        std::vector<BattleSide*> _sides;
 | 
			
		||||
    public:
 | 
			
		||||
        const BattleLibrary* GetLibrary() const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_BATTLE_HPP
 | 
			
		||||
							
								
								
									
										37
									
								
								src/Battling/Models/BattleCreature.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/Battling/Models/BattleCreature.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
#include "BattleCreature.hpp"
 | 
			
		||||
#include "../Models/Battle.hpp"
 | 
			
		||||
 | 
			
		||||
using namespace CreatureLib;
 | 
			
		||||
 | 
			
		||||
Battling::BattleCreature::BattleCreature(Battling::Battle *battle,
 | 
			
		||||
                                                      Library::Creature *creature)
 | 
			
		||||
                                                      :__Battle(battle),
 | 
			
		||||
                                                       __Level(creature->GetLevel()),
 | 
			
		||||
                                                       _creature(creature),
 | 
			
		||||
                                                       _statBoost(Core::StatisticSet<int8_t >())
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const Library::Creature* Battling::BattleCreature::GetBackingCreature() {
 | 
			
		||||
    return _creature;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Battling::BattleCreature::ApplyPostBattleEffects() {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t Battling::BattleCreature::GetStat(Core::Statistic stat) {
 | 
			
		||||
    return _fullStats.GetStat(stat);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Battling::BattleCreature::RecalculateStats() {
 | 
			
		||||
    this->_fullStats = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateStats(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Battling::BattleCreature::RecalculateStat(Core::Statistic stat) {
 | 
			
		||||
    auto s = this->__Battle->GetLibrary()->GetStatCalculator()->CalculateStat(this, stat);
 | 
			
		||||
    this->_fullStats.SetStat(stat, s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										34
									
								
								src/Battling/Models/BattleCreature.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/Battling/Models/BattleCreature.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
#ifndef CREATURELIB_BATTLECREATURE_HPP
 | 
			
		||||
#define CREATURELIB_BATTLECREATURE_HPP
 | 
			
		||||
 | 
			
		||||
#include "../../GenericTemplates.cpp"
 | 
			
		||||
#include "../../Library/Creature.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling{
 | 
			
		||||
    // Forward declare battle class
 | 
			
		||||
    class Battle;
 | 
			
		||||
 | 
			
		||||
    class BattleCreature {
 | 
			
		||||
        GetProperty(Battle*, Battle);
 | 
			
		||||
        GetProperty(uint8_t, Level);
 | 
			
		||||
 | 
			
		||||
    private:
 | 
			
		||||
        Library::Creature* _creature;
 | 
			
		||||
        Core::StatisticSet<int8_t > _statBoost;
 | 
			
		||||
        Core::StatisticSet<uint32_t > _fullStats;
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
        BattleCreature(Battle* battle, Library::Creature* creature);
 | 
			
		||||
 | 
			
		||||
        const Library::Creature* GetBackingCreature();
 | 
			
		||||
        void ApplyPostBattleEffects();
 | 
			
		||||
 | 
			
		||||
        uint32_t GetStat(Core::Statistic stat);
 | 
			
		||||
        void RecalculateStats();
 | 
			
		||||
 | 
			
		||||
        void RecalculateStat(Core::Statistic);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_BATTLECREATURE_HPP
 | 
			
		||||
							
								
								
									
										1
									
								
								src/Battling/Models/BattleSide.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/Battling/Models/BattleSide.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
#include "BattleSide.hpp"
 | 
			
		||||
							
								
								
									
										14
									
								
								src/Battling/Models/BattleSide.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/Battling/Models/BattleSide.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
#ifndef CREATURELIB_BATTLESIDE_HPP
 | 
			
		||||
#define CREATURELIB_BATTLESIDE_HPP
 | 
			
		||||
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "BattleCreature.hpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Battling{
 | 
			
		||||
    class BattleSide {
 | 
			
		||||
        std::vector<BattleCreature*> _creatures;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_BATTLESIDE_HPP
 | 
			
		||||
							
								
								
									
										1
									
								
								src/Battling/Models/BattleTeam.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/Battling/Models/BattleTeam.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
#include "BattleTeam.hpp"
 | 
			
		||||
							
								
								
									
										10
									
								
								src/Battling/Models/BattleTeam.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/Battling/Models/BattleTeam.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
#ifndef CREATURELIB_BATTLETEAM_HPP
 | 
			
		||||
#define CREATURELIB_BATTLETEAM_HPP
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BattleTeam {
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //CREATURELIB_BATTLETEAM_HPP
 | 
			
		||||
@@ -1,13 +1,10 @@
 | 
			
		||||
#include <exception>
 | 
			
		||||
#include "StatisticSet.hpp"
 | 
			
		||||
 | 
			
		||||
CreatureLib::Core::StatisticSet::StatisticSet(uint32_t health, uint32_t physicalAttack, uint32_t physicalDefense,
 | 
			
		||||
                                              uint32_t magicalAttack, uint32_t magicalDefense, uint32_t speed)
 | 
			
		||||
                                              :
 | 
			
		||||
                                              __Health(health),
 | 
			
		||||
                                              __PhysicalAttack(physicalAttack),
 | 
			
		||||
                                              __PhysicalDefense(physicalDefense),
 | 
			
		||||
                                              __MagicalAttack(magicalAttack),
 | 
			
		||||
                                              __MagicalDefense(magicalDefense),
 | 
			
		||||
                                              __Speed(speed)
 | 
			
		||||
                                              {}
 | 
			
		||||
 | 
			
		||||
template <class T>
 | 
			
		||||
CreatureLib::Core::StatisticSet<T>::StatisticSet()
 | 
			
		||||
: _health(0), _physicalAttack(0), _physicalDefense(0), _magicalAttack(0), _magicalDefense(0), _speed(0)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,30 +1,55 @@
 | 
			
		||||
#ifndef CREATURELIB_STATISTICSET_HPP
 | 
			
		||||
#define CREATURELIB_STATISTICSET_HPP
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <exception>
 | 
			
		||||
#include "Statistic.hpp"
 | 
			
		||||
#include "../GenericTemplates.cpp"
 | 
			
		||||
 | 
			
		||||
namespace CreatureLib::Core{
 | 
			
		||||
    template <class T>
 | 
			
		||||
    class StatisticSet {
 | 
			
		||||
    protected:
 | 
			
		||||
        T _health;
 | 
			
		||||
        T _physicalAttack;
 | 
			
		||||
        T _physicalDefense;
 | 
			
		||||
        T _magicalAttack;
 | 
			
		||||
        T _magicalDefense;
 | 
			
		||||
        T _speed;
 | 
			
		||||
    public:
 | 
			
		||||
        StatisticSet(uint32_t health, uint32_t physicalAttack, uint32_t physicalDefense, uint32_t magicalAttack,
 | 
			
		||||
                uint32_t magicalDefense, uint32_t speed);
 | 
			
		||||
        StatisticSet(T health, T physicalAttack, T physicalDefense, T magicalAttack, T magicalDefense, T speed)
 | 
			
		||||
                : _health(health), _physicalAttack(physicalAttack),
 | 
			
		||||
                  _physicalDefense(physicalDefense), _magicalAttack(magicalAttack),
 | 
			
		||||
                  _magicalDefense(magicalDefense), _speed(speed){}
 | 
			
		||||
        StatisticSet();
 | 
			
		||||
 | 
			
		||||
        GetSetProperty(uint32_t, Health)
 | 
			
		||||
        GetSetProperty(uint32_t, PhysicalAttack)
 | 
			
		||||
        GetSetProperty(uint32_t, PhysicalDefense)
 | 
			
		||||
        GetSetProperty(uint32_t, MagicalAttack)
 | 
			
		||||
        GetSetProperty(uint32_t, MagicalDefense)
 | 
			
		||||
        GetSetProperty(uint32_t, Speed)
 | 
			
		||||
        inline T GetHealth() const{ return _health; }
 | 
			
		||||
        inline T GetPhysicalAttack() const{ return _physicalAttack; }
 | 
			
		||||
        inline T GetPhysicalDefense() const{ return _physicalDefense; }
 | 
			
		||||
        inline T GetMagicalAttack() const{ return _magicalAttack; }
 | 
			
		||||
        inline T GetMagicalDefense() const{ return _magicalDefense; }
 | 
			
		||||
        inline T GetSpeed() const{ return _speed; }
 | 
			
		||||
 | 
			
		||||
        [[nodiscard]] inline uint32_t GetStat(Statistic stat) const{
 | 
			
		||||
 | 
			
		||||
        [[nodiscard]] inline T GetStat(Statistic stat) const{
 | 
			
		||||
            switch (stat){
 | 
			
		||||
                case Health: return __Health;
 | 
			
		||||
                case PhysicalAttack: return __PhysicalAttack;
 | 
			
		||||
                case PhysicalDefense: return __PhysicalDefense;
 | 
			
		||||
                case MagicalAttack: return __MagicalAttack;
 | 
			
		||||
                case MagicalDefense: return __MagicalDefense;
 | 
			
		||||
                case Speed: return __Speed;
 | 
			
		||||
                case Health: return _health;
 | 
			
		||||
                case PhysicalAttack: return _physicalAttack;
 | 
			
		||||
                case PhysicalDefense: return _physicalDefense;
 | 
			
		||||
                case MagicalAttack: return _magicalAttack;
 | 
			
		||||
                case MagicalDefense: return _magicalDefense;
 | 
			
		||||
                case Speed: return _speed;
 | 
			
		||||
            }
 | 
			
		||||
            throw std::exception();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        inline void SetStat(Statistic stat, T value){
 | 
			
		||||
            switch (stat){
 | 
			
		||||
                case Health: _health = value;
 | 
			
		||||
                case PhysicalAttack: _physicalAttack = value;
 | 
			
		||||
                case PhysicalDefense: _physicalDefense = value;
 | 
			
		||||
                case MagicalAttack: _magicalAttack = value;
 | 
			
		||||
                case MagicalDefense: _magicalDefense = value;
 | 
			
		||||
                case Speed: _speed = value;
 | 
			
		||||
            }
 | 
			
		||||
            throw std::exception();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -13,19 +13,19 @@ namespace CreatureLib::Library {
 | 
			
		||||
        uint8_t _level;
 | 
			
		||||
        std::string _nickname = "";
 | 
			
		||||
 | 
			
		||||
        uint32_t _healthPotential = 0;
 | 
			
		||||
        uint32_t _physAttackPotential = 0;
 | 
			
		||||
        uint32_t _physDefensePotential = 0;
 | 
			
		||||
        uint32_t _magAttackPotential = 0;
 | 
			
		||||
        uint32_t _magDefensePotential = 0;
 | 
			
		||||
        uint32_t _speedPotential = 0;
 | 
			
		||||
        uint8_t _healthPotential = 0;
 | 
			
		||||
        uint8_t _physAttackPotential = 0;
 | 
			
		||||
        uint8_t _physDefensePotential = 0;
 | 
			
		||||
        uint8_t _magAttackPotential = 0;
 | 
			
		||||
        uint8_t _magDefensePotential = 0;
 | 
			
		||||
        uint8_t _speedPotential = 0;
 | 
			
		||||
 | 
			
		||||
        uint32_t _healthExperience = 0;
 | 
			
		||||
        uint32_t _physAttackExperience = 0;
 | 
			
		||||
        uint32_t _physDefenseExperience = 0;
 | 
			
		||||
        uint32_t _magAttackExperience = 0;
 | 
			
		||||
        uint32_t _magDefenseExperience = 0;
 | 
			
		||||
        uint32_t _speedExperience = 0;
 | 
			
		||||
        uint8_t _healthExperience = 0;
 | 
			
		||||
        uint8_t _physAttackExperience = 0;
 | 
			
		||||
        uint8_t _physDefenseExperience = 0;
 | 
			
		||||
        uint8_t _magAttackExperience = 0;
 | 
			
		||||
        uint8_t _magDefenseExperience = 0;
 | 
			
		||||
        uint8_t _speedExperience = 0;
 | 
			
		||||
 | 
			
		||||
        std::string _talent = "";
 | 
			
		||||
        Gender  _gender = static_cast<Gender>(-1);
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ CreatureLib::Library::Creature::Creature(const CreatureLib::Library::DataLibrary
 | 
			
		||||
                                         const CreatureLib::Library::CreatureSpecies *species,
 | 
			
		||||
                                         const CreatureLib::Library::SpeciesVariant *variant, uint8_t level,
 | 
			
		||||
                                         std::string nickname, int8_t talentIndex,
 | 
			
		||||
                                         CreatureLib::Core::StatisticSet statExperience,
 | 
			
		||||
                                         CreatureLib::Core::StatisticSet statPotential,
 | 
			
		||||
                                         CreatureLib::Core::StatisticSet<uint8_t > statExperience,
 | 
			
		||||
                                         CreatureLib::Core::StatisticSet<uint8_t > statPotential,
 | 
			
		||||
                                         uint32_t identifier, CreatureLib::Library::Gender gender, uint8_t coloring,
 | 
			
		||||
                                         const CreatureLib::Library::Item *heldItem)
 | 
			
		||||
                                         :
 | 
			
		||||
@@ -52,8 +52,20 @@ int32_t CalculateStat(const CreatureLib::Library::Creature* creature, CreatureLi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int32_t CreatureLib::Library::Creature::CalculateFullStat(CreatureLib::Core::Statistic stat) const {
 | 
			
		||||
uint32_t CreatureLib::Library::Creature::CalculateFullStat(CreatureLib::Core::Statistic stat) const {
 | 
			
		||||
    if (stat == Core::Statistic::Health)
 | 
			
		||||
        return CalculateHealth(this);
 | 
			
		||||
    return CalculateStat(this, stat);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t CreatureLib::Library::Creature::GetBaseStat(CreatureLib::Core::Statistic stat) const {
 | 
			
		||||
    return this->GetVariant()->GetStatistic(stat);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t CreatureLib::Library::Creature::GetStatPotential(CreatureLib::Core::Statistic stat) const {
 | 
			
		||||
    return this->__StatPotential.GetStat(stat);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t CreatureLib::Library::Creature::GetStatExperience(CreatureLib::Core::Statistic stat) const {
 | 
			
		||||
    return this->__StatExperience.GetStat(stat);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,8 +13,8 @@ namespace CreatureLib::Library{
 | 
			
		||||
        GetProperty(const SpeciesVariant*, Variant);
 | 
			
		||||
        GetProperty(uint8_t, Level);
 | 
			
		||||
        GetProperty(uint32_t, Experience);
 | 
			
		||||
        GetProperty(Core::StatisticSet, StatExperience);
 | 
			
		||||
        GetProperty(Core::StatisticSet, StatPotential);
 | 
			
		||||
        GetProperty(Core::StatisticSet<uint8_t >, StatExperience);
 | 
			
		||||
        GetProperty(Core::StatisticSet<uint8_t >, StatPotential);
 | 
			
		||||
        GetProperty(uint32_t, UniqueIdentifier);
 | 
			
		||||
        GetProperty(Gender, Gender);
 | 
			
		||||
        GetProperty(uint8_t, Coloring);
 | 
			
		||||
@@ -26,15 +26,18 @@ namespace CreatureLib::Library{
 | 
			
		||||
        int8_t _talentIndex;
 | 
			
		||||
    public:
 | 
			
		||||
        Creature(const DataLibrary* library, const CreatureSpecies* species, const SpeciesVariant* variant,
 | 
			
		||||
                uint8_t level, std::string nickname, int8_t talentIndex, Core::StatisticSet statExperience,
 | 
			
		||||
                Core::StatisticSet statPotential,  uint32_t identifier, Gender gender,
 | 
			
		||||
                uint8_t level, std::string nickname, int8_t talentIndex, Core::StatisticSet<uint8_t > statExperience,
 | 
			
		||||
                Core::StatisticSet<uint8_t > statPotential,  uint32_t identifier, Gender gender,
 | 
			
		||||
                uint8_t coloring, const Item* heldItem);
 | 
			
		||||
 | 
			
		||||
        virtual ~Creature(){}
 | 
			
		||||
 | 
			
		||||
        std::string GetTalent() const;
 | 
			
		||||
        std::string GetNickname() const;
 | 
			
		||||
        virtual int32_t CalculateFullStat(Core::Statistic stat) const;
 | 
			
		||||
        virtual uint32_t CalculateFullStat(Core::Statistic stat) const;
 | 
			
		||||
        virtual uint16_t GetBaseStat(Core::Statistic stat) const;
 | 
			
		||||
        virtual uint8_t GetStatPotential(Core::Statistic stat) const;
 | 
			
		||||
        virtual uint8_t GetStatExperience(Core::Statistic stat) const;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ int8_t CreatureLib::Library::SpeciesVariant::GetRandomTalent(CreatureLib::Core::
 | 
			
		||||
 | 
			
		||||
CreatureLib::Library::SpeciesVariant::SpeciesVariant(std::string name, float height, float weight,
 | 
			
		||||
                                                     uint32_t baseExperience, std::vector<std::string> types,
 | 
			
		||||
                                                     CreatureLib::Core::StatisticSet baseStats,
 | 
			
		||||
                                                     CreatureLib::Core::StatisticSet<uint16_t > baseStats,
 | 
			
		||||
                                                     std::vector<std::string> talents,
 | 
			
		||||
                                                     std::vector<std::string> secretTalents)
 | 
			
		||||
                                                     : __Name(name),
 | 
			
		||||
 
 | 
			
		||||
@@ -19,13 +19,13 @@ namespace CreatureLib::Library {
 | 
			
		||||
        GetProperty(uint32_t, BaseExperience);
 | 
			
		||||
    private:
 | 
			
		||||
        std::vector<std::string> _types;
 | 
			
		||||
        const Core::StatisticSet _baseStatistics;
 | 
			
		||||
        const Core::StatisticSet<uint16_t > _baseStatistics;
 | 
			
		||||
        std::vector<std::string> _talents;
 | 
			
		||||
        std::vector<std::string> _secretTalents;
 | 
			
		||||
        //CreatureMoves _moves;
 | 
			
		||||
    public:
 | 
			
		||||
        SpeciesVariant(std::string name, float height, float weight, uint32_t baseExperience,
 | 
			
		||||
                std::vector<std::string> types, Core::StatisticSet baseStats, std::vector<std::string> talents,
 | 
			
		||||
                std::vector<std::string> types, Core::StatisticSet<uint16_t > baseStats, std::vector<std::string> talents,
 | 
			
		||||
                std::vector<std::string> secretTalents);
 | 
			
		||||
 | 
			
		||||
        [[nodiscard]] size_t GetTypeCount() const;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user