Commit 635db301 authored by VanillaSalt's avatar VanillaSalt

fix

fixed SwapDeckAndGrave
parent a7da0e4c
......@@ -1641,8 +1641,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit)
(*cit)->location = LOCATION_GRAVE;
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit)
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ) {
if ((*cit)->type & 0x802040) {
(*cit)->location = LOCATION_EXTRA;
mainGame->dField.extra[player].push_back(*cit);
cit = mainGame->dField.deck[player].erase(cit);
} else {
(*cit)->location = LOCATION_DECK;
++cit;
}
}
} else {
mainGame->gMutex.Lock();
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
......@@ -1650,9 +1658,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
(*cit)->location = LOCATION_GRAVE;
mainGame->dField.MoveCard(*cit, 10);
}
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
(*cit)->location = LOCATION_DECK;
mainGame->dField.MoveCard(*cit, 10);
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ) {
ClientCard* pcard = *cit;
if (pcard->type & 0x802040) {
pcard->location = LOCATION_EXTRA;
mainGame->dField.extra[player].push_back(pcard);
cit = mainGame->dField.deck[player].erase(cit);
} else {
pcard->location = LOCATION_DECK;
++cit;
}
mainGame->dField.MoveCard(pcard, 10);
}
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(11);
......
......@@ -568,9 +568,15 @@ void field::swap_deck_and_grave(uint8 playerid) {
(*clit)->enable_field_effect(false);
(*clit)->cancel_field_effect();
}
card_vector cl = player[playerid].list_grave;
player[playerid].list_grave = player[playerid].list_main;
player[playerid].list_main = cl;
player[playerid].list_grave.swap(player[playerid].list_main);
card_vector ex;
for(clit = player[playerid].list_main.begin(); clit != player[playerid].list_main.end(); ) {
if((*clit)->data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ)) {
ex.push_back(*clit);
clit = player[playerid].list_main.erase(clit);
} else
++clit;
}
for(clit = player[playerid].list_grave.begin(); clit != player[playerid].list_grave.end(); ++clit) {
(*clit)->current.location = LOCATION_GRAVE;
(*clit)->current.reason = REASON_EFFECT;
......@@ -587,7 +593,17 @@ void field::swap_deck_and_grave(uint8 playerid) {
(*clit)->apply_field_effect();
(*clit)->enable_field_effect(true);
}
for(clit = ex.begin(); clit != ex.end(); ++clit) {
(*clit)->current.location = LOCATION_EXTRA;
(*clit)->current.reason = REASON_EFFECT;
(*clit)->current.reason_effect = core.reason_effect;
(*clit)->current.reason_player = core.reason_player;
(*clit)->apply_field_effect();
(*clit)->enable_field_effect(true);
}
player[playerid].list_extra.insert(player[playerid].list_extra.end(), ex.begin(), ex.end());
reset_sequence(playerid, LOCATION_GRAVE);
reset_sequence(playerid, LOCATION_EXTRA);
pduel->write_buffer8(MSG_SWAP_GRAVE_DECK);
pduel->write_buffer8(playerid);
shuffle(playerid, LOCATION_DECK);
......
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