Implements functions for getting display species and variant.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2019-12-21 14:32:45 +01:00
parent fbc4973e28
commit 8e53ffb53d
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
4 changed files with 21 additions and 1 deletions

View File

@ -6,11 +6,12 @@ class CreatureLibConan(ConanFile):
license = "TODO" license = "TODO"
url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib" url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib"
description = "The core implementation for turn based battling using creatures." description = "The core implementation for turn based battling using creatures."
settings = "os", "compiler", "build_type", "arch" settings = "compiler"
options = {"shared": [True, False]} options = {"shared": [True, False]}
default_options = {"shared": False} default_options = {"shared": False}
generators = "cmake" generators = "cmake"
exports_sources = "*" exports_sources = "*"
compiler = "clang"
def build(self): def build(self):
cmake = CMake(self) cmake = CMake(self)

View File

@ -2,6 +2,7 @@
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include "../Models/Battle.hpp" #include "../Models/Battle.hpp"
#include "../ScriptHandling/ScriptMacros.cpp"
using namespace CreatureLib; using namespace CreatureLib;
@ -152,3 +153,13 @@ void Battling::Creature::AddExperience(uint32_t amount) {
__Experience = exp; __Experience = exp;
__Level = level; __Level = level;
} }
const Library::CreatureSpecies* Battling::Creature::GetDisplaySpecies() {
auto species = __Species;
HOOK(OverrideDisplaySpecies, this, this, &species);
return species;
}
const Library::SpeciesVariant* Battling::Creature::GetDisplayVariant() {
auto variant = __Variant;
HOOK(OverrideDisplayVariant, this, this, &variant);
return variant;
}

View File

@ -95,6 +95,9 @@ namespace CreatureLib::Battling {
std::vector<LearnedAttack*>& GetAttacks() { return _attacks; } std::vector<LearnedAttack*>& GetAttacks() { return _attacks; }
const Library::CreatureSpecies* GetDisplaySpecies();
const Library::SpeciesVariant* GetDisplayVariant();
// region Stat APIs // region Stat APIs
void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount); void ChangeStatBoost(Core::Statistic stat, int8_t diffAmount);

View File

@ -5,6 +5,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "../../Library/CreatureData/CreatureSpecies.hpp"
namespace CreatureLib::Battling { namespace CreatureLib::Battling {
class BaseTurnChoice; class BaseTurnChoice;
@ -24,6 +25,10 @@ namespace CreatureLib::Battling {
const std::string& GetName() { return _name; } const std::string& GetName() { return _name; }
virtual void OverrideDisplaySpecies(Creature* creature,
const CreatureLib::Library::CreatureSpecies** species){};
virtual void OverrideDisplayVariant(Creature* creature, const CreatureLib::Library::SpeciesVariant** variant){};
virtual void OnBeforeTurn(const BaseTurnChoice* choice){}; virtual void OnBeforeTurn(const BaseTurnChoice* choice){};
virtual void ChangeAttack(AttackTurnChoice* choice, std::string& attack){}; virtual void ChangeAttack(AttackTurnChoice* choice, std::string& attack){};