Allow changing creature types
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
a015a3fc62
commit
6e9844b343
|
@ -134,6 +134,10 @@ namespace CreatureLib::Battling {
|
|||
ResetActiveScripts();
|
||||
_weight = _variant->GetWeight();
|
||||
_height = _variant->GetHeight();
|
||||
_types.clear();
|
||||
for (auto t : _variant->GetTypes()) {
|
||||
_types.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
void Battling::Creature::SetOnBattleField(bool value) {
|
||||
|
@ -273,6 +277,14 @@ namespace CreatureLib::Battling {
|
|||
return std::find(_types.begin(), _types.end(), type) != _types.end();
|
||||
}
|
||||
|
||||
void Creature::SetType(u8 index, u8 type) noexcept {
|
||||
if (_types.size() > index) {
|
||||
_types[index] = type;
|
||||
} else {
|
||||
_types.push_back(type);
|
||||
}
|
||||
}
|
||||
|
||||
size_t Creature::ScriptCount() const {
|
||||
auto c = 3;
|
||||
if (_battleData.Side.HasValue()) {
|
||||
|
|
|
@ -156,6 +156,7 @@ namespace CreatureLib::Battling {
|
|||
[[nodiscard]] bool IsFainted() const noexcept;
|
||||
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const noexcept;
|
||||
[[nodiscard]] bool HasType(uint8_t type) const noexcept;
|
||||
void SetType(u8 index, u8 type) noexcept;
|
||||
|
||||
uint32_t GetMaxHealth() const noexcept { return _boostedStats.GetHealth(); }
|
||||
void ChangeLevelBy(int8_t amount);
|
||||
|
|
Loading…
Reference in New Issue