Commit 60484c53 authored by mercury233's avatar mercury233 Committed by GitHub

update Duel.SendtoDeck shuffle (#411)

parent b2867197
......@@ -53,6 +53,10 @@ struct card_sort {
//For redirect
#define LOCATION_DECKBOT 0x10001 //Return to deck bottom
#define LOCATION_DECKSHF 0x20001 //Return to deck and shuffle
//For Duel.SendtoDeck
#define SEQ_DECKTOP 0 //Return to deck top
#define SEQ_DECKBOTTOM 1 //Return to deck bottom
#define SEQ_DECKSHUFFLE 2 //Return to deck and shuffle
//Positions
#define POS_FACEUP_ATTACK 0x1
......@@ -390,6 +394,7 @@ struct card_sort {
#define DUEL_PSEUDO_SHUFFLE 0x10
#define DUEL_TAG_MODE 0x20
#define DUEL_SIMPLE_AI 0x40
#define DUEL_RETURN_DECK_TOP 0x80
//Activity
#define ACTIVITY_SUMMON 1
......
......@@ -137,15 +137,21 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
break;
}
case LOCATION_DECK: {
if (sequence == 0) { //deck top
if (sequence == SEQ_DECKTOP) {
player[playerid].list_main.push_back(pcard);
pcard->current.sequence = (uint8)player[playerid].list_main.size() - 1;
} else if (sequence == 1) { //deck bottom
} else if (sequence == SEQ_DECKBOTTOM) {
player[playerid].list_main.insert(player[playerid].list_main.begin(), pcard);
reset_sequence(playerid, LOCATION_DECK);
} else { //deck top & shuffle
player[playerid].list_main.push_back(pcard);
pcard->current.sequence = (uint8)player[playerid].list_main.size() - 1;
} else { // SEQ_DECKSHUFFLE
if(core.duel_options & DUEL_RETURN_DECK_TOP) {
player[playerid].list_main.push_back(pcard);
pcard->current.sequence = (uint8)player[playerid].list_main.size() - 1;
}
else {
player[playerid].list_main.insert(player[playerid].list_main.begin(), pcard);
reset_sequence(playerid, LOCATION_DECK);
}
if(!core.shuffle_check_disabled)
core.shuffle_deck_check[playerid] = TRUE;
}
......@@ -264,12 +270,15 @@ void field::move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequenc
pduel->write_buffer32(pcard->data.code);
pduel->write_buffer32(pcard->get_info_location());
player[preplayer].list_main.erase(player[preplayer].list_main.begin() + pcard->current.sequence);
if (sequence == 0) { //deck top
if (sequence == SEQ_DECKTOP) {
player[playerid].list_main.push_back(pcard);
} else if (sequence == 1) {
} else if (sequence == SEQ_DECKBOTTOM) {
player[playerid].list_main.insert(player[playerid].list_main.begin(), pcard);
} else {
player[playerid].list_main.push_back(pcard);
} else { // SEQ_DECKSHUFFLE
if(core.duel_options & DUEL_RETURN_DECK_TOP)
player[playerid].list_main.push_back(pcard);
else
player[playerid].list_main.insert(player[playerid].list_main.begin(), pcard);
if(!core.shuffle_check_disabled)
core.shuffle_deck_check[playerid] = TRUE;
}
......
......@@ -146,7 +146,7 @@ int32 scriptlib::debug_reload_field_begin(lua_State *L) {
uint32 flag = (uint32)lua_tointeger(L, 1);
int32 rule = (int32)lua_tointeger(L, 2);
pduel->clear();
pduel->game_field->core.duel_options = flag;
pduel->game_field->core.duel_options |= flag;
if (rule)
pduel->game_field->core.duel_rule = rule;
else if (flag & DUEL_OBSOLETE_RULING)
......
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