Add support for creating pokemon with passed Random parameter.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2021-04-11 17:50:47 +02:00
parent a88719e2b3
commit e8b86a20d1
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 7 additions and 5 deletions

View File

@ -34,9 +34,7 @@ namespace PkmnLib::Battling {
return *this;
}
Pokemon* CreatePokemon::Build() {
auto rand = ArbUt::Random();
Pokemon* CreatePokemon::Build(ArbUt::Random& rand) {
auto species = this->_library->GetSpeciesLibrary()->TryGet(this->_species);
if (!species.has_value()) {
std::stringstream err;

View File

@ -67,7 +67,11 @@ namespace PkmnLib::Battling {
CreatePokemon& WithNature(const ArbUt::StringView& nature);
CreatePokemon& IsAllowedExperienceGain(bool value);
Pokemon* Build();
Pokemon* Build() {
auto rand = ArbUt::Random();
return Build(rand);
}
Pokemon* Build(ArbUt::Random& rand);
};
}

View File

@ -304,7 +304,7 @@ void AngelScriptScript::ModifyNumberOfHits(CreatureLib::Battling::AttackTurnChoi
CreatureLib::Battling::BattleScript* AngelScriptScript::Clone() {
auto* ctx = _ctxPool->RequestContext();
auto* obj = _type->Instantiate(ctx);
if (_obj != nullptr){
if (_obj != nullptr) {
obj->CopyFrom(_obj);
}
_ctxPool->ReturnContextToPool(ctx);