From 2ae73b816bf2388a96faafda9925cafbeb2cd45f Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 29 Oct 2021 19:35:31 +0200 Subject: [PATCH] Implements ScriptSource changes, Updates OnEndTurn. --- src/Battling/Battle/Battle.hpp | 4 ++-- src/ScriptResolving/AngelScript/AngelScriptScript.cpp | 4 +--- src/ScriptResolving/AngelScript/AngelScriptScript.hpp | 2 +- src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp | 2 +- .../AngelScript/TypeRegistry/BasicScriptClass.cpp | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Battling/Battle/Battle.hpp b/src/Battling/Battle/Battle.hpp index fc09711..a9a2813 100644 --- a/src/Battling/Battle/Battle.hpp +++ b/src/Battling/Battle/Battle.hpp @@ -31,8 +31,8 @@ namespace PkmnLib::Battling { } size_t ScriptCount() const override { return CreatureLib::Battling::Battle::ScriptCount() + 1; } - void GetActiveScripts(ArbUt::List& scripts) override { - CreatureLib::Battling::Battle::GetActiveScripts(scripts); + void GetOwnScripts(ArbUt::List& scripts) override { + CreatureLib::Battling::Battle::GetOwnScripts(scripts); scripts.Append(CreatureLib::Battling::ScriptWrapper( CreatureLib::Battling::ScriptWrapper::FromScript(&_weatherScript))); } diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp index d78a307..a9c9f25 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp @@ -293,9 +293,7 @@ void AngelScriptScript::PreventOpponentSwitch(const CreatureLib::Battling::Switc ctx->SetArgAddress(1, outResult); }) } -void AngelScriptScript::OnEndTurn(CreatureLib::Battling::Creature* creature) { - CALL_HOOK(OnEndTurn, { ctx->SetArgObject(0, (void*)creature); }) -} +void AngelScriptScript::OnEndTurn() { CALL_HOOK(OnEndTurn, {}) } void AngelScriptScript::ModifyNumberOfHits(CreatureLib::Battling::AttackTurnChoice* choice, u8* numberOfHits){CALL_HOOK(ModifyNumberOfHits, { diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp index f117b81..babfacf 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp @@ -114,7 +114,7 @@ public: void PreventRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override; void PreventOpponentRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override; void PreventOpponentSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) override; - void OnEndTurn(CreatureLib::Battling::Creature* creature) override; + void OnEndTurn() override; //////////////////// // PkmnLib methods// diff --git a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp index 19bbdbd..3f70646 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp @@ -144,7 +144,7 @@ public: SCRIPT_HOOK_FUNCTION(PreventOpponentRunAway, "void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result)"); SCRIPT_HOOK_FUNCTION(PreventOpponentSwitch, "void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result)"); - SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn(Pokemon@ pokemon)"); + SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn()"); }; #undef SCRIPT_HOOK_FUNCTION diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp index 00a726c..9eb07df 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp @@ -45,7 +45,7 @@ shared abstract class PkmnScript { void PreventRunAway(FleeTurnChoice@ choice, bool& result){}; void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){}; void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){}; - void OnEndTurn(Pokemon@ pokemon){}; + void OnEndTurn(){}; // PkmnLib methods void ModifyCriticalStage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& critStage){};