Game: making sure that the pick timer is always at least 1 second (unless it's set to 0 deliberately) (#9850)

Co-authored-by: sprangg <a@b.c>
This commit is contained in:
sprangg 2023-03-04 14:11:16 +02:00 committed by GitHub
parent c8e02755bb
commit 1a96b0f065
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -310,7 +310,12 @@ public abstract class DraftImpl implements Draft {
public void firePickCardEvent(UUID playerId) {
DraftPlayer player = players.get(playerId);
int cardNum = Math.min(15, this.cardNum);
int time = timing.getPickTimeout(cardNum) - boosterLoadingCounter * BOOSTER_LOADING_INTERVAL;
int time = timing.getPickTimeout(cardNum);
// if the pack is re-sent to a player because they haven't been able to successfully load it, the pick time is reduced appropriately because of the elapsed time
// the time is always at least 1 second unless it's set to 0, i.e. unlimited time
if (time > 0) {
time = Math.max(1, time - boosterLoadingCounter * BOOSTER_LOADING_INTERVAL);
}
playerQueryEventSource.pickCard(playerId, "Pick card", player.getBooster(), time);
}