diff --git a/src/Battling/Pokemon/CreatePokemon.cpp b/src/Battling/Pokemon/CreatePokemon.cpp index 4cc3417..2c058ef 100644 --- a/src/Battling/Pokemon/CreatePokemon.cpp +++ b/src/Battling/Pokemon/CreatePokemon.cpp @@ -76,7 +76,9 @@ namespace PkmnLib::Battling { for (size_t i = 0; i < _attacks.Count(); i++) { auto& kv = _attacks[i]; auto move = kv.Move; - attacks[i] = new LearnedMove(move, kv.LearnMethod); + if (move.HasValue()) { + attacks[i] = new LearnedMove(move.GetValue(), kv.LearnMethod); + } } auto ivs = CreatureLib::Library::ClampedStatisticSet(_ivHp, _ivAttack, _ivDefense, _ivSpAtt, _ivSpDef, _ivSpeed); diff --git a/src/Battling/Pokemon/CreatePokemon.hpp b/src/Battling/Pokemon/CreatePokemon.hpp index dbe0880..7212c5f 100644 --- a/src/Battling/Pokemon/CreatePokemon.hpp +++ b/src/Battling/Pokemon/CreatePokemon.hpp @@ -18,7 +18,7 @@ namespace PkmnLib::Battling { uint32_t _identifier = 0; struct ToLearnMethod { - ArbUt::BorrowedPtr Move; + ArbUt::OptionalBorrowedPtr Move; CreatureLib::Battling::AttackLearnMethod LearnMethod; ToLearnMethod(ArbUt::BorrowedPtr move, CreatureLib::Battling::AttackLearnMethod method)