Reset weight/height when variant changes, when a creature is moved out of the battle.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
a12972472b
commit
2bd73bd4ef
|
@ -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);
|
||||
|
@ -410,4 +422,4 @@ Battling::Creature::~Creature() {
|
|||
if (_battleData.OnBattleField && _battleData.Side.HasValue()) {
|
||||
_battleData.Side.GetValue()->ForceClearCreature(_battleData.Index.GetCreatureIndex());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in New Issue