Skip to content

Commit

Permalink
Fix other logic update errors in SelectRelease/tribute
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Apr 1, 2024
1 parent bde406b commit f4fcb53
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5757,14 +5757,15 @@ bool field::process(Processors::SelectRelease& arg) {
if(arg.extra_release_nonsum_effect == nullptr)
diff.insert(diff.begin(), core.release_cards_ex_oneof.begin(), core.release_cards_ex_oneof.end());
}
std::sort(diff.begin(), diff.end(), card_sort());
std::set_difference(diff.begin(), diff.end(), core.unselect_cards.begin(), core.unselect_cards.end(),
std::inserter(core.select_cards, core.select_cards.begin()), card_sort());

auto message = pduel->new_message(MSG_HINT);
message->write<uint8_t>(HINT_SELECTMSG);
message->write<uint8_t>(playerid);
message->write<uint64_t>(500);
emplace_process<Processors::SelectUnselectCard>(playerid, cancelable, min, max, finishable);
emplace_process<Processors::SelectUnselectCard>(playerid, finishable || core.operated_set.empty(), min, max, finishable);
return FALSE;
}
case 3: {
Expand Down Expand Up @@ -5897,10 +5898,15 @@ bool field::process(Processors::SelectTribute& arg) {
rmax += pcard->release_param;
auto oldmin = min;
auto oldmax = max;
min -= rmax;
max -= rmin;
min = min > 0 ? min : 0;
max = max > 0 ? max : 0;
if(rmax > min)
min = 0;
else
min -= rmax;

if(rmin > max)
max = 0;
else
max -= rmin;
auto& must_choose_one = arg.must_choose_one;
bool force = !must_choose_one.empty();
for(auto& pcard : must_choose_one) {
Expand Down Expand Up @@ -5939,8 +5945,8 @@ bool field::process(Processors::SelectTribute& arg) {
if(core.operated_set.find(pcard) == core.operated_set.end())
core.select_cards.push_back(pcard);
}
uint8_t canc = (rmin == 0 && cancelable);
uint8_t finishable = (min <= 0 && !force && !exsize) ? TRUE : FALSE;
auto canc = (rmin == 0 && cancelable);
auto finishable = min == 0 && !force && !exsize;
for(auto& pcard : core.operated_set)
core.unselect_cards.push_back(pcard);
auto message = pduel->new_message(MSG_HINT);
Expand Down

0 comments on commit f4fcb53

Please sign in to comment.