Commit 3a099257 authored by mercury233's avatar mercury233 Committed by GitHub

update unique self destroy (#204)

parent 2e3cc636
......@@ -1266,25 +1266,60 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
auto cit = cset.begin();
ucard->unique_fieldid = (*cit)->fieldid;
} else {
card* mcard = 0;
core.select_cards.clear();
uint8 player = p;
for(auto& pcard : cset) {
if(ucard->unique_fieldid == pcard->fieldid) {
mcard = pcard;
break;
if(pcard->current.controler == player && pcard->unique_fieldid != UINT_MAX)
core.select_cards.push_back(pcard);
}
if(core.select_cards.size() == 0) {
player = 1 - p;
for(auto& pcard : cset) {
if(pcard->current.controler == player && pcard->unique_fieldid != UINT_MAX)
core.select_cards.push_back(pcard);
}
if(!mcard || pcard->fieldid < mcard->fieldid)
mcard = pcard;
}
ucard->unique_fieldid = mcard->fieldid;
cset.erase(mcard);
for(auto& pcard : cset) {
pcard->temp.reason_effect = pcard->current.reason_effect;
pcard->temp.reason_player = pcard->current.reason_player;
pcard->current.reason_effect = ucard->unique_effect;
pcard->current.reason_player = ucard->current.controler;
if(core.select_cards.size() == 0) {
player = p;
for(auto& pcard : cset) {
if(pcard->current.controler == player)
core.select_cards.push_back(pcard);
}
}
if(core.select_cards.size() == 0) {
player = 1 - p;
for(auto& pcard : cset) {
if(pcard->current.controler == player)
core.select_cards.push_back(pcard);
}
}
if(core.select_cards.size() == 1) {
returns.bvalue[1] = 0;
}
destroy(&cset, 0, REASON_RULE, 5);
else {
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(player);
pduel->write_buffer32(534);
add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, player, 0x10001);
}
return FALSE;
}
return TRUE;
}
case 1: {
card_set cset;
ucard->get_unique_target(&cset, p);
card* mcard = core.select_cards[returns.bvalue[1]];
ucard->unique_fieldid = mcard->fieldid;
cset.erase(mcard);
for(auto& pcard : cset) {
pcard->temp.reason_effect = pcard->current.reason_effect;
pcard->temp.reason_player = pcard->current.reason_player;
pcard->current.reason_effect = ucard->unique_effect;
pcard->current.reason_player = ucard->current.controler;
}
destroy(&cset, 0, REASON_RULE, 5);
return TRUE;
}
case 10: {
......@@ -4445,6 +4480,8 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
core.hint_timing[pcard->current.controler] |= TIMING_POS_CHANGE;
if((opos & POS_FACEDOWN) && (npos & POS_FACEUP)) {
pcard->fieldid = infos.field_id++;
if(check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))
pcard->unique_fieldid = UINT_MAX;
if(pcard->current.location == LOCATION_MZONE) {
raise_single_event(pcard, 0, EVENT_FLIP, reason_effect, 0, reason_player, 0, flag);
flips.insert(pcard);
......
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