diff --git a/src/Battling/Models/CreateCreature.cpp b/src/Battling/Models/CreateCreature.cpp index ca66203..c8388b5 100644 --- a/src/Battling/Models/CreateCreature.cpp +++ b/src/Battling/Models/CreateCreature.cpp @@ -59,6 +59,8 @@ Creature* CreateCreature::Create() { auto kv = _attacks[i]; attacks[i] = new LearnedAttack(std::get<0>(kv), std::get<1>(kv)); } - return new Creature(_library, species, variant, _level, experience, identifier, gender, _coloring, heldItem, - _nickname, talent, attacks); + auto c = new Creature(_library, species, variant, _level, experience, identifier, gender, _coloring, heldItem, + _nickname, talent, attacks); + c->Initialize(); + return c; } diff --git a/src/Battling/Models/Creature.cpp b/src/Battling/Models/Creature.cpp index cfa6ccd..55a78e6 100644 --- a/src/Battling/Models/Creature.cpp +++ b/src/Battling/Models/Creature.cpp @@ -13,8 +13,6 @@ Battling::Creature::Creature(const BattleLibrary* library, const Library::Creatu : _library(library), __Species(species), __Variant(variant), __Level(level), __Experience(experience), __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()); } diff --git a/src/Battling/Models/Creature.hpp b/src/Battling/Models/Creature.hpp index 034d2f8..a7e1f20 100644 --- a/src/Battling/Models/Creature.hpp +++ b/src/Battling/Models/Creature.hpp @@ -68,6 +68,11 @@ namespace CreatureLib::Battling { } }; + virtual void Initialize() { + RecalculateFlatStats(); + __CurrentHealth = GetBoostedStat(Core::Statistic::Health); + } + void SetBattleData(Battle* battle, BattleSide* side); Battle* GetBattle() const; BattleSide* GetBattleSide() const;