Implements Change Effectiveness script hook in AngelScript.
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:
@@ -58,6 +58,9 @@ void StopBeforeAttack(ExecutingMove@ attack, bool& result) override{
|
||||
AS_CLASS(
|
||||
ChangeAttackTypeScript,
|
||||
R"(void ChangeAttackType(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& outType) override{outType = 1; };)"),
|
||||
AS_CLASS(
|
||||
ChangeEffectivenessScript,
|
||||
R"(void ChangeEffectiveness(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& eff) override{eff = 0.75; };)"),
|
||||
AS_CLASS(
|
||||
PreventSecondaryEffectsScript,
|
||||
R"(void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& result) override{ result = !result; })"),
|
||||
@@ -271,6 +274,17 @@ TEST_CASE("Invoke ChangeAttackType script function") {
|
||||
delete script;
|
||||
}
|
||||
|
||||
TEST_CASE("Invoke ChangeEffectiveness script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "ChangeEffectivenessScript"_cnc);
|
||||
REQUIRE(script != nullptr);
|
||||
float b = 0;
|
||||
script->ChangeEffectiveness(nullptr, nullptr, 0, &b);
|
||||
REQUIRE(b == Approx(0.75));
|
||||
|
||||
delete script;
|
||||
}
|
||||
|
||||
TEST_CASE("Invoke PreventSecondaryEffects script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "PreventSecondaryEffectsScript"_cnc);
|
||||
|
||||
Reference in New Issue
Block a user