Revert "Adds support for changing talent by its hash, adds support for loading scripts by their name hash."
continuous-integration/drone/push Build is passing Details

This reverts commit e3c997af31.
This commit is contained in:
Deukhoofd 2022-05-28 11:07:19 +02:00
parent e3c997af31
commit c208394d18
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 4 additions and 33 deletions

View File

@ -49,8 +49,3 @@ ArbUt::OptionalUniquePtr<BattleScript> BattleLibrary::LoadScript(const ArbUt::Op
const ArbUt::StringView& scriptName) const { const ArbUt::StringView& scriptName) const {
return _scriptResolver->LoadScript(owner, category, scriptName).TakeOwnership(); return _scriptResolver->LoadScript(owner, category, scriptName).TakeOwnership();
} }
ArbUt::OptionalUniquePtr<BattleScript> BattleLibrary::LoadScriptByHash(const ArbUt::OptionalBorrowedPtr<void>& owner,
ScriptCategory category,
u32 scriptNameHash) const {
return _scriptResolver->LoadScriptByHash(owner, category, scriptNameHash).TakeOwnership();
}

View File

@ -47,9 +47,6 @@ namespace CreatureLib::Battling {
[[nodiscard]] ArbUt::OptionalUniquePtr<BattleScript> LoadScript(const ArbUt::OptionalBorrowedPtr<void>& owner, [[nodiscard]] ArbUt::OptionalUniquePtr<BattleScript> LoadScript(const ArbUt::OptionalBorrowedPtr<void>& owner,
ScriptCategory category, ScriptCategory category,
const ArbUt::StringView& scriptName) const; const ArbUt::StringView& scriptName) const;
[[nodiscard]] ArbUt::OptionalUniquePtr<BattleScript>
LoadScriptByHash(const ArbUt::OptionalBorrowedPtr<void>& owner, ScriptCategory category,
u32 scriptNameHash) const;
}; };
} }

View File

@ -273,15 +273,6 @@ namespace CreatureLib::Battling {
_overridenTalent = _library->GetStaticLib()->GetTalentLibrary()->Get(talent); _overridenTalent = _library->GetStaticLib()->GetTalentLibrary()->Get(talent);
} }
void Creature::OverrideActiveTalentByHash(u32 talentHash) {
_hasOverridenTalent = true;
if (_activeTalent.HasValue()) {
_activeTalent.GetValue()->OnRemove();
_activeTalent = this->_library->LoadScriptByHash(this, ScriptCategory::Talent, talentHash).TakeOwnership();
}
_overridenTalent = _library->GetStaticLib()->GetTalentLibrary()->GetByHash(talentHash);
}
void Creature::SetType(u8 index, u8 type) noexcept { void Creature::SetType(u8 index, u8 type) noexcept {
if (_types.Count() > index) { if (_types.Count() > index) {
_types[index] = type; _types[index] = type;

View File

@ -163,7 +163,6 @@ namespace CreatureLib::Battling {
void Heal(u32 amount, bool canRevive = false); void Heal(u32 amount, bool canRevive = false);
void RestoreAllAttackUses() noexcept; void RestoreAllAttackUses() noexcept;
void OverrideActiveTalent(const ArbUt::StringView& talent); void OverrideActiveTalent(const ArbUt::StringView& talent);
void OverrideActiveTalentByHash(u32 talentHash);
void AddExperience(u32 amount); void AddExperience(u32 amount);
void MarkOpponentAsSeen(ArbUt::BorrowedPtr<Creature> creature) { _battleData.SeenOpponents.insert(creature); } void MarkOpponentAsSeen(ArbUt::BorrowedPtr<Creature> creature) { _battleData.SeenOpponents.insert(creature); }

View File

@ -18,20 +18,9 @@ namespace CreatureLib::Battling {
virtual ~ScriptResolver() = default; virtual ~ScriptResolver() = default;
virtual void Initialize([[maybe_unused]] BattleLibrary* non_null library){}; virtual void Initialize([[maybe_unused]] BattleLibrary* non_null library){};
virtual ArbUt::OptionalUniquePtr<BattleScript> LoadScript(const ArbUt::OptionalBorrowedPtr<void>& owner, virtual ArbUt::OptionalUniquePtr<BattleScript>
ScriptCategory category, LoadScript([[maybe_unused]] const ArbUt::OptionalBorrowedPtr<void>& owner,
const ArbUt::StringView& scriptName) { [[maybe_unused]] ScriptCategory category, [[maybe_unused]] const ArbUt::StringView& scriptName) {
(void)owner;
(void)category;
(void)scriptName;
return nullptr;
};
virtual ArbUt::OptionalUniquePtr<BattleScript> LoadScriptByHash(const ArbUt::OptionalBorrowedPtr<void>& owner,
ScriptCategory category, u32 scriptNameHash) {
(void)owner;
(void)category;
(void)scriptNameHash;
return nullptr; return nullptr;
}; };