Commit 8d62e97d authored by nanahira's avatar nanahira

Merge branch 'skystriker-tmp' into skystriker

parents 7b34d6b5 853d588f
...@@ -429,19 +429,19 @@ bool SingleDuel::IsSkyStriker(unsigned int code) { ...@@ -429,19 +429,19 @@ bool SingleDuel::IsSkyStriker(unsigned int code) {
} }
void SingleDuel::CheckSkyStriker(unsigned char player_id) { void SingleDuel::CheckSkyStriker(unsigned char player_id) {
if((int32)pdeck[0].main.size() > 41) { if((int32)pdeck[player_id].main.size() > 41) {
is_skystriker[player_id] = false; is_skystriker[player_id] = false;
return; return;
} }
unsigned short skystricker_count = 0; unsigned short skystricker_count = 0;
for(int32 i = (int32)pdeck[0].main.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[player_id].main.size() - 1; i >= 0; --i) {
if(IsSkyStriker(pdeck[0].main[i]->first)) if(IsSkyStriker(pdeck[player_id].main[i]->first))
skystricker_count++; skystricker_count++;
} }
for(int32 i = (int32)pdeck[0].extra.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[player_id].extra.size() - 1; i >= 0; --i) {
if(IsSkyStriker(pdeck[0].extra[i]->first)) if(IsSkyStriker(pdeck[player_id].extra[i]->first))
skystricker_count++; skystricker_count++;
} }
...@@ -588,6 +588,9 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -588,6 +588,9 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
Deck d = pdeck[0]; Deck d = pdeck[0];
pdeck[0] = pdeck[1]; pdeck[0] = pdeck[1];
pdeck[1] = d; pdeck[1] = d;
bool b = is_skystriker[0];
is_skystriker[0] = is_skystriker[1];
is_skystriker[1] = b;
swapped = true; swapped = true;
} }
dp->state = CTOS_RESPONSE; dp->state = CTOS_RESPONSE;
...@@ -657,10 +660,12 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -657,10 +660,12 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
// add sky striker cards // add sky striker cards
// add 10 fireballs with code 46130346 // add 10 fireballs with code 46130346
new_card(pduel, 46130346, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE); for(int i = 0; i < 10; ++i)
new_card(pduel, 46130346, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE);
// add 5 effect veilers with code 97268402 // add 5 effect veilers with code 97268402
new_card(pduel, 97268402, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE); for(int i = 0; i < 5; ++i)
new_card(pduel, 97268402, p, p, LOCATION_GRAVE, 0, POS_FACEDOWN_DEFENSE);
} }
} }
last_replay.Flush(); last_replay.Flush();
...@@ -693,6 +698,16 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -693,6 +698,16 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
RefreshExtra(0); RefreshExtra(0);
RefreshExtra(1); RefreshExtra(1);
start_duel(pduel, opt); start_duel(pduel, opt);
char reload_buffer[1024];
int reload_buffer_length = query_field_info(pduel, (unsigned char*)reload_buffer);
NetServer::SendBufferToPlayer(players[0], STOC_GAME_MSG, reload_buffer, reload_buffer_length);
NetServer::ReSendToPlayer(players[1]);
for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit);
// server should send to recorder as well
RefreshGrave(0, 0xefffff, 0);
RefreshGrave(1, 0xefffff, 0);
if(host_info.time_limit) { if(host_info.time_limit) {
time_elapsed = 0; time_elapsed = 0;
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
...@@ -764,6 +779,9 @@ void SingleDuel::DuelEndProc() { ...@@ -764,6 +779,9 @@ void SingleDuel::DuelEndProc() {
Deck d = pdeck[0]; Deck d = pdeck[0];
pdeck[0] = pdeck[1]; pdeck[0] = pdeck[1];
pdeck[1] = d; pdeck[1] = d;
bool b = is_skystriker[0];
is_skystriker[0] = is_skystriker[1];
is_skystriker[1] = b;
} }
ready[0] = false; ready[0] = false;
ready[1] = false; ready[1] = false;
......
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