Reset weight/height when variant changes, when a creature is moved out of the battle.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2021-10-30 17:50:26 +02:00
parent a12972472b
commit 2bd73bd4ef
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 14 additions and 2 deletions

View File

@ -61,6 +61,9 @@ namespace CreatureLib::Battling {
_types.push_back(t);
}
_weight = variant->GetWeight();
_height = variant->GetHeight();
// Grab the new active talent.
_activeTalent =
std::unique_ptr<BattleScript>(_library->LoadScript(this, ScriptCategory::Talent, GetActiveTalent()));
@ -113,6 +116,15 @@ namespace CreatureLib::Battling {
_height = _variant->GetHeight();
}
void Battling::Creature::SetOnBattleField(bool value) {
_battleData.OnBattleField = value;
if (!value) {
ResetActiveScripts();
_weight = _variant->GetWeight();
_height = _variant->GetHeight();
}
}
bool Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmount) {
bool changed = false;
auto oldValue = this->_statBoost.GetStat(stat);

View File

@ -131,7 +131,7 @@ namespace CreatureLib::Battling {
void ClearBattleData() noexcept;
inline const ArbUt::OptionalBorrowedPtr<Battle>& GetBattle() const { return _battleData.Battle; }
inline const ArbUt::OptionalBorrowedPtr<BattleSide>& GetBattleSide() const { return _battleData.Side; }
inline void SetOnBattleField(bool value) { _battleData.OnBattleField = value; }
inline void SetOnBattleField(bool value);
inline void SetBattleIndex(const CreatureIndex& index) { _battleData.Index = index; }
inline const CreatureIndex& GetBattleIndex() const noexcept { return _battleData.Index; }
inline bool IsOnBattleField() const { return _battleData.OnBattleField; }