Rework CreatePokemon to not return a pointer to self every time, but return by value instead.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -7,7 +7,7 @@ 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"_cnc, 10).WithNature("neutralNature"_cnc)->Build();
|
||||
CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10).WithNature("neutralNature"_cnc).Build();
|
||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 40);
|
||||
CHECK(pkmn->GetCurrentHealth() == 40);
|
||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 25);
|
||||
@@ -20,7 +20,7 @@ TEST_CASE("Low level, no IVs, no EVs, neutral nature, no stat boosts stat test")
|
||||
|
||||
TEST_CASE("High level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||
auto pkmn =
|
||||
CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100).WithNature("neutralNature"_cnc)->Build();
|
||||
CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100).WithNature("neutralNature"_cnc).Build();
|
||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 310);
|
||||
CHECK(pkmn->GetCurrentHealth() == 310);
|
||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 205);
|
||||
@@ -34,8 +34,8 @@ TEST_CASE("High level, no IVs, no EVs, neutral nature, no stat boosts stat test"
|
||||
TEST_CASE("Low level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10)
|
||||
.WithNature("neutralNature"_cnc)
|
||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
->Build();
|
||||
.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);
|
||||
@@ -49,8 +49,8 @@ TEST_CASE("Low level, max IVs, no EVs, neutral nature, no stat boosts stat test"
|
||||
TEST_CASE("High level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||
.WithNature("neutralNature"_cnc)
|
||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
->Build();
|
||||
.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);
|
||||
@@ -64,9 +64,9 @@ TEST_CASE("High level, max IVs, no EVs, neutral nature, no stat boosts stat test
|
||||
TEST_CASE("High level, max IVs, max EVs, neutral nature, no stat boosts stat test") {
|
||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||
.WithNature("neutralNature"_cnc)
|
||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||
->Build();
|
||||
.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);
|
||||
@@ -80,9 +80,9 @@ TEST_CASE("High level, max IVs, max EVs, neutral nature, no stat boosts stat tes
|
||||
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, no stat boosts stat test") {
|
||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||
->Build();
|
||||
.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);
|
||||
@@ -96,9 +96,9 @@ TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, no st
|
||||
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted +6 stat test") {
|
||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||
->Build();
|
||||
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||
.Build();
|
||||
|
||||
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, 6);
|
||||
|
||||
@@ -115,9 +115,9 @@ TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attac
|
||||
TEST_CASE("High level, max IVs, max EVs, nature buffs attack, nerfs speed, Attack boosted -6 stat test") {
|
||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||
->Build();
|
||||
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||
.Build();
|
||||
|
||||
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, -6);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ TEST_CASE("Create and delete Pokemon") {
|
||||
|
||||
TEST_CASE("Get Nature from Pokemon") {
|
||||
auto lib = TestLibrary::GetLibrary();
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies"_cnc, 1).WithNature("neutralNature"_cnc)->Build();
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies"_cnc, 1).WithNature("neutralNature"_cnc).Build();
|
||||
auto nature = mon->GetNature();
|
||||
REQUIRE(nature->GetDecreaseModifier() == 1);
|
||||
REQUIRE(nature->GetIncreaseModifier() == 1);
|
||||
@@ -23,9 +23,9 @@ TEST_CASE("Get Attack name from Pokemon") {
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies"_cnc, 1)
|
||||
.LearnMove(Arbutils::CaseInsensitiveConstString("testMove"),
|
||||
CreatureLib::Battling::AttackLearnMethod::Level)
|
||||
->LearnMove(Arbutils::CaseInsensitiveConstString("testMove2"),
|
||||
.LearnMove(Arbutils::CaseInsensitiveConstString("testMove2"),
|
||||
CreatureLib::Battling::AttackLearnMethod::Level)
|
||||
->Build();
|
||||
.Build();
|
||||
auto move = mon->GetMoves()[0];
|
||||
REQUIRE(move->GetMoveData()->GetName() == "testMove"_cnc);
|
||||
auto move2 = mon->GetMoves()[1];
|
||||
|
||||
@@ -85,7 +85,7 @@ TEST_CASE("Validate Pokemon Forme in Script") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto data = GetScript(mainLib, "testForme"_cnc);
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc)->Build();
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc).Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgObject(1, (void*)mon->GetForme());
|
||||
|
||||
@@ -98,7 +98,7 @@ TEST_CASE("Validate Pokemon Level in Script") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto data = GetScript(mainLib, "testLevel"_cnc);
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc)->Build();
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc).Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgByte(1, mon->GetLevel());
|
||||
|
||||
@@ -111,7 +111,7 @@ TEST_CASE("Validate Pokemon Experience in Script") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto data = GetScript(mainLib, "testExperience"_cnc);
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc)->Build();
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30).WithForme("default"_cnc).Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgDWord(1, mon->GetExperience());
|
||||
|
||||
@@ -126,8 +126,8 @@ TEST_CASE("Validate Pokemon Gender in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgDWord(1, (int)mon->GetGender());
|
||||
|
||||
@@ -142,8 +142,8 @@ TEST_CASE("Validate Pokemon Shininess in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgByte(1, mon->IsShiny());
|
||||
|
||||
@@ -158,9 +158,9 @@ TEST_CASE("Validate Pokemon HeldItem in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithHeldItem("testItem"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithHeldItem("testItem"_cnc)
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgObject(1, (void*)mon->GetHeldItem());
|
||||
|
||||
@@ -175,8 +175,8 @@ TEST_CASE("Validate Pokemon CurrentHealth in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgDWord(1, mon->GetCurrentHealth());
|
||||
|
||||
@@ -191,8 +191,8 @@ TEST_CASE("Validate Pokemon Nickname in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
auto name = mon->GetNickname();
|
||||
data.Context->SetArgAddress(1, &name);
|
||||
@@ -208,8 +208,8 @@ TEST_CASE("Validate Pokemon Active Ability in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
data.Context->SetArgObject(0, (void*)mon);
|
||||
auto name = mon->GetActiveTalent();
|
||||
data.Context->SetArgAddress(1, &name);
|
||||
@@ -225,8 +225,8 @@ TEST_CASE("Validate Pokemon IsFainted in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
data.Context->SetArgByte(1, mon->IsFainted());
|
||||
|
||||
@@ -240,8 +240,8 @@ TEST_CASE("Validate Pokemon GetTypes in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
|
||||
auto data = GetScript(mainLib, "testType"_cnc);
|
||||
|
||||
@@ -260,8 +260,8 @@ TEST_CASE("Validate Pokemon HasType in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
|
||||
auto data = GetScript(mainLib, "testHasType"_cnc);
|
||||
|
||||
@@ -279,8 +279,8 @@ TEST_CASE("Validate Pokemon Damage in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
auto data = GetScript(mainLib, "testDamage"_cnc);
|
||||
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
@@ -298,8 +298,8 @@ TEST_CASE("Validate Pokemon Heal in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithGender(CreatureLib::Library::Gender::Male)
|
||||
->Build();
|
||||
.WithGender(CreatureLib::Library::Gender::Male)
|
||||
.Build();
|
||||
mon->Damage(50, CreatureLib::Battling::DamageSource::AttackDamage);
|
||||
auto data = GetScript(mainLib, "testHeal"_cnc);
|
||||
|
||||
@@ -317,9 +317,9 @@ TEST_CASE("Validate Pokemon GetMoves in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->LearnMove("testMove"_cnc, CreatureLib::Battling::AttackLearnMethod::Level)
|
||||
->LearnMove("testMove2"_cnc, CreatureLib::Battling::AttackLearnMethod::Unknown)
|
||||
->Build();
|
||||
.LearnMove("testMove"_cnc, CreatureLib::Battling::AttackLearnMethod::Level)
|
||||
.LearnMove("testMove2"_cnc, CreatureLib::Battling::AttackLearnMethod::Unknown)
|
||||
.Build();
|
||||
|
||||
for (size_t i = 0; i < mon->GetMoves().Count(); i++) {
|
||||
auto data = GetScript(mainLib, "testMove"_cnc);
|
||||
@@ -340,8 +340,8 @@ TEST_CASE("Validate Pokemon HasHeldItem in Script") {
|
||||
|
||||
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||
.WithForme("default"_cnc)
|
||||
->WithHeldItem("testItem"_cnc)
|
||||
->Build();
|
||||
.WithHeldItem("testItem"_cnc)
|
||||
.Build();
|
||||
auto data = GetScript(mainLib, "testHasHeldItem"_cnc);
|
||||
|
||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||
|
||||
Reference in New Issue
Block a user