Use vector instead of set for types.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -23,7 +23,7 @@ namespace CreatureLib::Battling {
|
||||
|
||||
_activeTalent = std::unique_ptr<Script>(_library->LoadScript(ScriptCategory::Talent, GetActiveTalent()));
|
||||
for (auto t : _variant->GetTypes()) {
|
||||
_types.insert(t);
|
||||
_types.push_back(t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace CreatureLib::Battling {
|
||||
// Set the types to the new variant.
|
||||
_types.clear();
|
||||
for (auto t : variant->GetTypes()) {
|
||||
_types.insert(t);
|
||||
_types.push_back(t);
|
||||
}
|
||||
|
||||
// Grab the new active talent.
|
||||
@@ -215,7 +215,7 @@ namespace CreatureLib::Battling {
|
||||
_overridenTalentName = talent;
|
||||
}
|
||||
|
||||
const std::unordered_set<uint8_t>& Creature::GetTypes() const noexcept { return _types; }
|
||||
const std::vector<uint8_t>& Creature::GetTypes() const noexcept { return _types; }
|
||||
|
||||
bool Creature::HasType(uint8_t type) const noexcept {
|
||||
return std::find(_types.begin(), _types.end(), type) != _types.end();
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace CreatureLib::Battling {
|
||||
std::unique_ptr<Script> _status = nullptr;
|
||||
ScriptSet _volatile = {};
|
||||
|
||||
std::unordered_set<uint8_t> _types;
|
||||
std::vector<uint8_t> _types;
|
||||
|
||||
private:
|
||||
void OnFaint();
|
||||
@@ -115,7 +115,7 @@ namespace CreatureLib::Battling {
|
||||
const ArbUt::StringView& GetActiveTalent() const;
|
||||
|
||||
[[nodiscard]] bool IsFainted() const noexcept;
|
||||
[[nodiscard]] const std::unordered_set<uint8_t>& GetTypes() const noexcept;
|
||||
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const noexcept;
|
||||
[[nodiscard]] bool HasType(uint8_t type) const noexcept;
|
||||
|
||||
uint32_t GetMaxHealth() const noexcept { return _boostedStats.GetHealth(); }
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace CreatureLib::Library {
|
||||
<< (uint32_t)defensive);
|
||||
}
|
||||
}
|
||||
[[nodiscard]] inline float GetEffectiveness(uint8_t attacking,
|
||||
const std::unordered_set<uint8_t>& defensive) const {
|
||||
[[nodiscard]] inline float GetEffectiveness(uint8_t attacking, const std::vector<uint8_t>& defensive) const {
|
||||
return std::accumulate(defensive.begin(), defensive.end(), (float)1,
|
||||
[this, attacking](float init, uint8_t defense) {
|
||||
return init * GetSingleEffectiveness(attacking, defense);
|
||||
|
||||
Reference in New Issue
Block a user