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

@ -0,0 +1,41 @@
package mage.constants;
/**
* The time a player receives whenever the timer starts. This ticks down before their normal time,
* and refreshes to full every time the timer starts, creating a sort of buffer. Similar to how to
* chess clocks work.
*
* Based off of MatchTimeLimit
*
* @author alexander-novo
*/
public enum MatchBufferTime {
NONE(0, "None"),
SEC__05(5, "5 Seconds"),
SEC__10(10, "10 Seconds"),
SEC__15(15, "15 Seconds"),
SEC__20(20, "20 Seconds"),
SEC__25(25, "25 Seconds"),
SEC__30(30, "30 Seconds");
private final int matchSeconds;
private final String name;
MatchBufferTime(int matchSeconds, String name) {
this.matchSeconds = matchSeconds;
this.name = name;
}
public int getBufferTime() {
return matchSeconds;
}
public String getName() {
return name;
}
@Override
public String toString() {
return name;
}
}