Commit bbbe1411 authored by nanahira's avatar nanahira

add Duel.MoveTurnCount

parent 23af4bb2
...@@ -1032,7 +1032,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1032,7 +1032,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
break; break;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
pbuf++; int r_player = BufferIO::ReadInt8(pbuf);
time_limit[0] = host_info.time_limit; time_limit[0] = host_info.time_limit;
time_limit[1] = host_info.time_limit; time_limit[1] = host_info.time_limit;
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset); NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, offset, pbuf - offset);
...@@ -1044,6 +1044,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1044,6 +1044,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
NetServer::ReSendToPlayers(cache_recorder, replay_recorder); NetServer::ReSendToPlayers(cache_recorder, replay_recorder);
#endif #endif
if(!(r_player & 0x2)) {
if(turn_count > 0) { if(turn_count > 0) {
if(turn_count % 2 == 0) { if(turn_count % 2 == 0) {
if(cur_player[0] == players[0]) if(cur_player[0] == players[0])
...@@ -1058,6 +1059,8 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1058,6 +1059,8 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
} }
} }
turn_count++; turn_count++;
}
turn_count++;
break; break;
} }
case MSG_NEW_PHASE: { case MSG_NEW_PHASE: {
......
...@@ -377,6 +377,7 @@ static const struct luaL_Reg duellib[] = { ...@@ -377,6 +377,7 @@ static const struct luaL_Reg duellib[] = {
{ "Exile", scriptlib::duel_exile }, { "Exile", scriptlib::duel_exile },
{ "DisableActionCheck", scriptlib::duel_disable_action_check }, { "DisableActionCheck", scriptlib::duel_disable_action_check },
{ "SetMetatable", scriptlib::duel_setmetatable }, { "SetMetatable", scriptlib::duel_setmetatable },
{ "MoveTurnCount", scriptlib::duel_move_turn_count },
{ "EnableGlobalFlag", scriptlib::duel_enable_global_flag }, { "EnableGlobalFlag", scriptlib::duel_enable_global_flag },
{ "GetLP", scriptlib::duel_get_lp }, { "GetLP", scriptlib::duel_get_lp },
......
...@@ -144,6 +144,15 @@ int32 scriptlib::duel_setmetatable(lua_State *L) { ...@@ -144,6 +144,15 @@ int32 scriptlib::duel_setmetatable(lua_State *L) {
lua_setmetatable(L, 1); lua_setmetatable(L, 1);
return 0; return 0;
} }
int32 scriptlib::duel_move_turn_count(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
int32 turn_player = pduel->game_field->infos.turn_player;
pduel->game_field->infos.turn_id++;
pduel->game_field->infos.turn_id_by_player[turn_player]++;
pduel->write_buffer8(MSG_NEW_TURN);
pduel->write_buffer8(turn_player | 0x2);
return 0;
}
int32 scriptlib::duel_enable_global_flag(lua_State *L) { int32 scriptlib::duel_enable_global_flag(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
......
...@@ -32,6 +32,7 @@ public: ...@@ -32,6 +32,7 @@ public:
static int32 duel_exile(lua_State *L); static int32 duel_exile(lua_State *L);
static int32 duel_disable_action_check(lua_State *L); static int32 duel_disable_action_check(lua_State *L);
static int32 duel_setmetatable(lua_State *L); static int32 duel_setmetatable(lua_State *L);
static int32 duel_move_turn_count(lua_State *L);
//card lib //card lib
static int32 card_get_code(lua_State *L); static int32 card_get_code(lua_State *L);
......
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