Implemented and fixed all code required to run at least a single turn.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-12-05 12:56:41 +01:00
parent 5d6ac316eb
commit 6f32d1245b
17 changed files with 171 additions and 58 deletions

View File

@@ -5,16 +5,18 @@
using namespace CreatureLib;
Battling::Creature::Creature(const Library::CreatureSpecies* species, const Library::SpeciesVariant* variant,
uint8_t level, uint32_t experience, Core::StatisticSet<uint8_t> statExp,
Core::StatisticSet<uint8_t> statPotential, uint32_t uid, Library::Gender gender,
uint8_t coloring, const Library::Item* heldItem, std::string nickname, int8_t talent,
std::vector<LearnedAttack*> attacks)
: __Species(species), __Variant(variant), __Level(level), __Experience(experience), __StatExperience(statExp),
__StatPotential(statPotential), __UniqueIdentifier(uid), __Gender(gender), __Coloring(coloring),
__HeldItem(heldItem), _nickname(std::move(nickname)), _talentIndex(talent), _hasOverridenTalent(false),
_attacks(std::move(attacks)) {
Battling::Creature::Creature(const BattleLibrary* library, const Library::CreatureSpecies* species,
const Library::SpeciesVariant* variant, uint8_t level, uint32_t experience,
Core::StatisticSet<uint8_t> statExp, Core::StatisticSet<uint8_t> statPotential,
uint32_t uid, Library::Gender gender, uint8_t coloring, const Library::Item* heldItem,
std::string nickname, int8_t talent, std::vector<LearnedAttack*> attacks)
: _library(library), __Species(species), __Variant(variant), __Level(level), __Experience(experience),
__StatExperience(statExp), __StatPotential(statPotential), __UniqueIdentifier(uid), __Gender(gender),
__Coloring(coloring), __HeldItem(heldItem), _nickname(std::move(nickname)), _talentIndex(talent),
_hasOverridenTalent(false), _attacks(std::move(attacks)) {
RecalculateFlatStats();
__CurrentHealth = GetBoostedStat(Core::Statistic::Health);
_activeTalent = _library->LoadScript(ScriptResolver::ScriptCategory::Talent, GetActiveTalent());
}
void Battling::Creature::ChangeLevel(int8_t amount) {
@@ -22,13 +24,6 @@ void Battling::Creature::ChangeLevel(int8_t amount) {
RecalculateFlatStats();
}
void Battling::Creature::SetBattle(Battling::Battle* battle) { this->_battle = battle; }
void Battling::Creature::SetBattleLibrary(Battling::BattleLibrary* library) {
this->_library = library;
_activeTalent = _library->LoadScript(ScriptResolver::ScriptCategory::Talent, GetActiveTalent());
}
const std::string& Battling::Creature::GetNickname() const {
if (_nickname.empty())
return __Species->GetName();
@@ -70,7 +65,8 @@ uint32_t Battling::Creature::GetStatExperience(Core::Statistic stat) const { ret
int8_t Battling::Creature::GetStatBoost(Core::Statistic stat) const { return _statBoost.GetStat(stat); }
void Battling::Creature::RecalculateFlatStats() {
this->_flatStats = this->_library->GetStatCalculator()->CalculateFlatStats(this);
auto statCalc = this->_library->GetStatCalculator();
this->_flatStats = statCalc->CalculateFlatStats(this);
RecalculateBoostedStats();
}
void Battling::Creature::RecalculateBoostedStats() {