mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
UI: added mulligan option to new tournament dialog, added mulligan type saving;
This commit is contained in:
parent
b925977efd
commit
42658d5cff
5 changed files with 46 additions and 18 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package mage.game.mulligan;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum MulliganType {
|
||||
|
||||
GAME_DEFAULT("Game Default"),
|
||||
|
|
@ -15,7 +17,7 @@ public enum MulliganType {
|
|||
}
|
||||
|
||||
public Mulligan getMulligan(int freeMulligans) {
|
||||
switch(this) {
|
||||
switch (this) {
|
||||
case PARIS:
|
||||
return new ParisMulligan(freeMulligans);
|
||||
case CANADIAN_HIGHLANDER:
|
||||
|
|
@ -33,6 +35,20 @@ public enum MulliganType {
|
|||
return displayName;
|
||||
}
|
||||
|
||||
public static MulliganType valueByName(String name) {
|
||||
String search = (name != null ? name : "").toUpperCase(Locale.ENGLISH);
|
||||
|
||||
MulliganType res = GAME_DEFAULT;
|
||||
for (MulliganType m : values()) {
|
||||
if (m.displayName.toUpperCase(Locale.ENGLISH).equals(search)) {
|
||||
res = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public MulliganType orDefault(MulliganType defaultMulligan) {
|
||||
if (this == GAME_DEFAULT) {
|
||||
return defaultMulligan;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue