Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions Game/GameBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1601,12 +1601,25 @@ private void OnSelectSum(BinaryReader packet)
}
}

for (int k = 0; k < mandatoryCards.Count; ++k)
IList<ClientCard> selected = SelectSumRecursive(0, sumval);

IList<ClientCard> SelectSumRecursive(int cardIndex, int sumVal)
{
sumval -= mandatoryCards[k].OpParam1;
if (cardIndex >= mandatoryCards.Count) return _ai.OnSelectSum(cards, sumVal, min, max, _select_hint, mode);

ClientCard card = mandatoryCards[cardIndex];
for (int opParam = 0; opParam < 2; opParam++)
{
int opParamValue = opParam == 0 ? card.OpParam1 : card.OpParam2;
int tempSumVal = sumVal - opParamValue;

IList<ClientCard> tempResult = SelectSumRecursive(cardIndex + 1, tempSumVal);
if (tempResult.Count >= min) return tempResult;
}

return new List<ClientCard>();
}

IList<ClientCard> selected = _ai.OnSelectSum(cards, sumval, min, max, _select_hint, mode);
_select_hint = 0;

byte[] result = new byte[mandatoryCards.Count + selected.Count + 1];
Expand Down