Commit c5eee848 authored by salix5's avatar salix5

Duel.SelectReleaseGroup, SelectReleaseGroupEx

parent 155829a9
...@@ -447,8 +447,8 @@ public: ...@@ -447,8 +447,8 @@ public:
int32 filter_field_card(uint8 self, uint32 location, uint32 location2, group* pgroup); int32 filter_field_card(uint8 self, uint32 location, uint32 location2, group* pgroup);
effect* is_player_affected_by_effect(uint8 playerid, uint32 code); effect* is_player_affected_by_effect(uint8 playerid, uint32 code);
int32 get_release_list(uint8 playerid, card_set* release_list, card_set* ex_list, card_set* ex_list_oneof, int32 use_con, int32 use_hand, int32 fun, int32 exarg, card* exc, group* exg, uint32 reason = 0u); int32 get_release_list(uint8 playerid, card_set* release_list, card_set* ex_list, card_set* ex_list_oneof, int32 use_con, int32 use_hand, int32 fun, int32 exarg, card* exc, group* exg, uint32 reason);
int32 check_release_list(uint8 playerid, int32 count, int32 use_con, int32 use_hand, int32 fun, int32 exarg, card* exc, group* exg, uint32 reason = 0u); int32 check_release_list(uint8 playerid, int32 count, int32 use_con, int32 use_hand, int32 fun, int32 exarg, card* exc, group* exg, uint32 reason);
int32 get_summon_release_list(card* target, card_set* release_list, card_set* ex_list, card_set* ex_list_oneof, group* mg = NULL, uint32 ex = 0, uint32 releasable = 0xff00ff, uint32 pos = 0x1); int32 get_summon_release_list(card* target, card_set* release_list, card_set* ex_list, card_set* ex_list_oneof, group* mg = NULL, uint32 ex = 0, uint32 releasable = 0xff00ff, uint32 pos = 0x1);
int32 get_summon_count_limit(uint8 playerid); int32 get_summon_count_limit(uint8 playerid);
int32 get_draw_count(uint8 playerid); int32 get_draw_count(uint8 playerid);
......
...@@ -2677,30 +2677,32 @@ int32 scriptlib::duel_check_release_group(lua_State *L) { ...@@ -2677,30 +2677,32 @@ int32 scriptlib::duel_check_release_group(lua_State *L) {
return 1; return 1;
} }
int32 scriptlib::duel_select_release_group(lua_State *L) { int32 scriptlib::duel_select_release_group(lua_State *L) {
const int32 must_param = 6;
check_action_permission(L); check_action_permission(L);
check_param_count(L, 5); check_param_count(L, must_param);
int32 playerid = (int32)lua_tointeger(L, 1); uint32 reason = (uint32)lua_tointeger(L, 1);
int32 playerid = (int32)lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 use_con = FALSE; int32 use_con = FALSE;
if(!lua_isnil(L, 2)) { if(!lua_isnil(L, 3)) {
check_param(L, PARAM_TYPE_FUNCTION, 2); check_param(L, PARAM_TYPE_FUNCTION, 3);
use_con = TRUE; use_con = TRUE;
} }
uint32 min = (uint32)lua_tointeger(L, 4);
uint32 max = (uint32)lua_tointeger(L, 5);
card* pexception = 0; card* pexception = 0;
group* pexgroup = 0; group* pexgroup = 0;
if(check_param(L, PARAM_TYPE_CARD, 5, TRUE)) if(check_param(L, PARAM_TYPE_CARD, 6, TRUE))
pexception = *(card**) lua_touserdata(L, 5); pexception = *(card**) lua_touserdata(L, 6);
else if(check_param(L, PARAM_TYPE_GROUP, 5, TRUE)) else if(check_param(L, PARAM_TYPE_GROUP, 6, TRUE))
pexgroup = *(group**) lua_touserdata(L, 5); pexgroup = *(group**) lua_touserdata(L, 6);
uint32 extraargs = lua_gettop(L) - 5; uint32 extraargs = lua_gettop(L) - must_param;
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
uint32 min = (uint32)lua_tointeger(L, 3);
uint32 max = (uint32)lua_tointeger(L, 4);
pduel->game_field->core.release_cards.clear(); pduel->game_field->core.release_cards.clear();
pduel->game_field->core.release_cards_ex.clear(); pduel->game_field->core.release_cards_ex.clear();
pduel->game_field->core.release_cards_ex_oneof.clear(); pduel->game_field->core.release_cards_ex_oneof.clear();
pduel->game_field->get_release_list(playerid, &pduel->game_field->core.release_cards, &pduel->game_field->core.release_cards_ex, &pduel->game_field->core.release_cards_ex_oneof, use_con, FALSE, 2, extraargs, pexception, pexgroup); pduel->game_field->get_release_list(playerid, &pduel->game_field->core.release_cards, &pduel->game_field->core.release_cards_ex, &pduel->game_field->core.release_cards_ex_oneof, use_con, FALSE, 3, extraargs, pexception, pexgroup, reason);
pduel->game_field->add_process(PROCESSOR_SELECT_RELEASE, 0, 0, 0, playerid, (max << 16) + min); pduel->game_field->add_process(PROCESSOR_SELECT_RELEASE, 0, 0, 0, playerid, (max << 16) + min);
return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) { return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) {
duel* pduel = (duel*)ctx; duel* pduel = (duel*)ctx;
...@@ -2740,30 +2742,32 @@ int32 scriptlib::duel_check_release_group_ex(lua_State *L) { ...@@ -2740,30 +2742,32 @@ int32 scriptlib::duel_check_release_group_ex(lua_State *L) {
return 1; return 1;
} }
int32 scriptlib::duel_select_release_group_ex(lua_State *L) { int32 scriptlib::duel_select_release_group_ex(lua_State *L) {
const int32 must_param = 6;
check_action_permission(L); check_action_permission(L);
check_param_count(L, 5); check_param_count(L, must_param);
int32 playerid = (int32)lua_tointeger(L, 1); uint32 reason = (uint32)lua_tointeger(L, 1);
int32 playerid = (int32)lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 use_con = FALSE; int32 use_con = FALSE;
if(!lua_isnil(L, 2)) { if(!lua_isnil(L, 3)) {
check_param(L, PARAM_TYPE_FUNCTION, 2); check_param(L, PARAM_TYPE_FUNCTION, 3);
use_con = TRUE; use_con = TRUE;
} }
uint32 min = (uint32)lua_tointeger(L, 4);
uint32 max = (uint32)lua_tointeger(L, 5);
card* pexception = 0; card* pexception = 0;
group* pexgroup = 0; group* pexgroup = 0;
if(check_param(L, PARAM_TYPE_CARD, 5, TRUE)) if(check_param(L, PARAM_TYPE_CARD, 6, TRUE))
pexception = *(card**) lua_touserdata(L, 5); pexception = *(card**) lua_touserdata(L, 6);
else if(check_param(L, PARAM_TYPE_GROUP, 5, TRUE)) else if(check_param(L, PARAM_TYPE_GROUP, 6, TRUE))
pexgroup = *(group**) lua_touserdata(L, 5); pexgroup = *(group**) lua_touserdata(L, 6);
uint32 extraargs = lua_gettop(L) - 5; uint32 extraargs = lua_gettop(L) - must_param;
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
uint32 min = (uint32)lua_tointeger(L, 3);
uint32 max = (uint32)lua_tointeger(L, 4);
pduel->game_field->core.release_cards.clear(); pduel->game_field->core.release_cards.clear();
pduel->game_field->core.release_cards_ex.clear(); pduel->game_field->core.release_cards_ex.clear();
pduel->game_field->core.release_cards_ex_oneof.clear(); pduel->game_field->core.release_cards_ex_oneof.clear();
pduel->game_field->get_release_list(playerid, &pduel->game_field->core.release_cards, &pduel->game_field->core.release_cards_ex, &pduel->game_field->core.release_cards_ex_oneof, use_con, TRUE, 2, extraargs, pexception, pexgroup); pduel->game_field->get_release_list(playerid, &pduel->game_field->core.release_cards, &pduel->game_field->core.release_cards_ex, &pduel->game_field->core.release_cards_ex_oneof, use_con, TRUE, 3, extraargs, pexception, pexgroup, reason);
pduel->game_field->add_process(PROCESSOR_SELECT_RELEASE, 0, 0, 0, playerid, (max << 16) + min); pduel->game_field->add_process(PROCESSOR_SELECT_RELEASE, 0, 0, 0, playerid, (max << 16) + min);
return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) { return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) {
duel* pduel = (duel*)ctx; duel* pduel = (duel*)ctx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment