From 2b4156c35c30a36bba897fc33cfa4678a0ac9ab2 Mon Sep 17 00:00:00 2001 From: Lyris Date: Wed, 30 Jun 2021 06:05:17 -0400 Subject: [PATCH 1/4] Add `duel_assume_reset` --- libduel.cpp | 7 +++++++ scriptlib.h | 1 + 2 files changed, 8 insertions(+) diff --git a/libduel.cpp b/libduel.cpp index 03c144068..a9cfa05eb 100644 --- a/libduel.cpp +++ b/libduel.cpp @@ -13,6 +13,13 @@ #include "group.h" #include "ocgapi.h" +//added by Lyris +int32 scriptlib::duel_assume_reset(lua_State *L) { + duel* pduel = interpreter::get_duel_info(L); + pduel->restore_assumes(); + return 1; +} + int32 scriptlib::duel_enable_global_flag(lua_State *L) { check_param_count(L, 1); int32 flag = (int32)lua_tointeger(L, 1); diff --git a/scriptlib.h b/scriptlib.h index 2116df609..bc9c77e69 100644 --- a/scriptlib.h +++ b/scriptlib.h @@ -373,6 +373,7 @@ class scriptlib { static void open_grouplib(lua_State *L); //Duel functions + static int32 duel_assume_reset(lua_State *L); //added by Lyris static int32 duel_enable_global_flag(lua_State *L); static int32 duel_get_lp(lua_State *L); static int32 duel_set_lp(lua_State *L); From 67d248f5a877d883cb503eb3e337e39825f7eb66 Mon Sep 17 00:00:00 2001 From: Lyris Date: Wed, 30 Jun 2021 07:03:38 -0400 Subject: [PATCH 2/4] un-cite --- libduel.cpp | 1 - scriptlib.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libduel.cpp b/libduel.cpp index a9cfa05eb..c98c51407 100644 --- a/libduel.cpp +++ b/libduel.cpp @@ -13,7 +13,6 @@ #include "group.h" #include "ocgapi.h" -//added by Lyris int32 scriptlib::duel_assume_reset(lua_State *L) { duel* pduel = interpreter::get_duel_info(L); pduel->restore_assumes(); diff --git a/scriptlib.h b/scriptlib.h index bc9c77e69..343fb8627 100644 --- a/scriptlib.h +++ b/scriptlib.h @@ -373,7 +373,7 @@ class scriptlib { static void open_grouplib(lua_State *L); //Duel functions - static int32 duel_assume_reset(lua_State *L); //added by Lyris + static int32 duel_assume_reset(lua_State *L); static int32 duel_enable_global_flag(lua_State *L); static int32 duel_get_lp(lua_State *L); static int32 duel_set_lp(lua_State *L); From 3b9508538abd068241dbda8b09ea12927f0900e0 Mon Sep 17 00:00:00 2001 From: Lyris Date: Wed, 30 Jun 2021 07:10:27 -0400 Subject: [PATCH 3/4] Update libduel.cpp `duel_assume_reset` now returns 0 --- libduel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libduel.cpp b/libduel.cpp index c98c51407..31330e7e8 100644 --- a/libduel.cpp +++ b/libduel.cpp @@ -16,7 +16,7 @@ int32 scriptlib::duel_assume_reset(lua_State *L) { duel* pduel = interpreter::get_duel_info(L); pduel->restore_assumes(); - return 1; + return 0; } int32 scriptlib::duel_enable_global_flag(lua_State *L) { From 855cfc76f9343f5ee5b5df49e20f5bdd426f5016 Mon Sep 17 00:00:00 2001 From: mercury233 Date: Tue, 30 Aug 2022 10:34:47 +0800 Subject: [PATCH 4/4] fix & format --- libduel.cpp | 12 ++++++------ scriptlib.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libduel.cpp b/libduel.cpp index 4a247e103..a99eb7c8e 100644 --- a/libduel.cpp +++ b/libduel.cpp @@ -13,12 +13,6 @@ #include "group.h" #include "ocgapi.h" -int32 scriptlib::duel_assume_reset(lua_State *L) { - duel* pduel = interpreter::get_duel_info(L); - pduel->restore_assumes(); - return 0; -} - int32 scriptlib::duel_enable_global_flag(lua_State *L) { check_param_count(L, 1); int32 flag = (int32)lua_tointeger(L, 1); @@ -4591,6 +4585,11 @@ int32 scriptlib::duel_majestic_copy(lua_State *L) { } return 0; } +int32 scriptlib::duel_assume_reset(lua_State *L) { + duel* pduel = interpreter::get_duel_info(L); + pduel->restore_assumes(); + return 0; +} static const struct luaL_Reg duellib[] = { { "EnableGlobalFlag", scriptlib::duel_enable_global_flag }, @@ -4811,6 +4810,7 @@ static const struct luaL_Reg duellib[] = { { "IsAbleToEnterBP", scriptlib::duel_is_able_to_enter_bp }, { "SwapDeckAndGrave", scriptlib::duel_swap_deck_and_grave }, { "MajesticCopy", scriptlib::duel_majestic_copy }, + { "AssumeReset", scriptlib::duel_assume_reset }, { NULL, NULL } }; void scriptlib::open_duellib(lua_State *L) { diff --git a/scriptlib.h b/scriptlib.h index e4e3abc0f..12edd435d 100644 --- a/scriptlib.h +++ b/scriptlib.h @@ -375,7 +375,6 @@ class scriptlib { static void open_grouplib(lua_State *L); //Duel functions - static int32 duel_assume_reset(lua_State *L); static int32 duel_enable_global_flag(lua_State *L); static int32 duel_get_lp(lua_State *L); static int32 duel_set_lp(lua_State *L); @@ -600,6 +599,7 @@ class scriptlib { //specific card functions static int32 duel_swap_deck_and_grave(lua_State *L); static int32 duel_majestic_copy(lua_State *L); + static int32 duel_assume_reset(lua_State *L); static void open_duellib(lua_State *L);