Update to newer CreatureLib.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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.");
|
||||
|
||||
@@ -7,15 +7,15 @@ namespace PkmnLib::Battling {
|
||||
class CreatePokemon {
|
||||
private:
|
||||
ArbUt::BorrowedPtr<const BattleLibrary> _library;
|
||||
ArbUt::CaseInsensitiveConstString _species = ""_cnc;
|
||||
ArbUt::CaseInsensitiveConstString _forme = "default"_cnc;
|
||||
ArbUt::StringView _species = ""_cnc;
|
||||
ArbUt::StringView _forme = "default"_cnc;
|
||||
uint8_t _level;
|
||||
std::string _nickname = "";
|
||||
|
||||
ArbUt::CaseInsensitiveConstString _ability = ""_cnc;
|
||||
ArbUt::CaseInsensitiveConstString _nature;
|
||||
ArbUt::StringView _ability = ""_cnc;
|
||||
ArbUt::StringView _nature;
|
||||
CreatureLib::Library::Gender _gender = static_cast<CreatureLib::Library::Gender>(-1);
|
||||
ArbUt::CaseInsensitiveConstString _heldItem = ""_cnc;
|
||||
ArbUt::StringView _heldItem = ""_cnc;
|
||||
uint32_t _identifier = 0;
|
||||
|
||||
struct ToLearnMethod {
|
||||
@@ -48,16 +48,15 @@ namespace PkmnLib::Battling {
|
||||
bool _allowedExperienceGain = true;
|
||||
|
||||
public:
|
||||
CreatePokemon(const BattleLibrary* library, const ArbUt::CaseInsensitiveConstString& species, uint8_t level)
|
||||
CreatePokemon(const BattleLibrary* library, const ArbUt::StringView& species, uint8_t level)
|
||||
: _library(library), _species(species), _level(level), _attacks(library->GetSettings()->GetMaximalMoves()) {
|
||||
}
|
||||
|
||||
CreatePokemon WithForme(const ArbUt::CaseInsensitiveConstString& forme);
|
||||
CreatePokemon WithForme(const ArbUt::StringView& forme);
|
||||
CreatePokemon WithGender(CreatureLib::Library::Gender gender);
|
||||
CreatePokemon IsShiny(bool value);
|
||||
CreatePokemon WithHeldItem(const ArbUt::CaseInsensitiveConstString& item);
|
||||
CreatePokemon LearnMove(const ArbUt::CaseInsensitiveConstString& move,
|
||||
CreatureLib::Battling::AttackLearnMethod method);
|
||||
CreatePokemon WithHeldItem(const ArbUt::StringView& item);
|
||||
CreatePokemon LearnMove(const ArbUt::StringView& move, CreatureLib::Battling::AttackLearnMethod method);
|
||||
|
||||
CreatePokemon WithRandomIndividualValues(ArbUt::Random rand = ArbUt::Random());
|
||||
CreatePokemon WithIndividualValue(CreatureLib::Library::Statistic stat, uint8_t value);
|
||||
@@ -67,7 +66,7 @@ namespace PkmnLib::Battling {
|
||||
CreatePokemon WithEffortValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
|
||||
uint8_t speed);
|
||||
|
||||
CreatePokemon WithNature(const ArbUt::CaseInsensitiveConstString& nature);
|
||||
CreatePokemon WithNature(const ArbUt::StringView& nature);
|
||||
CreatePokemon IsAllowedExperienceGain(bool value);
|
||||
|
||||
Pokemon* Build();
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace PkmnLib::Battling {
|
||||
const ArbUt::BorrowedPtr<const Library::PokemonSpecies>& species,
|
||||
const ArbUt::BorrowedPtr<const Library::PokemonForme>& forme, uint8_t level, uint32_t experience,
|
||||
uint32_t uid, CreatureLib::Library::Gender gender, uint8_t coloring,
|
||||
ArbUt::BorrowedPtr<const Library::Item> heldItem, const std::string& nickname,
|
||||
ArbUt::BorrowedPtr<const Library::Item> heldItem, const std::string_view& nickname,
|
||||
const CreatureLib::Library::TalentIndex& talent,
|
||||
const std::vector<CreatureLib::Battling::LearnedAttack*>& moves,
|
||||
CreatureLib::Library::StatisticSet<uint8_t> individualValues,
|
||||
|
||||
Reference in New Issue
Block a user