Commit 6988cf33 authored by fallenstardust's avatar fallenstardust

sync ocgcore

parent f82a88c5
...@@ -1218,6 +1218,7 @@ void card::get_linked_cards(card_set* cset) { ...@@ -1218,6 +1218,7 @@ void card::get_linked_cards(card_set* cset) {
int32 p = current.controler; int32 p = current.controler;
uint32 linked_zone = get_linked_zone(); uint32 linked_zone = get_linked_zone();
pduel->game_field->get_cards_in_zone(cset, linked_zone, p, LOCATION_MZONE); pduel->game_field->get_cards_in_zone(cset, linked_zone, p, LOCATION_MZONE);
pduel->game_field->get_cards_in_zone(cset, linked_zone >> 16, 1 - p, LOCATION_MZONE);
} }
uint32 card::get_mutual_linked_zone() { uint32 card::get_mutual_linked_zone() {
if(!(data.type & TYPE_LINK) || current.location != LOCATION_MZONE) if(!(data.type & TYPE_LINK) || current.location != LOCATION_MZONE)
...@@ -1356,6 +1357,7 @@ void card::get_mutual_linked_cards(card_set* cset) { ...@@ -1356,6 +1357,7 @@ void card::get_mutual_linked_cards(card_set* cset) {
int32 p = current.controler; int32 p = current.controler;
uint32 mutual_linked_zone = get_mutual_linked_zone(); uint32 mutual_linked_zone = get_mutual_linked_zone();
pduel->game_field->get_cards_in_zone(cset, mutual_linked_zone, p, LOCATION_MZONE); pduel->game_field->get_cards_in_zone(cset, mutual_linked_zone, p, LOCATION_MZONE);
pduel->game_field->get_cards_in_zone(cset, mutual_linked_zone >> 16, 1 - p, LOCATION_MZONE);
} }
int32 card::is_link_state() { int32 card::is_link_state() {
if(current.location != LOCATION_MZONE) if(current.location != LOCATION_MZONE)
...@@ -1428,76 +1430,58 @@ int32 card::is_status(uint32 status) { ...@@ -1428,76 +1430,58 @@ int32 card::is_status(uint32 status) {
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
uint32 card::get_column_zone(int32 loc1, int32 left, int32 right) { uint32 card::get_column_zone(int32 location) {
int32 zones = 0; int32 zones = 0;
int32 loc2 = current.location; uint8 seq = current.sequence;
int32 s = current.sequence; if(!(location & LOCATION_ONFIELD) || !(current.location & LOCATION_ONFIELD) || current.location == LOCATION_SZONE && seq >= 5)
if(!(loc1 & LOCATION_ONFIELD) || !(loc2 & LOCATION_ONFIELD) || loc2 == LOCATION_SZONE && s >=5 || left < 0 || right < 0)
return 0; return 0;
if(s <= 4) { if(seq <= 4) {
if(loc1 != loc2) if(location & LOCATION_MZONE) {
zones |= 1u << s; if(!(current.location & LOCATION_MZONE))
zones |= 1u << (16 + (4 - s)); zones |= 1u << seq;
if(loc1 & LOCATION_MZONE) { zones |= 1u << (16 + (4 - seq));
if(s == 1) if(seq == 1)
zones |= (1u << 5) | (1u << (16 + 6)); zones |= (1u << 5) | (1u << (16 + 6));
if(s == 3) if(seq == 3)
zones |= (1u << 6) | (1u << (16 + 5)); zones |= (1u << 6) | (1u << (16 + 5));
} }
} if(location & LOCATION_SZONE) {
if(s == 5) if(!(current.location & LOCATION_SZONE))
zones |= (1u << 1) | (1u << (16 + 3)); zones |= 1u << (seq + 8);
if(s == 6) zones |= 1u << (16 + 8 + (4 - seq));
zones |= (1u << 3) | (1u << (16 + 1));
for(int32 i = 1; i <= left; ++i) {
int32 seq = s - i;
if(s == 5)
seq = 1 - i;
if(s == 6)
seq = 3 - i;
if(seq >= 0 && seq <= 4) {
zones |= 1u << seq | 1u << (16 + (4 - seq));
if(loc1 & LOCATION_MZONE) {
if(seq == 1)
zones |= (1u << 5) | (1u << (16 + 6));
if(seq == 3)
zones |= (1u << 6) | (1u << (16 + 5));
}
} }
} }
for(int32 i = 1; i <= right; ++i) { if(seq == 5) {
int32 seq = s + i; if(location & LOCATION_MZONE)
if(s == 5) zones |= (1u << 1) | (1u << (16 + 3));
seq = 1 + i; if(location & LOCATION_SZONE)
if(s == 6) zones |= (1u << (8 + 1)) | (1u << (16 + 8 + 3));
seq = 3 + i; }
if(seq >= 0 && seq <= 4) { if(seq == 6) {
zones |= 1u << seq | 1u << (16 + (4 - seq)); if(location & LOCATION_MZONE)
if(loc1 & LOCATION_MZONE) { zones |= (1u << 3) | (1u << (16 + 1));
if(seq == 1) if(location & LOCATION_SZONE)
zones |= (1u << 5) | (1u << (16 + 6)); zones |= (1u << (8 + 3)) | (1u << (16 + 8 + 1));
if(seq == 3)
zones |= (1u << 6) | (1u << (16 + 5));
}
}
} }
return zones; return zones;
} }
void card::get_column_cards(card_set* cset, int32 left, int32 right) { void card::get_column_cards(card_set* cset) {
cset->clear(); cset->clear();
if(!(current.location & LOCATION_ONFIELD)) if(!(current.location & LOCATION_ONFIELD))
return; return;
int32 p = current.controler; int32 p = current.controler;
uint32 column_mzone = get_column_zone(LOCATION_MZONE, left, right); uint32 column_mzone = get_column_zone(LOCATION_MZONE);
uint32 column_szone = get_column_zone(LOCATION_SZONE, left, right); uint32 column_szone = get_column_zone(LOCATION_SZONE);
pduel->game_field->get_cards_in_zone(cset, column_mzone, p, LOCATION_MZONE); pduel->game_field->get_cards_in_zone(cset, column_mzone, p, LOCATION_MZONE);
pduel->game_field->get_cards_in_zone(cset, column_szone, p, LOCATION_SZONE); pduel->game_field->get_cards_in_zone(cset, column_mzone >> 16, 1 - p, LOCATION_MZONE);
pduel->game_field->get_cards_in_zone(cset, column_szone >> 8, p, LOCATION_SZONE);
pduel->game_field->get_cards_in_zone(cset, column_szone >> 24, 1 - p, LOCATION_SZONE);
} }
int32 card::is_all_column() { int32 card::is_all_column() {
if(!(current.location & LOCATION_ONFIELD)) if(!(current.location & LOCATION_ONFIELD))
return FALSE; return FALSE;
card_set cset; card_set cset;
get_column_cards(&cset, 0, 0); get_column_cards(&cset);
int32 full = 3; int32 full = 3;
if(pduel->game_field->core.duel_rule >= 4 && (current.sequence == 1 || current.sequence == 3)) if(pduel->game_field->core.duel_rule >= 4 && (current.sequence == 1 || current.sequence == 3))
full++; full++;
......
...@@ -233,8 +233,8 @@ public: ...@@ -233,8 +233,8 @@ public:
void set_status(uint32 status, int32 enabled); void set_status(uint32 status, int32 enabled);
int32 get_status(uint32 status); int32 get_status(uint32 status);
int32 is_status(uint32 status); int32 is_status(uint32 status);
uint32 get_column_zone(int32 loc1, int32 left, int32 right); uint32 get_column_zone(int32 location);
void get_column_cards(card_set* cset, int32 left, int32 right); void get_column_cards(card_set* cset);
int32 is_all_column(); int32 is_all_column();
void equip(card *target, uint32 send_msg = TRUE); void equip(card *target, uint32 send_msg = TRUE);
......
...@@ -816,7 +816,7 @@ void field::get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset) { ...@@ -816,7 +816,7 @@ void field::get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset) {
uint8 c = s; uint8 c = s;
for(int32 p = 0; p < 2; ++p) { for(int32 p = 0; p < 2; ++p) {
if(c) { if(c) {
uint32 linked_zone = get_linked_zone(self) & 0xffff; uint32 linked_zone = get_linked_zone(self);
get_cards_in_zone(cset, linked_zone, self, LOCATION_MZONE); get_cards_in_zone(cset, linked_zone, self, LOCATION_MZONE);
} }
self = 1 - self; self = 1 - self;
...@@ -883,50 +883,15 @@ int32 field::check_extra_link(int32 playerid, card* pcard, int32 sequence) { ...@@ -883,50 +883,15 @@ int32 field::check_extra_link(int32 playerid, card* pcard, int32 sequence) {
void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location) { void field::get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location) {
if(!(location & LOCATION_ONFIELD)) if(!(location & LOCATION_ONFIELD))
return; return;
uint32 icheck; card_vector& svector = (location == LOCATION_MZONE) ? player[playerid].list_mzone : player[playerid].list_szone;
if(location & LOCATION_MZONE) { uint32 icheck = 0x1;
card_vector& svector_s = player[playerid].list_mzone; for(auto it = svector.begin(); it != svector.end(); ++it) {
icheck = 0x1; if(zone & icheck) {
for(auto it = svector_s.begin(); it != svector_s.end(); ++it) { card* pcard = *it;
if(zone & icheck) { if(pcard)
card* pcard = *it; cset->insert(pcard);
if(pcard)
cset->insert(pcard);
}
icheck <<= 1;
}
card_vector& svector_o = player[1 - playerid].list_mzone;
icheck = 0x10000;
for(auto it = svector_o.begin(); it != svector_o.end(); ++it) {
if(zone & icheck) {
card* pcard = *it;
if(pcard)
cset->insert(pcard);
}
icheck <<= 1;
}
}
if(location & LOCATION_SZONE) {
card_vector& svector_s = player[playerid].list_szone;
icheck = 0x100;
for(auto it = svector_s.begin(); it != svector_s.end(); ++it) {
if(zone & icheck) {
card* pcard = *it;
if(pcard)
cset->insert(pcard);
}
icheck <<= 1;
}
card_vector& svector_o = player[1 - playerid].list_szone;
icheck = 0x1000000;
for(auto it = svector_o.begin(); it != svector_o.end(); ++it) {
if(zone & icheck) {
card* pcard = *it;
if(pcard)
cset->insert(pcard);
}
icheck <<= 1;
} }
icheck <<= 1;
} }
} }
void field::shuffle(uint8 playerid, uint8 location) { void field::shuffle(uint8 playerid, uint8 location) {
...@@ -2638,7 +2603,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 ...@@ -2638,7 +2603,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
card_set linked_cards; card_set linked_cards;
if(ct <= 0) { if(ct <= 0) {
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE); get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE);
if(linked_cards.find(tuner) != linked_cards.end()) if(linked_cards.find(tuner) != linked_cards.end())
ct++; ct++;
} }
...@@ -2936,7 +2901,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min, ...@@ -2936,7 +2901,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 lv, int32 min,
if(ct <= 0) { if(ct <= 0) {
int32 ft = ct; int32 ft = ct;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE); get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE);
for(auto cit = core.xmaterial_lst.begin(); cit != core.xmaterial_lst.end(); ++cit) { for(auto cit = core.xmaterial_lst.begin(); cit != core.xmaterial_lst.end(); ++cit) {
card* pcard = cit->second; card* pcard = cit->second;
if(linked_cards.find(pcard) != linked_cards.end()) if(linked_cards.find(pcard) != linked_cards.end())
......
...@@ -374,7 +374,7 @@ public: ...@@ -374,7 +374,7 @@ public:
void get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset); void get_linked_cards(uint8 self, uint8 s, uint8 o, card_set* cset);
int32 check_extra_link(int32 playerid); int32 check_extra_link(int32 playerid);
int32 check_extra_link(int32 playerid, card* pcard, int32 sequence); int32 check_extra_link(int32 playerid, card* pcard, int32 sequence);
void get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location = 0xc); void get_cards_in_zone(card_set* cset, uint32 zone, int32 playerid, int32 location);
void shuffle(uint8 playerid, uint8 location); void shuffle(uint8 playerid, uint8 location);
void reset_sequence(uint8 playerid, uint8 location); void reset_sequence(uint8 playerid, uint8 location);
void swap_deck_and_grave(uint8 playerid); void swap_deck_and_grave(uint8 playerid);
......
...@@ -424,14 +424,8 @@ int32 scriptlib::card_get_column_group(lua_State *L) { ...@@ -424,14 +424,8 @@ int32 scriptlib::card_get_column_group(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
int32 left = 0;
int32 right = 0;
if(lua_gettop(L) >= 2)
left = lua_tointeger(L, 2);
if(lua_gettop(L) >= 3)
right = lua_tointeger(L, 3);
card::card_set cset; card::card_set cset;
pcard->get_column_cards(&cset, left, right); pcard->get_column_cards(&cset);
group* pgroup = pcard->pduel->new_group(cset); group* pgroup = pcard->pduel->new_group(cset);
interpreter::group2value(L, pgroup); interpreter::group2value(L, pgroup);
return 1; return 1;
...@@ -440,14 +434,8 @@ int32 scriptlib::card_get_column_group_count(lua_State *L) { ...@@ -440,14 +434,8 @@ int32 scriptlib::card_get_column_group_count(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
int32 left = 0;
int32 right = 0;
if(lua_gettop(L) >= 2)
left = lua_tointeger(L, 2);
if(lua_gettop(L) >= 3)
right = lua_tointeger(L, 3);
card::card_set cset; card::card_set cset;
pcard->get_column_cards(&cset, left, right); pcard->get_column_cards(&cset);
lua_pushinteger(L, cset.size()); lua_pushinteger(L, cset.size());
return 1; return 1;
} }
...@@ -456,16 +444,10 @@ int32 scriptlib::card_get_column_zone(lua_State *L) { ...@@ -456,16 +444,10 @@ int32 scriptlib::card_get_column_zone(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
int32 loc = lua_tointeger(L, 2); int32 loc = lua_tointeger(L, 2);
int32 left = 0;
int32 right = 0;
int32 cp = pcard->current.controler; int32 cp = pcard->current.controler;
if(lua_gettop(L) >= 3) if(lua_gettop(L) >= 3 && !lua_isnil(L, 3))
left = lua_tointeger(L, 3); cp = lua_tointeger(L, 3);
if(lua_gettop(L) >= 4) uint32 zone = pcard->get_column_zone(loc);
right = lua_tointeger(L, 4);
if(lua_gettop(L) >= 5 && !lua_isnil(L, 5))
cp = lua_tointeger(L, 5);
uint32 zone = pcard->get_column_zone(loc, left, right);
if(cp == 1 - pcard->current.controler) if(cp == 1 - pcard->current.controler)
lua_pushinteger(L, (((zone & 0xffff) << 16) | (zone >> 16))); lua_pushinteger(L, (((zone & 0xffff) << 16) | (zone >> 16)));
else else
......
...@@ -1516,8 +1516,6 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1516,8 +1516,6 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
} }
effect* peffect = core.select_effects[returns.ivalue[0]]; effect* peffect = core.select_effects[returns.ivalue[0]];
core.units.begin()->peffect = peffect; core.units.begin()->peffect = peffect;
int32 unlimited = -1;
bool force_select = false;
core.select_effects.clear(); core.select_effects.clear();
core.select_options.clear(); core.select_options.clear();
if(ignore_count || core.summon_count[sumplayer] < get_summon_count_limit(sumplayer)) { if(ignore_count || core.summon_count[sumplayer] < get_summon_count_limit(sumplayer)) {
...@@ -1532,12 +1530,9 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1532,12 +1530,9 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
int32 new_zone = retval.size() > 1 ? retval[1] : 0x1f; int32 new_zone = retval.size() > 1 ? retval[1] : 0x1f;
int32 releasable = retval.size() > 2 ? (retval[2] < 0 ? 0xff00ff + retval[2] : retval[2]) : 0xff00ff; int32 releasable = retval.size() > 2 ? (retval[2] < 0 ? 0xff00ff + retval[2] : retval[2]) : 0xff00ff;
new_zone &= zone; new_zone &= zone;
bool unchanged = (new_zone == zone);
if(peffect) { if(peffect) {
if(new_min_tribute < (int32)min_tribute) { if(new_min_tribute < (int32)min_tribute)
new_min_tribute = min_tribute; new_min_tribute = min_tribute;
unchanged = false;
}
if(!target->is_summonable(peffect, new_min_tribute, new_zone, releasable)) if(!target->is_summonable(peffect, new_min_tribute, new_zone, releasable))
continue; continue;
} else { } else {
...@@ -1550,25 +1545,17 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1550,25 +1545,17 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
min = min_tribute; min = min_tribute;
if(max < min) if(max < min)
continue; continue;
if(min < new_min_tribute) { if(min < new_min_tribute)
min = new_min_tribute; min = new_min_tribute;
unchanged = false;
}
if(!check_tribute(target, min, max, 0, target->current.controler, new_zone, releasable)) if(!check_tribute(target, min, max, 0, target->current.controler, new_zone, releasable))
continue; continue;
} }
if(unlimited < 0 && unchanged)
unlimited = (int32)core.select_effects.size();
if(eset[i]->operation)
force_select = true;
core.select_effects.push_back(eset[i]); core.select_effects.push_back(eset[i]);
core.select_options.push_back(eset[i]->description); core.select_options.push_back(eset[i]->description);
} }
} }
if(core.select_options.size() == 1) if(core.select_options.size() == 1)
returns.ivalue[0] = 0; returns.ivalue[0] = 0;
else if(!force_select && unlimited >= 0)
returns.ivalue[0] = unlimited;
else else
add_process(PROCESSOR_SELECT_OPTION, 0, 0, 0, sumplayer, 0); add_process(PROCESSOR_SELECT_OPTION, 0, 0, 0, sumplayer, 0);
return FALSE; return FALSE;
...@@ -2062,8 +2049,6 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint ...@@ -2062,8 +2049,6 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
} }
effect* peffect = core.select_effects[returns.ivalue[0]]; effect* peffect = core.select_effects[returns.ivalue[0]];
core.units.begin()->peffect = peffect; core.units.begin()->peffect = peffect;
int32 unlimited = -1;
bool force_select = false;
core.select_effects.clear(); core.select_effects.clear();
core.select_options.clear(); core.select_options.clear();
if(ignore_count || core.summon_count[setplayer] < get_summon_count_limit(setplayer)) { if(ignore_count || core.summon_count[setplayer] < get_summon_count_limit(setplayer)) {
...@@ -2078,12 +2063,9 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint ...@@ -2078,12 +2063,9 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
int32 new_zone = retval.size() > 1 ? retval[1] : 0x1f; int32 new_zone = retval.size() > 1 ? retval[1] : 0x1f;
int32 releasable = retval.size() > 2 ? (retval[2] < 0 ? 0xff00ff + retval[2] : retval[2]) : 0xff00ff; int32 releasable = retval.size() > 2 ? (retval[2] < 0 ? 0xff00ff + retval[2] : retval[2]) : 0xff00ff;
new_zone &= zone; new_zone &= zone;
bool unchanged = (new_zone == zone);
if(peffect) { if(peffect) {
if(new_min_tribute < (int32)min_tribute) { if(new_min_tribute < (int32)min_tribute)
new_min_tribute = min_tribute; new_min_tribute = min_tribute;
unchanged = false;
}
if(!target->is_summonable(peffect, new_min_tribute, new_zone, releasable)) if(!target->is_summonable(peffect, new_min_tribute, new_zone, releasable))
continue; continue;
} else { } else {
...@@ -2096,25 +2078,17 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint ...@@ -2096,25 +2078,17 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
min = min_tribute; min = min_tribute;
if(max < min) if(max < min)
continue; continue;
if(min < new_min_tribute) { if(min < new_min_tribute)
min = new_min_tribute; min = new_min_tribute;
unchanged = false;
}
if(!check_tribute(target, min, max, 0, target->current.controler, new_zone, releasable, POS_FACEDOWN_DEFENSE)) if(!check_tribute(target, min, max, 0, target->current.controler, new_zone, releasable, POS_FACEDOWN_DEFENSE))
continue; continue;
} }
if(unlimited < 0 && unchanged)
unlimited = (int32)core.select_effects.size();
if(eset[i]->operation)
force_select = true;
core.select_effects.push_back(eset[i]); core.select_effects.push_back(eset[i]);
core.select_options.push_back(eset[i]->description); core.select_options.push_back(eset[i]->description);
} }
} }
if(core.select_options.size() == 1) if(core.select_options.size() == 1)
returns.ivalue[0] = 0; returns.ivalue[0] = 0;
else if(!force_select && unlimited >= 0)
returns.ivalue[0] = unlimited;
else else
add_process(PROCESSOR_SELECT_OPTION, 0, 0, 0, setplayer, 0); add_process(PROCESSOR_SELECT_OPTION, 0, 0, 0, setplayer, 0);
return FALSE; return FALSE;
...@@ -5067,7 +5041,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in ...@@ -5067,7 +5041,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
} }
card_set linked_cards; card_set linked_cards;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE); get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE);
if(linked_cards.find(tuner) != linked_cards.end()) if(linked_cards.find(tuner) != linked_cards.end())
ct++; ct++;
if(smat && linked_cards.find(smat) != linked_cards.end()) if(smat && linked_cards.find(smat) != linked_cards.end())
...@@ -5296,7 +5270,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc ...@@ -5296,7 +5270,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
card_set linked_cards; card_set linked_cards;
if(ct <= 0) { if(ct <= 0) {
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE); get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE);
} }
for(auto mit = core.operated_set.begin(); mit != core.operated_set.end(); ++mit) { for(auto mit = core.operated_set.begin(); mit != core.operated_set.end(); ++mit) {
card* pcard = *mit; card* pcard = *mit;
...@@ -5382,7 +5356,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc ...@@ -5382,7 +5356,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
} }
card_set linked_cards; card_set linked_cards;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE); get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE);
int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(), int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(),
[=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); }); [=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); });
if(ft > 0) { if(ft > 0) {
...@@ -5565,7 +5539,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc ...@@ -5565,7 +5539,7 @@ int32 field::select_xyz_material(int16 step, uint8 playerid, uint32 lv, card* sc
return FALSE; return FALSE;
card_set linked_cards; card_set linked_cards;
uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f; uint32 linked_zone = core.duel_rule >= 4 ? get_linked_zone(playerid) | (1u << 5) | (1u << 6) : 0x1f;
get_cards_in_zone(&linked_cards, linked_zone & 0xffff, playerid, LOCATION_MZONE); get_cards_in_zone(&linked_cards, linked_zone, playerid, LOCATION_MZONE);
int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(), int32 ft = ct + std::count_if(core.operated_set.begin(), core.operated_set.end(),
[=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); }); [=](card* pcard) { return linked_cards.find(pcard) != linked_cards.end(); });
if(ft > 0) if(ft > 0)
......
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