2020-01-05 14:18:30 +00:00
|
|
|
#ifdef TESTS_BUILD
|
2022-02-11 11:17:27 +00:00
|
|
|
#include <doctest.h>
|
2020-01-05 14:18:30 +00:00
|
|
|
#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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn =
|
2020-04-22 12:41:20 +00:00
|
|
|
CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10).WithNature("neutralNature"_cnc).Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn =
|
2020-04-22 12:41:20 +00:00
|
|
|
CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100).WithNature("neutralNature"_cnc).Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10)
|
2020-04-17 16:20:48 +00:00
|
|
|
.WithNature("neutralNature"_cnc)
|
2020-04-22 12:41:20 +00:00
|
|
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
|
|
|
.Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
2020-04-17 16:20:48 +00:00
|
|
|
.WithNature("neutralNature"_cnc)
|
2020-04-22 12:41:20 +00:00
|
|
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
|
|
|
.Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
2020-04-17 16:20:48 +00:00
|
|
|
.WithNature("neutralNature"_cnc)
|
2020-04-22 12:41:20 +00:00
|
|
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
|
|
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
|
|
|
.Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
2020-04-17 16:20:48 +00:00
|
|
|
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
2020-04-22 12:41:20 +00:00
|
|
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
|
|
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
|
|
|
.Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
2020-04-17 16:20:48 +00:00
|
|
|
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
2020-04-22 12:41:20 +00:00
|
|
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
|
|
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
|
|
|
.Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
|
|
|
|
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") {
|
2020-02-27 17:59:15 +00:00
|
|
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
2020-04-17 16:20:48 +00:00
|
|
|
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
2020-04-22 12:41:20 +00:00
|
|
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
|
|
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
|
|
|
.Build();
|
2020-01-05 14:18:30 +00:00
|
|
|
|
|
|
|
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
|