diff --git a/core/card.cpp b/core/card.cpp index 3322043..78fe41c 100644 --- a/core/card.cpp +++ b/core/card.cpp @@ -431,6 +431,9 @@ int32_t card::get_infos(byte* buf, uint32_t query_flag, int32_t use_cache) { query_flag &= ~QUERY_LINK; } } + if(query_flag & QUERY_TAG_MEMBER) { + buffer_write(p, tag_member); + } byte* finalize = buf; buffer_write(finalize, (int32_t)(p - buf)); buffer_write(finalize, query_flag); diff --git a/core/card.h b/core/card.h index cd4dbb5..4f8feb9 100644 --- a/core/card.h +++ b/core/card.h @@ -164,6 +164,7 @@ public: card_state spsummon; query_cache q_cache; uint8_t owner{ PLAYER_NONE }; + uint8_t tag_member{ 0 }; // [YGOL] proposal 53: the partner who brought it, 0 from new_card, 1 from new_tag_card uint8_t summon_player{ PLAYER_NONE }; uint32_t summon_info{}; uint32_t status{}; diff --git a/core/common.h b/core/common.h index 522fca5..c711acf 100644 --- a/core/common.h +++ b/core/common.h @@ -271,6 +271,7 @@ enum LuaParamType : int32_t { #define QUERY_LSCALE 0x200000 #define QUERY_RSCALE 0x400000 #define QUERY_LINK 0x800000 +#define QUERY_TAG_MEMBER 0x1000000 // [YGOL] proposal 53. Never 0x100000: old flags (0xf81fff, 0x181fff, 0xFFFFFF) set it with no value //Link markers #define LINK_MARKER_BOTTOM_LEFT 0x001 @@ -452,6 +453,7 @@ enum LuaParamType : int32_t { #define DUEL_SIMPLE_AI 0x40 #define DUEL_RETURN_DECK_TOP 0x80 #define DUEL_REVEAL_DECK_SEQ 0x100 +#define DUEL_TAG_SHARED_EXTRA 0x200 // [YGOL] proposal 53: one Extra Deck per Tag team //Activity #define ACTIVITY_SUMMON 1 diff --git a/core/field.cpp b/core/field.cpp index bf7de36..2b03d43 100644 --- a/core/field.cpp +++ b/core/field.cpp @@ -1243,15 +1243,17 @@ void field::tag_swap(uint8_t playerid) { pcard->enable_field_effect(true); } //extra - for(auto& pcard : player[playerid].list_extra) { - pcard->enable_field_effect(false); - pcard->cancel_field_effect(); - } - std::swap(player[playerid].list_extra, player[playerid].tag_list_extra); - std::swap(player[playerid].extra_p_count, player[playerid].tag_extra_p_count); - for(auto& pcard : player[playerid].list_extra) { - pcard->apply_field_effect(); - pcard->enable_field_effect(true); + if(!(core.duel_options & DUEL_TAG_SHARED_EXTRA)) { // [YGOL] proposal 53: a shared Extra Deck stays live for both partners + for(auto& pcard : player[playerid].list_extra) { + pcard->enable_field_effect(false); + pcard->cancel_field_effect(); + } + std::swap(player[playerid].list_extra, player[playerid].tag_list_extra); + std::swap(player[playerid].extra_p_count, player[playerid].tag_extra_p_count); + for(auto& pcard : player[playerid].list_extra) { + pcard->apply_field_effect(); + pcard->enable_field_effect(true); + } } player[playerid].tag_partner ^= 1; // [YGOL] proposal 45: the other partner's Field slot is the live one now pduel->write_buffer8(MSG_TAG_SWAP); diff --git a/core/ocgapi.cpp b/core/ocgapi.cpp index 751385b..a071482 100644 --- a/core/ocgapi.cpp +++ b/core/ocgapi.cpp @@ -109,6 +109,18 @@ OCGCORE_API void start_duel(intptr_t pduel, uint32_t options) { pd->game_field->core.shuffle_hand_check[1] = FALSE; pd->game_field->core.shuffle_deck_check[0] = FALSE; pd->game_field->core.shuffle_deck_check[1] = FALSE; + if((options & DUEL_TAG_MODE) && (options & DUEL_TAG_SHARED_EXTRA)) { // [YGOL] proposal 53: the team has one live Extra Deck + for(uint8_t p = 0; p < 2; ++p) { + auto& team = pd->game_field->player[p]; + for(auto& pcard : team.tag_list_extra) { + team.list_extra.push_back(pcard); + pcard->apply_field_effect(); + pcard->enable_field_effect(true); + } + team.tag_list_extra.clear(); + pd->game_field->reset_sequence(p, LOCATION_EXTRA); + } + } if(pd->game_field->player[0].start_count > 0) pd->game_field->draw(0, REASON_RULE, PLAYER_NONE, 0, pd->game_field->player[0].start_count); if(pd->game_field->player[1].start_count > 0) @@ -198,6 +210,7 @@ OCGCORE_API void new_tag_card(intptr_t pduel, uint32_t code, uint8_t owner, uint if(owner > 1 || !(location & (LOCATION_DECK | LOCATION_EXTRA))) return; card* pcard = ptduel->new_card(code); + pcard->tag_member = 1; // [YGOL] proposal 53 switch(location) { case LOCATION_DECK: ptduel->game_field->player[owner].tag_list_main.push_back(pcard);