game timer: Add chess-style buffer time option (#10598)

* UI Changes

* Add new buffer time options

* Main functionality

* Final implementation

Also added player UI for when they are using their buffer time (timer turns green)
This commit is contained in:
Alexander Novotny 2023-07-28 22:05:21 -04:00 committed by GitHub
parent b7543af939
commit 519b3988be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 273 additions and 16 deletions

View file

@ -1,6 +1,7 @@
package mage.game.match;
import mage.constants.MatchBufferTime;
import mage.constants.MatchTimeLimit;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
@ -48,6 +49,7 @@ public class MatchOptions implements Serializable {
* Time each player has during the game to play using his\her priority.
*/
protected MatchTimeLimit matchTimeLimit; // 0 = no priorityTime handling
protected MatchBufferTime matchBufferTime; // Amount of time each player gets before their normal time limit counts down. Refreshes each time the normal timer is invoked.
protected MulliganType mulliganType;
/*public MatchOptions(String name, String gameType) {
@ -160,6 +162,21 @@ public class MatchOptions implements Serializable {
this.matchTimeLimit = matchTimeLimit;
}
public int getBufferTime() {
if (matchBufferTime == null) {
return MatchBufferTime.NONE.getBufferTime();
}
return matchBufferTime.getBufferTime();
}
public MatchBufferTime getMatchBufferTime() {
return this.matchBufferTime;
}
public void setMatchBufferTime(MatchBufferTime matchBufferTime) {
this.matchBufferTime = matchBufferTime;
}
public String getPassword() {
return password;
}