133 lines
7.2 KiB
C++
133 lines
7.2 KiB
C++
|
#ifdef TESTS_BUILD
|
||
|
#include "../../extern/catch.hpp"
|
||
|
#include "../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||
|
#include "../TestLibrary/TestLibrary.hpp"
|
||
|
|
||
|
using namespace PkmnLib::Battling;
|
||
|
|
||
|
TEST_CASE("Low level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 10).WithNature("neutralNature")->Build();
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 40);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 40);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 25);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalDefense) == 25);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialAttack) == 25);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialDefense) == 25);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::Speed) == 25);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
TEST_CASE("High level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100).WithNature("neutralNature")->Build();
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 310);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 310);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 205);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalDefense) == 205);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialAttack) == 205);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialDefense) == 205);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::Speed) == 205);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
TEST_CASE("Low level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 10)
|
||
|
.WithNature("neutralNature")
|
||
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||
|
->Build();
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 43);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 43);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 28);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalDefense) == 28);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialAttack) == 28);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialDefense) == 28);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::Speed) == 28);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
TEST_CASE("High level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
||
|
.WithNature("neutralNature")
|
||
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||
|
->Build();
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 341);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 341);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 236);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalDefense) == 236);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialAttack) == 236);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialDefense) == 236);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::Speed) == 236);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
TEST_CASE("High level, max IVs, max EVs, neutral nature, no stat boosts stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
||
|
.WithNature("neutralNature")
|
||
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||
|
->Build();
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 404);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 299);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalDefense) == 299);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialAttack) == 299);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialDefense) == 299);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::Speed) == 299);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, no stat boosts stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
||
|
.WithNature("buffsAttackNerfsSpeed")
|
||
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||
|
->Build();
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 404);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 328);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalDefense) == 299);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialAttack) == 299);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::SpecialDefense) == 299);
|
||
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::Speed) == 269);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted +6 stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
||
|
.WithNature("buffsAttackNerfsSpeed")
|
||
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||
|
->Build();
|
||
|
|
||
|
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, 6);
|
||
|
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 404);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::PhysicalAttack) == 1312);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::PhysicalDefense) == 299);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::SpecialAttack) == 299);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::SpecialDefense) == 299);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::Speed) == 269);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted -6 stat test") {
|
||
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1", 100)
|
||
|
.WithNature("buffsAttackNerfsSpeed")
|
||
|
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||
|
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||
|
->Build();
|
||
|
|
||
|
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, -6);
|
||
|
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
||
|
CHECK(pkmn->GetCurrentHealth() == 404);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::PhysicalAttack) == 82);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::PhysicalDefense) == 299);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::SpecialAttack) == 299);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::SpecialDefense) == 299);
|
||
|
CHECK(pkmn->GetBoostedStat(PkmnLib::Library::Statistic::Speed) == 269);
|
||
|
delete pkmn;
|
||
|
}
|
||
|
|
||
|
|
||
|
#endif
|