Register Heal Method in AngelScript.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-13 15:15:07 +01:00
parent 6032610de6
commit b83cefce11
3 changed files with 27 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ class testScript1 {
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); }
bool testMove(Pokemon@ p, uint index, LearnedMove@ move){ return p.GetMoves()[index] is move; }
}
@@ -292,6 +293,25 @@ TEST_CASE("Validate Pokemon Damage in Script") {
delete mon;
}
TEST_CASE("Validate Pokemon Heal in Script") {
auto mainLib = TestLibrary::GetLibrary();
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3", 30)
.WithForme("default")
->WithGender(CreatureLib::Library::Gender::Male)
->Build();
mon->Damage(50, CreatureLib::Battling::DamageSource::AttackDamage);
auto data = GetScript(mainLib, "testHeal");
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
data.Context->SetArgDWord(1, 30);
REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED);
REQUIRE(mon->GetCurrentHealth() == mon->GetBoostedStat(PkmnLib::Library::Statistic::HealthPoints) - 20);
delete mon;
}
TEST_CASE("Validate Pokemon GetMoves in Script") {
auto mainLib = TestLibrary::GetLibrary();