Wait 2 seconds before making the draft pick for a timed out player (#10733)

* The draft session waits for 5 seconds before making the pick for the timed out player

* Formatting

* Renamed constant

* Tweak

* If the draft pick's timeout value would increase the client's pick's timer, don't set it (might happen if the client or server is lagging)

* Lowered BOOSTER_LOADING_INTERVAL and AUTOPICK_BUFFER

---------

Co-authored-by: sprangg <a@b.c>
This commit is contained in:
sprangg 2023-08-07 03:00:42 +03:00 committed by GitHub
parent 456ea87107
commit 287df7af21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 12 deletions

View file

@ -62,12 +62,13 @@
private List<String> setCodes;
// Number of the current booster (for draft log writing).
// starts with 1
private int packNo;
private int packNo = 1;
// Number of the current card pick (for draft log writing).
// starts with 1
private int pickNo;
private int pickNo = 1;
// Number of the latest card pick for which the timeout has been set.
private int timeoutPickNo = 0;
// Cached booster data to be written into the log (see logLastPick).
private String[] currentBooster;
@ -297,12 +298,16 @@
MageTray.instance.displayMessage("Pick the next card.");
MageTray.instance.blink();
}
countdown.stop();
this.timeout = draftPickView.getTimeout();
setTimeout(timeout);
if (timeout != 0) {
countdown.start();
int newTimeout = draftPickView.getTimeout();
if (pickNo != timeoutPickNo || newTimeout < timeout) { // if the timeout would increase the current pick's timer, don't set it (might happen if the client or server is lagging)
timeoutPickNo = pickNo;
countdown.stop();
timeout = newTimeout;
setTimeout(timeout);
if (timeout != 0) {
countdown.start();
}
}
if (!draftBooster.isEmptyGrid()) {