Update CreatureLib.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-06-05 16:54:57 +02:00
parent 12066e1dfe
commit 34fb528da4
2 changed files with 2 additions and 41 deletions

View File

@@ -20,7 +20,6 @@ class testScript1 {
bool testNickname(Pokemon@ p, const string& name){ return p.Nickname == name; }
bool testActiveAbility(Pokemon@ p, const constString &in ability){ return p.ActiveAbility == ability; }
bool testIsFainted(Pokemon@ p, bool b){ return p.IsFainted == b; }
bool testType(Pokemon@ p, uint index, uint8 type){ return p.GetTypes()[index] == type; }
bool testHasType(Pokemon@ p, uint8 type){ return p.HasType(type); }
void testDamage(Pokemon@ p, uint32 damage, DamageSource source){ p.Damage(damage, source); }
void testHeal(Pokemon@ p, uint32 amount){ p.Heal(amount); }
@@ -235,26 +234,6 @@ TEST_CASE("Validate Pokemon IsFainted in Script") {
delete mon;
}
TEST_CASE("Validate Pokemon GetTypes in Script") {
auto mainLib = TestLibrary::GetLibrary();
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
.WithForme("default"_cnc)
.WithGender(CreatureLib::Library::Gender::Male)
.Build();
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
auto data = GetScript(mainLib, "testType"_cnc);
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
data.Context->SetArgDWord(1, i);
data.Context->SetArgByte(2, mon->GetTypes()[i]);
REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED);
REQUIRE((bool)data.Context->GetReturnWord());
}
delete mon;
}
TEST_CASE("Validate Pokemon HasType in Script") {
auto mainLib = TestLibrary::GetLibrary();
@@ -262,11 +241,11 @@ TEST_CASE("Validate Pokemon HasType in Script") {
.WithForme("default"_cnc)
.WithGender(CreatureLib::Library::Gender::Male)
.Build();
for (size_t i = 0; i < mon->GetTypes().Count(); i++) {
for (auto t : mon->GetTypes()) {
auto data = GetScript(mainLib, "testHasType"_cnc);
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
data.Context->SetArgByte(1, mon->GetTypes()[i]);
data.Context->SetArgByte(1, t);
REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED);
REQUIRE((bool)data.Context->GetReturnWord());