Commit a9bc336e authored by nanahira's avatar nanahira

Reset time limit after picking deck

parent e454e517
......@@ -173,6 +173,7 @@ function Auxiliary.StartPick(e)
for p=0,1 do
if Duel.IsPlayerNeedToPickDeck(p) then
Duel.ShuffleDeck(p)
Duel.ResetTimeLimit(p)
end
end
for p=0,1 do
......
......@@ -743,6 +743,11 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
pick_deck_saved[player] = true;
break;
}
case MSG_RESET_TIME: {
player = BufferIO::ReadInt8(pbuf);
time_limit[player] = host_info.time_limit;
break;
}
case MSG_RETRY: {
WaitforResponse(last_response);
NetServer::SendBufferToPlayer(players[last_response], STOC_GAME_MSG, offset, pbuf - offset);
......
......@@ -914,5 +914,6 @@ public:
#define MSG_SELECT_UNSELECT_CARD 190
//2pick
#define MSG_SAVE_PICK_DECK 222
#define MSG_SAVE_PICK_DECK 220
#define MSG_RESET_TIME 221
#endif /* FIELD_H_ */
......@@ -373,6 +373,7 @@ static const struct luaL_Reg duellib[] = {
{ "SavePickDeck", scriptlib::duel_save_pick_deck },
{ "IsPlayerNeedToPickDeck", scriptlib::duel_is_player_need_to_pick_deck },
{ "GetStartCount", scriptlib::duel_get_start_count },
{ "ResetTimeLimit", scriptlib::duel_reset_time_limit },
//modded
{ "SelectField", scriptlib::duel_select_field },
{ "GetMasterRule", scriptlib::duel_get_master_rule },
......
......@@ -19,7 +19,7 @@ int32 scriptlib::duel_save_pick_deck(lua_State * L) {
check_param(L, PARAM_TYPE_GROUP, 2);
int32 playerid = lua_tonumberint(L, 1);
if(playerid != 0 && playerid != 1)
return 0;
luaL_error(L, "Parameter 1 should be 0 or 1.", 2);
group* pgroup = *(group**) lua_touserdata(L, 2);
duel* pduel = pgroup->pduel;
if(pgroup->container.size() == 0)
......@@ -50,6 +50,16 @@ int32 scriptlib::duel_get_start_count(lua_State * L) {
lua_pushinteger(L, pduel->game_field->player[p].start_count);
return 1;
}
int32 scriptlib::duel_reset_time_limit(lua_State * L) {
check_param_count(L, 1);
int32 p = lua_tonumberint(L, 1);
if(p != 0 && p != 1)
luaL_error(L, "Parameter 1 should be 0 or 1.", 2);
duel* pduel = interpreter::get_duel_info(L);
pduel->write_buffer8(MSG_RESET_TIME);
pduel->write_buffer8(p);
return 0;
}
//modded
int32 scriptlib::duel_select_field(lua_State * L) {
check_action_permission(L);
......
......@@ -20,6 +20,7 @@ public:
static int32 duel_save_pick_deck(lua_State *L);
static int32 duel_is_player_need_to_pick_deck(lua_State *L);
static int32 duel_get_start_count(lua_State *L);
static int32 duel_reset_time_limit(lua_State *L);
//millux
static int32 card_is_ritual_type(lua_State *L);
//modded
......
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