Merge Core library into Library, as with its utility functionality merged into Arbutils, it's becoming less and less useful.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
5672f2d2a7
commit
a7b87ab4f8
|
@ -7,10 +7,10 @@ export const BattleStatCalculator* CreatureLib_BattleStatCalculator_Construct()
|
||||||
export void CreatureLib_BattleStatCalculator_Destruct(const BattleStatCalculator* p) { delete p; }
|
export void CreatureLib_BattleStatCalculator_Destruct(const BattleStatCalculator* p) { delete p; }
|
||||||
|
|
||||||
export uint32_t CreatureLib_BattleStatCalculator_CalculateFlatStat(const BattleStatCalculator* p, Creature* creature,
|
export uint32_t CreatureLib_BattleStatCalculator_CalculateFlatStat(const BattleStatCalculator* p, Creature* creature,
|
||||||
CreatureLib::Core::Statistic stat) {
|
CreatureLib::Library::Statistic stat) {
|
||||||
return p->CalculateFlatStat(creature, stat);
|
return p->CalculateFlatStat(creature, stat);
|
||||||
}
|
}
|
||||||
export uint32_t CreatureLib_BattleStatCalculator_CalculateBoostedStat(const BattleStatCalculator* p, Creature* creature,
|
export uint32_t CreatureLib_BattleStatCalculator_CalculateBoostedStat(const BattleStatCalculator* p, Creature* creature,
|
||||||
CreatureLib::Core::Statistic stat) {
|
CreatureLib::Library::Statistic stat) {
|
||||||
return p->CalculateBoostedStat(creature, stat);
|
return p->CalculateBoostedStat(creature, stat);
|
||||||
}
|
}
|
|
@ -85,21 +85,20 @@ export void CreatureLib_Creature_SetDisplaySpecies(Creature* p, const CreatureLi
|
||||||
export void CreatureLib_Creature_SetDisplayVariant(Creature* p, const CreatureLib::Library::SpeciesVariant* variant) {
|
export void CreatureLib_Creature_SetDisplayVariant(Creature* p, const CreatureLib::Library::SpeciesVariant* variant) {
|
||||||
return p->SetDisplayVariant(variant);
|
return p->SetDisplayVariant(variant);
|
||||||
}
|
}
|
||||||
export void CreatureLib_Creature_ChangeStatBoost(Creature* p, CreatureLib::Core::Statistic stat, int8_t diffAmount){
|
export void CreatureLib_Creature_ChangeStatBoost(Creature* p, CreatureLib::Library::Statistic stat, int8_t diffAmount) {
|
||||||
p->ChangeStatBoost(stat, diffAmount);
|
p->ChangeStatBoost(stat, diffAmount);
|
||||||
}
|
}
|
||||||
export uint32_t CreatureLib_Creature_GetFlatStat(Creature* p, CreatureLib::Core::Statistic stat){
|
export uint32_t CreatureLib_Creature_GetFlatStat(Creature* p, CreatureLib::Library::Statistic stat) {
|
||||||
return p->GetFlatStat(stat);
|
return p->GetFlatStat(stat);
|
||||||
}
|
}
|
||||||
export uint32_t CreatureLib_Creature_GetBoostedStat(Creature* p, CreatureLib::Core::Statistic stat){
|
export uint32_t CreatureLib_Creature_GetBoostedStat(Creature* p, CreatureLib::Library::Statistic stat) {
|
||||||
return p->GetBoostedStat(stat);
|
return p->GetBoostedStat(stat);
|
||||||
}
|
}
|
||||||
export uint32_t CreatureLib_Creature_GetBaseStat(Creature* p, CreatureLib::Core::Statistic stat){
|
export uint32_t CreatureLib_Creature_GetBaseStat(Creature* p, CreatureLib::Library::Statistic stat) {
|
||||||
return p->GetBaseStat(stat);
|
return p->GetBaseStat(stat);
|
||||||
}
|
}
|
||||||
export int8_t CreatureLib_Creature_GetStatBoost(Creature* p, CreatureLib::Core::Statistic stat){
|
export int8_t CreatureLib_Creature_GetStatBoost(Creature* p, CreatureLib::Library::Statistic stat) {
|
||||||
return p->GetStatBoost(stat);
|
return p->GetStatBoost(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#undef SIMPLE_GET_FUNC
|
#undef SIMPLE_GET_FUNC
|
|
@ -21,7 +21,7 @@ export SpeciesVariant* CreatureLib_SpeciesVariant_Construct(
|
||||||
|
|
||||||
return new SpeciesVariant(Arbutils::CaseInsensitiveConstString(name), height, weight, baseExperience,
|
return new SpeciesVariant(Arbutils::CaseInsensitiveConstString(name), height, weight, baseExperience,
|
||||||
std::vector<uint8_t>(types, types + typeLength),
|
std::vector<uint8_t>(types, types + typeLength),
|
||||||
CreatureLib::Core::StatisticSet<uint16_t>(baseHealth, baseAttack, baseDefense,
|
CreatureLib::Library::StatisticSet<uint16_t>(baseHealth, baseAttack, baseDefense,
|
||||||
baseMagicalAttack, baseMagicalDefense,
|
baseMagicalAttack, baseMagicalDefense,
|
||||||
baseSpeed),
|
baseSpeed),
|
||||||
talentsWrapped, secretTalentsWrapped, attacks);
|
talentsWrapped, secretTalentsWrapped, attacks);
|
||||||
|
@ -38,7 +38,7 @@ SIMPLE_GET_FUNC(SpeciesVariant, GetWeight, float);
|
||||||
SIMPLE_GET_FUNC(SpeciesVariant, GetBaseExperience, uint32_t);
|
SIMPLE_GET_FUNC(SpeciesVariant, GetBaseExperience, uint32_t);
|
||||||
SIMPLE_GET_FUNC(SpeciesVariant, GetTypeCount, size_t);
|
SIMPLE_GET_FUNC(SpeciesVariant, GetTypeCount, size_t);
|
||||||
export uint8_t CreatureLib_SpeciesVariant_GetType(SpeciesVariant* p, size_t index) { return p->GetType(index); }
|
export uint8_t CreatureLib_SpeciesVariant_GetType(SpeciesVariant* p, size_t index) { return p->GetType(index); }
|
||||||
export uint32_t CreatureLib_SpeciesVariant_GetStatistic(SpeciesVariant* p, CreatureLib::Core::Statistic stat) {
|
export uint32_t CreatureLib_SpeciesVariant_GetStatistic(SpeciesVariant* p, CreatureLib::Library::Statistic stat) {
|
||||||
return p->GetStatistic(stat);
|
return p->GetStatistic(stat);
|
||||||
}
|
}
|
||||||
SIMPLE_GET_FUNC(SpeciesVariant, GetTalentCount, size_t);
|
SIMPLE_GET_FUNC(SpeciesVariant, GetTalentCount, size_t);
|
||||||
|
|
|
@ -31,11 +31,6 @@ if (WINDOWS)
|
||||||
ADD_DEFINITIONS(-D WINDOWS=1)
|
ADD_DEFINITIONS(-D WINDOWS=1)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
|
|
||||||
# Create Core library with files in src/Core
|
|
||||||
file(GLOB_RECURSE CORE_SRC_FILES "src/Core/*.cpp" "src/Core/*.hpp" "CInterface/Core/*.cpp")
|
|
||||||
add_library(CreatureLibCore SHARED ${CORE_SRC_FILES})
|
|
||||||
set_target_properties(CreatureLibCore PROPERTIES LINKER_LANGUAGE CXX)
|
|
||||||
|
|
||||||
# Create main Library library with files in src/Library
|
# Create main Library library with files in src/Library
|
||||||
file(GLOB_RECURSE LIBRARY_SRC_FILES "src/Library/*.cpp" "src/Library/*.hpp" "CInterface/Library/*.cpp")
|
file(GLOB_RECURSE LIBRARY_SRC_FILES "src/Library/*.cpp" "src/Library/*.hpp" "CInterface/Library/*.cpp")
|
||||||
add_library(CreatureLibLibrary SHARED ${LIBRARY_SRC_FILES})
|
add_library(CreatureLibLibrary SHARED ${LIBRARY_SRC_FILES})
|
||||||
|
@ -50,14 +45,9 @@ if (NOT DEFINED CONAN_EXPORTED)
|
||||||
add_executable(CreatureLibTests ${TEST_FILES} extern/catch.hpp)
|
add_executable(CreatureLibTests ${TEST_FILES} extern/catch.hpp)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Link the core library to the individual other libraries
|
|
||||||
target_link_libraries(CreatureLibLibrary CreatureLibCore)
|
|
||||||
target_link_libraries(CreatureLibBattling CreatureLibCore)
|
|
||||||
|
|
||||||
# Link the library data to the Battling library
|
# Link the library data to the Battling library
|
||||||
target_link_libraries(CreatureLibBattling CreatureLibLibrary)
|
target_link_libraries(CreatureLibBattling CreatureLibLibrary)
|
||||||
|
|
||||||
target_link_libraries(CreatureLibCore Arbutils)
|
|
||||||
target_link_libraries(CreatureLibLibrary Arbutils)
|
target_link_libraries(CreatureLibLibrary Arbutils)
|
||||||
target_link_libraries(CreatureLibBattling Arbutils)
|
target_link_libraries(CreatureLibBattling Arbutils)
|
||||||
|
|
||||||
|
@ -71,7 +61,6 @@ if (WINDOWS)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L ${CMAKE_BINARY_DIR}/bin")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L ${CMAKE_BINARY_DIR}/bin")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
|
||||||
# Statically link libraries we need in Windows.
|
# Statically link libraries we need in Windows.
|
||||||
target_link_libraries(CreatureLibCore -static-libgcc -static-libstdc++)
|
|
||||||
target_link_libraries(CreatureLibLibrary -static-libgcc -static-libstdc++)
|
target_link_libraries(CreatureLibLibrary -static-libgcc -static-libstdc++)
|
||||||
target_link_libraries(CreatureLibBattling -static-libgcc -static-libstdc++)
|
target_link_libraries(CreatureLibBattling -static-libgcc -static-libstdc++)
|
||||||
if (NOT DEFINED CONAN_EXPORTED)
|
if (NOT DEFINED CONAN_EXPORTED)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "TurnHandler.hpp"
|
#include "TurnHandler.hpp"
|
||||||
#include "../../Core/Exceptions/NotImplementedException.hpp"
|
#include "../../Library/Exceptions/NotImplementedException.hpp"
|
||||||
#include "../Models/Battle.hpp"
|
#include "../Models/Battle.hpp"
|
||||||
#include "../ScriptHandling/ScriptMacros.hpp"
|
#include "../ScriptHandling/ScriptMacros.hpp"
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ bool ___ChoiceOrderFunc(const BaseTurnChoice* a, const BaseTurnChoice* b, Arbuti
|
||||||
if (aPriority != bPriority)
|
if (aPriority != bPriority)
|
||||||
return aPriority > bPriority;
|
return aPriority > bPriority;
|
||||||
}
|
}
|
||||||
auto aSpeed = a->GetUser()->GetBoostedStat(Core::Statistic::Speed);
|
auto aSpeed = a->GetUser()->GetBoostedStat(Library::Statistic::Speed);
|
||||||
auto bSpeed = b->GetUser()->GetBoostedStat(Core::Statistic::Speed);
|
auto bSpeed = b->GetUser()->GetBoostedStat(Library::Statistic::Speed);
|
||||||
if (aSpeed != bSpeed)
|
if (aSpeed != bSpeed)
|
||||||
return aSpeed > bSpeed;
|
return aSpeed > bSpeed;
|
||||||
|
|
||||||
|
|
|
@ -1,46 +1,48 @@
|
||||||
#include "BattleStatCalculator.hpp"
|
#include "BattleStatCalculator.hpp"
|
||||||
#include "../../Core/Exceptions/NotImplementedException.hpp"
|
#include "../../Library/Exceptions/NotImplementedException.hpp"
|
||||||
#include "../Models/Creature.hpp"
|
#include "../Models/Creature.hpp"
|
||||||
|
|
||||||
using namespace CreatureLib;
|
using namespace CreatureLib;
|
||||||
|
|
||||||
Core::StatisticSet<uint32_t> Battling::BattleStatCalculator::CalculateFlatStats(Battling::Creature* creature) const {
|
Library::StatisticSet<uint32_t> Battling::BattleStatCalculator::CalculateFlatStats(Battling::Creature* creature) const {
|
||||||
return Core::StatisticSet<uint32_t>(CalculateFlatStat(creature, Core::Statistic::Health),
|
return Library::StatisticSet<uint32_t>(CalculateFlatStat(creature, Library::Statistic::Health),
|
||||||
CalculateFlatStat(creature, Core::Statistic::PhysicalAttack),
|
CalculateFlatStat(creature, Library::Statistic::PhysicalAttack),
|
||||||
CalculateFlatStat(creature, Core::Statistic::PhysicalDefense),
|
CalculateFlatStat(creature, Library::Statistic::PhysicalDefense),
|
||||||
CalculateFlatStat(creature, Core::Statistic::MagicalAttack),
|
CalculateFlatStat(creature, Library::Statistic::MagicalAttack),
|
||||||
CalculateFlatStat(creature, Core::Statistic::MagicalDefense),
|
CalculateFlatStat(creature, Library::Statistic::MagicalDefense),
|
||||||
CalculateFlatStat(creature, Core::Statistic::Speed));
|
CalculateFlatStat(creature, Library::Statistic::Speed));
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::StatisticSet<uint32_t> Battling::BattleStatCalculator::CalculateBoostedStats(Battling::Creature* creature) const {
|
Library::StatisticSet<uint32_t>
|
||||||
return Core::StatisticSet<uint32_t>(CalculateBoostedStat(creature, Core::Statistic::Health),
|
Battling::BattleStatCalculator::CalculateBoostedStats(Battling::Creature* creature) const {
|
||||||
CalculateBoostedStat(creature, Core::Statistic::PhysicalAttack),
|
return Library::StatisticSet<uint32_t>(CalculateBoostedStat(creature, Library::Statistic::Health),
|
||||||
CalculateBoostedStat(creature, Core::Statistic::PhysicalDefense),
|
CalculateBoostedStat(creature, Library::Statistic::PhysicalAttack),
|
||||||
CalculateBoostedStat(creature, Core::Statistic::MagicalAttack),
|
CalculateBoostedStat(creature, Library::Statistic::PhysicalDefense),
|
||||||
CalculateBoostedStat(creature, Core::Statistic::MagicalDefense),
|
CalculateBoostedStat(creature, Library::Statistic::MagicalAttack),
|
||||||
CalculateBoostedStat(creature, Core::Statistic::Speed));
|
CalculateBoostedStat(creature, Library::Statistic::MagicalDefense),
|
||||||
|
CalculateBoostedStat(creature, Library::Statistic::Speed));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CalculateHealthStat(Battling::Creature* creature) {
|
uint32_t CalculateHealthStat(Battling::Creature* creature) {
|
||||||
auto level = creature->GetLevel();
|
auto level = creature->GetLevel();
|
||||||
auto a = (creature->GetBaseStat(Core::Statistic::Health)) * 2 * level;
|
auto a = (creature->GetBaseStat(Library::Statistic::Health)) * 2 * level;
|
||||||
return floor(a / 100) + level + 10;
|
return floor(a / 100) + level + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CalculateOtherStat(Battling::Creature* creature, Core::Statistic stat) {
|
uint32_t CalculateOtherStat(Battling::Creature* creature, Library::Statistic stat) {
|
||||||
auto level = creature->GetLevel();
|
auto level = creature->GetLevel();
|
||||||
auto a = (creature->GetBaseStat(stat)) * 2 * level;
|
auto a = (creature->GetBaseStat(stat)) * 2 * level;
|
||||||
return floor(a / 100) + 10;
|
return floor(a / 100) + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Battling::BattleStatCalculator::CalculateFlatStat(Battling::Creature* creature, Core::Statistic stat) const {
|
uint32_t Battling::BattleStatCalculator::CalculateFlatStat(Battling::Creature* creature,
|
||||||
if (stat == Core::Statistic::Health)
|
Library::Statistic stat) const {
|
||||||
|
if (stat == Library::Statistic::Health)
|
||||||
return CalculateHealthStat(creature);
|
return CalculateHealthStat(creature);
|
||||||
return CalculateOtherStat(creature, stat);
|
return CalculateOtherStat(creature, stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Battling::BattleStatCalculator::CalculateBoostedStat(Battling::Creature* creature,
|
uint32_t Battling::BattleStatCalculator::CalculateBoostedStat(Battling::Creature* creature,
|
||||||
Core::Statistic stat) const {
|
Library::Statistic stat) const {
|
||||||
return creature->GetFlatStat(stat) + (creature->GetBoostedStat(stat));
|
return creature->GetFlatStat(stat) + (creature->GetBoostedStat(stat));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef CREATURELIB_BATTLESTATCALCULATOR_HPP
|
#ifndef CREATURELIB_BATTLESTATCALCULATOR_HPP
|
||||||
#define CREATURELIB_BATTLESTATCALCULATOR_HPP
|
#define CREATURELIB_BATTLESTATCALCULATOR_HPP
|
||||||
|
|
||||||
#include "../../Core/StatisticSet.hpp"
|
#include "../../Library/StatisticSet.hpp"
|
||||||
|
|
||||||
namespace CreatureLib::Battling {
|
namespace CreatureLib::Battling {
|
||||||
// predeclare BattleCreature class
|
// predeclare BattleCreature class
|
||||||
|
@ -11,10 +11,10 @@ namespace CreatureLib::Battling {
|
||||||
public:
|
public:
|
||||||
virtual ~BattleStatCalculator() = default;
|
virtual ~BattleStatCalculator() = default;
|
||||||
|
|
||||||
virtual Core::StatisticSet<uint32_t> CalculateFlatStats(Creature* creature) const;
|
virtual Library::StatisticSet<uint32_t> CalculateFlatStats(Creature* creature) const;
|
||||||
virtual Core::StatisticSet<uint32_t> CalculateBoostedStats(Creature* creature) const;
|
virtual Library::StatisticSet<uint32_t> CalculateBoostedStats(Creature* creature) const;
|
||||||
virtual uint32_t CalculateFlatStat(Creature* creature, Core::Statistic stat) const;
|
virtual uint32_t CalculateFlatStat(Creature* creature, Library::Statistic stat) const;
|
||||||
virtual uint32_t CalculateBoostedStat(Creature* creature, Core::Statistic stat) const;
|
virtual uint32_t CalculateBoostedStat(Creature* creature, Library::Statistic stat) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,14 @@ float DamageLibrary::GetStatModifier(ExecutingAttack* attack, Creature* target,
|
||||||
auto user = attack->GetUser();
|
auto user = attack->GetUser();
|
||||||
HOOK(ChangeDamageStatsUser, attack, attack, target, hitIndex, &user);
|
HOOK(ChangeDamageStatsUser, attack, attack, target, hitIndex, &user);
|
||||||
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
auto hit = attack->GetAttackDataForTarget(target)->GetHit(hitIndex);
|
||||||
Core::Statistic offensiveStat;
|
Library::Statistic offensiveStat;
|
||||||
Core::Statistic defensiveStat;
|
Library::Statistic defensiveStat;
|
||||||
if (attack->GetAttack()->GetAttack()->GetCategory() == Library::AttackCategory::Physical) {
|
if (attack->GetAttack()->GetAttack()->GetCategory() == Library::AttackCategory::Physical) {
|
||||||
offensiveStat = Core::Statistic::PhysicalAttack;
|
offensiveStat = Library::Statistic::PhysicalAttack;
|
||||||
defensiveStat = Core::Statistic::PhysicalDefense;
|
defensiveStat = Library::Statistic::PhysicalDefense;
|
||||||
} else {
|
} else {
|
||||||
offensiveStat = Core::Statistic::MagicalAttack;
|
offensiveStat = Library::Statistic::MagicalAttack;
|
||||||
defensiveStat = Core::Statistic::MagicalDefense;
|
defensiveStat = Library::Statistic::MagicalDefense;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bypassDefensive = hit->IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
auto bypassDefensive = hit->IsCritical() && target->GetStatBoost(defensiveStat) > 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "Battle.hpp"
|
#include "Battle.hpp"
|
||||||
#include "../../Core/Exceptions/NotImplementedException.hpp"
|
#include "../../Library/Exceptions/NotImplementedException.hpp"
|
||||||
#include "../Flow/TurnHandler.hpp"
|
#include "../Flow/TurnHandler.hpp"
|
||||||
#include "../Flow/TurnOrdering.hpp"
|
#include "../Flow/TurnOrdering.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "BattleSide.hpp"
|
#include "BattleSide.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "../../Core/Exceptions/CreatureException.hpp"
|
#include "../../Library/Exceptions/CreatureException.hpp"
|
||||||
#include "Battle.hpp"
|
#include "Battle.hpp"
|
||||||
|
|
||||||
using namespace CreatureLib::Battling;
|
using namespace CreatureLib::Battling;
|
||||||
|
|
|
@ -42,7 +42,7 @@ void Battling::Creature::SetBattleData(Battling::Battle* battle, Battling::Battl
|
||||||
|
|
||||||
// region Stat APIs
|
// region Stat APIs
|
||||||
|
|
||||||
void Battling::Creature::ChangeStatBoost(Core::Statistic stat, int8_t diffAmount) {
|
void Battling::Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmount) {
|
||||||
if (diffAmount > 0)
|
if (diffAmount > 0)
|
||||||
this->_statBoost.IncreaseStatBy(stat, diffAmount);
|
this->_statBoost.IncreaseStatBy(stat, diffAmount);
|
||||||
else
|
else
|
||||||
|
@ -50,13 +50,13 @@ void Battling::Creature::ChangeStatBoost(Core::Statistic stat, int8_t diffAmount
|
||||||
this->RecalculateBoostedStat(stat);
|
this->RecalculateBoostedStat(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Battling::Creature::GetFlatStat(Core::Statistic stat) const { return _flatStats.GetStat(stat); }
|
uint32_t Battling::Creature::GetFlatStat(Library::Statistic stat) const { return _flatStats.GetStat(stat); }
|
||||||
|
|
||||||
uint32_t Battling::Creature::GetBoostedStat(Core::Statistic stat) const { return _boostedStats.GetStat(stat); }
|
uint32_t Battling::Creature::GetBoostedStat(Library::Statistic stat) const { return _boostedStats.GetStat(stat); }
|
||||||
|
|
||||||
uint32_t Battling::Creature::GetBaseStat(Core::Statistic stat) const { return _variant->GetStatistic(stat); }
|
uint32_t Battling::Creature::GetBaseStat(Library::Statistic stat) const { return _variant->GetStatistic(stat); }
|
||||||
|
|
||||||
int8_t Battling::Creature::GetStatBoost(Core::Statistic stat) const { return _statBoost.GetStat(stat); }
|
int8_t Battling::Creature::GetStatBoost(Library::Statistic stat) const { return _statBoost.GetStat(stat); }
|
||||||
|
|
||||||
void Battling::Creature::RecalculateFlatStats() {
|
void Battling::Creature::RecalculateFlatStats() {
|
||||||
auto statCalc = this->_library->GetStatCalculator();
|
auto statCalc = this->_library->GetStatCalculator();
|
||||||
|
@ -67,13 +67,13 @@ void Battling::Creature::RecalculateBoostedStats() {
|
||||||
this->_boostedStats = this->_library->GetStatCalculator()->CalculateFlatStats(this);
|
this->_boostedStats = this->_library->GetStatCalculator()->CalculateFlatStats(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battling::Creature::RecalculateFlatStat(Core::Statistic stat) {
|
void Battling::Creature::RecalculateFlatStat(Library::Statistic stat) {
|
||||||
auto s = this->_library->GetStatCalculator()->CalculateFlatStat(this, stat);
|
auto s = this->_library->GetStatCalculator()->CalculateFlatStat(this, stat);
|
||||||
this->_flatStats.SetStat(stat, s);
|
this->_flatStats.SetStat(stat, s);
|
||||||
RecalculateBoostedStat(stat);
|
RecalculateBoostedStat(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battling::Creature::RecalculateBoostedStat(Core::Statistic stat) {
|
void Battling::Creature::RecalculateBoostedStat(Library::Statistic stat) {
|
||||||
auto s = this->_library->GetStatCalculator()->CalculateBoostedStat(this, stat);
|
auto s = this->_library->GetStatCalculator()->CalculateBoostedStat(this, stat);
|
||||||
this->_boostedStats.SetStat(stat, s);
|
this->_boostedStats.SetStat(stat, s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ namespace CreatureLib::Battling {
|
||||||
const Library::Item* _heldItem;
|
const Library::Item* _heldItem;
|
||||||
uint32_t _currentHealth;
|
uint32_t _currentHealth;
|
||||||
|
|
||||||
Core::StatisticSet<int8_t> _statBoost;
|
Library::StatisticSet<int8_t> _statBoost;
|
||||||
Core::StatisticSet<uint32_t> _flatStats;
|
Library::StatisticSet<uint32_t> _flatStats;
|
||||||
Core::StatisticSet<uint32_t> _boostedStats;
|
Library::StatisticSet<uint32_t> _boostedStats;
|
||||||
|
|
||||||
Battle* _battle = nullptr;
|
Battle* _battle = nullptr;
|
||||||
BattleSide* _side = nullptr;
|
BattleSide* _side = nullptr;
|
||||||
|
@ -73,7 +73,7 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
virtual void Initialize() {
|
virtual void Initialize() {
|
||||||
RecalculateFlatStats();
|
RecalculateFlatStats();
|
||||||
_currentHealth = GetBoostedStat(Core::Statistic::Health);
|
_currentHealth = GetBoostedStat(Library::Statistic::Health);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Library::CreatureSpecies* GetSpecies() const { return _species; }
|
inline const Library::CreatureSpecies* GetSpecies() const { return _species; }
|
||||||
|
@ -136,15 +136,15 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
// region Stat APIs
|
// region Stat APIs
|
||||||
|
|
||||||
void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount);
|
void ChangeStatBoost(Library::Statistic stat, int8_t diffAmount);
|
||||||
[[nodiscard]] uint32_t GetFlatStat(Core::Statistic stat) const;
|
[[nodiscard]] uint32_t GetFlatStat(Library::Statistic stat) const;
|
||||||
[[nodiscard]] uint32_t GetBoostedStat(Core::Statistic stat) const;
|
[[nodiscard]] uint32_t GetBoostedStat(Library::Statistic stat) const;
|
||||||
[[nodiscard]] uint32_t GetBaseStat(Core::Statistic stat) const;
|
[[nodiscard]] uint32_t GetBaseStat(Library::Statistic stat) const;
|
||||||
[[nodiscard]] int8_t GetStatBoost(Core::Statistic stat) const;
|
[[nodiscard]] int8_t GetStatBoost(Library::Statistic stat) const;
|
||||||
void RecalculateFlatStats();
|
void RecalculateFlatStats();
|
||||||
void RecalculateBoostedStats();
|
void RecalculateBoostedStats();
|
||||||
void RecalculateFlatStat(Core::Statistic);
|
void RecalculateFlatStat(Library::Statistic);
|
||||||
void RecalculateBoostedStat(Core::Statistic);
|
void RecalculateBoostedStat(Library::Statistic);
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "../../Core/Exceptions/NotReachableException.hpp"
|
#include "../../Library/Exceptions/NotReachableException.hpp"
|
||||||
#include "Script.hpp"
|
#include "Script.hpp"
|
||||||
#include "ScriptSet.hpp"
|
#include "ScriptSet.hpp"
|
||||||
#include "ScriptWrapper.hpp"
|
#include "ScriptWrapper.hpp"
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
#ifndef CREATURELIB_STATISTICSET_HPP
|
|
||||||
#define CREATURELIB_STATISTICSET_HPP
|
|
||||||
#include <exception>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "Exceptions/NotReachableException.hpp"
|
|
||||||
#include "Statistic.hpp"
|
|
||||||
|
|
||||||
namespace CreatureLib::Core {
|
|
||||||
template <class T> class StatisticSet {
|
|
||||||
protected:
|
|
||||||
T _health;
|
|
||||||
T _physicalAttack;
|
|
||||||
T _physicalDefense;
|
|
||||||
T _magicalAttack;
|
|
||||||
T _magicalDefense;
|
|
||||||
T _speed;
|
|
||||||
|
|
||||||
public:
|
|
||||||
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()
|
|
||||||
: _health(0), _physicalAttack(0), _physicalDefense(0), _magicalAttack(0), _magicalDefense(0), _speed(0) {}
|
|
||||||
|
|
||||||
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 T GetStat(Statistic stat) const {
|
|
||||||
switch (stat) {
|
|
||||||
case CreatureLib::Core::Statistic::Health: return _health;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalAttack: return _physicalAttack;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalDefense: return _physicalDefense;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalAttack: return _magicalAttack;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalDefense: return _magicalDefense;
|
|
||||||
case CreatureLib::Core::Statistic::Speed: return _speed;
|
|
||||||
default: throw NotReachableException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void SetStat(Statistic stat, T value) {
|
|
||||||
switch (stat) {
|
|
||||||
case CreatureLib::Core::Statistic::Health: _health = value; break;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalAttack: _physicalAttack = value; break;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalDefense: _physicalDefense = value; break;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalAttack: _magicalAttack = value; break;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalDefense: _magicalDefense = value; break;
|
|
||||||
case CreatureLib::Core::Statistic::Speed: _speed = value; break;
|
|
||||||
default: throw NotReachableException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void IncreaseStatBy(Statistic stat, T amount) {
|
|
||||||
switch (stat) {
|
|
||||||
case CreatureLib::Core::Statistic::Health: _health += amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalAttack: _physicalAttack += amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalDefense: _physicalDefense += amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalAttack: _magicalAttack += amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalDefense: _magicalDefense += amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::Speed: _speed += amount; break;
|
|
||||||
default: throw NotReachableException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inline void DecreaseStatBy(Statistic stat, T amount) {
|
|
||||||
switch (stat) {
|
|
||||||
case CreatureLib::Core::Statistic::Health: _health -= amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalAttack: _physicalAttack -= amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::PhysicalDefense: _physicalDefense -= amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalAttack: _magicalAttack -= amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::MagicalDefense: _magicalDefense -= amount; break;
|
|
||||||
case CreatureLib::Core::Statistic::Speed: _speed -= amount; break;
|
|
||||||
default: throw NotReachableException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // CREATURELIB_STATISTICSET_HPP
|
|
|
@ -8,7 +8,7 @@ size_t CreatureLib::Library::SpeciesVariant::GetTypeCount() const { return _type
|
||||||
|
|
||||||
uint8_t CreatureLib::Library::SpeciesVariant::GetType(size_t index) const { return _types[index]; }
|
uint8_t CreatureLib::Library::SpeciesVariant::GetType(size_t index) const { return _types[index]; }
|
||||||
|
|
||||||
uint32_t CreatureLib::Library::SpeciesVariant::GetStatistic(CreatureLib::Core::Statistic stat) const {
|
uint32_t CreatureLib::Library::SpeciesVariant::GetStatistic(CreatureLib::Library::Statistic stat) const {
|
||||||
return _baseStatistics.GetStat(stat);
|
return _baseStatistics.GetStat(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ const CreatureLib::Library::LearnableAttacks* CreatureLib::Library::SpeciesVaria
|
||||||
|
|
||||||
CreatureLib::Library::SpeciesVariant::SpeciesVariant(ConstString name, float height, float weight,
|
CreatureLib::Library::SpeciesVariant::SpeciesVariant(ConstString name, float height, float weight,
|
||||||
uint32_t baseExperience, std::vector<uint8_t> types,
|
uint32_t baseExperience, std::vector<uint8_t> types,
|
||||||
CreatureLib::Core::StatisticSet<uint16_t> baseStats,
|
CreatureLib::Library::StatisticSet<uint16_t> baseStats,
|
||||||
std::vector<ConstString> talents,
|
std::vector<ConstString> talents,
|
||||||
std::vector<ConstString> secretTalents,
|
std::vector<ConstString> secretTalents,
|
||||||
const LearnableAttacks* attacks)
|
const LearnableAttacks* attacks)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <Arbutils/Random.hpp>
|
#include <Arbutils/Random.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../../Core/StatisticSet.hpp"
|
#include "../StatisticSet.hpp"
|
||||||
#include "CreatureMoves.hpp"
|
#include "CreatureMoves.hpp"
|
||||||
#include "LearnableAttacks.hpp"
|
#include "LearnableAttacks.hpp"
|
||||||
#include "TalentIndex.hpp"
|
#include "TalentIndex.hpp"
|
||||||
|
@ -23,14 +23,14 @@ namespace CreatureLib::Library {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<uint8_t> _types;
|
std::vector<uint8_t> _types;
|
||||||
const Core::StatisticSet<uint16_t> _baseStatistics;
|
const Library::StatisticSet<uint16_t> _baseStatistics;
|
||||||
std::vector<ConstString> _talents;
|
std::vector<ConstString> _talents;
|
||||||
std::vector<ConstString> _secretTalents;
|
std::vector<ConstString> _secretTalents;
|
||||||
const LearnableAttacks* _attacks;
|
const LearnableAttacks* _attacks;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience,
|
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience,
|
||||||
std::vector<uint8_t> types, Core::StatisticSet<uint16_t> baseStats,
|
std::vector<uint8_t> types, Library::StatisticSet<uint16_t> baseStats,
|
||||||
std::vector<ConstString> talents, std::vector<ConstString> secretTalents,
|
std::vector<ConstString> talents, std::vector<ConstString> secretTalents,
|
||||||
const LearnableAttacks* attacks);
|
const LearnableAttacks* attacks);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace CreatureLib::Library {
|
||||||
[[nodiscard]] size_t GetTypeCount() const;
|
[[nodiscard]] size_t GetTypeCount() const;
|
||||||
[[nodiscard]] uint8_t GetType(size_t index) const;
|
[[nodiscard]] uint8_t GetType(size_t index) const;
|
||||||
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
|
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
|
||||||
[[nodiscard]] uint32_t GetStatistic(Core::Statistic stat) const;
|
[[nodiscard]] uint32_t GetStatistic(Library::Statistic stat) const;
|
||||||
[[nodiscard]] const size_t GetTalentCount() const { return _talents.size(); }
|
[[nodiscard]] const size_t GetTalentCount() const { return _talents.size(); }
|
||||||
[[nodiscard]] const size_t GetSecretTalentCount() const { return _secretTalents.size(); }
|
[[nodiscard]] const size_t GetSecretTalentCount() const { return _secretTalents.size(); }
|
||||||
[[nodiscard]] const ConstString& GetTalent(const TalentIndex& index) const {
|
[[nodiscard]] const ConstString& GetTalent(const TalentIndex& index) const {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "GrowthRateLibrary.hpp"
|
#include "GrowthRateLibrary.hpp"
|
||||||
#include "../../Core/Exceptions/CreatureException.hpp"
|
#include "../Exceptions/CreatureException.hpp"
|
||||||
|
|
||||||
uint8_t CreatureLib::Library::GrowthRateLibrary::CalculateLevel(const ConstString& growthRate,
|
uint8_t CreatureLib::Library::GrowthRateLibrary::CalculateLevel(const ConstString& growthRate,
|
||||||
uint32_t experience) const {
|
uint32_t experience) const {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <Arbutils/Enum.hpp>
|
#include <Arbutils/Enum.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace CreatureLib::Core {
|
namespace CreatureLib::Library {
|
||||||
ENUM(Statistic, uint8_t, Health, PhysicalAttack, PhysicalDefense, MagicalAttack, MagicalDefense, Speed)
|
ENUM(Statistic, uint8_t, Health, PhysicalAttack, PhysicalDefense, MagicalAttack, MagicalDefense, Speed)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
#ifndef CREATURELIB_STATISTICSET_HPP
|
||||||
|
#define CREATURELIB_STATISTICSET_HPP
|
||||||
|
#include <exception>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "Exceptions/NotReachableException.hpp"
|
||||||
|
#include "Statistic.hpp"
|
||||||
|
|
||||||
|
namespace CreatureLib::Library {
|
||||||
|
template <class T> class StatisticSet {
|
||||||
|
protected:
|
||||||
|
T _health;
|
||||||
|
T _physicalAttack;
|
||||||
|
T _physicalDefense;
|
||||||
|
T _magicalAttack;
|
||||||
|
T _magicalDefense;
|
||||||
|
T _speed;
|
||||||
|
|
||||||
|
public:
|
||||||
|
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()
|
||||||
|
: _health(0), _physicalAttack(0), _physicalDefense(0), _magicalAttack(0), _magicalDefense(0), _speed(0) {}
|
||||||
|
|
||||||
|
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 T GetStat(Statistic stat) const {
|
||||||
|
switch (stat) {
|
||||||
|
case CreatureLib::Library::Statistic::Health: return _health;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalAttack: return _physicalAttack;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalDefense: return _physicalDefense;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalAttack: return _magicalAttack;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalDefense: return _magicalDefense;
|
||||||
|
case CreatureLib::Library::Statistic::Speed: return _speed;
|
||||||
|
default: throw NotReachableException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SetStat(Statistic stat, T value) {
|
||||||
|
switch (stat) {
|
||||||
|
case CreatureLib::Library::Statistic::Health: _health = value; break;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalAttack: _physicalAttack = value; break;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalDefense: _physicalDefense = value; break;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalAttack: _magicalAttack = value; break;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalDefense: _magicalDefense = value; break;
|
||||||
|
case CreatureLib::Library::Statistic::Speed: _speed = value; break;
|
||||||
|
default: throw NotReachableException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void IncreaseStatBy(Statistic stat, T amount) {
|
||||||
|
switch (stat) {
|
||||||
|
case CreatureLib::Library::Statistic::Health: _health += amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalAttack: _physicalAttack += amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalDefense: _physicalDefense += amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalAttack: _magicalAttack += amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalDefense: _magicalDefense += amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::Speed: _speed += amount; break;
|
||||||
|
default: throw NotReachableException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void DecreaseStatBy(Statistic stat, T amount) {
|
||||||
|
switch (stat) {
|
||||||
|
case CreatureLib::Library::Statistic::Health: _health -= amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalAttack: _physicalAttack -= amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::PhysicalDefense: _physicalDefense -= amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalAttack: _magicalAttack -= amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::MagicalDefense: _magicalDefense -= amount; break;
|
||||||
|
case CreatureLib::Library::Statistic::Speed: _speed -= amount; break;
|
||||||
|
default: throw NotReachableException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CREATURELIB_STATISTICSET_HPP
|
|
@ -1,7 +1,7 @@
|
||||||
#ifdef TESTS_BUILD
|
#ifdef TESTS_BUILD
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "../extern/catch.hpp"
|
#include "../extern/catch.hpp"
|
||||||
#include "../src/Core/Exceptions/CreatureException.hpp"
|
#include "../src/Library/Exceptions/CreatureException.hpp"
|
||||||
|
|
||||||
TEST_CASE("When throwing exception, what() is readable", "[Utilities]") {
|
TEST_CASE("When throwing exception, what() is readable", "[Utilities]") {
|
||||||
bool hasCaught = false;
|
bool hasCaught = false;
|
||||||
|
|
|
@ -205,8 +205,8 @@ TEST_CASE("Switch Creature in, but have attack aimed at it. Attack should hit ne
|
||||||
battle.TrySetChoice(new SwitchTurnChoice(c1, c2));
|
battle.TrySetChoice(new SwitchTurnChoice(c1, c2));
|
||||||
battle.TrySetChoice(new AttackTurnChoice(c3, c3->GetAttacks()[0], CreatureIndex(0, 0)));
|
battle.TrySetChoice(new AttackTurnChoice(c3, c3->GetAttacks()[0], CreatureIndex(0, 0)));
|
||||||
|
|
||||||
REQUIRE(c2->GetCurrentHealth() < c2->GetBoostedStat(Core::Statistic::Health));
|
REQUIRE(c2->GetCurrentHealth() < c2->GetBoostedStat(Library::Statistic::Health));
|
||||||
REQUIRE(c1->GetCurrentHealth() == c1->GetBoostedStat(Core::Statistic::Health));
|
REQUIRE(c1->GetCurrentHealth() == c1->GetBoostedStat(Library::Statistic::Health));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Switch Creature in, mark as seen opponent for opponent", "[Integrations]") {
|
TEST_CASE("Switch Creature in, mark as seen opponent for opponent", "[Integrations]") {
|
||||||
|
|
|
@ -41,8 +41,8 @@ TEST_CASE("Get creature nickname when unset", "[Library]") {
|
||||||
TEST_CASE("Increase creature stat boost", "[Library]") {
|
TEST_CASE("Increase creature stat boost", "[Library]") {
|
||||||
auto library = TestLibrary::Get();
|
auto library = TestLibrary::Get();
|
||||||
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
||||||
creature->ChangeStatBoost(CreatureLib::Core::Statistic::PhysicalAttack, 6);
|
creature->ChangeStatBoost(CreatureLib::Library::Statistic::PhysicalAttack, 6);
|
||||||
REQUIRE(creature->GetStatBoost(CreatureLib::Core::Statistic::PhysicalAttack) == 6);
|
REQUIRE(creature->GetStatBoost(CreatureLib::Library::Statistic::PhysicalAttack) == 6);
|
||||||
delete creature;
|
delete creature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "TestLibrary.hpp"
|
#include "TestLibrary.hpp"
|
||||||
#include "../../src/Library/GrowthRates/LookupGrowthRate.hpp"
|
#include "../../src/Library/GrowthRates/LookupGrowthRate.hpp"
|
||||||
|
|
||||||
using namespace CreatureLib::Core;
|
|
||||||
using namespace CreatureLib::Library;
|
using namespace CreatureLib::Library;
|
||||||
using namespace CreatureLib::Battling;
|
using namespace CreatureLib::Battling;
|
||||||
BattleLibrary* TestLibrary::_library = nullptr;
|
BattleLibrary* TestLibrary::_library = nullptr;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include "../../src/Battling/Library/BattleLibrary.hpp"
|
#include "../../src/Battling/Library/BattleLibrary.hpp"
|
||||||
|
|
||||||
using namespace CreatureLib::Core;
|
|
||||||
using namespace CreatureLib::Library;
|
using namespace CreatureLib::Library;
|
||||||
using namespace CreatureLib::Battling;
|
using namespace CreatureLib::Battling;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue