Commit a9bc336e authored by nanahira's avatar nanahira

Reset time limit after picking deck

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