Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Duel.GetLastSelectHint #596

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions field.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ struct processor {
int32 summon_count[2]{};
uint8 extra_summon[2]{};
int32 spe_effect[2]{};
int32 last_select_hint[2]{ 0 };
int32 duel_options{ 0 };
int32 duel_rule{ CURRENT_RULE }; //current rule: 5, Master Rule 2020
uint32 copy_reset{ 0 };
Expand Down
13 changes: 13 additions & 0 deletions libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3701,12 +3701,24 @@ int32 scriptlib::duel_hint(lua_State * L) {
if(htype == HINT_OPSELECTED)
playerid = 1 - playerid;
duel* pduel = interpreter::get_duel_info(L);
if(htype == HINT_SELECTMSG)
pduel->game_field->core.last_select_hint[playerid] = desc;
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(htype);
pduel->write_buffer8(playerid);
pduel->write_buffer32(desc);
return 0;
}
int32 scriptlib::duel_get_last_select_hint(lua_State* L) {
duel* pduel = interpreter::get_duel_info(L);
uint8 playerid = pduel->game_field->core.reason_player;
if(lua_gettop(L) >= 1)
playerid = (uint8)lua_tointeger(L, 1);
if(playerid != 0 && playerid != 1)
return 0;
lua_pushinteger(L, pduel->game_field->core.last_select_hint[playerid]);
return 1;
}
int32 scriptlib::duel_hint_selection(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_GROUP, 1);
Expand Down Expand Up @@ -4961,6 +4973,7 @@ static const struct luaL_Reg duellib[] = {
{ "CheckRemoveOverlayCard", scriptlib::duel_check_remove_overlay_card },
{ "RemoveOverlayCard", scriptlib::duel_remove_overlay_card },
{ "Hint", scriptlib::duel_hint },
{ "GetLastSelectHint", scriptlib::duel_get_last_select_hint },
{ "HintSelection", scriptlib::duel_hint_selection },
{ "SelectEffectYesNo", scriptlib::duel_select_effect_yesno },
{ "SelectYesNo", scriptlib::duel_select_yesno },
Expand Down
1 change: 1 addition & 0 deletions scriptlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ class scriptlib {
static int32 duel_remove_overlay_card(lua_State *L);

static int32 duel_hint(lua_State *L);
static int32 duel_get_last_select_hint(lua_State *L);
static int32 duel_hint_selection(lua_State *L);
static int32 duel_select_effect_yesno(lua_State *L);
static int32 duel_select_yesno(lua_State *L);
Expand Down