Update to newer CreatureLib.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-07-04 15:50:30 +02:00
parent 698bc62b47
commit 7f1bc252ba
49 changed files with 207 additions and 237 deletions

View File

@@ -68,7 +68,7 @@ PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
ArbUt::BorrowedPtr<const Library::Item> heldItem = nullptr;
if (!this->_heldItem.Empty()) {
if (!_library->GetItemLibrary()->TryGet(this->_heldItem, heldItem)) {
throw CreatureException("Unknown Item: " + this->_heldItem.std_str());
THROW_CREATURE("Unknown Item: " << this->_heldItem.std_str());
}
AssertNotNull(heldItem);
}
@@ -103,8 +103,7 @@ PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
pkmn->Initialize();
return pkmn;
}
PkmnLib::Battling::CreatePokemon
PkmnLib::Battling::CreatePokemon::WithNature(const ArbUt::CaseInsensitiveConstString& nature) {
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithNature(const ArbUt::StringView& nature) {
_nature = nature;
return *this;
}
@@ -130,8 +129,7 @@ PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithEffortVal
_evSpeed = speed;
return *this;
}
PkmnLib::Battling::CreatePokemon
PkmnLib::Battling::CreatePokemon::WithForme(const ArbUt::CaseInsensitiveConstString& forme) {
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithForme(const ArbUt::StringView& forme) {
_forme = forme;
return *this;
}
@@ -144,17 +142,16 @@ PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::IsShiny(bool
_isShiny = value;
return *this;
}
PkmnLib::Battling::CreatePokemon
PkmnLib::Battling::CreatePokemon::WithHeldItem(const ArbUt::CaseInsensitiveConstString& item) {
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithHeldItem(const ArbUt::StringView& item) {
_heldItem = item;
return *this;
}
PkmnLib::Battling::CreatePokemon
PkmnLib::Battling::CreatePokemon::LearnMove(const ArbUt::CaseInsensitiveConstString& moveName,
PkmnLib::Battling::CreatePokemon::LearnMove(const ArbUt::StringView& moveName,
CreatureLib::Battling::AttackLearnMethod method) {
ArbUt::BorrowedPtr<const PkmnLib::Library::MoveData> move = nullptr;
if (!_library->GetMoveLibrary()->TryGet(moveName, move)) {
throw CreatureException("Invalid Move given: " + moveName.std_str());
THROW_CREATURE("Invalid Move given: " << moveName.std_str());
}
if (_currentMove >= _library->GetSettings()->GetMaximalMoves()) {
throw CreatureException("This pokemon already has the maximal allowed moves.");