Rework CreatePokemon to not return a pointer to self every time, but return by value instead.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
babb384166
commit
b1442f25fb
|
@ -1,16 +1,16 @@
|
||||||
#include "CreatePokemon.hpp"
|
#include "CreatePokemon.hpp"
|
||||||
|
|
||||||
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithRandomIndividualValues(Arbutils::Random rand) {
|
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithRandomIndividualValues(Arbutils::Random rand) {
|
||||||
_ivHp = rand.Get(0, 32);
|
_ivHp = rand.Get(0, 32);
|
||||||
_ivAttack = rand.Get(0, 32);
|
_ivAttack = rand.Get(0, 32);
|
||||||
_ivDefense = rand.Get(0, 32);
|
_ivDefense = rand.Get(0, 32);
|
||||||
_ivSpAtt = rand.Get(0, 32);
|
_ivSpAtt = rand.Get(0, 32);
|
||||||
_ivSpDef = rand.Get(0, 32);
|
_ivSpDef = rand.Get(0, 32);
|
||||||
_ivSpeed = rand.Get(0, 32);
|
_ivSpeed = rand.Get(0, 32);
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon
|
||||||
PkmnLib::Battling::CreatePokemon::WithIndividualValue(CreatureLib::Library::Statistic stat, uint8_t value) {
|
PkmnLib::Battling::CreatePokemon::WithIndividualValue(CreatureLib::Library::Statistic stat, uint8_t value) {
|
||||||
switch (stat) {
|
switch (stat) {
|
||||||
case PkmnLib::Library::Statistic::HealthPoints: _ivHp = value; break;
|
case PkmnLib::Library::Statistic::HealthPoints: _ivHp = value; break;
|
||||||
|
@ -20,11 +20,11 @@ PkmnLib::Battling::CreatePokemon::WithIndividualValue(CreatureLib::Library::Stat
|
||||||
case PkmnLib::Library::Statistic::SpecialDefense: _ivSpDef = value; break;
|
case PkmnLib::Library::Statistic::SpecialDefense: _ivSpDef = value; break;
|
||||||
case PkmnLib::Library::Statistic::Speed: _ivSpeed = value; break;
|
case PkmnLib::Library::Statistic::Speed: _ivSpeed = value; break;
|
||||||
}
|
}
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithEffortValue(CreatureLib::Library::Statistic stat,
|
||||||
PkmnLib::Battling::CreatePokemon::WithEffortValue(CreatureLib::Library::Statistic stat, uint8_t value) {
|
uint8_t value) {
|
||||||
switch (stat) {
|
switch (stat) {
|
||||||
case PkmnLib::Library::Statistic::HealthPoints: _evHp = value; break;
|
case PkmnLib::Library::Statistic::HealthPoints: _evHp = value; break;
|
||||||
case PkmnLib::Library::Statistic::PhysicalAttack: _evAttack = value; break;
|
case PkmnLib::Library::Statistic::PhysicalAttack: _evAttack = value; break;
|
||||||
|
@ -33,7 +33,7 @@ PkmnLib::Battling::CreatePokemon::WithEffortValue(CreatureLib::Library::Statisti
|
||||||
case PkmnLib::Library::Statistic::SpecialDefense: _evSpDef = value; break;
|
case PkmnLib::Library::Statistic::SpecialDefense: _evSpDef = value; break;
|
||||||
case PkmnLib::Library::Statistic::Speed: _evSpeed = value; break;
|
case PkmnLib::Library::Statistic::Speed: _evSpeed = value; break;
|
||||||
}
|
}
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
|
PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
|
||||||
|
@ -101,53 +101,53 @@ PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
|
||||||
pkmn->Initialize();
|
pkmn->Initialize();
|
||||||
return pkmn;
|
return pkmn;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon
|
||||||
PkmnLib::Battling::CreatePokemon::WithNature(const Arbutils::CaseInsensitiveConstString& nature) {
|
PkmnLib::Battling::CreatePokemon::WithNature(const Arbutils::CaseInsensitiveConstString& nature) {
|
||||||
_nature = nature;
|
_nature = nature;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithIndividualValues(uint8_t hp, uint8_t att,
|
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithIndividualValues(uint8_t hp, uint8_t att,
|
||||||
uint8_t def, uint8_t spAtt,
|
uint8_t def, uint8_t spAtt,
|
||||||
uint8_t spDef, uint8_t speed) {
|
uint8_t spDef, uint8_t speed) {
|
||||||
_ivHp = hp;
|
_ivHp = hp;
|
||||||
_ivAttack = att;
|
_ivAttack = att;
|
||||||
_ivDefense = def;
|
_ivDefense = def;
|
||||||
_ivSpAtt = spAtt;
|
_ivSpAtt = spAtt;
|
||||||
_ivSpDef = spDef;
|
_ivSpDef = spDef;
|
||||||
_ivSpeed = speed;
|
_ivSpeed = speed;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithEffortValues(uint8_t hp, uint8_t att,
|
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithEffortValues(uint8_t hp, uint8_t att,
|
||||||
uint8_t def, uint8_t spAtt,
|
uint8_t def, uint8_t spAtt,
|
||||||
uint8_t spDef, uint8_t speed) {
|
uint8_t spDef, uint8_t speed) {
|
||||||
_evHp = hp;
|
_evHp = hp;
|
||||||
_evAttack = att;
|
_evAttack = att;
|
||||||
_evDefense = def;
|
_evDefense = def;
|
||||||
_evSpAtt = spAtt;
|
_evSpAtt = spAtt;
|
||||||
_evSpDef = spDef;
|
_evSpDef = spDef;
|
||||||
_evSpeed = speed;
|
_evSpeed = speed;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon
|
||||||
PkmnLib::Battling::CreatePokemon::WithForme(const Arbutils::CaseInsensitiveConstString& forme) {
|
PkmnLib::Battling::CreatePokemon::WithForme(const Arbutils::CaseInsensitiveConstString& forme) {
|
||||||
_forme = forme;
|
_forme = forme;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::WithGender(CreatureLib::Library::Gender gender) {
|
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::WithGender(CreatureLib::Library::Gender gender) {
|
||||||
_gender = gender;
|
_gender = gender;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon* PkmnLib::Battling::CreatePokemon::IsShiny(bool value) {
|
PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::IsShiny(bool value) {
|
||||||
_shininessSet = true;
|
_shininessSet = true;
|
||||||
_isShiny = value;
|
_isShiny = value;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon
|
||||||
PkmnLib::Battling::CreatePokemon::WithHeldItem(const Arbutils::CaseInsensitiveConstString& item) {
|
PkmnLib::Battling::CreatePokemon::WithHeldItem(const Arbutils::CaseInsensitiveConstString& item) {
|
||||||
_heldItem = item;
|
_heldItem = item;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
PkmnLib::Battling::CreatePokemon*
|
PkmnLib::Battling::CreatePokemon
|
||||||
PkmnLib::Battling::CreatePokemon::LearnMove(const Arbutils::CaseInsensitiveConstString& moveName,
|
PkmnLib::Battling::CreatePokemon::LearnMove(const Arbutils::CaseInsensitiveConstString& moveName,
|
||||||
CreatureLib::Battling::AttackLearnMethod method) {
|
CreatureLib::Battling::AttackLearnMethod method) {
|
||||||
const PkmnLib::Library::MoveData* move = nullptr;
|
const PkmnLib::Library::MoveData* move = nullptr;
|
||||||
|
@ -161,5 +161,5 @@ PkmnLib::Battling::CreatePokemon::LearnMove(const Arbutils::CaseInsensitiveConst
|
||||||
auto& c = _attacks[_currentMove++];
|
auto& c = _attacks[_currentMove++];
|
||||||
c.Move = move;
|
c.Move = move;
|
||||||
c.LearnMethod = method;
|
c.LearnMethod = method;
|
||||||
return this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,22 +49,22 @@ namespace PkmnLib::Battling {
|
||||||
_attacks.Resize(library->GetSettings()->GetMaximalMoves(), ToLearnMethod());
|
_attacks.Resize(library->GetSettings()->GetMaximalMoves(), ToLearnMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePokemon* WithForme(const Arbutils::CaseInsensitiveConstString& forme);
|
CreatePokemon WithForme(const Arbutils::CaseInsensitiveConstString& forme);
|
||||||
CreatePokemon* WithGender(CreatureLib::Library::Gender gender);
|
CreatePokemon WithGender(CreatureLib::Library::Gender gender);
|
||||||
CreatePokemon* IsShiny(bool value);
|
CreatePokemon IsShiny(bool value);
|
||||||
CreatePokemon* WithHeldItem(const Arbutils::CaseInsensitiveConstString& item);
|
CreatePokemon WithHeldItem(const Arbutils::CaseInsensitiveConstString& item);
|
||||||
CreatePokemon* LearnMove(const Arbutils::CaseInsensitiveConstString& move,
|
CreatePokemon LearnMove(const Arbutils::CaseInsensitiveConstString& move,
|
||||||
CreatureLib::Battling::AttackLearnMethod method);
|
CreatureLib::Battling::AttackLearnMethod method);
|
||||||
|
|
||||||
CreatePokemon* WithRandomIndividualValues(Arbutils::Random rand = Arbutils::Random());
|
CreatePokemon WithRandomIndividualValues(Arbutils::Random rand = Arbutils::Random());
|
||||||
CreatePokemon* WithIndividualValue(CreatureLib::Library::Statistic stat, uint8_t value);
|
CreatePokemon WithIndividualValue(CreatureLib::Library::Statistic stat, uint8_t value);
|
||||||
CreatePokemon* WithIndividualValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
|
CreatePokemon WithIndividualValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
|
||||||
uint8_t speed);
|
uint8_t speed);
|
||||||
CreatePokemon* WithEffortValue(CreatureLib::Library::Statistic stat, uint8_t value);
|
CreatePokemon WithEffortValue(CreatureLib::Library::Statistic stat, uint8_t value);
|
||||||
CreatePokemon* WithEffortValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
|
CreatePokemon WithEffortValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
|
||||||
uint8_t speed);
|
uint8_t speed);
|
||||||
|
|
||||||
CreatePokemon* WithNature(const Arbutils::CaseInsensitiveConstString& nature);
|
CreatePokemon WithNature(const Arbutils::CaseInsensitiveConstString& nature);
|
||||||
|
|
||||||
Pokemon* Build();
|
Pokemon* Build();
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ using namespace PkmnLib::Battling;
|
||||||
|
|
||||||
TEST_CASE("Low level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
TEST_CASE("Low level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn =
|
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->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 40);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 40);
|
CHECK(pkmn->GetCurrentHealth() == 40);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 25);
|
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") {
|
TEST_CASE("High level, no IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn =
|
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->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 310);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 310);
|
CHECK(pkmn->GetCurrentHealth() == 310);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 205);
|
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") {
|
TEST_CASE("Low level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 10)
|
||||||
.WithNature("neutralNature"_cnc)
|
.WithNature("neutralNature"_cnc)
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->Build();
|
.Build();
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 43);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 43);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 43);
|
CHECK(pkmn->GetCurrentHealth() == 43);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 28);
|
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") {
|
TEST_CASE("High level, max IVs, no EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("neutralNature"_cnc)
|
.WithNature("neutralNature"_cnc)
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->Build();
|
.Build();
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 341);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 341);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 341);
|
CHECK(pkmn->GetCurrentHealth() == 341);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 236);
|
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") {
|
TEST_CASE("High level, max IVs, max EVs, neutral nature, no stat boosts stat test") {
|
||||||
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("neutralNature"_cnc)
|
.WithNature("neutralNature"_cnc)
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
->Build();
|
.Build();
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 404);
|
CHECK(pkmn->GetCurrentHealth() == 404);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 299);
|
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") {
|
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)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
->Build();
|
.Build();
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::HealthPoints) == 404);
|
||||||
CHECK(pkmn->GetCurrentHealth() == 404);
|
CHECK(pkmn->GetCurrentHealth() == 404);
|
||||||
CHECK(pkmn->GetFlatStat(PkmnLib::Library::Statistic::PhysicalAttack) == 328);
|
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") {
|
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)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
->Build();
|
.Build();
|
||||||
|
|
||||||
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, 6);
|
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") {
|
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)
|
auto pkmn = CreatePokemon(TestLibrary::GetLibrary(), "statTestSpecies1"_cnc, 100)
|
||||||
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
.WithNature("buffsAttackNerfsSpeed"_cnc)
|
||||||
->WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
->WithEffortValues(255, 255, 255, 255, 255, 255)
|
.WithEffortValues(255, 255, 255, 255, 255, 255)
|
||||||
->Build();
|
.Build();
|
||||||
|
|
||||||
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, -6);
|
pkmn->ChangeStatBoost(PkmnLib::Library::Statistic::PhysicalAttack, -6);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ TEST_CASE("Create and delete Pokemon") {
|
||||||
|
|
||||||
TEST_CASE("Get Nature from Pokemon") {
|
TEST_CASE("Get Nature from Pokemon") {
|
||||||
auto lib = TestLibrary::GetLibrary();
|
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();
|
auto nature = mon->GetNature();
|
||||||
REQUIRE(nature->GetDecreaseModifier() == 1);
|
REQUIRE(nature->GetDecreaseModifier() == 1);
|
||||||
REQUIRE(nature->GetIncreaseModifier() == 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)
|
auto mon = PkmnLib::Battling::CreatePokemon(lib, "testSpecies"_cnc, 1)
|
||||||
.LearnMove(Arbutils::CaseInsensitiveConstString("testMove"),
|
.LearnMove(Arbutils::CaseInsensitiveConstString("testMove"),
|
||||||
CreatureLib::Battling::AttackLearnMethod::Level)
|
CreatureLib::Battling::AttackLearnMethod::Level)
|
||||||
->LearnMove(Arbutils::CaseInsensitiveConstString("testMove2"),
|
.LearnMove(Arbutils::CaseInsensitiveConstString("testMove2"),
|
||||||
CreatureLib::Battling::AttackLearnMethod::Level)
|
CreatureLib::Battling::AttackLearnMethod::Level)
|
||||||
->Build();
|
.Build();
|
||||||
auto move = mon->GetMoves()[0];
|
auto move = mon->GetMoves()[0];
|
||||||
REQUIRE(move->GetMoveData()->GetName() == "testMove"_cnc);
|
REQUIRE(move->GetMoveData()->GetName() == "testMove"_cnc);
|
||||||
auto move2 = mon->GetMoves()[1];
|
auto move2 = mon->GetMoves()[1];
|
||||||
|
|
|
@ -85,7 +85,7 @@ TEST_CASE("Validate Pokemon Forme in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testForme"_cnc);
|
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(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgObject(1, (void*)mon->GetForme());
|
data.Context->SetArgObject(1, (void*)mon->GetForme());
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ TEST_CASE("Validate Pokemon Level in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testLevel"_cnc);
|
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->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgByte(1, mon->GetLevel());
|
data.Context->SetArgByte(1, mon->GetLevel());
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ TEST_CASE("Validate Pokemon Experience in Script") {
|
||||||
auto mainLib = TestLibrary::GetLibrary();
|
auto mainLib = TestLibrary::GetLibrary();
|
||||||
auto data = GetScript(mainLib, "testExperience"_cnc);
|
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->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgDWord(1, mon->GetExperience());
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgDWord(1, (int)mon->GetGender());
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgByte(1, mon->IsShiny());
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithHeldItem("testItem"_cnc)
|
.WithHeldItem("testItem"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgObject(1, (void*)mon->GetHeldItem());
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgDWord(1, mon->GetCurrentHealth());
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
auto name = mon->GetNickname();
|
auto name = mon->GetNickname();
|
||||||
data.Context->SetArgAddress(1, &name);
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
data.Context->SetArgObject(0, (void*)mon);
|
data.Context->SetArgObject(0, (void*)mon);
|
||||||
auto name = mon->GetActiveTalent();
|
auto name = mon->GetActiveTalent();
|
||||||
data.Context->SetArgAddress(1, &name);
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
data.Context->SetArgByte(1, mon->IsFainted());
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
|
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
|
||||||
auto data = GetScript(mainLib, "testType"_cnc);
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
|
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
|
||||||
auto data = GetScript(mainLib, "testHasType"_cnc);
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
auto data = GetScript(mainLib, "testDamage"_cnc);
|
auto data = GetScript(mainLib, "testDamage"_cnc);
|
||||||
|
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
->Build();
|
.Build();
|
||||||
mon->Damage(50, CreatureLib::Battling::DamageSource::AttackDamage);
|
mon->Damage(50, CreatureLib::Battling::DamageSource::AttackDamage);
|
||||||
auto data = GetScript(mainLib, "testHeal"_cnc);
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->LearnMove("testMove"_cnc, CreatureLib::Battling::AttackLearnMethod::Level)
|
.LearnMove("testMove"_cnc, CreatureLib::Battling::AttackLearnMethod::Level)
|
||||||
->LearnMove("testMove2"_cnc, CreatureLib::Battling::AttackLearnMethod::Unknown)
|
.LearnMove("testMove2"_cnc, CreatureLib::Battling::AttackLearnMethod::Unknown)
|
||||||
->Build();
|
.Build();
|
||||||
|
|
||||||
for (size_t i = 0; i < mon->GetMoves().Count(); i++) {
|
for (size_t i = 0; i < mon->GetMoves().Count(); i++) {
|
||||||
auto data = GetScript(mainLib, "testMove"_cnc);
|
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)
|
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
|
||||||
.WithForme("default"_cnc)
|
.WithForme("default"_cnc)
|
||||||
->WithHeldItem("testItem"_cnc)
|
.WithHeldItem("testItem"_cnc)
|
||||||
->Build();
|
.Build();
|
||||||
auto data = GetScript(mainLib, "testHasHeldItem"_cnc);
|
auto data = GetScript(mainLib, "testHasHeldItem"_cnc);
|
||||||
|
|
||||||
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
|
||||||
|
|
Loading…
Reference in New Issue