mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Refactor variant descriptions into GameType enum
This commit is contained in:
@@ -13,19 +13,19 @@ import forge.game.player.RegisteredPlayer;
|
||||
public enum GameType {
|
||||
|
||||
// deck composition rules, isPoolRestricted, can sideboard between matches
|
||||
Sealed (DeckFormat.Limited, true, true, true, "Sealed", null),
|
||||
Draft (DeckFormat.Limited, true, true, true, "Draft", null),
|
||||
Winston (DeckFormat.Limited, true, true, true, "Winston", null),
|
||||
Gauntlet (DeckFormat.Limited, true, true, true, "Gauntlet", null),
|
||||
Quest (DeckFormat.QuestDeck, true, true, false, "Quest", null),
|
||||
QuestDraft (DeckFormat.Limited, true, true, true, "Quest Draft", null),
|
||||
Constructed (DeckFormat.Constructed, false, true, true, "Constructed", null),
|
||||
Vanguard (DeckFormat.Vanguard, true, true, true, "Vanguard", null),
|
||||
Commander (DeckFormat.Commander, false, false, false, "Commander", null),
|
||||
Planechase (DeckFormat.Planechase, false, false, true, "Planechase", null),
|
||||
Archenemy (DeckFormat.Archenemy, false, false, true, "Archenemy", null),
|
||||
ArchenemyRumble (DeckFormat.Archenemy, false, false, true, "Archenemy Rumble", null),
|
||||
MomirBasic (DeckFormat.Constructed, false, false, false, "Momir Basic", new Function<RegisteredPlayer, Deck>() {
|
||||
Sealed (DeckFormat.Limited, true, true, true, "Sealed", "", null),
|
||||
Draft (DeckFormat.Limited, true, true, true, "Draft", "", null),
|
||||
Winston (DeckFormat.Limited, true, true, true, "Winston", "", null),
|
||||
Gauntlet (DeckFormat.Limited, true, true, true, "Gauntlet", "", null),
|
||||
Quest (DeckFormat.QuestDeck, true, true, false, "Quest", "", null),
|
||||
QuestDraft (DeckFormat.Limited, true, true, true, "Quest Draft", "", null),
|
||||
Constructed (DeckFormat.Constructed, false, true, true, "Constructed", "", null),
|
||||
Vanguard (DeckFormat.Vanguard, true, true, true, "Vanguard", "Each player has a special \"Avatar\" card that affects the game.", null),
|
||||
Commander (DeckFormat.Commander, false, false, false, "Commander", "Each player has a legendary \"General\" card which can be cast at any time and determines deck colors.", null),
|
||||
Planechase (DeckFormat.Planechase, false, false, true, "Planechase", "Plane cards apply global effects. Plane card changed when a player rolls \"Chaos\" on the planar die.", null),
|
||||
Archenemy (DeckFormat.Archenemy, false, false, true, "Archenemy", "One player is the Archenemy and can play scheme cards.", null),
|
||||
ArchenemyRumble (DeckFormat.Archenemy, false, false, true, "Archenemy Rumble", "All players are Archenemies and can play scheme cards.", null),
|
||||
MomirBasic (DeckFormat.Constructed, false, false, false, "Momir Basic", "Each player has a deck containing 60 basic lands and the Momir Vig avatar.", new Function<RegisteredPlayer, Deck>() {
|
||||
@Override
|
||||
public Deck apply(RegisteredPlayer player) {
|
||||
Deck deck = new Deck();
|
||||
@@ -43,15 +43,16 @@ public enum GameType {
|
||||
|
||||
private final DeckFormat deckFormat;
|
||||
private final boolean isCardPoolLimited, canSideboard, addWonCardsMidGame;
|
||||
private final String name;
|
||||
private final String name, description;
|
||||
private final Function<RegisteredPlayer, Deck> deckAutoGenerator;
|
||||
|
||||
GameType(DeckFormat deckFormat0, boolean isCardPoolLimited0, boolean canSideboard0, boolean addWonCardsMidgame0, String name0, Function<RegisteredPlayer, Deck> deckAutoGenerator0) {
|
||||
GameType(DeckFormat deckFormat0, boolean isCardPoolLimited0, boolean canSideboard0, boolean addWonCardsMidgame0, String name0, String description0, Function<RegisteredPlayer, Deck> deckAutoGenerator0) {
|
||||
deckFormat = deckFormat0;
|
||||
isCardPoolLimited = isCardPoolLimited0;
|
||||
canSideboard = canSideboard0;
|
||||
addWonCardsMidGame = addWonCardsMidgame0;
|
||||
name = name0;
|
||||
description = description0;
|
||||
deckAutoGenerator = deckAutoGenerator0;
|
||||
}
|
||||
|
||||
@@ -104,4 +105,8 @@ public enum GameType {
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import forge.screens.home.*;
|
||||
import forge.toolbox.*;
|
||||
import forge.toolbox.FSkin.SkinColor;
|
||||
import forge.toolbox.FSkin.SkinImage;
|
||||
import forge.util.GuiDisplayUtil;
|
||||
import forge.util.Lang;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.NameGenerator;
|
||||
@@ -1144,7 +1143,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
|
||||
variantType = variantType0;
|
||||
|
||||
setToolTipText(GuiDisplayUtil.getVariantDescription(variantType0));
|
||||
setToolTipText(variantType.getDescription());
|
||||
|
||||
addItemListener(new ItemListener() {
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,6 @@ import forge.toolbox.FOptionPane;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.toolbox.FTextField;
|
||||
import forge.util.Callback;
|
||||
import forge.util.GuiDisplayUtil;
|
||||
import forge.util.Lang;
|
||||
import forge.util.NameGenerator;
|
||||
import forge.util.Utils;
|
||||
@@ -951,11 +950,9 @@ public class ConstructedScreen extends LaunchScreen {
|
||||
|
||||
private class Variant {
|
||||
private final GameType gameType;
|
||||
private final String description;
|
||||
|
||||
private Variant(GameType gameType0) {
|
||||
gameType = gameType0;
|
||||
description = GuiDisplayUtil.getVariantDescription(gameType0);
|
||||
}
|
||||
|
||||
private void draw(Graphics g, FSkinFont font, FSkinColor color, float x, float y, float w, float h) {
|
||||
@@ -1026,7 +1023,7 @@ public class ConstructedScreen extends LaunchScreen {
|
||||
g.drawText(text, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false);
|
||||
value.draw(g, font, foreColor, x, y, w, h);
|
||||
h += SettingsScreen.SETTING_PADDING;
|
||||
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + w * SettingsScreen.INSETS_FACTOR, true, HAlignment.LEFT, false);
|
||||
g.drawText(value.gameType.getDescription(), SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + w * SettingsScreen.INSETS_FACTOR, true, HAlignment.LEFT, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,23 +519,4 @@ public final class GuiDisplayUtil {
|
||||
String playerName = FModel.getPreferences().getPref(FPref.PLAYER_NAME);
|
||||
return text.replaceAll("(?i)human", playerName);
|
||||
}
|
||||
|
||||
public static String getVariantDescription(GameType variant) {
|
||||
switch (variant) {
|
||||
case Archenemy:
|
||||
return "One player is the Archenemy and can play scheme cards.";
|
||||
case ArchenemyRumble:
|
||||
return "All players are Archenemies and can play scheme cards.";
|
||||
case Commander:
|
||||
return "Each player has a legendary \"General\" card which can be cast at any time and determines deck colors.";
|
||||
case MomirBasic:
|
||||
return "Each player has a deck containing 60 basic lands and the Momir Vig avatar.";
|
||||
case Planechase:
|
||||
return "Plane cards apply global effects. Plane card changed when a player rolls \"Chaos\" on the planar die.";
|
||||
case Vanguard:
|
||||
return "Each player has a special \"Avatar\" card that affects the game.";
|
||||
default:
|
||||
return ""; //other game types don't need descriptions
|
||||
}
|
||||
}
|
||||
} // end class GuiDisplayUtil
|
||||
|
||||
Reference in New Issue
Block a user