Support for evolving a mon.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
bb90d3db87
commit
9e587b3d0b
|
@ -1 +1,38 @@
|
||||||
#include "Pokemon.hpp"
|
#include "Pokemon.hpp"
|
||||||
|
#include <CreatureLib/Battling/Models/Battle.hpp>
|
||||||
|
|
||||||
|
void PkmnLib::Battling::Pokemon::Evolve(ArbUt::BorrowedPtr<const Library::PokemonSpecies> mon,
|
||||||
|
ArbUt::BorrowedPtr<const Library::PokemonForme> forme) {
|
||||||
|
_species = mon.ForceAs<const CreatureLib::Library::CreatureSpecies>();
|
||||||
|
_variant = forme.ForceAs<const CreatureLib::Library::SpeciesVariant>();
|
||||||
|
|
||||||
|
ArbUt::Random* rand;
|
||||||
|
if (!_battle.IsNull()) {
|
||||||
|
rand = &_battle->GetRandom()->GetRNG();
|
||||||
|
} else {
|
||||||
|
rand = new ArbUt::Random();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_gender != CreatureLib::Library::Gender::Genderless && _species->GetGenderRate() != -1) {
|
||||||
|
_gender = _species->GetRandomGender(*rand);
|
||||||
|
} else if (_species->GetGenderRate() == -1 && _gender != CreatureLib::Library::Gender::Genderless) {
|
||||||
|
_gender = CreatureLib::Library::Gender::Genderless;
|
||||||
|
}
|
||||||
|
|
||||||
|
_types.clear();
|
||||||
|
for (auto t : forme->GetTypes()) {
|
||||||
|
_types.insert(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
_activeTalent =
|
||||||
|
std::unique_ptr<CreatureLib::Battling::Script>(_library->LoadScript(ScriptCategory::Talent, GetActiveTalent()));
|
||||||
|
|
||||||
|
auto currentMaxHealth = GetBoostedStat(PkmnLib::Library::Statistic::HealthPoints);
|
||||||
|
RecalculateFlatStats();
|
||||||
|
auto diffHealth = GetBoostedStat(PkmnLib::Library::Statistic::HealthPoints) - currentMaxHealth;
|
||||||
|
_currentHealth += diffHealth;
|
||||||
|
if (_currentHealth < 0)
|
||||||
|
_currentHealth = 0;
|
||||||
|
|
||||||
|
// TODO: Learn moves?
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,9 @@ namespace PkmnLib::Battling {
|
||||||
inline ArbUt::BorrowedPtr<const PkmnLib::Library::PokemonSpecies> GetPokemonSpecies() const noexcept {
|
inline ArbUt::BorrowedPtr<const PkmnLib::Library::PokemonSpecies> GetPokemonSpecies() const noexcept {
|
||||||
return _species.As<const PkmnLib::Library::PokemonSpecies>();
|
return _species.As<const PkmnLib::Library::PokemonSpecies>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Evolve(ArbUt::BorrowedPtr<const Library::PokemonSpecies> mon,
|
||||||
|
ArbUt::BorrowedPtr<const Library::PokemonForme> forme);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue